powerpc/mm: Fix potential access to freed pages when using hugetlbfs
[linux-2.6] / arch / powerpc / platforms / iseries / dt.c
1 /*
2  *    Copyright (C) 2005-2006 Michael Ellerman, IBM Corporation
3  *    Copyright (C) 2000-2004, IBM Corporation
4  *
5  *    Description:
6  *      This file contains all the routines to build a flattened device
7  *      tree for a legacy iSeries machine.
8  *
9  *      This program is free software; you can redistribute it and/or
10  *      modify it under the terms of the GNU General Public License
11  *      as published by the Free Software Foundation; either version
12  *      2 of the License, or (at your option) any later version.
13  */
14
15 #undef DEBUG
16
17 #include <linux/types.h>
18 #include <linux/init.h>
19 #include <linux/pci.h>
20 #include <linux/pci_regs.h>
21 #include <linux/pci_ids.h>
22 #include <linux/threads.h>
23 #include <linux/bitops.h>
24 #include <linux/string.h>
25 #include <linux/kernel.h>
26 #include <linux/if_ether.h>     /* ETH_ALEN */
27
28 #include <asm/machdep.h>
29 #include <asm/prom.h>
30 #include <asm/lppaca.h>
31 #include <asm/cputable.h>
32 #include <asm/abs_addr.h>
33 #include <asm/system.h>
34 #include <asm/iseries/hv_types.h>
35 #include <asm/iseries/hv_lp_config.h>
36 #include <asm/iseries/hv_call_xm.h>
37 #include <asm/udbg.h>
38
39 #include "processor_vpd.h"
40 #include "call_hpt.h"
41 #include "call_pci.h"
42 #include "pci.h"
43 #include "it_exp_vpd_panel.h"
44 #include "naca.h"
45
46 #ifdef DEBUG
47 #define DBG(fmt...) udbg_printf(fmt)
48 #else
49 #define DBG(fmt...)
50 #endif
51
52 /*
53  * These are created by the linker script at the start and end
54  * of the section containing all the strings from this file.
55  */
56 extern char __dt_strings_start[];
57 extern char __dt_strings_end[];
58
59 struct iseries_flat_dt {
60         struct boot_param_header header;
61         u64 reserve_map[2];
62 };
63
64 static void * __initdata dt_data;
65
66 /*
67  * Putting these strings here keeps them out of the section
68  * that we rename to .dt_strings using objcopy and capture
69  * for the strings blob of the flattened device tree.
70  */
71 static char __initdata device_type_cpu[] = "cpu";
72 static char __initdata device_type_memory[] = "memory";
73 static char __initdata device_type_serial[] = "serial";
74 static char __initdata device_type_network[] = "network";
75 static char __initdata device_type_pci[] = "pci";
76 static char __initdata device_type_vdevice[] = "vdevice";
77 static char __initdata device_type_vscsi[] = "vscsi";
78
79
80 /* EBCDIC to ASCII conversion routines */
81
82 static unsigned char __init e2a(unsigned char x)
83 {
84         switch (x) {
85         case 0x81 ... 0x89:
86                 return x - 0x81 + 'a';
87         case 0x91 ... 0x99:
88                 return x - 0x91 + 'j';
89         case 0xA2 ... 0xA9:
90                 return x - 0xA2 + 's';
91         case 0xC1 ... 0xC9:
92                 return x - 0xC1 + 'A';
93         case 0xD1 ... 0xD9:
94                 return x - 0xD1 + 'J';
95         case 0xE2 ... 0xE9:
96                 return x - 0xE2 + 'S';
97         case 0xF0 ... 0xF9:
98                 return x - 0xF0 + '0';
99         }
100         return ' ';
101 }
102
103 static unsigned char * __init strne2a(unsigned char *dest,
104                 const unsigned char *src, size_t n)
105 {
106         int i;
107
108         n = strnlen(src, n);
109
110         for (i = 0; i < n; i++)
111                 dest[i] = e2a(src[i]);
112
113         return dest;
114 }
115
116 static struct iseries_flat_dt * __init dt_init(void)
117 {
118         struct iseries_flat_dt *dt;
119         unsigned long str_len;
120
121         str_len = __dt_strings_end - __dt_strings_start;
122         dt = (struct iseries_flat_dt *)ALIGN(klimit, 8);
123         dt->header.off_mem_rsvmap =
124                 offsetof(struct iseries_flat_dt, reserve_map);
125         dt->header.off_dt_strings = ALIGN(sizeof(*dt), 8);
126         dt->header.off_dt_struct = dt->header.off_dt_strings
127                 + ALIGN(str_len, 8);
128         dt_data = (void *)((unsigned long)dt + dt->header.off_dt_struct);
129         dt->header.dt_strings_size = str_len;
130
131         /* There is no notion of hardware cpu id on iSeries */
132         dt->header.boot_cpuid_phys = smp_processor_id();
133
134         memcpy((char *)dt + dt->header.off_dt_strings, __dt_strings_start,
135                         str_len);
136
137         dt->header.magic = OF_DT_HEADER;
138         dt->header.version = 0x10;
139         dt->header.last_comp_version = 0x10;
140
141         dt->reserve_map[0] = 0;
142         dt->reserve_map[1] = 0;
143
144         return dt;
145 }
146
147 static void __init dt_push_u32(struct iseries_flat_dt *dt, u32 value)
148 {
149         *((u32 *)dt_data) = value;
150         dt_data += sizeof(u32);
151 }
152
153 #ifdef notyet
154 static void __init dt_push_u64(struct iseries_flat_dt *dt, u64 value)
155 {
156         *((u64 *)dt_data) = value;
157         dt_data += sizeof(u64);
158 }
159 #endif
160
161 static void __init dt_push_bytes(struct iseries_flat_dt *dt, const char *data,
162                 int len)
163 {
164         memcpy(dt_data, data, len);
165         dt_data += ALIGN(len, 4);
166 }
167
168 static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
169 {
170         dt_push_u32(dt, OF_DT_BEGIN_NODE);
171         dt_push_bytes(dt, name, strlen(name) + 1);
172 }
173
174 #define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
175
176 static void __init dt_prop(struct iseries_flat_dt *dt, const char *name,
177                 const void *data, int len)
178 {
179         unsigned long offset;
180
181         dt_push_u32(dt, OF_DT_PROP);
182
183         /* Length of the data */
184         dt_push_u32(dt, len);
185
186         offset = name - __dt_strings_start;
187
188         /* The offset of the properties name in the string blob. */
189         dt_push_u32(dt, (u32)offset);
190
191         /* The actual data. */
192         dt_push_bytes(dt, data, len);
193 }
194
195 static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name,
196                 const char *data)
197 {
198         dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
199 }
200
201 static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
202                 u32 data)
203 {
204         dt_prop(dt, name, &data, sizeof(u32));
205 }
206
207 static void __init __maybe_unused dt_prop_u64(struct iseries_flat_dt *dt,
208                                               const char *name,
209                 u64 data)
210 {
211         dt_prop(dt, name, &data, sizeof(u64));
212 }
213
214 static void __init dt_prop_u64_list(struct iseries_flat_dt *dt,
215                 const char *name, u64 *data, int n)
216 {
217         dt_prop(dt, name, data, sizeof(u64) * n);
218 }
219
220 static void __init dt_prop_u32_list(struct iseries_flat_dt *dt,
221                 const char *name, u32 *data, int n)
222 {
223         dt_prop(dt, name, data, sizeof(u32) * n);
224 }
225
226 #ifdef notyet
227 static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name)
228 {
229         dt_prop(dt, name, NULL, 0);
230 }
231 #endif
232
233 static void __init dt_cpus(struct iseries_flat_dt *dt)
234 {
235         unsigned char buf[32];
236         unsigned char *p;
237         unsigned int i, index;
238         struct IoHriProcessorVpd *d;
239         u32 pft_size[2];
240
241         /* yuck */
242         snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
243         p = strchr(buf, ' ');
244         if (!p) p = buf + strlen(buf);
245
246         dt_start_node(dt, "cpus");
247         dt_prop_u32(dt, "#address-cells", 1);
248         dt_prop_u32(dt, "#size-cells", 0);
249
250         pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA  */
251         pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
252
253         for (i = 0; i < NR_CPUS; i++) {
254                 if (lppaca[i].dyn_proc_status >= 2)
255                         continue;
256
257                 snprintf(p, 32 - (p - buf), "@%d", i);
258                 dt_start_node(dt, buf);
259
260                 dt_prop_str(dt, "device_type", device_type_cpu);
261
262                 index = lppaca[i].dyn_hv_phys_proc_index;
263                 d = &xIoHriProcessorVpd[index];
264
265                 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
266                 dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
267
268                 dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
269                 dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
270
271                 /* magic conversions to Hz copied from old code */
272                 dt_prop_u32(dt, "clock-frequency",
273                         ((1UL << 34) * 1000000) / d->xProcFreq);
274                 dt_prop_u32(dt, "timebase-frequency",
275                         ((1UL << 32) * 1000000) / d->xTimeBaseFreq);
276
277                 dt_prop_u32(dt, "reg", i);
278
279                 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
280
281                 dt_end_node(dt);
282         }
283
284         dt_end_node(dt);
285 }
286
287 static void __init dt_model(struct iseries_flat_dt *dt)
288 {
289         char buf[16] = "IBM,";
290
291         /* N.B. lparcfg.c knows about the "IBM," prefixes ... */
292         /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
293         strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
294         strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
295         buf[11] = '\0';
296         dt_prop_str(dt, "system-id", buf);
297
298         /* "IBM," + machineType[0:4] */
299         strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
300         buf[8] = '\0';
301         dt_prop_str(dt, "model", buf);
302
303         dt_prop_str(dt, "compatible", "IBM,iSeries");
304         dt_prop_u32(dt, "ibm,partition-no", HvLpConfig_getLpIndex());
305 }
306
307 static void __init dt_initrd(struct iseries_flat_dt *dt)
308 {
309 #ifdef CONFIG_BLK_DEV_INITRD
310         if (naca.xRamDisk) {
311                 dt_prop_u64(dt, "linux,initrd-start", (u64)naca.xRamDisk);
312                 dt_prop_u64(dt, "linux,initrd-end",
313                         (u64)naca.xRamDisk + naca.xRamDiskSize * HW_PAGE_SIZE);
314         }
315 #endif
316 }
317
318 static void __init dt_do_vdevice(struct iseries_flat_dt *dt,
319                 const char *name, u32 reg, int unit,
320                 const char *type, const char *compat, int end)
321 {
322         char buf[32];
323
324         snprintf(buf, 32, "%s@%08x", name, reg + ((unit >= 0) ? unit : 0));
325         dt_start_node(dt, buf);
326         dt_prop_str(dt, "device_type", type);
327         if (compat)
328                 dt_prop_str(dt, "compatible", compat);
329         dt_prop_u32(dt, "reg", reg + ((unit >= 0) ? unit : 0));
330         if (unit >= 0)
331                 dt_prop_u32(dt, "linux,unit_address", unit);
332         if (end)
333                 dt_end_node(dt);
334 }
335
336 static void __init dt_vdevices(struct iseries_flat_dt *dt)
337 {
338         u32 reg = 0;
339         HvLpIndexMap vlan_map;
340         int i;
341
342         dt_start_node(dt, "vdevice");
343         dt_prop_str(dt, "device_type", device_type_vdevice);
344         dt_prop_str(dt, "compatible", "IBM,iSeries-vdevice");
345         dt_prop_u32(dt, "#address-cells", 1);
346         dt_prop_u32(dt, "#size-cells", 0);
347
348         dt_do_vdevice(dt, "vty", reg, -1, device_type_serial,
349                         "IBM,iSeries-vty", 1);
350         reg++;
351
352         dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
353                         "IBM,v-scsi", 1);
354         reg++;
355
356         vlan_map = HvLpConfig_getVirtualLanIndexMap();
357         for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
358                 unsigned char mac_addr[ETH_ALEN];
359
360                 if ((vlan_map & (0x8000 >> i)) == 0)
361                         continue;
362                 dt_do_vdevice(dt, "l-lan", reg, i, device_type_network,
363                                 "IBM,iSeries-l-lan", 0);
364                 mac_addr[0] = 0x02;
365                 mac_addr[1] = 0x01;
366                 mac_addr[2] = 0xff;
367                 mac_addr[3] = i;
368                 mac_addr[4] = 0xff;
369                 mac_addr[5] = HvLpConfig_getLpIndex_outline();
370                 dt_prop(dt, "local-mac-address", (char *)mac_addr, ETH_ALEN);
371                 dt_prop(dt, "mac-address", (char *)mac_addr, ETH_ALEN);
372                 dt_prop_u32(dt, "max-frame-size", 9000);
373                 dt_prop_u32(dt, "address-bits", 48);
374
375                 dt_end_node(dt);
376         }
377
378         dt_end_node(dt);
379 }
380
381 struct pci_class_name {
382         u16 code;
383         const char *name;
384         const char *type;
385 };
386
387 static struct pci_class_name __initdata pci_class_name[] = {
388         { PCI_CLASS_NETWORK_ETHERNET, "ethernet", device_type_network },
389 };
390
391 static struct pci_class_name * __init dt_find_pci_class_name(u16 class_code)
392 {
393         struct pci_class_name *cp;
394
395         for (cp = pci_class_name;
396                         cp < &pci_class_name[ARRAY_SIZE(pci_class_name)]; cp++)
397                 if (cp->code == class_code)
398                         return cp;
399         return NULL;
400 }
401
402 /*
403  * This assumes that the node slot is always on the primary bus!
404  */
405 static void __init scan_bridge_slot(struct iseries_flat_dt *dt,
406                 HvBusNumber bus, struct HvCallPci_BridgeInfo *bridge_info)
407 {
408         HvSubBusNumber sub_bus = bridge_info->subBusNumber;
409         u16 vendor_id;
410         u16 device_id;
411         u32 class_id;
412         int err;
413         char buf[32];
414         u32 reg[5];
415         int id_sel = ISERIES_GET_DEVICE_FROM_SUBBUS(sub_bus);
416         int function = ISERIES_GET_FUNCTION_FROM_SUBBUS(sub_bus);
417         HvAgentId eads_id_sel = ISERIES_PCI_AGENTID(id_sel, function);
418         u8 devfn;
419         struct pci_class_name *cp;
420
421         /*
422          * Connect all functions of any device found.
423          */
424         for (id_sel = 1; id_sel <= bridge_info->maxAgents; id_sel++) {
425                 for (function = 0; function < 8; function++) {
426                         HvAgentId agent_id = ISERIES_PCI_AGENTID(id_sel,
427                                         function);
428                         err = HvCallXm_connectBusUnit(bus, sub_bus,
429                                         agent_id, 0);
430                         if (err) {
431                                 if (err != 0x302)
432                                         DBG("connectBusUnit(%x, %x, %x) %x\n",
433                                                 bus, sub_bus, agent_id, err);
434                                 continue;
435                         }
436
437                         err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
438                                         PCI_VENDOR_ID, &vendor_id);
439                         if (err) {
440                                 DBG("ReadVendor(%x, %x, %x) %x\n",
441                                         bus, sub_bus, agent_id, err);
442                                 continue;
443                         }
444                         err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
445                                         PCI_DEVICE_ID, &device_id);
446                         if (err) {
447                                 DBG("ReadDevice(%x, %x, %x) %x\n",
448                                         bus, sub_bus, agent_id, err);
449                                 continue;
450                         }
451                         err = HvCallPci_configLoad32(bus, sub_bus, agent_id,
452                                         PCI_CLASS_REVISION , &class_id);
453                         if (err) {
454                                 DBG("ReadClass(%x, %x, %x) %x\n",
455                                         bus, sub_bus, agent_id, err);
456                                 continue;
457                         }
458
459                         devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(eads_id_sel),
460                                         function);
461                         cp = dt_find_pci_class_name(class_id >> 16);
462                         if (cp && cp->name)
463                                 strncpy(buf, cp->name, sizeof(buf) - 1);
464                         else
465                                 snprintf(buf, sizeof(buf), "pci%x,%x",
466                                                 vendor_id, device_id);
467                         buf[sizeof(buf) - 1] = '\0';
468                         snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
469                                         "@%x", PCI_SLOT(devfn));
470                         buf[sizeof(buf) - 1] = '\0';
471                         if (function != 0)
472                                 snprintf(buf + strlen(buf),
473                                         sizeof(buf) - strlen(buf),
474                                         ",%x", function);
475                         dt_start_node(dt, buf);
476                         reg[0] = (bus << 16) | (devfn << 8);
477                         reg[1] = 0;
478                         reg[2] = 0;
479                         reg[3] = 0;
480                         reg[4] = 0;
481                         dt_prop_u32_list(dt, "reg", reg, 5);
482                         if (cp && (cp->type || cp->name))
483                                 dt_prop_str(dt, "device_type",
484                                         cp->type ? cp->type : cp->name);
485                         dt_prop_u32(dt, "vendor-id", vendor_id);
486                         dt_prop_u32(dt, "device-id", device_id);
487                         dt_prop_u32(dt, "class-code", class_id >> 8);
488                         dt_prop_u32(dt, "revision-id", class_id & 0xff);
489                         dt_prop_u32(dt, "linux,subbus", sub_bus);
490                         dt_prop_u32(dt, "linux,agent-id", agent_id);
491                         dt_prop_u32(dt, "linux,logical-slot-number",
492                                         bridge_info->logicalSlotNumber);
493                         dt_end_node(dt);
494
495                 }
496         }
497 }
498
499 static void __init scan_bridge(struct iseries_flat_dt *dt, HvBusNumber bus,
500                 HvSubBusNumber sub_bus, int id_sel)
501 {
502         struct HvCallPci_BridgeInfo bridge_info;
503         HvAgentId agent_id;
504         int function;
505         int ret;
506
507         /* Note: hvSubBus and irq is always be 0 at this level! */
508         for (function = 0; function < 8; ++function) {
509                 agent_id = ISERIES_PCI_AGENTID(id_sel, function);
510                 ret = HvCallXm_connectBusUnit(bus, sub_bus, agent_id, 0);
511                 if (ret != 0) {
512                         if (ret != 0xb)
513                                 DBG("connectBusUnit(%x, %x, %x) %x\n",
514                                                 bus, sub_bus, agent_id, ret);
515                         continue;
516                 }
517                 DBG("found device at bus %d idsel %d func %d (AgentId %x)\n",
518                                 bus, id_sel, function, agent_id);
519                 ret = HvCallPci_getBusUnitInfo(bus, sub_bus, agent_id,
520                                 iseries_hv_addr(&bridge_info),
521                                 sizeof(struct HvCallPci_BridgeInfo));
522                 if (ret != 0)
523                         continue;
524                 DBG("bridge info: type %x subbus %x "
525                         "maxAgents %x maxsubbus %x logslot %x\n",
526                         bridge_info.busUnitInfo.deviceType,
527                         bridge_info.subBusNumber,
528                         bridge_info.maxAgents,
529                         bridge_info.maxSubBusNumber,
530                         bridge_info.logicalSlotNumber);
531                 if (bridge_info.busUnitInfo.deviceType ==
532                                 HvCallPci_BridgeDevice)
533                         scan_bridge_slot(dt, bus, &bridge_info);
534                 else
535                         DBG("PCI: Invalid Bridge Configuration(0x%02X)",
536                                 bridge_info.busUnitInfo.deviceType);
537         }
538 }
539
540 static void __init scan_phb(struct iseries_flat_dt *dt, HvBusNumber bus)
541 {
542         struct HvCallPci_DeviceInfo dev_info;
543         const HvSubBusNumber sub_bus = 0;       /* EADs is always 0. */
544         int err;
545         int id_sel;
546         const int max_agents = 8;
547
548         /*
549          * Probe for EADs Bridges
550          */
551         for (id_sel = 1; id_sel < max_agents; ++id_sel) {
552                 err = HvCallPci_getDeviceInfo(bus, sub_bus, id_sel,
553                                 iseries_hv_addr(&dev_info),
554                                 sizeof(struct HvCallPci_DeviceInfo));
555                 if (err) {
556                         if (err != 0x302)
557                                 DBG("getDeviceInfo(%x, %x, %x) %x\n",
558                                                 bus, sub_bus, id_sel, err);
559                         continue;
560                 }
561                 if (dev_info.deviceType != HvCallPci_NodeDevice) {
562                         DBG("PCI: Invalid System Configuration"
563                                         "(0x%02X) for bus 0x%02x id 0x%02x.\n",
564                                         dev_info.deviceType, bus, id_sel);
565                         continue;
566                 }
567                 scan_bridge(dt, bus, sub_bus, id_sel);
568         }
569 }
570
571 static void __init dt_pci_devices(struct iseries_flat_dt *dt)
572 {
573         HvBusNumber bus;
574         char buf[32];
575         u32 buses[2];
576         int phb_num = 0;
577
578         /* Check all possible buses. */
579         for (bus = 0; bus < 256; bus++) {
580                 int err = HvCallXm_testBus(bus);
581
582                 if (err) {
583                         /*
584                          * Check for Unexpected Return code, a clue that
585                          * something has gone wrong.
586                          */
587                         if (err != 0x0301)
588                                 DBG("Unexpected Return on Probe(0x%02X) "
589                                                 "0x%04X\n", bus, err);
590                         continue;
591                 }
592                 DBG("bus %d appears to exist\n", bus);
593                 snprintf(buf, 32, "pci@%d", phb_num);
594                 dt_start_node(dt, buf);
595                 dt_prop_str(dt, "device_type", device_type_pci);
596                 dt_prop_str(dt, "compatible", "IBM,iSeries-Logical-PHB");
597                 dt_prop_u32(dt, "#address-cells", 3);
598                 dt_prop_u32(dt, "#size-cells", 2);
599                 buses[0] = buses[1] = bus;
600                 dt_prop_u32_list(dt, "bus-range", buses, 2);
601                 scan_phb(dt, bus);
602                 dt_end_node(dt);
603                 phb_num++;
604         }
605 }
606
607 static void dt_finish(struct iseries_flat_dt *dt)
608 {
609         dt_push_u32(dt, OF_DT_END);
610         dt->header.totalsize = (unsigned long)dt_data - (unsigned long)dt;
611         klimit = ALIGN((unsigned long)dt_data, 8);
612 }
613
614 void * __init build_flat_dt(unsigned long phys_mem_size)
615 {
616         struct iseries_flat_dt *iseries_dt;
617         u64 tmp[2];
618
619         iseries_dt = dt_init();
620
621         dt_start_node(iseries_dt, "");
622
623         dt_prop_u32(iseries_dt, "#address-cells", 2);
624         dt_prop_u32(iseries_dt, "#size-cells", 2);
625         dt_model(iseries_dt);
626
627         /* /memory */
628         dt_start_node(iseries_dt, "memory@0");
629         dt_prop_str(iseries_dt, "device_type", device_type_memory);
630         tmp[0] = 0;
631         tmp[1] = phys_mem_size;
632         dt_prop_u64_list(iseries_dt, "reg", tmp, 2);
633         dt_end_node(iseries_dt);
634
635         /* /chosen */
636         dt_start_node(iseries_dt, "chosen");
637         dt_prop_str(iseries_dt, "bootargs", cmd_line);
638         dt_initrd(iseries_dt);
639         dt_end_node(iseries_dt);
640
641         dt_cpus(iseries_dt);
642
643         dt_vdevices(iseries_dt);
644         dt_pci_devices(iseries_dt);
645
646         dt_end_node(iseries_dt);
647
648         dt_finish(iseries_dt);
649
650         return iseries_dt;
651 }