mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
I just uncovered this problem while trying to get the lx going. The symptom was that the northbridge ops were never getting run, in particular the phase 2 ops for the geodelx were not running. The reason was that the ops struct member for the device was not set. How is the ops struct member set? Currently, the ops vector for a static device (i.e. a device created from the dts) has to be set by hand, as in mainboard/emulation/qemu-x86/dts: domain0 { /config/("northbridge/intel/i440bxemulation"); ops = "i440bxemulation_pcidomainops"; This requirement is ridiculous (it's my fault). If we know the part, and have the dts, we should not have to explicitly name the ops. In fact the constructors array, defined at the end of the various device files, makes searching for an ops struct for a dynamic device automatic. We should support this automatic behavior for static devices too. Given the function find_constructor in device/device.c, why don't we just use that? The problem is that we did not set up the device struct to include a device id, just a device path, and find_constructor requires a device_id -- which makes sense, I hope, as the path is its pci path (e.g. 0:1.0) and the constructors are defined by the device id (i.e. it is the same constructor for a given part, no matter how many of the part we have). So, as a start to fixing this limitation (this is going to take several patches), I've done the following: 1. add a struct device_id to the device struct. 2. extended the dev_init code in device/device.c -- this is the first function called from lib/stage2.c -- to find a constructor for the dev->id and, if found, set dev->ops to it. Result: for static devices with the id set, the ops pointer will be set automatically. Coreboot builds fine with this change. The next change will be to add dtc commands to set ids. Currently, we have commands like pcipath, pcidomain, etc.; the new commands will look like pciid, domainid, etc. Once we have these commands, we will have made it possible to set ops automatically. We can just set the ids in the device dts file, and users will never have to see any of this complication. The final change will be a bit more complicated. Right now, if you look in, e.g., northbridge/amd/geodelx/dts, you'll see that we have one dts, but the northbridge plays three roles. We can't easily contain those three roles in one dts (I am open to suggestions showing I am wrong). I am going to propose that we have more than one dts file in a directory, so instead of northbridge/amd/geodelx/dts we would have northbridge/amd/geodelx/dtsdomain northbridge/amd/geodelx/dtsapic northbridge/amd/geodelx/dtspci so that we could set the variables for each of these individual components. There is no need to split geodelx.c into three .c files, however. Finally, I will be removing the archaic vendor and device unsigned's from the device struct in future, but as I say, I am trying to stage these changes to keep them understandable. Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://coreboot.org/repository/coreboot-v3@556 f3766cd6-281f-0410-b1cd-43a5c92072e9 |
||
---|---|---|
.. | ||
agp.h | ||
cardbus.h | ||
device.h | ||
hypertransport.h | ||
hypertransport_def.h | ||
path.h | ||
pci.h | ||
pci_def.h | ||
pci_ids.h | ||
pci_ops.h | ||
pci_rom.h | ||
pcie.h | ||
pcix.h | ||
pnp.h | ||
resource.h | ||
smbus.h | ||
smbus_def.h |