PERFORCE change 154405 for review

Nathan Whitehorn nwhitehorn at FreeBSD.org
Tue Dec 9 09:15:35 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=154405

Change 154405 by nwhitehorn at nwhitehorn_trantor on 2008/12/09 17:14:34

	Have the OFW memory routines check address-cells instead of relying
	on the value of ppc64 to figure out the number of cells in a physical 
	memory address.

Affected files ...

.. //depot/projects/ppc-g5/sys/powerpc/aim/ofw_machdep.c#8 edit

Differences ...

==== //depot/projects/ppc-g5/sys/powerpc/aim/ofw_machdep.c#8 (text+ko) ====

@@ -147,12 +147,22 @@
 mem_regions(struct mem_region **memp, int *memsz,
 		struct mem_region **availp, int *availsz)
 {
-	int phandle;
+	phandle_t phandle;
 	int asz, msz, fsz;
 	int i, j;
 	int still_merging;
+	cell_t address_cells;
 
 	asz = msz = 0;
+
+	/*
+	 * Get #address-cells from root node, defaulting to 1 if it cannot
+	 * be found.
+	 */
+	phandle = OF_finddevice("/");
+	if (OF_getprop(phandle, "#address-cells", &address_cells, 
+	    sizeof(address_cells)) < sizeof(address_cells))
+		address_cells = 1;
 	
 	/*
 	 * Get memory.
@@ -174,7 +184,7 @@
 		}
 	}
 
-	if (ppc64) {
+	if (address_cells == 2) {
 	    struct mem_region64 OFmem64[OFMEM_REGIONS + 1];
 	    if ((phandle == -1) || (msz = OF_getprop(phandle, "reg",
 			  OFmem64, sizeof OFmem64[0] * OFMEM_REGIONS)) <= 0) {


More information about the p4-projects mailing list