Sun Dec 22 15:57:07 2019 UTC ()
Add acpi_intr_mask() and acpi_intr_unmask() which, following the pre-existing
ACPI software layering model, are wrappers around acpi_md_intr_mask() and
acpi_md_intr_unmask(), which in turn are wrappers around intr_mask() and
intr_unmask().

XXX ARM and IA64 implementations of acpi_md_intr_mask() and
acpi_md_intr_unmask() are just stubs for now.


(thorpej)
diff -r1.10 -r1.11 src/sys/arch/arm/acpi/acpi_machdep.c
diff -r1.2 -r1.3 src/sys/arch/arm/include/acpi_machdep.h
diff -r1.9 -r1.10 src/sys/arch/ia64/acpi/acpi_machdep.c
diff -r1.8 -r1.9 src/sys/arch/ia64/include/acpi_machdep.h
diff -r1.28 -r1.29 src/sys/arch/x86/acpi/acpi_machdep.c
diff -r1.13 -r1.14 src/sys/arch/x86/include/acpi_machdep.h
diff -r1.3 -r1.4 src/sys/dev/acpi/acpi_intr.h
diff -r1.15 -r1.16 src/sys/dev/acpi/acpi_util.c

cvs diff -r1.10 -r1.11 src/sys/arch/arm/acpi/acpi_machdep.c (expand / switch to unified diff)

--- src/sys/arch/arm/acpi/acpi_machdep.c 2019/08/12 15:37:26 1.10
+++ src/sys/arch/arm/acpi/acpi_machdep.c 2019/12/22 15:57:06 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_machdep.c,v 1.10 2019/08/12 15:37:26 skrll Exp $ */ 1/* $NetBSD: acpi_machdep.c,v 1.11 2019/12/22 15:57:06 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jared McNeill <jmcneill@invisible.ca>. 8 * by Jared McNeill <jmcneill@invisible.ca>.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include "pci.h" 32#include "pci.h"
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.10 2019/08/12 15:37:26 skrll Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.11 2019/12/22 15:57:06 thorpej 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/bus.h> 39#include <sys/bus.h>
40#include <sys/cpu.h> 40#include <sys/cpu.h>
41#include <sys/device.h> 41#include <sys/device.h>
42 42
43#include <uvm/uvm_extern.h> 43#include <uvm/uvm_extern.h>
44 44
45#include <dev/fdt/fdtvar.h> 45#include <dev/fdt/fdtvar.h>
46 46
47#include <dev/acpi/acpica.h> 47#include <dev/acpi/acpica.h>
48#include <dev/acpi/acpivar.h> 48#include <dev/acpi/acpivar.h>
@@ -247,26 +247,40 @@ acpi_md_OsEnableInterrupt(void) @@ -247,26 +247,40 @@ acpi_md_OsEnableInterrupt(void)
247void 247void
248acpi_md_OsDisableInterrupt(void) 248acpi_md_OsDisableInterrupt(void)
249{ 249{
250 cpsid(I32_bit); 250 cpsid(I32_bit);
251} 251}
252 252
253void * 253void *
254acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *), void *arg, bool mpsafe, const char *xname) 254acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *), void *arg, bool mpsafe, const char *xname)
255{ 255{
256 return intr_establish_xname(irq, ipl, type | (mpsafe ? IST_MPSAFE : 0), handler, arg, xname); 256 return intr_establish_xname(irq, ipl, type | (mpsafe ? IST_MPSAFE : 0), handler, arg, xname);
257} 257}
258 258
259void 259void
 260acpi_md_intr_mask(void *ih)
 261{
 262 /* XXX */
 263 panic("acpi_md_intr_mask(%p): not implemented", ih);
 264}
 265
 266void
 267acpi_md_intr_unmask(void *ih)
 268{
 269 /* XXX */
 270 panic("acpi_md_intr_unmask(%p): not implemented", ih);
 271}
 272
 273void
260acpi_md_intr_disestablish(void *ih) 274acpi_md_intr_disestablish(void *ih)
261{ 275{
262 intr_disestablish(ih); 276 intr_disestablish(ih);
263} 277}
264 278
265int 279int
266acpi_md_sleep(int state) 280acpi_md_sleep(int state)
267{ 281{
268 printf("ERROR: ACPI sleep not implemented on this platform\n"); 282 printf("ERROR: ACPI sleep not implemented on this platform\n");
269 return -1; 283 return -1;
270} 284}
271 285
272uint32_t 286uint32_t

