notrace void __init machine_init(u64 dt_ptr) { lockdep_init(); udbg_early_init(); early_init_devtree(__va(dt_ptr)); early_init_mmu(); probe_machine(); setup_kdump_trampoline(); #ifdef CONFIG_6xx if (cpu_has_feature(CPU_FTR_CAN_DOZE) || cpu_has_feature(CPU_FTR_CAN_NAP)) ppc_md.power_save = ppc6xx_idle; #endif #ifdef CONFIG_E500 if (cpu_has_feature(CPU_FTR_CAN_DOZE) || cpu_has_feature(CPU_FTR_CAN_NAP)) ppc_md.power_save = e500_idle; #endif if (ppc_md.progress) ppc_md.progress("id mach(): done", 0x200); }
/* * Find out what kind of machine we're on and save any data we need * from the early boot process (devtree is copied on pmac by prom_init()). * This is called very early on the boot process, after a minimal * MMU environment has been set up but before MMU_init is called. */ notrace void __init machine_init(unsigned long dt_ptr) { /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); /* Do some early initialization based on the flat device tree */ early_init_devtree(__va(dt_ptr)); probe_machine(); setup_kdump_trampoline(); #ifdef CONFIG_6xx if (cpu_has_feature(CPU_FTR_CAN_DOZE) || cpu_has_feature(CPU_FTR_CAN_NAP)) ppc_md.power_save = ppc6xx_idle; #endif #ifdef CONFIG_E500 if (cpu_has_feature(CPU_FTR_CAN_DOZE) || cpu_has_feature(CPU_FTR_CAN_NAP)) ppc_md.power_save = e500_idle; #endif if (ppc_md.progress) ppc_md.progress("id mach(): done", 0x200); }
void __init init_arch(bp_tag_t *bp_start) { sysmem.nr_banks = 0; /* Parse boot parameters */ if (bp_start) parse_bootparam(bp_start); #ifdef CONFIG_OF early_init_devtree(dtb_start); #endif if (sysmem.nr_banks == 0) { sysmem.nr_banks = 1; sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START; sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE; } #ifdef CONFIG_CMDLINE_BOOL if (!command_line[0]) strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE); #endif /* Early hook for platforms */ platform_init(bp_start); /* Initialize MMU. */ init_mmu(); }
void __init setup_arch(char **cmdline_p) { /* * init "current thread structure" pointer */ lm32_current_thread = (struct thread_info*)&init_thread_union; /* populate memory_start and memory_end, needed for bootmem_init() */ early_init_devtree(__dtb_start); /* a cmdline set by the bootloader overrides one defined in the dts */ if (__cmdline && strlen(__cmdline)) strlcpy(cmd_line, __cmdline, COMMAND_LINE_SIZE); *cmdline_p = cmd_line; strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); /* early commandline needed by memblock */ parse_early_param(); bootmem_init(); device_tree_init(); paging_init(); plat_setup_arch(); #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif }
notrace void __init machine_init(u64 dt_ptr) { /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); patch_instruction((unsigned int *)&memcpy, PPC_INST_NOP); patch_instruction(&memset_nocache_branch, PPC_INST_NOP); /* Do some early initialization based on the flat device tree */ early_init_devtree(__va(dt_ptr)); epapr_paravirt_early_init(); early_init_mmu(); probe_machine(); setup_kdump_trampoline(); #ifdef CONFIG_6xx if (cpu_has_feature(CPU_FTR_CAN_DOZE) || cpu_has_feature(CPU_FTR_CAN_NAP)) ppc_md.power_save = ppc6xx_idle; #endif #ifdef CONFIG_E500 if (cpu_has_feature(CPU_FTR_CAN_DOZE) || cpu_has_feature(CPU_FTR_CAN_NAP)) ppc_md.power_save = e500_idle; #endif if (ppc_md.progress) ppc_md.progress("id mach(): done", 0x200); }
void __init machine_early_init(const char *cmdline, unsigned int ram, unsigned int fdt) { unsigned long *src, *dst = (unsigned long *)0x0; /* clearing bss section */ memset(__bss_start, 0, __bss_stop-__bss_start); memset(_ssbss, 0, _esbss-_ssbss); /* * Copy command line passed from bootloader, or use default * if none provided, or forced */ #ifndef CONFIG_CMDLINE_BOOL if (cmdline && cmdline[0] != '\0') strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE); #endif /* initialize device tree for usage in early_printk */ early_init_devtree((void *)_fdt_start); #ifdef CONFIG_EARLY_PRINTK setup_early_printk(NULL); #endif early_printk("Ramdisk addr 0x%08x, FDT 0x%08x\n", ram, fdt); printk(KERN_NOTICE "Found FDT at 0x%08x\n", fdt); #ifdef CONFIG_MTD_UCLINUX { int size; unsigned int romfs_base; romfs_base = (ram ? ram : (unsigned int)&__init_end); /* if CONFIG_MTD_UCLINUX_EBSS is defined, assume ROMFS is at the * end of kernel, which is ROMFS_LOCATION defined above. */ size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base)); early_printk("Found romfs @ 0x%08x (0x%08x)\n", romfs_base, size); early_printk("#### klimit %p ####\n", klimit); BUG_ON(size < 0); /* What else can we do? */ /* Use memmove to handle likely case of memory overlap */ early_printk("Moving 0x%08x bytes from 0x%08x to 0x%08x\n", size, romfs_base, (unsigned)&_ebss); memmove(&_ebss, (int *)romfs_base, size); /* update klimit */ klimit += PAGE_ALIGN(size); early_printk("New klimit: 0x%08x\n", (unsigned)klimit); } #endif for (src = __ivt_start; src < __ivt_end; src++, dst++) *dst = *src; /* Initialize global data */ per_cpu(KM, 0) = 0x1; /* We start in kernel mode */ per_cpu(CURRENT_SAVE, 0) = (unsigned long)current; }
void __init early_setup(unsigned long dt_ptr) { struct paca_struct *lpaca = get_paca(); static struct machdep_calls **mach; /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); DBG(" -> early_setup()\n"); /* * Do early initializations using the flattened device * tree, like retreiving the physical memory map or * calculating/retreiving the hash table size */ early_init_devtree(__va(dt_ptr)); /* * Iterate all ppc_md structures until we find the proper * one for the current machine type */ DBG("Probing machine type for platform %x...\n", _machine); for (mach = machines; *mach; mach++) { if ((*mach)->probe(_machine)) break; } /* What can we do if we didn't find ? */ if (*mach == NULL) { DBG("No suitable machine found !\n"); for (;;); } ppc_md = **mach; #ifdef CONFIG_CRASH_DUMP kdump_setup(); #endif DBG("Found, Initializing memory management...\n"); /* * Initialize the MMU Hash table and create the linear mapping * of memory. Has to be done before stab/slb initialization as * this is currently where the page size encoding is obtained */ htab_initialize(); /* * Initialize stab / SLB management except on iSeries */ if (!firmware_has_feature(FW_FEATURE_ISERIES)) { if (cpu_has_feature(CPU_FTR_SLB)) slb_initialize(); else stab_initialize(lpaca->stab_real); } DBG(" <- early_setup()\n"); }
void __init __dt_setup_arch(struct boot_param_header *bph) { if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { pr_err("DTB has bad magic, ignoring builtin OF DTB\n"); return; } initial_boot_params = bph; early_init_devtree(initial_boot_params); }
void __init early_setup(unsigned long dt_ptr) { /* Identify CPU type */ identify_cpu(0, mfspr(SPRN_PVR)); /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ setup_paca(0); /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); /* * Do early initializations using the flattened device * tree, like retreiving the physical memory map or * calculating/retreiving the hash table size */ early_init_devtree(__va(dt_ptr)); /* Now we know the logical id of our boot cpu, setup the paca. */ setup_paca(boot_cpuid); /* Fix up paca fields required for the boot cpu */ get_paca()->cpu_start = 1; get_paca()->stab_real = __pa((u64)&initial_stab); get_paca()->stab_addr = (u64)&initial_stab; /* Probe the machine type */ probe_machine(); setup_kdump_trampoline(); DBG("Found, Initializing memory management...\n"); /* * Initialize the MMU Hash table and create the linear mapping * of memory. Has to be done before stab/slb initialization as * this is currently where the page size encoding is obtained */ htab_initialize(); /* * Initialize stab / SLB management except on iSeries */ if (cpu_has_feature(CPU_FTR_SLB)) slb_initialize(); else if (!firmware_has_feature(FW_FEATURE_ISERIES)) stab_initialize(get_paca()->stab_real); DBG(" <- early_setup()\n"); }
notrace void __init machine_init(u64 dt_ptr) { /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); patch_instruction((unsigned int *)&memcpy, PPC_INST_NOP); patch_instruction(&memset_nocache_branch, PPC_INST_NOP); /* Do some early initialization based on the flat device tree */ early_init_devtree(__va(dt_ptr)); early_init_mmu(); setup_kdump_trampoline(); }
void __init early_setup(unsigned long dt_ptr) { /* -------- printk is _NOT_ safe to use here ! ------- */ /* Fill in any unititialised pacas */ initialise_pacas(); /* Identify CPU type */ identify_cpu(0, mfspr(SPRN_PVR)); /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ setup_paca(0); /* Initialize lockdep early or else spinlocks will blow */ lockdep_init(); /* -------- printk is now safe to use ------- */ /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); /* * Do early initialization using the flattened device * tree, such as retrieving the physical memory map or * calculating/retrieving the hash table size. */ early_init_devtree(__va(dt_ptr)); /* Now we know the logical id of our boot cpu, setup the paca. */ setup_paca(boot_cpuid); /* Fix up paca fields required for the boot cpu */ get_paca()->cpu_start = 1; /* Probe the machine type */ probe_machine(); setup_kdump_trampoline(); DBG("Found, Initializing memory management...\n"); /* Initialize the hash table or TLB handling */ early_init_mmu(); DBG(" <- early_setup()\n"); }
/* * Find out what kind of machine we're on and save any data we need * from the early boot process (devtree is copied on pmac by prom_init()). * This is called very early on the boot process, after a minimal * MMU environment has been set up but before MMU_init is called. */ void __init machine_init(unsigned long dt_ptr, unsigned long phys) { early_init_devtree(__va(dt_ptr)); #ifdef CONFIG_CMDLINE strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); #endif /* CONFIG_CMDLINE */ platform_init(); #ifdef CONFIG_6xx ppc_md.power_save = ppc6xx_idle; #endif if (ppc_md.progress) ppc_md.progress("id mach(): done", 0x200); }
void __init machine_early_init(char *cmdline, unsigned long p_initrd_start, unsigned long p_initrd_end) { /* clear bss section */ memset(__bss_start, 0, __bss_stop - __bss_start); #ifndef CONFIG_CMDLINE_BOOL if (cmdline) { strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE); } #else strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #endif initrd_start = p_initrd_start; initrd_end = p_initrd_end; early_init_devtree(__dtb_start); printk("initrd: %lx %lx\n", initrd_start, initrd_end); memblock_reserve(__pa(initrd_start), initrd_end - initrd_start); }
void __init init_arch(bp_tag_t *bp_start) { /* Parse boot parameters */ if (bp_start) parse_bootparam(bp_start); #ifdef CONFIG_OF early_init_devtree(dtb_start); #endif #ifdef CONFIG_CMDLINE_BOOL if (!command_line[0]) strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE); #endif /* Early hook for platforms */ platform_init(bp_start); /* Initialize MMU. */ init_mmu(); }
void __init early_setup(unsigned long dt_ptr) { static __initdata struct paca_struct boot_paca; /* -------- printk is _NOT_ safe to use here ! ------- */ /* Try new device tree based feature discovery ... */ if (!dt_cpu_ftrs_init(__va(dt_ptr))) /* Otherwise use the old style CPU table */ identify_cpu(0, mfspr(SPRN_PVR)); /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ initialise_paca(&boot_paca, 0); setup_paca(&boot_paca); fixup_boot_paca(); /* -------- printk is now safe to use ------- */ /* Enable early debugging if any specified (see udbg.h) */ udbg_early_init(); DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); /* * Do early initialization using the flattened device * tree, such as retrieving the physical memory map or * calculating/retrieving the hash table size. */ early_init_devtree(__va(dt_ptr)); /* Now we know the logical id of our boot cpu, setup the paca. */ if (boot_cpuid != 0) { /* Poison paca_ptrs[0] again if it's not the boot cpu */ memset(&paca_ptrs[0], 0x88, sizeof(paca_ptrs[0])); } setup_paca(paca_ptrs[boot_cpuid]); fixup_boot_paca(); /* * Configure exception handlers. This include setting up trampolines * if needed, setting exception endian mode, etc... */ configure_exceptions(); /* Apply all the dynamic patching */ apply_feature_fixups(); setup_feature_keys(); /* Initialize the hash table or TLB handling */ early_init_mmu(); /* * After firmware and early platform setup code has set things up, * we note the SPR values for configurable control/performance * registers, and use those as initial defaults. */ record_spr_defaults(); /* * At this point, we can let interrupts switch to virtual mode * (the MMU has been setup), so adjust the MSR in the PACA to * have IR and DR set and enable AIL if it exists */ cpu_ready_for_interrupts(); /* * We enable ftrace here, but since we only support DYNAMIC_FTRACE, it * will only actually get enabled on the boot cpu much later once * ftrace itself has been initialized. */ this_cpu_enable_ftrace(); DBG(" <- early_setup()\n"); #ifdef CONFIG_PPC_EARLY_DEBUG_BOOTX /* * This needs to be done *last* (after the above DBG() even) * * Right after we return from this function, we turn on the MMU * which means the real-mode access trick that btext does will * no longer work, it needs to switch to using a real MMU * mapping. This call will ensure that it does */ btext_map(); #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */ }
void __init machine_early_init(const char *cmdline, unsigned int ram, unsigned int fdt, unsigned int msr) { unsigned long *src, *dst; unsigned int offset = 0; /* If CONFIG_MTD_UCLINUX is defined, assume ROMFS is at the * end of kernel. There are two position which we want to check. * The first is __init_end and the second __bss_start. */ #ifdef CONFIG_MTD_UCLINUX int romfs_size; unsigned int romfs_base; char *old_klimit = klimit; romfs_base = (ram ? ram : (unsigned int)&__init_end); romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base)); if (!romfs_size) { romfs_base = (unsigned int)&__bss_start; romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base)); } /* Move ROMFS out of BSS before clearing it */ if (romfs_size > 0) { memmove(&_ebss, (int *)romfs_base, romfs_size); klimit += romfs_size; } #endif /* clearing bss section */ memset(__bss_start, 0, __bss_stop-__bss_start); memset(_ssbss, 0, _esbss-_ssbss); /* Copy command line passed from bootloader */ #ifndef CONFIG_CMDLINE_BOOL if (cmdline && cmdline[0] != '\0') strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE); #endif lockdep_init(); /* initialize device tree for usage in early_printk */ early_init_devtree((void *)_fdt_start); #ifdef CONFIG_EARLY_PRINTK setup_early_printk(NULL); #endif eprintk("Ramdisk addr 0x%08x, ", ram); if (fdt) eprintk("FDT at 0x%08x\n", fdt); else eprintk("Compiled-in FDT at 0x%08x\n", (unsigned int)_fdt_start); #ifdef CONFIG_MTD_UCLINUX eprintk("Found romfs @ 0x%08x (0x%08x)\n", romfs_base, romfs_size); eprintk("#### klimit %p ####\n", old_klimit); BUG_ON(romfs_size < 0); /* What else can we do? */ eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", romfs_size, romfs_base, (unsigned)&_ebss); eprintk("New klimit: 0x%08x\n", (unsigned)klimit); #endif #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR if (msr) eprintk("!!!Your kernel has setup MSR instruction but " "CPU don't have it %x\n", msr); #else if (!msr) eprintk("!!!Your kernel not setup MSR instruction but " "CPU have it %x\n", msr); #endif /* Do not copy reset vectors. offset = 0x2 means skip the first * two instructions. dst is pointer to MB vectors which are placed * in block ram. If you want to copy reset vector setup offset to 0x0 */ #if !CONFIG_MANUAL_RESET_VECTOR offset = 0x2; #endif dst = (unsigned long *) (offset * sizeof(u32)); for (src = __ivt_start + offset; src < __ivt_end; src++, dst++) *dst = *src; /* Initialize global data */ per_cpu(KM, 0) = 0x1; /* We start in kernel mode */ per_cpu(CURRENT_SAVE, 0) = (unsigned long)current; }
void __init early_setup(unsigned long dt_ptr) { struct paca_struct *lpaca = get_paca(); static struct machdep_calls **mach; /* * Enable early debugging if any specified (see top of * this file) */ EARLY_DEBUG_INIT(); DBG(" -> early_setup()\n"); /* * Fill the default DBG level in naca (do we want to keep * that old mecanism around forever ?) */ ppcdbg_initialize(); /* * Do early initializations using the flattened device * tree, like retreiving the physical memory map or * calculating/retreiving the hash table size */ early_init_devtree(__va(dt_ptr)); /* * Iterate all ppc_md structures until we find the proper * one for the current machine type */ DBG("Probing machine type for platform %x...\n", systemcfg->platform); for (mach = machines; *mach; mach++) { if ((*mach)->probe(systemcfg->platform)) break; } /* What can we do if we didn't find ? */ if (*mach == NULL) { DBG("No suitable machine found !\n"); for (;;); } ppc_md = **mach; /* our udbg callbacks got overriden by the above, let's put them * back in. Ultimately, I want those things to be split from the * main ppc_md */ EARLY_DEBUG_INIT(); DBG("Found, Initializing memory management...\n"); /* * Initialize stab / SLB management */ stab_initialize(lpaca->stab_real); /* * Initialize the MMU Hash table and create the linear mapping * of memory */ htab_initialize(); DBG(" <- early_setup()\n"); }
void __init machine_early_init(const char *cmdline, unsigned int ram, unsigned int fdt, unsigned int msr, unsigned int tlb0, unsigned int tlb1) { unsigned long *src, *dst; unsigned int offset = 0; /* */ #ifdef CONFIG_MTD_UCLINUX int romfs_size; unsigned int romfs_base; char *old_klimit = klimit; romfs_base = (ram ? ram : (unsigned int)&__init_end); romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base)); if (!romfs_size) { romfs_base = (unsigned int)&__bss_start; romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base)); } /* */ if (romfs_size > 0) { memmove(&_ebss, (int *)romfs_base, romfs_size); klimit += romfs_size; } #endif /* */ memset(__bss_start, 0, __bss_stop-__bss_start); memset(_ssbss, 0, _esbss-_ssbss); /* */ #ifndef CONFIG_CMDLINE_BOOL if (cmdline && cmdline[0] != '\0') strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE); #endif lockdep_init(); /* */ early_init_devtree((void *)_fdt_start); #ifdef CONFIG_EARLY_PRINTK setup_early_printk(NULL); #endif /* */ kernel_tlb = tlb0 + tlb1; /* */ printk("Ramdisk addr 0x%08x, ", ram); if (fdt) printk("FDT at 0x%08x\n", fdt); else printk("Compiled-in FDT at 0x%08x\n", (unsigned int)_fdt_start); #ifdef CONFIG_MTD_UCLINUX printk("Found romfs @ 0x%08x (0x%08x)\n", romfs_base, romfs_size); printk("#### klimit %p ####\n", old_klimit); BUG_ON(romfs_size < 0); /* */ printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", romfs_size, romfs_base, (unsigned)&_ebss); printk("New klimit: 0x%08x\n", (unsigned)klimit); #endif #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR if (msr) printk("!!!Your kernel has setup MSR instruction but " "CPU don't have it %x\n", msr); #else if (!msr) printk("!!!Your kernel not setup MSR instruction but " "CPU have it %x\n", msr); #endif /* */ #if !CONFIG_MANUAL_RESET_VECTOR offset = 0x2; #endif dst = (unsigned long *) (offset * sizeof(u32)); for (src = __ivt_start + offset; src < __ivt_end; src++, dst++) *dst = *src; /* */ per_cpu(KM, 0) = 0x1; /* */ per_cpu(CURRENT_SAVE, 0) = (unsigned long)current; }