Author: jhb
Date: Thu Sep 16 16:03:12 2010
New Revision: 212749
URL: http://svn.freebsd.org/changeset/base/212749

Log:
  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

Modified:
  head/usr.sbin/pciconf/cap.c

Modified: head/usr.sbin/pciconf/cap.c
==============================================================================
--- head/usr.sbin/pciconf/cap.c Thu Sep 16 15:42:56 2010        (r212748)
+++ head/usr.sbin/pciconf/cap.c Thu Sep 16 16:03:12 2010        (r212749)
@@ -460,6 +460,7 @@ cap_pciaf(int fd, struct pci_conf *p, ui
 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>. */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to