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