kexec.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _ARM_KEXEC_H
  2. #define _ARM_KEXEC_H
  3. #ifdef CONFIG_KEXEC
  4. /* Maximum physical address we can use pages from */
  5. #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
  6. /* Maximum address we can reach in physical address mode */
  7. #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
  8. /* Maximum address we can use for the control code buffer */
  9. #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
  10. #define KEXEC_CONTROL_PAGE_SIZE 4096
  11. #define KEXEC_ARCH KEXEC_ARCH_ARM
  12. #define KEXEC_ARM_ATAGS_OFFSET 0x1000
  13. #define KEXEC_ARM_ZIMAGE_OFFSET 0x8000
  14. #ifndef __ASSEMBLY__
  15. /**
  16. * crash_setup_regs() - save registers for the panic kernel
  17. * @newregs: registers are saved here
  18. * @oldregs: registers to be saved (may be %NULL)
  19. *
  20. * Function copies machine registers from @oldregs to @newregs. If @oldregs is
  21. * %NULL then current registers are stored there.
  22. */
  23. static inline void crash_setup_regs(struct pt_regs *newregs,
  24. struct pt_regs *oldregs)
  25. {
  26. if (oldregs) {
  27. memcpy(newregs, oldregs, sizeof(*newregs));
  28. } else {
  29. __asm__ __volatile__ (
  30. "stmia %[regs_base], {r0-r12}\n\t"
  31. "mov %[_ARM_sp], sp\n\t"
  32. "str lr, %[_ARM_lr]\n\t"
  33. "adr %[_ARM_pc], 1f\n\t"
  34. "mrs %[_ARM_cpsr], cpsr\n\t"
  35. "1:"
  36. : [_ARM_pc] "=r" (newregs->ARM_pc),
  37. [_ARM_cpsr] "=r" (newregs->ARM_cpsr),
  38. [_ARM_sp] "=r" (newregs->ARM_sp),
  39. [_ARM_lr] "=o" (newregs->ARM_lr)
  40. : [regs_base] "r" (&newregs->ARM_r0)
  41. : "memory"
  42. );
  43. }
  44. }
  45. /* Function pointer to optional machine-specific reinitialization */
  46. extern void (*kexec_reinit)(void);
  47. static inline unsigned long phys_to_boot_phys(phys_addr_t phys)
  48. {
  49. return phys_to_idmap(phys);
  50. }
  51. #define phys_to_boot_phys phys_to_boot_phys
  52. static inline phys_addr_t boot_phys_to_phys(unsigned long entry)
  53. {
  54. return idmap_to_phys(entry);
  55. }
  56. #define boot_phys_to_phys boot_phys_to_phys
  57. static inline unsigned long page_to_boot_pfn(struct page *page)
  58. {
  59. return page_to_pfn(page) + (arch_phys_to_idmap_offset >> PAGE_SHIFT);
  60. }
  61. #define page_to_boot_pfn page_to_boot_pfn
  62. static inline struct page *boot_pfn_to_page(unsigned long boot_pfn)
  63. {
  64. return pfn_to_page(boot_pfn - (arch_phys_to_idmap_offset >> PAGE_SHIFT));
  65. }
  66. #define boot_pfn_to_page boot_pfn_to_page
  67. #endif /* __ASSEMBLY__ */
  68. #endif /* CONFIG_KEXEC */
  69. #endif /* _ARM_KEXEC_H */