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 athn(4) attachment from pci_intr_map(...



details:   https://anonhg.NetBSD.org/src/rev/646e5b2a77a3
branches:  trunk
changeset: 341683:646e5b2a77a3
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Tue Nov 17 17:15:29 2015 +0000

description:
Switch PCI athn(4) attachment from pci_intr_map() to
pci_intr_alloc()/pci_intr_release(), this enables MSI where available.

diffstat:

 sys/dev/pci/if_athn_pci.c |  23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diffs (69 lines):

diff -r 4c2a0152ea3c -r 646e5b2a77a3 sys/dev/pci/if_athn_pci.c
--- a/sys/dev/pci/if_athn_pci.c Tue Nov 17 16:53:21 2015 +0000
+++ b/sys/dev/pci/if_athn_pci.c Tue Nov 17 17:15:29 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_athn_pci.c,v 1.10 2014/03/29 19:28:24 christos Exp $        */
+/*     $NetBSD: if_athn_pci.c,v 1.11 2015/11/17 17:15:29 jakllsch Exp $        */
 /*     $OpenBSD: if_athn_pci.c,v 1.11 2011/01/08 10:02:32 damien Exp $ */
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_athn_pci.c,v 1.10 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_pci.c,v 1.11 2015/11/17 17:15:29 jakllsch Exp $");
 
 #include "opt_inet.h"
 
@@ -66,7 +66,7 @@
        /* PCI specific goo. */
        pci_chipset_tag_t       psc_pc;
        pcitag_t                psc_tag;
-       pci_intr_handle_t       psc_pih;
+       pci_intr_handle_t       *psc_pihp;
        void                    *psc_ih;
        bus_space_tag_t         psc_iot;
        bus_space_handle_t      psc_ioh;
@@ -200,14 +200,15 @@
        /*
         * Arrange interrupt line.
         */
-       if (pci_intr_map(pa, &psc->psc_pih) != 0) {
+       if (pci_intr_alloc(pa, &psc->psc_pihp, NULL, 0) != 0) {
                aprint_error_dev(self, "couldn't map interrupt\n");
                goto fail1;
        }
 
-       intrstr = pci_intr_string(psc->psc_pc, psc->psc_pih, intrbuf, sizeof(intrbuf));
-       psc->psc_ih = pci_intr_establish(psc->psc_pc, psc->psc_pih, IPL_NET,
-           athn_intr, sc);
+       intrstr = pci_intr_string(psc->psc_pc, psc->psc_pihp[0], intrbuf,
+           sizeof(intrbuf));
+       psc->psc_ih = pci_intr_establish(psc->psc_pc, psc->psc_pihp[0],
+           IPL_NET, athn_intr, sc);
        if (psc->psc_ih == NULL) {
                aprint_error_dev(self, "couldn't map interrupt\n");
                goto fail1;
@@ -250,6 +251,10 @@
                pci_intr_disestablish(psc->psc_pc, psc->psc_ih);
                psc->psc_ih = NULL;
        }
+       if (psc->psc_pihp != NULL) {
+               pci_intr_release(psc->psc_pc, psc->psc_pihp, 1);
+               psc->psc_pihp = NULL;
+       }
        if (psc->psc_mapsz > 0) {
                bus_space_unmap(psc->psc_iot, psc->psc_ioh, psc->psc_mapsz);
                psc->psc_mapsz = 0;
@@ -299,8 +304,8 @@
        if (reg & 0xff00)
                pci_conf_write(psc->psc_pc, psc->psc_tag, 0x40, reg & ~0xff00);
 
-       psc->psc_ih = pci_intr_establish(psc->psc_pc, psc->psc_pih, IPL_NET,
-           athn_intr, sc);
+       psc->psc_ih = pci_intr_establish(psc->psc_pc, psc->psc_pihp[0],
+           IPL_NET, athn_intr, sc);
        if (psc->psc_ih == NULL) {
                aprint_error_dev(self, "couldn't map interrupt\n");
                return false;



Home | Main Index | Thread Index | Old Index