cvs diff -r1.2 -r1.3 src/sys/arch/arm/include/acpi_machdep.h (expand / switch to unified diff)

--- src/sys/arch/arm/include/acpi_machdep.h 2018/11/16 23:03:55 1.2
+++ src/sys/arch/arm/include/acpi_machdep.h 2019/12/22 15:57:06 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_machdep.h,v 1.2 2018/11/16 23:03:55 jmcneill Exp $ */ 1/* $NetBSD: acpi_machdep.h,v 1.3 2019/12/22 15:57:06 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jared McNeill <jmcneill@invisible.ca>. 8 * by Jared McNeill <jmcneill@invisible.ca>.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -38,26 +38,28 @@ ACPI_STATUS acpi_md_OsInitialize(void); @@ -38,26 +38,28 @@ ACPI_STATUS acpi_md_OsInitialize(void);
38ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void); 38ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void);
39ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER, 39ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER,
40 void *, void **, const char *); 40 void *, void **, const char *);
41void acpi_md_OsRemoveInterruptHandler(void *); 41void acpi_md_OsRemoveInterruptHandler(void *);
42ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **); 42ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
43void acpi_md_OsUnmapMemory(void *, UINT32); 43void acpi_md_OsUnmapMemory(void *, UINT32);
44ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *, ACPI_PHYSICAL_ADDRESS *); 44ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *, ACPI_PHYSICAL_ADDRESS *);
45BOOLEAN acpi_md_OsReadable(void *, UINT32); 45BOOLEAN acpi_md_OsReadable(void *, UINT32);
46BOOLEAN acpi_md_OsWritable(void *, UINT32); 46BOOLEAN acpi_md_OsWritable(void *, UINT32);
47void acpi_md_OsEnableInterrupt(void); 47void acpi_md_OsEnableInterrupt(void);
48void acpi_md_OsDisableInterrupt(void); 48void acpi_md_OsDisableInterrupt(void);
49void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *), 49void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *),
50 void *, bool, const char *); 50 void *, bool, const char *);
 51void acpi_md_intr_mask(void *);
 52void acpi_md_intr_unmask(void *);
51void acpi_md_intr_disestablish(void *); 53void acpi_md_intr_disestablish(void *);
52int acpi_md_sleep(int); 54int acpi_md_sleep(int);
53uint32_t acpi_md_pdc(void); 55uint32_t acpi_md_pdc(void);
54uint32_t acpi_md_ncpus(void); 56uint32_t acpi_md_ncpus(void);
55void acpi_md_callback(struct acpi_softc *); 57void acpi_md_callback(struct acpi_softc *);
56 58
57static inline int 59static inline int
58_acpi_notimpl(const char *fn) 60_acpi_notimpl(const char *fn)
59{ 61{
60 printf("WARNING: ACPI function %s not implemented on this platform\n", fn); 62 printf("WARNING: ACPI function %s not implemented on this platform\n", fn);
61 return 0; 63 return 0;
62} 64}
63 65

cvs diff -r1.9 -r1.10 src/sys/arch/ia64/acpi/acpi_machdep.c (expand / switch to unified diff)

--- src/sys/arch/ia64/acpi/acpi_machdep.c 2018/11/17 20:53:35 1.9
+++ src/sys/arch/ia64/acpi/acpi_machdep.c 2019/12/22 15:57:06 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_machdep.c,v 1.9 2018/11/17 20:53:35 scole Exp $ */ 1/* $NetBSD: acpi_machdep.c,v 1.10 2019/12/22 15:57:06 thorpej Exp $ */
2/* 2/*
3 * Copyright (c) 2009 KIYOHARA Takashi 3 * Copyright (c) 2009 KIYOHARA Takashi
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27/* 27/*
28 * Machine-dependent routines for ACPICA. 28 * Machine-dependent routines for ACPICA.
29 */ 29 */
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.9 2018/11/17 20:53:35 scole Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.10 2019/12/22 15:57:06 thorpej Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34 34
35#include <uvm/uvm_extern.h> 35#include <uvm/uvm_extern.h>
36 36
37#include <machine/bus.h> 37#include <machine/bus.h>
38#include <machine/efi.h> 38#include <machine/efi.h>
39#include <machine/intrdefs.h> 39#include <machine/intrdefs.h>
40 40
41#include <dev/acpi/acpica.h> 41#include <dev/acpi/acpica.h>
42#include <dev/acpi/acpivar.h> 42#include <dev/acpi/acpivar.h>
43 43
44#include <machine/acpi_machdep.h> 44#include <machine/acpi_machdep.h>
@@ -116,26 +116,40 @@ acpi_md_OsRemoveInterruptHandler(void *c @@ -116,26 +116,40 @@ acpi_md_OsRemoveInterruptHandler(void *c
116 intr_disestablish(cookie); 116 intr_disestablish(cookie);
117} 117}
118 118
119void * 119void *
120acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *), 120acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *),
121 void *arg, bool mpsafe, const char *xname) 121 void *arg, bool mpsafe, const char *xname)
122{ 122{
123 const int vec = acpi_isa_irq_to_vector(irq); 123 const int vec = acpi_isa_irq_to_vector(irq);
124 124
125 return intr_establish(vec, type, ipl, handler, arg); 125 return intr_establish(vec, type, ipl, handler, arg);
126} 126}
127 127
128void 128void
 129acpi_md_intr_mask(void *ih)
 130{
 131 /* XXX */
 132 panic("acpi_md_intr_mask(%p): not implemented", ih);
 133}
 134
 135void
 136acpi_md_intr_unmask(void *ih)
 137{
 138 /* XXX */
 139 panic("acpi_md_intr_unmask(%p): not implemented", ih);
 140}
 141
 142void
