aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-11-23 20:54:23 -0500
committerGrant Likely <grant.likely@secretlab.ca>2009-11-23 20:54:23 -0500
commitc8cb7a59842c0b512b44f6f818cdb0b5a3ddc89e (patch)
tree74d7b5c8dac3d5167b0394b5967bad52681dc28e /arch/microblaze/kernel
parente169cfbef46d62e042614ffafa8880eed1d894bb (diff)
of/flattree: merge of_scan_flat_dt
Merge common code between PowerPC and Microblaze Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Tested-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel')
-rw-r--r--arch/microblaze/kernel/prom.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 06d620ab4168..0db8ee64ffe6 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -50,67 +50,6 @@ typedef u32 cell_t;
50/* export that to outside world */ 50/* export that to outside world */
51struct device_node *of_chosen; 51struct device_node *of_chosen;
52 52
53/**
54 * This function is used to scan the flattened device-tree, it is
55 * used to extract the memory informations at boot before we can
56 * unflatten the tree
57 */
58int __init of_scan_flat_dt(int (*it)(unsigned long node,
59 const char *uname, int depth,
60 void *data),
61 void *data)
62{
63 unsigned long p = ((unsigned long)initial_boot_params) +
64 initial_boot_params->off_dt_struct;
65 int rc = 0;
66 int depth = -1;
67
68 do {
69 u32 tag = *((u32 *)p);
70 char *pathp;
71
72 p += 4;
73 if (tag == OF_DT_END_NODE) {
74 depth--;
75 continue;
76 }
77 if (tag == OF_DT_NOP)
78 continue;
79 if (tag == OF_DT_END)
80 break;
81 if (tag == OF_DT_PROP) {
82 u32 sz = *((u32 *)p);
83 p += 8;
84 if (initial_boot_params->version < 0x10)
85 p = _ALIGN(p, sz >= 8 ? 8 : 4);
86 p += sz;
87 p = _ALIGN(p, 4);
88 continue;
89 }
90 if (tag != OF_DT_BEGIN_NODE) {
91 printk(KERN_WARNING "Invalid tag %x scanning flattened"
92 " device tree !\n", tag);
93 return -EINVAL;
94 }
95 depth++;
96 pathp = (char *)p;
97 p = _ALIGN(p + strlen(pathp) + 1, 4);
98 if ((*pathp) == '/') {
99 char *lp, *np;
100 for (lp = NULL, np = pathp; *np; np++)
101 if ((*np) == '/')
102 lp = np+1;
103 if (lp != NULL)
104 pathp = lp;
105 }
106 rc = it(p, pathp, depth, data);
107 if (rc != 0)
108 break;
109 } while (1);
110
111 return rc;
112}
113
114unsigned long __init of_get_flat_dt_root(void) 53unsigned long __init of_get_flat_dt_root(void)
115{ 54{
116 unsigned long p = ((unsigned long)initial_boot_params) + 55 unsigned long p = ((unsigned long)initial_boot_params) +