Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / powerpc / kernel / early_32.c
blob03f1135ef64fcf2243c8f1d1faedcbdf74c64739
1 // SPDX-License-Identifier: GPL-2.0
3 /*
4 * Early init before relocation
5 */
7 #include <linux/init.h>
8 #include <linux/kernel.h>
9 #include <asm/setup.h>
10 #include <asm/sections.h>
13 * We're called here very early in the boot.
15 * Note that the kernel may be running at an address which is different
16 * from the address that it was linked at, so we must use RELOC/PTRRELOC
17 * to access static data (including strings). -- paulus
19 notrace unsigned long __init early_init(unsigned long dt_ptr)
21 unsigned long kva, offset = reloc_offset();
23 kva = *PTRRELOC(&kernstart_virt_addr);
25 /* First zero the BSS */
26 if (kva == KERNELBASE)
27 memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start);
30 * Identify the CPU type and fix up code sections
31 * that depend on which cpu we have.
33 identify_cpu(offset, mfspr(SPRN_PVR));
35 apply_feature_fixups();
37 return kva + offset;