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>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@1045 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Myles Watson 2008-11-19 03:05:33 +00:00
commit 12a3094274
3 changed files with 32 additions and 30 deletions

View file

@ -632,38 +632,36 @@ void ram_resource(struct device *dev, unsigned long index,
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));
}
}
}

View file

@ -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 {
};

View file

@ -648,11 +648,13 @@ static void coreboot_emit_special(FILE *e, struct node *tree)
* 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);
}