129acpi_md_intr_disestablish(void *ih) 143acpi_md_intr_disestablish(void *ih)
130{ 144{
131 intr_disestablish(ih); 145 intr_disestablish(ih);
132} 146}
133 147
134ACPI_STATUS 148ACPI_STATUS
135acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, UINT32 Length, 149acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, UINT32 Length,
136 void **LogicalAddress) 150 void **LogicalAddress)
137{ 151{
138 152
139 if (bus_space_map(IA64_BUS_SPACE_MEM, PhysicalAddress, Length, 153 if (bus_space_map(IA64_BUS_SPACE_MEM, PhysicalAddress, Length,
140 0, (bus_space_handle_t *) LogicalAddress) == 0) 154 0, (bus_space_handle_t *) LogicalAddress) == 0)
141 return AE_OK; 155 return AE_OK;

cvs diff -r1.8 -r1.9 src/sys/arch/ia64/include/acpi_machdep.h (expand / switch to unified diff)

--- src/sys/arch/ia64/include/acpi_machdep.h 2018/11/16 23:03:55 1.8
+++ src/sys/arch/ia64/include/acpi_machdep.h 2019/12/22 15:57:07 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_machdep.h,v 1.8 2018/11/16 23:03:55 jmcneill Exp $ */ 1/* $NetBSD: acpi_machdep.h,v 1.9 2019/12/22 15:57:07 thorpej Exp $ */
2 2
3ACPI_STATUS acpi_md_OsInitialize(void); 3ACPI_STATUS acpi_md_OsInitialize(void);
4ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void); 4ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void);
5 5
6#define acpi_md_OsIn8(x) inb((x)) 6#define acpi_md_OsIn8(x) inb((x))
7#define acpi_md_OsIn16(x) inw((x)) 7#define acpi_md_OsIn16(x) inw((x))
8#define acpi_md_OsIn32(x) inl((x)) 8#define acpi_md_OsIn32(x) inl((x))
9 9
10#define acpi_md_OsOut8(x, v) outb((x), (v)) 10#define acpi_md_OsOut8(x, v) outb((x), (v))
11#define acpi_md_OsOut16(x, v) outw((x), (v)) 11#define acpi_md_OsOut16(x, v) outw((x), (v))
12#define acpi_md_OsOut32(x, v) outl((x), (v)) 12#define acpi_md_OsOut32(x, v) outl((x), (v))
13 13
14ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER, 14ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER,
@@ -17,20 +17,22 @@ void acpi_md_OsRemoveInterruptHandler(vo @@ -17,20 +17,22 @@ void acpi_md_OsRemoveInterruptHandler(vo
17 17
18ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **); 18ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
19void acpi_md_OsUnmapMemory(void *, UINT32); 19void acpi_md_OsUnmapMemory(void *, UINT32);
20ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *LogicalAddress, 20ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *LogicalAddress,
21 ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 21 ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
22 22
23BOOLEAN acpi_md_OsReadable(void *, UINT32); 23BOOLEAN acpi_md_OsReadable(void *, UINT32);
24BOOLEAN acpi_md_OsWritable(void *, UINT32); 24BOOLEAN acpi_md_OsWritable(void *, UINT32);
25void acpi_md_OsEnableInterrupt(void); 25void acpi_md_OsEnableInterrupt(void);
26void acpi_md_OsDisableInterrupt(void); 26void acpi_md_OsDisableInterrupt(void);
27 27
28void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *), 28void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *),
29 void *, bool, const char *); 29 void *, bool, const char *);
 30void acpi_md_intr_mask(void *);
 31void acpi_md_intr_unmask(void *);
