diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2009-01-03 19:38:47 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2009-01-03 19:38:47 +0000 |
commit | 4ca12119c31e0cd42b3cb4b28dd898b8218290dc (patch) | |
tree | 098db494b106fc2ba6859a08899f153876ecd41f /sys/powerpc | |
parent | 6299d1e736cea0af7a3dba4c67151b374fa64885 (diff) | |
download | FreeBSD-src-4ca12119c31e0cd42b3cb4b28dd898b8218290dc.zip FreeBSD-src-4ca12119c31e0cd42b3cb4b28dd898b8218290dc.tar.gz |
Fix the OFW interrupt map parser to use its own idea of the number of interrupt
cells in the map, instead of using a value passed to it and then panicing if it
disagrees. This fixes interrupt map parsing for PCI bridges on some Apple
Uninorth PCI controllers.
Reported by: marcel
Tested on: G4 iBook, Sun Ultra 5
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/powermac/grackle.c | 17 | ||||
-rw-r--r-- | sys/powerpc/powermac/gracklevar.h | 1 | ||||
-rw-r--r-- | sys/powerpc/powermac/macio.c | 8 | ||||
-rw-r--r-- | sys/powerpc/powermac/uninorth.c | 15 | ||||
-rw-r--r-- | sys/powerpc/powermac/uninorthvar.h | 1 |
5 files changed, 11 insertions, 31 deletions
diff --git a/sys/powerpc/powermac/grackle.c b/sys/powerpc/powermac/grackle.c index 9dd796d..fc323bf 100644 --- a/sys/powerpc/powermac/grackle.c +++ b/sys/powerpc/powermac/grackle.c @@ -165,7 +165,7 @@ static int grackle_attach(device_t dev) { struct grackle_softc *sc; - phandle_t node, iparent; + phandle_t node; u_int32_t busrange[2]; struct grackle_range *rp, *io, *mem[2]; int nmem, i, error; @@ -254,14 +254,6 @@ grackle_attach(device_t dev) ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(cell_t)); - /* We need the number of interrupt cells to read the imap */ - if (OF_getprop(node, "interrupt-parent", &iparent,sizeof(iparent)) <= 0) - iparent = node; - - if (OF_getprop(iparent,"#interrupt-cells",&sc->sc_icells, - sizeof(sc->sc_icells)) <= 0) - sc->sc_icells = 1; - device_add_child(dev, "pci", device_get_unit(dev)); return (bus_generic_attach(dev)); } @@ -348,15 +340,14 @@ grackle_route_interrupt(device_t bus, device_t dev, int pin) { struct grackle_softc *sc; struct ofw_pci_register reg; - uint32_t pintr, mintr[2]; + uint32_t pintr, mintr; uint8_t maskbuf[sizeof(reg) + sizeof(pintr)]; sc = device_get_softc(bus); pintr = pin; if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®, - sizeof(reg), &pintr, sizeof(pintr), &mintr, - sizeof(mintr[0])*sc->sc_icells, maskbuf)) - return (mintr[0]); + sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), maskbuf)) + return (mintr); /* Maybe it's a real interrupt, not an intpin */ if (pin > 4) diff --git a/sys/powerpc/powermac/gracklevar.h b/sys/powerpc/powermac/gracklevar.h index 78461d8..8d58c0a 100644 --- a/sys/powerpc/powermac/gracklevar.h +++ b/sys/powerpc/powermac/gracklevar.h @@ -52,7 +52,6 @@ struct grackle_softc { struct rman sc_mem_rman; bus_space_tag_t sc_memt; bus_dma_tag_t sc_dmat; - int sc_icells; struct ofw_bus_iinfo sc_pci_iinfo; }; diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c index 71be113..5c17925 100644 --- a/sys/powerpc/powermac/macio.c +++ b/sys/powerpc/powermac/macio.c @@ -185,7 +185,6 @@ macio_add_intr(phandle_t devnode, struct macio_devinfo *dinfo) { int *intr; int i, nintr; - phandle_t iparent; int icells; if (dinfo->mdi_ninterrupts >= 6) { @@ -193,10 +192,9 @@ macio_add_intr(phandle_t devnode, struct macio_devinfo *dinfo) return; } - icells = 1; - - if (OF_getprop(devnode, "interrupt-parent", &iparent, sizeof(iparent)) == sizeof(iparent)) - OF_getprop(iparent, "#interrupt-cells", &icells, sizeof(icells)); + if (OF_searchprop(devnode, "#interrupt-cells", &icells, sizeof(icells)) + <= 0) + icells = 1; nintr = OF_getprop_alloc(devnode, "interrupts", sizeof(*intr), (void **)&intr); diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c index b0b55a4..d9de1af 100644 --- a/sys/powerpc/powermac/uninorth.c +++ b/sys/powerpc/powermac/uninorth.c @@ -164,7 +164,7 @@ uninorth_attach(device_t dev) { struct uninorth_softc *sc; const char *compatible; - phandle_t node, child, iparent; + phandle_t node, child; u_int32_t reg[2], busrange[2]; struct uninorth_range *rp, *io, *mem[2]; int nmem, i, error; @@ -296,12 +296,6 @@ uninorth_attach(device_t dev) ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(cell_t)); - /* We need the number of interrupt cells to read the imap */ - sc->sc_icells = 2; - if (OF_getprop(node, "interrupt-parent", &iparent,sizeof(iparent)) > 0) - OF_getprop(iparent,"#interrupt-cells",&sc->sc_icells, - sizeof(sc->sc_icells)); - device_add_child(dev, "pci", device_get_unit(dev)); return (bus_generic_attach(dev)); } @@ -370,15 +364,14 @@ uninorth_route_interrupt(device_t bus, device_t dev, int pin) { struct uninorth_softc *sc; struct ofw_pci_register reg; - uint32_t pintr, mintr[2]; + uint32_t pintr, mintr; uint8_t maskbuf[sizeof(reg) + sizeof(pintr)]; sc = device_get_softc(bus); pintr = pin; if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®, - sizeof(reg), &pintr, sizeof(pintr), mintr, - sizeof(mintr[0])*sc->sc_icells, maskbuf)) - return (mintr[0]); + sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), maskbuf)) + return (mintr); /* Maybe it's a real interrupt, not an intpin */ if (pin > 4) diff --git a/sys/powerpc/powermac/uninorthvar.h b/sys/powerpc/powermac/uninorthvar.h index 6bb4024..4480eb8 100644 --- a/sys/powerpc/powermac/uninorthvar.h +++ b/sys/powerpc/powermac/uninorthvar.h @@ -64,7 +64,6 @@ struct uninorth_softc { struct ofw_bus_iinfo sc_pci_iinfo; int sc_u3; - int sc_icells; }; struct unin_chip_softc { |