aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel/machine_kexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/kernel/machine_kexec.c')
-rw-r--r--arch/ppc/kernel/machine_kexec.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/arch/ppc/kernel/machine_kexec.c b/arch/ppc/kernel/machine_kexec.c
index b82535357d6d..84d65a87191e 100644
--- a/arch/ppc/kernel/machine_kexec.c
+++ b/arch/ppc/kernel/machine_kexec.c
@@ -21,24 +21,23 @@
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22 22
23typedef NORET_TYPE void (*relocate_new_kernel_t)( 23typedef NORET_TYPE void (*relocate_new_kernel_t)(
24 unsigned long indirection_page, unsigned long reboot_code_buffer, 24 unsigned long indirection_page,
25 unsigned long start_address) ATTRIB_NORET; 25 unsigned long reboot_code_buffer,
26 unsigned long start_address) ATTRIB_NORET;
26 27
27const extern unsigned char relocate_new_kernel[]; 28const extern unsigned char relocate_new_kernel[];
28const extern unsigned int relocate_new_kernel_size; 29const extern unsigned int relocate_new_kernel_size;
29 30
30void machine_shutdown(void) 31void machine_shutdown(void)
31{ 32{
32 if (ppc_md.machine_shutdown) { 33 if (ppc_md.machine_shutdown)
33 ppc_md.machine_shutdown(); 34 ppc_md.machine_shutdown();
34 }
35} 35}
36 36
37void machine_crash_shutdown(struct pt_regs *regs) 37void machine_crash_shutdown(struct pt_regs *regs)
38{ 38{
39 if (ppc_md.machine_crash_shutdown) { 39 if (ppc_md.machine_crash_shutdown)
40 ppc_md.machine_crash_shutdown(); 40 ppc_md.machine_crash_shutdown();
41 }
42} 41}
43 42
44/* 43/*
@@ -48,9 +47,8 @@ void machine_crash_shutdown(struct pt_regs *regs)
48 */ 47 */
49int machine_kexec_prepare(struct kimage *image) 48int machine_kexec_prepare(struct kimage *image)
50{ 49{
51 if (ppc_md.machine_kexec_prepare) { 50 if (ppc_md.machine_kexec_prepare)
52 return ppc_md.machine_kexec_prepare(image); 51 return ppc_md.machine_kexec_prepare(image);
53 }
54 /* 52 /*
55 * Fail if platform doesn't provide its own machine_kexec_prepare 53 * Fail if platform doesn't provide its own machine_kexec_prepare
56 * implementation. 54 * implementation.
@@ -60,9 +58,8 @@ int machine_kexec_prepare(struct kimage *image)
60 58
61void machine_kexec_cleanup(struct kimage *image) 59void machine_kexec_cleanup(struct kimage *image)
62{ 60{
63 if (ppc_md.machine_kexec_cleanup) { 61 if (ppc_md.machine_kexec_cleanup)
64 ppc_md.machine_kexec_cleanup(image); 62 ppc_md.machine_kexec_cleanup(image);
65 }
66} 63}
67 64
68/* 65/*
@@ -71,9 +68,9 @@ void machine_kexec_cleanup(struct kimage *image)
71 */ 68 */
72NORET_TYPE void machine_kexec(struct kimage *image) 69NORET_TYPE void machine_kexec(struct kimage *image)
73{ 70{
74 if (ppc_md.machine_kexec) { 71 if (ppc_md.machine_kexec)
75 ppc_md.machine_kexec(image); 72 ppc_md.machine_kexec(image);
76 } else { 73 else {
77 /* 74 /*
78 * Fall back to normal restart if platform doesn't provide 75 * Fall back to normal restart if platform doesn't provide
79 * its own kexec function, and user insist to kexec... 76 * its own kexec function, and user insist to kexec...
@@ -83,7 +80,6 @@ NORET_TYPE void machine_kexec(struct kimage *image)
83 for(;;); 80 for(;;);
84} 81}
85 82
86
87/* 83/*
88 * This is a generic machine_kexec function suitable at least for 84 * This is a generic machine_kexec function suitable at least for
89 * non-OpenFirmware embedded platforms. 85 * non-OpenFirmware embedded platforms.
@@ -104,15 +100,15 @@ void machine_kexec_simple(struct kimage *image)
104 100
105 /* we need both effective and real address here */ 101 /* we need both effective and real address here */
106 reboot_code_buffer = 102 reboot_code_buffer =
107 (unsigned long)page_address(image->control_code_page); 103 (unsigned long)page_address(image->control_code_page);
108 reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer); 104 reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer);
109 105
110 /* copy our kernel relocation code to the control code page */ 106 /* copy our kernel relocation code to the control code page */
111 memcpy((void *)reboot_code_buffer, 107 memcpy((void *)reboot_code_buffer, relocate_new_kernel,
112 relocate_new_kernel, relocate_new_kernel_size); 108 relocate_new_kernel_size);
113 109
114 flush_icache_range(reboot_code_buffer, 110 flush_icache_range(reboot_code_buffer,
115 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE); 111 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
116 printk(KERN_INFO "Bye!\n"); 112 printk(KERN_INFO "Bye!\n");
117 113
118 /* now call it */ 114 /* now call it */