Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / arch / powerpc / include / asm / kexec.h
1 #ifndef _ASM_POWERPC_KEXEC_H
2 #define _ASM_POWERPC_KEXEC_H
3 #ifdef __KERNEL__
4
5 #ifdef CONFIG_FSL_BOOKE
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  */
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)
14
15 #else
16
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
36 #endif
37
38 #define KEXEC_CONTROL_PAGE_SIZE 4096
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
47 #define KEXEC_STATE_NONE 0
48 #define KEXEC_STATE_IRQS_OFF 1
49 #define KEXEC_STATE_REAL_MODE 2
50
51 #ifndef __ASSEMBLY__
52 #include <linux/cpumask.h>
53 #include <asm/reg.h>
54
55 typedef void (*crash_shutdown_t)(void);
56
57 #ifdef CONFIG_KEXEC
58
59 /*
60  * This function is responsible for capturing register states if coming
61  * via panic or invoking dump using sysrq-trigger.
62  */
63 static inline void crash_setup_regs(struct pt_regs *newregs,
64                                         struct pt_regs *oldregs)
65 {
66         if (oldregs)
67                 memcpy(newregs, oldregs, sizeof(*newregs));
68         else
69                 ppc_save_regs(newregs);
70 }
71
72 extern void kexec_smp_wait(void);       /* get and clear naca physid, wait for
73                                           master to copy new code to 0 */
74 extern int crashing_cpu;
75 extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
76 extern cpumask_t cpus_in_sr;
77 static inline int kexec_sr_activated(int cpu)
78 {
79         return cpu_isset(cpu,cpus_in_sr);
80 }
81
82 struct kimage;
83 struct pt_regs;
84 extern void default_machine_kexec(struct kimage *image);
85 extern int default_machine_kexec_prepare(struct kimage *image);
86 extern void default_machine_crash_shutdown(struct pt_regs *regs);
87 extern int crash_shutdown_register(crash_shutdown_t handler);
88 extern int crash_shutdown_unregister(crash_shutdown_t handler);
89
90 extern void machine_kexec_simple(struct kimage *image);
91 extern void crash_kexec_secondary(struct pt_regs *regs);
92 extern int overlaps_crashkernel(unsigned long start, unsigned long size);
93 extern void reserve_crashkernel(void);
94 extern void machine_kexec_mask_interrupts(void);
95
96 #else /* !CONFIG_KEXEC */
97 static inline int kexec_sr_activated(int cpu) { return 0; }
98 static inline void crash_kexec_secondary(struct pt_regs *regs) { }
99
100 static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
101 {
102         return 0;
103 }
104
105 static inline void reserve_crashkernel(void) { ; }
106
107 static inline int crash_shutdown_register(crash_shutdown_t handler)
108 {
109         return 0;
110 }
111
112 static inline int crash_shutdown_unregister(crash_shutdown_t handler)
113 {
114         return 0;
115 }
116
117 #endif /* CONFIG_KEXEC */
118 #endif /* ! __ASSEMBLY__ */
119 #endif /* __KERNEL__ */
120 #endif /* _ASM_POWERPC_KEXEC_H */