diff options
author | jhb <jhb@FreeBSD.org> | 2010-09-16 16:03:12 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-09-16 16:03:12 +0000 |
commit | 39642e55302d3d222f5a118fb3a4c6eb91d7e5a0 (patch) | |
tree | 5b310d944ecd9ae87044c153566142f7a6b2a4c1 /usr.sbin/pciconf | |
parent | c24aa138ad5069ce7bb3a791efb6736b43b1067e (diff) | |
download | FreeBSD-src-39642e55302d3d222f5a118fb3a4c6eb91d7e5a0.zip FreeBSD-src-39642e55302d3d222f5a118fb3a4c6eb91d7e5a0.tar.gz |
Only attempt to list extended capabilities for devices that have a
PCI-express capabilities. Non-PCI-express PCI devices may simply ignore
the upper bits in a config register address effectively aliasing the
device ID register to 0x100 rather than returning 0xFFFFFFFF. Previously
the code relied on these reads returning 0xFFFFFFFF.
MFC after: 3 days
Diffstat (limited to 'usr.sbin/pciconf')
-rw-r--r-- | usr.sbin/pciconf/cap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c index 9e6a671..605add8 100644 --- a/usr.sbin/pciconf/cap.c +++ b/usr.sbin/pciconf/cap.c @@ -460,6 +460,7 @@ cap_pciaf(int fd, struct pci_conf *p, uint8_t ptr) void list_caps(int fd, struct pci_conf *p) { + int express; uint16_t sta; uint8_t ptr, cap; @@ -481,6 +482,7 @@ list_caps(int fd, struct pci_conf *p) } /* Walk the capability list. */ + express = 0; ptr = read_config(fd, &p->pc_sel, ptr, 1); while (ptr != 0 && ptr != 0xff) { cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1); @@ -514,6 +516,7 @@ list_caps(int fd, struct pci_conf *p) cap_subvendor(fd, p, ptr); break; case PCIY_EXPRESS: + express = 1; cap_express(fd, p, ptr); break; case PCIY_MSIX: @@ -533,7 +536,8 @@ list_caps(int fd, struct pci_conf *p) ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1); } - list_ecaps(fd, p); + if (express) + list_ecaps(fd, p); } /* From <sys/systm.h>. */ |