Module Name:    src
Committed By:   jmcneill
Date:           Sun Dec  6 12:23:13 UTC 2020

Modified Files:
        src/sys/dev/acpi: amdccp_acpi.c atppc_acpi.c fdc_acpi.c lpt_acpi.c
            mpu_acpi.c pckbc_acpi.c spic_acpi.c wb_acpi.c

Log Message:
acpi: Use acpi_intr_establish to install interrupt handlers

Get rid of bus-specific (isa_intr_establish) and MD (intr_establish) calls
from MI ACPI code, and use acpi_intr_establish everywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/amdccp_acpi.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/atppc_acpi.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/acpi/fdc_acpi.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/lpt_acpi.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/mpu_acpi.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/acpi/pckbc_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/spic_acpi.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/wb_acpi.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/dev/acpi/amdccp_acpi.c
diff -u src/sys/dev/acpi/amdccp_acpi.c:1.2 src/sys/dev/acpi/amdccp_acpi.c:1.3
--- src/sys/dev/acpi/amdccp_acpi.c:1.2	Sun Oct 21 11:09:20 2018
+++ src/sys/dev/acpi/amdccp_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_acpi.c,v 1.2 2018/10/21 11:09:20 jmcneill Exp $ */
+/* $NetBSD: amdccp_acpi.c,v 1.3 2020/12/06 12:23:13 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.2 2018/10/21 11:09:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.3 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/ic/amdccpvar.h>
 
@@ -68,9 +69,6 @@ amdccp_acpi_attach(device_t parent, devi
 	struct acpi_attach_args *aa = aux;
 	struct acpi_resources res;
 	struct acpi_mem *mem;
-#if notyet
-	struct acpi_irq *irq;
-#endif
 	ACPI_STATUS rv;
 #if notyet
 	void *ih;
@@ -89,23 +87,16 @@ amdccp_acpi_attach(device_t parent, devi
 		goto done;
 	}
 
-#if notyet
-	irq = acpi_res_irq(&res, 0);
-	if (irq == NULL) {
-		aprint_error_dev(self, "couldn't find irq resource\n");
-		goto done;
-	}
-
-#endif
 	sc->sc_bst = aa->aa_memt;
-	if (bus_space_map(aa->aa_memt, mem->ar_base, mem->ar_length, 0, &sc->sc_bsh) != 0) {
+	if (bus_space_map(aa->aa_memt, mem->ar_base, mem->ar_length, 0,
+	    &sc->sc_bsh) != 0) {
 		aprint_error_dev(self, "couldn't map registers\n");
 		goto done;
 	}
 
 #if notyet
-	const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-	ih = intr_establish(irq->ar_irq, IPL_VM, type | IST_MPSAFE, amdccp_intr, sc);
+	ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_VM, true, amdccp_intr, sc, device_xname(self));
 	if (ih == NULL) {
 		aprint_error_dev(self, "couldn't install interrupt handler\n");
 		return;

Index: src/sys/dev/acpi/atppc_acpi.c
diff -u src/sys/dev/acpi/atppc_acpi.c:1.17 src/sys/dev/acpi/atppc_acpi.c:1.18
--- src/sys/dev/acpi/atppc_acpi.c:1.17	Fri Mar  5 14:00:17 2010
+++ src/sys/dev/acpi/atppc_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: atppc_acpi.c,v 1.17 2010/03/05 14:00:17 jruoho Exp $ */
+/* $NetBSD: atppc_acpi.c,v 1.18 2020/12/06 12:23:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atppc_acpi.c,v 1.17 2010/03/05 14:00:17 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atppc_acpi.c,v 1.18 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include "opt_atppc.h"
 
@@ -98,10 +98,8 @@ atppc_acpi_attach(device_t parent, devic
 	struct acpi_attach_args *aa = aux;
 	struct acpi_resources res;
 	struct acpi_io *io;
-	struct acpi_irq *irq;
 	struct acpi_drq *drq;
 	ACPI_STATUS rv;
-	int nirq;
 
 	sc->sc_dev_ok = ATPPC_NOATTACH;
 
@@ -120,14 +118,6 @@ atppc_acpi_attach(device_t parent, devic
 		goto out;
 	}
 
-	/* find our IRQ */
-	irq = acpi_res_irq(&res, 0);
-	if (irq == NULL) {
-		aprint_error_dev(sc->sc_dev, "unable to find irq resource\n");
-		goto out;
-	}
-	nirq = irq->ar_irq;
-
 	/* find our DRQ */
 	drq = acpi_res_drq(&res, 0);
 	if (drq == NULL) {
@@ -150,9 +140,12 @@ atppc_acpi_attach(device_t parent, devic
 		goto out;
 	}
 
-	sc->sc_ieh = isa_intr_establish(aa->aa_ic, nirq,
-	    (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
-	    IPL_TTY, atppcintr, sc->sc_dev);
+	sc->sc_ieh = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_TTY, false, atppcintr, self device_xname(self));
+	if (sc->sc_ieh == NULL) {
+		aprint_error_dev(self, "unable to establish interrupt\n");
+		goto out;
+	}
 
 	/* setup DMA hooks */
 	if (atppc_isadma_setup(sc, asc->sc_ic, asc->sc_drq) == 0) {

Index: src/sys/dev/acpi/fdc_acpi.c
diff -u src/sys/dev/acpi/fdc_acpi.c:1.43 src/sys/dev/acpi/fdc_acpi.c:1.44
--- src/sys/dev/acpi/fdc_acpi.c:1.43	Mon Apr 13 16:33:23 2015
+++ src/sys/dev/acpi/fdc_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdc_acpi.c,v 1.43 2015/04/13 16:33:23 riastradh Exp $ */
+/* $NetBSD: fdc_acpi.c,v 1.44 2020/12/06 12:23:13 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill <[email protected]>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.43 2015/04/13 16:33:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.44 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/isa/isadmavar.h>
 #include <dev/isa/fdcvar.h>
@@ -101,7 +102,6 @@ fdc_acpi_attach(device_t parent, device_
 	struct fdc_softc *sc = &asc->sc_fdc;
 	struct acpi_attach_args *aa = aux;
 	struct acpi_io *io, *ctlio;
-	struct acpi_irq *irq;
 	struct acpi_drq *drq;
 	struct acpi_resources res;
 	ACPI_STATUS rv;
@@ -124,13 +124,6 @@ fdc_acpi_attach(device_t parent, device_
 		goto out;
 	}
 
-	/* find our IRQ */
-	irq = acpi_res_irq(&res, 0);
-	if (irq == NULL) {
-		aprint_error_dev(sc->sc_dev, "unable to find irq resource\n");
-		goto out;
-	}
-
 	/* find our DRQ */
 	drq = acpi_res_drq(&res, 0);
 	if (drq == NULL) {
@@ -188,9 +181,12 @@ fdc_acpi_attach(device_t parent, device_
 		}
 	}
 
-	sc->sc_ih = isa_intr_establish(aa->aa_ic, irq->ar_irq,
-	    (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
-	    IPL_BIO, fdcintr, sc);
+	sc->sc_ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_BIO, false, fdcintr, sc, device_xname(self));
+	if (sc->sc_ih == NULL) {
+		aprint_error_dev(sc->sc_dev, "unable to establish interrupt\n");
+		goto out;
+	}
 
 	/* Setup direct configuration of floppy drives */
 	sc->sc_present = fdc_acpi_enumerate(asc);

Index: src/sys/dev/acpi/lpt_acpi.c
diff -u src/sys/dev/acpi/lpt_acpi.c:1.20 src/sys/dev/acpi/lpt_acpi.c:1.21
--- src/sys/dev/acpi/lpt_acpi.c:1.20	Sun Jun 24 12:25:33 2018
+++ src/sys/dev/acpi/lpt_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt_acpi.c,v 1.20 2018/06/24 12:25:33 jdolecek Exp $ */
+/* $NetBSD: lpt_acpi.c,v 1.21 2020/12/06 12:23:13 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill <[email protected]>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lpt_acpi.c,v 1.20 2018/06/24 12:25:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_acpi.c,v 1.21 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -34,6 +34,7 @@ __KERNEL_RCSID(0, "$NetBSD: lpt_acpi.c,v
 #include <sys/systm.h>
 
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/ic/lptvar.h>
 
@@ -83,7 +84,6 @@ lpt_acpi_attach(device_t parent, device_
 	struct acpi_attach_args *aa = aux;
 	struct acpi_resources res;
 	struct acpi_io *io;
-	struct acpi_irq *irq;
 	ACPI_STATUS rv;
 
 	sc->sc_dev = self;
@@ -105,13 +105,6 @@ lpt_acpi_attach(device_t parent, device_
 		goto out;
 	}
 
-	/* find our IRQ */
-	irq = acpi_res_irq(&res, 0);
-	if (irq == NULL) {
-		aprint_error_dev(self, "unable to find irq resource\n");
-		goto out;
-	}
-
 	sc->sc_iot = aa->aa_iot;
 	if (bus_space_map(sc->sc_iot, io->ar_base, io->ar_length,
 		    0, &sc->sc_ioh)) {
@@ -121,9 +114,12 @@ lpt_acpi_attach(device_t parent, device_
 
 	lpt_attach_subr(sc);
 
-	sc->sc_ih = isa_intr_establish_xname(aa->aa_ic, irq->ar_irq,
-	    (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
-	    IPL_TTY, lptintr, sc, device_xname(self));
+	sc->sc_ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_TTY, false, lptintr, sc, device_xname(self));
+	if (sc->sc_ih == NULL) {
+		aprint_error_dev(self, "unable to establish interrupt\n");
+		goto out;
+	}
 
  out:
 	acpi_resource_cleanup(&res);

Index: src/sys/dev/acpi/mpu_acpi.c
diff -u src/sys/dev/acpi/mpu_acpi.c:1.13 src/sys/dev/acpi/mpu_acpi.c:1.14
--- src/sys/dev/acpi/mpu_acpi.c:1.13	Fri Dec  9 08:56:54 2011
+++ src/sys/dev/acpi/mpu_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mpu_acpi.c,v 1.13 2011/12/09 08:56:54 mrg Exp $ */
+/* $NetBSD: mpu_acpi.c,v 1.14 2020/12/06 12:23:13 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill <[email protected]>
@@ -30,13 +30,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpu_acpi.c,v 1.13 2011/12/09 08:56:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpu_acpi.c,v 1.14 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
 
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/ic/mpuvar.h>
 
@@ -87,7 +88,6 @@ mpu_acpi_attach(device_t parent, device_
 	struct acpi_attach_args *aa = aux;
 	struct acpi_resources res;
 	struct acpi_io *io;
-	struct acpi_irq *irq;
 	ACPI_STATUS rv;
 
 	/* parse resources */
@@ -104,13 +104,6 @@ mpu_acpi_attach(device_t parent, device_
 		goto out;
 	}
 
-	/* find our IRQ */
-	irq = acpi_res_irq(&res, 0);
-	if (irq == NULL) {
-		aprint_error_dev(self, "unable to find irq resource\n");
-		goto out;
-	}
-
 	sc->iot = aa->aa_iot;
 	if (bus_space_map(sc->iot, io->ar_base, io->ar_length, 0, &sc->ioh)) {
 		aprint_error_dev(self, "can't map i/o space\n");
@@ -123,9 +116,12 @@ mpu_acpi_attach(device_t parent, device_
 	mutex_init(&asc->sc_lock, MUTEX_DEFAULT, IPL_AUDIO);
 	mpu_attach(sc);
 
-	sc->arg = isa_intr_establish(aa->aa_ic, irq->ar_irq,
-	    (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
-	    IPL_AUDIO, mpu_intr, sc);
+	sc->arg = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_AUDIO, true, mpu_intr, sc, device_xname(self));
+	if (sc->arg == NULL) {
+		aprint_error_dev(self, "unable to establish interrupt\n");
+		goto out;
+	}
 
  out:
 	acpi_resource_cleanup(&res);

Index: src/sys/dev/acpi/pckbc_acpi.c
diff -u src/sys/dev/acpi/pckbc_acpi.c:1.37 src/sys/dev/acpi/pckbc_acpi.c:1.38
--- src/sys/dev/acpi/pckbc_acpi.c:1.37	Sun Aug 11 06:46:35 2019
+++ src/sys/dev/acpi/pckbc_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pckbc_acpi.c,v 1.37 2019/08/11 06:46:35 rin Exp $	*/
+/*	$NetBSD: pckbc_acpi.c,v 1.38 2020/12/06 12:23:13 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c,v 1.37 2019/08/11 06:46:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c,v 1.38 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c
 #include <sys/systm.h>
 
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/isa/isareg.h>
 
@@ -65,9 +66,7 @@ static void	pckbc_acpi_attach(device_t, 
 struct pckbc_acpi_softc {
 	struct pckbc_softc sc_pckbc;
 
-	isa_chipset_tag_t sc_ic;
-	int sc_irq;
-	int sc_ist;
+	ACPI_HANDLE sc_handle;
 	pckbc_slot_t sc_slot;
 };
 
@@ -136,7 +135,6 @@ pckbc_acpi_attach(device_t parent, devic
 	ACPI_STATUS rv;
 
 	sc->sc_dv = self;
-	psc->sc_ic = aa->aa_ic;
 
 	if (acpi_match_hid(aa->aa_node->ad_devinfo, pckbc_acpi_ids_kbd)) {
 		psc->sc_slot = PCKBC_KBD_SLOT;
@@ -161,8 +159,7 @@ pckbc_acpi_attach(device_t parent, devic
 		aprint_error_dev(self, "unable to find irq resource\n");
 		goto out;
 	}
-	psc->sc_irq = irq->ar_irq;
-	psc->sc_ist = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
+	psc->sc_handle = aa->aa_node->ad_handle;
 
 	if (psc->sc_slot == PCKBC_KBD_SLOT)
 		first = psc;
@@ -235,9 +232,9 @@ static void
 pckbc_acpi_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
 {
 	struct pckbc_acpi_softc *psc = NULL; /* XXX: gcc */
-	isa_chipset_tag_t ic = NULL;
 	void *rv = NULL;
-	int irq = 0, ist = 0; /* XXX: gcc */
+	ACPI_HANDLE handle;
+	char intr_name[64];
 	int i;
 
 	/*
@@ -246,27 +243,25 @@ pckbc_acpi_intr_establish(struct pckbc_s
 	for (i = 0; i < pckbc_cd.cd_ndevs; i++) {
 		psc = device_lookup_private(&pckbc_cd, i);
 		if (psc && psc->sc_slot == slot) {
-			irq = psc->sc_irq;
-			ist = psc->sc_ist;
-			ic = psc->sc_ic;
+			handle = psc->sc_handle;
 			break;
 		}
 	}
 	if (i < pckbc_cd.cd_ndevs) {
-		char intr_xname[64];
-		snprintf(intr_xname, sizeof(intr_xname), "%s %s",
+		snprintf(intr_name, sizeof(intr_name), "%s %s",
 		    device_xname(psc->sc_pckbc.sc_dv), pckbc_slot_names[slot]);
 
-		rv = isa_intr_establish_xname(ic, irq, ist, IPL_TTY, pckbcintr,
-		    sc, intr_xname);
+		rv = acpi_intr_establish(sc->sc_dv, (uint64_t)(uintptr_t)handle,
+		    IPL_TTY, false, pckbcintr, sc, intr_name);
 	}
 	if (rv == NULL) {
 		aprint_error_dev(sc->sc_dv,
 		    "unable to establish interrupt for %s slot\n",
 		    pckbc_slot_names[slot]);
 	} else {
-		aprint_normal_dev(sc->sc_dv, "using irq %d for %s slot\n",
-		    irq, pckbc_slot_names[slot]);
+		aprint_normal_dev(sc->sc_dv, "using %s for %s slot\n",
+		    acpi_intr_string(rv, intr_name, sizeof(intr_name)),
+		    pckbc_slot_names[slot]);
 	}
 }
 

Index: src/sys/dev/acpi/spic_acpi.c
diff -u src/sys/dev/acpi/spic_acpi.c:1.6 src/sys/dev/acpi/spic_acpi.c:1.7
--- src/sys/dev/acpi/spic_acpi.c:1.6	Fri Mar  5 14:00:17 2010
+++ src/sys/dev/acpi/spic_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spic_acpi.c,v 1.6 2010/03/05 14:00:17 jruoho Exp $	*/
+/*	$NetBSD: spic_acpi.c,v 1.7 2020/12/06 12:23:13 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.6 2010/03/05 14:00:17 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.7 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/ic/spicvar.h>
 
@@ -113,8 +114,12 @@ spic_acpi_attach(device_t parent, device
 		goto out;
 	}
 #if 0
-	sc->sc_ih = isa_intr_establish(NULL, irq->ar_irq,
-	    IST_EDGE, IPL_TTY, spic_intr, sc);
+	sc->sc_ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_TTY, false, spic_intr, sc, device_xname(self));
+	if (sc->sc_ih == NULL) {
+		aprint_error_dev(self, "unable to establish interrupt\n");
+		goto out;
+	}
 #endif
 
 	if (!pmf_device_register(self, spic_suspend, spic_resume))

Index: src/sys/dev/acpi/wb_acpi.c
diff -u src/sys/dev/acpi/wb_acpi.c:1.5 src/sys/dev/acpi/wb_acpi.c:1.6
--- src/sys/dev/acpi/wb_acpi.c:1.5	Thu Aug 19 18:37:38 2010
+++ src/sys/dev/acpi/wb_acpi.c	Sun Dec  6 12:23:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: wb_acpi.c,v 1.5 2010/08/19 18:37:38 jmcneill Exp $ */
+/* $NetBSD: wb_acpi.c,v 1.6 2020/12/06 12:23:13 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Jared D. McNeill <[email protected]>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wb_acpi.c,v 1.5 2010/08/19 18:37:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wb_acpi.c,v 1.6 2020/12/06 12:23:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -34,6 +34,7 @@ __KERNEL_RCSID(0, "$NetBSD: wb_acpi.c,v 
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/ic/w83l518dvar.h>
 #include <dev/ic/w83l518dreg.h>
@@ -128,9 +129,8 @@ wb_acpi_attach(device_t parent, device_t
 	}
 	sc->sc_ioh_length = io->ar_length;
 
-	sc->sc_ih = isa_intr_establish(sc->sc_ic, irq->ar_irq,
-	    (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
-	    IPL_SDMMC, wb_intr, &sc->sc_wb);
+	sc->sc_ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	    IPL_SDMMC, false, wb_intr, &sc->sc_wb, device_xname(self));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self,
 		    "couldn't establish interrupt handler\n");
@@ -167,7 +167,7 @@ wb_acpi_detach(device_t self, int flags)
 		return rv;
 
 	if (sc->sc_ih)
-		isa_intr_disestablish(sc->sc_ic, sc->sc_ih);
+		acpi_intr_disestablish(sc->sc_ih);
 
 	if (sc->sc_ioh_length > 0)
 		bus_space_unmap(sc->sc_wb.wb_iot, sc->sc_wb.wb_ioh,

Reply via email to