Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Dec 2008 17:15:35 GMT
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 154405 for review
Message-ID:  <200812091715.mB9HFZuM077820@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154405

Change 154405 by nwhitehorn@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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812091715.mB9HFZuM077820>