Module Name: src Committed By: jdolecek Date: Thu Oct 25 21:07:58 UTC 2018
Modified Files: src/sys/dev/pci: ehci_pci.c Log Message: enable MSI support where available To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/ehci_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/ehci_pci.c diff -u src/sys/dev/pci/ehci_pci.c:1.67 src/sys/dev/pci/ehci_pci.c:1.68 --- src/sys/dev/pci/ehci_pci.c:1.67 Thu May 10 03:41:00 2018 +++ src/sys/dev/pci/ehci_pci.c Thu Oct 25 21:07:58 2018 @@ -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 @@ struct ehci_pci_softc { 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 @@ ehci_pci_attach(device_t parent, device_ 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 @@ ehci_pci_attach(device_t parent, device_ 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 @@ ehci_pci_attach(device_t parent, device_ /* * 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 @@ ehci_pci_detach(device_t self, int flags 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);