PERFORCE change 99929 for review

Paolo Pisati piso at FreeBSD.org
Sat Jun 24 11:35:35 UTC 2006


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

Change 99929 by piso at piso_newluxor on 2006/06/24 11:34:33

	Convert some bus_setup_intr() methods to the interrupt filter
	model: for now i just converted nexus on i386.
	
	Next step: reconvert all the previous marked drivers with
	FIX_INTR_FILTER to be real filters.

Affected files ...

.. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#5 edit
.. //depot/projects/soc2006/intr_filter/i386/i386/nexus.c#2 edit
.. //depot/projects/soc2006/intr_filter/i386/include/intr_machdep.h#2 edit
.. //depot/projects/soc2006/intr_filter/i386/isa/clock.c#3 edit
.. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#4 edit
.. //depot/projects/soc2006/intr_filter/sys/interrupt.h#3 edit

Differences ...

==== //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#5 (text+ko) ====

@@ -112,8 +112,8 @@
 }
 
 int
-intr_add_handler(const char *name, int vector, driver_intr_t handler,
-    void *arg, enum intr_type flags, void **cookiep)
+intr_add_handler(const char *name, int vector, driver_filter_t filter, 
+    driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep)
 {
 	struct intsrc *isrc;
 	int error;
@@ -121,8 +121,8 @@
 	isrc = intr_lookup_source(vector);
 	if (isrc == NULL)
 		return (EINVAL);
-	error = intr_event_add_handler(isrc->is_event, name, handler, arg,
-	    intr_priority(flags), flags, cookiep);
+	error = intr_event_add_handler(isrc->is_event, name, filter, handler,
+	    arg, intr_priority(flags), flags, cookiep);
 	if (error == 0) {
 		intrcnt_updatename(isrc);
 		mtx_lock_spin(&intr_table_lock);

==== //depot/projects/soc2006/intr_filter/i386/i386/nexus.c#2 (text+ko) ====

@@ -97,7 +97,7 @@
 static	int nexus_release_resource(device_t, device_t, int, int,
 				   struct resource *);
 static	int nexus_setup_intr(device_t, device_t, struct resource *, int flags,
-			     void (*)(void *), void *, void **);
+			     driver_filter_t, void (*)(void *), void *, void **);
 static	int nexus_teardown_intr(device_t, device_t, struct resource *,
 				void *);
 static struct resource_list *nexus_get_reslist(device_t dev, device_t child);
@@ -477,7 +477,8 @@
  */
 static int
 nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
-		 int flags, void (*ihand)(void *), void *arg, void **cookiep)
+		 int flags, driver_filter_t filter, void (*ihand)(void *), 
+		 void *arg, void **cookiep)
 {
 	int		error;
 
@@ -497,7 +498,7 @@
 		return (error);
 
 	error = intr_add_handler(device_get_nameunit(child),
-	    rman_get_start(irq), ihand, arg, flags, cookiep);
+	    rman_get_start(irq), filter, ihand, arg, flags, cookiep);
 
 	return (error);
 }

==== //depot/projects/soc2006/intr_filter/i386/include/intr_machdep.h#2 (text+ko) ====

@@ -124,8 +124,8 @@
 #else
 #define	intr_add_cpu(apic_id)
 #endif
-int	intr_add_handler(const char *name, int vector, driver_intr_t handler,
-    void *arg, enum intr_type flags, void **cookiep);
+int	intr_add_handler(const char *name, int vector, driver_filter_t filter, 
+    driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep);
 int	intr_config_intr(int vector, enum intr_trigger trig,
     enum intr_polarity pol);
 void	intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame);

==== //depot/projects/soc2006/intr_filter/i386/isa/clock.c#3 (text+ko) ====

@@ -824,8 +824,7 @@
 	 * timecounter to user a simpler algorithm.
 	 */
 	if (!using_lapic_timer) {
-		// XXX - FIX_INTR_FILTER
-		intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
+		intr_add_handler("clk", 0, (driver_filter_t *)clkintr, NULL, NULL,
 		    INTR_TYPE_CLK | INTR_FAST, NULL);
 		i8254_intsrc = intr_lookup_source(0);
 		if (i8254_intsrc != NULL)
@@ -859,8 +858,7 @@
 
 		/* Enable periodic interrupts from the RTC. */
 		rtc_statusb |= RTCSB_PINTR;
-		// XXX - FIX_INTR_FILTER
-		intr_add_handler("rtc", 8, (driver_intr_t *)rtcintr, NULL,
+		intr_add_handler("rtc", 8, (driver_filter_t *)rtcintr, NULL, NULL,
 		    INTR_TYPE_CLK | INTR_FAST, NULL);
 
 		writertc(RTC_STATUSB, rtc_statusb);

==== //depot/projects/soc2006/intr_filter/kern/kern_intr.c#4 (text+ko) ====

@@ -323,8 +323,8 @@
 
 int
 intr_event_add_handler(struct intr_event *ie, const char *name,
-    driver_intr_t handler, void *arg, u_char pri, enum intr_type flags,
-    void **cookiep)
+    driver_filter_t filter, driver_intr_t handler, void *arg, u_char pri, 
+    enum intr_type flags, void **cookiep)
 {
 	struct intr_handler *ih, *temp_ih;
 	struct intr_thread *it;
@@ -334,6 +334,7 @@
 
 	/* Allocate and populate an interrupt handler structure. */
 	ih = malloc(sizeof(struct intr_handler), M_ITHREAD, M_WAITOK | M_ZERO);
+	ih->ih_filter = filter;
 	ih->ih_handler = handler;
 	ih->ih_argument = arg;
 	ih->ih_name = name;
@@ -568,7 +569,7 @@
 		if (eventp != NULL)
 			*eventp = ie;
 	}
-	return (intr_event_add_handler(ie, name, handler, arg,
+	return (intr_event_add_handler(ie, name, NULL, handler, arg,
 		    (pri * RQ_PPQ) + PI_SOFT, flags, cookiep));
 		    /* XXKSE.. think of a better way to get separate queues */
 }
@@ -789,8 +790,8 @@
 		 */
 		arg = ((ih->ih_argument == NULL) ? frame : ih->ih_argument);
 		
-		CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
-		     ih->ih_handler, arg, ih->ih_name);
+		CTR5(KTR_INTR, "%s: exec %p/%p(%p) for %s", __func__,
+		     ih->ih_filter, ih->ih_handler, arg, ih->ih_name);
 
 		if (ih->ih_flags & IH_FAST) {
 			// XXX - actually should call ih_filter()...

==== //depot/projects/soc2006/intr_filter/sys/interrupt.h#3 (text+ko) ====

@@ -43,6 +43,7 @@
  * together.
  */
 struct intr_handler {
+	driver_filter_t	*ih_filter;	/* Filter function. */
 	driver_intr_t	*ih_handler;	/* Handler function. */
 	void		*ih_argument;	/* Argument to pass to handler. */
 	int		 ih_flags;
@@ -115,7 +116,7 @@
 int     intr_filter_loop(struct intr_event *ie, struct trapframe *frame);
 u_char	intr_priority(enum intr_type flags);
 int	intr_event_add_handler(struct intr_event *ie, const char *name,
-	    driver_intr_t handler, void *arg, u_char pri, enum intr_type flags,
+	    driver_filter_t filter, driver_intr_t handler, void *arg, u_char pri, enum intr_type flags,
 	    void **cookiep);
 int	intr_event_create(struct intr_event **event, void *source,
 	    int flags, void (*enable)(void *), const char *fmt, ...)


More information about the p4-projects mailing list