svn commit: r184233 - head/sys/dev/iwn

Alexander Motin mav at FreeBSD.org
Fri Oct 24 21:21:44 UTC 2008


Author: mav
Date: Fri Oct 24 21:21:43 2008
New Revision: 184233
URL: http://svn.freebsd.org/changeset/base/184233

Log:
  Add MSI support.
  
  Tested on:	Acer TravelMate 6292 with 0x4229 chip.
  Reviewed by:	sam@

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Fri Oct 24 20:10:22 2008	(r184232)
+++ head/sys/dev/iwn/if_iwn.c	Fri Oct 24 21:21:43 2008	(r184233)
@@ -253,7 +253,7 @@ iwn_attach(device_t dev)
 	struct iwn_softc *sc = (struct iwn_softc *)device_get_softc(dev);
 	struct ieee80211com *ic;
 	struct ifnet *ifp;
-	int i, error;
+	int i, error, result;
 
 	sc->sc_dev = dev;
 
@@ -282,6 +282,9 @@ iwn_attach(device_t dev)
 	sc->sc_st = rman_get_bustag(sc->mem);
 	sc->sc_sh = rman_get_bushandle(sc->mem);
 	sc->irq_rid = 0;
+	if ((result = pci_msi_count(dev)) == 1 &&
+	    pci_alloc_msi(dev, &result) == 0)
+		sc->irq_rid = 1;
 	sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
 					 RF_ACTIVE | RF_SHAREABLE);
 	if (sc->irq == NULL) {
@@ -487,6 +490,8 @@ iwn_cleanup(device_t dev)
 	if (sc->irq != NULL) {
 		bus_teardown_intr(dev, sc->irq, sc->sc_ih);
 		bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
+		if (sc->irq_rid == 1)
+			pci_release_msi(dev);
 	}
 	if (sc->mem != NULL)
 		bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem);


More information about the svn-src-all mailing list