Don't use the global variable pci_mode, but use a local copy of

the return value of pci_mode_detect(), instead.
This commit is contained in:
dyoung 2010-02-15 23:53:07 +00:00
parent c4b330d512
commit 2e4dbd90d6
3 changed files with 21 additions and 14 deletions

View File

@ -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 @@ void
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 @@ mainbus_attach(device_t parent, device_t self, void *aux)
/*
* 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 @@ mainbus_attach(device_t parent, device_t self, void *aux)
#endif
#if NPCI > 0
if (pci_mode != 0) {
if (mode != 0) {
int npcibus = 0;
mba.mba_pba.pba_iot = X86_BUS_SPACE_IO;

View File

@ -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 @@ mainbus_match(device_t parent, cfdata_t match, void *aux)
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 @@ mainbus_attach(device_t parent, device_t self, void *aux)
/*
* 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 @@ mainbus_rescan(device_t self, const char *ifattr, const int *locators)
* 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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.9 2009/08/18 16:41:03 jmcneill Exp $ */
/* $NetBSD: mainbus.c,v 1.10 2010/02/15 23:53:56 dyoung Exp $ */
/* NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp */
/*
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.9 2009/08/18 16:41:03 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2010/02/15 23:53:56 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -134,6 +134,9 @@ mainbus_match(device_t parent, cfdata_t match, void *aux)
void
mainbus_attach(device_t parent, device_t self, void *aux)
{
#if NPCI > 0
int mode;
#endif
union mainbus_attach_args mba;
#if defined(DOM0OPS)
int numcpus = 0;
@ -155,9 +158,9 @@ mainbus_attach(device_t parent, device_t self, void *aux)
#endif
#if NPCI > 0
/* ACPI needs to be able to access PCI configuration space. */
pci_mode = pci_mode_detect();
mode = pci_mode_detect();
#ifdef PCI_BUS_FIXUP
if (pci_mode != 0) {
if (mode != 0) {
pci_maxbus = pci_bus_fixup(NULL, 0);
aprint_debug_dev(self, "PCI bus max, after "
"pci_bus_fixup: %i\n", pci_maxbus);