svn commit: r217658 - head/sys/powerpc/powermac

Andreas Tobler andreast at FreeBSD.org
Thu Jan 20 20:22:20 UTC 2011


Author: andreast
Date: Thu Jan 20 20:22:19 2011
New Revision: 217658
URL: http://svn.freebsd.org/changeset/base/217658

Log:
  Correct parsing of the grackle and uninorthpci ranges property.
  
  Approved by: nwhitehorn (mentor)

Modified:
  head/sys/powerpc/powermac/grackle.c
  head/sys/powerpc/powermac/gracklevar.h
  head/sys/powerpc/powermac/uninorthpci.c
  head/sys/powerpc/powermac/uninorthvar.h

Modified: head/sys/powerpc/powermac/grackle.c
==============================================================================
--- head/sys/powerpc/powermac/grackle.c	Thu Jan 20 19:26:28 2011	(r217657)
+++ head/sys/powerpc/powermac/grackle.c	Thu Jan 20 20:22:19 2011	(r217658)
@@ -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;

Modified: head/sys/powerpc/powermac/gracklevar.h
==============================================================================
--- head/sys/powerpc/powermac/gracklevar.h	Thu Jan 20 19:26:28 2011	(r217657)
+++ head/sys/powerpc/powermac/gracklevar.h	Thu Jan 20 20:22:19 2011	(r217658)
@@ -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;

Modified: head/sys/powerpc/powermac/uninorthpci.c
==============================================================================
--- head/sys/powerpc/powermac/uninorthpci.c	Thu Jan 20 19:26:28 2011	(r217657)
+++ head/sys/powerpc/powermac/uninorthpci.c	Thu Jan 20 20:22:19 2011	(r217658)
@@ -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;

Modified: head/sys/powerpc/powermac/uninorthvar.h
==============================================================================
--- head/sys/powerpc/powermac/uninorthvar.h	Thu Jan 20 19:26:28 2011	(r217657)
+++ head/sys/powerpc/powermac/uninorthvar.h	Thu Jan 20 20:22:19 2011	(r217658)
@@ -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;


More information about the svn-src-head mailing list