2 * Procedures for creating, accessing and interpreting the device tree.
4 * Paul Mackerras August 1996.
5 * Copyright (C) 1996-2005 Paul Mackerras.
7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
8 * {engebret|bergner}@us.ibm.com
10 * Adapted for sparc64 by David S. Miller davem@davemloft.net
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
18 #include <linux/kernel.h>
19 #include <linux/types.h>
20 #include <linux/string.h>
22 #include <linux/bootmem.h>
23 #include <linux/module.h>
26 #include <asm/of_device.h>
27 #include <asm/oplib.h>
32 static struct device_node
*allnodes
;
34 /* use when traversing tree through the allnext, child, sibling,
35 * or parent members of struct device_node.
37 static DEFINE_RWLOCK(devtree_lock
);
39 int of_device_is_compatible(struct device_node
*device
, const char *compat
)
44 cp
= (char *) of_get_property(device
, "compatible", &cplen
);
48 if (strncmp(cp
, compat
, strlen(compat
)) == 0)
57 EXPORT_SYMBOL(of_device_is_compatible
);
59 struct device_node
*of_get_parent(const struct device_node
*node
)
61 struct device_node
*np
;
70 EXPORT_SYMBOL(of_get_parent
);
72 struct device_node
*of_get_next_child(const struct device_node
*node
,
73 struct device_node
*prev
)
75 struct device_node
*next
;
77 next
= prev
? prev
->sibling
: node
->child
;
78 for (; next
!= 0; next
= next
->sibling
) {
84 EXPORT_SYMBOL(of_get_next_child
);
86 struct device_node
*of_find_node_by_path(const char *path
)
88 struct device_node
*np
= allnodes
;
90 for (; np
!= 0; np
= np
->allnext
) {
91 if (np
->full_name
!= 0 && strcmp(np
->full_name
, path
) == 0)
97 EXPORT_SYMBOL(of_find_node_by_path
);
99 struct device_node
*of_find_node_by_phandle(phandle handle
)
101 struct device_node
*np
;
103 for (np
= allnodes
; np
!= 0; np
= np
->allnext
)
104 if (np
->node
== handle
)
109 EXPORT_SYMBOL(of_find_node_by_phandle
);
111 struct device_node
*of_find_node_by_name(struct device_node
*from
,
114 struct device_node
*np
;
116 np
= from
? from
->allnext
: allnodes
;
117 for (; np
!= NULL
; np
= np
->allnext
)
118 if (np
->name
!= NULL
&& strcmp(np
->name
, name
) == 0)
123 EXPORT_SYMBOL(of_find_node_by_name
);
125 struct device_node
*of_find_node_by_type(struct device_node
*from
,
128 struct device_node
*np
;
130 np
= from
? from
->allnext
: allnodes
;
131 for (; np
!= 0; np
= np
->allnext
)
132 if (np
->type
!= 0 && strcmp(np
->type
, type
) == 0)
137 EXPORT_SYMBOL(of_find_node_by_type
);
139 struct device_node
*of_find_compatible_node(struct device_node
*from
,
140 const char *type
, const char *compatible
)
142 struct device_node
*np
;
144 np
= from
? from
->allnext
: allnodes
;
145 for (; np
!= 0; np
= np
->allnext
) {
147 && !(np
->type
!= 0 && strcmp(np
->type
, type
) == 0))
149 if (of_device_is_compatible(np
, compatible
))
155 EXPORT_SYMBOL(of_find_compatible_node
);
157 struct property
*of_find_property(struct device_node
*np
, const char *name
,
162 for (pp
= np
->properties
; pp
!= 0; pp
= pp
->next
) {
163 if (strcmp(pp
->name
, name
) == 0) {
171 EXPORT_SYMBOL(of_find_property
);
174 * Find a property with a given name for a given node
175 * and return the value.
177 void *of_get_property(struct device_node
*np
, const char *name
, int *lenp
)
179 struct property
*pp
= of_find_property(np
,name
,lenp
);
180 return pp
? pp
->value
: NULL
;
182 EXPORT_SYMBOL(of_get_property
);
184 int of_getintprop_default(struct device_node
*np
, const char *name
, int def
)
186 struct property
*prop
;
189 prop
= of_find_property(np
, name
, &len
);
190 if (!prop
|| len
!= 4)
193 return *(int *) prop
->value
;
195 EXPORT_SYMBOL(of_getintprop_default
);
197 int of_n_addr_cells(struct device_node
*np
)
203 ip
= of_get_property(np
, "#address-cells", NULL
);
206 } while (np
->parent
);
207 /* No #address-cells property for the root node, default to 2 */
210 EXPORT_SYMBOL(of_n_addr_cells
);
212 int of_n_size_cells(struct device_node
*np
)
218 ip
= of_get_property(np
, "#size-cells", NULL
);
221 } while (np
->parent
);
222 /* No #size-cells property for the root node, default to 1 */
225 EXPORT_SYMBOL(of_n_size_cells
);
227 int of_set_property(struct device_node
*dp
, const char *name
, void *val
, int len
)
229 struct property
**prevp
;
233 new_val
= kmalloc(len
, GFP_KERNEL
);
237 memcpy(new_val
, val
, len
);
241 write_lock(&devtree_lock
);
242 prevp
= &dp
->properties
;
244 struct property
*prop
= *prevp
;
246 if (!strcmp(prop
->name
, name
)) {
247 void *old_val
= prop
->value
;
250 ret
= prom_setprop(dp
->node
, name
, val
, len
);
253 prop
->value
= new_val
;
256 if (OF_IS_DYNAMIC(prop
))
259 OF_MARK_DYNAMIC(prop
);
265 prevp
= &(*prevp
)->next
;
267 write_unlock(&devtree_lock
);
269 /* XXX Upate procfs if necessary... */
273 EXPORT_SYMBOL(of_set_property
);
275 static unsigned int prom_early_allocated
;
277 static void * __init
prom_early_alloc(unsigned long size
)
281 ret
= __alloc_bootmem(size
, SMP_CACHE_BYTES
, 0UL);
283 memset(ret
, 0, size
);
285 prom_early_allocated
+= size
;
291 /* PSYCHO interrupt mapping support. */
292 #define PSYCHO_IMAP_A_SLOT0 0x0c00UL
293 #define PSYCHO_IMAP_B_SLOT0 0x0c20UL
294 static unsigned long psycho_pcislot_imap_offset(unsigned long ino
)
296 unsigned int bus
= (ino
& 0x10) >> 4;
297 unsigned int slot
= (ino
& 0x0c) >> 2;
300 return PSYCHO_IMAP_A_SLOT0
+ (slot
* 8);
302 return PSYCHO_IMAP_B_SLOT0
+ (slot
* 8);
305 #define PSYCHO_IMAP_SCSI 0x1000UL
306 #define PSYCHO_IMAP_ETH 0x1008UL
307 #define PSYCHO_IMAP_BPP 0x1010UL
308 #define PSYCHO_IMAP_AU_REC 0x1018UL
309 #define PSYCHO_IMAP_AU_PLAY 0x1020UL
310 #define PSYCHO_IMAP_PFAIL 0x1028UL
311 #define PSYCHO_IMAP_KMS 0x1030UL
312 #define PSYCHO_IMAP_FLPY 0x1038UL
313 #define PSYCHO_IMAP_SHW 0x1040UL
314 #define PSYCHO_IMAP_KBD 0x1048UL
315 #define PSYCHO_IMAP_MS 0x1050UL
316 #define PSYCHO_IMAP_SER 0x1058UL
317 #define PSYCHO_IMAP_TIM0 0x1060UL
318 #define PSYCHO_IMAP_TIM1 0x1068UL
319 #define PSYCHO_IMAP_UE 0x1070UL
320 #define PSYCHO_IMAP_CE 0x1078UL
321 #define PSYCHO_IMAP_A_ERR 0x1080UL
322 #define PSYCHO_IMAP_B_ERR 0x1088UL
323 #define PSYCHO_IMAP_PMGMT 0x1090UL
324 #define PSYCHO_IMAP_GFX 0x1098UL
325 #define PSYCHO_IMAP_EUPA 0x10a0UL
327 static unsigned long __psycho_onboard_imap_off
[] = {
328 /*0x20*/ PSYCHO_IMAP_SCSI
,
329 /*0x21*/ PSYCHO_IMAP_ETH
,
330 /*0x22*/ PSYCHO_IMAP_BPP
,
331 /*0x23*/ PSYCHO_IMAP_AU_REC
,
332 /*0x24*/ PSYCHO_IMAP_AU_PLAY
,
333 /*0x25*/ PSYCHO_IMAP_PFAIL
,
334 /*0x26*/ PSYCHO_IMAP_KMS
,
335 /*0x27*/ PSYCHO_IMAP_FLPY
,
336 /*0x28*/ PSYCHO_IMAP_SHW
,
337 /*0x29*/ PSYCHO_IMAP_KBD
,
338 /*0x2a*/ PSYCHO_IMAP_MS
,
339 /*0x2b*/ PSYCHO_IMAP_SER
,
340 /*0x2c*/ PSYCHO_IMAP_TIM0
,
341 /*0x2d*/ PSYCHO_IMAP_TIM1
,
342 /*0x2e*/ PSYCHO_IMAP_UE
,
343 /*0x2f*/ PSYCHO_IMAP_CE
,
344 /*0x30*/ PSYCHO_IMAP_A_ERR
,
345 /*0x31*/ PSYCHO_IMAP_B_ERR
,
346 /*0x32*/ PSYCHO_IMAP_PMGMT
,
347 /*0x33*/ PSYCHO_IMAP_GFX
,
348 /*0x34*/ PSYCHO_IMAP_EUPA
,
350 #define PSYCHO_ONBOARD_IRQ_BASE 0x20
351 #define PSYCHO_ONBOARD_IRQ_LAST 0x34
352 #define psycho_onboard_imap_offset(__ino) \
353 __psycho_onboard_imap_off[(__ino) - PSYCHO_ONBOARD_IRQ_BASE]
355 #define PSYCHO_ICLR_A_SLOT0 0x1400UL
356 #define PSYCHO_ICLR_SCSI 0x1800UL
358 #define psycho_iclr_offset(ino) \
359 ((ino & 0x20) ? (PSYCHO_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \
360 (PSYCHO_ICLR_A_SLOT0 + (((ino) & 0x1f)<<3)))
362 static unsigned int psycho_irq_build(struct device_node
*dp
,
366 unsigned long controller_regs
= (unsigned long) _data
;
367 unsigned long imap
, iclr
;
368 unsigned long imap_off
, iclr_off
;
372 if (ino
< PSYCHO_ONBOARD_IRQ_BASE
) {
374 imap_off
= psycho_pcislot_imap_offset(ino
);
377 if (ino
> PSYCHO_ONBOARD_IRQ_LAST
) {
378 prom_printf("psycho_irq_build: Wacky INO [%x]\n", ino
);
381 imap_off
= psycho_onboard_imap_offset(ino
);
384 /* Now build the IRQ bucket. */
385 imap
= controller_regs
+ imap_off
;
388 iclr_off
= psycho_iclr_offset(ino
);
389 iclr
= controller_regs
+ iclr_off
;
392 if ((ino
& 0x20) == 0)
393 inofixup
= ino
& 0x03;
395 return build_irq(inofixup
, iclr
, imap
);
398 static void psycho_irq_trans_init(struct device_node
*dp
)
400 struct linux_prom64_registers
*regs
;
402 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
403 dp
->irq_trans
->irq_build
= psycho_irq_build
;
405 regs
= of_get_property(dp
, "reg", NULL
);
406 dp
->irq_trans
->data
= (void *) regs
[2].phys_addr
;
409 #define sabre_read(__reg) \
411 __asm__ __volatile__("ldxa [%1] %2, %0" \
413 : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \
418 struct sabre_irq_data
{
419 unsigned long controller_regs
;
420 unsigned int pci_first_busno
;
422 #define SABRE_CONFIGSPACE 0x001000000UL
423 #define SABRE_WRSYNC 0x1c20UL
425 #define SABRE_CONFIG_BASE(CONFIG_SPACE) \
426 (CONFIG_SPACE | (1UL << 24))
427 #define SABRE_CONFIG_ENCODE(BUS, DEVFN, REG) \
428 (((unsigned long)(BUS) << 16) | \
429 ((unsigned long)(DEVFN) << 8) | \
430 ((unsigned long)(REG)))
432 /* When a device lives behind a bridge deeper in the PCI bus topology
433 * than APB, a special sequence must run to make sure all pending DMA
434 * transfers at the time of IRQ delivery are visible in the coherency
435 * domain by the cpu. This sequence is to perform a read on the far
436 * side of the non-APB bridge, then perform a read of Sabre's DMA
437 * write-sync register.
439 static void sabre_wsync_handler(unsigned int ino
, void *_arg1
, void *_arg2
)
441 unsigned int phys_hi
= (unsigned int) (unsigned long) _arg1
;
442 struct sabre_irq_data
*irq_data
= _arg2
;
443 unsigned long controller_regs
= irq_data
->controller_regs
;
444 unsigned long sync_reg
= controller_regs
+ SABRE_WRSYNC
;
445 unsigned long config_space
= controller_regs
+ SABRE_CONFIGSPACE
;
446 unsigned int bus
, devfn
;
449 config_space
= SABRE_CONFIG_BASE(config_space
);
451 bus
= (phys_hi
>> 16) & 0xff;
452 devfn
= (phys_hi
>> 8) & 0xff;
454 config_space
|= SABRE_CONFIG_ENCODE(bus
, devfn
, 0x00);
456 __asm__
__volatile__("membar #Sync\n\t"
457 "lduha [%1] %2, %0\n\t"
460 : "r" ((u16
*) config_space
),
461 "i" (ASI_PHYS_BYPASS_EC_E_L
)
464 sabre_read(sync_reg
);
467 #define SABRE_IMAP_A_SLOT0 0x0c00UL
468 #define SABRE_IMAP_B_SLOT0 0x0c20UL
469 #define SABRE_IMAP_SCSI 0x1000UL
470 #define SABRE_IMAP_ETH 0x1008UL
471 #define SABRE_IMAP_BPP 0x1010UL
472 #define SABRE_IMAP_AU_REC 0x1018UL
473 #define SABRE_IMAP_AU_PLAY 0x1020UL
474 #define SABRE_IMAP_PFAIL 0x1028UL
475 #define SABRE_IMAP_KMS 0x1030UL
476 #define SABRE_IMAP_FLPY 0x1038UL
477 #define SABRE_IMAP_SHW 0x1040UL
478 #define SABRE_IMAP_KBD 0x1048UL
479 #define SABRE_IMAP_MS 0x1050UL
480 #define SABRE_IMAP_SER 0x1058UL
481 #define SABRE_IMAP_UE 0x1070UL
482 #define SABRE_IMAP_CE 0x1078UL
483 #define SABRE_IMAP_PCIERR 0x1080UL
484 #define SABRE_IMAP_GFX 0x1098UL
485 #define SABRE_IMAP_EUPA 0x10a0UL
486 #define SABRE_ICLR_A_SLOT0 0x1400UL
487 #define SABRE_ICLR_B_SLOT0 0x1480UL
488 #define SABRE_ICLR_SCSI 0x1800UL
489 #define SABRE_ICLR_ETH 0x1808UL
490 #define SABRE_ICLR_BPP 0x1810UL
491 #define SABRE_ICLR_AU_REC 0x1818UL
492 #define SABRE_ICLR_AU_PLAY 0x1820UL
493 #define SABRE_ICLR_PFAIL 0x1828UL
494 #define SABRE_ICLR_KMS 0x1830UL
495 #define SABRE_ICLR_FLPY 0x1838UL
496 #define SABRE_ICLR_SHW 0x1840UL
497 #define SABRE_ICLR_KBD 0x1848UL
498 #define SABRE_ICLR_MS 0x1850UL
499 #define SABRE_ICLR_SER 0x1858UL
500 #define SABRE_ICLR_UE 0x1870UL
501 #define SABRE_ICLR_CE 0x1878UL
502 #define SABRE_ICLR_PCIERR 0x1880UL
504 static unsigned long sabre_pcislot_imap_offset(unsigned long ino
)
506 unsigned int bus
= (ino
& 0x10) >> 4;
507 unsigned int slot
= (ino
& 0x0c) >> 2;
510 return SABRE_IMAP_A_SLOT0
+ (slot
* 8);
512 return SABRE_IMAP_B_SLOT0
+ (slot
* 8);
515 static unsigned long __sabre_onboard_imap_off
[] = {
516 /*0x20*/ SABRE_IMAP_SCSI
,
517 /*0x21*/ SABRE_IMAP_ETH
,
518 /*0x22*/ SABRE_IMAP_BPP
,
519 /*0x23*/ SABRE_IMAP_AU_REC
,
520 /*0x24*/ SABRE_IMAP_AU_PLAY
,
521 /*0x25*/ SABRE_IMAP_PFAIL
,
522 /*0x26*/ SABRE_IMAP_KMS
,
523 /*0x27*/ SABRE_IMAP_FLPY
,
524 /*0x28*/ SABRE_IMAP_SHW
,
525 /*0x29*/ SABRE_IMAP_KBD
,
526 /*0x2a*/ SABRE_IMAP_MS
,
527 /*0x2b*/ SABRE_IMAP_SER
,
528 /*0x2c*/ 0 /* reserved */,
529 /*0x2d*/ 0 /* reserved */,
530 /*0x2e*/ SABRE_IMAP_UE
,
531 /*0x2f*/ SABRE_IMAP_CE
,
532 /*0x30*/ SABRE_IMAP_PCIERR
,
533 /*0x31*/ 0 /* reserved */,
534 /*0x32*/ 0 /* reserved */,
535 /*0x33*/ SABRE_IMAP_GFX
,
536 /*0x34*/ SABRE_IMAP_EUPA
,
538 #define SABRE_ONBOARD_IRQ_BASE 0x20
539 #define SABRE_ONBOARD_IRQ_LAST 0x30
540 #define sabre_onboard_imap_offset(__ino) \
541 __sabre_onboard_imap_off[(__ino) - SABRE_ONBOARD_IRQ_BASE]
543 #define sabre_iclr_offset(ino) \
544 ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \
545 (SABRE_ICLR_A_SLOT0 + (((ino) & 0x1f)<<3)))
547 static int sabre_device_needs_wsync(struct device_node
*dp
)
549 struct device_node
*parent
= dp
->parent
;
550 char *parent_model
, *parent_compat
;
552 /* This traversal up towards the root is meant to
555 * 1) non-PCI bus sitting under PCI, such as 'ebus'
556 * 2) the PCI controller interrupts themselves, which
557 * will use the sabre_irq_build but do not need
558 * the DMA synchronization handling
561 if (!strcmp(parent
->type
, "pci"))
563 parent
= parent
->parent
;
569 parent_model
= of_get_property(parent
,
572 (!strcmp(parent_model
, "SUNW,sabre") ||
573 !strcmp(parent_model
, "SUNW,simba")))
576 parent_compat
= of_get_property(parent
,
579 (!strcmp(parent_compat
, "pci108e,a000") ||
580 !strcmp(parent_compat
, "pci108e,a001")))
586 static unsigned int sabre_irq_build(struct device_node
*dp
,
590 struct sabre_irq_data
*irq_data
= _data
;
591 unsigned long controller_regs
= irq_data
->controller_regs
;
592 struct linux_prom_pci_registers
*regs
;
593 unsigned long imap
, iclr
;
594 unsigned long imap_off
, iclr_off
;
599 if (ino
< SABRE_ONBOARD_IRQ_BASE
) {
601 imap_off
= sabre_pcislot_imap_offset(ino
);
604 if (ino
> SABRE_ONBOARD_IRQ_LAST
) {
605 prom_printf("sabre_irq_build: Wacky INO [%x]\n", ino
);
608 imap_off
= sabre_onboard_imap_offset(ino
);
611 /* Now build the IRQ bucket. */
612 imap
= controller_regs
+ imap_off
;
615 iclr_off
= sabre_iclr_offset(ino
);
616 iclr
= controller_regs
+ iclr_off
;
619 if ((ino
& 0x20) == 0)
620 inofixup
= ino
& 0x03;
622 virt_irq
= build_irq(inofixup
, iclr
, imap
);
624 /* If the parent device is a PCI<->PCI bridge other than
625 * APB, we have to install a pre-handler to ensure that
626 * all pending DMA is drained before the interrupt handler
629 regs
= of_get_property(dp
, "reg", NULL
);
630 if (regs
&& sabre_device_needs_wsync(dp
)) {
631 irq_install_pre_handler(virt_irq
,
633 (void *) (long) regs
->phys_hi
,
640 static void sabre_irq_trans_init(struct device_node
*dp
)
642 struct linux_prom64_registers
*regs
;
643 struct sabre_irq_data
*irq_data
;
646 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
647 dp
->irq_trans
->irq_build
= sabre_irq_build
;
649 irq_data
= prom_early_alloc(sizeof(struct sabre_irq_data
));
651 regs
= of_get_property(dp
, "reg", NULL
);
652 irq_data
->controller_regs
= regs
[0].phys_addr
;
654 busrange
= of_get_property(dp
, "bus-range", NULL
);
655 irq_data
->pci_first_busno
= busrange
[0];
657 dp
->irq_trans
->data
= irq_data
;
660 /* SCHIZO interrupt mapping support. Unlike Psycho, for this controller the
661 * imap/iclr registers are per-PBM.
663 #define SCHIZO_IMAP_BASE 0x1000UL
664 #define SCHIZO_ICLR_BASE 0x1400UL
666 static unsigned long schizo_imap_offset(unsigned long ino
)
668 return SCHIZO_IMAP_BASE
+ (ino
* 8UL);
671 static unsigned long schizo_iclr_offset(unsigned long ino
)
673 return SCHIZO_ICLR_BASE
+ (ino
* 8UL);
676 static unsigned long schizo_ino_to_iclr(unsigned long pbm_regs
,
679 return pbm_regs
+ schizo_iclr_offset(ino
) + 4;
682 static unsigned long schizo_ino_to_imap(unsigned long pbm_regs
,
685 return pbm_regs
+ schizo_imap_offset(ino
) + 4;
688 #define schizo_read(__reg) \
690 __asm__ __volatile__("ldxa [%1] %2, %0" \
692 : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \
696 #define schizo_write(__reg, __val) \
697 __asm__ __volatile__("stxa %0, [%1] %2" \
699 : "r" (__val), "r" (__reg), \
700 "i" (ASI_PHYS_BYPASS_EC_E) \
703 static void tomatillo_wsync_handler(unsigned int ino
, void *_arg1
, void *_arg2
)
705 unsigned long sync_reg
= (unsigned long) _arg2
;
706 u64 mask
= 1UL << (ino
& IMAP_INO
);
710 schizo_write(sync_reg
, mask
);
715 val
= schizo_read(sync_reg
);
720 printk("tomatillo_wsync_handler: DMA won't sync [%lx:%lx]\n",
725 static unsigned char cacheline
[64]
726 __attribute__ ((aligned (64)));
728 __asm__
__volatile__("rd %%fprs, %0\n\t"
730 "wr %1, 0x0, %%fprs\n\t"
731 "stda %%f0, [%5] %6\n\t"
732 "wr %0, 0x0, %%fprs\n\t"
734 : "=&r" (mask
), "=&r" (val
)
735 : "0" (mask
), "1" (val
),
736 "i" (FPRS_FEF
), "r" (&cacheline
[0]),
737 "i" (ASI_BLK_COMMIT_P
));
741 struct schizo_irq_data
{
742 unsigned long pbm_regs
;
743 unsigned long sync_reg
;
748 static unsigned int schizo_irq_build(struct device_node
*dp
,
752 struct schizo_irq_data
*irq_data
= _data
;
753 unsigned long pbm_regs
= irq_data
->pbm_regs
;
754 unsigned long imap
, iclr
;
761 /* Now build the IRQ bucket. */
762 imap
= schizo_ino_to_imap(pbm_regs
, ino
);
763 iclr
= schizo_ino_to_iclr(pbm_regs
, ino
);
765 /* On Schizo, no inofixup occurs. This is because each
766 * INO has it's own IMAP register. On Psycho and Sabre
767 * there is only one IMAP register for each PCI slot even
768 * though four different INOs can be generated by each
771 * But, for JBUS variants (essentially, Tomatillo), we have
772 * to fixup the lowest bit of the interrupt group number.
776 is_tomatillo
= (irq_data
->sync_reg
!= 0UL);
779 if (irq_data
->portid
& 1)
780 ign_fixup
= (1 << 6);
783 virt_irq
= build_irq(ign_fixup
, iclr
, imap
);
786 irq_install_pre_handler(virt_irq
,
787 tomatillo_wsync_handler
,
788 ((irq_data
->chip_version
<= 4) ?
789 (void *) 1 : (void *) 0),
790 (void *) irq_data
->sync_reg
);
796 static void __schizo_irq_trans_init(struct device_node
*dp
, int is_tomatillo
)
798 struct linux_prom64_registers
*regs
;
799 struct schizo_irq_data
*irq_data
;
801 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
802 dp
->irq_trans
->irq_build
= schizo_irq_build
;
804 irq_data
= prom_early_alloc(sizeof(struct schizo_irq_data
));
806 regs
= of_get_property(dp
, "reg", NULL
);
807 dp
->irq_trans
->data
= irq_data
;
809 irq_data
->pbm_regs
= regs
[0].phys_addr
;
811 irq_data
->sync_reg
= regs
[3].phys_addr
+ 0x1a18UL
;
813 irq_data
->sync_reg
= 0UL;
814 irq_data
->portid
= of_getintprop_default(dp
, "portid", 0);
815 irq_data
->chip_version
= of_getintprop_default(dp
, "version#", 0);
818 static void schizo_irq_trans_init(struct device_node
*dp
)
820 __schizo_irq_trans_init(dp
, 0);
823 static void tomatillo_irq_trans_init(struct device_node
*dp
)
825 __schizo_irq_trans_init(dp
, 1);
828 static unsigned int pci_sun4v_irq_build(struct device_node
*dp
,
832 u32 devhandle
= (u32
) (unsigned long) _data
;
834 return sun4v_build_irq(devhandle
, devino
);
837 static void pci_sun4v_irq_trans_init(struct device_node
*dp
)
839 struct linux_prom64_registers
*regs
;
841 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
842 dp
->irq_trans
->irq_build
= pci_sun4v_irq_build
;
844 regs
= of_get_property(dp
, "reg", NULL
);
845 dp
->irq_trans
->data
= (void *) (unsigned long)
846 ((regs
->phys_addr
>> 32UL) & 0x0fffffff);
848 #endif /* CONFIG_PCI */
851 /* INO number to IMAP register offset for SYSIO external IRQ's.
852 * This should conform to both Sunfire/Wildfire server and Fusion
855 #define SYSIO_IMAP_SLOT0 0x2c04UL
856 #define SYSIO_IMAP_SLOT1 0x2c0cUL
857 #define SYSIO_IMAP_SLOT2 0x2c14UL
858 #define SYSIO_IMAP_SLOT3 0x2c1cUL
859 #define SYSIO_IMAP_SCSI 0x3004UL
860 #define SYSIO_IMAP_ETH 0x300cUL
861 #define SYSIO_IMAP_BPP 0x3014UL
862 #define SYSIO_IMAP_AUDIO 0x301cUL
863 #define SYSIO_IMAP_PFAIL 0x3024UL
864 #define SYSIO_IMAP_KMS 0x302cUL
865 #define SYSIO_IMAP_FLPY 0x3034UL
866 #define SYSIO_IMAP_SHW 0x303cUL
867 #define SYSIO_IMAP_KBD 0x3044UL
868 #define SYSIO_IMAP_MS 0x304cUL
869 #define SYSIO_IMAP_SER 0x3054UL
870 #define SYSIO_IMAP_TIM0 0x3064UL
871 #define SYSIO_IMAP_TIM1 0x306cUL
872 #define SYSIO_IMAP_UE 0x3074UL
873 #define SYSIO_IMAP_CE 0x307cUL
874 #define SYSIO_IMAP_SBERR 0x3084UL
875 #define SYSIO_IMAP_PMGMT 0x308cUL
876 #define SYSIO_IMAP_GFX 0x3094UL
877 #define SYSIO_IMAP_EUPA 0x309cUL
879 #define bogon ((unsigned long) -1)
880 static unsigned long sysio_irq_offsets
[] = {
881 /* SBUS Slot 0 --> 3, level 1 --> 7 */
882 SYSIO_IMAP_SLOT0
, SYSIO_IMAP_SLOT0
, SYSIO_IMAP_SLOT0
, SYSIO_IMAP_SLOT0
,
883 SYSIO_IMAP_SLOT0
, SYSIO_IMAP_SLOT0
, SYSIO_IMAP_SLOT0
, SYSIO_IMAP_SLOT0
,
884 SYSIO_IMAP_SLOT1
, SYSIO_IMAP_SLOT1
, SYSIO_IMAP_SLOT1
, SYSIO_IMAP_SLOT1
,
885 SYSIO_IMAP_SLOT1
, SYSIO_IMAP_SLOT1
, SYSIO_IMAP_SLOT1
, SYSIO_IMAP_SLOT1
,
886 SYSIO_IMAP_SLOT2
, SYSIO_IMAP_SLOT2
, SYSIO_IMAP_SLOT2
, SYSIO_IMAP_SLOT2
,
887 SYSIO_IMAP_SLOT2
, SYSIO_IMAP_SLOT2
, SYSIO_IMAP_SLOT2
, SYSIO_IMAP_SLOT2
,
888 SYSIO_IMAP_SLOT3
, SYSIO_IMAP_SLOT3
, SYSIO_IMAP_SLOT3
, SYSIO_IMAP_SLOT3
,
889 SYSIO_IMAP_SLOT3
, SYSIO_IMAP_SLOT3
, SYSIO_IMAP_SLOT3
, SYSIO_IMAP_SLOT3
,
891 /* Onboard devices (not relevant/used on SunFire). */
922 #define NUM_SYSIO_OFFSETS ARRAY_SIZE(sysio_irq_offsets)
924 /* Convert Interrupt Mapping register pointer to associated
925 * Interrupt Clear register pointer, SYSIO specific version.
927 #define SYSIO_ICLR_UNUSED0 0x3400UL
928 #define SYSIO_ICLR_SLOT0 0x340cUL
929 #define SYSIO_ICLR_SLOT1 0x344cUL
930 #define SYSIO_ICLR_SLOT2 0x348cUL
931 #define SYSIO_ICLR_SLOT3 0x34ccUL
932 static unsigned long sysio_imap_to_iclr(unsigned long imap
)
934 unsigned long diff
= SYSIO_ICLR_UNUSED0
- SYSIO_IMAP_SLOT0
;
938 static unsigned int sbus_of_build_irq(struct device_node
*dp
,
942 unsigned long reg_base
= (unsigned long) _data
;
943 struct linux_prom_registers
*regs
;
944 unsigned long imap
, iclr
;
950 regs
= of_get_property(dp
, "reg", NULL
);
952 sbus_slot
= regs
->which_io
;
955 ino
+= (sbus_slot
* 8);
957 imap
= sysio_irq_offsets
[ino
];
958 if (imap
== ((unsigned long)-1)) {
959 prom_printf("get_irq_translations: Bad SYSIO INO[%x]\n",
965 /* SYSIO inconsistency. For external SLOTS, we have to select
966 * the right ICLR register based upon the lower SBUS irq level
970 iclr
= sysio_imap_to_iclr(imap
);
972 sbus_level
= ino
& 0x7;
976 iclr
= reg_base
+ SYSIO_ICLR_SLOT0
;
979 iclr
= reg_base
+ SYSIO_ICLR_SLOT1
;
982 iclr
= reg_base
+ SYSIO_ICLR_SLOT2
;
986 iclr
= reg_base
+ SYSIO_ICLR_SLOT3
;
990 iclr
+= ((unsigned long)sbus_level
- 1UL) * 8UL;
992 return build_irq(sbus_level
, iclr
, imap
);
995 static void sbus_irq_trans_init(struct device_node
*dp
)
997 struct linux_prom64_registers
*regs
;
999 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
1000 dp
->irq_trans
->irq_build
= sbus_of_build_irq
;
1002 regs
= of_get_property(dp
, "reg", NULL
);
1003 dp
->irq_trans
->data
= (void *) (unsigned long) regs
->phys_addr
;
1005 #endif /* CONFIG_SBUS */
1008 static unsigned int central_build_irq(struct device_node
*dp
,
1012 struct device_node
*central_dp
= _data
;
1013 struct of_device
*central_op
= of_find_device_by_node(central_dp
);
1014 struct resource
*res
;
1015 unsigned long imap
, iclr
;
1018 if (!strcmp(dp
->name
, "eeprom")) {
1019 res
= ¢ral_op
->resource
[5];
1020 } else if (!strcmp(dp
->name
, "zs")) {
1021 res
= ¢ral_op
->resource
[4];
1022 } else if (!strcmp(dp
->name
, "clock-board")) {
1023 res
= ¢ral_op
->resource
[3];
1028 imap
= res
->start
+ 0x00UL
;
1029 iclr
= res
->start
+ 0x10UL
;
1031 /* Set the INO state to idle, and disable. */
1032 upa_writel(0, iclr
);
1035 tmp
= upa_readl(imap
);
1037 upa_writel(tmp
, imap
);
1039 return build_irq(0, iclr
, imap
);
1042 static void central_irq_trans_init(struct device_node
*dp
)
1044 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
1045 dp
->irq_trans
->irq_build
= central_build_irq
;
1047 dp
->irq_trans
->data
= dp
;
1052 void (*init
)(struct device_node
*);
1056 static struct irq_trans pci_irq_trans_table
[] = {
1057 { "SUNW,sabre", sabre_irq_trans_init
},
1058 { "pci108e,a000", sabre_irq_trans_init
},
1059 { "pci108e,a001", sabre_irq_trans_init
},
1060 { "SUNW,psycho", psycho_irq_trans_init
},
1061 { "pci108e,8000", psycho_irq_trans_init
},
1062 { "SUNW,schizo", schizo_irq_trans_init
},
1063 { "pci108e,8001", schizo_irq_trans_init
},
1064 { "SUNW,schizo+", schizo_irq_trans_init
},
1065 { "pci108e,8002", schizo_irq_trans_init
},
1066 { "SUNW,tomatillo", tomatillo_irq_trans_init
},
1067 { "pci108e,a801", tomatillo_irq_trans_init
},
1068 { "SUNW,sun4v-pci", pci_sun4v_irq_trans_init
},
1072 static unsigned int sun4v_vdev_irq_build(struct device_node
*dp
,
1073 unsigned int devino
,
1076 u32 devhandle
= (u32
) (unsigned long) _data
;
1078 return sun4v_build_irq(devhandle
, devino
);
1081 static void sun4v_vdev_irq_trans_init(struct device_node
*dp
)
1083 struct linux_prom64_registers
*regs
;
1085 dp
->irq_trans
= prom_early_alloc(sizeof(struct of_irq_controller
));
1086 dp
->irq_trans
->irq_build
= sun4v_vdev_irq_build
;
1088 regs
= of_get_property(dp
, "reg", NULL
);
1089 dp
->irq_trans
->data
= (void *) (unsigned long)
1090 ((regs
->phys_addr
>> 32UL) & 0x0fffffff);
1093 static void irq_trans_init(struct device_node
*dp
)
1101 model
= of_get_property(dp
, "model", NULL
);
1103 model
= of_get_property(dp
, "compatible", NULL
);
1105 for (i
= 0; i
< ARRAY_SIZE(pci_irq_trans_table
); i
++) {
1106 struct irq_trans
*t
= &pci_irq_trans_table
[i
];
1108 if (!strcmp(model
, t
->name
))
1114 if (!strcmp(dp
->name
, "sbus") ||
1115 !strcmp(dp
->name
, "sbi"))
1116 return sbus_irq_trans_init(dp
);
1118 if (!strcmp(dp
->name
, "fhc") &&
1119 !strcmp(dp
->parent
->name
, "central"))
1120 return central_irq_trans_init(dp
);
1121 if (!strcmp(dp
->name
, "virtual-devices"))
1122 return sun4v_vdev_irq_trans_init(dp
);
1125 static int is_root_node(const struct device_node
*dp
)
1130 return (dp
->parent
== NULL
);
1133 /* The following routines deal with the black magic of fully naming a
1136 * Certain well known named nodes are just the simple name string.
1138 * Actual devices have an address specifier appended to the base name
1139 * string, like this "foo@addr". The "addr" can be in any number of
1140 * formats, and the platform plus the type of the node determine the
1141 * format and how it is constructed.
1143 * For children of the ROOT node, the naming convention is fixed and
1144 * determined by whether this is a sun4u or sun4v system.
1146 * For children of other nodes, it is bus type specific. So
1147 * we walk up the tree until we discover a "device_type" property
1148 * we recognize and we go from there.
1150 * As an example, the boot device on my workstation has a full path:
1152 * /pci@1e,600000/ide@d/disk@0,0:c
1154 static void __init
sun4v_path_component(struct device_node
*dp
, char *tmp_buf
)
1156 struct linux_prom64_registers
*regs
;
1157 struct property
*rprop
;
1158 u32 high_bits
, low_bits
, type
;
1160 rprop
= of_find_property(dp
, "reg", NULL
);
1164 regs
= rprop
->value
;
1165 if (!is_root_node(dp
->parent
)) {
1166 sprintf(tmp_buf
, "%s@%x,%x",
1168 (unsigned int) (regs
->phys_addr
>> 32UL),
1169 (unsigned int) (regs
->phys_addr
& 0xffffffffUL
));
1173 type
= regs
->phys_addr
>> 60UL;
1174 high_bits
= (regs
->phys_addr
>> 32UL) & 0x0fffffffUL
;
1175 low_bits
= (regs
->phys_addr
& 0xffffffffUL
);
1177 if (type
== 0 || type
== 8) {
1178 const char *prefix
= (type
== 0) ? "m" : "i";
1181 sprintf(tmp_buf
, "%s@%s%x,%x",
1183 high_bits
, low_bits
);
1185 sprintf(tmp_buf
, "%s@%s%x",
1189 } else if (type
== 12) {
1190 sprintf(tmp_buf
, "%s@%x",
1191 dp
->name
, high_bits
);
1195 static void __init
sun4u_path_component(struct device_node
*dp
, char *tmp_buf
)
1197 struct linux_prom64_registers
*regs
;
1198 struct property
*prop
;
1200 prop
= of_find_property(dp
, "reg", NULL
);
1205 if (!is_root_node(dp
->parent
)) {
1206 sprintf(tmp_buf
, "%s@%x,%x",
1208 (unsigned int) (regs
->phys_addr
>> 32UL),
1209 (unsigned int) (regs
->phys_addr
& 0xffffffffUL
));
1213 prop
= of_find_property(dp
, "upa-portid", NULL
);
1215 prop
= of_find_property(dp
, "portid", NULL
);
1217 unsigned long mask
= 0xffffffffUL
;
1219 if (tlb_type
>= cheetah
)
1222 sprintf(tmp_buf
, "%s@%x,%x",
1224 *(u32
*)prop
->value
,
1225 (unsigned int) (regs
->phys_addr
& mask
));
1229 /* "name@slot,offset" */
1230 static void __init
sbus_path_component(struct device_node
*dp
, char *tmp_buf
)
1232 struct linux_prom_registers
*regs
;
1233 struct property
*prop
;
1235 prop
= of_find_property(dp
, "reg", NULL
);
1240 sprintf(tmp_buf
, "%s@%x,%x",
1246 /* "name@devnum[,func]" */
1247 static void __init
pci_path_component(struct device_node
*dp
, char *tmp_buf
)
1249 struct linux_prom_pci_registers
*regs
;
1250 struct property
*prop
;
1253 prop
= of_find_property(dp
, "reg", NULL
);
1258 devfn
= (regs
->phys_hi
>> 8) & 0xff;
1260 sprintf(tmp_buf
, "%s@%x,%x",
1265 sprintf(tmp_buf
, "%s@%x",
1271 /* "name@UPA_PORTID,offset" */
1272 static void __init
upa_path_component(struct device_node
*dp
, char *tmp_buf
)
1274 struct linux_prom64_registers
*regs
;
1275 struct property
*prop
;
1277 prop
= of_find_property(dp
, "reg", NULL
);
1283 prop
= of_find_property(dp
, "upa-portid", NULL
);
1287 sprintf(tmp_buf
, "%s@%x,%x",
1289 *(u32
*) prop
->value
,
1290 (unsigned int) (regs
->phys_addr
& 0xffffffffUL
));
1294 static void __init
vdev_path_component(struct device_node
*dp
, char *tmp_buf
)
1296 struct property
*prop
;
1299 prop
= of_find_property(dp
, "reg", NULL
);
1305 sprintf(tmp_buf
, "%s@%x", dp
->name
, *regs
);
1308 /* "name@addrhi,addrlo" */
1309 static void __init
ebus_path_component(struct device_node
*dp
, char *tmp_buf
)
1311 struct linux_prom64_registers
*regs
;
1312 struct property
*prop
;
1314 prop
= of_find_property(dp
, "reg", NULL
);
1320 sprintf(tmp_buf
, "%s@%x,%x",
1322 (unsigned int) (regs
->phys_addr
>> 32UL),
1323 (unsigned int) (regs
->phys_addr
& 0xffffffffUL
));
1326 /* "name@bus,addr" */
1327 static void __init
i2c_path_component(struct device_node
*dp
, char *tmp_buf
)
1329 struct property
*prop
;
1332 prop
= of_find_property(dp
, "reg", NULL
);
1338 /* This actually isn't right... should look at the #address-cells
1339 * property of the i2c bus node etc. etc.
1341 sprintf(tmp_buf
, "%s@%x,%x",
1342 dp
->name
, regs
[0], regs
[1]);
1345 /* "name@reg0[,reg1]" */
1346 static void __init
usb_path_component(struct device_node
*dp
, char *tmp_buf
)
1348 struct property
*prop
;
1351 prop
= of_find_property(dp
, "reg", NULL
);
1357 if (prop
->length
== sizeof(u32
) || regs
[1] == 1) {
1358 sprintf(tmp_buf
, "%s@%x",
1361 sprintf(tmp_buf
, "%s@%x,%x",
1362 dp
->name
, regs
[0], regs
[1]);
1366 /* "name@reg0reg1[,reg2reg3]" */
1367 static void __init
ieee1394_path_component(struct device_node
*dp
, char *tmp_buf
)
1369 struct property
*prop
;
1372 prop
= of_find_property(dp
, "reg", NULL
);
1378 if (regs
[2] || regs
[3]) {
1379 sprintf(tmp_buf
, "%s@%08x%08x,%04x%08x",
1380 dp
->name
, regs
[0], regs
[1], regs
[2], regs
[3]);
1382 sprintf(tmp_buf
, "%s@%08x%08x",
1383 dp
->name
, regs
[0], regs
[1]);
1387 static void __init
__build_path_component(struct device_node
*dp
, char *tmp_buf
)
1389 struct device_node
*parent
= dp
->parent
;
1391 if (parent
!= NULL
) {
1392 if (!strcmp(parent
->type
, "pci") ||
1393 !strcmp(parent
->type
, "pciex"))
1394 return pci_path_component(dp
, tmp_buf
);
1395 if (!strcmp(parent
->type
, "sbus"))
1396 return sbus_path_component(dp
, tmp_buf
);
1397 if (!strcmp(parent
->type
, "upa"))
1398 return upa_path_component(dp
, tmp_buf
);
1399 if (!strcmp(parent
->type
, "ebus"))
1400 return ebus_path_component(dp
, tmp_buf
);
1401 if (!strcmp(parent
->name
, "usb") ||
1402 !strcmp(parent
->name
, "hub"))
1403 return usb_path_component(dp
, tmp_buf
);
1404 if (!strcmp(parent
->type
, "i2c"))
1405 return i2c_path_component(dp
, tmp_buf
);
1406 if (!strcmp(parent
->type
, "firewire"))
1407 return ieee1394_path_component(dp
, tmp_buf
);
1408 if (!strcmp(parent
->type
, "virtual-devices"))
1409 return vdev_path_component(dp
, tmp_buf
);
1411 /* "isa" is handled with platform naming */
1414 /* Use platform naming convention. */
1415 if (tlb_type
== hypervisor
)
1416 return sun4v_path_component(dp
, tmp_buf
);
1418 return sun4u_path_component(dp
, tmp_buf
);
1421 static char * __init
build_path_component(struct device_node
*dp
)
1423 char tmp_buf
[64], *n
;
1426 __build_path_component(dp
, tmp_buf
);
1427 if (tmp_buf
[0] == '\0')
1428 strcpy(tmp_buf
, dp
->name
);
1430 n
= prom_early_alloc(strlen(tmp_buf
) + 1);
1436 static char * __init
build_full_name(struct device_node
*dp
)
1438 int len
, ourlen
, plen
;
1441 plen
= strlen(dp
->parent
->full_name
);
1442 ourlen
= strlen(dp
->path_component_name
);
1443 len
= ourlen
+ plen
+ 2;
1445 n
= prom_early_alloc(len
);
1446 strcpy(n
, dp
->parent
->full_name
);
1447 if (!is_root_node(dp
->parent
)) {
1448 strcpy(n
+ plen
, "/");
1451 strcpy(n
+ plen
, dp
->path_component_name
);
1456 static unsigned int unique_id
;
1458 static struct property
* __init
build_one_prop(phandle node
, char *prev
, char *special_name
, void *special_val
, int special_len
)
1460 static struct property
*tmp
= NULL
;
1465 memset(p
, 0, sizeof(*p
) + 32);
1468 p
= prom_early_alloc(sizeof(struct property
) + 32);
1469 p
->unique_id
= unique_id
++;
1472 p
->name
= (char *) (p
+ 1);
1474 strcpy(p
->name
, special_name
);
1475 p
->length
= special_len
;
1476 p
->value
= prom_early_alloc(special_len
);
1477 memcpy(p
->value
, special_val
, special_len
);
1480 prom_firstprop(node
, p
->name
);
1482 prom_nextprop(node
, prev
, p
->name
);
1484 if (strlen(p
->name
) == 0) {
1488 p
->length
= prom_getproplen(node
, p
->name
);
1489 if (p
->length
<= 0) {
1492 p
->value
= prom_early_alloc(p
->length
+ 1);
1493 prom_getproperty(node
, p
->name
, p
->value
, p
->length
);
1494 ((unsigned char *)p
->value
)[p
->length
] = '\0';
1500 static struct property
* __init
build_prop_list(phandle node
)
1502 struct property
*head
, *tail
;
1504 head
= tail
= build_one_prop(node
, NULL
,
1505 ".node", &node
, sizeof(node
));
1507 tail
->next
= build_one_prop(node
, NULL
, NULL
, NULL
, 0);
1510 tail
->next
= build_one_prop(node
, tail
->name
,
1518 static char * __init
get_one_property(phandle node
, const char *name
)
1520 char *buf
= "<NULL>";
1523 len
= prom_getproplen(node
, name
);
1525 buf
= prom_early_alloc(len
);
1526 prom_getproperty(node
, name
, buf
, len
);
1532 static struct device_node
* __init
create_node(phandle node
, struct device_node
*parent
)
1534 struct device_node
*dp
;
1539 dp
= prom_early_alloc(sizeof(*dp
));
1540 dp
->unique_id
= unique_id
++;
1541 dp
->parent
= parent
;
1543 kref_init(&dp
->kref
);
1545 dp
->name
= get_one_property(node
, "name");
1546 dp
->type
= get_one_property(node
, "device_type");
1549 dp
->properties
= build_prop_list(node
);
1556 static struct device_node
* __init
build_tree(struct device_node
*parent
, phandle node
, struct device_node
***nextp
)
1558 struct device_node
*dp
;
1560 dp
= create_node(node
, parent
);
1563 *nextp
= &dp
->allnext
;
1565 dp
->path_component_name
= build_path_component(dp
);
1566 dp
->full_name
= build_full_name(dp
);
1568 dp
->child
= build_tree(dp
, prom_getchild(node
), nextp
);
1570 dp
->sibling
= build_tree(parent
, prom_getsibling(node
), nextp
);
1576 void __init
prom_build_devicetree(void)
1578 struct device_node
**nextp
;
1580 allnodes
= create_node(prom_root_node
, NULL
);
1581 allnodes
->path_component_name
= "";
1582 allnodes
->full_name
= "/";
1584 nextp
= &allnodes
->allnext
;
1585 allnodes
->child
= build_tree(allnodes
,
1586 prom_getchild(allnodes
->node
),
1588 printk("PROM: Built device tree with %u bytes of memory.\n",
1589 prom_early_allocated
);