kbuild: Fix instrumentation removal breakage on avr32
[wrt350n-kernel.git] / arch / powerpc / kernel / machine_kexec_32.c
blobcbaa34196797ea55a67afbfa9a79a3fc74384e59
1 /*
2 * PPC32 code to handle Linux booting another kernel.
4 * Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
5 * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
6 * Copyright (C) 2005 IBM Corporation.
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
12 #include <linux/kexec.h>
13 #include <linux/mm.h>
14 #include <linux/string.h>
15 #include <asm/cacheflush.h>
16 #include <asm/hw_irq.h>
17 #include <asm/io.h>
19 typedef NORET_TYPE void (*relocate_new_kernel_t)(
20 unsigned long indirection_page,
21 unsigned long reboot_code_buffer,
22 unsigned long start_address) ATTRIB_NORET;
25 * This is a generic machine_kexec function suitable at least for
26 * non-OpenFirmware embedded platforms.
27 * It merely copies the image relocation code to the control page and
28 * jumps to it.
29 * A platform specific function may just call this one.
31 void default_machine_kexec(struct kimage *image)
33 extern const unsigned char relocate_new_kernel[];
34 extern const unsigned int relocate_new_kernel_size;
35 unsigned long page_list;
36 unsigned long reboot_code_buffer, reboot_code_buffer_phys;
37 relocate_new_kernel_t rnk;
39 /* Interrupts aren't acceptable while we reboot */
40 local_irq_disable();
42 page_list = image->head;
44 /* we need both effective and real address here */
45 reboot_code_buffer =
46 (unsigned long)page_address(image->control_code_page);
47 reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer);
49 /* copy our kernel relocation code to the control code page */
50 memcpy((void *)reboot_code_buffer, relocate_new_kernel,
51 relocate_new_kernel_size);
53 flush_icache_range(reboot_code_buffer,
54 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
55 printk(KERN_INFO "Bye!\n");
57 /* now call it */
58 rnk = (relocate_new_kernel_t) reboot_code_buffer;
59 (*rnk)(page_list, reboot_code_buffer_phys, image->start);
62 int default_machine_kexec_prepare(struct kimage *image)
64 return 0;