1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2019 FORTH-ICS/CARV
4 * Nick Kossifidis <mick@ics.forth.gr>
10 #include <asm/page.h> /* For PAGE_SIZE */
12 /* Maximum physical address we can use pages from */
13 #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
15 /* Maximum address we can reach in physical address mode */
16 #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
18 /* Maximum address we can use for the control code buffer */
19 #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
21 /* Reserve a page for the control code buffer */
22 #define KEXEC_CONTROL_PAGE_SIZE PAGE_SIZE
24 #define KEXEC_ARCH KEXEC_ARCH_RISCV
26 extern void riscv_crash_save_regs(struct pt_regs *newregs);
29 crash_setup_regs(struct pt_regs *newregs,
30 struct pt_regs *oldregs)
33 memcpy(newregs, oldregs, sizeof(struct pt_regs));
35 riscv_crash_save_regs(newregs);
39 #define ARCH_HAS_KIMAGE_ARCH
42 unsigned long fdt_addr;
45 extern const unsigned char riscv_kexec_relocate[];
46 extern const unsigned int riscv_kexec_relocate_size;
48 typedef void (*riscv_kexec_method)(unsigned long first_ind_entry,
49 unsigned long jump_addr,
50 unsigned long fdt_addr,
52 unsigned long va_pa_off);
54 extern riscv_kexec_method riscv_kexec_norelocate;
56 #ifdef CONFIG_KEXEC_FILE
57 extern const struct kexec_file_ops elf_kexec_ops;
59 struct purgatory_info;
60 int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
62 const Elf_Shdr *relsec,
63 const Elf_Shdr *symtab);
64 #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add