mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
powerpc: Factor do_feature_fixup calls
32 and 64-bit do a similar set of calls early on, we move it all to a single common function to make the boot code more readable. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
b9c13fe32f
commit
9402c68461
5 changed files with 37 additions and 30 deletions
|
@ -184,4 +184,8 @@ label##3: \
|
||||||
FTR_ENTRY_OFFSET label##1b-label##3b; \
|
FTR_ENTRY_OFFSET label##1b-label##3b; \
|
||||||
.popsection;
|
.popsection;
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
void apply_feature_fixups(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */
|
#endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
|
extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
|
||||||
extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
|
extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
|
||||||
void *fixup_end);
|
void *fixup_end);
|
||||||
extern void do_final_fixups(void);
|
|
||||||
|
|
||||||
static inline void eieio(void)
|
static inline void eieio(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,6 @@ int ucache_bsize;
|
||||||
notrace unsigned long __init early_init(unsigned long dt_ptr)
|
notrace unsigned long __init early_init(unsigned long dt_ptr)
|
||||||
{
|
{
|
||||||
unsigned long offset = reloc_offset();
|
unsigned long offset = reloc_offset();
|
||||||
struct cpu_spec *spec;
|
|
||||||
|
|
||||||
/* First zero the BSS -- use memset_io, some platforms don't have
|
/* First zero the BSS -- use memset_io, some platforms don't have
|
||||||
* caches on yet */
|
* caches on yet */
|
||||||
|
@ -81,21 +80,9 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
|
||||||
* Identify the CPU type and fix up code sections
|
* Identify the CPU type and fix up code sections
|
||||||
* that depend on which cpu we have.
|
* that depend on which cpu we have.
|
||||||
*/
|
*/
|
||||||
spec = identify_cpu(offset, mfspr(SPRN_PVR));
|
identify_cpu(offset, mfspr(SPRN_PVR));
|
||||||
|
|
||||||
do_feature_fixups(spec->cpu_features,
|
apply_feature_fixups();
|
||||||
PTRRELOC(&__start___ftr_fixup),
|
|
||||||
PTRRELOC(&__stop___ftr_fixup));
|
|
||||||
|
|
||||||
do_feature_fixups(spec->mmu_features,
|
|
||||||
PTRRELOC(&__start___mmu_ftr_fixup),
|
|
||||||
PTRRELOC(&__stop___mmu_ftr_fixup));
|
|
||||||
|
|
||||||
do_lwsync_fixups(spec->cpu_features,
|
|
||||||
PTRRELOC(&__start___lwsync_fixup),
|
|
||||||
PTRRELOC(&__stop___lwsync_fixup));
|
|
||||||
|
|
||||||
do_final_fixups();
|
|
||||||
|
|
||||||
return KERNELBASE + offset;
|
return KERNELBASE + offset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,18 +467,7 @@ void __init setup_system(void)
|
||||||
{
|
{
|
||||||
DBG(" -> setup_system()\n");
|
DBG(" -> setup_system()\n");
|
||||||
|
|
||||||
/* Apply the CPUs-specific and firmware specific fixups to kernel
|
apply_feature_fixups();
|
||||||
* text (nop out sections not relevant to this CPU or this firmware)
|
|
||||||
*/
|
|
||||||
do_feature_fixups(cur_cpu_spec->cpu_features,
|
|
||||||
&__start___ftr_fixup, &__stop___ftr_fixup);
|
|
||||||
do_feature_fixups(cur_cpu_spec->mmu_features,
|
|
||||||
&__start___mmu_ftr_fixup, &__stop___mmu_ftr_fixup);
|
|
||||||
do_feature_fixups(powerpc_firmware_features,
|
|
||||||
&__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
|
|
||||||
do_lwsync_fixups(cur_cpu_spec->cpu_features,
|
|
||||||
&__start___lwsync_fixup, &__stop___lwsync_fixup);
|
|
||||||
do_final_fixups();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unflatten the device-tree passed by prom_init or kexec
|
* Unflatten the device-tree passed by prom_init or kexec
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#include <asm/code-patching.h>
|
#include <asm/code-patching.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
|
#include <asm/setup.h>
|
||||||
|
#include <asm/firmware.h>
|
||||||
|
|
||||||
struct fixup_entry {
|
struct fixup_entry {
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
|
@ -130,7 +131,7 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_final_fixups(void)
|
static void do_final_fixups(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE)
|
#if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE)
|
||||||
int *src, *dest;
|
int *src, *dest;
|
||||||
|
@ -151,6 +152,33 @@ void do_final_fixups(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void apply_feature_fixups(void)
|
||||||
|
{
|
||||||
|
struct cpu_spec *spec = *PTRRELOC(&cur_cpu_spec);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apply the CPU-specific and firmware specific fixups to kernel text
|
||||||
|
* (nop out sections not relevant to this CPU or this firmware).
|
||||||
|
*/
|
||||||
|
do_feature_fixups(spec->cpu_features,
|
||||||
|
PTRRELOC(&__start___ftr_fixup),
|
||||||
|
PTRRELOC(&__stop___ftr_fixup));
|
||||||
|
|
||||||
|
do_feature_fixups(spec->mmu_features,
|
||||||
|
PTRRELOC(&__start___mmu_ftr_fixup),
|
||||||
|
PTRRELOC(&__stop___mmu_ftr_fixup));
|
||||||
|
|
||||||
|
do_lwsync_fixups(spec->cpu_features,
|
||||||
|
PTRRELOC(&__start___lwsync_fixup),
|
||||||
|
PTRRELOC(&__stop___lwsync_fixup));
|
||||||
|
|
||||||
|
#ifdef CONFIG_PPC64
|
||||||
|
do_feature_fixups(powerpc_firmware_features,
|
||||||
|
&__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
|
||||||
|
#endif
|
||||||
|
do_final_fixups();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FTR_FIXUP_SELFTEST
|
#ifdef CONFIG_FTR_FIXUP_SELFTEST
|
||||||
|
|
||||||
#define check(x) \
|
#define check(x) \
|
||||||
|
|
Loading…
Reference in a new issue