summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-01-16 17:04:42 +0000
committerjhb <jhb@FreeBSD.org>2007-01-16 17:04:42 +0000
commit0de926dfd1d79b809a414cb250d0aa4f54590c15 (patch)
tree504649b73a5fe137d3a70f03305fc5afbb42491f /sys/dev/pci
parent067aec5afddd21ace5e0a6e9e54d840b30e14225 (diff)
downloadFreeBSD-src-0de926dfd1d79b809a414cb250d0aa4f54590c15.zip
FreeBSD-src-0de926dfd1d79b809a414cb250d0aa4f54590c15.tar.gz
Fix the subvendor ID for PCI-PCI bridges.
- Retire the PCI_SUB*_1 constants and don't try to read a subvendor ID out of them. There isn't a standard subvendor ID field for PCI-PCI bridges. Instead, the dword at offset 0x34 is actually mostly reserved except for the LSB which is the capabilities pointer. - Add support for the PCI-PCI bridge subvendor ID capability (13) and use it to set the subvendor ID for PCI-PCI bridges. MFC after: 1 month
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci.c9
-rw-r--r--sys/dev/pci/pcireg.h7
2 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 018de34..3b03313 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -385,8 +385,6 @@ pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg)
cfg->nummaps = PCI_MAXMAPS_0;
break;
case 1:
- cfg->subvendor = REG(PCIR_SUBVEND_1, 2);
- cfg->subdevice = REG(PCIR_SUBDEV_1, 2);
cfg->nummaps = PCI_MAXMAPS_1;
break;
case 2:
@@ -567,6 +565,13 @@ pci_read_extcap(device_t pcib, pcicfgregs *cfg)
cfg->vpd.vpd_reg = ptr;
pci_read_vpd(pcib, cfg);
break;
+ case PCIY_SUBVENDOR:
+ /* Should always be true. */
+ if ((cfg->hdrtype & PCIM_HDRTYPE) == 1) {
+ val = REG(ptr + PCIR_SUBVENDCAP_ID, 4);
+ cfg->subvendor = val & 0xffff;
+ cfg->subdevice = val >> 16;
+ }
default:
break;
}
diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h
index 244cc94..2fe430e 100644
--- a/sys/dev/pci/pcireg.h
+++ b/sys/dev/pci/pcireg.h
@@ -107,6 +107,7 @@
#define PCIY_DEBUG 0x0a /* Debug port */
#define PCIY_CRES 0x0b /* CompactPCI central resource control */
#define PCIY_HOTPLUG 0x0c /* PCI Hot-Plug */
+#define PCIY_SUBVENDOR 0x0d /* PCI-PCI bridge subvendor ID */
#define PCIY_AGP8X 0x0e /* AGP 8x */
#define PCIY_SECDEV 0x0f /* Secure Device */
#define PCIY_EXPRESS 0x10 /* PCI Express */
@@ -167,9 +168,6 @@
#define PCIR_BRIDGECTL_1 0x3e
-#define PCIR_SUBVEND_1 0x34
-#define PCIR_SUBDEV_1 0x36
-
/* config registers for header type 2 (CardBus) devices */
#define PCIR_CAP_PTR_2 0x14
@@ -452,6 +450,9 @@
#define PCIR_HTMSI_ADDRESS_LO 0x4
#define PCIR_HTMSI_ADDRESS_HI 0x8
+/* PCI-PCI Bridge Subvendor definitions */
+#define PCIR_SUBVENDCAP_ID 0x4
+
/* MSI-X definitions */
#define PCIR_MSIX_CTRL 0x2
#define PCIM_MSIXCTRL_MSIX_ENABLE 0x8000
OpenPOWER on IntegriCloud