Subject: port-i386/31971: pci_bus_fixup() is called and leads to crash on non-pci machines
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: User Lkundrak <lkundrak@morph.sk>
List: netbsd-bugs
Date: 11/01/2005 15:42:00
>Number: 31971
>Category: port-i386
>Synopsis: pci_bus_fixup() is called and leads to crash on non-pci machines
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: port-i386-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 01 15:42:00 +0000 2005
>Originator: Lubomir Kundrak
>Release: NetBSD 3.99.9 05/05/10
>Organization:
>Environment:
System: NetBSD anthem 3.99.9 NetBSD 3.99.9 (GENERIC) #1: Wed Oct 5 13:30:15 CEST 2005 lkundrak@elvraba.edu.sk:/usr/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
Affected file: $NetBSD: mainbus.c,v 1.59 2005/06/22 00:58:48 sekiya Exp $
>Description:
pci_bus_fixup() is called even if pci_mode_detect() returns pci_mode = 0
And, as pci_bus_fixup() calls pci_make_tag() which panics if pci_mode is
neither 1 nor 2, this leads to a crash.
PCI_BUS_FIXUP is enabled in INSTALL_LAPTOP kernel by default and thus this
makes it impossible to install NetBSD on old laptops.
>How-To-Repeat:
Start the kernel with NPCI > 1 and PCI_BUS_FIXUP on non-pci machine (qemu -isa)
>Fix:
--- mainbus.c.orig 2005-06-22 02:58:48.000000000 +0200
+++ mainbus.c
@@ -202,13 +202,15 @@ mainbus_attach(parent, self, aux)
* ACPI needs to be able to access PCI configuration space.
*/
pci_mode = pci_mode_detect();
+ if (pci_mode) { /* PCI host bridge is present */
#if defined(PCI_BUS_FIXUP)
- pci_maxbus = pci_bus_fixup(NULL, 0);
- aprint_debug("PCI bus max, after pci_bus_fixup: %i\n", pci_maxbus);
+ pci_maxbus = pci_bus_fixup(NULL, 0);
+ aprint_debug("PCI bus max, after pci_bus_fixup: %i\n", pci_maxbus);
#if defined(PCI_ADDR_FIXUP)
- pciaddr.extent_port = NULL;
- pciaddr.extent_mem = NULL;
- pci_addr_fixup(NULL, pci_maxbus);
+ pciaddr.extent_port = NULL;
+ pciaddr.extent_mem = NULL;
+ pci_addr_fixup(NULL, pci_maxbus);
+ }
#endif
#endif
#endif
>Unformatted:
To: gnats-bugs@gnats.NetBSD.org
Subject: pci_bus_fixup() is called and leads to crash on non-pci machines
From: lkundrak@skosi.org
Reply-To: lkundrak@skosi.org
X-send-pr-version: 3.95