30void acpi_md_intr_disestablish(void *); 32void acpi_md_intr_disestablish(void *);
31 33
32int acpi_md_sleep(int); 34int acpi_md_sleep(int);
33uint32_t acpi_md_pdc(void); 35uint32_t acpi_md_pdc(void);
34uint32_t acpi_md_ncpus(void); 36uint32_t acpi_md_ncpus(void);
35struct acpi_softc; 37struct acpi_softc;
36void acpi_md_callback(struct acpi_softc *); 38void acpi_md_callback(struct acpi_softc *);

cvs diff -r1.28 -r1.29 src/sys/arch/x86/acpi/acpi_machdep.c (expand / switch to unified diff)

--- src/sys/arch/x86/acpi/acpi_machdep.c 2019/09/12 14:28:08 1.28
+++ src/sys/arch/x86/acpi/acpi_machdep.c 2019/12/22 15:57:07 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_machdep.c,v 1.28 2019/09/12 14:28:08 martin Exp $ */ 1/* $NetBSD: acpi_machdep.c,v 1.29 2019/12/22 15:57:07 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright 2001 Wasabi Systems, Inc. 4 * Copyright 2001 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
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,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38/* 38/*
39 * Machine-dependent routines for ACPICA. 39 * Machine-dependent routines for ACPICA.
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.28 2019/09/12 14:28:08 martin Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.29 2019/12/22 15:57:07 thorpej Exp $");
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/bus.h> 47#include <sys/bus.h>
48#include <sys/cpu.h> 48#include <sys/cpu.h>
49#include <sys/device.h> 49#include <sys/device.h>
50 50
51#include <uvm/uvm_extern.h> 51#include <uvm/uvm_extern.h>
52 52
53#include <machine/cpufunc.h> 53#include <machine/cpufunc.h>
54#include <machine/bootinfo.h> 54#include <machine/bootinfo.h>
55#include <machine/autoconf.h> 55#include <machine/autoconf.h>
56 56
@@ -343,26 +343,38 @@ acpi_md_intr_establish(uint32_t Interrup @@ -343,26 +343,38 @@ acpi_md_intr_establish(uint32_t Interrup
343 ih = intr_establish_xname(irq, pic, pin, type, ipl, 343 ih = intr_establish_xname(irq, pic, pin, type, ipl,
344 handler, arg, mpsafe, xname); 344 handler, arg, mpsafe, xname);
345 345
346#if NIOAPIC > 0 346#if NIOAPIC > 0
347 if (mipp) { 347 if (mipp) {
348 *mipp = NULL; 348 *mipp = NULL;
349 } 349 }
350#endif 350#endif
351 351
352 return ih; 352 return ih;
353} 353}
354 354
355void 355void
 356acpi_md_intr_mask(void *ih)
 357{
 358 intr_mask(ih);
 359}
 360
 361void
 362acpi_md_intr_unmask(void *ih)
 363{
 364 intr_unmask(ih);
 365}
 366
 367void
356acpi_md_intr_disestablish(void *ih) 368acpi_md_intr_disestablish(void *ih)
357{ 369{
358 intr_disestablish(ih); 370 intr_disestablish(ih);
359} 371}
360 372
361ACPI_STATUS 373ACPI_STATUS
362acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, 374acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress,
363 uint32_t Length, void **LogicalAddress) 375 uint32_t Length, void **LogicalAddress)
364{ 376{
365 int rv; 377 int rv;
366 378
367 rv = _x86_memio_map(x86_bus_space_mem, PhysicalAddress, 379 rv = _x86_memio_map(x86_bus_space_mem, PhysicalAddress,
368 Length, 0, (bus_space_handle_t *)LogicalAddress); 380 Length, 0, (bus_space_handle_t *)LogicalAddress);

cvs diff -r1.13 -r1.14 src/sys/arch/x86/include/acpi_machdep.h (expand / switch to unified diff)

--- src/sys/arch/x86/include/acpi_machdep.h 2018/11/16 23:03:55 1.13
+++ src/sys/arch/x86/include/acpi_machdep.h 2019/12/22 15:57:07 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_machdep.h,v 1.13 2018/11/16 23:03:55 jmcneill Exp $ */ 1/* $NetBSD: acpi_machdep.h,v 1.14 2019/12/22 15:57:07 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright 2001 Wasabi Systems, Inc. 4 * Copyright 2001 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
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
@@ -62,24 +62,26 @@ void acpi_md_OsRemoveInterruptHandler(v @@ -62,24 +62,26 @@ void acpi_md_OsRemoveInterruptHandler(v
62 62
63ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **); 63ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
64void acpi_md_OsUnmapMemory(void *, UINT32); 64void acpi_md_OsUnmapMemory(void *, UINT32);
65ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *LogicalAddress, 65ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *LogicalAddress,
66 ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 66 ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
67 67
68BOOLEAN acpi_md_OsReadable(void *, UINT32); 68BOOLEAN acpi_md_OsReadable(void *, UINT32);
69BOOLEAN acpi_md_OsWritable(void *, UINT32); 69BOOLEAN acpi_md_OsWritable(void *, UINT32);
70void acpi_md_OsDisableInterrupt(void); 70void acpi_md_OsDisableInterrupt(void);
71void acpi_md_OsEnableInterrupt(void); 71void acpi_md_OsEnableInterrupt(void);
72 72
73void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *), 73void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *),
74 void *, bool, const char *); 74 void *, bool, const char *);
 75void acpi_md_intr_mask(void *);
 76void acpi_md_intr_unmask(void *);
75void acpi_md_intr_disestablish(void *); 77void acpi_md_intr_disestablish(void *);
76 78
77int acpi_md_sleep(int); 79int acpi_md_sleep(int);
78void acpi_md_sleep_init(void); 80void acpi_md_sleep_init(void);
79 81
80uint32_t acpi_md_pdc(void); 82uint32_t acpi_md_pdc(void);
81uint32_t acpi_md_ncpus(void); 83uint32_t acpi_md_ncpus(void);
82struct acpi_softc; 84struct acpi_softc;
83void acpi_md_callback(struct acpi_softc *); 85void acpi_md_callback(struct acpi_softc *);
84 86
85#endif /* !_X86_ACPI_MACHDEP_H_ */ 87#endif /* !_X86_ACPI_MACHDEP_H_ */

