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 27static 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 38struct kimage_arch { 39 unsigned long efi_boot; 40 unsigned long cmdline_ptr; 41 unsigned long systable_ptr; 42}; 43 44typedef 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 50struct kimage; 51extern const unsigned char relocate_new_kernel[]; 52extern const size_t relocate_new_kernel_size; 53extern void kexec_reboot(void); 54 55#ifdef CONFIG_SMP 56extern atomic_t kexec_ready_to_reboot; 57extern const unsigned char kexec_smp_wait[]; 58#endif 59 60#endif /* !_ASM_KEXEC_H */ 61