kexec.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * kexec.h for kexec
  4. *
  5. * Copyright (C) 2022 Loongson Technology Corporation Limited
  6. */
  7. #ifndef _ASM_KEXEC_H
  8. #define _ASM_KEXEC_H
  9. #include <asm/stacktrace.h>
  10. #include <asm/page.h>
  11. /* Maximum physical address we can use pages from */
  12. #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
  13. /* Maximum address we can reach in physical address mode */
  14. #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
  15. /* Maximum address we can use for the control code buffer */
  16. #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
  17. /* Reserve a page for the control code buffer */
  18. #define KEXEC_CONTROL_PAGE_SIZE PAGE_SIZE
  19. /* The native architecture */
  20. #define KEXEC_ARCH KEXEC_ARCH_LOONGARCH
  21. static inline void crash_setup_regs(struct pt_regs *newregs,
  22. struct pt_regs *oldregs)
  23. {
  24. if (oldregs)
  25. memcpy(newregs, oldregs, sizeof(*newregs));
  26. else
  27. prepare_frametrace(newregs);
  28. }
  29. #define ARCH_HAS_KIMAGE_ARCH
  30. struct kimage_arch {
  31. unsigned long efi_boot;
  32. unsigned long cmdline_ptr;
  33. unsigned long systable_ptr;
  34. };
  35. typedef void (*do_kexec_t)(unsigned long efi_boot,
  36. unsigned long cmdline_ptr,
  37. unsigned long systable_ptr,
  38. unsigned long start_addr,
  39. unsigned long first_ind_entry);
  40. struct kimage;
  41. extern const unsigned char relocate_new_kernel[];
  42. extern const size_t relocate_new_kernel_size;
  43. extern void kexec_reboot(void);
  44. #ifdef CONFIG_SMP
  45. extern atomic_t kexec_ready_to_reboot;
  46. extern const unsigned char kexec_smp_wait[];
  47. #endif
  48. #endif /* !_ASM_KEXEC_H */