Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 1 | #ifndef _ASM_POWERPC_KEXEC_H |
| 2 | #define _ASM_POWERPC_KEXEC_H |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 3 | #ifdef __KERNEL__ |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 4 | |
Suzuki Poulose | 674bfa4 | 2011-07-18 03:29:20 +0000 | [diff] [blame] | 5 | #if defined(CONFIG_FSL_BOOKE) || defined(CONFIG_44x) |
Sebastian Andrzej Siewior | b3df895 | 2010-04-04 22:19:03 +0200 | [diff] [blame] | 6 | |
| 7 | /* |
| 8 | * On FSL-BookE we setup a 1:1 mapping which covers the first 2GiB of memory |
| 9 | * and therefore we can only deal with memory within this range |
| 10 | */ |
Kumar Gala | 23dcab8 | 2010-07-22 13:30:44 -0500 | [diff] [blame] | 11 | #define KEXEC_SOURCE_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1) |
| 12 | #define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1) |
| 13 | #define KEXEC_CONTROL_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1) |
Sebastian Andrzej Siewior | b3df895 | 2010-04-04 22:19:03 +0200 | [diff] [blame] | 14 | |
| 15 | #else |
| 16 | |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 17 | /* |
| 18 | * Maximum page that is mapped directly into kernel memory. |
| 19 | * XXX: Since we copy virt we can use any page we allocate |
| 20 | */ |
| 21 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) |
| 22 | |
| 23 | /* |
| 24 | * Maximum address we can reach in physical address mode. |
| 25 | * XXX: I want to allow initrd in highmem. Otherwise set to rmo on LPAR. |
| 26 | */ |
| 27 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) |
| 28 | |
| 29 | /* Maximum address we can use for the control code buffer */ |
| 30 | #ifdef __powerpc64__ |
| 31 | #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) |
| 32 | #else |
| 33 | /* TASK_SIZE, probably left over from use_mm ?? */ |
| 34 | #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE |
| 35 | #endif |
Sebastian Andrzej Siewior | b3df895 | 2010-04-04 22:19:03 +0200 | [diff] [blame] | 36 | #endif |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 37 | |
Huang Ying | 163f687 | 2008-08-15 00:40:22 -0700 | [diff] [blame] | 38 | #define KEXEC_CONTROL_PAGE_SIZE 4096 |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 39 | |
| 40 | /* The native architecture */ |
| 41 | #ifdef __powerpc64__ |
| 42 | #define KEXEC_ARCH KEXEC_ARCH_PPC64 |
| 43 | #else |
| 44 | #define KEXEC_ARCH KEXEC_ARCH_PPC |
| 45 | #endif |
| 46 | |
Michael Neuling | 1fc711f | 2010-05-13 19:40:11 +0000 | [diff] [blame] | 47 | #define KEXEC_STATE_NONE 0 |
| 48 | #define KEXEC_STATE_IRQS_OFF 1 |
| 49 | #define KEXEC_STATE_REAL_MODE 2 |
| 50 | |
Michael Ellerman | 2babf5c | 2006-05-17 18:00:46 +1000 | [diff] [blame] | 51 | #ifndef __ASSEMBLY__ |
Anton Vorontsov | 7375331 | 2008-12-17 10:09:01 +0000 | [diff] [blame] | 52 | #include <asm/reg.h> |
Michael Ellerman | 2babf5c | 2006-05-17 18:00:46 +1000 | [diff] [blame] | 53 | |
Arnd Bergmann | aee10c6 | 2008-06-12 19:14:34 +1000 | [diff] [blame] | 54 | typedef void (*crash_shutdown_t)(void); |
| 55 | |
Michael Ellerman | cc53291 | 2005-12-04 18:39:43 +1100 | [diff] [blame] | 56 | #ifdef CONFIG_KEXEC |
| 57 | |
Haren Myneni | 8385a6a | 2006-01-13 19:15:36 -0800 | [diff] [blame] | 58 | /* |
| 59 | * This function is responsible for capturing register states if coming |
| 60 | * via panic or invoking dump using sysrq-trigger. |
| 61 | */ |
| 62 | static inline void crash_setup_regs(struct pt_regs *newregs, |
| 63 | struct pt_regs *oldregs) |
| 64 | { |
| 65 | if (oldregs) |
| 66 | memcpy(newregs, oldregs, sizeof(*newregs)); |
Anton Vorontsov | 7375331 | 2008-12-17 10:09:01 +0000 | [diff] [blame] | 67 | else |
| 68 | ppc_save_regs(newregs); |
Anton Vorontsov | 7375331 | 2008-12-17 10:09:01 +0000 | [diff] [blame] | 69 | } |
Haren Myneni | 8385a6a | 2006-01-13 19:15:36 -0800 | [diff] [blame] | 70 | |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 71 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for |
| 72 | master to copy new code to 0 */ |
Michael Ellerman | cc53291 | 2005-12-04 18:39:43 +1100 | [diff] [blame] | 73 | extern int crashing_cpu; |
| 74 | extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)); |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 75 | |
Michael Ellerman | 3d1229d | 2005-11-14 23:35:00 +1100 | [diff] [blame] | 76 | struct kimage; |
Michael Ellerman | cc53291 | 2005-12-04 18:39:43 +1100 | [diff] [blame] | 77 | struct pt_regs; |
Michael Ellerman | 3d1229d | 2005-11-14 23:35:00 +1100 | [diff] [blame] | 78 | extern void default_machine_kexec(struct kimage *image); |
| 79 | extern int default_machine_kexec_prepare(struct kimage *image); |
Michael Ellerman | cc53291 | 2005-12-04 18:39:43 +1100 | [diff] [blame] | 80 | extern void default_machine_crash_shutdown(struct pt_regs *regs); |
Michael Neuling | 496b010 | 2008-01-18 15:50:30 +1100 | [diff] [blame] | 81 | extern int crash_shutdown_register(crash_shutdown_t handler); |
| 82 | extern int crash_shutdown_unregister(crash_shutdown_t handler); |
Michael Ellerman | cc53291 | 2005-12-04 18:39:43 +1100 | [diff] [blame] | 83 | |
Albert Herranz | 39931e4 | 2006-02-01 03:05:57 -0800 | [diff] [blame] | 84 | extern void machine_kexec_simple(struct kimage *image); |
David Wilder | c0ce7d0 | 2006-06-23 15:29:34 -0700 | [diff] [blame] | 85 | extern void crash_kexec_secondary(struct pt_regs *regs); |
Michael Ellerman | 2babf5c | 2006-05-17 18:00:46 +1000 | [diff] [blame] | 86 | extern int overlaps_crashkernel(unsigned long start, unsigned long size); |
Michael Ellerman | 35dd543 | 2006-05-18 11:16:11 +1000 | [diff] [blame] | 87 | extern void reserve_crashkernel(void); |
Matthew McClintock | c71635d | 2010-09-16 17:58:23 -0500 | [diff] [blame] | 88 | extern void machine_kexec_mask_interrupts(void); |
Albert Herranz | 39931e4 | 2006-02-01 03:05:57 -0800 | [diff] [blame] | 89 | |
Michael Ellerman | 2babf5c | 2006-05-17 18:00:46 +1000 | [diff] [blame] | 90 | #else /* !CONFIG_KEXEC */ |
David Wilder | c0ce7d0 | 2006-06-23 15:29:34 -0700 | [diff] [blame] | 91 | static inline void crash_kexec_secondary(struct pt_regs *regs) { } |
Michael Ellerman | 2babf5c | 2006-05-17 18:00:46 +1000 | [diff] [blame] | 92 | |
| 93 | static inline int overlaps_crashkernel(unsigned long start, unsigned long size) |
| 94 | { |
| 95 | return 0; |
| 96 | } |
| 97 | |
Michael Ellerman | 35dd543 | 2006-05-18 11:16:11 +1000 | [diff] [blame] | 98 | static inline void reserve_crashkernel(void) { ; } |
| 99 | |
Arnd Bergmann | aee10c6 | 2008-06-12 19:14:34 +1000 | [diff] [blame] | 100 | static inline int crash_shutdown_register(crash_shutdown_t handler) |
| 101 | { |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static inline int crash_shutdown_unregister(crash_shutdown_t handler) |
| 106 | { |
| 107 | return 0; |
| 108 | } |
| 109 | |
Haren Myneni | 8385a6a | 2006-01-13 19:15:36 -0800 | [diff] [blame] | 110 | #endif /* CONFIG_KEXEC */ |
Michael Ellerman | 2babf5c | 2006-05-17 18:00:46 +1000 | [diff] [blame] | 111 | #endif /* ! __ASSEMBLY__ */ |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 112 | #endif /* __KERNEL__ */ |
Michael Ellerman | e1df870 | 2005-11-03 15:35:45 +1100 | [diff] [blame] | 113 | #endif /* _ASM_POWERPC_KEXEC_H */ |