Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Allow registering ACPI interrupt handlers with a xname.
details: https://anonhg.NetBSD.org/src/rev/decf3c4d6778
branches: trunk
changeset: 360640:decf3c4d6778
user: bouyer <bouyer%NetBSD.org@localhost>
date: Tue Mar 20 12:14:52 2018 +0000
description:
Allow registering ACPI interrupt handlers with a xname.
AcpiOsInstallInterruptHandler(), part of ACPICA API, doesn't allow passing
the xname. I extend the API with AcpiOsInstallInterruptHandler_xname()
for this purpose, and change acpi_md_OsInstallInterruptHandler() to
accept and use the xname (ia64 doens't use it).
The xname was hardcoded to "acpi SCI" in the
x86 acpi_md_OsInstallInterruptHandler(), so I make
AcpiOsInstallInterruptHandler() call
AcpiOsInstallInterruptHandler_xname with xname = "acpi SCI".
Now 'vmstat -i' shows the device's name instead of "acpi SCI" for for i2c HID
interrupts.
Proposed on tech-kern@ on Dec 29.
diffstat:
sys/arch/ia64/acpi/acpi_machdep.c | 7 ++++---
sys/arch/ia64/include/acpi_machdep.h | 4 ++--
sys/arch/x86/acpi/acpi_machdep.c | 9 +++++----
sys/arch/x86/include/acpi_machdep.h | 4 ++--
sys/dev/acpi/acpi_intr.h | 4 ++--
sys/dev/acpi/acpi_util.c | 8 ++++----
sys/dev/acpi/acpica.h | 6 +++++-
sys/dev/acpi/acpica/OsdInterrupt.c | 14 +++++++++++---
sys/dev/i2c/ihidev.c | 7 ++++---
9 files changed, 39 insertions(+), 24 deletions(-)
diffs (242 lines):
diff -r b3061648f8e8 -r decf3c4d6778 sys/arch/ia64/acpi/acpi_machdep.c
--- a/sys/arch/ia64/acpi/acpi_machdep.c Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/arch/ia64/acpi/acpi_machdep.c Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.6 2012/09/23 00:31:05 chs Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.7 2018/03/20 12:14:52 bouyer Exp $ */
/*
* Copyright (c) 2009 KIYOHARA Takashi
* All rights reserved.
@@ -28,7 +28,7 @@
* Machine-dependent routines for ACPICA.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.6 2012/09/23 00:31:05 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.7 2018/03/20 12:14:52 bouyer Exp $");
#include <sys/param.h>
@@ -77,7 +77,8 @@
ACPI_STATUS
acpi_md_OsInstallInterruptHandler(UINT32 InterruptNumber,
ACPI_OSD_HANDLER ServiceRoutine,
- void *Context, void **cookiep)
+ void *Context, void **cookiep,
+ const char *xname)
{
static int isa_irq_to_vector_map[16] = {
/* i8259 IRQ translation, first 16 entries */
diff -r b3061648f8e8 -r decf3c4d6778 sys/arch/ia64/include/acpi_machdep.h
--- a/sys/arch/ia64/include/acpi_machdep.h Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/arch/ia64/include/acpi_machdep.h Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.h,v 1.6 2012/09/23 00:31:05 chs Exp $ */
+/* $NetBSD: acpi_machdep.h,v 1.7 2018/03/20 12:14:52 bouyer Exp $ */
ACPI_STATUS acpi_md_OsInitialize(void);
ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void);
@@ -12,7 +12,7 @@
#define acpi_md_OsOut32(x, v) outl((x), (v))
ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER,
- void *, void **);
+ void *, void **, const char *);
void acpi_md_OsRemoveInterruptHandler(void *);
ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
diff -r b3061648f8e8 -r decf3c4d6778 sys/arch/x86/acpi/acpi_machdep.c
--- a/sys/arch/x86/acpi/acpi_machdep.c Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/arch/x86/acpi/acpi_machdep.c Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.18 2017/02/14 13:29:09 nonaka Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.19 2018/03/20 12:14:52 bouyer Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.18 2017/02/14 13:29:09 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.19 2018/03/20 12:14:52 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -147,7 +147,8 @@
ACPI_STATUS
acpi_md_OsInstallInterruptHandler(uint32_t InterruptNumber,
- ACPI_OSD_HANDLER ServiceRoutine, void *Context, void **cookiep)
+ ACPI_OSD_HANDLER ServiceRoutine, void *Context, void **cookiep,
+ const char *xname)
{
void *ih;
struct pic *pic;
@@ -242,7 +243,7 @@
* XXX probably, IPL_BIO is enough.
*/
ih = intr_establish_xname(irq, pic, pin, type, IPL_TTY,
- (int (*)(void *)) ServiceRoutine, Context, false, "acpi SCI");
+ (int (*)(void *)) ServiceRoutine, Context, false, xname);
#if NIOAPIC > 0
if (mipp) {
diff -r b3061648f8e8 -r decf3c4d6778 sys/arch/x86/include/acpi_machdep.h
--- a/sys/arch/x86/include/acpi_machdep.h Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/arch/x86/include/acpi_machdep.h Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.h,v 1.11 2012/09/23 00:31:05 chs Exp $ */
+/* $NetBSD: acpi_machdep.h,v 1.12 2018/03/20 12:14:52 bouyer Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -57,7 +57,7 @@
#define acpi_md_OsOut32(x, v) outl((x), (v))
ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32,
- ACPI_OSD_HANDLER, void *, void **);
+ ACPI_OSD_HANDLER, void *, void **, const char *);
void acpi_md_OsRemoveInterruptHandler(void *);
ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
diff -r b3061648f8e8 -r decf3c4d6778 sys/dev/acpi/acpi_intr.h
--- a/sys/dev/acpi/acpi_intr.h Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/dev/acpi/acpi_intr.h Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_intr.h,v 1.1 2017/12/10 16:51:30 bouyer Exp $ */
+/* $NetBSD: acpi_intr.h,v 1.2 2018/03/20 12:14:52 bouyer Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,6 +29,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
void * acpi_intr_establish(device_t, uint64_t,
- unsigned int (*intr)(void *), void *);
+ unsigned int (*intr)(void *), void *, const char *);
void acpi_intr_disestablish(void *, unsigned int (*intr)(void *));
const char * acpi_intr_string(void *, char *, size_t len);
diff -r b3061648f8e8 -r decf3c4d6778 sys/dev/acpi/acpi_util.c
--- a/sys/dev/acpi/acpi_util.c Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/dev/acpi/acpi_util.c Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_util.c,v 1.10 2017/12/10 18:52:41 bouyer Exp $ */
+/* $NetBSD: acpi_util.c,v 1.11 2018/03/20 12:14:52 bouyer Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.10 2017/12/10 18:52:41 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.11 2018/03/20 12:14:52 bouyer Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -517,7 +517,7 @@
void *
acpi_intr_establish(device_t dev, uint64_t c,
- unsigned int (*intr)(void *), void *iarg)
+ unsigned int (*intr)(void *), void *iarg, const char *xname)
{
ACPI_STATUS rv;
ACPI_HANDLE hdl = (void *)(uintptr_t)c;
@@ -540,7 +540,7 @@
aih->aih_hdl = hdl;
aih->aih_irq = irq->ar_irq;
- rv = AcpiOsInstallInterruptHandler(irq->ar_irq, intr, iarg);
+ rv = AcpiOsInstallInterruptHandler_xname(irq->ar_irq, intr, iarg, xname);
if (ACPI_FAILURE(rv)) {
kmem_free(aih, sizeof(struct acpi_irq_handler));
aih = NULL;
diff -r b3061648f8e8 -r decf3c4d6778 sys/dev/acpi/acpica.h
--- a/sys/dev/acpi/acpica.h Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/dev/acpi/acpica.h Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpica.h,v 1.5 2011/02/17 07:34:42 jruoho Exp $ */
+/* $NetBSD: acpica.h,v 1.6 2018/03/20 12:14:52 bouyer Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -46,4 +46,8 @@
#include <external/bsd/acpica/dist/include/acpi.h>
#include <external/bsd/acpica/dist/include/accommon.h>
+/* extention to the ACPICA API */
+ACPI_STATUS AcpiOsInstallInterruptHandler_xname(
+ UINT32, ACPI_OSD_HANDLER, void *, const char *);
+
#endif /* !_SYS_DEV_ACPI_ACPICA_H */
diff -r b3061648f8e8 -r decf3c4d6778 sys/dev/acpi/acpica/OsdInterrupt.c
--- a/sys/dev/acpi/acpica/OsdInterrupt.c Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/dev/acpi/acpica/OsdInterrupt.c Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: OsdInterrupt.c,v 1.8 2009/08/18 16:41:02 jmcneill Exp $ */
+/* $NetBSD: OsdInterrupt.c,v 1.9 2018/03/20 12:14:52 bouyer Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: OsdInterrupt.c,v 1.8 2009/08/18 16:41:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdInterrupt.c,v 1.9 2018/03/20 12:14:52 bouyer Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -86,6 +86,14 @@
AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
ACPI_OSD_HANDLER ServiceRoutine, void *Context)
{
+ return AcpiOsInstallInterruptHandler_xname(InterruptNumber,
+ ServiceRoutine, Context, "acpi SCI");
+}
+
+ACPI_STATUS
+AcpiOsInstallInterruptHandler_xname(UINT32 InterruptNumber,
+ ACPI_OSD_HANDLER ServiceRoutine, void *Context, const char *xname)
+{
struct acpi_interrupt_handler *aih;
ACPI_STATUS rv;
@@ -102,7 +110,7 @@
aih->aih_func = ServiceRoutine;
rv = acpi_md_OsInstallInterruptHandler(InterruptNumber,
- ServiceRoutine, Context, &aih->aih_ih);
+ ServiceRoutine, Context, &aih->aih_ih, xname);
if (rv == AE_OK) {
mutex_enter(&acpi_interrupt_list_mtx);
LIST_INSERT_HEAD(&acpi_interrupt_list, aih, aih_list);
diff -r b3061648f8e8 -r decf3c4d6778 sys/dev/i2c/ihidev.c
--- a/sys/dev/i2c/ihidev.c Tue Mar 20 11:24:14 2018 +0000
+++ b/sys/dev/i2c/ihidev.c Tue Mar 20 12:14:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ihidev.c,v 1.1 2017/12/10 17:05:54 bouyer Exp $ */
+/* $NetBSD: ihidev.c,v 1.2 2018/03/20 12:14:52 bouyer Exp $ */
/* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
/*-
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.1 2017/12/10 17:05:54 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.2 2018/03/20 12:14:52 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -208,7 +208,8 @@
{
char buf[100];
- sc->sc_ih = acpi_intr_establish(self, sc->sc_phandle, ihidev_intr, sc);
+ sc->sc_ih = acpi_intr_establish(self,
+ sc->sc_phandle, ihidev_intr, sc, device_xname(self));
if (sc->sc_ih == NULL)
aprint_error_dev(self, "can't establish interrupt\n");
aprint_normal_dev(self, "interrupting at %s\n",
Home |
Main Index |
Thread Index |
Old Index