mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 08:58:07 +00:00
76222808fc
We originally added asm-prototypes.h in commit42f5b4cacd
("powerpc: Introduce asm-prototypes.h"). It's purpose was for prototypes of C functions that are only called from asm, in order to fix sparse warnings about missing prototypes. A few months later Nick added a different use case in commit4efca4ed05
("kbuild: modversions for EXPORT_SYMBOL() for asm") for C prototypes for exported asm functions. This is basically the inverse of our original usage. Since then we've added various prototypes to asm-prototypes.h for both reasons, meaning we now need to unstitch it all. Dispatch prototypes of C functions into relevant headers and keep only the prototypes for functions defined in assembly. For the time being, leave prom_init() there because moving it into asm/prom.h or asm/setup.h conflicts with drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.o This will be fixed later by untaggling asm/pci.h and asm/prom.h or by renaming the function in shadowrom.c Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/62d46904eca74042097acf4cb12c175e3067f3d1.1646413435.git.christophe.leroy@csgroup.eu
38 lines
888 B
C
38 lines
888 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
* Early init before relocation
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <asm/setup.h>
|
|
#include <asm/sections.h>
|
|
|
|
/*
|
|
* We're called here very early in the boot.
|
|
*
|
|
* Note that the kernel may be running at an address which is different
|
|
* from the address that it was linked at, so we must use RELOC/PTRRELOC
|
|
* to access static data (including strings). -- paulus
|
|
*/
|
|
notrace unsigned long __init early_init(unsigned long dt_ptr)
|
|
{
|
|
unsigned long kva, offset = reloc_offset();
|
|
|
|
kva = *PTRRELOC(&kernstart_virt_addr);
|
|
|
|
/* First zero the BSS */
|
|
if (kva == KERNELBASE)
|
|
memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start);
|
|
|
|
/*
|
|
* Identify the CPU type and fix up code sections
|
|
* that depend on which cpu we have.
|
|
*/
|
|
identify_cpu(offset, mfspr(SPRN_PVR));
|
|
|
|
apply_feature_fixups();
|
|
|
|
return kva + offset;
|
|
}
|