Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 May 2009 02:31:08 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r191837 - projects/mips/sys/mips/atheros
Message-ID:  <200905060231.n462V8JN001265@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Wed May  6 02:31:07 2009
New Revision: 191837
URL: http://svn.freebsd.org/changeset/base/191837

Log:
  - Handle memory requests on apb level, do not pass them up to
      nexus
  - Unmask IRQ in bus_intr_setup
  - Do not count timer IRQ (IRQ0) as stray

Modified:
  projects/mips/sys/mips/atheros/apb.c
  projects/mips/sys/mips/atheros/apbvar.h

Modified: projects/mips/sys/mips/atheros/apb.c
==============================================================================
--- projects/mips/sys/mips/atheros/apb.c	Wed May  6 01:50:04 2009	(r191836)
+++ projects/mips/sys/mips/atheros/apb.c	Wed May  6 02:31:07 2009	(r191837)
@@ -101,6 +101,16 @@ apb_attach(device_t dev)
 	int rid = 0;
 
 	device_set_desc(dev, "APB Bus bridge");
+
+	sc->apb_mem_rman.rm_type = RMAN_ARRAY;
+	sc->apb_mem_rman.rm_descr = "APB memory window";
+
+	if (rman_init(&sc->apb_mem_rman) != 0 ||
+	    rman_manage_region(&sc->apb_mem_rman, 
+			AR71XX_APB_BASE, 
+			AR71XX_APB_BASE + AR71XX_APB_SIZE - 1) != 0)
+		panic("apb_attach: failed to set up memory rman");
+
 	sc->apb_irq_rman.rm_type = RMAN_ARRAY;
 	sc->apb_irq_rman.rm_descr = "APB IRQ";
 
@@ -145,18 +155,19 @@ apb_alloc_resource(device_t bus, device_
 	/*
 	 * Pass memory requests to nexus device
 	 */
-	passthrough = (device_get_parent(child) != bus) ||
-		(type == SYS_RES_MEMORY);
+	passthrough = (device_get_parent(child) != bus);
 	rle = NULL;
 
-	dprintf("%s: entry (%p, %p, %d, %p, %p, %p, %ld, %d)\n",
-	    __func__, bus, child, type, rid, (void *)(intptr_t)start,
+	dprintf("%s: entry (%p, %p, %d, %d, %p, %p, %ld, %d)\n",
+	    __func__, bus, child, type, *rid, (void *)(intptr_t)start,
 	    (void *)(intptr_t)end, count, flags);
 
 	if (passthrough)
 		return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type,
 		    rid, start, end, count, flags));
 
+	printf("not pass through\n");
+
 	/*
 	 * If this is an allocation of the "default" range for a given RID,
 	 * and we know what the resources for this device are (ie. they aren't
@@ -185,6 +196,9 @@ apb_alloc_resource(device_t bus, device_
 	case SYS_RES_IRQ:
 		rm = &sc->apb_irq_rman;
 		break;
+	case SYS_RES_MEMORY:
+		rm = &sc->apb_mem_rman;
+		break;
 	default:
 		printf("%s: unknown resource type %d\n", __func__, type);
 		return (0);
@@ -275,6 +289,8 @@ apb_setup_intr(device_t bus, device_t ch
 	intr_event_add_handler(event, device_get_nameunit(child), filt,
 	    handler, arg, intr_priority(flags), flags, cookiep);
 
+	apb_unmask_irq(irq);
+
 	return (0);
 }
 
@@ -313,7 +329,9 @@ apb_intr(void *arg)
 		if (reg & (1 << irq)) {
 			event = sc->sc_eventstab[irq];
 			if (!event || TAILQ_EMPTY(&event->ie_handlers)) {
-				printf("Stray IRQ %d\n", irq);
+				/* Ignore timer interrupts */
+				if (irq != 0)
+					printf("Stray IRQ %d\n", irq);
 				continue;
 			}
 

Modified: projects/mips/sys/mips/atheros/apbvar.h
==============================================================================
--- projects/mips/sys/mips/atheros/apbvar.h	Wed May  6 01:50:04 2009	(r191836)
+++ projects/mips/sys/mips/atheros/apbvar.h	Wed May  6 02:31:07 2009	(r191837)
@@ -34,6 +34,7 @@
 
 struct apb_softc {
 	struct rman		apb_irq_rman;
+	struct rman		apb_mem_rman;
 	/* IRQ events structs for child devices */
 	struct intr_event	*sc_eventstab[APB_NIRQS];	
 	/* Resources and cookies for MIPS CPU INTs */



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