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.



details:   https://anonhg.NetBSD.org/src/rev/2fb218b917e8
branches:  trunk
changeset: 836507:2fb218b917e8
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Oct 21 00:51:12 2018 +0000

description:
Enable MSI support where available.

diffstat:

 sys/dev/pci/if_msk.c    |  16 ++++++++++------
 sys/dev/pci/if_mskvar.h |   3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (73 lines):

diff -r d8a7ab6e049f -r 2fb218b917e8 sys/dev/pci/if_msk.c
--- a/sys/dev/pci/if_msk.c      Sun Oct 21 00:42:05 2018 +0000
+++ b/sys/dev/pci/if_msk.c      Sun Oct 21 00:51:12 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.78 2018/09/14 18:46:47 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.79 2018/10/21 00:51:12 jmcneill Exp $ */
 /*     $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $     */
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.78 2018/09/14 18:46:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.79 2018/10/21 00:51:12 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1359,7 +1359,6 @@
        struct skc_attach_args skca;
        pci_chipset_tag_t pc = pa->pa_pc;
        pcireg_t command, memtype;
-       pci_intr_handle_t ih;
        const char *intrstr = NULL;
        int rc, sk_nodenum;
        u_int8_t hw, pmd;
@@ -1431,13 +1430,13 @@
        DPRINTFN(2, ("mskc_attach: allocate interrupt\n"));
 
        /* Allocate interrupt */
-       if (pci_intr_map(pa, &ih)) {
+       if (pci_intr_alloc(pa, &sc->sk_pihp, NULL, 0)) {
                aprint_error(": couldn't map interrupt\n");
                goto fail_1;
        }
 
-       intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-       sc->sk_intrhand = pci_intr_establish_xname(pc, ih, IPL_NET, msk_intr,
+       intrstr = pci_intr_string(pc, sc->sk_pihp[0], intrbuf, sizeof(intrbuf));
+       sc->sk_intrhand = pci_intr_establish_xname(pc, sc->sk_pihp[0], IPL_NET, msk_intr,
            sc, device_xname(sc->sk_dev));
        if (sc->sk_intrhand == NULL) {
                aprint_error(": couldn't establish interrupt");
@@ -1745,6 +1744,11 @@
                sc->sk_intrhand = NULL;
        }
 
+       if (sc->sk_pihp != NULL) {
+               pci_intr_release(sc->sk_pc, sc->sk_pihp, 1);
+               sc->sk_pihp = NULL;
+       }
+
        rv = config_detach_children(self, flags);
        if (rv != 0)
                return (rv);
diff -r d8a7ab6e049f -r 2fb218b917e8 sys/dev/pci/if_mskvar.h
--- a/sys/dev/pci/if_mskvar.h   Sun Oct 21 00:42:05 2018 +0000
+++ b/sys/dev/pci/if_mskvar.h   Sun Oct 21 00:51:12 2018 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $  */
-/*     $NetBSD: if_mskvar.h,v 1.19 2018/09/14 18:46:47 jakllsch Exp $  */
+/*     $NetBSD: if_mskvar.h,v 1.20 2018/10/21 00:51:12 jmcneill Exp $  */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -193,6 +193,7 @@
        bus_space_tag_t         sk_btag;        /* bus space tag */
        bus_size_t              sk_bsize;       /* bus space size */
        void                    *sk_intrhand;   /* irq handler handle */
+       pci_intr_handle_t       *sk_pihp;
        pci_chipset_tag_t       sk_pc;
        u_int8_t                sk_fibertype;
        u_int8_t                sk_type;



Home | Main Index | Thread Index | Old Index