bonding: fix a race condition in calls to slave MII ioctls
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / s390 / kernel / machine_kexec.c
blob131d7ee8b416d8f6f8bb7f053c3799a3803e97ef
1 /*
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>
8 */
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 #include <asm/ipl.h>
24 typedef void (*relocate_kernel_t)(kimage_entry_t *, unsigned long);
26 extern const unsigned char relocate_kernel[];
27 extern const unsigned long long relocate_kernel_len;
29 int machine_kexec_prepare(struct kimage *image)
31 void *reboot_code_buffer;
33 /* Can't replace kernel image since it is read-only. */
34 if (ipl_flags & IPL_NSS_VALID)
35 return -ENOSYS;
37 /* We don't support anything but the default image type for now. */
38 if (image->type != KEXEC_TYPE_DEFAULT)
39 return -EINVAL;
41 /* Get the destination where the assembler code should be copied to.*/
42 reboot_code_buffer = (void *) page_to_phys(image->control_code_page);
44 /* Then copy it */
45 memcpy(reboot_code_buffer, relocate_kernel, relocate_kernel_len);
46 return 0;
49 void machine_kexec_cleanup(struct kimage *image)
53 void machine_shutdown(void)
57 void machine_kexec(struct kimage *image)
59 relocate_kernel_t data_mover;
61 smp_send_stop();
62 pfault_fini();
63 s390_reset_system();
65 data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);
67 /* Call the moving routine */
68 (*data_mover)(&image->head, image->start);
69 for (;;);