svn commit: r222355 - projects/pseries/powerpc/ofw
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Fri May 27 14:08:24 UTC 2011
Author: nwhitehorn
Date: Fri May 27 14:08:24 2011
New Revision: 222355
URL: http://svn.freebsd.org/changeset/base/222355
Log:
Check for memory in multiple /memory nodes, as present in some IBM systems
(e.g. the QS22 Cell blade server).
Modified:
projects/pseries/powerpc/ofw/ofw_machdep.c
Modified: projects/pseries/powerpc/ofw/ofw_machdep.c
==============================================================================
--- projects/pseries/powerpc/ofw/ofw_machdep.c Fri May 27 10:40:34 2011 (r222354)
+++ projects/pseries/powerpc/ofw/ofw_machdep.c Fri May 27 14:08:24 2011 (r222355)
@@ -353,25 +353,32 @@ ofw_mem_regions(struct mem_region **memp
int asz, msz, fsz;
int i, j, res;
int still_merging;
+ char name[31];
asz = msz = 0;
/*
- * Get memory.
+ * Get memory from all the /memory nodes.
*/
- phandle = OF_finddevice("/memory");
- if (phandle == -1)
- phandle = OF_finddevice("/memory at 0");
-
- msz = parse_ofw_memory(phandle, "reg", OFmem);
- msz /= sizeof(struct mem_region);
- asz = parse_ofw_memory(phandle, "available", OFavail);
- asz /= sizeof(struct mem_region);
-
- res = parse_drconf_memory(&msz, &asz, OFmem, OFavail);
- if (res == 0)
- /* tbd. */
- printf("no ibm machine\n");
+ for (phandle = OF_child(OF_peer(0)); phandle != 0;
+ phandle = OF_peer(phandle)) {
+ if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0)
+ continue;
+ if (strncmp(name, "memory", sizeof(name)) != 0)
+ continue;
+
+ res = parse_ofw_memory(phandle, "reg", &OFmem[msz]);
+ msz += res/sizeof(struct mem_region);
+ if (OF_getproplen(phandle, "available") >= 0)
+ res = parse_ofw_memory(phandle, "available",
+ &OFavail[asz]);
+ else
+ res = parse_ofw_memory(phandle, "reg", &OFavail[asz]);
+ asz += res/sizeof(struct mem_region);
+ }
+
+ /* Check for memory in ibm,dynamic-reconfiguration-memory */
+ parse_drconf_memory(&msz, &asz, OFmem, OFavail);
qsort(OFmem, msz, sizeof(*OFmem), mr_cmp);
qsort(OFavail, asz, sizeof(*OFavail), mr_cmp);
More information about the svn-src-projects
mailing list