Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci enable MSI support where available



details:   https://anonhg.NetBSD.org/src/rev/54da9f8bca34
branches:  trunk
changeset: 836589:54da9f8bca34
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Oct 25 21:07:58 2018 +0000

description:
enable MSI support where available

diffstat:

 sys/dev/pci/ehci_pci.c |  23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diffs (73 lines):

diff -r 118677eb1445 -r 54da9f8bca34 sys/dev/pci/ehci_pci.c
--- a/sys/dev/pci/ehci_pci.c    Thu Oct 25 21:03:19 2018 +0000
+++ b/sys/dev/pci/ehci_pci.c    Thu Oct 25 21:07:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_pci.c,v 1.67 2018/05/10 03:41:00 msaitoh Exp $    */
+/*     $NetBSD: ehci_pci.c,v 1.68 2018/10/25 21:07:58 jdolecek Exp $   */
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.67 2018/05/10 03:41:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.68 2018/10/25 21:07:58 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -83,6 +83,7 @@
        ehci_softc_t            sc;
        pci_chipset_tag_t       sc_pc;
        pcitag_t                sc_tag;
+       pci_intr_handle_t       *sc_pihp;
        void                    *sc_ih;         /* interrupt vectoring */
 };
 
@@ -117,7 +118,6 @@
        pci_chipset_tag_t pc = pa->pa_pc;
        pcitag_t tag = pa->pa_tag;
        char const *intrstr;
-       pci_intr_handle_t ih;
        pcireg_t csr;
        int ncomp;
        struct usb_pci *up;
@@ -171,7 +171,7 @@
        pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
 
        /* Map and establish the interrupt. */
-       if (pci_intr_map(pa, &ih)) {
+       if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0) != 0) {
                aprint_error_dev(self, "couldn't map interrupt\n");
                goto fail;
        }
@@ -179,10 +179,13 @@
        /*
         * Allocate IRQ
         */
-       intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-       sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_USB, ehci_intr, sc,
-           device_xname(self));
+       intrstr = pci_intr_string(pc, sc->sc_pihp[0], intrbuf, sizeof(intrbuf));
+       sc->sc_ih = pci_intr_establish_xname(pc, sc->sc_pihp[0], IPL_USB,
+           ehci_intr, sc, device_xname(self));
        if (sc->sc_ih == NULL) {
+               pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
+               sc->sc_pihp = NULL;
+
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
                        aprint_error(" at %s", intrstr);
@@ -288,6 +291,12 @@
                pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
                sc->sc_ih = NULL;
        }
+
+       if (sc->sc_pihp != NULL) {
+               pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
+               sc->sc_pihp = NULL;
+       }
+
        if (sc->sc.sc_size) {
                ehci_release_ownership(&sc->sc, sc->sc_pc, sc->sc_tag);
                bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);



Home | Main Index | Thread Index | Old Index