Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Sep 2010 16:03:13 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r212749 - head/usr.sbin/pciconf
Message-ID:  <201009161603.o8GG3DUJ098103@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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>. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009161603.o8GG3DUJ098103>