From owner-svn-src-head@FreeBSD.ORG Thu Sep 16 16:03:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 455FE106564A; Thu, 16 Sep 2010 16:03:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34B6B8FC0A; Thu, 16 Sep 2010 16:03:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8GG3DKP098105; Thu, 16 Sep 2010 16:03:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8GG3DUJ098103; Thu, 16 Sep 2010 16:03:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009161603.o8GG3DUJ098103@svn.freebsd.org> From: John Baldwin Date: Thu, 16 Sep 2010 16:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212749 - head/usr.sbin/pciconf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2010 16:03:13 -0000 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 . */