Module Name:    src
Committed By:   matt
Date:           Sat Dec 24 01:24:44 UTC 2011

Modified Files:
        src/sys/dev/pci [matt-nb5-mips64]: pci.c

Log Message:
Add support for __PCI_DEV_FUNCORDER


To generate a diff of this commit:
cvs rdiff -u -r1.119.4.1 -r1.119.4.1.4.1 src/sys/dev/pci/pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pci.c
diff -u src/sys/dev/pci/pci.c:1.119.4.1 src/sys/dev/pci/pci.c:1.119.4.1.4.1
--- src/sys/dev/pci/pci.c:1.119.4.1	Thu Nov 20 02:40:59 2008
+++ src/sys/dev/pci/pci.c	Sat Dec 24 01:24:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.119.4.1 2008/11/20 02:40:59 snj Exp $	*/
+/*	$NetBSD: pci.c,v 1.119.4.1.4.1 2011/12/24 01:24:44 matt Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.119.4.1 2008/11/20 02:40:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.119.4.1.4.1 2011/12/24 01:24:44 matt Exp $");
 
 #include "opt_pci.h"
 
@@ -533,7 +533,24 @@ pci_enumerate_bus(struct pci_softc *sc, 
 		else
 			nfunctions = PCI_HDRTYPE_MULTIFN(bhlcr) ? 8 : 1;
 
+#ifdef __PCI_DEV_FUNCORDER
+		char funcs[8];
+		int j;
+		for (j = 0; j < nfunctions; j++) {
+			funcs[j] = j;
+		}
+		if (j < __arraycount(funcs))
+			funcs[j] = -1;
+		if (nfunctions > 1) {
+			pci_dev_funcorder(sc->sc_pc, sc->sc_bus, device,
+			    nfunctions, funcs);
+		}
+		for (j = 0;
+		     j < 8 && (function = funcs[j]) < 8 && function >= 0;
+		     j++) {
+#else
 		for (function = 0; function < nfunctions; function++) {
+#endif
 			if ((locators[PCICF_FUNCTION] != PCICF_FUNCTION_DEFAULT)
 			    && (locators[PCICF_FUNCTION] != function))
 				continue;

Reply via email to