blob: a6ca6da1430bd60506af9b5babc62df147c8c9f7 [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 Neuling1fc711f2010-05-13 19:40:11 +000034#define KEXEC_STATE_NONE 0
35#define KEXEC_STATE_IRQS_OFF 1
36#define KEXEC_STATE_REAL_MODE 2
37
Michael Ellerman2babf5c2006-05-17 18:00:46 +100038#ifndef __ASSEMBLY__
Michael Ellermanb6f35b42006-07-05 14:39:43 +100039#include <linux/cpumask.h>
Anton Vorontsov73753312008-12-17 10:09:01 +000040#include <asm/reg.h>
Michael Ellerman2babf5c2006-05-17 18:00:46 +100041
Arnd Bergmannaee10c62008-06-12 19:14:34 +100042typedef void (*crash_shutdown_t)(void);
43
Michael Ellermancc532912005-12-04 18:39:43 +110044#ifdef CONFIG_KEXEC
45
Haren Myneni8385a6a2006-01-13 19:15:36 -080046/*
47 * This function is responsible for capturing register states if coming
48 * via panic or invoking dump using sysrq-trigger.
49 */
50static inline void crash_setup_regs(struct pt_regs *newregs,
51 struct pt_regs *oldregs)
52{
53 if (oldregs)
54 memcpy(newregs, oldregs, sizeof(*newregs));
Anton Vorontsov73753312008-12-17 10:09:01 +000055 else
56 ppc_save_regs(newregs);
Anton Vorontsov73753312008-12-17 10:09:01 +000057}
Haren Myneni8385a6a2006-01-13 19:15:36 -080058
Michael Ellermane1df8702005-11-03 15:35:45 +110059extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
60 master to copy new code to 0 */
Michael Ellermancc532912005-12-04 18:39:43 +110061extern int crashing_cpu;
62extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
David Wilderc0ce7d02006-06-23 15:29:34 -070063extern cpumask_t cpus_in_sr;
64static inline int kexec_sr_activated(int cpu)
65{
66 return cpu_isset(cpu,cpus_in_sr);
67}
Michael Ellermane1df8702005-11-03 15:35:45 +110068
Michael Ellerman3d1229d2005-11-14 23:35:00 +110069struct kimage;
Michael Ellermancc532912005-12-04 18:39:43 +110070struct pt_regs;
Michael Ellerman3d1229d2005-11-14 23:35:00 +110071extern void default_machine_kexec(struct kimage *image);
72extern int default_machine_kexec_prepare(struct kimage *image);
Michael Ellermancc532912005-12-04 18:39:43 +110073extern void default_machine_crash_shutdown(struct pt_regs *regs);
Michael Neuling496b0102008-01-18 15:50:30 +110074extern int crash_shutdown_register(crash_shutdown_t handler);
75extern int crash_shutdown_unregister(crash_shutdown_t handler);
Michael Ellermancc532912005-12-04 18:39:43 +110076
Albert Herranz39931e42006-02-01 03:05:57 -080077extern void machine_kexec_simple(struct kimage *image);
David Wilderc0ce7d02006-06-23 15:29:34 -070078extern void crash_kexec_secondary(struct pt_regs *regs);
Michael Ellerman2babf5c2006-05-17 18:00:46 +100079extern int overlaps_crashkernel(unsigned long start, unsigned long size);
Michael Ellerman35dd5432006-05-18 11:16:11 +100080extern void reserve_crashkernel(void);
Albert Herranz39931e42006-02-01 03:05:57 -080081
Michael Ellerman2babf5c2006-05-17 18:00:46 +100082#else /* !CONFIG_KEXEC */
David Wilderc0ce7d02006-06-23 15:29:34 -070083static inline int kexec_sr_activated(int cpu) { return 0; }
84static inline void crash_kexec_secondary(struct pt_regs *regs) { }
Michael Ellerman2babf5c2006-05-17 18:00:46 +100085
86static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
87{
88 return 0;
89}
90
Michael Ellerman35dd5432006-05-18 11:16:11 +100091static inline void reserve_crashkernel(void) { ; }
92
Arnd Bergmannaee10c62008-06-12 19:14:34 +100093static inline int crash_shutdown_register(crash_shutdown_t handler)
94{
95 return 0;
96}
97
98static inline int crash_shutdown_unregister(crash_shutdown_t handler)
99{
100 return 0;
101}
102
Haren Myneni8385a6a2006-01-13 19:15:36 -0800103#endif /* CONFIG_KEXEC */
Michael Ellerman2babf5c2006-05-17 18:00:46 +1000104#endif /* ! __ASSEMBLY__ */
Arnd Bergmann88ced032005-12-16 22:43:46 +0100105#endif /* __KERNEL__ */
Michael Ellermane1df8702005-11-03 15:35:45 +1100106#endif /* _ASM_POWERPC_KEXEC_H */