aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
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/powerpc
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/powerpc')
-rw-r--r--arch/powerpc/kernel/prom.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index fccf7e49bb28..14a07b9e00d1 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -80,67 +80,6 @@ extern rwlock_t devtree_lock; /* temporary while merging */
80/* export that to outside world */ 80/* export that to outside world */
81struct device_node *of_chosen; 81struct device_node *of_chosen;
82 82
83/**
84 * This function is used to scan the flattened device-tree, it is
85 * used to extract the memory informations at boot before we can
86 * unflatten the tree
87 */
88int __init of_scan_flat_dt(int (*it)(unsigned long node,
89 const char *uname, int depth,
90 void *data),
91 void *data)
92{
93 unsigned long p = ((unsigned long)initial_boot_params) +
94 initial_boot_params->off_dt_struct;
95 int rc = 0;
96 int depth = -1;
97
98 do {
99 u32 tag = *((u32 *)p);
100 char *pathp;
101
102 p += 4;
103 if (tag == OF_DT_END_NODE) {
104 depth --;
105 continue;
106 }
107 if (tag == OF_DT_NOP)
108 continue;
109 if (tag == OF_DT_END)
110 break;
111 if (tag == OF_DT_PROP) {
112 u32 sz = *((u32 *)p);
113 p += 8;
114 if (initial_boot_params->version < 0x10)
115 p = _ALIGN(p, sz >= 8 ? 8 : 4);
116 p += sz;
117 p = _ALIGN(p, 4);
118 continue;
119 }
120 if (tag != OF_DT_BEGIN_NODE) {
121 printk(KERN_WARNING "Invalid tag %x scanning flattened"
122 " device tree !\n", tag);
123 return -EINVAL;
124 }
125 depth++;
126 pathp = (char *)p;
127 p = _ALIGN(p + strlen(pathp) + 1, 4);
128 if ((*pathp) == '/') {
129 char *lp, *np;
130 for (lp = NULL, np = pathp; *np; np++)
131 if ((*np) == '/')
132 lp = np+1;
133 if (lp != NULL)
134 pathp = lp;
135 }
136 rc = it(p, pathp, depth, data);
137 if (rc != 0)
138 break;
139 } while(1);
140
141 return rc;
142}
143
144unsigned long __init of_get_flat_dt_root(void) 83unsigned long __init of_get_flat_dt_root(void)
145{ 84{
146 unsigned long p = ((unsigned long)initial_boot_params) + 85 unsigned long p = ((unsigned long)initial_boot_params) +