PCI: populate subsystem vendor and device IDs for PCI bridges
authorGabe Black <gabe.black@ni.com>
Tue, 6 Oct 2009 15:45:19 +0000 (10:45 -0500)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 4 Nov 2009 21:06:36 +0000 (13:06 -0800)
Change to populate the subsystem vendor and subsytem device IDs for
PCI-PCI bridges that implement the PCI Subsystem Vendor ID capability.
Previously bridges left subsystem vendor IDs unpopulated.

Signed-off-by: Gabe Black <gabe.black@ni.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/probe.c
include/linux/pci_regs.h

index 118463befef0262846b92a665f387e18f778b794..4842b09b7f3c64a077ece20bc6eb717dc919ede2 100644 (file)
@@ -730,6 +730,7 @@ int pci_setup_device(struct pci_dev *dev)
        u32 class;
        u8 hdr_type;
        struct pci_slot *slot;
+       int pos = 0;
 
        if (pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type))
                return -EIO;
@@ -822,6 +823,11 @@ int pci_setup_device(struct pci_dev *dev)
                dev->transparent = ((dev->class & 0xff) == 1);
                pci_read_bases(dev, 2, PCI_ROM_ADDRESS1);
                set_pcie_hotplug_bridge(dev);
+               pos = pci_find_capability(dev, PCI_CAP_ID_SSVID);
+               if (pos) {
+                       pci_read_config_word(dev, pos + PCI_SSVID_VENDOR_ID, &dev->subsystem_vendor);
+                       pci_read_config_word(dev, pos + PCI_SSVID_DEVICE_ID, &dev->subsystem_device);
+               }
                break;
 
        case PCI_HEADER_TYPE_CARDBUS:               /* CardBus bridge header */
index d798770f08cd6b5bfce71091131a7ffae9f02d03..9f2ad0aa3c3961ae1ba55c981b815815e6cd35b7 100644 (file)
 #define  PCI_X_STATUS_266MHZ   0x40000000      /* 266 MHz capable */
 #define  PCI_X_STATUS_533MHZ   0x80000000      /* 533 MHz capable */
 
+/* PCI Bridge Subsystem ID registers */
+
+#define PCI_SSVID_VENDOR_ID     4      /* PCI-Bridge subsystem vendor id register */
+#define PCI_SSVID_DEVICE_ID     6      /* PCI-Bridge subsystem device id register */
+
 /* PCI Express capability registers */
 
 #define PCI_EXP_FLAGS          2       /* Capabilities register */