diff options
| author | bouyer <bouyer@NetBSD.org> | 2018-03-20 12:14:52 +0000 |
|---|---|---|
| committer | bouyer <bouyer@NetBSD.org> | 2018-03-20 12:14:52 +0000 |
| commit | 0d2d508cb9ab75d7cfa4e673df02f8984d869717 (patch) | |
| tree | b7afbb970fed814ff5bfa6f0c0a58f4d7a68ea02 /sys/dev/acpi | |
| parent | f97975bff06b35e69d1082e7d57e4d5b65d54fd9 (diff) | |
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 (limited to 'sys/dev/acpi')
| -rw-r--r-- | sys/dev/acpi/acpi_intr.h | 4 | ||||
| -rw-r--r-- | sys/dev/acpi/acpi_util.c | 8 | ||||
| -rw-r--r-- | sys/dev/acpi/acpica.h | 6 | ||||
| -rw-r--r-- | sys/dev/acpi/acpica/OsdInterrupt.c | 14 |
4 files changed, 22 insertions, 10 deletions
diff --git a/sys/dev/acpi/acpi_intr.h b/sys/dev/acpi/acpi_intr.h index c0cde90f196..dc3c1ee1f1c 100644 --- a/sys/dev/acpi/acpi_intr.h +++ b/sys/dev/acpi/acpi_intr.h @@ -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 --git a/sys/dev/acpi/acpi_util.c b/sys/dev/acpi/acpi_util.c index 0ca7e72f836..db7c4657b94 100644 --- a/sys/dev/acpi/acpi_util.c +++ b/sys/dev/acpi/acpi_util.c @@ -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 @@ struct acpi_irq_handler { 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 @@ acpi_intr_establish(device_t dev, uint64_t c, 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 --git a/sys/dev/acpi/acpica.h b/sys/dev/acpi/acpica.h index 9a768a7c8d2..8f73eaee2a0 100644 --- a/sys/dev/acpi/acpica.h +++ b/sys/dev/acpi/acpica.h @@ -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 --git a/sys/dev/acpi/acpica/OsdInterrupt.c b/sys/dev/acpi/acpica/OsdInterrupt.c index 7bf517eabc5..b62da90b4e7 100644 --- a/sys/dev/acpi/acpica/OsdInterrupt.c +++ b/sys/dev/acpi/acpica/OsdInterrupt.c @@ -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 @@ ACPI_STATUS 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 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, 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); |
