tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/acpi



On Mon, Dec 11, 2017 at 12:22:56AM +0100, Jaromír Dole?ek wrote:
[in response to acpi_intr_establish() introduction]
> Can we have acpi_intr_establish() accept the xname? It's very useful to
> have the driver name registered for "intrctl list".

The attached patch does it.
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".

On my laptop I had before the change:
>intrctl list
interrupt id    CPU0  CPU1  CPU2  CPU3  device name(s)
ioapic0 pin 9  29928*    0     0     0  acpi SCI
msi0 vec 0      3388*    0     0     0  xhci0
ioapic0 pin 16     0*    0     0     0  unknown, ahcisata0, ichsmb0
ioapic0 pin 17     0*    0     0     0  unknown
ioapic0 pin 51     0*    0     0     0  acpi SCI
msi1 vec 0       394*    0     0     0  iwm0
msix2 vec 0        0*    0     0     0  nvme0 adminq
msix2 vec 1     1652*    0     0     0  nvme0 ioq1
msix2 vec 2        0  1915*    0     0  nvme0 ioq2
msix2 vec 3        0     0   104*    0  nvme0 ioq3
msix2 vec 4        0     0     0   426* nvme0 ioq4
msi3 vec 0         0*    0     0     0  hdaudio0
ioapic0 pin 1      0*    0     0     0  unknown
ioapic0 pin 12     0*    0     0     0  unknown

and after:
>intrctl list
interrupt id   CPU0  CPU1  CPU2  CPU3  device name(s)
ioapic0 pin 9  7130*    0     0     0  acpi SCI
msi0 vec 0      920*    0     0     0  xhci0
ioapic0 pin 16    0*    0     0     0  unknown, ahcisata0, ichsmb0
ioapic0 pin 17    0*    0     0     0  unknown
ioapic0 pin 51    0*    0     0     0  ihidev0
msi1 vec 0      617*    0     0     0  iwm0
msix2 vec 0       0*    0     0     0  nvme0 adminq
msix2 vec 1    2531*    0     0     0  nvme0 ioq1
msix2 vec 2       0   911*    0     0  nvme0 ioq2
msix2 vec 3       0     0    95*    0  nvme0 ioq3
msix2 vec 4       0     0     0   407* nvme0 ioq4
msi3 vec 0        0*    0     0     0  hdaudio0
ioapic0 pin 1     0*    0     0     0  unknown
ioapic0 pin 12    0*    0     0     0  unknown

any objection to this change ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: sys/arch/ia64/acpi/acpi_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/acpi/acpi_machdep.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 acpi_machdep.c
--- sys/arch/ia64/acpi/acpi_machdep.c	23 Sep 2012 00:31:05 -0000	1.6
+++ sys/arch/ia64/acpi/acpi_machdep.c	28 Dec 2017 14:32:18 -0000
@@ -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: sys/arch/ia64/include/acpi_machdep.h
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/include/acpi_machdep.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 acpi_machdep.h
--- sys/arch/ia64/include/acpi_machdep.h	23 Sep 2012 00:31:05 -0000	1.6
+++ sys/arch/ia64/include/acpi_machdep.h	28 Dec 2017 14:32:18 -0000
@@ -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: sys/arch/x86/acpi/acpi_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/acpi/acpi_machdep.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 acpi_machdep.c
--- sys/arch/x86/acpi/acpi_machdep.c	14 Feb 2017 13:29:09 -0000	1.18
+++ sys/arch/x86/acpi/acpi_machdep.c	28 Dec 2017 14:32:19 -0000
@@ -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: sys/arch/x86/include/acpi_machdep.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/include/acpi_machdep.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 acpi_machdep.h
--- sys/arch/x86/include/acpi_machdep.h	23 Sep 2012 00:31:05 -0000	1.11
+++ sys/arch/x86/include/acpi_machdep.h	28 Dec 2017 14:32:19 -0000
@@ -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: sys/dev/acpi/acpi_intr.h
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_intr.h,v
retrieving revision 1.1
diff -u -p -u -r1.1 acpi_intr.h
--- sys/dev/acpi/acpi_intr.h	10 Dec 2017 16:51:30 -0000	1.1
+++ sys/dev/acpi/acpi_intr.h	28 Dec 2017 14:32:19 -0000
@@ -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: sys/dev/acpi/acpi_util.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_util.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 acpi_util.c
--- sys/dev/acpi/acpi_util.c	10 Dec 2017 18:52:41 -0000	1.10
+++ sys/dev/acpi/acpi_util.c	28 Dec 2017 14:32:19 -0000
@@ -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: sys/dev/acpi/acpica.h
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpica.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 acpica.h
--- sys/dev/acpi/acpica.h	17 Feb 2011 07:34:42 -0000	1.5
+++ sys/dev/acpi/acpica.h	28 Dec 2017 14:32:19 -0000
@@ -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: sys/dev/acpi/acpica/OsdInterrupt.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpica/OsdInterrupt.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 OsdInterrupt.c
--- sys/dev/acpi/acpica/OsdInterrupt.c	18 Aug 2009 16:41:02 -0000	1.8
+++ sys/dev/acpi/acpica/OsdInterrupt.c	28 Dec 2017 14:32:19 -0000
@@ -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: sys/dev/i2c/ihidev.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/ihidev.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 ihidev.c
--- sys/dev/i2c/ihidev.c	10 Dec 2017 17:05:54 -0000	1.1
+++ sys/dev/i2c/ihidev.c	28 Dec 2017 14:32:19 -0000
@@ -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",


Home | Main Index | Thread Index | Old Index