Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / arch / ppc / kernel / machine_kexec.c
index caac3d4..84d65a8 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/machdep.h>
 
-typedef void (*relocate_new_kernel_t)(
-       unsigned long indirection_page, unsigned long reboot_code_buffer,
-       unsigned long start_address);
+typedef NORET_TYPE void (*relocate_new_kernel_t)(
+                               unsigned long indirection_page,
+                               unsigned long reboot_code_buffer,
+                               unsigned long start_address) ATTRIB_NORET;
 
 const extern unsigned char relocate_new_kernel[];
 const extern unsigned int relocate_new_kernel_size;
 
 void machine_shutdown(void)
 {
-       if (ppc_md.machine_shutdown) {
+       if (ppc_md.machine_shutdown)
                ppc_md.machine_shutdown();
-       }
+}
+
+void machine_crash_shutdown(struct pt_regs *regs)
+{
+       if (ppc_md.machine_crash_shutdown)
+               ppc_md.machine_crash_shutdown();
 }
 
 /*
@@ -41,9 +47,8 @@ void machine_shutdown(void)
  */
 int machine_kexec_prepare(struct kimage *image)
 {
-       if (ppc_md.machine_kexec_prepare) {
+       if (ppc_md.machine_kexec_prepare)
                return ppc_md.machine_kexec_prepare(image);
-       }
        /*
         * Fail if platform doesn't provide its own machine_kexec_prepare
         * implementation.
@@ -53,29 +58,28 @@ int machine_kexec_prepare(struct kimage *image)
 
 void machine_kexec_cleanup(struct kimage *image)
 {
-       if (ppc_md.machine_kexec_cleanup) {
+       if (ppc_md.machine_kexec_cleanup)
                ppc_md.machine_kexec_cleanup(image);
-       }
 }
 
 /*
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-void machine_kexec(struct kimage *image)
+NORET_TYPE void machine_kexec(struct kimage *image)
 {
-       if (ppc_md.machine_kexec) {
+       if (ppc_md.machine_kexec)
                ppc_md.machine_kexec(image);
-       else {
+       else {
                /*
                 * Fall back to normal restart if platform doesn't provide
                 * its own kexec function, and user insist to kexec...
                 */
                machine_restart(NULL);
        }
+       for(;;);
 }
 
-
 /*
  * This is a generic machine_kexec function suitable at least for
  * non-OpenFirmware embedded platforms.
@@ -85,30 +89,30 @@ void machine_kexec(struct kimage *image)
  */
 void machine_kexec_simple(struct kimage *image)
 {
-       unsigned long indirection_page;
+       unsigned long page_list;
        unsigned long reboot_code_buffer, reboot_code_buffer_phys;
        relocate_new_kernel_t rnk;
 
        /* Interrupts aren't acceptable while we reboot */
        local_irq_disable();
 
-       indirection_page = image->head & PAGE_MASK;
+       page_list = image->head;
 
        /* we need both effective and real address here */
        reboot_code_buffer =
-               (unsigned long)page_address(image->control_code_page);
+                       (unsigned long)page_address(image->control_code_page);
        reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer);
 
        /* copy our kernel relocation code to the control code page */
-       memcpy((void *)reboot_code_buffer,
-               relocate_new_kernel, relocate_new_kernel_size);
+       memcpy((void *)reboot_code_buffer, relocate_new_kernel,
+                                               relocate_new_kernel_size);
 
        flush_icache_range(reboot_code_buffer,
-               reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
+                               reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
        printk(KERN_INFO "Bye!\n");
 
        /* now call it */
        rnk = (relocate_new_kernel_t) reboot_code_buffer;
-       (*rnk)(indirection_page, reboot_code_buffer_phys, image->start);
+       (*rnk)(page_list, reboot_code_buffer_phys, image->start);
 }