1 /*
2 * Common boot and setup code for both 32-bit and 64-bit.
3 * Extracted from arch/powerpc/kernel/setup_64.c.
4 *
5 * Copyright (C) 2001 PPC64 Team, IBM Corp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13 #undef DEBUG
14
15 #include <linux/export.h>
16 #include <linux/string.h>
17 #include <linux/sched.h>
18 #include <linux/init.h>
19 #include <linux/kernel.h>
20 #include <linux/reboot.h>
21 #include <linux/delay.h>
22 #include <linux/initrd.h>
23 #include <linux/platform_device.h>
24 #include <linux/seq_file.h>
25 #include <linux/ioport.h>
26 #include <linux/console.h>
27 #include <linux/screen_info.h>
28 #include <linux/root_dev.h>
29 #include <linux/notifier.h>
30 #include <linux/cpu.h>
31 #include <linux/unistd.h>
32 #include <linux/serial.h>
33 #include <linux/serial_8250.h>
34 #include <linux/debugfs.h>
35 #include <linux/percpu.h>
36 #include <linux/memblock.h>
37 #include <linux/of_platform.h>
38 #include <asm/io.h>
39 #include <asm/paca.h>
40 #include <asm/prom.h>
41 #include <asm/processor.h>
42 #include <asm/vdso_datapage.h>
43 #include <asm/pgtable.h>
44 #include <asm/smp.h>
45 #include <asm/elf.h>
46 #include <asm/machdep.h>
47 #include <asm/time.h>
48 #include <asm/cputable.h>
49 #include <asm/sections.h>
50 #include <asm/firmware.h>
51 #include <asm/btext.h>
52 #include <asm/nvram.h>
53 #include <asm/setup.h>
54 #include <asm/rtas.h>
55 #include <asm/iommu.h>
56 #include <asm/serial.h>
57 #include <asm/cache.h>
58 #include <asm/page.h>
59 #include <asm/mmu.h>
60 #include <asm/xmon.h>
61 #include <asm/cputhreads.h>
62 #include <mm/mmu_decl.h>
63 #include <asm/fadump.h>
64
65 #ifdef DEBUG
66 #include <asm/udbg.h>
67 #define DBG(fmt...) udbg_printf(fmt)
68 #else
69 #define DBG(fmt...)
70 #endif
71
72 /* The main machine-dep calls structure
73 */
74 struct machdep_calls ppc_md;
75 EXPORT_SYMBOL(ppc_md);
76 struct machdep_calls *machine_id;
77 EXPORT_SYMBOL(machine_id);
78
79 int boot_cpuid = -1;
80 EXPORT_SYMBOL_GPL(boot_cpuid);
81
82 unsigned long klimit = (unsigned long) _end;
83
84 /*
85 * This still seems to be needed... -- paulus
86 */
87 struct screen_info screen_info = {
88 .orig_x = 0,
89 .orig_y = 25,
90 .orig_video_cols = 80,
91 .orig_video_lines = 25,
92 .orig_video_isVGA = 1,
93 .orig_video_points = 16
94 };
95 #if defined(CONFIG_FB_VGA16_MODULE)
96 EXPORT_SYMBOL(screen_info);
97 #endif
98
99 /* Variables required to store legacy IO irq routing */
100 int of_i8042_kbd_irq;
101 EXPORT_SYMBOL_GPL(of_i8042_kbd_irq);
102 int of_i8042_aux_irq;
103 EXPORT_SYMBOL_GPL(of_i8042_aux_irq);
104
105 #ifdef __DO_IRQ_CANON
106 /* XXX should go elsewhere eventually */
107 int ppc_do_canonicalize_irqs;
108 EXPORT_SYMBOL(ppc_do_canonicalize_irqs);
109 #endif
110
111 /* also used by kexec */
machine_shutdown(void)112 void machine_shutdown(void)
113 {
114 #ifdef CONFIG_FA_DUMP
115 /*
116 * if fadump is active, cleanup the fadump registration before we
117 * shutdown.
118 */
119 fadump_cleanup();
120 #endif
121
122 if (ppc_md.machine_shutdown)
123 ppc_md.machine_shutdown();
124 }
125
machine_restart(char * cmd)126 void machine_restart(char *cmd)
127 {
128 machine_shutdown();
129 if (ppc_md.restart)
130 ppc_md.restart(cmd);
131 #ifdef CONFIG_SMP
132 smp_send_stop();
133 #endif
134 printk(KERN_EMERG "System Halted, OK to turn off power\n");
135 local_irq_disable();
136 while (1) ;
137 }
138
machine_power_off(void)139 void machine_power_off(void)
140 {
141 machine_shutdown();
142 if (pm_power_off)
143 pm_power_off();
144 #ifdef CONFIG_SMP
145 smp_send_stop();
146 #endif
147 printk(KERN_EMERG "System Halted, OK to turn off power\n");
148 local_irq_disable();
149 while (1) ;
150 }
151 /* Used by the G5 thermal driver */
152 EXPORT_SYMBOL_GPL(machine_power_off);
153
154 void (*pm_power_off)(void);
155 EXPORT_SYMBOL_GPL(pm_power_off);
156
machine_halt(void)157 void machine_halt(void)
158 {
159 machine_shutdown();
160 if (ppc_md.halt)
161 ppc_md.halt();
162 #ifdef CONFIG_SMP
163 smp_send_stop();
164 #endif
165 printk(KERN_EMERG "System Halted, OK to turn off power\n");
166 local_irq_disable();
167 while (1) ;
168 }
169
170
171 #ifdef CONFIG_TAU
172 extern u32 cpu_temp(unsigned long cpu);
173 extern u32 cpu_temp_both(unsigned long cpu);
174 #endif /* CONFIG_TAU */
175
176 #ifdef CONFIG_SMP
177 DEFINE_PER_CPU(unsigned int, cpu_pvr);
178 #endif
179
show_cpuinfo_summary(struct seq_file * m)180 static void show_cpuinfo_summary(struct seq_file *m)
181 {
182 struct device_node *root;
183 const char *model = NULL;
184 #if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
185 unsigned long bogosum = 0;
186 int i;
187 for_each_online_cpu(i)
188 bogosum += loops_per_jiffy;
189 seq_printf(m, "total bogomips\t: %lu.%02lu\n",
190 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
191 #endif /* CONFIG_SMP && CONFIG_PPC32 */
192 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
193 if (ppc_md.name)
194 seq_printf(m, "platform\t: %s\n", ppc_md.name);
195 root = of_find_node_by_path("/");
196 if (root)
197 model = of_get_property(root, "model", NULL);
198 if (model)
199 seq_printf(m, "model\t\t: %s\n", model);
200 of_node_put(root);
201
202 if (ppc_md.show_cpuinfo != NULL)
203 ppc_md.show_cpuinfo(m);
204
205 #ifdef CONFIG_PPC32
206 /* Display the amount of memory */
207 seq_printf(m, "Memory\t\t: %d MB\n",
208 (unsigned int)(total_memory / (1024 * 1024)));
209 #endif
210 }
211
show_cpuinfo(struct seq_file * m,void * v)212 static int show_cpuinfo(struct seq_file *m, void *v)
213 {
214 unsigned long cpu_id = (unsigned long)v - 1;
215 unsigned int pvr;
216 unsigned long proc_freq;
217 unsigned short maj;
218 unsigned short min;
219
220 #ifdef CONFIG_SMP
221 pvr = per_cpu(cpu_pvr, cpu_id);
222 #else
223 pvr = mfspr(SPRN_PVR);
224 #endif
225 maj = (pvr >> 8) & 0xFF;
226 min = pvr & 0xFF;
227
228 seq_printf(m, "processor\t: %lu\n", cpu_id);
229 seq_printf(m, "cpu\t\t: ");
230
231 if (cur_cpu_spec->pvr_mask)
232 seq_printf(m, "%s", cur_cpu_spec->cpu_name);
233 else
234 seq_printf(m, "unknown (%08x)", pvr);
235
236 #ifdef CONFIG_ALTIVEC
237 if (cpu_has_feature(CPU_FTR_ALTIVEC))
238 seq_printf(m, ", altivec supported");
239 #endif /* CONFIG_ALTIVEC */
240
241 seq_printf(m, "\n");
242
243 #ifdef CONFIG_TAU
244 if (cur_cpu_spec->cpu_features & CPU_FTR_TAU) {
245 #ifdef CONFIG_TAU_AVERAGE
246 /* more straightforward, but potentially misleading */
247 seq_printf(m, "temperature \t: %u C (uncalibrated)\n",
248 cpu_temp(cpu_id));
249 #else
250 /* show the actual temp sensor range */
251 u32 temp;
252 temp = cpu_temp_both(cpu_id);
253 seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
254 temp & 0xff, temp >> 16);
255 #endif
256 }
257 #endif /* CONFIG_TAU */
258
259 /*
260 * Platforms that have variable clock rates, should implement
261 * the method ppc_md.get_proc_freq() that reports the clock
262 * rate of a given cpu. The rest can use ppc_proc_freq to
263 * report the clock rate that is same across all cpus.
264 */
265 if (ppc_md.get_proc_freq)
266 proc_freq = ppc_md.get_proc_freq(cpu_id);
267 else
268 proc_freq = ppc_proc_freq;
269
270 if (proc_freq)
271 seq_printf(m, "clock\t\t: %lu.%06luMHz\n",
272 proc_freq / 1000000, proc_freq % 1000000);
273
274 if (ppc_md.show_percpuinfo != NULL)
275 ppc_md.show_percpuinfo(m, cpu_id);
276
277 /* If we are a Freescale core do a simple check so
278 * we dont have to keep adding cases in the future */
279 if (PVR_VER(pvr) & 0x8000) {
280 switch (PVR_VER(pvr)) {
281 case 0x8000: /* 7441/7450/7451, Voyager */
282 case 0x8001: /* 7445/7455, Apollo 6 */
283 case 0x8002: /* 7447/7457, Apollo 7 */
284 case 0x8003: /* 7447A, Apollo 7 PM */
285 case 0x8004: /* 7448, Apollo 8 */
286 case 0x800c: /* 7410, Nitro */
287 maj = ((pvr >> 8) & 0xF);
288 min = PVR_MIN(pvr);
289 break;
290 default: /* e500/book-e */
291 maj = PVR_MAJ(pvr);
292 min = PVR_MIN(pvr);
293 break;
294 }
295 } else {
296 switch (PVR_VER(pvr)) {
297 case 0x0020: /* 403 family */
298 maj = PVR_MAJ(pvr) + 1;
299 min = PVR_MIN(pvr);
300 break;
301 case 0x1008: /* 740P/750P ?? */
302 maj = ((pvr >> 8) & 0xFF) - 1;
303 min = pvr & 0xFF;
304 break;
305 default:
306 maj = (pvr >> 8) & 0xFF;
307 min = pvr & 0xFF;
308 break;
309 }
310 }
311
312 seq_printf(m, "revision\t: %hd.%hd (pvr %04x %04x)\n",
313 maj, min, PVR_VER(pvr), PVR_REV(pvr));
314
315 #ifdef CONFIG_PPC32
316 seq_printf(m, "bogomips\t: %lu.%02lu\n",
317 loops_per_jiffy / (500000/HZ),
318 (loops_per_jiffy / (5000/HZ)) % 100);
319 #endif
320
321 #ifdef CONFIG_SMP
322 seq_printf(m, "\n");
323 #endif
324 /* If this is the last cpu, print the summary */
325 if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
326 show_cpuinfo_summary(m);
327
328 return 0;
329 }
330
c_start(struct seq_file * m,loff_t * pos)331 static void *c_start(struct seq_file *m, loff_t *pos)
332 {
333 if (*pos == 0) /* just in case, cpu 0 is not the first */
334 *pos = cpumask_first(cpu_online_mask);
335 else
336 *pos = cpumask_next(*pos - 1, cpu_online_mask);
337 if ((*pos) < nr_cpu_ids)
338 return (void *)(unsigned long)(*pos + 1);
339 return NULL;
340 }
341
c_next(struct seq_file * m,void * v,loff_t * pos)342 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
343 {
344 (*pos)++;
345 return c_start(m, pos);
346 }
347
c_stop(struct seq_file * m,void * v)348 static void c_stop(struct seq_file *m, void *v)
349 {
350 }
351
352 const struct seq_operations cpuinfo_op = {
353 .start =c_start,
354 .next = c_next,
355 .stop = c_stop,
356 .show = show_cpuinfo,
357 };
358
check_for_initrd(void)359 void __init check_for_initrd(void)
360 {
361 #ifdef CONFIG_BLK_DEV_INITRD
362 DBG(" -> check_for_initrd() initrd_start=0x%lx initrd_end=0x%lx\n",
363 initrd_start, initrd_end);
364
365 /* If we were passed an initrd, set the ROOT_DEV properly if the values
366 * look sensible. If not, clear initrd reference.
367 */
368 if (is_kernel_addr(initrd_start) && is_kernel_addr(initrd_end) &&
369 initrd_end > initrd_start)
370 ROOT_DEV = Root_RAM0;
371 else
372 initrd_start = initrd_end = 0;
373
374 if (initrd_start)
375 pr_info("Found initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
376
377 DBG(" <- check_for_initrd()\n");
378 #endif /* CONFIG_BLK_DEV_INITRD */
379 }
380
381 #ifdef CONFIG_SMP
382
383 int threads_per_core, threads_per_subcore, threads_shift;
384 cpumask_t threads_core_mask;
385 EXPORT_SYMBOL_GPL(threads_per_core);
386 EXPORT_SYMBOL_GPL(threads_per_subcore);
387 EXPORT_SYMBOL_GPL(threads_shift);
388 EXPORT_SYMBOL_GPL(threads_core_mask);
389
cpu_init_thread_core_maps(int tpc)390 static void __init cpu_init_thread_core_maps(int tpc)
391 {
392 int i;
393
394 threads_per_core = tpc;
395 threads_per_subcore = tpc;
396 cpumask_clear(&threads_core_mask);
397
398 /* This implementation only supports power of 2 number of threads
399 * for simplicity and performance
400 */
401 threads_shift = ilog2(tpc);
402 BUG_ON(tpc != (1 << threads_shift));
403
404 for (i = 0; i < tpc; i++)
405 cpumask_set_cpu(i, &threads_core_mask);
406
407 printk(KERN_INFO "CPU maps initialized for %d thread%s per core\n",
408 tpc, tpc > 1 ? "s" : "");
409 printk(KERN_DEBUG " (thread shift is %d)\n", threads_shift);
410 }
411
412
413 /**
414 * setup_cpu_maps - initialize the following cpu maps:
415 * cpu_possible_mask
416 * cpu_present_mask
417 *
418 * Having the possible map set up early allows us to restrict allocations
419 * of things like irqstacks to nr_cpu_ids rather than NR_CPUS.
420 *
421 * We do not initialize the online map here; cpus set their own bits in
422 * cpu_online_mask as they come up.
423 *
424 * This function is valid only for Open Firmware systems. finish_device_tree
425 * must be called before using this.
426 *
427 * While we're here, we may as well set the "physical" cpu ids in the paca.
428 *
429 * NOTE: This must match the parsing done in early_init_dt_scan_cpus.
430 */
smp_setup_cpu_maps(void)431 void __init smp_setup_cpu_maps(void)
432 {
433 struct device_node *dn = NULL;
434 int cpu = 0;
435 int nthreads = 1;
436
437 DBG("smp_setup_cpu_maps()\n");
438
439 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < nr_cpu_ids) {
440 const __be32 *intserv;
441 __be32 cpu_be;
442 int j, len;
443
444 DBG(" * %s...\n", dn->full_name);
445
446 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s",
447 &len);
448 if (intserv) {
449 DBG(" ibm,ppc-interrupt-server#s -> %d threads\n",
450 nthreads);
451 } else {
452 DBG(" no ibm,ppc-interrupt-server#s -> 1 thread\n");
453 intserv = of_get_property(dn, "reg", &len);
454 if (!intserv) {
455 cpu_be = cpu_to_be32(cpu);
456 intserv = &cpu_be; /* assume logical == phys */
457 len = 4;
458 }
459 }
460
461 nthreads = len / sizeof(int);
462
463 for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
464 bool avail;
465
466 DBG(" thread %d -> cpu %d (hard id %d)\n",
467 j, cpu, be32_to_cpu(intserv[j]));
468
469 avail = of_device_is_available(dn);
470 if (!avail)
471 avail = !of_property_match_string(dn,
472 "enable-method", "spin-table");
473
474 set_cpu_present(cpu, avail);
475 set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j]));
476 set_cpu_possible(cpu, true);
477 cpu++;
478 }
479 }
480
481 /* If no SMT supported, nthreads is forced to 1 */
482 if (!cpu_has_feature(CPU_FTR_SMT)) {
483 DBG(" SMT disabled ! nthreads forced to 1\n");
484 nthreads = 1;
485 }
486
487 #ifdef CONFIG_PPC64
488 /*
489 * On pSeries LPAR, we need to know how many cpus
490 * could possibly be added to this partition.
491 */
492 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
493 (dn = of_find_node_by_path("/rtas"))) {
494 int num_addr_cell, num_size_cell, maxcpus;
495 const __be32 *ireg;
496
497 num_addr_cell = of_n_addr_cells(dn);
498 num_size_cell = of_n_size_cells(dn);
499
500 ireg = of_get_property(dn, "ibm,lrdr-capacity", NULL);
501
502 if (!ireg)
503 goto out;
504
505 maxcpus = be32_to_cpup(ireg + num_addr_cell + num_size_cell);
506
507 /* Double maxcpus for processors which have SMT capability */
508 if (cpu_has_feature(CPU_FTR_SMT))
509 maxcpus *= nthreads;
510
511 if (maxcpus > nr_cpu_ids) {
512 printk(KERN_WARNING
513 "Partition configured for %d cpus, "
514 "operating system maximum is %d.\n",
515 maxcpus, nr_cpu_ids);
516 maxcpus = nr_cpu_ids;
517 } else
518 printk(KERN_INFO "Partition configured for %d cpus.\n",
519 maxcpus);
520
521 for (cpu = 0; cpu < maxcpus; cpu++)
522 set_cpu_possible(cpu, true);
523 out:
524 of_node_put(dn);
525 }
526 vdso_data->processorCount = num_present_cpus();
527 #endif /* CONFIG_PPC64 */
528
529 /* Initialize CPU <=> thread mapping/
530 *
531 * WARNING: We assume that the number of threads is the same for
532 * every CPU in the system. If that is not the case, then some code
533 * here will have to be reworked
534 */
535 cpu_init_thread_core_maps(nthreads);
536
537 /* Now that possible cpus are set, set nr_cpu_ids for later use */
538 setup_nr_cpu_ids();
539
540 free_unused_pacas();
541 }
542 #endif /* CONFIG_SMP */
543
544 #ifdef CONFIG_PCSPKR_PLATFORM
add_pcspkr(void)545 static __init int add_pcspkr(void)
546 {
547 struct device_node *np;
548 struct platform_device *pd;
549 int ret;
550
551 np = of_find_compatible_node(NULL, NULL, "pnpPNP,100");
552 of_node_put(np);
553 if (!np)
554 return -ENODEV;
555
556 pd = platform_device_alloc("pcspkr", -1);
557 if (!pd)
558 return -ENOMEM;
559
560 ret = platform_device_add(pd);
561 if (ret)
562 platform_device_put(pd);
563
564 return ret;
565 }
566 device_initcall(add_pcspkr);
567 #endif /* CONFIG_PCSPKR_PLATFORM */
568
probe_machine(void)569 void probe_machine(void)
570 {
571 extern struct machdep_calls __machine_desc_start;
572 extern struct machdep_calls __machine_desc_end;
573
574 /*
575 * Iterate all ppc_md structures until we find the proper
576 * one for the current machine type
577 */
578 DBG("Probing machine type ...\n");
579
580 for (machine_id = &__machine_desc_start;
581 machine_id < &__machine_desc_end;
582 machine_id++) {
583 DBG(" %s ...", machine_id->name);
584 memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
585 if (ppc_md.probe()) {
586 DBG(" match !\n");
587 break;
588 }
589 DBG("\n");
590 }
591 /* What can we do if we didn't find ? */
592 if (machine_id >= &__machine_desc_end) {
593 DBG("No suitable machine found !\n");
594 for (;;);
595 }
596
597 printk(KERN_INFO "Using %s machine description\n", ppc_md.name);
598 }
599
600 /* Match a class of boards, not a specific device configuration. */
check_legacy_ioport(unsigned long base_port)601 int check_legacy_ioport(unsigned long base_port)
602 {
603 struct device_node *parent, *np = NULL;
604 int ret = -ENODEV;
605
606 switch(base_port) {
607 case I8042_DATA_REG:
608 if (!(np = of_find_compatible_node(NULL, NULL, "pnpPNP,303")))
609 np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03");
610 if (np) {
611 parent = of_get_parent(np);
612
613 of_i8042_kbd_irq = irq_of_parse_and_map(parent, 0);
614 if (!of_i8042_kbd_irq)
615 of_i8042_kbd_irq = 1;
616
617 of_i8042_aux_irq = irq_of_parse_and_map(parent, 1);
618 if (!of_i8042_aux_irq)
619 of_i8042_aux_irq = 12;
620
621 of_node_put(np);
622 np = parent;
623 break;
624 }
625 np = of_find_node_by_type(NULL, "8042");
626 /* Pegasos has no device_type on its 8042 node, look for the
627 * name instead */
628 if (!np)
629 np = of_find_node_by_name(NULL, "8042");
630 if (np) {
631 of_i8042_kbd_irq = 1;
632 of_i8042_aux_irq = 12;
633 }
634 break;
635 case FDC_BASE: /* FDC1 */
636 np = of_find_node_by_type(NULL, "fdc");
637 break;
638 default:
639 /* ipmi is supposed to fail here */
640 break;
641 }
642 if (!np)
643 return ret;
644 parent = of_get_parent(np);
645 if (parent) {
646 if (strcmp(parent->type, "isa") == 0)
647 ret = 0;
648 of_node_put(parent);
649 }
650 of_node_put(np);
651 return ret;
652 }
653 EXPORT_SYMBOL(check_legacy_ioport);
654
ppc_panic_event(struct notifier_block * this,unsigned long event,void * ptr)655 static int ppc_panic_event(struct notifier_block *this,
656 unsigned long event, void *ptr)
657 {
658 /*
659 * If firmware-assisted dump has been registered then trigger
660 * firmware-assisted dump and let firmware handle everything else.
661 */
662 crash_fadump(NULL, ptr);
663 ppc_md.panic(ptr); /* May not return */
664 return NOTIFY_DONE;
665 }
666
667 static struct notifier_block ppc_panic_block = {
668 .notifier_call = ppc_panic_event,
669 .priority = INT_MIN /* may not return; must be done last */
670 };
671
setup_panic(void)672 void __init setup_panic(void)
673 {
674 atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
675 }
676
677 #ifdef CONFIG_CHECK_CACHE_COHERENCY
678 /*
679 * For platforms that have configurable cache-coherency. This function
680 * checks that the cache coherency setting of the kernel matches the setting
681 * left by the firmware, as indicated in the device tree. Since a mismatch
682 * will eventually result in DMA failures, we print * and error and call
683 * BUG() in that case.
684 */
685
686 #ifdef CONFIG_NOT_COHERENT_CACHE
687 #define KERNEL_COHERENCY 0
688 #else
689 #define KERNEL_COHERENCY 1
690 #endif
691
check_cache_coherency(void)692 static int __init check_cache_coherency(void)
693 {
694 struct device_node *np;
695 const void *prop;
696 int devtree_coherency;
697
698 np = of_find_node_by_path("/");
699 prop = of_get_property(np, "coherency-off", NULL);
700 of_node_put(np);
701
702 devtree_coherency = prop ? 0 : 1;
703
704 if (devtree_coherency != KERNEL_COHERENCY) {
705 printk(KERN_ERR
706 "kernel coherency:%s != device tree_coherency:%s\n",
707 KERNEL_COHERENCY ? "on" : "off",
708 devtree_coherency ? "on" : "off");
709 BUG();
710 }
711
712 return 0;
713 }
714
715 late_initcall(check_cache_coherency);
716 #endif /* CONFIG_CHECK_CACHE_COHERENCY */
717
718 #ifdef CONFIG_DEBUG_FS
719 struct dentry *powerpc_debugfs_root;
720 EXPORT_SYMBOL(powerpc_debugfs_root);
721
powerpc_debugfs_init(void)722 static int powerpc_debugfs_init(void)
723 {
724 powerpc_debugfs_root = debugfs_create_dir("powerpc", NULL);
725
726 return powerpc_debugfs_root == NULL;
727 }
728 arch_initcall(powerpc_debugfs_init);
729 #endif
730
ppc_printk_progress(char * s,unsigned short hex)731 void ppc_printk_progress(char *s, unsigned short hex)
732 {
733 pr_info("%s\n", s);
734 }
735
arch_setup_pdev_archdata(struct platform_device * pdev)736 void arch_setup_pdev_archdata(struct platform_device *pdev)
737 {
738 pdev->archdata.dma_mask = DMA_BIT_MASK(32);
739 pdev->dev.dma_mask = &pdev->archdata.dma_mask;
740 set_dma_ops(&pdev->dev, &dma_direct_ops);
741 }
742