Source-Changes-HG archive

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

[src/nick-nhusb]: src/sys/dev/pci Switch PCI xhci(4) attachment from pci_intr...



details:   https://anonhg.NetBSD.org/src/rev/289f3296e1d4
branches:  nick-nhusb
changeset: 334470:289f3296e1d4
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Apr 05 15:36:48 2016 +0000

description:
Switch PCI xhci(4) attachment from pci_intr_map() to
pci_intr_alloc()/pci_intr_release().

This enables MSI where available.

diffstat:

 sys/dev/pci/xhci_pci.c |  26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diffs (77 lines):

diff -r 64530b9faa26 -r 289f3296e1d4 sys/dev/pci/xhci_pci.c
--- a/sys/dev/pci/xhci_pci.c    Mon Apr 04 07:43:12 2016 +0000
+++ b/sys/dev/pci/xhci_pci.c    Tue Apr 05 15:36:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci_pci.c,v 1.4.2.4 2015/08/31 08:33:03 skrll Exp $   */
+/*     $NetBSD: xhci_pci.c,v 1.4.2.5 2016/04/05 15:36:48 skrll Exp $   */
 /*     OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.4.2.4 2015/08/31 08:33:03 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.4.2.5 2016/04/05 15:36:48 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -70,6 +70,7 @@
        pci_chipset_tag_t       sc_pc;
        pcitag_t                sc_tag;
        void                    *sc_ih;
+       pci_intr_handle_t       *sc_pihp;
 };
 
 static int
@@ -142,7 +143,6 @@
        const pci_chipset_tag_t pc = pa->pa_pc;
        const pcitag_t tag = pa->pa_tag;
        char const *intrstr;
-       pci_intr_handle_t ih;
        pcireg_t csr, memtype;
        int err;
        uint32_t hccparams;
@@ -198,17 +198,15 @@
        pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
                       csr | PCI_COMMAND_MASTER_ENABLE);
 
-       /* Map and establish the interrupt. */
-       if (pci_intr_map(pa, &ih)) {
-               aprint_error_dev(self, "couldn't map interrupt\n");
+       /* Allocate and establish the interrupt. */
+       if (pci_intr_alloc(pa, &psc->sc_pihp, NULL, 0)) {
+               aprint_error_dev(self, "can't allocate handler\n");
                goto fail;
        }
-
-       /*
-        * Allocate IRQ
-        */
-       intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-       psc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, xhci_intr, sc);
+       intrstr = pci_intr_string(pc, psc->sc_pihp[0], intrbuf,
+           sizeof(intrbuf));
+       psc->sc_ih = pci_intr_establish(pc, psc->sc_pihp[0], IPL_USB,
+           xhci_intr, sc);
        if (psc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
@@ -251,7 +249,7 @@
 
 fail:
        if (psc->sc_ih) {
-               pci_intr_disestablish(psc->sc_pc, psc->sc_ih);
+               pci_intr_release(psc->sc_pc, psc->sc_pihp, 1);
                psc->sc_ih = NULL;
        }
        if (sc->sc_ios) {
@@ -285,7 +283,7 @@
        }
 
        if (psc->sc_ih != NULL) {
-               pci_intr_disestablish(psc->sc_pc, psc->sc_ih);
+               pci_intr_release(psc->sc_pc, psc->sc_pihp, 1);
                psc->sc_ih = NULL;
        }
        if (sc->sc_ios) {



Home | Main Index | Thread Index | Old Index