Module Name:    src
Committed By:   jakllsch
Date:           Tue Nov 17 17:15:29 UTC 2015

Modified Files:
        src/sys/dev/pci: if_athn_pci.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/if_athn_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/if_athn_pci.c
diff -u src/sys/dev/pci/if_athn_pci.c:1.10 src/sys/dev/pci/if_athn_pci.c:1.11
--- src/sys/dev/pci/if_athn_pci.c:1.10	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_athn_pci.c	Tue Nov 17 17:15:29 2015
@@ -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 @@ struct athn_pci_softc {
 	/* 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 @@ athn_pci_attach(device_t parent, device_
 	/*
 	 * 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 @@ athn_pci_detach(device_t self, int flags
 		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 @@ athn_pci_resume(device_t self, const pmf
 	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;

Reply via email to