diff options
author | marcel <marcel@FreeBSD.org> | 2008-04-26 18:35:44 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2008-04-26 18:35:44 +0000 |
commit | 300a2381229dad74f8419cf1c6bffa99e4c6e1ad (patch) | |
tree | 389334e40309425443dcbb313150102b5cf3a343 /sys/powerpc/powermac | |
parent | 36c68051b228782e34316508b5112de3269d6674 (diff) | |
download | FreeBSD-src-300a2381229dad74f8419cf1c6bffa99e4c6e1ad.zip FreeBSD-src-300a2381229dad74f8419cf1c6bffa99e4c6e1ad.tar.gz |
Take into account the size of the interrupt cell. It's determined
by the parent for interrupt resources. This corrects parsing of
the interrupts property.
With parsing of the property fixed, add all interrupts to the
resource list. Bump the max. number of interrupts from 5 to 6
as scc(4) attached to macio(4) has 6 interrupts (3 per channel).
Submitted by: Nathan Whitehorn <nathanw@uchicago.edu>
Diffstat (limited to 'sys/powerpc/powermac')
-rw-r--r-- | sys/powerpc/powermac/macio.c | 39 | ||||
-rw-r--r-- | sys/powerpc/powermac/maciovar.h | 2 |
2 files changed, 27 insertions, 14 deletions
diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c index b55d626..f4a4e9c 100644 --- a/sys/powerpc/powermac/macio.c +++ b/sys/powerpc/powermac/macio.c @@ -179,27 +179,40 @@ macio_get_quirks(const char *name) static void macio_add_intr(phandle_t devnode, struct macio_devinfo *dinfo) { - int intr; + int *intr; + int i, nintr; + phandle_t iparent; + int icells; - if (dinfo->mdi_ninterrupts >= 5) { - printf("macio: device has more than 5 interrupts\n"); + if (dinfo->mdi_ninterrupts >= 6) { + printf("macio: device has more than 6 interrupts\n"); return; } - if (OF_getprop(devnode, "interrupts", &intr, sizeof(intr)) == -1) { - if (OF_getprop(devnode, "AAPL,interrupts", &intr, - sizeof(intr)) == -1) + icells = 1; + + if (OF_getprop(devnode, "interrupt-parent", &iparent, sizeof(iparent)) == sizeof(iparent)) + OF_getprop(iparent, "#interrupt-cells", &icells, sizeof(icells)); + + nintr = OF_getprop_alloc(devnode, "interrupts", sizeof(*intr), + (void **)&intr); + if (nintr == -1) { + nintr = OF_getprop_alloc(devnode, "AAPL,interrupts", + sizeof(*intr), (void **)&intr); + if (nintr == -1) return; } - if (intr == -1) + if (intr[0] == -1) return; - resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ, - dinfo->mdi_ninterrupts, intr, intr, 1); + for (i = 0; i < nintr; i+=icells) { + resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ, + dinfo->mdi_ninterrupts, intr[i], intr[i], 1); - dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = intr; - dinfo->mdi_ninterrupts++; + dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = intr[i]; + dinfo->mdi_ninterrupts++; + } } @@ -413,9 +426,9 @@ macio_alloc_resource(device_t bus, device_t child, int type, int *rid, rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_IRQ, *rid); if (rle == NULL) { - if (dinfo->mdi_ninterrupts >= 5) { + if (dinfo->mdi_ninterrupts >= 6) { device_printf(bus, - "%s has more than 5 interrupts\n", + "%s has more than 6 interrupts\n", device_get_nameunit(child)); return (NULL); } diff --git a/sys/powerpc/powermac/maciovar.h b/sys/powerpc/powermac/maciovar.h index e289102..c1ff391 100644 --- a/sys/powerpc/powermac/maciovar.h +++ b/sys/powerpc/powermac/maciovar.h @@ -49,7 +49,7 @@ struct macio_reg { * Per macio device structure. */ struct macio_devinfo { - int mdi_interrupts[5]; + int mdi_interrupts[6]; int mdi_ninterrupts; int mdi_base; struct ofw_bus_devinfo mdi_obdinfo; |