PERFORCE change 98148 for review

Kip Macy kmacy at FreeBSD.org
Tue May 30 12:17:07 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=98148

Change 98148 by kmacy at kmacy_storage:sun4v_work on 2006/05/30 19:15:21

	don't register all 4 PCI interrupts for every device

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#41 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#41 (text+ko) ====

@@ -426,41 +426,38 @@
 	struct hvpci_softc *sc;
 	int pciintr, rid;
 	int error;
-	int i;
+
 
 	sc = device_get_softc(dev);
 
-	pciintr = rman_get_start(ires);
+	rid = rman_get_start(ires);
+	pciintr = rid - 1;
+	printf("pciintr=0x%x\n", pciintr);
 	/* sun4v uses 1 through 4 interrupts */
 	KASSERT(pciintr >= 1 && pciintr <= 4, ("interrupt out of range"));
-	for (i = 1; i <= 4; i++) {
-	rid = pciintr = i;
-	pciintr--;
 	if (sc->hs_intr[pciintr] == NULL) {
 		if ((sc->hs_intr[pciintr] = bus_alloc_resource_any(dev,
-		    SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
+			  SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
 			device_printf(dev, "couldn't alloc interrupt\n");
-			return (ENXIO);
+				return (ENXIO);
 		}
 		sc->hs_intrrefcnt[pciintr] = 1;
 	} else
 		sc->hs_intrrefcnt[pciintr]++;
-
+	
 	error = bus_setup_intr(dev, sc->hs_intr[pciintr], flags, intr, arg,
-	    cookiep);
+			       cookiep);
 	if (error) {
 		sc->hs_intrrefcnt[pciintr]--;
 		if (sc->hs_intrrefcnt[pciintr] == 0) {
 			bus_release_resource(dev, SYS_RES_IRQ,
-			    rman_get_rid(sc->hs_intr[pciintr]),
-			    sc->hs_intr[pciintr]);
+					     rman_get_rid(sc->hs_intr[pciintr]),
+					     sc->hs_intr[pciintr]);
 			sc->hs_intr[pciintr] = NULL;
 		}
 		device_printf(dev, "bus_setup_intr: %d\n", error);
-		return (error);
-	}
+			return (error);
 	}
-
 	return (0);
 }
 


More information about the p4-projects mailing list