[Skiboot] [PATCH] tree-wide: use dt_add_property_u64s() where we can

Oliver O'Halloran oohall at gmail.com
Thu Nov 17 18:05:19 AEDT 2016


A few places (mostly old code) were using:

	add_property_cells(hi32(number), lo32(number));

This patch converts them to use the helper rather than doing it manually.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/console.c     |  5 +----
 core/opal.c        |  4 +---
 core/trace.c       |  3 +--
 hdata/cpu-common.c |  3 +--
 hdata/iohub.c      | 13 ++++---------
 hdata/memory.c     |  5 ++---
 hdata/spira.c      |  6 ++----
 hw/npu.c           |  3 +--
 hw/nx-rng.c        |  3 +--
 hw/p7ioc-phb.c     |  6 ++----
 hw/phb3.c          |  5 +----
 hw/phb4.c          |  5 +----
 hw/psi.c           |  2 +-
 13 files changed, 19 insertions(+), 44 deletions(-)

diff --git a/core/console.c b/core/console.c
index b8f3c7e354e1..03327dca5519 100644
--- a/core/console.c
+++ b/core/console.c
@@ -350,10 +350,7 @@ void init_opal_console(void)
 
 void memcons_add_properties(void)
 {
-	uint64_t addr = (u64)&memcons;
-
-	dt_add_property_cells(opal_node, "ibm,opal-memcons",
-			      hi32(addr), lo32(addr));
+	dt_add_property_u64(opal_node, "ibm,opal-memcons", (u64) &memcons);
 }
 
 /*
diff --git a/core/opal.c b/core/opal.c
index 61a2adb10602..2930120a6002 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -129,9 +129,7 @@ static void add_opal_firmware_node(void)
 	dt_add_property_string(firmware, "compatible", "ibm,opal-firmware");
 	dt_add_property_string(firmware, "name", "firmware");
 	dt_add_property_string(firmware, "version", version);
-	dt_add_property_cells(firmware, "symbol-map",
-			      hi32(sym_start), lo32(sym_start),
-			      hi32(sym_size), lo32(sym_size));
+	dt_add_property_u64s(firmware, "symbol-map", sym_start, sym_size);
 }
 
 void add_opal_node(void)
diff --git a/core/trace.c b/core/trace.c
index 10b70bd6fb54..4364aea57d1d 100644
--- a/core/trace.c
+++ b/core/trace.c
@@ -178,8 +178,7 @@ static void trace_add_dt_props(void)
 	free(prop);
 
 	tmask = (uint64_t)&debug_descriptor.trace_mask;
-	dt_add_property_cells(opal_node, "ibm,opal-trace-mask",
-			      hi32(tmask), lo32(tmask));
+	dt_add_property_u64(opal_node, "ibm,opal-trace-mask", tmask);
 }
 
 static void trace_add_desc(struct trace_info *t, uint64_t size)
diff --git a/hdata/cpu-common.c b/hdata/cpu-common.c
index cf0ce8ae8993..491eab84a91c 100644
--- a/hdata/cpu-common.c
+++ b/hdata/cpu-common.c
@@ -104,8 +104,7 @@ struct dt_node * add_core_common(struct dt_node *cpus,
 	freq = ((uint64_t)be32_to_cpu(tb->actual_clock_speed)) * 1000000ul;
 	if (freq <= 0xfffffffful)
 		dt_add_property_cells(cpu, "clock-frequency", freq);
-	dt_add_property_cells(cpu, "ibm,extended-clock-frequency",
-			      hi32(freq), lo32(freq));
+	dt_add_property_u64(cpu, "ibm,extended-clock-frequency", freq);
 
 	/* FIXME: Hardcoding is bad. */
 	dt_add_property_cells(cpu, "timebase-frequency", 512000000);
diff --git a/hdata/iohub.c b/hdata/iohub.c
index 7676adfb1937..50915f849cff 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -46,10 +46,8 @@ static void io_add_common(struct dt_node *hn, const struct cechub_io_hub *hub)
 	 * do too complex ranges property parsing
 	 */
 	dt_add_property(hn, "ranges", NULL, 0);
