On 26.09.19 18:45, Aaron Durbin via coreboot wrote: > Here's some of the requirements/issues we should resolve that come to mind: > > 1. Easy way to directly retrieve a device's chip config object w/o > traversing the device hierarchy. Which leads to... > 2. Symbol alias for accessing struct device directly (no bdf lookup)
What we already have: Static pointers to `struct device` for devices with a globally valid address (PCI devices on bus 0 and PNP devices), e.g.: DEVTREE_CONST struct device *DEVTREE_CONST __pci_0_02_0 = &_dev6; DEVTREE_CONST struct device *DEVTREE_CONST __pnp_002e_00 = &_dev56; What I suggested somewhere on Gerrit: At the chip driver level, add a header file that maps these to more distinct names, e.g. #define igd_dev __pci_0_02_0; But that was last week. Since then I've written yet another override tree and realized something. We write a lot lines like device pci 02.0 on end # Integrated Graphics Device What's wrong with that? (if you know me it's obvious) there is a comment! IIRC, Kyösti suggested it already, we could let sconfig read a chip specific mapping for device names. That would also allow us to write the above as device igd on end Mapping could look like this: device pci 00.0 alias mch device pci 02.0 alias igd and we could directly generate pointers with these names: DEVTREE_CONST struct device *DEVTREE_CONST igd_dev = &_dev6; Limitations: Actually, chip drivers can't provide global names. What should sconfig generate if a second instance of a chip pops up? So the generated pointers must somehow be limited to chips that can only occur once, e.g. PCH, single socket CPU. What do you think? Nico _______________________________________________ coreboot mailing list -- coreboot@coreboot.org To unsubscribe send an email to coreboot-le...@coreboot.org