Mon Sep 20 21:05:15 2021 UTC ()
Make _splraise/_spllower/splx functions available to modules again.


(jmcneill)
diff -r1.2 -r1.3 src/sys/arch/arm/cortex/gic_splfuncs.c
diff -r1.6 -r1.7 src/sys/arch/arm/fdt/fdt_intr.h
diff -r1.21 -r1.22 src/sys/arch/arm/pic/pic_splfuncs.c
diff -r1.35 -r1.36 src/sys/arch/arm/pic/picvar.h

cvs diff -r1.2 -r1.3 src/sys/arch/arm/cortex/gic_splfuncs.c (expand / switch to unified diff)

--- src/sys/arch/arm/cortex/gic_splfuncs.c 2021/09/18 12:25:07 1.2
+++ src/sys/arch/arm/cortex/gic_splfuncs.c 2021/09/20 21:05:14 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gic_splfuncs.c,v 1.2 2021/09/18 12:25:07 jmcneill Exp $ */ 1/* $NetBSD: gic_splfuncs.c,v 1.3 2021/09/20 21:05:14 jmcneill 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.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
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 <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: gic_splfuncs.c,v 1.2 2021/09/18 12:25:07 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: gic_splfuncs.c,v 1.3 2021/09/20 21:05:14 jmcneill Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/atomic.h> 33#include <sys/atomic.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/lwp.h> 35#include <sys/lwp.h>
36 36
37#include <arm/pic/picvar.h> 37#include <arm/pic/picvar.h>
38#include <arm/cpu.h> 38#include <arm/cpu.h>
39#include <arm/cpufunc.h> 39#include <arm/cpufunc.h>
40#include <arm/locore.h> 40#include <arm/locore.h>
41 41
42#include <arm/cortex/gic_splfuncs.h> 42#include <arm/cortex/gic_splfuncs.h>
43 43
@@ -117,17 +117,17 @@ dohard: @@ -117,17 +117,17 @@ dohard:
117 pic_do_pending_ints(psw, newipl, NULL); 117 pic_do_pending_ints(psw, newipl, NULL);
118 ci->ci_intr_depth--; 118 ci->ci_intr_depth--;
119 if ((psw & I32_bit) == 0) { 119 if ((psw & I32_bit) == 0) {
120 ENABLE_INTERRUPT(); 120 ENABLE_INTERRUPT();
121 } 121 }
122 122
123dosoft: 123dosoft:
124 cpu_dosoftints(); 124 cpu_dosoftints();
125} 125}
126 126
127void 127void
128gic_spl_init(void) 128gic_spl_init(void)
129{ 129{
130 _splraise = gic_splraise; 130 pic_splraise = gic_splraise;
131 _spllower = gic_spllower; 131 pic_spllower = gic_spllower;
132 splx = gic_splx; 132 pic_splx = gic_splx;
133} 133}

cvs diff -r1.6 -r1.7 src/sys/arch/arm/fdt/fdt_intr.h (expand / switch to unified diff)

--- src/sys/arch/arm/fdt/fdt_intr.h 2021/08/30 23:20:00 1.6
+++ src/sys/arch/arm/fdt/fdt_intr.h 2021/09/20 21:05:15 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_intr.h,v 1.6 2021/08/30 23:20:00 jmcneill Exp $ */ 1/* $NetBSD: fdt_intr.h,v 1.7 2021/09/20 21:05:15 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 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.
@@ -30,23 +30,27 @@ @@ -30,23 +30,27 @@
30#define _ARM_FDT_INTR_H 30#define _ARM_FDT_INTR_H
31 31
32#define ARM_IRQ_HANDLER _C_LABEL(arm_fdt_irq_handler) 32#define ARM_IRQ_HANDLER _C_LABEL(arm_fdt_irq_handler)
33#define ARM_FIQ_HANDLER _C_LABEL(arm_fdt_fiq_handler) 33#define ARM_FIQ_HANDLER _C_LABEL(arm_fdt_fiq_handler)
34 34
35#ifndef _LOCORE 35#ifndef _LOCORE
36 36
37#define __HAVE_PIC_SET_PRIORITY 37#define __HAVE_PIC_SET_PRIORITY
38#define __HAVE_PIC_PENDING_INTRS 38#define __HAVE_PIC_PENDING_INTRS
39 39
40#define PIC_MAXSOURCES 8192 40#define PIC_MAXSOURCES 8192
41#define PIC_MAXMAXSOURCES (PIC_MAXSOURCES * 2 + 32) 41#define PIC_MAXMAXSOURCES (PIC_MAXSOURCES * 2 + 32)
42 42
 43#define _splraise pic_splraise
 44#define _spllower pic_spllower
 45#define splx pic_splx
 46
43void arm_fdt_irq_set_handler(void (*)(void *)); 47void arm_fdt_irq_set_handler(void (*)(void *));
44void arm_fdt_irq_handler(void *); 48void arm_fdt_irq_handler(void *);
45void arm_fdt_fiq_set_handler(void (*)(void *)); 49void arm_fdt_fiq_set_handler(void (*)(void *));
46void arm_fdt_fiq_handler(void *); 50void arm_fdt_fiq_handler(void *);
47 51
48#include <arm/pic/picvar.h> 52#include <arm/pic/picvar.h>
49 53
50#endif 54#endif
51 55
52#endif /* _ARM_FDT_INTR_H */ 56#endif /* _ARM_FDT_INTR_H */

