15 #include <linux/export.h>
16 #include <linux/string.h>
17 #include <linux/sched.h>
19 #include <linux/kernel.h>
20 #include <linux/reboot.h>
26 #include <linux/utsname.h>
27 #include <linux/tty.h>
32 #include <linux/serial.h>
35 #include <linux/pci.h>
43 #include <asm/processor.h>
44 #include <asm/pgtable.h>
47 #include <asm/machdep.h>
50 #include <asm/cputable.h>
51 #include <asm/sections.h>
52 #include <asm/btext.h>
53 #include <asm/nvram.h>
54 #include <asm/setup.h>
56 #include <asm/iommu.h>
57 #include <asm/serial.h>
58 #include <asm/cache.h>
64 #include <asm/kexec.h>
65 #include <asm/mmu_context.h>
68 #include <asm/hugetlb.h>
73 #define DBG(fmt...) udbg_printf(fmt)
103 static char *smt_enabled_cmdline;
109 const char *smt_option;
115 if (smt_enabled_cmdline) {
116 if (!
strcmp(smt_enabled_cmdline,
"on"))
118 else if (!
strcmp(smt_enabled_cmdline,
"off"))
136 if (!
strcmp(smt_option,
"on"))
138 else if (!
strcmp(smt_option,
"off"))
148 static int __init early_smt_enabled(
char *
p)
150 smt_enabled_cmdline =
p;
156 #define check_smt_enabled()
197 DBG(
" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr);
210 get_paca()->cpu_start = 1;
212 get_paca()->data_offset = 0;
219 DBG(
"Found, Initializing memory management...\n");
229 reserve_hugetlb_gpages();
231 DBG(
" <- early_setup()\n");
235 void early_setup_secondary(
void)
238 get_paca()->soft_enabled = 0;
241 early_init_mmu_secondary();
246 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
247 void smp_release_cpus(
void)
252 DBG(
" -> smp_release_cpus()\n");
260 ptr = (
unsigned long *)((
unsigned long)&__secondary_hold_spinloop
262 *ptr =
__pa(generic_secondary_smp_init);
265 for (i = 0; i < 100000; i++) {
274 DBG(
" <- smp_release_cpus()\n");
285 static void __init initialize_cache_info(
void)
288 unsigned long num_cpus = 0;
290 DBG(
" -> initialize_cache_info()\n");
292 for_each_node_by_type(np,
"cpu") {
300 const u32 *sizep, *lsizep;
317 if (sizep == 0 || lsizep == 0)
318 DBG(
"Argh, can't find dcache properties ! "
319 "sizep: %p, lsizep: %p\n", sizep, lsizep);
339 if (sizep == 0 || lsizep == 0)
340 DBG(
"Argh, can't find icache properties ! "
341 "sizep: %p, lsizep: %p\n", sizep, lsizep);
350 DBG(
" <- initialize_cache_info()\n");
360 DBG(
" -> setup_system()\n");
368 &__start___mmu_ftr_fixup, &__stop___mmu_ftr_fixup);
370 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
372 &__start___lwsync_fixup, &__stop___lwsync_fixup);
378 unflatten_device_tree();
384 initialize_cache_info();
386 #ifdef CONFIG_PPC_RTAS
423 smp_setup_cpu_maps();
433 printk(
"Starting Linux PPC64 %s\n", init_utsname()->
version);
435 printk(
"-----------------------------------------------------\n");
439 printk(
"ppc64_caches.dcache_line_size = 0x%x\n",
442 printk(
"ppc64_caches.icache_line_size = 0x%x\n",
444 #ifdef CONFIG_PPC_STD_MMU_64
450 printk(
"physical_start = 0x%llx\n",
452 printk(
"-----------------------------------------------------\n");
454 DBG(
" <- setup_system()\n");
462 static u64 safe_stack_limit(
void)
464 #ifdef CONFIG_PPC_BOOK3E
466 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
467 return linear_map_top;
472 if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
478 static void __init irqstack_early_init(
void)
497 #ifdef CONFIG_PPC_BOOK3E
500 extern unsigned int interrupt_base_book3e;
501 extern unsigned int exc_debug_debug_book3e;
516 (
unsigned long)&exc_debug_debug_book3e, 0);
519 #define exc_lvl_early_init()
526 static void __init emergency_stack_init(
void)
540 limit =
min(safe_stack_limit(), ppc64_rma_size);
579 irqstack_early_init();
581 emergency_stack_init();
583 #ifdef CONFIG_PPC_STD_MMU_64
590 #ifdef CONFIG_DUMMY_CONSOLE
609 #define PPC64_LINUX_FUNCTION 0x0f000000
610 #define PPC64_IPL_MESSAGE 0xc0000000
611 #define PPC64_TERM_MESSAGE 0xb0000000
613 static void ppc64_do_msg(
unsigned int src,
const char *
msg)
629 printk(
"[boot]%04x %s\n", src, msg);
633 #define PCPU_DYN_SIZE ()
635 static void *
__init pcpu_fc_alloc(
unsigned int cpu,
size_t size,
size_t align)
641 static void __init pcpu_fc_free(
void *ptr,
size_t size)
646 static int pcpu_cpu_distance(
unsigned int from,
unsigned int to)
675 rc = pcpu_embed_first_chunk(0, dyn_size, atom_size, pcpu_cpu_distance,
676 pcpu_fc_alloc, pcpu_fc_free);
678 panic(
"cannot initialize percpu area (err=%d)", rc);
683 paca[
cpu].data_offset = __per_cpu_offset[
cpu];
689 #ifdef CONFIG_PPC_INDIRECT_IO
690 struct ppc_pci_io ppc_pci_io;