]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/powerpc/include/asm/kexec.h
Merge git://git.infradead.org/users/cbou/battery-2.6.35
[net-next-2.6.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
b3df895a
SAS
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 */
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__
b6f35b49 52#include <linux/cpumask.h>
73753313 53#include <asm/reg.h>
2babf5c2 54
aee10c61
AB
55typedef void (*crash_shutdown_t)(void);
56
cc532915
ME
57#ifdef CONFIG_KEXEC
58
8385a6a3
HM
59/*
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));
73753313
AV
68 else
69 ppc_save_regs(newregs);
73753313 70}
8385a6a3 71
e1df870d
ME
72extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
73 master to copy new code to 0 */
cc532915
ME
74extern int crashing_cpu;
75extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
c0ce7d08
DW
76extern cpumask_t cpus_in_sr;
77static inline int kexec_sr_activated(int cpu)
78{
79 return cpu_isset(cpu,cpus_in_sr);
80}
e1df870d 81
3d1229d6 82struct kimage;
cc532915 83struct pt_regs;
3d1229d6
ME
84extern void default_machine_kexec(struct kimage *image);
85extern int default_machine_kexec_prepare(struct kimage *image);
cc532915 86extern void default_machine_crash_shutdown(struct pt_regs *regs);
496b010e
MN
87extern int crash_shutdown_register(crash_shutdown_t handler);
88extern int crash_shutdown_unregister(crash_shutdown_t handler);
cc532915 89
39931e41 90extern void machine_kexec_simple(struct kimage *image);
c0ce7d08 91extern void crash_kexec_secondary(struct pt_regs *regs);
2babf5c2 92extern int overlaps_crashkernel(unsigned long start, unsigned long size);
35dd5432 93extern void reserve_crashkernel(void);
2babf5c2
ME
94
95#else /* !CONFIG_KEXEC */
c0ce7d08
DW
96static inline int kexec_sr_activated(int cpu) { return 0; }
97static inline void crash_kexec_secondary(struct pt_regs *regs) { }
2babf5c2
ME
98
99static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
100{
101 return 0;
102}
39931e41 103
35dd5432
ME
104static inline void reserve_crashkernel(void) { ; }
105
aee10c61
AB
106static 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
8385a6a3 116#endif /* CONFIG_KEXEC */
2babf5c2 117#endif /* ! __ASSEMBLY__ */
88ced031 118#endif /* __KERNEL__ */
e1df870d 119#endif /* _ASM_POWERPC_KEXEC_H */