2 * arch/s390/kernel/machine_kexec.c
4 * Copyright IBM Corp. 2005,2006
6 * Author(s): Rolf Adelsberger,
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
10 #include <linux/device.h>
12 #include <linux/kexec.h>
13 #include <linux/delay.h>
14 #include <linux/reboot.h>
15 #include <linux/ftrace.h>
17 #include <asm/setup.h>
18 #include <asm/pgtable.h>
19 #include <asm/pgalloc.h>
20 #include <asm/system.h>
22 #include <asm/reset.h>
25 typedef void (*relocate_kernel_t
)(kimage_entry_t
*, unsigned long);
27 extern const unsigned char relocate_kernel
[];
28 extern const unsigned long long relocate_kernel_len
;
30 int machine_kexec_prepare(struct kimage
*image
)
32 void *reboot_code_buffer
;
34 /* Can't replace kernel image since it is read-only. */
35 if (ipl_flags
& IPL_NSS_VALID
)
38 /* We don't support anything but the default image type for now. */
39 if (image
->type
!= KEXEC_TYPE_DEFAULT
)
42 /* Get the destination where the assembler code should be copied to.*/
43 reboot_code_buffer
= (void *) page_to_phys(image
->control_code_page
);
46 memcpy(reboot_code_buffer
, relocate_kernel
, relocate_kernel_len
);
50 void machine_kexec_cleanup(struct kimage
*image
)
54 void machine_shutdown(void)
58 static void __machine_kexec(void *data
)
60 relocate_kernel_t data_mover
;
61 struct kimage
*image
= data
;
66 data_mover
= (relocate_kernel_t
) page_to_phys(image
->control_code_page
);
68 /* Call the moving routine */
69 (*data_mover
)(&image
->head
, image
->start
);
73 void machine_kexec(struct kimage
*image
)
77 smp_switch_to_ipl_cpu(__machine_kexec
, image
);