| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | 
|---|
| 2 | #ifndef _UAPILINUX_KEXEC_H | 
|---|
| 3 | #define _UAPILINUX_KEXEC_H | 
|---|
| 4 |  | 
|---|
| 5 | /* kexec system call -  It loads the new kernel to boot into. | 
|---|
| 6 | * kexec does not sync, or unmount filesystems so if you need | 
|---|
| 7 | * that to happen you need to do that yourself. | 
|---|
| 8 | */ | 
|---|
| 9 |  | 
|---|
| 10 | #include <linux/types.h> | 
|---|
| 11 |  | 
|---|
| 12 | /* kexec flags for different usage scenarios */ | 
|---|
| 13 | #define KEXEC_ON_CRASH		0x00000001 | 
|---|
| 14 | #define KEXEC_PRESERVE_CONTEXT	0x00000002 | 
|---|
| 15 | #define KEXEC_UPDATE_ELFCOREHDR	0x00000004 | 
|---|
| 16 | #define KEXEC_CRASH_HOTPLUG_SUPPORT 0x00000008 | 
|---|
| 17 | #define KEXEC_ARCH_MASK		0xffff0000 | 
|---|
| 18 |  | 
|---|
| 19 | /* | 
|---|
| 20 | * Kexec file load interface flags. | 
|---|
| 21 | * KEXEC_FILE_UNLOAD : Unload already loaded kexec/kdump image. | 
|---|
| 22 | * KEXEC_FILE_ON_CRASH : Load/unload operation belongs to kdump image. | 
|---|
| 23 | * KEXEC_FILE_NO_INITRAMFS : No initramfs is being loaded. Ignore the initrd | 
|---|
| 24 | *                           fd field. | 
|---|
| 25 | * KEXEC_FILE_FORCE_DTB : Force carrying over the current boot's DTB to the new | 
|---|
| 26 | *                        kernel on x86. This is already the default behavior on | 
|---|
| 27 | *                        some other architectures, like ARM64 and PowerPC. | 
|---|
| 28 | */ | 
|---|
| 29 | #define KEXEC_FILE_UNLOAD	0x00000001 | 
|---|
| 30 | #define KEXEC_FILE_ON_CRASH	0x00000002 | 
|---|
| 31 | #define KEXEC_FILE_NO_INITRAMFS	0x00000004 | 
|---|
| 32 | #define KEXEC_FILE_DEBUG	0x00000008 | 
|---|
| 33 | #define KEXEC_FILE_NO_CMA	0x00000010 | 
|---|
| 34 | #define KEXEC_FILE_FORCE_DTB	0x00000020 | 
|---|
| 35 |  | 
|---|
| 36 | /* These values match the ELF architecture values. | 
|---|
| 37 | * Unless there is a good reason that should continue to be the case. | 
|---|
| 38 | */ | 
|---|
| 39 | #define KEXEC_ARCH_DEFAULT ( 0 << 16) | 
|---|
| 40 | #define KEXEC_ARCH_386     ( 3 << 16) | 
|---|
| 41 | #define KEXEC_ARCH_68K     ( 4 << 16) | 
|---|
| 42 | #define KEXEC_ARCH_PARISC  (15 << 16) | 
|---|
| 43 | #define KEXEC_ARCH_X86_64  (62 << 16) | 
|---|
| 44 | #define KEXEC_ARCH_PPC     (20 << 16) | 
|---|
| 45 | #define KEXEC_ARCH_PPC64   (21 << 16) | 
|---|
| 46 | #define KEXEC_ARCH_IA_64   (50 << 16) | 
|---|
| 47 | #define KEXEC_ARCH_ARM     (40 << 16) | 
|---|
| 48 | #define KEXEC_ARCH_S390    (22 << 16) | 
|---|
| 49 | #define KEXEC_ARCH_SH      (42 << 16) | 
|---|
| 50 | #define KEXEC_ARCH_MIPS_LE (10 << 16) | 
|---|
| 51 | #define KEXEC_ARCH_MIPS    ( 8 << 16) | 
|---|
| 52 | #define KEXEC_ARCH_AARCH64 (183 << 16) | 
|---|
| 53 | #define KEXEC_ARCH_RISCV   (243 << 16) | 
|---|
| 54 | #define KEXEC_ARCH_LOONGARCH	(258 << 16) | 
|---|
| 55 |  | 
|---|
| 56 | /* The artificial cap on the number of segments passed to kexec_load. */ | 
|---|
| 57 | #define KEXEC_SEGMENT_MAX 16 | 
|---|
| 58 |  | 
|---|
| 59 | #ifndef __KERNEL__ | 
|---|
| 60 | /* | 
|---|
| 61 | * This structure is used to hold the arguments that are used when | 
|---|
| 62 | * loading  kernel binaries. | 
|---|
| 63 | */ | 
|---|
| 64 | struct kexec_segment { | 
|---|
| 65 | const void *buf; | 
|---|
| 66 | __kernel_size_t bufsz; | 
|---|
| 67 | const void *mem; | 
|---|
| 68 | __kernel_size_t memsz; | 
|---|
| 69 | }; | 
|---|
| 70 |  | 
|---|
| 71 | #endif /* __KERNEL__ */ | 
|---|
| 72 |  | 
|---|
| 73 | #endif /* _UAPILINUX_KEXEC_H */ | 
|---|
| 74 |  | 
|---|