PERFORCE change 109408 for review

Sam Leffler sam at FreeBSD.org
Tue Nov 7 01:29:42 UTC 2006


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

Change 109408 by sam at sam_ebb on 2006/11/07 01:29:23

	o add comments
	o be pedantic and cleanup resources in detach

Affected files ...

.. //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_qmgr.c#2 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_qmgr.c#2 (text+ko) ====

@@ -59,6 +59,20 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+/*
+ * Intel XScale Queue Manager support.
+ *
+ * Each IXP4XXX device has a hardware block that implements a priority
+ * queue manager that is shared between the XScale cpu and the backend
+ * devices (such as the NPE).  Queues are accessed by reading/writing
+ * special memory locations.  The queue contents are mapped into a shared
+ * SRAM region with entries managed in a circular buffer.  The XScale
+ * processor can receive interrupts based on queue contents (a condition
+ * code determines when interrupts should be delivered).
+ *
+ * The code here basically replaces the qmgr class in the Intel Access
+ * Library (IAL).
+ */
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -121,6 +135,7 @@
 	bus_space_handle_t	sc_ioh;
 	struct resource		*sc_irq;	/* IRQ resource */
 	void			*sc_ih;		/* interrupt handler */
+	int			sc_rid;		/* resource id for irq */
 
 	struct qmgrInfo		qinfo[IX_QMGR_MAX_NUM_QUEUES];
 	/*
@@ -193,7 +208,7 @@
 {
 	struct ixpqmgr_softc *sc = device_get_softc(dev);
 	struct ixp425_softc *sa = device_get_softc(device_get_parent(dev));
-	int rid, i;
+	int i;
 
 	ixpqmgr_sc = sc;
 
@@ -204,7 +219,7 @@
 		panic("%s: Cannot map registers", device_get_name(dev));
 
 	/* NB: we only use the lower 32 q's */
-	sc->sc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
+	sc->sc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->sc_rid,
 	    IXP425_INT_QUE1_32, IXP425_INT_QUE33_64, 2, RF_ACTIVE);
 	if (!sc->sc_irq)
 		panic("Unable to allocate the qmgr irqs.\n");
@@ -288,8 +303,9 @@
 	struct ixpqmgr_softc *sc = device_get_softc(dev);
 
 	aqm_reset(sc);		/* disable interrupts */
-	/* XXX unmap memory */
-	/* XXX free irq */
+	bus_teardown_intr(dev, sc->sc_irq, sc->sc_ih);
+	bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid, sc->sc_irq);
+	bus_space_unmap(sc->sc_iot, sc->sc_ioh, IXP425_QMGR_SIZE);
 }
 
 int


More information about the p4-projects mailing list