cvs diff -r1.21 -r1.22 src/sys/arch/arm/pic/pic_splfuncs.c (expand / switch to unified diff)

--- src/sys/arch/arm/pic/pic_splfuncs.c 2021/08/10 15:31:55 1.21
+++ src/sys/arch/arm/pic/pic_splfuncs.c 2021/09/20 21:05:15 1.22
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pic_splfuncs.c,v 1.21 2021/08/10 15:31:55 jmcneill Exp $ */ 1/* $NetBSD: pic_splfuncs.c,v 1.22 2021/09/20 21:05:15 jmcneill Exp $ */
2/*- 2/*-
3 * Copyright (c) 2008 The NetBSD Foundation, Inc. 3 * Copyright (c) 2008 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas. 7 * by Matt Thomas.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -17,52 +17,55 @@ @@ -17,52 +17,55 @@
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
 30
 31#include "opt_modular.h"
 32
30#include <sys/cdefs.h> 33#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.21 2021/08/10 15:31:55 jmcneill Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.22 2021/09/20 21:05:15 jmcneill Exp $");
32 35
33#define _INTR_PRIVATE 36#define _INTR_PRIVATE
34#include <sys/param.h> 37#include <sys/param.h>
35#include <sys/atomic.h> 38#include <sys/atomic.h>
36#include <sys/evcnt.h> 39#include <sys/evcnt.h>
37#include <sys/lwp.h> 40#include <sys/lwp.h>
38#include <sys/kernel.h> 41#include <sys/kernel.h>
39 42
40#include <dev/cons.h> 43#include <dev/cons.h>
41 44
42#include <arm/armreg.h> 45#include <arm/armreg.h>
43#include <arm/cpu.h> 46#include <arm/cpu.h>
44#include <arm/cpufunc.h> 47#include <arm/cpufunc.h>
45#include <arm/locore.h> /* for compat aarch64 */ 48#include <arm/locore.h> /* for compat aarch64 */
46 49
47#include <arm/pic/picvar.h> 50#include <arm/pic/picvar.h>
48 51
49static int pic_default_splraise(int); 52static int pic_default_splraise(int);
50static int pic_default_spllower(int); 53static int pic_default_spllower(int);
51static void pic_default_splx(int); 54static void pic_default_splx(int);
52 55
53int (*_splraise)(int) = pic_default_splraise; 56int (*pic_splraise)(int) = pic_default_splraise;
54int (*_spllower)(int) = pic_default_spllower; 57int (*pic_spllower)(int) = pic_default_spllower;
55void (*splx)(int) = pic_default_splx; 58void (*pic_splx)(int) = pic_default_splx;
56 59
57static int 60static int
58pic_default_splraise(int newipl) 61pic_default_splraise(int newipl)
59{ 62{
60 struct cpu_info * const ci = curcpu(); 63 struct cpu_info * const ci = curcpu();
61 const int oldipl = ci->ci_cpl; 64 const int oldipl = ci->ci_cpl;
62 KASSERT(newipl < NIPL); 65 KASSERT(newipl < NIPL);
63 if (newipl > ci->ci_cpl) { 66 if (newipl > ci->ci_cpl) {
64 pic_set_priority(ci, newipl); 67 pic_set_priority(ci, newipl);
65 } 68 }
66 return oldipl; 69 return oldipl;
67} 70}
68 71
@@ -99,13 +102,48 @@ pic_default_splx(int savedipl) @@ -99,13 +102,48 @@ pic_default_splx(int savedipl)
99 "splx(%d) to a higher ipl than %d", savedipl, ci->ci_cpl); 102 "splx(%d) to a higher ipl than %d", savedipl, ci->ci_cpl);
100 103
101 ci->ci_intr_depth++; 104 ci->ci_intr_depth++;
102 pic_do_pending_ints(psw, savedipl, NULL); 105 pic_do_pending_ints(psw, savedipl, NULL);
103 ci->ci_intr_depth--; 106 ci->ci_intr_depth--;
104 KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d", 107 KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d",
105 ci->ci_cpl, savedipl); 108 ci->ci_cpl, savedipl);
106 if ((psw & I32_bit) == 0) 109 if ((psw & I32_bit) == 0)
107 ENABLE_INTERRUPT(); 110 ENABLE_INTERRUPT();
108 cpu_dosoftints(); 111 cpu_dosoftints();
109 KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d", 112 KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d",
110 ci->ci_cpl, savedipl); 113 ci->ci_cpl, savedipl);
111} 114}
 115
 116#ifdef MODULAR
 117#ifdef _spllower
 118#undef _spllower
 119#endif
 120int _spllower(int);
 121
 122#ifdef _splraise
 123#undef _splraise
 124#endif
 125int _splraise(int);
 126
 127#ifdef splx
 128#undef splx
 129#endif
 130void splx(int);
 131
 132int
 133_spllower(int newipl)
 134{
 135 return pic_spllower(newipl);
 136}
 137
 138int
 139_splraise(int newipl)
 140{
 141 return pic_splraise(newipl);
 142}
 143
 144void
 145splx(int savedipl)
 146{
 147 pic_splx(savedipl);
 148}
 149#endif /* !MODULAR */

