Loading...
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * machine_kexec.c - handle transition of Linux booting another kernel
4 */
5#include <linux/compiler.h>
6#include <linux/kexec.h>
7#include <linux/mm.h>
8#include <linux/delay.h>
9
10#include <asm/cacheflush.h>
11#include <asm/page.h>
12#include <asm/setup.h>
13
14extern const unsigned char relocate_new_kernel[];
15extern const size_t relocate_new_kernel_size;
16
17int machine_kexec_prepare(struct kimage *kimage)
18{
19 return 0;
20}
21
22void machine_kexec_cleanup(struct kimage *kimage)
23{
24}
25
26void machine_shutdown(void)
27{
28}
29
30void machine_crash_shutdown(struct pt_regs *regs)
31{
32}
33
34typedef void (*relocate_kernel_t)(unsigned long ptr,
35 unsigned long start,
36 unsigned long cpu_mmu_flags) __noreturn;
37
38void machine_kexec(struct kimage *image)
39{
40 void *reboot_code_buffer;
41 unsigned long cpu_mmu_flags;
42
43 reboot_code_buffer = page_address(image->control_code_page);
44
45 memcpy(reboot_code_buffer, relocate_new_kernel,
46 relocate_new_kernel_size);
47
48 /*
49 * we do not want to be bothered.
50 */
51 local_irq_disable();
52
53 pr_info("Will call new kernel at 0x%08lx. Bye...\n", image->start);
54 __flush_cache_all();
55 cpu_mmu_flags = m68k_cputype | m68k_mmutype << 8;
56 ((relocate_kernel_t) reboot_code_buffer)(image->head & PAGE_MASK,
57 image->start,
58 cpu_mmu_flags);
59}
1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel
3 */
4#include <linux/compiler.h>
5#include <linux/kexec.h>
6#include <linux/mm.h>
7#include <linux/delay.h>
8
9#include <asm/cacheflush.h>
10#include <asm/page.h>
11#include <asm/setup.h>
12
13extern const unsigned char relocate_new_kernel[];
14extern const size_t relocate_new_kernel_size;
15
16int machine_kexec_prepare(struct kimage *kimage)
17{
18 return 0;
19}
20
21void machine_kexec_cleanup(struct kimage *kimage)
22{
23}
24
25void machine_shutdown(void)
26{
27}
28
29void machine_crash_shutdown(struct pt_regs *regs)
30{
31}
32
33typedef void (*relocate_kernel_t)(unsigned long ptr,
34 unsigned long start,
35 unsigned long cpu_mmu_flags) __noreturn;
36
37void machine_kexec(struct kimage *image)
38{
39 void *reboot_code_buffer;
40 unsigned long cpu_mmu_flags;
41
42 reboot_code_buffer = page_address(image->control_code_page);
43
44 memcpy(reboot_code_buffer, relocate_new_kernel,
45 relocate_new_kernel_size);
46
47 /*
48 * we do not want to be bothered.
49 */
50 local_irq_disable();
51
52 pr_info("Will call new kernel at 0x%08lx. Bye...\n", image->start);
53 __flush_cache_all();
54 cpu_mmu_flags = m68k_cputype | m68k_mmutype << 8;
55 ((relocate_kernel_t) reboot_code_buffer)(image->head & PAGE_MASK,
56 image->start,
57 cpu_mmu_flags);
58}