Merge tag 'drm-vc4-fixes-2016-09-14' of https://github.com/anholt/linux into drm...
[linux-2.6-block.git] / arch / powerpc / include / asm / kexec.h
CommitLineData
e1df870d
ME
1#ifndef _ASM_POWERPC_KEXEC_H
2#define _ASM_POWERPC_KEXEC_H
88ced031 3#ifdef __KERNEL__
e1df870d 4
674bfa48 5#if defined(CONFIG_FSL_BOOKE) || defined(CONFIG_44x)
b3df895a
SAS
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 */
23dcab8f
KG
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)
b3df895a
SAS
14
15#else
16
e1df870d
ME
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
b3df895a 36#endif
e1df870d 37
163f6876 38#define KEXEC_CONTROL_PAGE_SIZE 4096
e1df870d
ME
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
1fc711f7
MN
47#define KEXEC_STATE_NONE 0
48#define KEXEC_STATE_IRQS_OFF 1
49#define KEXEC_STATE_REAL_MODE 2
50
2babf5c2 51#ifndef __ASSEMBLY__
73753313 52#include <asm/reg.h>
2babf5c2 53
aee10c61
AB
54typedef void (*crash_shutdown_t)(void);
55
cc532915
ME
56#ifdef CONFIG_KEXEC
57
8385a6a3
HM
58/*
59 * This function is responsible for capturing register states if coming
60 * via panic or invoking dump using sysrq-trigger.
61 */
62static inline void crash_setup_regs(struct pt_regs *newregs,
63 struct pt_regs *oldregs)
64{
65 if (oldregs)
66 memcpy(newregs, oldregs, sizeof(*newregs));
73753313
AV
67 else
68 ppc_save_regs(newregs);
73753313 69}
8385a6a3 70
e1df870d
ME
71extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
72 master to copy new code to 0 */
cc532915
ME
73extern int crashing_cpu;
74extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
e1df870d 75
3d1229d6 76struct kimage;
cc532915 77struct pt_regs;
3d1229d6
ME
78extern void default_machine_kexec(struct kimage *image);
79extern int default_machine_kexec_prepare(struct kimage *image);
cc532915 80extern void default_machine_crash_shutdown(struct pt_regs *regs);
496b010e
MN
81extern int crash_shutdown_register(crash_shutdown_t handler);
82extern int crash_shutdown_unregister(crash_shutdown_t handler);
cc532915 83
c0ce7d08 84extern void crash_kexec_secondary(struct pt_regs *regs);
2babf5c2 85extern int overlaps_crashkernel(unsigned long start, unsigned long size);
35dd5432 86extern void reserve_crashkernel(void);
c71635d2 87extern void machine_kexec_mask_interrupts(void);
2babf5c2 88
c1caae3d
HB
89static inline bool kdump_in_progress(void)
90{
91 return crashing_cpu >= 0;
92}
93
2babf5c2 94#else /* !CONFIG_KEXEC */
c0ce7d08 95static inline void crash_kexec_secondary(struct pt_regs *regs) { }
2babf5c2
ME
96
97static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
98{
99 return 0;
100}
39931e41 101
35dd5432
ME
102static inline void reserve_crashkernel(void) { ; }
103
aee10c61
AB
104static inline int crash_shutdown_register(crash_shutdown_t handler)
105{
106 return 0;
107}
108
109static inline int crash_shutdown_unregister(crash_shutdown_t handler)
110{
111 return 0;
112}
113
c1caae3d
HB
114static inline bool kdump_in_progress(void)
115{
116 return false;
117}
118
8385a6a3 119#endif /* CONFIG_KEXEC */
2babf5c2 120#endif /* ! __ASSEMBLY__ */
88ced031 121#endif /* __KERNEL__ */
e1df870d 122#endif /* _ASM_POWERPC_KEXEC_H */