Module Name: src Committed By: bouyer Date: Tue Mar 20 12:14:52 UTC 2018
Modified Files: src/sys/arch/ia64/acpi: acpi_machdep.c src/sys/arch/ia64/include: acpi_machdep.h src/sys/arch/x86/acpi: acpi_machdep.c src/sys/arch/x86/include: acpi_machdep.h src/sys/dev/acpi: acpi_intr.h acpi_util.c acpica.h src/sys/dev/acpi/acpica: OsdInterrupt.c src/sys/dev/i2c: ihidev.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/acpi/acpi_machdep.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/include/acpi_machdep.h cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/acpi/acpi_machdep.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/acpi_machdep.h cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_intr.h cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpi_util.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica.h cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpica/OsdInterrupt.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/ihidev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/ia64/acpi/acpi_machdep.c diff -u src/sys/arch/ia64/acpi/acpi_machdep.c:1.6 src/sys/arch/ia64/acpi/acpi_machdep.c:1.7 --- src/sys/arch/ia64/acpi/acpi_machdep.c:1.6 Sun Sep 23 00:31:05 2012 +++ src/sys/arch/ia64/acpi/acpi_machdep.c Tue Mar 20 12:14:52 2018 @@ -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_md_OsGetRootPointer(void) 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 */ Index: src/sys/arch/ia64/include/acpi_machdep.h diff -u src/sys/arch/ia64/include/acpi_machdep.h:1.6 src/sys/arch/ia64/include/acpi_machdep.h:1.7 --- src/sys/arch/ia64/include/acpi_machdep.h:1.6 Sun Sep 23 00:31:05 2012 +++ src/sys/arch/ia64/include/acpi_machdep.h Tue Mar 20 12:14:52 2018 @@ -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 @@ ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootP #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 **); Index: src/sys/arch/x86/acpi/acpi_machdep.c diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.18 src/sys/arch/x86/acpi/acpi_machdep.c:1.19 --- src/sys/arch/x86/acpi/acpi_machdep.c:1.18 Tue Feb 14 13:29:09 2017 +++ src/sys/arch/x86/acpi/acpi_machdep.c Tue Mar 20 12:14:52 2018 @@ -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_md_findoverride(ACPI_SUBTABLE_HEADE 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 @@ acpi_md_OsInstallInterruptHandler(uint32 * 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) { Index: src/sys/arch/x86/include/acpi_machdep.h diff -u src/sys/arch/x86/include/acpi_machdep.h:1.11 src/sys/arch/x86/include/acpi_machdep.h:1.12 --- src/sys/arch/x86/include/acpi_machdep.h:1.11 Sun Sep 23 00:31:05 2012 +++ src/sys/arch/x86/include/acpi_machdep.h Tue Mar 20 12:14:52 2018 @@ -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 @@ ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootP #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 **); Index: src/sys/dev/acpi/acpi_intr.h diff -u src/sys/dev/acpi/acpi_intr.h:1.1 src/sys/dev/acpi/acpi_intr.h:1.2 --- src/sys/dev/acpi/acpi_intr.h:1.1 Sun Dec 10 16:51:30 2017 +++ src/sys/dev/acpi/acpi_intr.h Tue Mar 20 12:14:52 2018 @@ -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); Index: src/sys/dev/acpi/acpi_util.c diff -u src/sys/dev/acpi/acpi_util.c:1.10 src/sys/dev/acpi/acpi_util.c:1.11 --- src/sys/dev/acpi/acpi_util.c:1.10 Sun Dec 10 18:52:41 2017 +++ src/sys/dev/acpi/acpi_util.c Tue Mar 20 12:14:52 2018 @@ -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 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; Index: src/sys/dev/acpi/acpica.h diff -u src/sys/dev/acpi/acpica.h:1.5 src/sys/dev/acpi/acpica.h:1.6 --- src/sys/dev/acpi/acpica.h:1.5 Thu Feb 17 07:34:42 2011 +++ src/sys/dev/acpi/acpica.h Tue Mar 20 12:14:52 2018 @@ -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 */ Index: src/sys/dev/acpi/acpica/OsdInterrupt.c diff -u src/sys/dev/acpi/acpica/OsdInterrupt.c:1.8 src/sys/dev/acpi/acpica/OsdInterrupt.c:1.9 --- src/sys/dev/acpi/acpica/OsdInterrupt.c:1.8 Tue Aug 18 16:41:02 2009 +++ src/sys/dev/acpi/acpica/OsdInterrupt.c Tue Mar 20 12:14:52 2018 @@ -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 Int 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); Index: src/sys/dev/i2c/ihidev.c diff -u src/sys/dev/i2c/ihidev.c:1.1 src/sys/dev/i2c/ihidev.c:1.2 --- src/sys/dev/i2c/ihidev.c:1.1 Sun Dec 10 17:05:54 2017 +++ src/sys/dev/i2c/ihidev.c Tue Mar 20 12:14:52 2018 @@ -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 @@ ihidev_attach(device_t parent, device_t { 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",