From owner-svn-src-head@FreeBSD.ORG Thu Apr 3 22:32:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8CEB9754; Thu, 3 Apr 2014 22:32:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A3A5836; Thu, 3 Apr 2014 22:32:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s33MWDcI029642; Thu, 3 Apr 2014 22:32:13 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s33MWDlj029641; Thu, 3 Apr 2014 22:32:13 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201404032232.s33MWDlj029641@svn.freebsd.org> From: Ryan Stone Date: Thu, 3 Apr 2014 22:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264091 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 03 Apr 2014 22:32:13 -0000 Author: rstone Date: Thu Apr 3 22:32:12 2014 New Revision: 264091 URL: http://svnweb.freebsd.org/changeset/base/264091 Log: Correct a PCI enumeration bug introduced in r264011 Ensure that first_func is set to 0 on every iteration of the PCI slot enumeration loop after the first. There is a continue statement that would cause first_func to stay at 1 any PCI device where slot 0 has no functions until we find a slot that does have a function. This would cause us to not enumerate the first PCI function on the device. Credit to markj@ for spotting the bug. X-MFC-With: r264011 Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Apr 3 22:22:10 2014 (r264090) +++ head/sys/dev/pci/pci.c Thu Apr 3 22:32:12 2014 (r264091) @@ -3503,7 +3503,7 @@ pci_add_children(device_t dev, int domai KASSERT(dinfo_size >= sizeof(struct pci_devinfo), ("dinfo_size too small")); maxslots = PCIB_MAXSLOTS(pcib); - for (s = 0; s <= maxslots; s++) { + for (s = 0; s <= maxslots; s++, first_func = 0) { pcifunchigh = 0; f = 0; DELAY(1); @@ -3515,9 +3515,6 @@ pci_add_children(device_t dev, int domai for (f = first_func; f <= pcifunchigh; f++) pci_identify_function(pcib, dev, domain, busno, s, f, dinfo_size); - - /* For slots after slot 0 we need to check for function 0. */ - first_func = 0; } #undef REG }