Module Name: src Committed By: jdolecek Date: Mon Oct 22 20:57:07 UTC 2018
Modified Files: src/sys/dev/pci: siisata_pci.c Log Message: enable MSI support where available, blatantly copied from jmcneill's msk(4) To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/siisata_pci.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/pci/siisata_pci.c diff -u src/sys/dev/pci/siisata_pci.c:1.16 src/sys/dev/pci/siisata_pci.c:1.17 --- src/sys/dev/pci/siisata_pci.c:1.16 Wed Jun 21 22:48:05 2017 +++ src/sys/dev/pci/siisata_pci.c Mon Oct 22 20:57:07 2018 @@ -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_pci_softc { 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 @@ siisata_pci_attach(device_t parent, devi 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 @@ siisata_pci_attach(device_t parent, devi 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 @@ siisata_pci_detach(device_t dv, int flag 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); }