[PATCH 16/19] ppc64: Define /cpus in iSeries device tree

Michael Ellerman michael at ellerman.id.au
Tue Jul 26 18:58:42 EST 2005


Add the /cpus node and nodes for each cpu, as well as cache size properties,
reg propery and linux,boot-cpu.

---

 arch/ppc64/kernel/iSeries_setup.c |   48 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletion(-)

Index: work/arch/ppc64/kernel/iSeries_setup.c
===================================================================
--- work.orig/arch/ppc64/kernel/iSeries_setup.c
+++ work/arch/ppc64/kernel/iSeries_setup.c
@@ -1047,6 +1047,51 @@ void dt_initrd(struct iseries_flat_dt *d
 #endif
 }
 
+void dt_cpus(struct iseries_flat_dt *dt)
+{
+	unsigned char buf[32];
+	unsigned char *p;
+	unsigned int i, index;
+	struct IoHriProcessorVpd *d;
+
+	/* yuck */
+	snprintf(buf, 32, "/cpus/PowerPC,%s", cur_cpu_spec->cpu_name);
+	p = strchr(buf, ' ');
+	if (!p) p = buf + strlen(buf);
+
+	dt_start_node(dt, "/cpus");
+	dt_prop_u32(dt, "#address-cells", 1);
+	dt_prop_u32(dt, "#size-cells", 0);
+
+	for (i = 0; i < NR_CPUS; i++) {
+		if (paca[i].lppaca.dyn_proc_status >= 2)
+			continue;
+
+		snprintf(p, 32 - (p - buf), "@%d", i);
+		dt_start_node(dt, buf);
+
+		dt_prop_str(dt, "device_type", "cpu");
+
+		index = paca[i].lppaca.dyn_hv_phys_proc_index;
+		d = &xIoHriProcessorVpd[index];
+
+		dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
+		dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
+
+		dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
+		dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
+
+		dt_prop_u32(dt, "reg", i);
+
+		if (dt->header.boot_cpuid_phys == i)
+			dt_prop_empty(dt, "linux,boot-cpu");
+
+		dt_end_node(dt);
+	}
+
+	dt_end_node(dt);
+}
+
 void build_flat_dt(struct iseries_flat_dt *dt)
 {
 	u64 tmp[2];
@@ -1075,9 +1120,10 @@ void build_flat_dt(struct iseries_flat_d
 	if (iseries_memory_limit)
 		dt_prop_u64(dt, "linux,memory-limit", iseries_memory_limit);
 	dt_initrd(dt);
-
 	dt_end_node(dt);
 
+	dt_cpus(dt);
+
 	dt_end_node(dt);
 
 	dt_push_u32(dt, OF_DT_END);



More information about the Linuxppc64-dev mailing list