Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Aug 2012 16:55:01 +0000 (UTC)
From:      Jakub Wojciech Klama <jceel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r239096 - in user/jceel/soc2012_armv6/sys: arm/arm arm/include kern
Message-ID:  <201208061655.q76Gt1hZ060191@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jceel
Date: Mon Aug  6 16:55:01 2012
New Revision: 239096
URL: http://svn.freebsd.org/changeset/base/239096

Log:
  Remove need of passing trapframes between consecutive arm_dispatch_irq()
  calls. Trapframe will be stored in thread td_intr_frame variable in first
  arm_dispatch_irq() call (at root interrupt controlled) and maintained
  in whole IRQ handling path.

Modified:
  user/jceel/soc2012_armv6/sys/arm/arm/gic.c
  user/jceel/soc2012_armv6/sys/arm/arm/intrng.c
  user/jceel/soc2012_armv6/sys/arm/include/intr.h
  user/jceel/soc2012_armv6/sys/kern/kern_intr.c

Modified: user/jceel/soc2012_armv6/sys/arm/arm/gic.c
==============================================================================
--- user/jceel/soc2012_armv6/sys/arm/arm/gic.c	Mon Aug  6 16:37:43 2012	(r239095)
+++ user/jceel/soc2012_armv6/sys/arm/arm/gic.c	Mon Aug  6 16:55:01 2012	(r239096)
@@ -228,8 +228,7 @@ arm_gic_attach(device_t dev)
 static int
 arm_gic_intr(void *arg)
 {
-	struct arm_intr_data *id = (struct arm_intr_data *)arg;
-	struct arm_gic_softc *sc = (struct arm_gic_softc *)id->arg;
+	struct arm_gic_softc *sc = (struct arm_gic_softc *)arg;
 	uint32_t active_irq, last_irq = 0;
 
 	active_irq = gic_c_read_4(sc, GICC_IAR);
@@ -251,7 +250,7 @@ arm_gic_intr(void *arg)
 	}
 	
 	gic_c_write_4(sc, GICC_EOIR, active_irq);
-	arm_dispatch_irq(sc->gic_dev, id->tf, active_irq);
+	arm_dispatch_irq(sc->gic_dev, NULL, active_irq);
 
 	return (FILTER_HANDLED);
 }

Modified: user/jceel/soc2012_armv6/sys/arm/arm/intrng.c
==============================================================================
--- user/jceel/soc2012_armv6/sys/arm/arm/intrng.c	Mon Aug  6 16:37:43 2012	(r239095)
+++ user/jceel/soc2012_armv6/sys/arm/arm/intrng.c	Mon Aug  6 16:55:01 2012	(r239096)
@@ -69,7 +69,6 @@ typedef void (*mask_fn)(void *);
 struct arm_intr_controller {
 	device_t		ic_dev;
 	phandle_t		ic_node;
-	struct arm_intr_data	ic_id;
 };
 
 struct arm_intr_handler {
@@ -92,7 +91,6 @@ void
 arm_dispatch_irq(device_t dev, struct trapframe *tf, int irq)
 {
 	struct arm_intr_handler *ih = NULL;
-	void *arg;
 	int i;
 
 	debugf("pic %s, tf %p, irq %d\n", device_get_nameunit(dev), tf, irq);
@@ -110,12 +108,6 @@ arm_dispatch_irq(device_t dev, struct tr
 
 	debugf("requested by %s\n", device_get_nameunit(ih->ih_dev));
 
-	arg = tf;
-
-	/* XXX */
-	for (i = 0; arm_pics[i].ic_dev != NULL; i++)
-		arm_pics[i].ic_id.tf = tf;
-
 	ih->ih_intrcnt++;
 	if (intr_event_handle(ih->ih_event, tf) != 0) {
 		/* Stray IRQ */
@@ -222,7 +214,6 @@ arm_setup_irqhandler(device_t dev, drive
 {
 	struct arm_intr_controller *pic;
 	struct arm_intr_handler *ih;
-	struct arm_intr_data *id;
 	int error;
 
 	if (irq < 0)
@@ -263,28 +254,17 @@ arm_setup_irqhandler(device_t dev, drive
 #endif
 	}
 
-	if (flags & INTR_CONTROLLER) {
-		struct arm_intr_controller *pic = NULL;
-		int i;
-		for (i = 0; i < NPIC; i++) {
-			if (arm_pics[i].ic_dev == dev)
-				pic = &arm_pics[i];
-		}
-
-		id = &pic->ic_id;
-		id->arg = arg;
-		arg = id;
-	}
-
 	intr_event_add_handler(ih->ih_event, device_get_nameunit(dev), filt, hand, arg,
 	    intr_priority(flags), flags, cookiep);
 
 	debugf("done\n");
+	*cookiep = ih;
 }
 
 int
 arm_remove_irqhandler(int irq, void *cookie)
 {
+	struct arm_intr_handler *ih = (struct arm_intr_handler *)ih;
 	/*
 	struct intr_event *event;
 	int error;

Modified: user/jceel/soc2012_armv6/sys/arm/include/intr.h
==============================================================================
--- user/jceel/soc2012_armv6/sys/arm/include/intr.h	Mon Aug  6 16:37:43 2012	(r239095)
+++ user/jceel/soc2012_armv6/sys/arm/include/intr.h	Mon Aug  6 16:55:01 2012	(r239096)
@@ -40,6 +40,7 @@
 #define _MACHINE_INTR_H_
 
 #include <machine/psl.h>
+#include <machine/pcb.h>
 #include <dev/ofw/openfirm.h>
 
 #include "opt_global.h"
@@ -50,11 +51,6 @@
 #define	NPIC		16
 #define	INTR_CONTROLLER	INTR_MD1
 
-struct arm_intr_data {
-	void *			arg;
-	struct trapframe *	tf;
-};
-
 int arm_fdt_map_irq(phandle_t ic, int irq);
 void arm_register_pic(device_t dev);
 void arm_unregister_pic(device_t dev);

Modified: user/jceel/soc2012_armv6/sys/kern/kern_intr.c
==============================================================================
--- user/jceel/soc2012_armv6/sys/kern/kern_intr.c	Mon Aug  6 16:37:43 2012	(r239095)
+++ user/jceel/soc2012_armv6/sys/kern/kern_intr.c	Mon Aug  6 16:55:01 2012	(r239096)
@@ -1418,7 +1418,12 @@ intr_event_handle(struct intr_event *ie,
 	ret = 0;
 	critical_enter();
 	oldframe = td->td_intr_frame;
-	td->td_intr_frame = frame;
+	
+	if (frame)
+		td->td_intr_frame = frame;
+	else
+		frame = td->td_intr_frame;
+	
 	TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
 		if (ih->ih_filter == NULL) {
 			thread = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208061655.q76Gt1hZ060191>