18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * kexec.h for kexec
48c2ecf20Sopenharmony_ci * Created by <nschichan@corp.free.fr> on Thu Oct 12 14:59:34 2006
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _MIPS_KEXEC
88c2ecf20Sopenharmony_ci# define _MIPS_KEXEC
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <asm/stacktrace.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* Maximum physical address we can use pages from */
138c2ecf20Sopenharmony_ci#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
148c2ecf20Sopenharmony_ci/* Maximum address we can reach in physical address mode */
158c2ecf20Sopenharmony_ci#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
168c2ecf20Sopenharmony_ci /* Maximum address we can use for the control code buffer */
178c2ecf20Sopenharmony_ci#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
188c2ecf20Sopenharmony_ci/* Reserve 3*4096 bytes for board-specific info */
198c2ecf20Sopenharmony_ci#define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* The native architecture */
228c2ecf20Sopenharmony_ci#define KEXEC_ARCH KEXEC_ARCH_MIPS
238c2ecf20Sopenharmony_ci#define MAX_NOTE_BYTES 1024
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic inline void crash_setup_regs(struct pt_regs *newregs,
268c2ecf20Sopenharmony_ci				    struct pt_regs *oldregs)
278c2ecf20Sopenharmony_ci{
288c2ecf20Sopenharmony_ci	if (oldregs)
298c2ecf20Sopenharmony_ci		memcpy(newregs, oldregs, sizeof(*newregs));
308c2ecf20Sopenharmony_ci	else
318c2ecf20Sopenharmony_ci		prepare_frametrace(newregs);
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#ifdef CONFIG_KEXEC
358c2ecf20Sopenharmony_cistruct kimage;
368c2ecf20Sopenharmony_ciextern unsigned long kexec_args[4];
378c2ecf20Sopenharmony_ciextern int (*_machine_kexec_prepare)(struct kimage *);
388c2ecf20Sopenharmony_ciextern void (*_machine_kexec_shutdown)(void);
398c2ecf20Sopenharmony_ciextern void (*_machine_crash_shutdown)(struct pt_regs *regs);
408c2ecf20Sopenharmony_civoid default_machine_crash_shutdown(struct pt_regs *regs);
418c2ecf20Sopenharmony_civoid kexec_nonboot_cpu_jump(void);
428c2ecf20Sopenharmony_civoid kexec_reboot(void);
438c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP
448c2ecf20Sopenharmony_ciextern const unsigned char kexec_smp_wait[];
458c2ecf20Sopenharmony_ciextern unsigned long secondary_kexec_args[4];
468c2ecf20Sopenharmony_ciextern atomic_t kexec_ready_to_reboot;
478c2ecf20Sopenharmony_ciextern void (*_crash_smp_send_stop)(void);
488c2ecf20Sopenharmony_ci#endif
498c2ecf20Sopenharmony_ci#endif
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#endif /* !_MIPS_KEXEC */
52