summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2009-05-06 02:31:07 +0000
committergonzo <gonzo@FreeBSD.org>2009-05-06 02:31:07 +0000
commitdc2660a7b6a95439a453d2ac7bf2973d0409a396 (patch)
tree89a2c5670034f2f5a6d1679a458df17f487fbafd /sys
parent27c94311cad8a148300e55b50c18eca1fb57e523 (diff)
downloadFreeBSD-src-dc2660a7b6a95439a453d2ac7bf2973d0409a396.zip
FreeBSD-src-dc2660a7b6a95439a453d2ac7bf2973d0409a396.tar.gz
- 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
Diffstat (limited to 'sys')
-rw-r--r--sys/mips/atheros/apb.c28
-rw-r--r--sys/mips/atheros/apbvar.h1
2 files changed, 24 insertions, 5 deletions
diff --git a/sys/mips/atheros/apb.c b/sys/mips/atheros/apb.c
index d53408c..f6e20a7 100644
--- a/sys/mips/atheros/apb.c
+++ b/sys/mips/atheros/apb.c
@@ -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_t child, int type, int *rid,
/*
* 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_t child, int type, int *rid,
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 child, struct resource *ires,
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;
}
diff --git a/sys/mips/atheros/apbvar.h b/sys/mips/atheros/apbvar.h
index e1d29f4..9afd690 100644
--- a/sys/mips/atheros/apbvar.h
+++ b/sys/mips/atheros/apbvar.h
@@ -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 */
OpenPOWER on IntegriCloud