Date: Fri, 27 May 2011 14:08:24 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r222355 - projects/pseries/powerpc/ofw Message-ID: <201105271408.p4RE8OtA038639@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105271408.p4RE8OtA038639>