On Fri, Sep 27, 2019 at 11:11 AM Nico Huber <
nico.h@gmx.de> wrote:
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
Have you pushed this patch?
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
We can do this in 2 stages, I think, right? Or were you wanting to push a mapping along with the alias wording? I could run with what you had prior in patch from the get go and follow up with further clean up.
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