Date: Thu, 03 Apr 2008 22:10:11 -0500 From: Nathan Whitehorn <nathanw@uchicago.edu> To: freebsd-ppc@freebsd.org Subject: Re: BMAC Ethernet Driver Message-ID: <47F59C13.9030705@uchicago.edu> In-Reply-To: <3B02E59E-5399-40B6-9747-2F49200FD708@mac.com> References: <47E06B23.7060400@uchicago.edu> <20080325023040.ab0daa19.stas@FreeBSD.org> <47E8527B.2050002@uchicago.edu> <47F39EF4.8040800@uchicago.edu> <C83E8810-B68B-49B5-A7F4-8B72A4FFFFDA@mac.com> <47F3D2BC.7060001@uchicago.edu> <47F422A0.9080907@uchicago.edu> <CB59240D-E385-4D4C-9372-E9D418502F61@mac.com> <EB224547-BCC9-4467-98E5-1D8EC0352349@mac.com> <Pine.GSO.4.62.0804022152590.20081@harper.uchicago.edu> <C1AB89FF-C466-46B0-BA83-2AD2989E73F9@mac.com> <47F4E007.90802@uchicago.edu> <3B02E59E-5399-40B6-9747-2F49200FD708@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --Boundary_(ID_RxzxIkHXi5e4Hyi9c4g2Ng) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT 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 --Boundary_(ID_RxzxIkHXi5e4Hyi9c4g2Ng) Content-type: text/plain; name=macio.patch Content-transfer-encoding: 7BIT Content-disposition: inline; filename=macio.patch --- 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; --Boundary_(ID_RxzxIkHXi5e4Hyi9c4g2Ng)--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47F59C13.9030705>