-	dt_add_property_cells(hn, "ibm,gx-bar-1",
-			      hi32(be64_to_cpu(hub->gx_ctrl_bar1)), lo32(be64_to_cpu(hub->gx_ctrl_bar1)));
-	dt_add_property_cells(hn, "ibm,gx-bar-2",
-			      hi32(be64_to_cpu(hub->gx_ctrl_bar2)), lo32(be64_to_cpu(hub->gx_ctrl_bar2)));
+	dt_add_property_u64(hn, "ibm,gx-bar-1", be64_to_cpu(hub->gx_ctrl_bar1));
+	dt_add_property_u64(hn, "ibm,gx-bar-2", be64_to_cpu(hub->gx_ctrl_bar2));
 
 	/* Add presence detect if valid */
 	if (hub->flags & CECHUB_HUB_FLAG_FAB_BR0_PDT)
@@ -240,11 +238,8 @@ static struct dt_node *io_add_phb3(const struct cechub_io_hub *hub,
 		u64 eq1 = be64_to_cpu(hub->phb_lane_eq[index][1]);
 		u64 eq2 = be64_to_cpu(hub->phb_lane_eq[index][2]);
 		u64 eq3 = be64_to_cpu(hub->phb_lane_eq[index][3]);
-		dt_add_property_cells(pbcq, "ibm,lane-eq",
-				      hi32(eq0), lo32(eq0),
-				      hi32(eq1), lo32(eq1),
-				      hi32(eq2), lo32(eq2),
-				      hi32(eq3), lo32(eq3));
+
+		dt_add_property_u64s(pbcq, "ibm,lane-eq", eq0, eq1, eq2, eq3);
 	}
 
 	/* Currently we only create a PBCQ node, the actual PHB nodes
diff --git a/hdata/memory.c b/hdata/memory.c
index a8b9955dbecc..c6080917d134 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -225,9 +225,8 @@ static void add_bus_freq_to_ram_area(struct dt_node *ram_node, u32 chip_id)
 		return;
 	}
 
-	freq = ((u64)be32_to_cpu(timebase->memory_bus_frequency)) *1000000ul;
-	dt_add_property_cells(ram_node, "ibm,memory-bus-frequency", hi32(freq),
-			      lo32(freq));
+	freq = ((u64)be32_to_cpu(timebase->memory_bus_frequency)) * 1000000ul;
+	dt_add_property_u64(ram_node, "ibm,memory-bus-frequency", freq);
 }
 
 static void add_size_to_ram_area(struct dt_node *ram_node,
diff --git a/hdata/spira.c b/hdata/spira.c
index 592197e7685b..0e47b4fa1ad7 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -267,8 +267,7 @@ static struct dt_node *add_xscom_node(uint64_t base, uint32_t hw_id,
 	freq = dt_prop_get_u64_def(dt_root, "nest-frequency", 0);
 	freq /= 4;
 	if (freq)
-		dt_add_property_cells(node, "bus-frequency",
-				      hi32(freq), lo32(freq));
+		dt_add_property_u64(node, "bus-frequency", freq);
 
 	return node;
 }
@@ -801,8 +800,7 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
 		u64 freq = be32_to_cpu(p->nest_freq_mhz);
 
 		freq *= 1000000;
-		dt_add_property_cells(dt_root, "nest-frequency",
-				      hi32(freq), lo32(freq));
+		dt_add_property_u64(dt_root, "nest-frequency", freq);
 	}
 }
 
diff --git a/hw/npu.c b/hw/npu.c
index 5232954d0f1c..302a551853bf 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -1561,8 +1561,7 @@ static void npu_add_phb_properties(struct npu *p)
 			      NPU_NUM_OF_PES);
 	dt_add_property_cells(np, "ibm,opal-reserved-pe",
 			      0);
-        dt_add_property_cells(np, "ibm,opal-tce-kill",
-			      hi32(tkill), lo32(tkill));
+        dt_add_property_u64(np, "ibm,opal-tce-kill", tkill);
 
 	/* Memory window is exposed as 32-bits non-prefetchable
 	 * one because 64-bits prefetchable one is kind of special
diff --git a/hw/nx-rng.c b/hw/nx-rng.c
index f652bb5d91c2..dc419cb5e9df 100644
--- a/hw/nx-rng.c
+++ b/hw/nx-rng.c
@@ -92,7 +92,6 @@ void nx_create_rng_node(struct dt_node *node)
 		return;
 
 	dt_add_property_strings(rng, "compatible", "ibm,power-rng");
-	dt_add_property_cells(rng, "reg", hi32(rng_addr), lo32(rng_addr),
-			      hi32(rng_len), lo32(rng_len));
+	dt_add_property_u64s(rng, "reg", rng_addr, rng_len);
 	dt_add_property_cells(rng, "ibm,chip-id", gcid);
 }
diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c
index 50608e2dcc49..025dd6cdf605 100644
--- a/hw/p7ioc-phb.c
+++ b/hw/p7ioc-phb.c
@@ -2598,10 +2598,8 @@ static void p7ioc_pcie_add_node(struct p7ioc_phb *p)
 
 	/* XXX FIXME: add opal-memwin32, dmawins, etc... */
 	m64b = cleanup_addr(p->m64_base);
