sync hh.org
[hh.org.git] / arch / arm / kernel / machine_kexec.c
blob650dfe1aaa99c490262edf75795dd0e9d8f9a268
1 /*
2 * machine_kexec.c - handle transition of Linux booting another kernel
3 */
5 #include <linux/mm.h>
6 #include <linux/kexec.h>
7 #include <linux/delay.h>
8 #include <linux/reboot.h>
9 #include <asm/pgtable.h>
10 #include <asm/pgalloc.h>
11 #include <asm/mmu_context.h>
12 #include <asm/io.h>
13 #include <asm/cacheflush.h>
14 #include <asm/mach-types.h>
16 const extern unsigned char relocate_new_kernel[];
17 const extern unsigned int relocate_new_kernel_size;
19 extern unsigned long kexec_start_address;
20 extern unsigned long kexec_indirection_page;
21 extern unsigned long kexec_mach_type;
23 extern void setup_mm_for_reboot(char mode);
25 int machine_kexec_prepare(struct kimage *image)
27 return 0;
30 void machine_kexec_cleanup(struct kimage *image)
34 void machine_shutdown(void)
38 void machine_crash_shutdown(struct pt_regs *regs)
42 void machine_kexec(struct kimage *image)
44 unsigned long page_list;
45 unsigned long reboot_code_buffer_phys;
46 void *reboot_code_buffer;
49 page_list = image->head & PAGE_MASK;
51 /* we need both effective and real address here */
52 reboot_code_buffer_phys =
53 page_to_pfn(image->control_code_page) << PAGE_SHIFT;
54 reboot_code_buffer = page_address(image->control_code_page);
56 /* Prepare parameters for reboot_code_buffer*/
57 kexec_start_address = image->start;
58 kexec_indirection_page = page_list;
59 kexec_mach_type = machine_arch_type;
61 /* copy our kernel relocation code to the control code page */
62 memcpy(reboot_code_buffer,
63 relocate_new_kernel, relocate_new_kernel_size);
66 flush_icache_range(reboot_code_buffer,
67 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
68 printk(KERN_INFO "Bye!\n");
70 cpu_proc_fin();
71 setup_mm_for_reboot(0); /* mode is not used, so just pass 0*/
72 cpu_reset(reboot_code_buffer_phys);