Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Switch PCI re(4) attachment from pci_intr_map() to



details:   https://anonhg.NetBSD.org/src/rev/62a7fcd5f608
branches:  trunk
changeset: 812423:62a7fcd5f608
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Dec 14 20:01:17 2015 +0000

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

This enables MSI where available.

diffstat:

 sys/dev/pci/if_re_pci.c |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (64 lines):

diff -r 5ef37abef49f -r 62a7fcd5f608 sys/dev/pci/if_re_pci.c
--- a/sys/dev/pci/if_re_pci.c   Mon Dec 14 18:24:06 2015 +0000
+++ b/sys/dev/pci/if_re_pci.c   Mon Dec 14 20:01:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_re_pci.c,v 1.44 2015/05/03 00:04:06 matt Exp $      */
+/*     $NetBSD: if_re_pci.c,v 1.45 2015/12/14 20:01:17 jakllsch Exp $  */
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.44 2015/05/03 00:04:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.45 2015/12/14 20:01:17 jakllsch Exp $");
 
 #include <sys/types.h>
 
@@ -75,6 +75,7 @@
        struct rtk_softc sc_rtk;
 
        void *sc_ih;
+       pci_intr_handle_t *sc_pihp;
        pci_chipset_tag_t sc_pc;
 };
 
@@ -174,7 +175,6 @@
        struct rtk_softc *sc = &psc->sc_rtk;
        struct pci_attach_args *pa = aux;
        pci_chipset_tag_t pc = pa->pa_pc;
-       pci_intr_handle_t ih;
        const char *intrstr = NULL;
        const struct rtk_type *t;
        uint32_t hwrev;
@@ -253,12 +253,14 @@
 
        /* Hook interrupt last to avoid having to lock softc */
        /* Allocate interrupt */
-       if (pci_intr_map(pa, &ih)) {
+       if (pci_intr_alloc(pa, &psc->sc_pihp, NULL, 0)) {
                aprint_error_dev(self, "couldn't map interrupt\n");
                return;
        }
-       intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-       psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, re_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_NET,
+           re_intr, sc);
        if (psc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
@@ -305,6 +307,11 @@
                psc->sc_ih = NULL;
        }
 
+       if (psc->sc_pihp != NULL) {
+               pci_intr_release(psc->sc_pc, psc->sc_pihp, 1);
+               psc->sc_pihp = NULL;
+       }
+
        if (sc->rtk_bsize != 0) {
                bus_space_unmap(sc->rtk_btag, sc->rtk_bhandle, sc->rtk_bsize);
                sc->rtk_bsize = 0;



Home | Main Index | Thread Index | Old Index