1#ifndef _ASM_POWERPC_KEXEC_H 2#define _ASM_POWERPC_KEXEC_H 3#ifdef __KERNEL__ 4 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 */ 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) 14 15#else 16 17#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) 18 19#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) 20 21/* Maximum address we can use for the control code buffer */ 22#ifdef __powerpc64__ 23#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) 24#else 25/* TASK_SIZE, probably left over from use_mm ?? */ 26#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE 27#endif 28#endif 29 30#define KEXEC_CONTROL_PAGE_SIZE 4096 31 32/* The native architecture */ 33#ifdef __powerpc64__ 34#define KEXEC_ARCH KEXEC_ARCH_PPC64 35#else 36#define KEXEC_ARCH KEXEC_ARCH_PPC 37#endif 38 39#define KEXEC_STATE_NONE 0 40#define KEXEC_STATE_IRQS_OFF 1 41#define KEXEC_STATE_REAL_MODE 2 42 43#ifndef __ASSEMBLY__ 44#include <linux/cpumask.h> 45#include <asm/reg.h> 46 47typedef void (*crash_shutdown_t)(void); 48 49#ifdef CONFIG_KEXEC 50 51/* 52 * This function is responsible for capturing register states if coming 53 * via panic or invoking dump using sysrq-trigger. 54 */ 55static inline void crash_setup_regs(struct pt_regs *newregs, 56 struct pt_regs *oldregs) 57{ 58 if (oldregs) 59 memcpy(newregs, oldregs, sizeof(*newregs)); 60 else 61 ppc_save_regs(newregs); 62} 63 64extern void kexec_smp_wait(void); /* get and clear naca physid, wait for 65 master to copy new code to 0 */ 66extern int crashing_cpu; 67extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)); 68extern cpumask_t cpus_in_sr; 69static inline int kexec_sr_activated(int cpu) 70{ 71 return cpu_isset(cpu,cpus_in_sr); 72} 73 74struct kimage; 75struct pt_regs; 76extern void default_machine_kexec(struct kimage *image); 77extern int default_machine_kexec_prepare(struct kimage *image); 78extern void default_machine_crash_shutdown(struct pt_regs *regs); 79extern int crash_shutdown_register(crash_shutdown_t handler); 80extern int crash_shutdown_unregister(crash_shutdown_t handler); 81 82extern void machine_kexec_simple(struct kimage *image); 83extern void crash_kexec_secondary(struct pt_regs *regs); 84extern int overlaps_crashkernel(unsigned long start, unsigned long size); 85extern void reserve_crashkernel(void); 86 87#else /* !CONFIG_KEXEC */ 88static inline int kexec_sr_activated(int cpu) { return 0; } 89static inline void crash_kexec_secondary(struct pt_regs *regs) { } 90 91static inline int overlaps_crashkernel(unsigned long start, unsigned long size) 92{ 93 return 0; 94} 95 96static inline void reserve_crashkernel(void) { ; } 97 98static inline int crash_shutdown_register(crash_shutdown_t handler) 99{ 100 return 0; 101} 102 103static inline int crash_shutdown_unregister(crash_shutdown_t handler) 104{ 105 return 0; 106} 107 108#endif /* CONFIG_KEXEC */ 109#endif /* ! __ASSEMBLY__ */ 110#endif /* __KERNEL__ */ 111#endif /* _ASM_POWERPC_KEXEC_H */ 112