cvs diff -r1.35 -r1.36 src/sys/arch/arm/pic/picvar.h (expand / switch to unified diff)

--- src/sys/arch/arm/pic/picvar.h 2021/08/10 15:31:55 1.35
+++ src/sys/arch/arm/pic/picvar.h 2021/09/20 21:05:15 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: picvar.h,v 1.35 2021/08/10 15:31:55 jmcneill Exp $ */ 1/* $NetBSD: picvar.h,v 1.36 2021/09/20 21:05:15 jmcneill Exp $ */
2/*- 2/*-
3 * Copyright (c) 2008 The NetBSD Foundation, Inc. 3 * Copyright (c) 2008 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas. 7 * by Matt Thomas.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -30,29 +30,29 @@ @@ -30,29 +30,29 @@
30#ifndef _ARM_PIC_PICVAR_H_ 30#ifndef _ARM_PIC_PICVAR_H_
31#define _ARM_PIC_PICVAR_H_ 31#define _ARM_PIC_PICVAR_H_
32 32
33#ifdef _KERNEL_OPT 33#ifdef _KERNEL_OPT
34#include "opt_multiprocessor.h" 34#include "opt_multiprocessor.h"
35#endif 35#endif
36 36
37#ifdef MULTIPROCESSOR 37#ifdef MULTIPROCESSOR
38#include <sys/kcpuset.h> 38#include <sys/kcpuset.h>
39#endif 39#endif
40 40
41typedef uint32_t intr_handle_t; /* for ACPI */ 41typedef uint32_t intr_handle_t; /* for ACPI */
42 42
43extern int (*_splraise)(int); 43extern int (*pic_splraise)(int);
44extern int (*_spllower)(int); 44extern int (*pic_spllower)(int);
45extern void (*splx)(int); 45extern void (*pic_splx)(int);
46 46
47const char * 47const char *
48 intr_typename(int); 48 intr_typename(int);
49 49
50struct pic_softc; 50struct pic_softc;
51struct intrsource; 51struct intrsource;
52struct cpu_info; 52struct cpu_info;
53 53
54#define IPI_AST 0 /* just get an interrupt */ 54#define IPI_AST 0 /* just get an interrupt */
55#define IPI_XCALL 1 /* xcall */ 55#define IPI_XCALL 1 /* xcall */
56#define IPI_NOP 2 /* just get an interrupt (armv6) */ 56#define IPI_NOP 2 /* just get an interrupt (armv6) */
57#define IPI_SHOOTDOWN 3 /* cause a tlb shootdown */ 57#define IPI_SHOOTDOWN 3 /* cause a tlb shootdown */
58#define IPI_DDB 4 /* enter DDB */ 58#define IPI_DDB 4 /* enter DDB */