diff options
author | andreast <andreast@FreeBSD.org> | 2011-01-20 20:22:19 +0000 |
---|---|---|
committer | andreast <andreast@FreeBSD.org> | 2011-01-20 20:22:19 +0000 |
commit | ad366db2011f14e8f5f98e4ccdcb57ffd22f5c23 (patch) | |
tree | 1bc649a6a9120b09ca9537efad913192c55e6946 | |
parent | 6d8a904d4902ca85ab4a35457d4844b3e2db8f7e (diff) | |
download | FreeBSD-src-ad366db2011f14e8f5f98e4ccdcb57ffd22f5c23.zip FreeBSD-src-ad366db2011f14e8f5f98e4ccdcb57ffd22f5c23.tar.gz |
Correct parsing of the grackle and uninorthpci ranges property.
Approved by: nwhitehorn (mentor)
-rw-r--r-- | sys/powerpc/powermac/grackle.c | 5 | ||||
-rw-r--r-- | sys/powerpc/powermac/gracklevar.h | 2 | ||||
-rw-r--r-- | sys/powerpc/powermac/uninorthpci.c | 5 | ||||
-rw-r--r-- | sys/powerpc/powermac/uninorthvar.h | 2 |
4 files changed, 10 insertions, 4 deletions
diff --git a/sys/powerpc/powermac/grackle.c b/sys/powerpc/powermac/grackle.c index a7ba6cb..ee7fb38 100644 --- a/sys/powerpc/powermac/grackle.c +++ b/sys/powerpc/powermac/grackle.c @@ -199,11 +199,14 @@ grackle_attach(device_t dev) return (ENXIO); } + sc->sc_nrange /= sizeof(sc->sc_range[0]); + sc->sc_range[6].pci_hi = 0; io = NULL; nmem = 0; - for (rp = sc->sc_range; rp->pci_hi != 0; rp++) { + for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && + rp->pci_hi != 0; rp++) { switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; diff --git a/sys/powerpc/powermac/gracklevar.h b/sys/powerpc/powermac/gracklevar.h index 8d58c0a..bc8b664 100644 --- a/sys/powerpc/powermac/gracklevar.h +++ b/sys/powerpc/powermac/gracklevar.h @@ -45,7 +45,7 @@ struct grackle_softc { vm_offset_t sc_addr; vm_offset_t sc_data; int sc_bus; - struct grackle_range sc_range[6]; + struct grackle_range sc_range[7]; int sc_nrange; int sc_iostart; struct rman sc_io_rman; diff --git a/sys/powerpc/powermac/uninorthpci.c b/sys/powerpc/powermac/uninorthpci.c index cfc8862..421c7e5 100644 --- a/sys/powerpc/powermac/uninorthpci.c +++ b/sys/powerpc/powermac/uninorthpci.c @@ -231,11 +231,14 @@ uninorth_attach(device_t dev) return (ENXIO); } + sc->sc_nrange /= sizeof(sc->sc_range[0]); + sc->sc_range[6].pci_hi = 0; io = NULL; nmem = 0; - for (rp = sc->sc_range; rp->pci_hi != 0; rp++) { + for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && + rp->pci_hi != 0; rp++) { switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; diff --git a/sys/powerpc/powermac/uninorthvar.h b/sys/powerpc/powermac/uninorthvar.h index 9625d42..2c37d77 100644 --- a/sys/powerpc/powermac/uninorthvar.h +++ b/sys/powerpc/powermac/uninorthvar.h @@ -53,7 +53,7 @@ struct uninorth_softc { vm_offset_t sc_addr; vm_offset_t sc_data; int sc_bus; - struct uninorth_range sc_range[6]; + struct uninorth_range sc_range[7]; int sc_nrange; int sc_iostart; struct rman sc_io_rman; |