1 // SPDX-License-Identifier: GPL-2.0
4 * Early init before relocation
7 #include <linux/init.h>
8 #include <linux/kernel.h>
10 #include <asm/sections.h>
11 #include <asm/asm-prototypes.h>
14 * We're called here very early in the boot.
16 * Note that the kernel may be running at an address which is different
17 * from the address that it was linked at, so we must use RELOC/PTRRELOC
18 * to access static data (including strings). -- paulus
20 notrace unsigned long __init early_init(unsigned long dt_ptr)
22 unsigned long offset = reloc_offset();
24 /* First zero the BSS */
25 memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start);
28 * Identify the CPU type and fix up code sections
29 * that depend on which cpu we have.
31 identify_cpu(offset, mfspr(SPRN_PVR));
33 apply_feature_fixups();
35 return KERNELBASE + offset;