Mon Apr 22 22:47:00 2024 UTC (17d)
Add (defined(MPBIOS) || NACPICA > 0) check around mp_pci_childdetached().
Fixes the build without MPBIOS or ACPI. Modified patch from Paolo Pisati in
current-users@.

While here:
Remove obsolete <arch/x86/pci/msipic.h> include with its guard.
Add comments for multiple endifs for better readability.


(andvar)
diff -r1.6 -r1.7 src/sys/arch/i386/i386/i386_mainbus.c

cvs diff -r1.6 -r1.7 src/sys/arch/i386/i386/i386_mainbus.c (expand / switch to unified diff)

--- src/sys/arch/i386/i386/i386_mainbus.c 2021/08/07 16:18:55 1.6
+++ src/sys/arch/i386/i386/i386_mainbus.c 2024/04/22 22:47:00 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i386_mainbus.c,v 1.6 2021/08/07 16:18:55 thorpej Exp $ */ 1/* $NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $ */
2/* NetBSD: mainbus.c,v 1.104 2018/12/02 08:19:44 cherry Exp */ 2/* NetBSD: mainbus.c,v 1.104 2018/12/02 08:19:44 cherry Exp */
3 3
4/* 4/*
5 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 5 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.6 2021/08/07 16:18:55 thorpej Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/reboot.h> 40#include <sys/reboot.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42 42
43#include <dev/isa/isavar.h> 43#include <dev/isa/isavar.h>
44#include <dev/eisa/eisavar.h> 44#include <dev/eisa/eisavar.h>
45#include <dev/pci/pcivar.h> 45#include <dev/pci/pcivar.h>
46 46
47#include <dev/isa/isareg.h> /* for ISA_HOLE_VADDR */ 47#include <dev/isa/isareg.h> /* for ISA_HOLE_VADDR */
48 48
@@ -77,32 +77,29 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus @@ -77,32 +77,29 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus
77#endif 77#endif
78 78
79#include <x86/autoconf.h> 79#include <x86/autoconf.h>
80 80
81#if NIPMI > 0 81#if NIPMI > 0
82#include <x86/ipmivar.h> 82#include <x86/ipmivar.h>
83#endif 83#endif
84 84
85#if NPCI > 0 85#if NPCI > 0
86#if defined(PCI_BUS_FIXUP) 86#if defined(PCI_BUS_FIXUP)
87#include <arch/x86/pci/pci_bus_fixup.h> 87#include <arch/x86/pci/pci_bus_fixup.h>
88#if defined(PCI_ADDR_FIXUP) 88#if defined(PCI_ADDR_FIXUP)
89#include <arch/x86/pci/pci_addr_fixup.h> 89#include <arch/x86/pci/pci_addr_fixup.h>
90#endif 90#endif /* PCI_ADDR_FIXUP */
91#endif 91#endif /* PCI_BUS_FIXUP */
92#ifdef __HAVE_PCI_MSI_MSIX 92#endif /* NPCI > 0 */
93#include <arch/x86/pci/msipic.h> 
94#endif /* __HAVE_PCI_MSI_MSIX */ 
95#endif 
96 93
97void i386_mainbus_childdetached(device_t, device_t); 94void i386_mainbus_childdetached(device_t, device_t);
98int i386_mainbus_match(device_t, cfdata_t, void *); 95int i386_mainbus_match(device_t, cfdata_t, void *);
99void i386_mainbus_attach(device_t, device_t, void *); 96void i386_mainbus_attach(device_t, device_t, void *);
100int i386_mainbus_rescan(device_t, const char *, const int *); 97int i386_mainbus_rescan(device_t, const char *, const int *);
101 98
102union i386_mainbus_attach_args { 99union i386_mainbus_attach_args {
103 const char *mba_busname; /* first elem of all */ 100 const char *mba_busname; /* first elem of all */
104 struct pcibus_attach_args mba_pba; 101 struct pcibus_attach_args mba_pba;
105 struct eisabus_attach_args mba_eba; 102 struct eisabus_attach_args mba_eba;
106 struct isabus_attach_args mba_iba; 103 struct isabus_attach_args mba_iba;
107#if NMCA > 0 104#if NMCA > 0
108 struct mcabus_attach_args mba_mba; 105 struct mcabus_attach_args mba_mba;
@@ -168,27 +165,27 @@ i386_mainbus_childdetached(device_t self @@ -168,27 +165,27 @@ i386_mainbus_childdetached(device_t self
168 struct mainbus_softc *sc = device_private(self); 165 struct mainbus_softc *sc = device_private(self);
169 166
170 if (sc->sc_acpi == child) 167 if (sc->sc_acpi == child)
171 sc->sc_acpi = NULL; 168 sc->sc_acpi = NULL;
172 if (sc->sc_ipmi == child) 169 if (sc->sc_ipmi == child)
173 sc->sc_ipmi = NULL; 170 sc->sc_ipmi = NULL;
174 if (sc->sc_mca == child) 171 if (sc->sc_mca == child)
175 sc->sc_mca = NULL; 172 sc->sc_mca = NULL;
176 if (sc->sc_pnpbios == child) 173 if (sc->sc_pnpbios == child)
177 sc->sc_pnpbios = NULL; 174 sc->sc_pnpbios = NULL;
178 if (sc->sc_pci == child) 175 if (sc->sc_pci == child)
179 sc->sc_pci = NULL; 176 sc->sc_pci = NULL;
180 177
181#if NPCI > 0 178#if NPCI > 0 && (defined(MPBIOS) || NACPICA > 0)
182 mp_pci_childdetached(self, child); 179 mp_pci_childdetached(self, child);
183#endif 180#endif
184} 181}
185 182
186/* 183/*
187 * Probe for the mainbus; always succeeds. 184 * Probe for the mainbus; always succeeds.
188 */ 185 */
189int 186int
190i386_mainbus_match(device_t parent, cfdata_t match, void *aux) 187i386_mainbus_match(device_t parent, cfdata_t match, void *aux)
191{ 188{
192 189
193 return 1; 190 return 1;
194} 191}