aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2006-05-19 03:06:38 -0400
committerPaul Mackerras <paulus@samba.org>2006-05-24 02:08:57 -0400
commit7499bf1a4cabde789e7694b33d01a1913ae1dddf (patch)
tree0bcc92093b8782df448b0521e2ebefc5f5634f75 /arch/powerpc/platforms
parent72a14eafb243b1f31118ea55a7e8c2588b5ad468 (diff)
[PATCH] powerpc: cleanup of iSeries flat device tree
Consolidate the vio device node creation. Make some parameters const. Make a few more things __initdata. Get the device_type strings out of the device tree blob. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/iseries/dt.c199
1 files changed, 101 insertions, 98 deletions
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index 2a51ec1e3359..d3444aabe76e 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -47,16 +47,34 @@
47#define DBG(fmt...) 47#define DBG(fmt...)
48#endif 48#endif
49 49
50/*
51 * These are created by the linker script at the start and end
52 * of the section containing all the strings from this file.
53 */
50extern char __dt_strings_start[]; 54extern char __dt_strings_start[];
51extern char __dt_strings_end[]; 55extern char __dt_strings_end[];
52 56
53struct iseries_flat_dt { 57struct iseries_flat_dt {
54 struct boot_param_header header; 58 struct boot_param_header header;
55 u64 reserve_map[2]; 59 u64 reserve_map[2];
56 void *data;
57}; 60};
58 61
59static struct iseries_flat_dt *iseries_dt; 62static void * __initdata dt_data;
63
64/*
65 * Putting these strings here keeps them out of the section
66 * that we rename to .dt_strings using objcopy and capture
67 * for the strings blob of the flattened device tree.
68 */
69static char __initdata device_type_cpu[] = "cpu";
70static char __initdata device_type_memory[] = "memory";
71static char __initdata device_type_serial[] = "serial";
72static char __initdata device_type_network[] = "network";
73static char __initdata device_type_block[] = "block";
74static char __initdata device_type_byte[] = "byte";
75static char __initdata device_type_pci[] = "pci";
76static char __initdata device_type_vdevice[] = "vdevice";
77static char __initdata device_type_vscsi[] = "vscsi";
60 78
61static struct iseries_flat_dt * __init dt_init(void) 79static struct iseries_flat_dt * __init dt_init(void)
62{ 80{
@@ -70,7 +88,7 @@ static struct iseries_flat_dt * __init dt_init(void)
70 dt->header.off_dt_strings = ALIGN(sizeof(*dt), 8); 88 dt->header.off_dt_strings = ALIGN(sizeof(*dt), 8);
71 dt->header.off_dt_struct = dt->header.off_dt_strings 89 dt->header.off_dt_struct = dt->header.off_dt_strings
72 + ALIGN(str_len, 8); 90 + ALIGN(str_len, 8);
73 dt->data = (void *)((unsigned long)dt + dt->header.off_dt_struct); 91 dt_data = (void *)((unsigned long)dt + dt->header.off_dt_struct);
74 dt->header.dt_strings_size = str_len; 92 dt->header.dt_strings_size = str_len;
75 93
76 /* There is no notion of hardware cpu id on iSeries */ 94 /* There is no notion of hardware cpu id on iSeries */
@@ -91,26 +109,26 @@ static struct iseries_flat_dt * __init dt_init(void)
91 109
92static void __init dt_push_u32(struct iseries_flat_dt *dt, u32 value) 110static void __init dt_push_u32(struct iseries_flat_dt *dt, u32 value)
93{ 111{
94 *((u32 *)dt->data) = value; 112 *((u32 *)dt_data) = value;
95 dt->data += sizeof(u32); 113 dt_data += sizeof(u32);
96} 114}
97 115
98#ifdef notyet 116#ifdef notyet
99static void __init dt_push_u64(struct iseries_flat_dt *dt, u64 value) 117static void __init dt_push_u64(struct iseries_flat_dt *dt, u64 value)
100{ 118{
101 *((u64 *)dt->data) = value; 119 *((u64 *)dt_data) = value;
102 dt->data += sizeof(u64); 120 dt_data += sizeof(u64);
103} 121}
104#endif 122#endif
105 123
106static void __init dt_push_bytes(struct iseries_flat_dt *dt, char *data, 124static void __init dt_push_bytes(struct iseries_flat_dt *dt, const char *data,
107 int len) 125 int len)
108{ 126{
109 memcpy(dt->data, data, len); 127 memcpy(dt_data, data, len);
110 dt->data += ALIGN(len, 4); 128 dt_data += ALIGN(len, 4);
111} 129}
112 130
113static void __init dt_start_node(struct iseries_flat_dt *dt, char *name) 131static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
114{ 132{
115 dt_push_u32(dt, OF_DT_BEGIN_NODE); 133 dt_push_u32(dt, OF_DT_BEGIN_NODE);
116 dt_push_bytes(dt, name, strlen(name) + 1); 134 dt_push_bytes(dt, name, strlen(name) + 1);
@@ -118,8 +136,8 @@ static void __init dt_start_node(struct iseries_flat_dt *dt, char *name)
118 136
119#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE) 137#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
120 138
121static void __init dt_prop(struct iseries_flat_dt *dt, char *name, 139static void __init dt_prop(struct iseries_flat_dt *dt, const char *name,
122 void *data, int len) 140 const void *data, int len)
123{ 141{
124 unsigned long offset; 142 unsigned long offset;
125 143
@@ -137,36 +155,40 @@ static void __init dt_prop(struct iseries_flat_dt *dt, char *name,
137 dt_push_bytes(dt, data, len); 155 dt_push_bytes(dt, data, len);
138} 156}
139 157
140static void __init dt_prop_str(struct iseries_flat_dt *dt, char *name, 158static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name,
141 char *data) 159 const char *data)
142{ 160{
143 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */ 161 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
144} 162}
145 163
146static void __init dt_prop_u32(struct iseries_flat_dt *dt, char *name, u32 data) 164static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
165 u32 data)
147{ 166{
148 dt_prop(dt, name, &data, sizeof(u32)); 167 dt_prop(dt, name, &data, sizeof(u32));
149} 168}
150 169
151static void __init dt_prop_u64(struct iseries_flat_dt *dt, char *name, u64 data) 170#ifdef notyet
171static void __init dt_prop_u64(struct iseries_flat_dt *dt, const char *name,
172 u64 data)
152{ 173{
153 dt_prop(dt, name, &data, sizeof(u64)); 174 dt_prop(dt, name, &data, sizeof(u64));
154} 175}
176#endif
155 177
156static void __init dt_prop_u64_list(struct iseries_flat_dt *dt, char *name, 178static void __init dt_prop_u64_list(struct iseries_flat_dt *dt,
157 u64 *data, int n) 179 const char *name, u64 *data, int n)
158{ 180{
159 dt_prop(dt, name, data, sizeof(u64) * n); 181 dt_prop(dt, name, data, sizeof(u64) * n);
160} 182}
161 183
162static void __init dt_prop_u32_list(struct iseries_flat_dt *dt, char *name, 184static void __init dt_prop_u32_list(struct iseries_flat_dt *dt,
163 u32 *data, int n) 185 const char *name, u32 *data, int n)
164{ 186{
165 dt_prop(dt, name, data, sizeof(u32) * n); 187 dt_prop(dt, name, data, sizeof(u32) * n);
166} 188}
167 189
168#ifdef notyet 190#ifdef notyet
169static void __init dt_prop_empty(struct iseries_flat_dt *dt, char *name) 191static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name)
170{ 192{
171 dt_prop(dt, name, NULL, 0); 193 dt_prop(dt, name, NULL, 0);
172} 194}
@@ -199,7 +221,7 @@ static void __init dt_cpus(struct iseries_flat_dt *dt)
199 snprintf(p, 32 - (p - buf), "@%d", i); 221 snprintf(p, 32 - (p - buf), "@%d", i);
200 dt_start_node(dt, buf); 222 dt_start_node(dt, buf);
201 223
202 dt_prop_str(dt, "device_type", "cpu"); 224 dt_prop_str(dt, "device_type", device_type_cpu);
203 225
204 index = lppaca[i].dyn_hv_phys_proc_index; 226 index = lppaca[i].dyn_hv_phys_proc_index;
205 d = &xIoHriProcessorVpd[index]; 227 d = &xIoHriProcessorVpd[index];
@@ -244,32 +266,41 @@ static void __init dt_model(struct iseries_flat_dt *dt)
244 dt_prop_str(dt, "compatible", "IBM,iSeries"); 266 dt_prop_str(dt, "compatible", "IBM,iSeries");
245} 267}
246 268
269static void __init dt_do_vdevice(struct iseries_flat_dt *dt,
270 const char *name, u32 reg, int unit,
271 const char *type, const char *compat, int end)
272{
273 char buf[32];
274
275 snprintf(buf, 32, "%s@%08x", name, reg + ((unit >= 0) ? unit : 0));
276 dt_start_node(dt, buf);
277 dt_prop_str(dt, "device_type", type);
278 if (compat)
279 dt_prop_str(dt, "compatible", compat);
280 dt_prop_u32(dt, "reg", reg + ((unit >= 0) ? unit : 0));
281 if (unit >= 0)
282 dt_prop_u32(dt, "linux,unit_address", unit);
283 if (end)
284 dt_end_node(dt);
285}
286
247static void __init dt_vdevices(struct iseries_flat_dt *dt) 287static void __init dt_vdevices(struct iseries_flat_dt *dt)
248{ 288{
249 u32 reg = 0; 289 u32 reg = 0;
250 HvLpIndexMap vlan_map; 290 HvLpIndexMap vlan_map;
251 int i; 291 int i;
252 char buf[32];
253 292
254 dt_start_node(dt, "vdevice"); 293 dt_start_node(dt, "vdevice");
255 dt_prop_str(dt, "device_type", "vdevice"); 294 dt_prop_str(dt, "device_type", device_type_vdevice);
256 dt_prop_str(dt, "compatible", "IBM,iSeries-vdevice"); 295 dt_prop_str(dt, "compatible", "IBM,iSeries-vdevice");
257 dt_prop_u32(dt, "#address-cells", 1); 296 dt_prop_u32(dt, "#address-cells", 1);
258 dt_prop_u32(dt, "#size-cells", 0); 297 dt_prop_u32(dt, "#size-cells", 0);
259 298
260 snprintf(buf, sizeof(buf), "vty@%08x", reg); 299 dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, NULL, 1);
261 dt_start_node(dt, buf);
262 dt_prop_str(dt, "device_type", "serial");
263 dt_prop_u32(dt, "reg", reg);
264 dt_end_node(dt);
265 reg++; 300 reg++;
266 301
267 snprintf(buf, sizeof(buf), "v-scsi@%08x", reg); 302 dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
268 dt_start_node(dt, buf); 303 "IBM,v-scsi", 1);
269 dt_prop_str(dt, "device_type", "vscsi");
270 dt_prop_str(dt, "compatible", "IBM,v-scsi");
271 dt_prop_u32(dt, "reg", reg);
272 dt_end_node(dt);
273 reg++; 304 reg++;
274 305
275 vlan_map = HvLpConfig_getVirtualLanIndexMap(); 306 vlan_map = HvLpConfig_getVirtualLanIndexMap();
@@ -278,13 +309,8 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)
278 309
279 if ((vlan_map & (0x8000 >> i)) == 0) 310 if ((vlan_map & (0x8000 >> i)) == 0)
280 continue; 311 continue;
281 snprintf(buf, 32, "l-lan@%08x", reg + i); 312 dt_do_vdevice(dt, "l-lan", reg, i, device_type_network,
282 dt_start_node(dt, buf); 313 "IBM,iSeries-l-lan", 0);
283 dt_prop_str(dt, "device_type", "network");
284 dt_prop_str(dt, "compatible", "IBM,iSeries-l-lan");
285 dt_prop_u32(dt, "reg", reg + i);
286 dt_prop_u32(dt, "linux,unit_address", i);
287
288 mac_addr[0] = 0x02; 314 mac_addr[0] = 0x02;
289 mac_addr[1] = 0x01; 315 mac_addr[1] = 0x01;
290 mac_addr[2] = 0xff; 316 mac_addr[2] = 0xff;
@@ -300,47 +326,31 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)
300 } 326 }
301 reg += HVMAXARCHITECTEDVIRTUALLANS; 327 reg += HVMAXARCHITECTEDVIRTUALLANS;
302 328
303 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++) { 329 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
304 snprintf(buf, 32, "viodasd@%08x", reg + i); 330 dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
305 dt_start_node(dt, buf); 331 "IBM,iSeries-viodasd", 1);
306 dt_prop_str(dt, "device_type", "block");
307 dt_prop_str(dt, "compatible", "IBM,iSeries-viodasd");
308 dt_prop_u32(dt, "reg", reg + i);
309 dt_prop_u32(dt, "linux,unit_address", i);
310 dt_end_node(dt);
311 }
312 reg += HVMAXARCHITECTEDVIRTUALDISKS; 332 reg += HVMAXARCHITECTEDVIRTUALDISKS;
313 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++) { 333
314 snprintf(buf, 32, "viocd@%08x", reg + i); 334 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
315 dt_start_node(dt, buf); 335 dt_do_vdevice(dt, "viocd", reg, i, device_type_block,
316 dt_prop_str(dt, "device_type", "block"); 336 "IBM,iSeries-viocd", 1);
317 dt_prop_str(dt, "compatible", "IBM,iSeries-viocd");
318 dt_prop_u32(dt, "reg", reg + i);
319 dt_prop_u32(dt, "linux,unit_address", i);
320 dt_end_node(dt);
321 }
322 reg += HVMAXARCHITECTEDVIRTUALCDROMS; 337 reg += HVMAXARCHITECTEDVIRTUALCDROMS;
323 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++) { 338
324 snprintf(buf, 32, "viotape@%08x", reg + i); 339 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
325 dt_start_node(dt, buf); 340 dt_do_vdevice(dt, "viotape", reg, i, device_type_byte,
326 dt_prop_str(dt, "device_type", "byte"); 341 "IBM,iSeries-viotape", 1);
327 dt_prop_str(dt, "compatible", "IBM,iSeries-viotape");
328 dt_prop_u32(dt, "reg", reg + i);
329 dt_prop_u32(dt, "linux,unit_address", i);
330 dt_end_node(dt);
331 }
332 342
333 dt_end_node(dt); 343 dt_end_node(dt);
334} 344}
335 345
336struct pci_class_name { 346struct pci_class_name {
337 u16 code; 347 u16 code;
338 char *name; 348 const char *name;
339 char *type; 349 const char *type;
340}; 350};
341 351
342static struct pci_class_name __initdata pci_class_name[] = { 352static struct pci_class_name __initdata pci_class_name[] = {
343 { PCI_CLASS_NETWORK_ETHERNET, "ethernet", "network" }, 353 { PCI_CLASS_NETWORK_ETHERNET, "ethernet", device_type_network },
344}; 354};
345 355
346static struct pci_class_name * __init dt_find_pci_class_name(u16 class_code) 356static struct pci_class_name * __init dt_find_pci_class_name(u16 class_code)
@@ -384,9 +394,7 @@ static void __init scan_bridge_slot(struct iseries_flat_dt *dt,
384 agent_id, 0); 394 agent_id, 0);
385 if (err) { 395 if (err) {
386 if (err != 0x302) 396 if (err != 0x302)
387 printk(KERN_DEBUG 397 DBG("connectBusUnit(%x, %x, %x) %x\n",
388 "connectBusUnit(%x, %x, %x) "
389 "== %x\n",
390 bus, sub_bus, agent_id, err); 398 bus, sub_bus, agent_id, err);
391 continue; 399 continue;
392 } 400 }
@@ -394,24 +402,21 @@ static void __init scan_bridge_slot(struct iseries_flat_dt *dt,
394 err = HvCallPci_configLoad16(bus, sub_bus, agent_id, 402 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
395 PCI_VENDOR_ID, &vendor_id); 403 PCI_VENDOR_ID, &vendor_id);
396 if (err) { 404 if (err) {
397 printk(KERN_DEBUG 405 DBG("ReadVendor(%x, %x, %x) %x\n",
398 "ReadVendor(%x, %x, %x) == %x\n",
399 bus, sub_bus, agent_id, err); 406 bus, sub_bus, agent_id, err);
400 continue; 407 continue;
401 } 408 }
402 err = HvCallPci_configLoad16(bus, sub_bus, agent_id, 409 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
403 PCI_DEVICE_ID, &device_id); 410 PCI_DEVICE_ID, &device_id);
404 if (err) { 411 if (err) {
405 printk(KERN_DEBUG 412 DBG("ReadDevice(%x, %x, %x) %x\n",
406 "ReadDevice(%x, %x, %x) == %x\n",
407 bus, sub_bus, agent_id, err); 413 bus, sub_bus, agent_id, err);
408 continue; 414 continue;
409 } 415 }
410 err = HvCallPci_configLoad32(bus, sub_bus, agent_id, 416 err = HvCallPci_configLoad32(bus, sub_bus, agent_id,
411 PCI_CLASS_REVISION , &class_id); 417 PCI_CLASS_REVISION , &class_id);
412 if (err) { 418 if (err) {
413 printk(KERN_DEBUG 419 DBG("ReadClass(%x, %x, %x) %x\n",
414 "ReadClass(%x, %x, %x) == %x\n",
415 bus, sub_bus, agent_id, err); 420 bus, sub_bus, agent_id, err);
416 continue; 421 continue;
417 } 422 }
@@ -470,19 +475,18 @@ static void __init scan_bridge(struct iseries_flat_dt *dt, HvBusNumber bus,
470 ret = HvCallXm_connectBusUnit(bus, sub_bus, agent_id, 0); 475 ret = HvCallXm_connectBusUnit(bus, sub_bus, agent_id, 0);
471 if (ret != 0) { 476 if (ret != 0) {
472 if (ret != 0xb) 477 if (ret != 0xb)
473 printk(KERN_DEBUG "connectBusUnit(%x, %x, %x) " 478 DBG("connectBusUnit(%x, %x, %x) %x\n",
474 "== %x\n",
475 bus, sub_bus, agent_id, ret); 479 bus, sub_bus, agent_id, ret);
476 continue; 480 continue;
477 } 481 }
478 printk("found device at bus %d idsel %d func %d (AgentId %x)\n", 482 DBG("found device at bus %d idsel %d func %d (AgentId %x)\n",
479 bus, id_sel, function, agent_id); 483 bus, id_sel, function, agent_id);
480 ret = HvCallPci_getBusUnitInfo(bus, sub_bus, agent_id, 484 ret = HvCallPci_getBusUnitInfo(bus, sub_bus, agent_id,
481 iseries_hv_addr(&bridge_info), 485 iseries_hv_addr(&bridge_info),
482 sizeof(struct HvCallPci_BridgeInfo)); 486 sizeof(struct HvCallPci_BridgeInfo));
483 if (ret != 0) 487 if (ret != 0)
484 continue; 488 continue;
485 printk("bridge info: type %x subbus %x " 489 DBG("bridge info: type %x subbus %x "
486 "maxAgents %x maxsubbus %x logslot %x\n", 490 "maxAgents %x maxsubbus %x logslot %x\n",
487 bridge_info.busUnitInfo.deviceType, 491 bridge_info.busUnitInfo.deviceType,
488 bridge_info.subBusNumber, 492 bridge_info.subBusNumber,
@@ -493,7 +497,7 @@ static void __init scan_bridge(struct iseries_flat_dt *dt, HvBusNumber bus,
493 HvCallPci_BridgeDevice) 497 HvCallPci_BridgeDevice)
494 scan_bridge_slot(dt, bus, &bridge_info); 498 scan_bridge_slot(dt, bus, &bridge_info);
495 else 499 else
496 printk("PCI: Invalid Bridge Configuration(0x%02X)", 500 DBG("PCI: Invalid Bridge Configuration(0x%02X)",
497 bridge_info.busUnitInfo.deviceType); 501 bridge_info.busUnitInfo.deviceType);
498 } 502 }
499} 503}
@@ -515,13 +519,12 @@ static void __init scan_phb(struct iseries_flat_dt *dt, HvBusNumber bus)
515 sizeof(struct HvCallPci_DeviceInfo)); 519 sizeof(struct HvCallPci_DeviceInfo));
516 if (err) { 520 if (err) {
517 if (err != 0x302) 521 if (err != 0x302)
518 printk(KERN_DEBUG "getDeviceInfo(%x, %x, %x) " 522 DBG("getDeviceInfo(%x, %x, %x) %x\n",
519 "== %x\n",
520 bus, sub_bus, id_sel, err); 523 bus, sub_bus, id_sel, err);
521 continue; 524 continue;
522 } 525 }
523 if (dev_info.deviceType != HvCallPci_NodeDevice) { 526 if (dev_info.deviceType != HvCallPci_NodeDevice) {
524 printk(KERN_DEBUG "PCI: Invalid System Configuration" 527 DBG("PCI: Invalid System Configuration"
525 "(0x%02X) for bus 0x%02x id 0x%02x.\n", 528 "(0x%02X) for bus 0x%02x id 0x%02x.\n",
526 dev_info.deviceType, bus, id_sel); 529 dev_info.deviceType, bus, id_sel);
527 continue; 530 continue;
@@ -547,14 +550,14 @@ static void __init dt_pci_devices(struct iseries_flat_dt *dt)
547 * something has gone wrong. 550 * something has gone wrong.
548 */ 551 */
549 if (err != 0x0301) 552 if (err != 0x0301)
550 printk(KERN_ERR "Unexpected Return on Probe" 553 DBG("Unexpected Return on Probe(0x%02X) "
551 "(0x%02X): 0x%04X", bus, err); 554 "0x%04X\n", bus, err);
552 continue; 555 continue;
553 } 556 }
554 printk("bus %d appears to exist\n", bus); 557 DBG("bus %d appears to exist\n", bus);
555 snprintf(buf, 32, "pci@%d", phb_num); 558 snprintf(buf, 32, "pci@%d", phb_num);
556 dt_start_node(dt, buf); 559 dt_start_node(dt, buf);
557 dt_prop_str(dt, "device_type", "pci"); 560 dt_prop_str(dt, "device_type", device_type_pci);
558 dt_prop_str(dt, "compatible", "IBM,iSeries-Logical-PHB"); 561 dt_prop_str(dt, "compatible", "IBM,iSeries-Logical-PHB");
559 dt_prop_u32(dt, "#address-cells", 3); 562 dt_prop_u32(dt, "#address-cells", 3);
560 dt_prop_u32(dt, "#size-cells", 2); 563 dt_prop_u32(dt, "#size-cells", 2);
@@ -569,12 +572,13 @@ static void __init dt_pci_devices(struct iseries_flat_dt *dt)
569static void dt_finish(struct iseries_flat_dt *dt) 572static void dt_finish(struct iseries_flat_dt *dt)
570{ 573{
571 dt_push_u32(dt, OF_DT_END); 574 dt_push_u32(dt, OF_DT_END);
572 dt->header.totalsize = (unsigned long)dt->data - (unsigned long)dt; 575 dt->header.totalsize = (unsigned long)dt_data - (unsigned long)dt;
573 klimit = ALIGN((unsigned long)dt->data, 8); 576 klimit = ALIGN((unsigned long)dt_data, 8);
574} 577}
575 578
576void * __init build_flat_dt(unsigned long phys_mem_size) 579void * __init build_flat_dt(unsigned long phys_mem_size)
577{ 580{
581 struct iseries_flat_dt *iseries_dt;
578 u64 tmp[2]; 582 u64 tmp[2];
579 583
580 iseries_dt = dt_init(); 584 iseries_dt = dt_init();
@@ -587,8 +591,7 @@ void * __init build_flat_dt(unsigned long phys_mem_size)
587 591
588 /* /memory */ 592 /* /memory */
589 dt_start_node(iseries_dt, "memory@0"); 593 dt_start_node(iseries_dt, "memory@0");
590 dt_prop_str(iseries_dt, "name", "memory"); 594 dt_prop_str(iseries_dt, "device_type", device_type_memory);
591 dt_prop_str(iseries_dt, "device_type", "memory");
592 tmp[0] = 0; 595 tmp[0] = 0;
593 tmp[1] = phys_mem_size; 596 tmp[1] = phys_mem_size;
594 dt_prop_u64_list(iseries_dt, "reg", tmp, 2); 597 dt_prop_u64_list(iseries_dt, "reg", tmp, 2);