kexec.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef CONFIG_KEXEC_FILE
  36. extern const struct kexec_file_ops kexec_efi_ops;
  37. extern const struct kexec_file_ops kexec_elf_ops;
  38. int arch_kimage_file_post_load_cleanup(struct kimage *image);
  39. #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
  40. extern int load_other_segments(struct kimage *image,
  41. unsigned long kernel_load_addr, unsigned long kernel_size,
  42. char *initrd, unsigned long initrd_len, char *cmdline, unsigned long cmdline_len);
  43. #endif
  44. typedef void (*do_kexec_t)(unsigned long efi_boot,
  45. unsigned long cmdline_ptr,
  46. unsigned long systable_ptr,
  47. unsigned long start_addr,
  48. unsigned long first_ind_entry);
  49. struct kimage;
  50. extern const unsigned char relocate_new_kernel[];
  51. extern const size_t relocate_new_kernel_size;
  52. extern void kexec_reboot(void);
  53. #ifdef CONFIG_SMP
  54. extern atomic_t kexec_ready_to_reboot;
  55. extern const unsigned char kexec_smp_wait[];
  56. #endif
  57. #endif /* !_ASM_KEXEC_H */