Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|---|
| 2 | /* |
| 3 | * kexec.h for kexec |
| 4 | * |
| 5 | * Copyright (C) 2022 Loongson Technology Corporation Limited |
| 6 | */ |
| 7 | |
| 8 | #ifndef _ASM_KEXEC_H |
| 9 | #define _ASM_KEXEC_H |
| 10 | |
| 11 | #include <asm/stacktrace.h> |
| 12 | #include <asm/page.h> |
| 13 | |
| 14 | /* Maximum physical address we can use pages from */ |
| 15 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) |
| 16 | /* Maximum address we can reach in physical address mode */ |
| 17 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) |
| 18 | /* Maximum address we can use for the control code buffer */ |
| 19 | #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) |
| 20 | |
| 21 | /* Reserve a page for the control code buffer */ |
| 22 | #define KEXEC_CONTROL_PAGE_SIZE PAGE_SIZE |
| 23 | |
| 24 | /* The native architecture */ |
| 25 | #define KEXEC_ARCH KEXEC_ARCH_LOONGARCH |
| 26 | |
| 27 | static inline void crash_setup_regs(struct pt_regs *newregs, |
| 28 | struct pt_regs *oldregs) |
| 29 | { |
| 30 | if (oldregs) |
| 31 | memcpy(newregs, oldregs, sizeof(*newregs)); |
| 32 | else |
| 33 | prepare_frametrace(newregs); |
| 34 | } |
| 35 | |
| 36 | #define ARCH_HAS_KIMAGE_ARCH |
| 37 | |
| 38 | struct kimage_arch { |
| 39 | unsigned long efi_boot; |
| 40 | unsigned long cmdline_ptr; |
| 41 | unsigned long systable_ptr; |
| 42 | }; |
| 43 | |
| 44 | #ifdef CONFIG_KEXEC_FILE |
| 45 | extern const struct kexec_file_ops kexec_efi_ops; |
| 46 | extern const struct kexec_file_ops kexec_elf_ops; |
| 47 | |
| 48 | int arch_kimage_file_post_load_cleanup(struct kimage *image); |
| 49 | #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup |
| 50 | |
| 51 | extern int load_other_segments(struct kimage *image, |
| 52 | unsigned long kernel_load_addr, unsigned long kernel_size, |
| 53 | char *initrd, unsigned long initrd_len, char *cmdline, unsigned long cmdline_len); |
| 54 | #endif |
| 55 | |
| 56 | typedef void (*do_kexec_t)(unsigned long efi_boot, |
| 57 | unsigned long cmdline_ptr, |
| 58 | unsigned long systable_ptr, |
| 59 | unsigned long start_addr, |
| 60 | unsigned long first_ind_entry); |
| 61 | |
| 62 | struct kimage; |
| 63 | extern const unsigned char relocate_new_kernel[]; |
| 64 | extern const size_t relocate_new_kernel_size; |
| 65 | extern void kexec_reboot(void); |
| 66 | |
| 67 | #ifdef CONFIG_SMP |
| 68 | extern atomic_t kexec_ready_to_reboot; |
| 69 | extern const unsigned char kexec_smp_wait[]; |
| 70 | #endif |
| 71 | |
| 72 | #endif /* !_ASM_KEXEC_H */ |
| 73 |
Warning: This file is not a C or C++ file. It does not have highlighting.
