mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-22 18:44:44 +08:00
aaee8c7f2a
Include reboot.h in machine_kexec.c for declaration of machine_crash_shutdown and machine_shutdown. gcc-12 with W=1 reports: arch/m68k/kernel/machine_kexec.c:26:6: warning: no previous prototype for 'machine_shutdown' [-Wmissing-prototypes] 26 | void machine_shutdown(void) | ^~~~~~~~~~~~~~~~ arch/m68k/kernel/machine_kexec.c:30:6: warning: no previous prototype for 'machine_crash_shutdown' [-Wmissing-prototypes] 30 | void machine_crash_shutdown(struct pt_regs *regs) | ^~~~~~~~~~~~~~~~~~~~~~ No functional changes intended. Compile tested only. Signed-off-by: Simon Horman <horms@kernel.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Link: https://lore.kernel.org/r/20230421-m68k-kexec-include-reboot-v1-1-7552963a0f25@kernel.org Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* machine_kexec.c - handle transition of Linux booting another kernel
|
|
*/
|
|
#include <linux/compiler.h>
|
|
#include <linux/kexec.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/reboot.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/page.h>
|
|
#include <asm/setup.h>
|
|
|
|
extern const unsigned char relocate_new_kernel[];
|
|
extern const size_t relocate_new_kernel_size;
|
|
|
|
int machine_kexec_prepare(struct kimage *kimage)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void machine_kexec_cleanup(struct kimage *kimage)
|
|
{
|
|
}
|
|
|
|
void machine_shutdown(void)
|
|
{
|
|
}
|
|
|
|
void machine_crash_shutdown(struct pt_regs *regs)
|
|
{
|
|
}
|
|
|
|
typedef void (*relocate_kernel_t)(unsigned long ptr,
|
|
unsigned long start,
|
|
unsigned long cpu_mmu_flags) __noreturn;
|
|
|
|
void machine_kexec(struct kimage *image)
|
|
{
|
|
void *reboot_code_buffer;
|
|
unsigned long cpu_mmu_flags;
|
|
|
|
reboot_code_buffer = page_address(image->control_code_page);
|
|
|
|
memcpy(reboot_code_buffer, relocate_new_kernel,
|
|
relocate_new_kernel_size);
|
|
|
|
/*
|
|
* we do not want to be bothered.
|
|
*/
|
|
local_irq_disable();
|
|
|
|
pr_info("Will call new kernel at 0x%08lx. Bye...\n", image->start);
|
|
__flush_cache_all();
|
|
cpu_mmu_flags = m68k_cputype | m68k_mmutype << 8;
|
|
((relocate_kernel_t) reboot_code_buffer)(image->head & PAGE_MASK,
|
|
image->start,
|
|
cpu_mmu_flags);
|
|
}
|