kexec.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef _ASM_POWERPC_KEXEC_H
  2. #define _ASM_POWERPC_KEXEC_H
  3. #ifdef __KERNEL__
  4. #if defined(CONFIG_FSL_BOOKE) || defined(CONFIG_44x)
  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 <asm/reg.h>
  43. typedef void (*crash_shutdown_t)(void);
  44. #ifdef CONFIG_KEXEC
  45. /*
  46. * This function is responsible for capturing register states if coming
  47. * via panic or invoking dump using sysrq-trigger.
  48. */
  49. static inline void crash_setup_regs(struct pt_regs *newregs,
  50. struct pt_regs *oldregs)
  51. {
  52. if (oldregs)
  53. memcpy(newregs, oldregs, sizeof(*newregs));
  54. else
  55. ppc_save_regs(newregs);
  56. }
  57. extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
  58. master to copy new code to 0 */
  59. extern int crashing_cpu;
  60. extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
  61. struct kimage;
  62. struct pt_regs;
  63. extern void default_machine_kexec(struct kimage *image);
  64. extern int default_machine_kexec_prepare(struct kimage *image);
  65. extern void default_machine_crash_shutdown(struct pt_regs *regs);
  66. extern int crash_shutdown_register(crash_shutdown_t handler);
  67. extern int crash_shutdown_unregister(crash_shutdown_t handler);
  68. extern void machine_kexec_simple(struct kimage *image);
  69. extern void crash_kexec_secondary(struct pt_regs *regs);
  70. extern int overlaps_crashkernel(unsigned long start, unsigned long size);
  71. extern void reserve_crashkernel(void);
  72. extern void machine_kexec_mask_interrupts(void);
  73. #else /* !CONFIG_KEXEC */
  74. static inline void crash_kexec_secondary(struct pt_regs *regs) { }
  75. static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
  76. {
  77. return 0;
  78. }
  79. static inline void reserve_crashkernel(void) { ; }
  80. static inline int crash_shutdown_register(crash_shutdown_t handler)
  81. {
  82. return 0;
  83. }
  84. static inline int crash_shutdown_unregister(crash_shutdown_t handler)
  85. {
  86. return 0;
  87. }
  88. #endif /* CONFIG_KEXEC */
  89. #endif /* ! __ASSEMBLY__ */
  90. #endif /* __KERNEL__ */
  91. #endif /* _ASM_POWERPC_KEXEC_H */