Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi acpi: Use acpi_intr_establish to install interr...



details:   https://anonhg.NetBSD.org/src/rev/a995b0411e41
branches:  trunk
changeset: 957653:a995b0411e41
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Dec 06 12:23:13 2020 +0000

description:
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.

diffstat:

 sys/dev/acpi/amdccp_acpi.c |  23 +++++++----------------
 sys/dev/acpi/atppc_acpi.c  |  23 ++++++++---------------
 sys/dev/acpi/fdc_acpi.c    |  22 +++++++++-------------
 sys/dev/acpi/lpt_acpi.c    |  22 +++++++++-------------
 sys/dev/acpi/mpu_acpi.c    |  22 +++++++++-------------
 sys/dev/acpi/pckbc_acpi.c  |  33 ++++++++++++++-------------------
 sys/dev/acpi/spic_acpi.c   |  13 +++++++++----
 sys/dev/acpi/wb_acpi.c     |  12 ++++++------
 8 files changed, 71 insertions(+), 99 deletions(-)

diffs (truncated from 505 to 300 lines):

diff -r a720f6c56d94 -r a995b0411e41 sys/dev/acpi/amdccp_acpi.c
--- a/sys/dev/acpi/amdccp_acpi.c        Sun Dec 06 11:41:47 2020 +0000
+++ b/sys/dev/acpi/amdccp_acpi.c        Sun Dec 06 12:23:13 2020 +0000
@@ -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 @@
 
 #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 @@
        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 @@
                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;
diff -r a720f6c56d94 -r a995b0411e41 sys/dev/acpi/atppc_acpi.c
--- a/sys/dev/acpi/atppc_acpi.c Sun Dec 06 11:41:47 2020 +0000
+++ b/sys/dev/acpi/atppc_acpi.c Sun Dec 06 12:23:13 2020 +0000
@@ -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 @@
        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 @@
                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 @@
                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) {
diff -r a720f6c56d94 -r a995b0411e41 sys/dev/acpi/fdc_acpi.c
--- a/sys/dev/acpi/fdc_acpi.c   Sun Dec 06 11:41:47 2020 +0000
+++ b/sys/dev/acpi/fdc_acpi.c   Sun Dec 06 12:23:13 2020 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 
 #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 @@
        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 @@
                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 @@
                }
        }
 
-       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);
diff -r a720f6c56d94 -r a995b0411e41 sys/dev/acpi/lpt_acpi.c
--- a/sys/dev/acpi/lpt_acpi.c   Sun Dec 06 11:41:47 2020 +0000
+++ b/sys/dev/acpi/lpt_acpi.c   Sun Dec 06 12:23:13 2020 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 #include <sys/systm.h>
 
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/ic/lptvar.h>
 
@@ -83,7 +84,6 @@
        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 @@
                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_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);
diff -r a720f6c56d94 -r a995b0411e41 sys/dev/acpi/mpu_acpi.c
--- a/sys/dev/acpi/mpu_acpi.c   Sun Dec 06 11:41:47 2020 +0000
+++ b/sys/dev/acpi/mpu_acpi.c   Sun Dec 06 12:23:13 2020 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        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 @@
                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 @@



Home | Main Index | Thread Index | Old Index