kexec.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2019 FORTH-ICS/CARV
  4. * Nick Kossifidis <mick@ics.forth.gr>
  5. */
  6. #ifndef _RISCV_KEXEC_H
  7. #define _RISCV_KEXEC_H
  8. #include <asm/page.h> /* For PAGE_SIZE */
  9. /* Maximum physical address we can use pages from */
  10. #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
  11. /* Maximum address we can reach in physical address mode */
  12. #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
  13. /* Maximum address we can use for the control code buffer */
  14. #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
  15. /* Reserve a page for the control code buffer */
  16. #define KEXEC_CONTROL_PAGE_SIZE PAGE_SIZE
  17. #define KEXEC_ARCH KEXEC_ARCH_RISCV
  18. extern void riscv_crash_save_regs(struct pt_regs *newregs);
  19. static inline void
  20. crash_setup_regs(struct pt_regs *newregs,
  21. struct pt_regs *oldregs)
  22. {
  23. if (oldregs)
  24. memcpy(newregs, oldregs, sizeof(struct pt_regs));
  25. else
  26. riscv_crash_save_regs(newregs);
  27. }
  28. #define ARCH_HAS_KIMAGE_ARCH
  29. struct kimage_arch {
  30. unsigned long fdt_addr;
  31. };
  32. const extern unsigned char riscv_kexec_relocate[];
  33. const extern unsigned int riscv_kexec_relocate_size;
  34. typedef void (*riscv_kexec_method)(unsigned long first_ind_entry,
  35. unsigned long jump_addr,
  36. unsigned long fdt_addr,
  37. unsigned long hartid,
  38. unsigned long va_pa_off);
  39. extern riscv_kexec_method riscv_kexec_norelocate;
  40. #endif