-	dt_add_property_cells(np, "ibm,opal-m64-window",
-			      hi32(m64b), lo32(m64b),
-			      hi32(m64b), lo32(m64b),
-			      hi32(PHB_M64_SIZE), lo32(PHB_M64_SIZE));
+	dt_add_property_u64s(np, "ibm,opal-m64-window",
+			      m64b, m64b, PHB_M64_SIZE);
 	dt_add_property_cells(np, "ibm,opal-msi-ports", 256);
 	dt_add_property_cells(np, "ibm,opal-num-pes", 128);
 	dt_add_property_cells(np, "ibm,opal-reserved-pe", 127);
diff --git a/hw/phb3.c b/hw/phb3.c
index 52b30c24674b..07ab64e6ee82 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -4301,10 +4301,7 @@ static void phb3_add_properties(struct phb3 *p)
 			      hi32(m32b), lo32(m32b), 0, M32_PCI_SIZE - 0x10000);
 
 	/* XXX FIXME: add opal-memwin32, dmawins, etc... */
-	dt_add_property_cells(np, "ibm,opal-m64-window",
-			      hi32(m64b), lo32(m64b),
-			      hi32(m64b), lo32(m64b),
-			      hi32(m64s), lo32(m64s));
+	dt_add_property_u64s(np, "ibm,opal-m64-window", m64b, m64b, m64s);
 	dt_add_property(np, "ibm,opal-single-pe", NULL, 0);
 	//dt_add_property_cells(np, "ibm,opal-msi-ports", 2048);
 	dt_add_property_cells(np, "ibm,opal-num-pes", 256);
diff --git a/hw/phb4.c b/hw/phb4.c
index a21aa1afc5f1..f10923cef9d7 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2873,10 +2873,7 @@ static void phb4_add_properties(struct phb4 *p)
 			      hi32(m32b), lo32(m32b), 0, M32_PCI_SIZE - 0x10000);
 
 	/* XXX FIXME: add opal-memwin32, dmawins, etc... */
-	dt_add_property_cells(np, "ibm,opal-m64-window",
-			      hi32(m64b), lo32(m64b),
-			      hi32(m64b), lo32(m64b),
-			      hi32(m64s), lo32(m64s));
+	dt_add_property_u64s(np, "ibm,opal-m64-window", m64b, m64b, m64s);
 	dt_add_property(np, "ibm,opal-single-pe", NULL, 0);
 	dt_add_property_cells(np, "ibm,opal-num-pes", p->num_pes);
 	dt_add_property_cells(np, "ibm,opal-reserved-pe",
diff --git a/hw/psi.c b/hw/psi.c
index 17e83a587da6..a58df7a2913d 100644
--- a/hw/psi.c
+++ b/hw/psi.c
@@ -854,7 +854,7 @@ static void psi_create_mm_dtnode(struct psi *psi)
 		return;
 
 	/* Hard wire size to 4G */
-	dt_add_property_cells(np, "reg", hi32(addr), lo32(addr), 1, 0);
+	dt_add_property_u64s(np, "reg", addr, 0x100000000ull);
 	switch (proc_gen) {
 	case proc_gen_p7:
 		dt_add_property_strings(np, "compatible", "ibm,psi",
-- 
2.5.5



More information about the Skiboot mailing list