Author: myles Date: 2008-11-19 04:05:33 +0100 (Wed, 19 Nov 2008) New Revision: 1045
Modified: coreboot-v3/device/pci_device.c coreboot-v3/mainboard/amd/serengeti/dts coreboot-v3/util/dtc/flattree.c Log: This patch makes subsystem ids work. Here are the changes by file:
device/pci_device.c: Only update IDs if: - The device is on the mainboard - The device has a Vendor ID and Device ID - The device has a set_subsystem function in ops_pci(dev)
util/dtc/flattree.c: Make devices from the dts be on_mainboard. If they're plugged in, they shouldn't be in the dts.
mainboard/amd/serengeti/dts: Add subsystem_vendor and subsystem_device.
Build tested on Serengeti. Getting closer :)
Signed-off-by: Myles Watson mylesgw@gmail.com Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: coreboot-v3/device/pci_device.c =================================================================== --- coreboot-v3/device/pci_device.c 2008-11-18 22:32:05 UTC (rev 1044) +++ coreboot-v3/device/pci_device.c 2008-11-19 03:05:33 UTC (rev 1045) @@ -632,38 +632,36 @@ void pci_dev_set_subsystem_wrapper(struct device *dev) { const struct pci_operations *ops; - u16 vendor = 0; - u16 device = 0; + u16 vendor = dev->id.pci.vendor; + u16 device = dev->id.pci.device;
-#warning Per-device subsystem ID has to be set here, but for that we have to extend the dts. - -#ifdef HAVE_MAINBOARD_PCI_SUBSYSTEM_ID - /* If there's no explicit subsystem ID for this device and the device - * is onboard, use the board defaults. */ - if (dev->on_mainboard) { - if (!vendor) - vendor = mainboard_pci_subsystem_vendor; - if (!device) - device = mainboard_pci_subsystem_device; - } else { - printk(BIOS_DEBUG, "%s: Device not on_mainboard\n", - dev_path(dev)); - } -#endif - /* Set the subsystem vendor and device ID for mainboard devices. */ ops = ops_pci(dev);
/* If either vendor or device is zero, we leave it as is. */ if (ops && ops->set_subsystem && vendor && device) { - printk(BIOS_DEBUG, - "%s: Setting subsystem VID/DID to %02x/%02x\n", - dev_path(dev), vendor, device); + /* If there's no explicit subsystem ID for this device and the + * device is onboard, use the board defaults. */ + vendor = dev->subsystem_vendor; + device = dev->subsystem_device;
- ops->set_subsystem(dev, vendor, device); - } else { - printk(BIOS_DEBUG, "%s: Not setting subsystem VID/DID\n", - dev_path(dev)); - } + /* Set the subsystem vendor and device ID for mainboard devices. */ + if (dev->on_mainboard) { + if (!vendor) + vendor = dev_root.subsystem_vendor; + if (!device) + device = dev_root.subsystem_device; + + printk(BIOS_DEBUG, + "%s: Setting subsystem VID/DID to %02x/%02x\n", + dev_path(dev), vendor, device); + + ops->set_subsystem(dev, vendor, device); + + } else { + printk(BIOS_DEBUG, "%s: Device not on_mainboard\n", + dev_path(dev)); + } + } }
Modified: coreboot-v3/mainboard/amd/serengeti/dts =================================================================== --- coreboot-v3/mainboard/amd/serengeti/dts 2008-11-18 22:32:05 UTC (rev 1044) +++ coreboot-v3/mainboard/amd/serengeti/dts 2008-11-19 03:05:33 UTC (rev 1045) @@ -22,6 +22,8 @@ device_operations="serengeti"; mainboard_vendor = "AMD"; mainboard_name = "Serengeti"; + subsystem_vendor = "PCI_VENDOR_ID_AMD"; + subsystem_device = "0x2b80"; cpus { }; apic@0 { };
Modified: coreboot-v3/util/dtc/flattree.c =================================================================== --- coreboot-v3/util/dtc/flattree.c 2008-11-18 22:32:05 UTC (rev 1044) +++ coreboot-v3/util/dtc/flattree.c 2008-11-19 03:05:33 UTC (rev 1045) @@ -648,11 +648,13 @@ * then a variable is set to 1 (e.g. on_mainboard); * and some are just set directly into the code (e.g. ops_pci). */ + + /* If it's in the tree, it's on the mainboard. */ + fprintf(f, "\t.on_mainboard = 1,\n"); + for_each_property(tree, prop) { /* to do: check the value, maybe. Kinda pointless though. */ - if (streq(prop->name, "on_mainboard")){ - fprintf(f, "\t.on_mainboard = 1,\n"); - } + if (streq(prop->name, "subsystem_vendor")){ fprintf(f, "\t.subsystem_vendor = %s,\n", prop->val.val); }