blob: 7e06b43720d3ce0ce439c50b4ba980f6e398fc01 [file] [log] [blame]
Michael Ellermane1df8702005-11-03 15:35:45 +11001#ifndef _ASM_POWERPC_KEXEC_H
2#define _ASM_POWERPC_KEXEC_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01003#ifdef __KERNEL__
Michael Ellermane1df8702005-11-03 15:35:45 +11004
5/*
6 * Maximum page that is mapped directly into kernel memory.
7 * XXX: Since we copy virt we can use any page we allocate
8 */
9#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
10
11/*
12 * Maximum address we can reach in physical address mode.
13 * XXX: I want to allow initrd in highmem. Otherwise set to rmo on LPAR.
14 */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
16
17/* Maximum address we can use for the control code buffer */
18#ifdef __powerpc64__
19#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
20#else
21/* TASK_SIZE, probably left over from use_mm ?? */
22#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
23#endif
24
Huang Ying163f6872008-08-15 00:40:22 -070025#define KEXEC_CONTROL_PAGE_SIZE 4096
Michael Ellermane1df8702005-11-03 15:35:45 +110026
27/* The native architecture */
28#ifdef __powerpc64__
29#define KEXEC_ARCH KEXEC_ARCH_PPC64
30#else
31#define KEXEC_ARCH KEXEC_ARCH_PPC
32#endif
33
Michael Ellerman2babf5c2006-05-17 18:00:46 +100034#ifndef __ASSEMBLY__
Michael Ellermanb6f35b42006-07-05 14:39:43 +100035#include <linux/cpumask.h>
Anton Vorontsov73753312008-12-17 10:09:01 +000036#include <asm/reg.h>
Michael Ellerman2babf5c2006-05-17 18:00:46 +100037
Arnd Bergmannaee10c62008-06-12 19:14:34 +100038typedef void (*crash_shutdown_t)(void);
39
Michael Ellermancc532912005-12-04 18:39:43 +110040#ifdef CONFIG_KEXEC
41
Haren Myneni8385a6a2006-01-13 19:15:36 -080042/*
43 * This function is responsible for capturing register states if coming
44 * via panic or invoking dump using sysrq-trigger.
45 */
46static inline void crash_setup_regs(struct pt_regs *newregs,
47 struct pt_regs *oldregs)
48{
49 if (oldregs)
50 memcpy(newregs, oldregs, sizeof(*newregs));
Anton Vorontsov73753312008-12-17 10:09:01 +000051 else
52 ppc_save_regs(newregs);
Anton Vorontsov73753312008-12-17 10:09:01 +000053}
Haren Myneni8385a6a2006-01-13 19:15:36 -080054
Michael Ellermane1df8702005-11-03 15:35:45 +110055extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
56 master to copy new code to 0 */
Michael Ellermancc532912005-12-04 18:39:43 +110057extern int crashing_cpu;
58extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
David Wilderc0ce7d02006-06-23 15:29:34 -070059extern cpumask_t cpus_in_sr;
60static inline int kexec_sr_activated(int cpu)
61{
62 return cpu_isset(cpu,cpus_in_sr);
63}
Michael Ellermane1df8702005-11-03 15:35:45 +110064
Michael Ellerman3d1229d2005-11-14 23:35:00 +110065struct kimage;
Michael Ellermancc532912005-12-04 18:39:43 +110066struct pt_regs;
Michael Ellerman3d1229d2005-11-14 23:35:00 +110067extern void default_machine_kexec(struct kimage *image);
68extern int default_machine_kexec_prepare(struct kimage *image);
Michael Ellermancc532912005-12-04 18:39:43 +110069extern void default_machine_crash_shutdown(struct pt_regs *regs);
Michael Neuling496b0102008-01-18 15:50:30 +110070extern int crash_shutdown_register(crash_shutdown_t handler);
71extern int crash_shutdown_unregister(crash_shutdown_t handler);
Michael Ellermancc532912005-12-04 18:39:43 +110072
Albert Herranz39931e42006-02-01 03:05:57 -080073extern void machine_kexec_simple(struct kimage *image);
David Wilderc0ce7d02006-06-23 15:29:34 -070074extern void crash_kexec_secondary(struct pt_regs *regs);
Michael Ellerman2babf5c2006-05-17 18:00:46 +100075extern int overlaps_crashkernel(unsigned long start, unsigned long size);
Michael Ellerman35dd5432006-05-18 11:16:11 +100076extern void reserve_crashkernel(void);
Albert Herranz39931e42006-02-01 03:05:57 -080077
Michael Ellerman2babf5c2006-05-17 18:00:46 +100078#else /* !CONFIG_KEXEC */
David Wilderc0ce7d02006-06-23 15:29:34 -070079static inline int kexec_sr_activated(int cpu) { return 0; }
80static inline void crash_kexec_secondary(struct pt_regs *regs) { }
Michael Ellerman2babf5c2006-05-17 18:00:46 +100081
82static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
83{
84 return 0;
85}
86
Michael Ellerman35dd5432006-05-18 11:16:11 +100087static inline void reserve_crashkernel(void) { ; }
88
Arnd Bergmannaee10c62008-06-12 19:14:34 +100089static inline int crash_shutdown_register(crash_shutdown_t handler)
90{
91 return 0;
92}
93
94static inline int crash_shutdown_unregister(crash_shutdown_t handler)
95{
96 return 0;
97}
98
Haren Myneni8385a6a2006-01-13 19:15:36 -080099#endif /* CONFIG_KEXEC */
Michael Ellerman2babf5c2006-05-17 18:00:46 +1000100#endif /* ! __ASSEMBLY__ */
Arnd Bergmann88ced032005-12-16 22:43:46 +0100101#endif /* __KERNEL__ */
Michael Ellermane1df8702005-11-03 15:35:45 +1100102#endif /* _ASM_POWERPC_KEXEC_H */