cvs diff -r1.3 -r1.4 src/sys/dev/acpi/acpi_intr.h (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_intr.h 2018/11/16 23:05:50 1.3
+++ src/sys/dev/acpi/acpi_intr.h 2019/12/22 15:57:07 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_intr.h,v 1.3 2018/11/16 23:05:50 jmcneill Exp $ */ 1/* $NetBSD: acpi_intr.h,v 1.4 2019/12/22 15:57:07 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 The NetBSD Foundation, Inc. 4 * Copyright (c) 2017 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Manuel Bouyer. 8 * by Manuel Bouyer.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -18,17 +18,25 @@ @@ -18,17 +18,25 @@
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
 31
 32#ifndef _DEV_ACPI_ACPI_INTR_H_
 33#define _DEV_ACPI_ACPI_INTR_H_
 34
31void * acpi_intr_establish(device_t, uint64_t, int, bool, 35void * acpi_intr_establish(device_t, uint64_t, int, bool,
32 int (*intr)(void *), void *, const char *); 36 int (*intr)(void *), void *, const char *);
 37void acpi_intr_mask(void *);
 38void acpi_intr_unmask(void *);
33void acpi_intr_disestablish(void *); 39void acpi_intr_disestablish(void *);
34const char * acpi_intr_string(void *, char *, size_t len); 40const char * acpi_intr_string(void *, char *, size_t len);
 41
 42#endif /* _DEV_ACPI_ACPI_INTR_H_ */

cvs diff -r1.15 -r1.16 src/sys/dev/acpi/acpi_util.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_util.c 2018/12/21 14:51:12 1.15
+++ src/sys/dev/acpi/acpi_util.c 2019/12/22 15:57:07 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_util.c,v 1.15 2018/12/21 14:51:12 jmcneill Exp $ */ 1/* $NetBSD: acpi_util.c,v 1.16 2019/12/22 15:57:07 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum of By Noon Software, Inc. 8 * by Charles M. Hannum of By Noon Software, Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -55,27 +55,27 @@ @@ -55,27 +55,27 @@
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE. 64 * POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#include <sys/cdefs.h> 67#include <sys/cdefs.h>
68__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.15 2018/12/21 14:51:12 jmcneill Exp $"); 68__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.16 2019/12/22 15:57:07 thorpej Exp $");
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/kmem.h> 71#include <sys/kmem.h>
72#include <sys/cpu.h> 72#include <sys/cpu.h>
73 73
74#include <dev/acpi/acpireg.h> 74#include <dev/acpi/acpireg.h>
75#include <dev/acpi/acpivar.h> 75#include <dev/acpi/acpivar.h>
76#include <dev/acpi/acpi_intr.h> 76#include <dev/acpi/acpi_intr.h>
77 77
78#include <machine/acpi_machdep.h> 78#include <machine/acpi_machdep.h>
79 79
80#define _COMPONENT ACPI_BUS_COMPONENT 80#define _COMPONENT ACPI_BUS_COMPONENT
81ACPI_MODULE_NAME ("acpi_util") 81ACPI_MODULE_NAME ("acpi_util")
@@ -581,26 +581,42 @@ acpi_intr_establish(device_t dev, uint64 @@ -581,26 +581,42 @@ acpi_intr_establish(device_t dev, uint64
581 goto end; 581 goto end;
582 582
583 aih = kmem_alloc(sizeof(struct acpi_irq_handler), KM_SLEEP); 583 aih = kmem_alloc(sizeof(struct acpi_irq_handler), KM_SLEEP);
584 aih->aih_hdl = hdl; 584 aih->aih_hdl = hdl;
585 aih->aih_irq = irq->ar_irq; 585 aih->aih_irq = irq->ar_irq;
586 aih->aih_ih = ih; 586 aih->aih_ih = ih;
587 587
588end: 588end:
589 acpi_resource_cleanup(&res); 589 acpi_resource_cleanup(&res);
590 return aih; 590 return aih;
591} 591}
592 592
593void 593void
 594acpi_intr_mask(void *c)
 595{
 596 struct acpi_irq_handler * const aih = c;
 597
 598 acpi_md_intr_mask(aih->aih_ih);
 599}
 600
 601void
 602acpi_intr_unmask(void *c)
 603{
 604 struct acpi_irq_handler * const aih = c;
 605
 606 acpi_md_intr_unmask(aih->aih_ih);
 607}
 608
 609void
594acpi_intr_disestablish(void *c) 610acpi_intr_disestablish(void *c)
595{ 611{
596 struct acpi_irq_handler *aih = c; 612 struct acpi_irq_handler *aih = c;
597 613
598 acpi_md_intr_disestablish(aih->aih_ih); 614 acpi_md_intr_disestablish(aih->aih_ih);
599 kmem_free(aih, sizeof(struct acpi_irq_handler)); 615 kmem_free(aih, sizeof(struct acpi_irq_handler));
600} 616}
601 617
602const char * 618const char *
603acpi_intr_string(void *c, char *buf, size_t size) 619acpi_intr_string(void *c, char *buf, size_t size)
604{ 620{
605 struct acpi_irq_handler *aih = c; 621 struct acpi_irq_handler *aih = c;
606 intr_handle_t ih = aih->aih_irq; 622 intr_handle_t ih = aih->aih_irq;