summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@gmail.com>2008-11-19 03:05:33 +0000
committerMyles Watson <mylesgw@gmail.com>2008-11-19 03:05:33 +0000
commit12a3094274be163825b59407dfa9641e2d9b41d3 (patch)
tree42ba931831d6355d76832f194f7b33636ffcfd74
parent09f70836fdeed2970e8b7d0e946b7a633ff77ff6 (diff)
downloadcoreboot-12a3094274be163825b59407dfa9641e2d9b41d3.tar.gz
coreboot-12a3094274be163825b59407dfa9641e2d9b41d3.tar.bz2
coreboot-12a3094274be163825b59407dfa9641e2d9b41d3.zip
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
-rw-r--r--device/pci_device.c52
-rw-r--r--mainboard/amd/serengeti/dts2
-rw-r--r--util/dtc/flattree.c8
3 files changed, 32 insertions, 30 deletions
diff --git a/device/pci_device.c b/device/pci_device.c
index 2fc845ac9c1f..f07833e0cf1f 100644
--- a/device/pci_device.c
+++ b/device/pci_device.c
@@ -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;
-
-#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. */
+ u16 vendor = dev->id.pci.vendor;
+ u16 device = dev->id.pci.device;
+
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;
+
+ /* 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;
- ops->set_subsystem(dev, vendor, device);
- } else {
- printk(BIOS_DEBUG, "%s: Not setting subsystem VID/DID\n",
- dev_path(dev));
- }
+ 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));
+ }
+ }
}
diff --git a/mainboard/amd/serengeti/dts b/mainboard/amd/serengeti/dts
index 97c290288baf..1a5223c54d4a 100644
--- a/mainboard/amd/serengeti/dts
+++ b/mainboard/amd/serengeti/dts
@@ -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 {
};
diff --git a/util/dtc/flattree.c b/util/dtc/flattree.c
index 3b2a6d4323a3..d1d1afd67959 100644
--- a/util/dtc/flattree.c
+++ b/util/dtc/flattree.c
@@ -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);
}