diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-02-25 22:41:00 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-02-25 22:41:00 -0500 |
commit | 874f2f997dbe041a6c6e509dae8656ed9022d65d (patch) | |
tree | 61898165882041ef7f9beaf2ef6663a1a4d3c29a /arch/powerpc | |
parent | 071c06cb570d38efe23a124e885f2f3e643a9206 (diff) | |
parent | 6ebdc661b608671e9ca572af8bb42d58108cc008 (diff) |
Merge commit 'origin/master' into next
Manual merge of:
drivers/char/hvc_console.c
drivers/char/hvc_console.h
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/prom.h | 18 | ||||
-rw-r--r-- | arch/powerpc/kernel/of_platform.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 887 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_mds.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/xes_mpc85xx.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/cbe_powerbutton.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/ras.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_manage.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/pasemi/cpufreq.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/cpufreq_32.c | 14 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/cpufreq_64.c | 14 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/feature.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/pfunc_core.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/smp.c | 12 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/time.c | 8 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/udbg_scc.c | 6 | ||||
-rw-r--r-- | arch/powerpc/sysdev/grackle.c | 4 |
19 files changed, 94 insertions, 899 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 654bba5cf6b4..155d571f5e26 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -173,6 +173,7 @@ config PPC_OF | |||
173 | 173 | ||
174 | config OF | 174 | config OF |
175 | def_bool y | 175 | def_bool y |
176 | select OF_FLATTREE | ||
176 | 177 | ||
177 | config PPC_UDBG_16550 | 178 | config PPC_UDBG_16550 |
178 | bool | 179 | bool |
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index 2ab9cbd98826..ddd408a93b5a 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h | |||
@@ -23,21 +23,8 @@ | |||
23 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
24 | #include <asm/atomic.h> | 24 | #include <asm/atomic.h> |
25 | 25 | ||
26 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1 | ||
27 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 | ||
28 | |||
29 | #define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2)) | ||
30 | #define of_prop_cmp(s1, s2) strcmp((s1), (s2)) | ||
31 | #define of_node_cmp(s1, s2) strcasecmp((s1), (s2)) | ||
32 | |||
33 | extern struct device_node *of_chosen; | ||
34 | |||
35 | #define HAVE_ARCH_DEVTREE_FIXUPS | 26 | #define HAVE_ARCH_DEVTREE_FIXUPS |
36 | 27 | ||
37 | /* For updating the device tree at runtime */ | ||
38 | extern void of_attach_node(struct device_node *); | ||
39 | extern void of_detach_node(struct device_node *); | ||
40 | |||
41 | #ifdef CONFIG_PPC32 | 28 | #ifdef CONFIG_PPC32 |
42 | /* | 29 | /* |
43 | * PCI <-> OF matching functions | 30 | * PCI <-> OF matching functions |
@@ -52,11 +39,6 @@ extern struct device_node* pci_device_to_OF_node(struct pci_dev *); | |||
52 | extern void pci_create_OF_bus_map(void); | 39 | extern void pci_create_OF_bus_map(void); |
53 | #endif | 40 | #endif |
54 | 41 | ||
55 | extern struct resource *request_OF_resource(struct device_node* node, | ||
56 | int index, const char* name_postfix); | ||
57 | extern int release_OF_resource(struct device_node* node, int index); | ||
58 | |||
59 | |||
60 | /* | 42 | /* |
61 | * OF address retreival & translation | 43 | * OF address retreival & translation |
62 | */ | 44 | */ |
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 1a4fc0d11a03..666d08db319e 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c | |||
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(of_find_device_by_node); | |||
214 | static int of_dev_phandle_match(struct device *dev, void *data) | 214 | static int of_dev_phandle_match(struct device *dev, void *data) |
215 | { | 215 | { |
216 | phandle *ph = data; | 216 | phandle *ph = data; |
217 | return to_of_device(dev)->node->linux_phandle == *ph; | 217 | return to_of_device(dev)->node->phandle == *ph; |
218 | } | 218 | } |
219 | 219 | ||
220 | struct of_device *of_find_device_by_phandle(phandle ph) | 220 | struct of_device *of_find_device_by_phandle(phandle ph) |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index ccf56ac92de5..d43fc65749c1 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -224,7 +224,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, | |||
224 | * G5 machines... So when something asks for bus 0 io base | 224 | * G5 machines... So when something asks for bus 0 io base |
225 | * (bus 0 is HT root), we return the AGP one instead. | 225 | * (bus 0 is HT root), we return the AGP one instead. |
226 | */ | 226 | */ |
227 | if (in_bus == 0 && machine_is_compatible("MacRISC4")) { | 227 | if (in_bus == 0 && of_machine_is_compatible("MacRISC4")) { |
228 | struct device_node *agp; | 228 | struct device_node *agp; |
229 | 229 | ||
230 | agp = of_find_compatible_node(NULL, NULL, "u3-agp"); | 230 | agp = of_find_compatible_node(NULL, NULL, "u3-agp"); |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 4ec300862466..43238b2054b6 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -61,365 +61,12 @@ | |||
61 | #define DBG(fmt...) | 61 | #define DBG(fmt...) |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | |||
65 | static int __initdata dt_root_addr_cells; | ||
66 | static int __initdata dt_root_size_cells; | ||
67 | |||
68 | #ifdef CONFIG_PPC64 | 64 | #ifdef CONFIG_PPC64 |
69 | int __initdata iommu_is_off; | 65 | int __initdata iommu_is_off; |
70 | int __initdata iommu_force_on; | 66 | int __initdata iommu_force_on; |
71 | unsigned long tce_alloc_start, tce_alloc_end; | 67 | unsigned long tce_alloc_start, tce_alloc_end; |
72 | #endif | 68 | #endif |
73 | 69 | ||
74 | typedef u32 cell_t; | ||
75 | |||
76 | #if 0 | ||
77 | static struct boot_param_header *initial_boot_params __initdata; | ||
78 | #else | ||
79 | struct boot_param_header *initial_boot_params; | ||
80 | #endif | ||
81 | |||
82 | extern struct device_node *allnodes; /* temporary while merging */ | ||
83 | |||
84 | extern rwlock_t devtree_lock; /* temporary while merging */ | ||
85 | |||
86 | /* export that to outside world */ | ||
87 | struct device_node *of_chosen; | ||
88 | |||
89 | static inline char *find_flat_dt_string(u32 offset) | ||
90 | { | ||
91 | return ((char *)initial_boot_params) + | ||
92 | initial_boot_params->off_dt_strings + offset; | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * This function is used to scan the flattened device-tree, it is | ||
97 | * used to extract the memory informations at boot before we can | ||
98 | * unflatten the tree | ||
99 | */ | ||
100 | int __init of_scan_flat_dt(int (*it)(unsigned long node, | ||
101 | const char *uname, int depth, | ||
102 | void *data), | ||
103 | void *data) | ||
104 | { | ||
105 | unsigned long p = ((unsigned long)initial_boot_params) + | ||
106 | initial_boot_params->off_dt_struct; | ||
107 | int rc = 0; | ||
108 | int depth = -1; | ||
109 | |||
110 | do { | ||
111 | u32 tag = *((u32 *)p); | ||
112 | char *pathp; | ||
113 | |||
114 | p += 4; | ||
115 | if (tag == OF_DT_END_NODE) { | ||
116 | depth --; | ||
117 | continue; | ||
118 | } | ||
119 | if (tag == OF_DT_NOP) | ||
120 | continue; | ||
121 | if (tag == OF_DT_END) | ||
122 | break; | ||
123 | if (tag == OF_DT_PROP) { | ||
124 | u32 sz = *((u32 *)p); | ||
125 | p += 8; | ||
126 | if (initial_boot_params->version < 0x10) | ||
127 | p = _ALIGN(p, sz >= 8 ? 8 : 4); | ||
128 | p += sz; | ||
129 | p = _ALIGN(p, 4); | ||
130 | continue; | ||
131 | } | ||
132 | if (tag != OF_DT_BEGIN_NODE) { | ||
133 | printk(KERN_WARNING "Invalid tag %x scanning flattened" | ||
134 | " device tree !\n", tag); | ||
135 | return -EINVAL; | ||
136 | } | ||
137 | depth++; | ||
138 | pathp = (char *)p; | ||
139 | p = _ALIGN(p + strlen(pathp) + 1, 4); | ||
140 | if ((*pathp) == '/') { | ||
141 | char *lp, *np; | ||
142 | for (lp = NULL, np = pathp; *np; np++) | ||
143 | if ((*np) == '/') | ||
144 | lp = np+1; | ||
145 | if (lp != NULL) | ||
146 | pathp = lp; | ||
147 | } | ||
148 | rc = it(p, pathp, depth, data); | ||
149 | if (rc != 0) | ||
150 | break; | ||
151 | } while(1); | ||
152 | |||
153 | return rc; | ||
154 | } | ||
155 | |||
156 | unsigned long __init of_get_flat_dt_root(void) | ||
157 | { | ||
158 | unsigned long p = ((unsigned long)initial_boot_params) + | ||
159 | initial_boot_params->off_dt_struct; | ||
160 | |||
161 | while(*((u32 *)p) == OF_DT_NOP) | ||
162 | p += 4; | ||
163 | BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE); | ||
164 | p += 4; | ||
165 | return _ALIGN(p + strlen((char *)p) + 1, 4); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * This function can be used within scan_flattened_dt callback to get | ||
170 | * access to properties | ||
171 | */ | ||
172 | void* __init of_get_flat_dt_prop(unsigned long node, const char *name, | ||
173 | unsigned long *size) | ||
174 | { | ||
175 | unsigned long p = node; | ||
176 | |||
177 | do { | ||
178 | u32 tag = *((u32 *)p); | ||
179 | u32 sz, noff; | ||
180 | const char *nstr; | ||
181 | |||
182 | p += 4; | ||
183 | if (tag == OF_DT_NOP) | ||
184 | continue; | ||
185 | if (tag != OF_DT_PROP) | ||
186 | return NULL; | ||
187 | |||
188 | sz = *((u32 *)p); | ||
189 | noff = *((u32 *)(p + 4)); | ||
190 | p += 8; | ||
191 | if (initial_boot_params->version < 0x10) | ||
192 | p = _ALIGN(p, sz >= 8 ? 8 : 4); | ||
193 | |||
194 | nstr = find_flat_dt_string(noff); | ||
195 | if (nstr == NULL) { | ||
196 | printk(KERN_WARNING "Can't find property index" | ||
197 | " name !\n"); | ||
198 | return NULL; | ||
199 | } | ||
200 | if (strcmp(name, nstr) == 0) { | ||
201 | if (size) | ||
202 | *size = sz; | ||
203 | return (void *)p; | ||
204 | } | ||
205 | p += sz; | ||
206 | p = _ALIGN(p, 4); | ||
207 | } while(1); | ||
208 | } | ||
209 | |||
210 | int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | ||
211 | { | ||
212 | const char* cp; | ||
213 | unsigned long cplen, l; | ||
214 | |||
215 | cp = of_get_flat_dt_prop(node, "compatible", &cplen); | ||
216 | if (cp == NULL) | ||
217 | return 0; | ||
218 | while (cplen > 0) { | ||
219 | if (strncasecmp(cp, compat, strlen(compat)) == 0) | ||
220 | return 1; | ||
221 | l = strlen(cp) + 1; | ||
222 | cp += l; | ||
223 | cplen -= l; | ||
224 | } | ||
225 | |||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, | ||
230 | unsigned long align) | ||
231 | { | ||
232 | void *res; | ||
233 | |||
234 | *mem = _ALIGN(*mem, align); | ||
235 | res = (void *)*mem; | ||
236 | *mem += size; | ||
237 | |||
238 | return res; | ||
239 | } | ||
240 | |||
241 | static unsigned long __init unflatten_dt_node(unsigned long mem, | ||
242 | unsigned long *p, | ||
243 | struct device_node *dad, | ||
244 | struct device_node ***allnextpp, | ||
245 | unsigned long fpsize) | ||
246 | { | ||
247 | struct device_node *np; | ||
248 | struct property *pp, **prev_pp = NULL; | ||
249 | char *pathp; | ||
250 | u32 tag; | ||
251 | unsigned int l, allocl; | ||
252 | int has_name = 0; | ||
253 | int new_format = 0; | ||
254 | |||
255 | tag = *((u32 *)(*p)); | ||
256 | if (tag != OF_DT_BEGIN_NODE) { | ||
257 | printk("Weird tag at start of node: %x\n", tag); | ||
258 | return mem; | ||
259 | } | ||
260 | *p += 4; | ||
261 | pathp = (char *)*p; | ||
262 | l = allocl = strlen(pathp) + 1; | ||
263 | *p = _ALIGN(*p + l, 4); | ||
264 | |||
265 | /* version 0x10 has a more compact unit name here instead of the full | ||
266 | * path. we accumulate the full path size using "fpsize", we'll rebuild | ||
267 | * it later. We detect this because the first character of the name is | ||
268 | * not '/'. | ||
269 | */ | ||
270 | if ((*pathp) != '/') { | ||
271 | new_format = 1; | ||
272 | if (fpsize == 0) { | ||
273 | /* root node: special case. fpsize accounts for path | ||
274 | * plus terminating zero. root node only has '/', so | ||
275 | * fpsize should be 2, but we want to avoid the first | ||
276 | * level nodes to have two '/' so we use fpsize 1 here | ||
277 | */ | ||
278 | fpsize = 1; | ||
279 | allocl = 2; | ||
280 | } else { | ||
281 | /* account for '/' and path size minus terminal 0 | ||
282 | * already in 'l' | ||
283 | */ | ||
284 | fpsize += l; | ||
285 | allocl = fpsize; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | |||
290 | np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl, | ||
291 | __alignof__(struct device_node)); | ||
292 | if (allnextpp) { | ||
293 | memset(np, 0, sizeof(*np)); | ||
294 | np->full_name = ((char*)np) + sizeof(struct device_node); | ||
295 | if (new_format) { | ||
296 | char *p = np->full_name; | ||
297 | /* rebuild full path for new format */ | ||
298 | if (dad && dad->parent) { | ||
299 | strcpy(p, dad->full_name); | ||
300 | #ifdef DEBUG | ||
301 | if ((strlen(p) + l + 1) != allocl) { | ||
302 | DBG("%s: p: %d, l: %d, a: %d\n", | ||
303 | pathp, (int)strlen(p), l, allocl); | ||
304 | } | ||
305 | #endif | ||
306 | p += strlen(p); | ||
307 | } | ||
308 | *(p++) = '/'; | ||
309 | memcpy(p, pathp, l); | ||
310 | } else | ||
311 | memcpy(np->full_name, pathp, l); | ||
312 | prev_pp = &np->properties; | ||
313 | **allnextpp = np; | ||
314 | *allnextpp = &np->allnext; | ||
315 | if (dad != NULL) { | ||
316 | np->parent = dad; | ||
317 | /* we temporarily use the next field as `last_child'*/ | ||
318 | if (dad->next == 0) | ||
319 | dad->child = np; | ||
320 | else | ||
321 | dad->next->sibling = np; | ||
322 | dad->next = np; | ||
323 | } | ||
324 | kref_init(&np->kref); | ||
325 | } | ||
326 | while(1) { | ||
327 | u32 sz, noff; | ||
328 | char *pname; | ||
329 | |||
330 | tag = *((u32 *)(*p)); | ||
331 | if (tag == OF_DT_NOP) { | ||
332 | *p += 4; | ||
333 | continue; | ||
334 | } | ||
335 | if (tag != OF_DT_PROP) | ||
336 | break; | ||
337 | *p += 4; | ||
338 | sz = *((u32 *)(*p)); | ||
339 | noff = *((u32 *)((*p) + 4)); | ||
340 | *p += 8; | ||
341 | if (initial_boot_params->version < 0x10) | ||
342 | *p = _ALIGN(*p, sz >= 8 ? 8 : 4); | ||
343 | |||
344 | pname = find_flat_dt_string(noff); | ||
345 | if (pname == NULL) { | ||
346 | printk("Can't find property name in list !\n"); | ||
347 | break; | ||
348 | } | ||
349 | if (strcmp(pname, "name") == 0) | ||
350 | has_name = 1; | ||
351 | l = strlen(pname) + 1; | ||
352 | pp = unflatten_dt_alloc(&mem, sizeof(struct property), | ||
353 | __alignof__(struct property)); | ||
354 | if (allnextpp) { | ||
355 | if (strcmp(pname, "linux,phandle") == 0) { | ||
356 | np->node = *((u32 *)*p); | ||
357 | if (np->linux_phandle == 0) | ||
358 | np->linux_phandle = np->node; | ||
359 | } | ||
360 | if (strcmp(pname, "ibm,phandle") == 0) | ||
361 | np->linux_phandle = *((u32 *)*p); | ||
362 | pp->name = pname; | ||
363 | pp->length = sz; | ||
364 | pp->value = (void *)*p; | ||
365 | *prev_pp = pp; | ||
366 | prev_pp = &pp->next; | ||
367 | } | ||
368 | *p = _ALIGN((*p) + sz, 4); | ||
369 | } | ||
370 | /* with version 0x10 we may not have the name property, recreate | ||
371 | * it here from the unit name if absent | ||
372 | */ | ||
373 | if (!has_name) { | ||
374 | char *p = pathp, *ps = pathp, *pa = NULL; | ||
375 | int sz; | ||
376 | |||
377 | while (*p) { | ||
378 | if ((*p) == '@') | ||
379 | pa = p; | ||
380 | if ((*p) == '/') | ||
381 | ps = p + 1; | ||
382 | p++; | ||
383 | } | ||
384 | if (pa < ps) | ||
385 | pa = p; | ||
386 | sz = (pa - ps) + 1; | ||
387 | pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz, | ||
388 | __alignof__(struct property)); | ||
389 | if (allnextpp) { | ||
390 | pp->name = "name"; | ||
391 | pp->length = sz; | ||
392 | pp->value = pp + 1; | ||
393 | *prev_pp = pp; | ||
394 | prev_pp = &pp->next; | ||
395 | memcpy(pp->value, ps, sz - 1); | ||
396 | ((char *)pp->value)[sz - 1] = 0; | ||
397 | DBG("fixed up name for %s -> %s\n", pathp, | ||
398 | (char *)pp->value); | ||
399 | } | ||
400 | } | ||
401 | if (allnextpp) { | ||
402 | *prev_pp = NULL; | ||
403 | np->name = of_get_property(np, "name", NULL); | ||
404 | np->type = of_get_property(np, "device_type", NULL); | ||
405 | |||
406 | if (!np->name) | ||
407 | np->name = "<NULL>"; | ||
408 | if (!np->type) | ||
409 | np->type = "<NULL>"; | ||
410 | } | ||
411 | while (tag == OF_DT_BEGIN_NODE) { | ||
412 | mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); | ||
413 | tag = *((u32 *)(*p)); | ||
414 | } | ||
415 | if (tag != OF_DT_END_NODE) { | ||
416 | printk("Weird tag at end of node: %x\n", tag); | ||
417 | return mem; | ||
418 | } | ||
419 | *p += 4; | ||
420 | return mem; | ||
421 | } | ||
422 | |||
423 | static int __init early_parse_mem(char *p) | 70 | static int __init early_parse_mem(char *p) |
424 | { | 71 | { |
425 | if (!p) | 72 | if (!p) |
@@ -446,7 +93,7 @@ static void __init move_device_tree(void) | |||
446 | DBG("-> move_device_tree\n"); | 93 | DBG("-> move_device_tree\n"); |
447 | 94 | ||
448 | start = __pa(initial_boot_params); | 95 | start = __pa(initial_boot_params); |
449 | size = initial_boot_params->totalsize; | 96 | size = be32_to_cpu(initial_boot_params->totalsize); |
450 | 97 | ||
451 | if ((memory_limit && (start + size) > memory_limit) || | 98 | if ((memory_limit && (start + size) > memory_limit) || |
452 | overlaps_crashkernel(start, size)) { | 99 | overlaps_crashkernel(start, size)) { |
@@ -459,54 +106,6 @@ static void __init move_device_tree(void) | |||
459 | DBG("<- move_device_tree\n"); | 106 | DBG("<- move_device_tree\n"); |
460 | } | 107 | } |
461 | 108 | ||
462 | /** | ||
463 | * unflattens the device-tree passed by the firmware, creating the | ||
464 | * tree of struct device_node. It also fills the "name" and "type" | ||
465 | * pointers of the nodes so the normal device-tree walking functions | ||
466 | * can be used (this used to be done by finish_device_tree) | ||
467 | */ | ||
468 | void __init unflatten_device_tree(void) | ||
469 | { | ||
470 | unsigned long start, mem, size; | ||
471 | struct device_node **allnextp = &allnodes; | ||
472 | |||
473 | DBG(" -> unflatten_device_tree()\n"); | ||
474 | |||
475 | /* First pass, scan for size */ | ||
476 | start = ((unsigned long)initial_boot_params) + | ||
477 | initial_boot_params->off_dt_struct; | ||
478 | size = unflatten_dt_node(0, &start, NULL, NULL, 0); | ||
479 | size = (size | 3) + 1; | ||
480 | |||
481 | DBG(" size is %lx, allocating...\n", size); | ||
482 | |||
483 | /* Allocate memory for the expanded device tree */ | ||
484 | mem = lmb_alloc(size + 4, __alignof__(struct device_node)); | ||
485 | mem = (unsigned long) __va(mem); | ||
486 | |||
487 | ((u32 *)mem)[size / 4] = 0xdeadbeef; | ||
488 | |||
489 | DBG(" unflattening %lx...\n", mem); | ||
490 | |||
491 | /* Second pass, do actual unflattening */ | ||
492 | start = ((unsigned long)initial_boot_params) + | ||
493 | initial_boot_params->off_dt_struct; | ||
494 | unflatten_dt_node(mem, &start, NULL, &allnextp, 0); | ||
495 | if (*((u32 *)start) != OF_DT_END) | ||
496 | printk(KERN_WARNING "Weird tag at end of tree: %08x\n", *((u32 *)start)); | ||
497 | if (((u32 *)mem)[size / 4] != 0xdeadbeef) | ||
498 | printk(KERN_WARNING "End of tree marker overwritten: %08x\n", | ||
499 | ((u32 *)mem)[size / 4] ); | ||
500 | *allnextp = NULL; | ||
501 | |||
502 | /* Get pointer to OF "/chosen" node for use everywhere */ | ||
503 | of_chosen = of_find_node_by_path("/chosen"); | ||
504 | if (of_chosen == NULL) | ||
505 | of_chosen = of_find_node_by_path("/chosen@0"); | ||
506 | |||
507 | DBG(" <- unflatten_device_tree()\n"); | ||
508 | } | ||
509 | |||
510 | /* | 109 | /* |
511 | * ibm,pa-features is a per-cpu property that contains a string of | 110 | * ibm,pa-features is a per-cpu property that contains a string of |
512 | * attribute descriptors, each of which has a 2 byte header plus up | 111 | * attribute descriptors, each of which has a 2 byte header plus up |
@@ -763,48 +362,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node, | |||
763 | return 0; | 362 | return 0; |
764 | } | 363 | } |
765 | 364 | ||
766 | #ifdef CONFIG_BLK_DEV_INITRD | 365 | void __init early_init_dt_scan_chosen_arch(unsigned long node) |
767 | static void __init early_init_dt_check_for_initrd(unsigned long node) | ||
768 | { | ||
769 | unsigned long l; | ||
770 | u32 *prop; | ||
771 | |||
772 | DBG("Looking for initrd properties... "); | ||
773 | |||
774 | prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l); | ||
775 | if (prop) { | ||
776 | initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4)); | ||
777 | |||
778 | prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l); | ||
779 | if (prop) { | ||
780 | initrd_end = (unsigned long) | ||
781 | __va(of_read_ulong(prop, l/4)); | ||
782 | initrd_below_start_ok = 1; | ||
783 | } else { | ||
784 | initrd_start = 0; | ||
785 | } | ||
786 | } | ||
787 | |||
788 | DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end); | ||
789 | } | ||
790 | #else | ||
791 | static inline void early_init_dt_check_for_initrd(unsigned long node) | ||
792 | { | ||
793 | } | ||
794 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
795 | |||
796 | static int __init early_init_dt_scan_chosen(unsigned long node, | ||
797 | const char *uname, int depth, void *data) | ||
798 | { | 366 | { |
799 | unsigned long *lprop; | 367 | unsigned long *lprop; |
800 | unsigned long l; | ||
801 | char *p; | ||
802 | |||
803 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); | ||
804 | |||
805 | if (depth != 1 || | ||
806 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) | ||
807 | return 0; | ||
808 | 368 | ||
809 | #ifdef CONFIG_PPC64 | 369 | #ifdef CONFIG_PPC64 |
810 | /* check if iommu is forced on or off */ | 370 | /* check if iommu is forced on or off */ |
@@ -815,17 +375,17 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
815 | #endif | 375 | #endif |
816 | 376 | ||
817 | /* mem=x on the command line is the preferred mechanism */ | 377 | /* mem=x on the command line is the preferred mechanism */ |
818 | lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL); | 378 | lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL); |
819 | if (lprop) | 379 | if (lprop) |
820 | memory_limit = *lprop; | 380 | memory_limit = *lprop; |
821 | 381 | ||
822 | #ifdef CONFIG_PPC64 | 382 | #ifdef CONFIG_PPC64 |
823 | lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL); | 383 | lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL); |
824 | if (lprop) | 384 | if (lprop) |
825 | tce_alloc_start = *lprop; | 385 | tce_alloc_start = *lprop; |
826 | lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL); | 386 | lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL); |
827 | if (lprop) | 387 | if (lprop) |
828 | tce_alloc_end = *lprop; | 388 | tce_alloc_end = *lprop; |
829 | #endif | 389 | #endif |
830 | 390 | ||
831 | #ifdef CONFIG_KEXEC | 391 | #ifdef CONFIG_KEXEC |
@@ -837,51 +397,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
837 | if (lprop) | 397 | if (lprop) |
838 | crashk_res.end = crashk_res.start + *lprop - 1; | 398 | crashk_res.end = crashk_res.start + *lprop - 1; |
839 | #endif | 399 | #endif |
840 | |||
841 | early_init_dt_check_for_initrd(node); | ||
842 | |||
843 | /* Retreive command line */ | ||
844 | p = of_get_flat_dt_prop(node, "bootargs", &l); | ||
845 | if (p != NULL && l > 0) | ||
846 | strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); | ||
847 | |||
848 | #ifdef CONFIG_CMDLINE | ||
849 | if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) | ||
850 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
851 | #endif /* CONFIG_CMDLINE */ | ||
852 | |||
853 | DBG("Command line is: %s\n", cmd_line); | ||
854 | |||
855 | /* break now */ | ||
856 | return 1; | ||
857 | } | ||
858 | |||
859 | static int __init early_init_dt_scan_root(unsigned long node, | ||
860 | const char *uname, int depth, void *data) | ||
861 | { | ||
862 | u32 *prop; | ||
863 | |||
864 | if (depth != 0) | ||
865 | return 0; | ||
866 | |||
867 | prop = of_get_flat_dt_prop(node, "#size-cells", NULL); | ||
868 | dt_root_size_cells = (prop == NULL) ? 1 : *prop; | ||
869 | DBG("dt_root_size_cells = %x\n", dt_root_size_cells); | ||
870 | |||
871 | prop = of_get_flat_dt_prop(node, "#address-cells", NULL); | ||
872 | dt_root_addr_cells = (prop == NULL) ? 2 : *prop; | ||
873 | DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells); | ||
874 | |||
875 | /* break now */ | ||
876 | return 1; | ||
877 | } | ||
878 | |||
879 | static u64 __init dt_mem_next_cell(int s, cell_t **cellp) | ||
880 | { | ||
881 | cell_t *p = *cellp; | ||
882 | |||
883 | *cellp = p + s; | ||
884 | return of_read_number(p, s); | ||
885 | } | 400 | } |
886 | 401 | ||
887 | #ifdef CONFIG_PPC_PSERIES | 402 | #ifdef CONFIG_PPC_PSERIES |
@@ -893,22 +408,22 @@ static u64 __init dt_mem_next_cell(int s, cell_t **cellp) | |||
893 | */ | 408 | */ |
894 | static int __init early_init_dt_scan_drconf_memory(unsigned long node) | 409 | static int __init early_init_dt_scan_drconf_memory(unsigned long node) |
895 | { | 410 | { |
896 | cell_t *dm, *ls, *usm; | 411 | __be32 *dm, *ls, *usm; |
897 | unsigned long l, n, flags; | 412 | unsigned long l, n, flags; |
898 | u64 base, size, lmb_size; | 413 | u64 base, size, lmb_size; |
899 | unsigned int is_kexec_kdump = 0, rngs; | 414 | unsigned int is_kexec_kdump = 0, rngs; |
900 | 415 | ||
901 | ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l); | 416 | ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l); |
902 | if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t)) | 417 | if (ls == NULL || l < dt_root_size_cells * sizeof(__be32)) |
903 | return 0; | 418 | return 0; |
904 | lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls); | 419 | lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls); |
905 | 420 | ||
906 | dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l); | 421 | dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l); |
907 | if (dm == NULL || l < sizeof(cell_t)) | 422 | if (dm == NULL || l < sizeof(__be32)) |
908 | return 0; | 423 | return 0; |
909 | 424 | ||
910 | n = *dm++; /* number of entries */ | 425 | n = *dm++; /* number of entries */ |
911 | if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t)) | 426 | if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(__be32)) |
912 | return 0; | 427 | return 0; |
913 | 428 | ||
914 | /* check if this is a kexec/kdump kernel. */ | 429 | /* check if this is a kexec/kdump kernel. */ |
@@ -963,65 +478,47 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node) | |||
963 | #define early_init_dt_scan_drconf_memory(node) 0 | 478 | #define early_init_dt_scan_drconf_memory(node) 0 |
964 | #endif /* CONFIG_PPC_PSERIES */ | 479 | #endif /* CONFIG_PPC_PSERIES */ |
965 | 480 | ||
966 | static int __init early_init_dt_scan_memory(unsigned long node, | 481 | static int __init early_init_dt_scan_memory_ppc(unsigned long node, |
967 | const char *uname, int depth, void *data) | 482 | const char *uname, |
483 | int depth, void *data) | ||
968 | { | 484 | { |
969 | char *type = of_get_flat_dt_prop(node, "device_type", NULL); | ||
970 | cell_t *reg, *endp; | ||
971 | unsigned long l; | ||
972 | |||
973 | /* Look for the ibm,dynamic-reconfiguration-memory node */ | ||
974 | if (depth == 1 && | 485 | if (depth == 1 && |
975 | strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) | 486 | strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) |
976 | return early_init_dt_scan_drconf_memory(node); | 487 | return early_init_dt_scan_drconf_memory(node); |
488 | |||
489 | return early_init_dt_scan_memory(node, uname, depth, data); | ||
490 | } | ||
977 | 491 | ||
978 | /* We are scanning "memory" nodes only */ | 492 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) |
979 | if (type == NULL) { | 493 | { |
980 | /* | 494 | #if defined(CONFIG_PPC64) |
981 | * The longtrail doesn't have a device_type on the | 495 | if (iommu_is_off) { |
982 | * /memory node, so look for the node called /memory@0. | 496 | if (base >= 0x80000000ul) |
983 | */ | 497 | return; |
984 | if (depth != 1 || strcmp(uname, "memory@0") != 0) | 498 | if ((base + size) > 0x80000000ul) |
985 | return 0; | 499 | size = 0x80000000ul - base; |
986 | } else if (strcmp(type, "memory") != 0) | 500 | } |
987 | return 0; | 501 | #endif |
988 | |||
989 | reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l); | ||
990 | if (reg == NULL) | ||
991 | reg = of_get_flat_dt_prop(node, "reg", &l); | ||
992 | if (reg == NULL) | ||
993 | return 0; | ||
994 | |||
995 | endp = reg + (l / sizeof(cell_t)); | ||
996 | |||
997 | DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n", | ||
998 | uname, l, reg[0], reg[1], reg[2], reg[3]); | ||
999 | |||
1000 | while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { | ||
1001 | u64 base, size; | ||
1002 | 502 | ||
1003 | base = dt_mem_next_cell(dt_root_addr_cells, ®); | 503 | lmb_add(base, size); |
1004 | size = dt_mem_next_cell(dt_root_size_cells, ®); | ||
1005 | 504 | ||
1006 | if (size == 0) | 505 | memstart_addr = min((u64)memstart_addr, base); |
1007 | continue; | 506 | } |
1008 | DBG(" - %llx , %llx\n", (unsigned long long)base, | ||
1009 | (unsigned long long)size); | ||
1010 | #ifdef CONFIG_PPC64 | ||
1011 | if (iommu_is_off) { | ||
1012 | if (base >= 0x80000000ul) | ||
1013 | continue; | ||
1014 | if ((base + size) > 0x80000000ul) | ||
1015 | size = 0x80000000ul - base; | ||
1016 | } | ||
1017 | #endif | ||
1018 | lmb_add(base, size); | ||
1019 | 507 | ||
1020 | memstart_addr = min((u64)memstart_addr, base); | 508 | u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) |
1021 | } | 509 | { |
510 | return lmb_alloc(size, align); | ||
511 | } | ||
1022 | 512 | ||
1023 | return 0; | 513 | #ifdef CONFIG_BLK_DEV_INITRD |
514 | void __init early_init_dt_setup_initrd_arch(unsigned long start, | ||
515 | unsigned long end) | ||
516 | { | ||
517 | initrd_start = (unsigned long)__va(start); | ||
518 | initrd_end = (unsigned long)__va(end); | ||
519 | initrd_below_start_ok = 1; | ||
1024 | } | 520 | } |
521 | #endif | ||
1025 | 522 | ||
1026 | static void __init early_reserve_mem(void) | 523 | static void __init early_reserve_mem(void) |
1027 | { | 524 | { |
@@ -1186,7 +683,7 @@ void __init early_init_devtree(void *params) | |||
1186 | /* Scan memory nodes and rebuild LMBs */ | 683 | /* Scan memory nodes and rebuild LMBs */ |
1187 | lmb_init(); | 684 | lmb_init(); |
1188 | of_scan_flat_dt(early_init_dt_scan_root, NULL); | 685 | of_scan_flat_dt(early_init_dt_scan_root, NULL); |
1189 | of_scan_flat_dt(early_init_dt_scan_memory, NULL); | 686 | of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); |
1190 | 687 | ||
1191 | /* Save command line for /proc/cmdline and then parse parameters */ | 688 | /* Save command line for /proc/cmdline and then parse parameters */ |
1192 | strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); | 689 | strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); |
@@ -1234,25 +731,6 @@ void __init early_init_devtree(void *params) | |||
1234 | DBG(" <- early_init_devtree()\n"); | 731 | DBG(" <- early_init_devtree()\n"); |
1235 | } | 732 | } |
1236 | 733 | ||
1237 | |||
1238 | /** | ||
1239 | * Indicates whether the root node has a given value in its | ||
1240 | * compatible property. | ||
1241 | */ | ||
1242 | int machine_is_compatible(const char *compat) | ||
1243 | { | ||
1244 | struct device_node *root; | ||
1245 | int rc = 0; | ||
1246 | |||
1247 | root = of_find_node_by_path("/"); | ||
1248 | if (root) { | ||
1249 | rc = of_device_is_compatible(root, compat); | ||
1250 | of_node_put(root); | ||
1251 | } | ||
1252 | return rc; | ||
1253 | } | ||
1254 | EXPORT_SYMBOL(machine_is_compatible); | ||
1255 | |||
1256 | /******* | 734 | /******* |
1257 | * | 735 | * |
1258 | * New implementation of the OF "find" APIs, return a refcounted | 736 | * New implementation of the OF "find" APIs, return a refcounted |
@@ -1265,27 +743,6 @@ EXPORT_SYMBOL(machine_is_compatible); | |||
1265 | *******/ | 743 | *******/ |
1266 | 744 | ||
1267 | /** | 745 | /** |
1268 | * of_find_node_by_phandle - Find a node given a phandle | ||
1269 | * @handle: phandle of the node to find | ||
1270 | * | ||
1271 | * Returns a node pointer with refcount incremented, use | ||
1272 | * of_node_put() on it when done. | ||
1273 | */ | ||
1274 | struct device_node *of_find_node_by_phandle(phandle handle) | ||
1275 | { | ||
1276 | struct device_node *np; | ||
1277 | |||
1278 | read_lock(&devtree_lock); | ||
1279 | for (np = allnodes; np != 0; np = np->allnext) | ||
1280 | if (np->linux_phandle == handle) | ||
1281 | break; | ||
1282 | of_node_get(np); | ||
1283 | read_unlock(&devtree_lock); | ||
1284 | return np; | ||
1285 | } | ||
1286 | EXPORT_SYMBOL(of_find_node_by_phandle); | ||
1287 | |||
1288 | /** | ||
1289 | * of_find_next_cache_node - Find a node's subsidiary cache | 746 | * of_find_next_cache_node - Find a node's subsidiary cache |
1290 | * @np: node of type "cpu" or "cache" | 747 | * @np: node of type "cpu" or "cache" |
1291 | * | 748 | * |
@@ -1316,138 +773,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np) | |||
1316 | return NULL; | 773 | return NULL; |
1317 | } | 774 | } |
1318 | 775 | ||
1319 | /** | ||
1320 | * of_node_get - Increment refcount of a node | ||
1321 | * @node: Node to inc refcount, NULL is supported to | ||
1322 | * simplify writing of callers | ||
1323 | * | ||
1324 | * Returns node. | ||
1325 | */ | ||
1326 | struct device_node *of_node_get(struct device_node *node) | ||
1327 | { | ||
1328 | if (node) | ||
1329 | kref_get(&node->kref); | ||
1330 | return node; | ||
1331 | } | ||
1332 | EXPORT_SYMBOL(of_node_get); | ||
1333 | |||
1334 | static inline struct device_node * kref_to_device_node(struct kref *kref) | ||
1335 | { | ||
1336 | return container_of(kref, struct device_node, kref); | ||
1337 | } | ||
1338 | |||
1339 | /** | ||
1340 | * of_node_release - release a dynamically allocated node | ||
1341 | * @kref: kref element of the node to be released | ||
1342 | * | ||
1343 | * In of_node_put() this function is passed to kref_put() | ||
1344 | * as the destructor. | ||
1345 | */ | ||
1346 | static void of_node_release(struct kref *kref) | ||
1347 | { | ||
1348 | struct device_node *node = kref_to_device_node(kref); | ||
1349 | struct property *prop = node->properties; | ||
1350 | |||
1351 | /* We should never be releasing nodes that haven't been detached. */ | ||
1352 | if (!of_node_check_flag(node, OF_DETACHED)) { | ||
1353 | printk("WARNING: Bad of_node_put() on %s\n", node->full_name); | ||
1354 | dump_stack(); | ||
1355 | kref_init(&node->kref); | ||
1356 | return; | ||
1357 | } | ||
1358 | |||
1359 | if (!of_node_check_flag(node, OF_DYNAMIC)) | ||
1360 | return; | ||
1361 | |||
1362 | while (prop) { | ||
1363 | struct property *next = prop->next; | ||
1364 | kfree(prop->name); | ||
1365 | kfree(prop->value); | ||
1366 | kfree(prop); | ||
1367 | prop = next; | ||
1368 | |||
1369 | if (!prop) { | ||
1370 | prop = node->deadprops; | ||
1371 | node->deadprops = NULL; | ||
1372 | } | ||
1373 | } | ||
1374 | kfree(node->full_name); | ||
1375 | kfree(node->data); | ||
1376 | kfree(node); | ||
1377 | } | ||
1378 | |||
1379 | /** | ||
1380 | * of_node_put - Decrement refcount of a node | ||
1381 | * @node: Node to dec refcount, NULL is supported to | ||
1382 | * simplify writing of callers | ||
1383 | * | ||
1384 | */ | ||
1385 | void of_node_put(struct device_node *node) | ||
1386 | { | ||
1387 | if (node) | ||
1388 | kref_put(&node->kref, of_node_release); | ||
1389 | } | ||
1390 | EXPORT_SYMBOL(of_node_put); | ||
1391 | |||
1392 | /* | ||
1393 | * Plug a device node into the tree and global list. | ||
1394 | */ | ||
1395 | void of_attach_node(struct device_node *np) | ||
1396 | { | ||
1397 | unsigned long flags; | ||
1398 | |||
1399 | write_lock_irqsave(&devtree_lock, flags); | ||
1400 | np->sibling = np->parent->child; | ||
1401 | np->allnext = allnodes; | ||
1402 | np->parent->child = np; | ||
1403 | allnodes = np; | ||
1404 | write_unlock_irqrestore(&devtree_lock, flags); | ||
1405 | } | ||
1406 | |||
1407 | /* | ||
1408 | * "Unplug" a node from the device tree. The caller must hold | ||
1409 | * a reference to the node. The memory associated with the node | ||
1410 | * is not freed until its refcount goes to zero. | ||
1411 | */ | ||
1412 | void of_detach_node(struct device_node *np) | ||
1413 | { | ||
1414 | struct device_node *parent; | ||
1415 | unsigned long flags; | ||
1416 | |||
1417 | write_lock_irqsave(&devtree_lock, flags); | ||
1418 | |||
1419 | parent = np->parent; | ||
1420 | if (!parent) | ||
1421 | goto out_unlock; | ||
1422 | |||
1423 | if (allnodes == np) | ||
1424 | allnodes = np->allnext; | ||
1425 | else { | ||
1426 | struct device_node *prev; | ||
1427 | for (prev = allnodes; | ||
1428 | prev->allnext != np; | ||
1429 | prev = prev->allnext) | ||
1430 | ; | ||
1431 | prev->allnext = np->allnext; | ||
1432 | } | ||
1433 | |||
1434 | if (parent->child == np) | ||
1435 | parent->child = np->sibling; | ||
1436 | else { | ||
1437 | struct device_node *prevsib; | ||
1438 | for (prevsib = np->parent->child; | ||
1439 | prevsib->sibling != np; | ||
1440 | prevsib = prevsib->sibling) | ||
1441 | ; | ||
1442 | prevsib->sibling = np->sibling; | ||
1443 | } | ||
1444 | |||
1445 | of_node_set_flag(np, OF_DETACHED); | ||
1446 | |||
1447 | out_unlock: | ||
1448 | write_unlock_irqrestore(&devtree_lock, flags); | ||
1449 | } | ||
1450 | |||
1451 | #ifdef CONFIG_PPC_PSERIES | 776 | #ifdef CONFIG_PPC_PSERIES |
1452 | /* | 777 | /* |
1453 | * Fix up the uninitialized fields in a new device node: | 778 | * Fix up the uninitialized fields in a new device node: |
@@ -1479,9 +804,9 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1479 | if (machine_is(powermac)) | 804 | if (machine_is(powermac)) |
1480 | return -ENODEV; | 805 | return -ENODEV; |
1481 | 806 | ||
1482 | /* fix up new node's linux_phandle field */ | 807 | /* fix up new node's phandle field */ |
1483 | if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL))) | 808 | if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL))) |
1484 | node->linux_phandle = *ibm_phandle; | 809 | node->phandle = *ibm_phandle; |
1485 | 810 | ||
1486 | out: | 811 | out: |
1487 | of_node_put(parent); | 812 | of_node_put(parent); |
@@ -1520,120 +845,6 @@ static int __init prom_reconfig_setup(void) | |||
1520 | __initcall(prom_reconfig_setup); | 845 | __initcall(prom_reconfig_setup); |
1521 | #endif | 846 | #endif |
1522 | 847 | ||
1523 | /* | ||
1524 | * Add a property to a node | ||
1525 | */ | ||
1526 | int prom_add_property(struct device_node* np, struct property* prop) | ||
1527 | { | ||
1528 | struct property **next; | ||
1529 | unsigned long flags; | ||
1530 | |||
1531 | prop->next = NULL; | ||
1532 | write_lock_irqsave(&devtree_lock, flags); | ||
1533 | next = &np->properties; | ||
1534 | while (*next) { | ||
1535 | if (strcmp(prop->name, (*next)->name) == 0) { | ||
1536 | /* duplicate ! don't insert it */ | ||
1537 | write_unlock_irqrestore(&devtree_lock, flags); | ||
1538 | return -1; | ||
1539 | } | ||
1540 | next = &(*next)->next; | ||
1541 | } | ||
1542 | *next = prop; | ||
1543 | write_unlock_irqrestore(&devtree_lock, flags); | ||
1544 | |||
1545 | #ifdef CONFIG_PROC_DEVICETREE | ||
1546 | /* try to add to proc as well if it was initialized */ | ||
1547 | if (np->pde) | ||
1548 | proc_device_tree_add_prop(np->pde, prop); | ||
1549 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
1550 | |||
1551 | return 0; | ||
1552 | } | ||
1553 | |||
1554 | /* | ||
1555 | * Remove a property from a node. Note that we don't actually | ||
1556 | * remove it, since we have given out who-knows-how-many pointers | ||
1557 | * to the data using get-property. Instead we just move the property | ||
1558 | * to the "dead properties" list, so it won't be found any more. | ||
1559 | */ | ||
1560 | int prom_remove_property(struct device_node *np, struct property *prop) | ||
1561 | { | ||
1562 | struct property **next; | ||
1563 | unsigned long flags; | ||
1564 | int found = 0; | ||
1565 | |||
1566 | write_lock_irqsave(&devtree_lock, flags); | ||
1567 | next = &np->properties; | ||
1568 | while (*next) { | ||
1569 | if (*next == prop) { | ||
1570 | /* found the node */ | ||
1571 | *next = prop->next; | ||
1572 | prop->next = np->deadprops; | ||
1573 | np->deadprops = prop; | ||
1574 | found = 1; | ||
1575 | break; | ||
1576 | } | ||
1577 | next = &(*next)->next; | ||
1578 | } | ||
1579 | write_unlock_irqrestore(&devtree_lock, flags); | ||
1580 | |||
1581 | if (!found) | ||
1582 | return -ENODEV; | ||
1583 | |||
1584 | #ifdef CONFIG_PROC_DEVICETREE | ||
1585 | /* try to remove the proc node as well */ | ||
1586 | if (np->pde) | ||
1587 | proc_device_tree_remove_prop(np->pde, prop); | ||
1588 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
1589 | |||
1590 | return 0; | ||
1591 | } | ||
1592 | |||
1593 | /* | ||
1594 | * Update a property in a node. Note that we don't actually | ||
1595 | * remove it, since we have given out who-knows-how-many pointers | ||
1596 | * to the data using get-property. Instead we just move the property | ||
1597 | * to the "dead properties" list, and add the new property to the | ||
1598 | * property list | ||
1599 | */ | ||
1600 | int prom_update_property(struct device_node *np, | ||
1601 | struct property *newprop, | ||
1602 | struct property *oldprop) | ||
1603 | { | ||
1604 | struct property **next; | ||
1605 | unsigned long flags; | ||
1606 | int found = 0; | ||
1607 | |||
1608 | write_lock_irqsave(&devtree_lock, flags); | ||
1609 | next = &np->properties; | ||
1610 | while (*next) { | ||
1611 | if (*next == oldprop) { | ||
1612 | /* found the node */ | ||
1613 | newprop->next = oldprop->next; | ||
1614 | *next = newprop; | ||
1615 | oldprop->next = np->deadprops; | ||
1616 | np->deadprops = oldprop; | ||
1617 | found = 1; | ||
1618 | break; | ||
1619 | } | ||
1620 | next = &(*next)->next; | ||
1621 | } | ||
1622 | write_unlock_irqrestore(&devtree_lock, flags); | ||
1623 | |||
1624 | if (!found) | ||
1625 | return -ENODEV; | ||
1626 | |||
1627 | #ifdef CONFIG_PROC_DEVICETREE | ||
1628 | /* try to add to proc as well if it was initialized */ | ||
1629 | if (np->pde) | ||
1630 | proc_device_tree_update_prop(np->pde, newprop, oldprop); | ||
1631 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
1632 | |||
1633 | return 0; | ||
1634 | } | ||
1635 | |||
1636 | |||
1637 | /* Find the device node for a given logical cpu number, also returns the cpu | 848 | /* Find the device node for a given logical cpu number, also returns the cpu |
1638 | * local thread number (index in ibm,interrupt-server#s) if relevant and | 849 | * local thread number (index in ibm,interrupt-server#s) if relevant and |
1639 | * asked for (non NULL) | 850 | * asked for (non NULL) |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index 04af81e39bec..04d105d689f1 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c | |||
@@ -341,7 +341,8 @@ static void __init mpc85xx_mds_pic_init(void) | |||
341 | } | 341 | } |
342 | 342 | ||
343 | mpic = mpic_alloc(np, r.start, | 343 | mpic = mpic_alloc(np, r.start, |
344 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, | 344 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | |
345 | MPIC_BROKEN_FRR_NIRQS, | ||
345 | 0, 256, " OpenPIC "); | 346 | 0, 256, " OpenPIC "); |
346 | BUG_ON(mpic == NULL); | 347 | BUG_ON(mpic == NULL); |
347 | of_node_put(np); | 348 | of_node_put(np); |
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c index 1b426050a2f9..0125604d096e 100644 --- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c +++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c | |||
@@ -80,8 +80,8 @@ static void xes_mpc85xx_configure_l2(void __iomem *l2_base) | |||
80 | printk(KERN_INFO "xes_mpc85xx: Enabling L2 as cache\n"); | 80 | printk(KERN_INFO "xes_mpc85xx: Enabling L2 as cache\n"); |
81 | 81 | ||
82 | ctl = MPC85xx_L2CTL_L2E | MPC85xx_L2CTL_L2I; | 82 | ctl = MPC85xx_L2CTL_L2E | MPC85xx_L2CTL_L2I; |
83 | if (machine_is_compatible("MPC8540") || | 83 | if (of_machine_is_compatible("MPC8540") || |
84 | machine_is_compatible("MPC8560")) | 84 | of_machine_is_compatible("MPC8560")) |
85 | /* | 85 | /* |
86 | * Assume L2 SRAM is used fully for cache, so set | 86 | * Assume L2 SRAM is used fully for cache, so set |
87 | * L2BLKSZ (bits 4:5) to match L2SIZ (bits 2:3). | 87 | * L2BLKSZ (bits 4:5) to match L2SIZ (bits 2:3). |
diff --git a/arch/powerpc/platforms/cell/cbe_powerbutton.c b/arch/powerpc/platforms/cell/cbe_powerbutton.c index dcddaa5fcb66..f75a4daa4ca2 100644 --- a/arch/powerpc/platforms/cell/cbe_powerbutton.c +++ b/arch/powerpc/platforms/cell/cbe_powerbutton.c | |||
@@ -48,7 +48,7 @@ static int __init cbe_powerbutton_init(void) | |||
48 | int ret = 0; | 48 | int ret = 0; |
49 | struct input_dev *dev; | 49 | struct input_dev *dev; |
50 | 50 | ||
51 | if (!machine_is_compatible("IBM,CBPLUS-1.0")) { | 51 | if (!of_machine_is_compatible("IBM,CBPLUS-1.0")) { |
52 | printk(KERN_ERR "%s: Not a cell blade.\n", __func__); | 52 | printk(KERN_ERR "%s: Not a cell blade.\n", __func__); |
53 | ret = -ENODEV; | 53 | ret = -ENODEV; |
54 | goto out; | 54 | goto out; |
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c index 5e0a191764fc..608fd2b584c9 100644 --- a/arch/powerpc/platforms/cell/ras.c +++ b/arch/powerpc/platforms/cell/ras.c | |||
@@ -255,7 +255,7 @@ static int __init cbe_sysreset_init(void) | |||
255 | { | 255 | { |
256 | struct cbe_pmd_regs __iomem *regs; | 256 | struct cbe_pmd_regs __iomem *regs; |
257 | 257 | ||
258 | sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0"); | 258 | sysreset_hack = of_machine_is_compatible("IBM,CBPLUS-1.0"); |
259 | if (!sysreset_hack) | 259 | if (!sysreset_hack) |
260 | return 0; | 260 | return 0; |
261 | 261 | ||
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index 4c506c1463cd..891f18e337a2 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c | |||
@@ -457,7 +457,7 @@ neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid) | |||
457 | continue; | 457 | continue; |
458 | vic_handles = of_get_property(spu_dn, "vicinity", &lenp); | 458 | vic_handles = of_get_property(spu_dn, "vicinity", &lenp); |
459 | for (i=0; i < (lenp / sizeof(phandle)); i++) { | 459 | for (i=0; i < (lenp / sizeof(phandle)); i++) { |
460 | if (vic_handles[i] == target->linux_phandle) | 460 | if (vic_handles[i] == target->phandle) |
461 | return spu; | 461 | return spu; |
462 | } | 462 | } |
463 | } | 463 | } |
@@ -499,7 +499,7 @@ static void init_affinity_node(int cbe) | |||
499 | 499 | ||
500 | if (strcmp(name, "spe") == 0) { | 500 | if (strcmp(name, "spe") == 0) { |
501 | spu = devnode_spu(cbe, vic_dn); | 501 | spu = devnode_spu(cbe, vic_dn); |
502 | avoid_ph = last_spu_dn->linux_phandle; | 502 | avoid_ph = last_spu_dn->phandle; |
503 | } else { | 503 | } else { |
504 | /* | 504 | /* |
505 | * "mic-tm" and "bif0" nodes do not have | 505 | * "mic-tm" and "bif0" nodes do not have |
@@ -514,7 +514,7 @@ static void init_affinity_node(int cbe) | |||
514 | last_spu->has_mem_affinity = 1; | 514 | last_spu->has_mem_affinity = 1; |
515 | spu->has_mem_affinity = 1; | 515 | spu->has_mem_affinity = 1; |
516 | } | 516 | } |
517 | avoid_ph = vic_dn->linux_phandle; | 517 | avoid_ph = vic_dn->phandle; |
518 | } | 518 | } |
519 | 519 | ||
520 | list_add_tail(&spu->aff_list, &last_spu->aff_list); | 520 | list_add_tail(&spu->aff_list, &last_spu->aff_list); |
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c index be2527a516ea..d35e0520abf0 100644 --- a/arch/powerpc/platforms/pasemi/cpufreq.c +++ b/arch/powerpc/platforms/pasemi/cpufreq.c | |||
@@ -304,8 +304,8 @@ static struct cpufreq_driver pas_cpufreq_driver = { | |||
304 | 304 | ||
305 | static int __init pas_cpufreq_init(void) | 305 | static int __init pas_cpufreq_init(void) |
306 | { | 306 | { |
307 | if (!machine_is_compatible("PA6T-1682M") && | 307 | if (!of_machine_is_compatible("PA6T-1682M") && |
308 | !machine_is_compatible("pasemi,pwrficient")) | 308 | !of_machine_is_compatible("pasemi,pwrficient")) |
309 | return -ENODEV; | 309 | return -ENODEV; |
310 | 310 | ||
311 | return cpufreq_register_driver(&pas_cpufreq_driver); | 311 | return cpufreq_register_driver(&pas_cpufreq_driver); |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c index 08d94e4cedd3..d4f127d18141 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_32.c +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c | |||
@@ -657,31 +657,31 @@ static int __init pmac_cpufreq_setup(void) | |||
657 | cur_freq = (*value) / 1000; | 657 | cur_freq = (*value) / 1000; |
658 | 658 | ||
659 | /* Check for 7447A based MacRISC3 */ | 659 | /* Check for 7447A based MacRISC3 */ |
660 | if (machine_is_compatible("MacRISC3") && | 660 | if (of_machine_is_compatible("MacRISC3") && |
661 | of_get_property(cpunode, "dynamic-power-step", NULL) && | 661 | of_get_property(cpunode, "dynamic-power-step", NULL) && |
662 | PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { | 662 | PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { |
663 | pmac_cpufreq_init_7447A(cpunode); | 663 | pmac_cpufreq_init_7447A(cpunode); |
664 | /* Check for other MacRISC3 machines */ | 664 | /* Check for other MacRISC3 machines */ |
665 | } else if (machine_is_compatible("PowerBook3,4") || | 665 | } else if (of_machine_is_compatible("PowerBook3,4") || |
666 | machine_is_compatible("PowerBook3,5") || | 666 | of_machine_is_compatible("PowerBook3,5") || |
667 | machine_is_compatible("MacRISC3")) { | 667 | of_machine_is_compatible("MacRISC3")) { |
668 | pmac_cpufreq_init_MacRISC3(cpunode); | 668 | pmac_cpufreq_init_MacRISC3(cpunode); |
669 | /* Else check for iBook2 500/600 */ | 669 | /* Else check for iBook2 500/600 */ |
670 | } else if (machine_is_compatible("PowerBook4,1")) { | 670 | } else if (of_machine_is_compatible("PowerBook4,1")) { |
671 | hi_freq = cur_freq; | 671 | hi_freq = cur_freq; |
672 | low_freq = 400000; | 672 | low_freq = 400000; |
673 | set_speed_proc = pmu_set_cpu_speed; | 673 | set_speed_proc = pmu_set_cpu_speed; |
674 | is_pmu_based = 1; | 674 | is_pmu_based = 1; |
675 | } | 675 | } |
676 | /* Else check for TiPb 550 */ | 676 | /* Else check for TiPb 550 */ |
677 | else if (machine_is_compatible("PowerBook3,3") && cur_freq == 550000) { | 677 | else if (of_machine_is_compatible("PowerBook3,3") && cur_freq == 550000) { |
678 | hi_freq = cur_freq; | 678 | hi_freq = cur_freq; |
679 | low_freq = 500000; | 679 | low_freq = 500000; |
680 | set_speed_proc = pmu_set_cpu_speed; | 680 | set_speed_proc = pmu_set_cpu_speed; |
681 | is_pmu_based = 1; | 681 | is_pmu_based = 1; |
682 | } | 682 | } |
683 | /* Else check for TiPb 400 & 500 */ | 683 | /* Else check for TiPb 400 & 500 */ |
684 | else if (machine_is_compatible("PowerBook3,2")) { | 684 | else if (of_machine_is_compatible("PowerBook3,2")) { |
685 | /* We only know about the 400 MHz and the 500Mhz model | 685 | /* We only know about the 400 MHz and the 500Mhz model |
686 | * they both have 300 MHz as low frequency | 686 | * they both have 300 MHz as low frequency |
687 | */ | 687 | */ |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index 708c75133377..3ed288e68ec4 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -398,11 +398,11 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
398 | int rc = -ENODEV; | 398 | int rc = -ENODEV; |
399 | 399 | ||
400 | /* Check supported platforms */ | 400 | /* Check supported platforms */ |
401 | if (machine_is_compatible("PowerMac8,1") || | 401 | if (of_machine_is_compatible("PowerMac8,1") || |
402 | machine_is_compatible("PowerMac8,2") || | 402 | of_machine_is_compatible("PowerMac8,2") || |
403 | machine_is_compatible("PowerMac9,1")) | 403 | of_machine_is_compatible("PowerMac9,1")) |
404 | use_volts_smu = 1; | 404 | use_volts_smu = 1; |
405 | else if (machine_is_compatible("PowerMac11,2")) | 405 | else if (of_machine_is_compatible("PowerMac11,2")) |
406 | use_volts_vdnap = 1; | 406 | use_volts_vdnap = 1; |
407 | else | 407 | else |
408 | return -ENODEV; | 408 | return -ENODEV; |
@@ -729,9 +729,9 @@ static int __init g5_cpufreq_init(void) | |||
729 | return -ENODEV; | 729 | return -ENODEV; |
730 | } | 730 | } |
731 | 731 | ||
732 | if (machine_is_compatible("PowerMac7,2") || | 732 | if (of_machine_is_compatible("PowerMac7,2") || |
733 | machine_is_compatible("PowerMac7,3") || | 733 | of_machine_is_compatible("PowerMac7,3") || |
734 | machine_is_compatible("RackMac3,1")) | 734 | of_machine_is_compatible("RackMac3,1")) |
735 | rc = g5_pm72_cpufreq_init(cpus); | 735 | rc = g5_pm72_cpufreq_init(cpus); |
736 | #ifdef CONFIG_PMAC_SMU | 736 | #ifdef CONFIG_PMAC_SMU |
737 | else | 737 | else |
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 424b633fbe0d..9e1b9fd75206 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c | |||
@@ -2426,7 +2426,7 @@ static int __init probe_motherboard(void) | |||
2426 | } | 2426 | } |
2427 | } | 2427 | } |
2428 | for(i=0; i<ARRAY_SIZE(pmac_mb_defs); i++) { | 2428 | for(i=0; i<ARRAY_SIZE(pmac_mb_defs); i++) { |
2429 | if (machine_is_compatible(pmac_mb_defs[i].model_string)) { | 2429 | if (of_machine_is_compatible(pmac_mb_defs[i].model_string)) { |
2430 | pmac_mb = pmac_mb_defs[i]; | 2430 | pmac_mb = pmac_mb_defs[i]; |
2431 | goto found; | 2431 | goto found; |
2432 | } | 2432 | } |
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index 96d5ce50364e..ede49e78a8da 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c | |||
@@ -842,7 +842,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target, | |||
842 | list_for_each_entry(func, &dev->functions, link) { | 842 | list_for_each_entry(func, &dev->functions, link) { |
843 | if (name && strcmp(name, func->name)) | 843 | if (name && strcmp(name, func->name)) |
844 | continue; | 844 | continue; |
845 | if (func->phandle && target->node != func->phandle) | 845 | if (func->phandle && target->phandle != func->phandle) |
846 | continue; | 846 | continue; |
847 | if ((func->flags & flags) == 0) | 847 | if ((func->flags & flags) == 0) |
848 | continue; | 848 | continue; |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index b40c22d697f0..6898e8241cd0 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -693,9 +693,9 @@ static void __init smp_core99_setup(int ncpus) | |||
693 | #ifdef CONFIG_PPC64 | 693 | #ifdef CONFIG_PPC64 |
694 | 694 | ||
695 | /* i2c based HW sync on some G5s */ | 695 | /* i2c based HW sync on some G5s */ |
696 | if (machine_is_compatible("PowerMac7,2") || | 696 | if (of_machine_is_compatible("PowerMac7,2") || |
697 | machine_is_compatible("PowerMac7,3") || | 697 | of_machine_is_compatible("PowerMac7,3") || |
698 | machine_is_compatible("RackMac3,1")) | 698 | of_machine_is_compatible("RackMac3,1")) |
699 | smp_core99_setup_i2c_hwsync(ncpus); | 699 | smp_core99_setup_i2c_hwsync(ncpus); |
700 | 700 | ||
701 | /* pfunc based HW sync on recent G5s */ | 701 | /* pfunc based HW sync on recent G5s */ |
@@ -713,7 +713,7 @@ static void __init smp_core99_setup(int ncpus) | |||
713 | #else /* CONFIG_PPC64 */ | 713 | #else /* CONFIG_PPC64 */ |
714 | 714 | ||
715 | /* GPIO based HW sync on ppc32 Core99 */ | 715 | /* GPIO based HW sync on ppc32 Core99 */ |
716 | if (pmac_tb_freeze == NULL && !machine_is_compatible("MacRISC4")) { | 716 | if (pmac_tb_freeze == NULL && !of_machine_is_compatible("MacRISC4")) { |
717 | struct device_node *cpu; | 717 | struct device_node *cpu; |
718 | const u32 *tbprop = NULL; | 718 | const u32 *tbprop = NULL; |
719 | 719 | ||
@@ -750,7 +750,7 @@ static void __init smp_core99_setup(int ncpus) | |||
750 | #endif | 750 | #endif |
751 | 751 | ||
752 | /* 32 bits SMP can't NAP */ | 752 | /* 32 bits SMP can't NAP */ |
753 | if (!machine_is_compatible("MacRISC4")) | 753 | if (!of_machine_is_compatible("MacRISC4")) |
754 | powersave_nap = 0; | 754 | powersave_nap = 0; |
755 | } | 755 | } |
756 | 756 | ||
@@ -852,7 +852,7 @@ static void __devinit smp_core99_setup_cpu(int cpu_nr) | |||
852 | /* If we didn't start the second CPU, we must take | 852 | /* If we didn't start the second CPU, we must take |
853 | * it off the bus | 853 | * it off the bus |
854 | */ | 854 | */ |
855 | if (machine_is_compatible("MacRISC4") && | 855 | if (of_machine_is_compatible("MacRISC4") && |
856 | num_online_cpus() < 2) | 856 | num_online_cpus() < 2) |
857 | g5_phy_disable_cpu1(); | 857 | g5_phy_disable_cpu1(); |
858 | #endif /* CONFIG_PPC64 */ | 858 | #endif /* CONFIG_PPC64 */ |
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c index 1810e4226e56..48211ca134c3 100644 --- a/arch/powerpc/platforms/powermac/time.c +++ b/arch/powerpc/platforms/powermac/time.c | |||
@@ -317,9 +317,9 @@ void __init pmac_calibrate_decr(void) | |||
317 | * calibration. That's better since the VIA itself seems | 317 | * calibration. That's better since the VIA itself seems |
318 | * to be slightly off. --BenH | 318 | * to be slightly off. --BenH |
319 | */ | 319 | */ |
320 | if (!machine_is_compatible("MacRISC2") && | 320 | if (!of_machine_is_compatible("MacRISC2") && |
321 | !machine_is_compatible("MacRISC3") && | 321 | !of_machine_is_compatible("MacRISC3") && |
322 | !machine_is_compatible("MacRISC4")) | 322 | !of_machine_is_compatible("MacRISC4")) |
323 | if (via_calibrate_decr()) | 323 | if (via_calibrate_decr()) |
324 | return; | 324 | return; |
325 | 325 | ||
@@ -328,7 +328,7 @@ void __init pmac_calibrate_decr(void) | |||
328 | * probably implement calibration based on the KL timer on these | 328 | * probably implement calibration based on the KL timer on these |
329 | * machines anyway... -BenH | 329 | * machines anyway... -BenH |
330 | */ | 330 | */ |
331 | if (machine_is_compatible("PowerMac3,5")) | 331 | if (of_machine_is_compatible("PowerMac3,5")) |
332 | if (via_calibrate_decr()) | 332 | if (via_calibrate_decr()) |
333 | return; | 333 | return; |
334 | #endif | 334 | #endif |
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c index 9490157da62e..d83135a9830e 100644 --- a/arch/powerpc/platforms/powermac/udbg_scc.c +++ b/arch/powerpc/platforms/powermac/udbg_scc.c | |||
@@ -132,9 +132,9 @@ void udbg_scc_init(int force_scc) | |||
132 | scc_inittab[1] = in_8(sccc); | 132 | scc_inittab[1] = in_8(sccc); |
133 | out_8(sccc, 12); | 133 | out_8(sccc, 12); |
134 | scc_inittab[3] = in_8(sccc); | 134 | scc_inittab[3] = in_8(sccc); |
135 | } else if (machine_is_compatible("RackMac1,1") | 135 | } else if (of_machine_is_compatible("RackMac1,1") |
136 | || machine_is_compatible("RackMac1,2") | 136 | || of_machine_is_compatible("RackMac1,2") |
137 | || machine_is_compatible("MacRISC4")) { | 137 | || of_machine_is_compatible("MacRISC4")) { |
138 | /* Xserves and G5s default to 57600 */ | 138 | /* Xserves and G5s default to 57600 */ |
139 | scc_inittab[1] = 0; | 139 | scc_inittab[1] = 0; |
140 | scc_inittab[3] = 0; | 140 | scc_inittab[3] = 0; |
diff --git a/arch/powerpc/sysdev/grackle.c b/arch/powerpc/sysdev/grackle.c index 5da37c2f22ee..cf27df6e508b 100644 --- a/arch/powerpc/sysdev/grackle.c +++ b/arch/powerpc/sysdev/grackle.c | |||
@@ -56,9 +56,9 @@ static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable) | |||
56 | void __init setup_grackle(struct pci_controller *hose) | 56 | void __init setup_grackle(struct pci_controller *hose) |
57 | { | 57 | { |
58 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); | 58 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); |
59 | if (machine_is_compatible("PowerMac1,1")) | 59 | if (of_machine_is_compatible("PowerMac1,1")) |
60 | ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); | 60 | ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); |
61 | if (machine_is_compatible("AAPL,PowerBook1998")) | 61 | if (of_machine_is_compatible("AAPL,PowerBook1998")) |
62 | grackle_set_loop_snoop(hose, 1); | 62 | grackle_set_loop_snoop(hose, 1); |
63 | #if 0 /* Disabled for now, HW problems ??? */ | 63 | #if 0 /* Disabled for now, HW problems ??? */ |
64 | grackle_set_stg(hose, 1); | 64 | grackle_set_stg(hose, 1); |