This source file includes following definitions.
- default_machine_kexec
- default_machine_kexec_prepare
1
2
3
4
5
6
7
8
9
10 #include <linux/kexec.h>
11 #include <linux/mm.h>
12 #include <linux/string.h>
13 #include <asm/cacheflush.h>
14 #include <asm/hw_irq.h>
15 #include <asm/io.h>
16
17 typedef void (*relocate_new_kernel_t)(
18 unsigned long indirection_page,
19 unsigned long reboot_code_buffer,
20 unsigned long start_address) __noreturn;
21
22
23
24
25
26
27
28
29 void default_machine_kexec(struct kimage *image)
30 {
31 extern const unsigned int relocate_new_kernel_size;
32 unsigned long page_list;
33 unsigned long reboot_code_buffer, reboot_code_buffer_phys;
34 relocate_new_kernel_t rnk;
35
36
37 local_irq_disable();
38
39
40
41 machine_kexec_mask_interrupts();
42
43 page_list = image->head;
44
45
46 reboot_code_buffer =
47 (unsigned long)page_address(image->control_code_page);
48 reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer);
49
50
51 memcpy((void *)reboot_code_buffer, relocate_new_kernel,
52 relocate_new_kernel_size);
53
54 flush_icache_range(reboot_code_buffer,
55 reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
56 printk(KERN_INFO "Bye!\n");
57
58 if (!IS_ENABLED(CONFIG_FSL_BOOKE) && !IS_ENABLED(CONFIG_44x))
59 relocate_new_kernel(page_list, reboot_code_buffer_phys, image->start);
60
61
62 rnk = (relocate_new_kernel_t) reboot_code_buffer;
63 (*rnk)(page_list, reboot_code_buffer_phys, image->start);
64 }
65
66 int default_machine_kexec_prepare(struct kimage *image)
67 {
68 return 0;
69 }