[S390] pfault code cleanup.
[linux-block.git] / arch / s390 / kernel / machine_kexec.c
CommitLineData
cf13f0ea
HC
1/*
2 * arch/s390/kernel/machine_kexec.c
3 *
c6b5b847 4 * Copyright IBM Corp. 2005,2006
cf13f0ea 5 *
c6b5b847
HC
6 * Author(s): Rolf Adelsberger,
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
cf13f0ea
HC
8 */
9
cf13f0ea
HC
10#include <linux/device.h>
11#include <linux/mm.h>
12#include <linux/kexec.h>
13#include <linux/delay.h>
a386fba2
HC
14#include <asm/cio.h>
15#include <asm/setup.h>
cf13f0ea
HC
16#include <asm/pgtable.h>
17#include <asm/pgalloc.h>
18#include <asm/system.h>
a386fba2 19#include <asm/smp.h>
15e9b586 20#include <asm/reset.h>
cf13f0ea 21
c6b5b847 22typedef void (*relocate_kernel_t)(kimage_entry_t *, unsigned long);
cf13f0ea 23
2efe55a9
TK
24extern const unsigned char relocate_kernel[];
25extern const unsigned long long relocate_kernel_len;
cf13f0ea 26
c6b5b847 27int machine_kexec_prepare(struct kimage *image)
cf13f0ea 28{
c6b5b847 29 void *reboot_code_buffer;
cf13f0ea
HC
30
31 /* We don't support anything but the default image type for now. */
32 if (image->type != KEXEC_TYPE_DEFAULT)
33 return -EINVAL;
34
35 /* Get the destination where the assembler code should be copied to.*/
c6b5b847 36 reboot_code_buffer = (void *) page_to_phys(image->control_code_page);
cf13f0ea
HC
37
38 /* Then copy it */
c6b5b847 39 memcpy(reboot_code_buffer, relocate_kernel, relocate_kernel_len);
cf13f0ea
HC
40 return 0;
41}
42
c6b5b847 43void machine_kexec_cleanup(struct kimage *image)
cf13f0ea
HC
44{
45}
46
c6b5b847 47void machine_shutdown(void)
cf13f0ea
HC
48{
49 printk(KERN_INFO "kexec: machine_shutdown called\n");
50}
51
c6b5b847 52void machine_kexec(struct kimage *image)
cf13f0ea 53{
cf13f0ea
HC
54 relocate_kernel_t data_mover;
55
c6b5b847 56 smp_send_stop();
29b08d2b 57 pfault_fini();
15e9b586
HC
58 s390_reset_system();
59
c6b5b847 60 data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);
cf13f0ea
HC
61
62 /* Call the moving routine */
c6b5b847
HC
63 (*data_mover)(&image->head, image->start);
64 for (;;);
cf13f0ea 65}