From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwRkM-0001A8-C1 for qemu-devel@nongnu.org; Mon, 16 Jun 2014 03:54:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwRjy-00063V-AM for qemu-devel@nongnu.org; Mon, 16 Jun 2014 03:54:30 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:38085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwRjx-00061x-I5 for qemu-devel@nongnu.org; Mon, 16 Jun 2014 03:54:06 -0400 Received: from /spool/local by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Jun 2014 17:53:59 +1000 From: Alexey Kardashevskiy Date: Mon, 16 Jun 2014 17:53:48 +1000 Message-Id: <1402905233-26510-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1402905233-26510-1-git-send-email-aik@ozlabs.ru> References: <1402905233-26510-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH 2/7] spapr: Use DT memory node rendering helper for other nodes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Nishanth Aravamudan , qemu-ppc@nongnu.org, Alexander Graf This finishes refactoring by using the spapr_populate_memory_node helper for all nodes and removing leftovers from spapr_populate_memory(). This is not a part of the previous patch because the patches look nicer apart. Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 8390759..cb3a10a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -689,13 +689,8 @@ static void spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start, static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) { - uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0), - cpu_to_be32(0x0), cpu_to_be32(0x0), - cpu_to_be32(0x0)}; - char mem_name[32]; hwaddr node0_size, mem_start, node_size; - uint64_t mem_reg_property[2]; - int i, off; + int i; /* memory node(s) */ if (nb_numa_nodes > 1 && node_mem[0] < ram_size) { @@ -716,7 +711,6 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) /* RAM: Node 1 and beyond */ mem_start = node0_size; for (i = 1; i < nb_numa_nodes; i++) { - mem_reg_property[0] = cpu_to_be64(mem_start); if (mem_start >= ram_size) { node_size = 0; } else { @@ -725,16 +719,7 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) node_size = ram_size - mem_start; } } - mem_reg_property[1] = cpu_to_be64(node_size); - associativity[3] = associativity[4] = cpu_to_be32(i); - sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start); - off = fdt_add_subnode(fdt, 0, mem_name); - _FDT(off); - _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); - _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, - sizeof(mem_reg_property)))); - _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, - sizeof(associativity)))); + spapr_populate_memory_node(fdt, i, mem_start, node_size); mem_start += node_size; } -- 2.0.0