From owner-svn-src-projects@FreeBSD.ORG Fri May 27 14:08:24 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF27A1065673; Fri, 27 May 2011 14:08:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F3458FC14; Fri, 27 May 2011 14:08:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4RE8OMs038641; Fri, 27 May 2011 14:08:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4RE8OtA038639; Fri, 27 May 2011 14:08:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105271408.p4RE8OtA038639@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 27 May 2011 14:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222355 - projects/pseries/powerpc/ofw X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2011 14:08:24 -0000 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);