Module Name:    src
Committed By:   dyoung
Date:           Mon Feb 15 23:53:08 UTC 2010

Modified Files:
        src/sys/arch/amd64/amd64: mainbus.c
        src/sys/arch/i386/i386: mainbus.c

Log Message:
Don't use the global variable pci_mode, but use a local copy of
the return value of pci_mode_detect(), instead.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/amd64/mainbus.c
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/i386/i386/mainbus.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/arch/amd64/amd64/mainbus.c
diff -u src/sys/arch/amd64/amd64/mainbus.c:1.29 src/sys/arch/amd64/amd64/mainbus.c:1.30
--- src/sys/arch/amd64/amd64/mainbus.c:1.29	Tue Aug 18 16:41:02 2009
+++ src/sys/arch/amd64/amd64/mainbus.c	Mon Feb 15 23:53:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.29 2009/08/18 16:41:02 jmcneill Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.30 2010/02/15 23:53:07 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.29 2009/08/18 16:41:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2010/02/15 23:53:07 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -151,6 +151,7 @@
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
 #if NPCI > 0
+	int mode;
 	union mainbus_attach_args mba;
 #endif
 #if NACPICA > 0
@@ -176,9 +177,9 @@
 	/*
 	 * ACPI needs to be able to access PCI configuration space.
 	 */
-	pci_mode = pci_mode_detect();
+	mode = pci_mode_detect();
 #if defined(PCI_BUS_FIXUP)
-	if (pci_mode != 0) {
+	if (mode != 0) {
 		pci_maxbus = pci_bus_fixup(NULL, 0);
 		aprint_debug("PCI bus max, after pci_bus_fixup: %i\n",
 		    pci_maxbus);
@@ -252,7 +253,7 @@
 #endif
 
 #if NPCI > 0
-	if (pci_mode != 0) {
+	if (mode != 0) {
 		int npcibus = 0;
 
 		mba.mba_pba.pba_iot = X86_BUS_SPACE_IO;

Index: src/sys/arch/i386/i386/mainbus.c
diff -u src/sys/arch/i386/i386/mainbus.c:1.88 src/sys/arch/i386/i386/mainbus.c:1.89
--- src/sys/arch/i386/i386/mainbus.c:1.88	Fri Jan  8 00:09:44 2010
+++ src/sys/arch/i386/i386/mainbus.c	Mon Feb 15 23:53:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.88 2010/01/08 00:09:44 dyoung Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.89 2010/02/15 23:53:07 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.88 2010/01/08 00:09:44 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.89 2010/02/15 23:53:07 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -211,6 +211,9 @@
 void
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
+#if NPCI > 0
+	int mode;
+#endif
 	struct mainbus_softc *sc = device_private(self);
 	union mainbus_attach_args mba;
 #ifdef MPBIOS
@@ -234,9 +237,9 @@
 	/*
 	 * ACPI needs to be able to access PCI configuration space.
 	 */
-	pci_mode = pci_mode_detect();
+	mode = pci_mode_detect();
 #if defined(PCI_BUS_FIXUP)
-	if (pci_mode != 0) {
+	if (mode != 0) {
 		pci_maxbus = pci_bus_fixup(NULL, 0);
 		aprint_debug("PCI bus max, after pci_bus_fixup: %i\n",
 		    pci_maxbus);
@@ -390,7 +393,7 @@
 	 * XXX that's not currently possible.
 	 */
 #if NPCI > 0
-	if (pci_mode != 0 && ifattr_match(ifattr, "pcibus")) {
+	if (pci_mode_detect() != 0 && ifattr_match(ifattr, "pcibus")) {
 		int npcibus = 0;
 
 		mba.mba_pba.pba_iot = X86_BUS_SPACE_IO;

Reply via email to