Mon May 2 04:39:29 2022 UTC ()
fix non-MULTIPROCESSOR build


(ryo)
diff -r1.7 -r1.8 src/sys/arch/arm/apple/apple_intc.c

cvs diff -r1.7 -r1.8 src/sys/arch/arm/apple/apple_intc.c (expand / switch to unified diff)

--- src/sys/arch/arm/apple/apple_intc.c 2022/03/28 19:59:26 1.7
+++ src/sys/arch/arm/apple/apple_intc.c 2022/05/02 04:39:29 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: apple_intc.c,v 1.7 2022/03/28 19:59:26 riastradh Exp $ */ 1/* $NetBSD: apple_intc.c,v 1.8 2022/05/02 04:39:29 ryo Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2021 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2021 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * 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 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_ddb.h" 29#include "opt_ddb.h"
30#include "opt_multiprocessor.h" 30#include "opt_multiprocessor.h"
31 31
32#define _INTR_PRIVATE 32#define _INTR_PRIVATE
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: apple_intc.c,v 1.7 2022/03/28 19:59:26 riastradh Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: apple_intc.c,v 1.8 2022/05/02 04:39:29 ryo Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/bus.h> 38#include <sys/bus.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/intr.h> 40#include <sys/intr.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42#include <sys/lwp.h> 42#include <sys/lwp.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/cpu.h> 44#include <sys/cpu.h>
45#include <sys/kmem.h> 45#include <sys/kmem.h>
46#include <sys/atomic.h> 46#include <sys/atomic.h>
47 47
48#include <dev/fdt/fdtvar.h> 48#include <dev/fdt/fdtvar.h>
@@ -493,30 +493,34 @@ apple_intc_attach(device_t parent, devic @@ -493,30 +493,34 @@ apple_intc_attach(device_t parent, devic
493 sc->sc_cpuid = kmem_zalloc(sizeof(*sc->sc_cpuid) * ncpu, KM_SLEEP); 493 sc->sc_cpuid = kmem_zalloc(sizeof(*sc->sc_cpuid) * ncpu, KM_SLEEP);
494 sc->sc_pc = kmem_zalloc(sizeof(*sc->sc_pc) * ncpu, KM_SLEEP); 494 sc->sc_pc = kmem_zalloc(sizeof(*sc->sc_pc) * ncpu, KM_SLEEP);
495 495
496 CPU_INFO_ITERATOR cii; 496 CPU_INFO_ITERATOR cii;
497 struct cpu_info *ci; 497 struct cpu_info *ci;
498 for (CPU_INFO_FOREACH(cii, ci)) { 498 for (CPU_INFO_FOREACH(cii, ci)) {
499 const cpuid_t cpuno = cpu_index(ci); 499 const cpuid_t cpuno = cpu_index(ci);
500 struct apple_intc_percpu * const pc = &sc->sc_pc[cpuno]; 500 struct apple_intc_percpu * const pc = &sc->sc_pc[cpuno];
501 struct pic_softc * const pic = &pc->pc_pic; 501 struct pic_softc * const pic = &pc->pc_pic;
502 502
503 pc->pc_sc = sc; 503 pc->pc_sc = sc;
504 pc->pc_cpuid = cpuno; 504 pc->pc_cpuid = cpuno;
505 505
 506#ifdef MULTIPROCESSOR
506 pic->pic_cpus = ci->ci_kcpuset; 507 pic->pic_cpus = ci->ci_kcpuset;
 508#endif
507 pic->pic_ops = &apple_intc_localpicops; 509 pic->pic_ops = &apple_intc_localpicops;
508 pic->pic_maxsources = 2; 510 pic->pic_maxsources = 2;
509 snprintf(pic->pic_name, sizeof(pic->pic_name), "AIC/%lu", cpuno); 511 snprintf(pic->pic_name, sizeof(pic->pic_name), "AIC/%lu", cpuno);
510 512
511 pic_add(pic, PIC_IRQBASE_ALLOC); 513 pic_add(pic, PIC_IRQBASE_ALLOC);
512 514
 515#ifdef MULTIPROCESSOR
513 intr_establish_xname(pic->pic_irqbase + LOCALPIC_SOURCE_IPI, 516 intr_establish_xname(pic->pic_irqbase + LOCALPIC_SOURCE_IPI,
514 IPL_HIGH, IST_LEVEL | IST_MPSAFE, apple_intc_ipi_handler, 517 IPL_HIGH, IST_LEVEL | IST_MPSAFE, apple_intc_ipi_handler,
515 pc, "ipi"); 518 pc, "ipi");
 519#endif
516 } 520 }
517 521
518 apple_intc_cpu_init(&sc->sc_pic, curcpu()); 522 apple_intc_cpu_init(&sc->sc_pic, curcpu());
519} 523}
520 524
521CFATTACH_DECL_NEW(apple_intc, sizeof(struct apple_intc_softc), 525CFATTACH_DECL_NEW(apple_intc, sizeof(struct apple_intc_softc),
522 apple_intc_match, apple_intc_attach, NULL, NULL); 526 apple_intc_match, apple_intc_attach, NULL, NULL);