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 void *fdt
; /* For CONFIG_KEXEC_FILE */
43 unsigned long fdt_addr
;
46 extern const unsigned char riscv_kexec_relocate
[];
47 extern const unsigned int riscv_kexec_relocate_size
;
49 typedef void (*riscv_kexec_method
)(unsigned long first_ind_entry
,
50 unsigned long jump_addr
,
51 unsigned long fdt_addr
,
53 unsigned long va_pa_off
);
55 extern riscv_kexec_method riscv_kexec_norelocate
;
57 #ifdef CONFIG_KEXEC_FILE
58 extern const struct kexec_file_ops elf_kexec_ops
;
60 struct purgatory_info
;
61 int arch_kexec_apply_relocations_add(struct purgatory_info
*pi
,
63 const Elf_Shdr
*relsec
,
64 const Elf_Shdr
*symtab
);
65 #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
68 int arch_kimage_file_post_load_cleanup(struct kimage
*image
);
69 #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup