BMAC Ethernet Driver
Nathan Whitehorn
nathanw at uchicago.edu
Fri Apr 4 03:05:56 UTC 2008
Marcel Moolenaar wrote:
> Let's split the work. If you could fix macio(4) to use #interrupt-cells,
> I'll fix scc(4) to deal with the DBDMA interrupts...
I've attached a revised patch that does this, and is tested on an
OpenPIC system (G4 iBook) and on my G3.
-Nathan
-------------- next part --------------
--- macio.c 2007-12-20 18:23:22.000000000 -0600
+++ macio.c.multi 2008-04-03 20:00:23.562978813 -0500
@@ -179,27 +179,40 @@
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 @@
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);
}
--- maciovar.h 2005-12-03 05:59:26.000000000 -0600
+++ maciovar.h.multi 2008-04-03 20:00:31.643813109 -0500
@@ -49,7 +49,7 @@
* 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;
More information about the freebsd-ppc
mailing list