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, blatantly co...



details:   https://anonhg.NetBSD.org/src/rev/b0fd2801a4bd
branches:  trunk
changeset: 445318:b0fd2801a4bd
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Oct 22 20:57:07 2018 +0000

description:
enable MSI support where available, blatantly copied from jmcneill's msk(4)

diffstat:

 sys/dev/pci/siisata_pci.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r aed7c5368870 -r b0fd2801a4bd sys/dev/pci/siisata_pci.c
--- a/sys/dev/pci/siisata_pci.c Mon Oct 22 20:30:52 2018 +0000
+++ b/sys/dev/pci/siisata_pci.c Mon Oct 22 20:57:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_pci.c,v 1.16 2017/06/21 22:48:05 jdolecek Exp $ */
+/* $NetBSD: siisata_pci.c,v 1.17 2018/10/22 20:57:07 jdolecek Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.16 2017/06/21 22:48:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.17 2018/10/22 20:57:07 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -67,7 +67,8 @@
        struct siisata_softc si_sc;
        pci_chipset_tag_t sc_pc;
        pcitag_t sc_pcitag;
-       void * sc_ih;
+       pci_intr_handle_t *sc_pihp;
+       void *sc_ih;
 };
 
 static int siisata_pci_match(device_t, cfdata_t, void *);
@@ -147,7 +148,6 @@
        const char *intrstr;
        pcireg_t csr, memtype;
        const struct siisata_pci_board *spbp;
-       pci_intr_handle_t intrhandle;
        bus_space_tag_t memt;
        bus_space_handle_t memh;
        uint32_t gcreg;
@@ -209,15 +209,15 @@
                sc->sc_dmat = pa->pa_dmat;
 
        /* map interrupt */
-       if (pci_intr_map(pa, &intrhandle) != 0) {
+       if (pci_intr_alloc(pa, &psc->sc_pihp, NULL, 0) != 0) {
                bus_space_unmap(sc->sc_grt, sc->sc_grh, grsize);
                bus_space_unmap(sc->sc_prt, sc->sc_prh, prsize);
                aprint_error_dev(self, "couldn't map interrupt\n");
                return;
        }
-       intrstr = pci_intr_string(pa->pa_pc, intrhandle, intrbuf,
+       intrstr = pci_intr_string(pa->pa_pc, psc->sc_pihp[0], intrbuf,
            sizeof(intrbuf));
-       psc->sc_ih = pci_intr_establish_xname(pa->pa_pc, intrhandle,
+       psc->sc_ih = pci_intr_establish_xname(pa->pa_pc, psc->sc_pihp[0],
            IPL_BIO, siisata_intr, sc, device_xname(self));
        if (psc->sc_ih == NULL) {
                bus_space_unmap(sc->sc_grt, sc->sc_grh, grsize);
@@ -290,6 +290,11 @@
        if (rv)
                return rv;
 
+       if (psc->sc_pihp != NULL) {
+               pci_intr_release(psc->sc_pc, psc->sc_pihp, 1);
+               psc->sc_pihp = NULL;
+       }
+       
        if (psc->sc_ih != NULL) {
                pci_intr_disestablish(psc->sc_pc, psc->sc_ih);
        }



Home | Main Index | Thread Index | Old Index