blob: 076327f2eff777b2cdbd4e15de8336ce7b03faa6 [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
Sebastian Andrzej Siewiorb3df8952010-04-04 22:19:03 +02005#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 */
Kumar Gala23dcab82010-07-22 13:30:44 -050011#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 Siewiorb3df8952010-04-04 22:19:03 +020014
15#else
16
Michael Ellermane1df8702005-11-03 15:35:45 +110017/*
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 Siewiorb3df8952010-04-04 22:19:03 +020036#endif
Michael Ellermane1df8702005-11-03 15:35:45 +110037
Huang Ying163f6872008-08-15 00:40:22 -070038#define KEXEC_CONTROL_PAGE_SIZE 4096
Michael Ellermane1df8702005-11-03 15:35:45 +110039
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 Neuling1fc711f2010-05-13 19:40:11 +000047#define KEXEC_STATE_NONE 0
48#define KEXEC_STATE_IRQS_OFF 1
49#define KEXEC_STATE_REAL_MODE 2
50
Michael Ellerman2babf5c2006-05-17 18:00:46 +100051#ifndef __ASSEMBLY__
Michael Ellermanb6f35b42006-07-05 14:39:43 +100052#include <linux/cpumask.h>
Anton Vorontsov73753312008-12-17 10:09:01 +000053#include <asm/reg.h>
Michael Ellerman2babf5c2006-05-17 18:00:46 +100054
Arnd Bergmannaee10c62008-06-12 19:14:34 +100055typedef void (*crash_shutdown_t)(void);
56
Michael Ellermancc532912005-12-04 18:39:43 +110057#ifdef CONFIG_KEXEC
58
Haren Myneni8385a6a2006-01-13 19:15:36 -080059/*
60 * This function is responsible for capturing register states if coming
61 * via panic or invoking dump using sysrq-trigger.
62 */
63static inline void crash_setup_regs(struct pt_regs *newregs,
64 struct pt_regs *oldregs)
65{
66 if (oldregs)
67 memcpy(newregs, oldregs, sizeof(*newregs));
Anton Vorontsov73753312008-12-17 10:09:01 +000068 else
69 ppc_save_regs(newregs);
Anton Vorontsov73753312008-12-17 10:09:01 +000070}
Haren Myneni8385a6a2006-01-13 19:15:36 -080071
Michael Ellermane1df8702005-11-03 15:35:45 +110072extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
73 master to copy new code to 0 */
Michael Ellermancc532912005-12-04 18:39:43 +110074extern int crashing_cpu;
75extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
David Wilderc0ce7d02006-06-23 15:29:34 -070076extern cpumask_t cpus_in_sr;
77static inline int kexec_sr_activated(int cpu)
78{
79 return cpu_isset(cpu,cpus_in_sr);
80}
Michael Ellermane1df8702005-11-03 15:35:45 +110081
Michael Ellerman3d1229d2005-11-14 23:35:00 +110082struct kimage;
Michael Ellermancc532912005-12-04 18:39:43 +110083struct pt_regs;
Michael Ellerman3d1229d2005-11-14 23:35:00 +110084extern void default_machine_kexec(struct kimage *image);
85extern int default_machine_kexec_prepare(struct kimage *image);
Michael Ellermancc532912005-12-04 18:39:43 +110086extern void default_machine_crash_shutdown(struct pt_regs *regs);
Michael Neuling496b0102008-01-18 15:50:30 +110087extern int crash_shutdown_register(crash_shutdown_t handler);
88extern int crash_shutdown_unregister(crash_shutdown_t handler);
Michael Ellermancc532912005-12-04 18:39:43 +110089
Albert Herranz39931e42006-02-01 03:05:57 -080090extern void machine_kexec_simple(struct kimage *image);
David Wilderc0ce7d02006-06-23 15:29:34 -070091extern void crash_kexec_secondary(struct pt_regs *regs);
Michael Ellerman2babf5c2006-05-17 18:00:46 +100092extern int overlaps_crashkernel(unsigned long start, unsigned long size);
Michael Ellerman35dd5432006-05-18 11:16:11 +100093extern void reserve_crashkernel(void);
Albert Herranz39931e42006-02-01 03:05:57 -080094
Michael Ellerman2babf5c2006-05-17 18:00:46 +100095#else /* !CONFIG_KEXEC */
David Wilderc0ce7d02006-06-23 15:29:34 -070096static inline int kexec_sr_activated(int cpu) { return 0; }
97static inline void crash_kexec_secondary(struct pt_regs *regs) { }
Michael Ellerman2babf5c2006-05-17 18:00:46 +100098
99static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
100{
101 return 0;
102}
103
Michael Ellerman35dd5432006-05-18 11:16:11 +1000104static inline void reserve_crashkernel(void) { ; }
105
Arnd Bergmannaee10c62008-06-12 19:14:34 +1000106static inline int crash_shutdown_register(crash_shutdown_t handler)
107{
108 return 0;
109}
110
111static inline int crash_shutdown_unregister(crash_shutdown_t handler)
112{
113 return 0;
114}
115
Haren Myneni8385a6a2006-01-13 19:15:36 -0800116#endif /* CONFIG_KEXEC */
Michael Ellerman2babf5c2006-05-17 18:00:46 +1000117#endif /* ! __ASSEMBLY__ */
Arnd Bergmann88ced032005-12-16 22:43:46 +0100118#endif /* __KERNEL__ */
Michael Ellermane1df8702005-11-03 15:35:45 +1100119#endif /* _ASM_POWERPC_KEXEC_H */