kexec.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef _ASM_POWERPC_KEXEC_H
  2. #define _ASM_POWERPC_KEXEC_H
  3. #ifdef __KERNEL__
  4. #ifdef CONFIG_FSL_BOOKE
  5. /*
  6. * On FSL-BookE we setup a 1:1 mapping which covers the first 2GiB of memory
  7. * and therefore we can only deal with memory within this range
  8. */
  9. #define KEXEC_SOURCE_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
  10. #define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
  11. #define KEXEC_CONTROL_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
  12. #else
  13. /*
  14. * Maximum page that is mapped directly into kernel memory.
  15. * XXX: Since we copy virt we can use any page we allocate
  16. */
  17. #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
  18. /*
  19. * Maximum address we can reach in physical address mode.
  20. * XXX: I want to allow initrd in highmem. Otherwise set to rmo on LPAR.
  21. */
  22. #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
  23. /* Maximum address we can use for the control code buffer */
  24. #ifdef __powerpc64__
  25. #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
  26. #else
  27. /* TASK_SIZE, probably left over from use_mm ?? */
  28. #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
  29. #endif
  30. #endif
  31. #define KEXEC_CONTROL_PAGE_SIZE 4096
  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. #define KEXEC_STATE_NONE 0
  39. #define KEXEC_STATE_IRQS_OFF 1
  40. #define KEXEC_STATE_REAL_MODE 2
  41. #ifndef __ASSEMBLY__
  42. #include <linux/cpumask.h>
  43. #include <asm/reg.h>
  44. typedef void (*crash_shutdown_t)(void);
  45. #ifdef CONFIG_KEXEC
  46. /*
  47. * This function is responsible for capturing register states if coming
  48. * via panic or invoking dump using sysrq-trigger.
  49. */
  50. static inline void crash_setup_regs(struct pt_regs *newregs,
  51. struct pt_regs *oldregs)
  52. {
  53. if (oldregs)
  54. memcpy(newregs, oldregs, sizeof(*newregs));
  55. else
  56. ppc_save_regs(newregs);
  57. }
  58. extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
  59. master to copy new code to 0 */
  60. extern int crashing_cpu;
  61. extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
  62. extern cpumask_t cpus_in_sr;
  63. static inline int kexec_sr_activated(int cpu)
  64. {
  65. return cpu_isset(cpu,cpus_in_sr);
  66. }
  67. struct kimage;
  68. struct pt_regs;
  69. extern void default_machine_kexec(struct kimage *image);
  70. extern int default_machine_kexec_prepare(struct kimage *image);
  71. extern void default_machine_crash_shutdown(struct pt_regs *regs);
  72. extern int crash_shutdown_register(crash_shutdown_t handler);
  73. extern int crash_shutdown_unregister(crash_shutdown_t handler);
  74. extern void machine_kexec_simple(struct kimage *image);
  75. extern void crash_kexec_secondary(struct pt_regs *regs);
  76. extern int overlaps_crashkernel(unsigned long start, unsigned long size);
  77. extern void reserve_crashkernel(void);
  78. #else /* !CONFIG_KEXEC */
  79. static inline int kexec_sr_activated(int cpu) { return 0; }
  80. static inline void crash_kexec_secondary(struct pt_regs *regs) { }
  81. static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
  82. {
  83. return 0;
  84. }
  85. static inline void reserve_crashkernel(void) { ; }
  86. static inline int crash_shutdown_register(crash_shutdown_t handler)
  87. {
  88. return 0;
  89. }
  90. static inline int crash_shutdown_unregister(crash_shutdown_t handler)
  91. {
  92. return 0;
  93. }
  94. #endif /* CONFIG_KEXEC */
  95. #endif /* ! __ASSEMBLY__ */
  96. #endif /* __KERNEL__ */
  97. #endif /* _ASM_POWERPC_KEXEC_H */