1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_CRASH_RESERVE_H
3 #define LINUX_CRASH_RESERVE_H
4 
5 #include <linux/linkage.h>
6 #include <linux/elfcore.h>
7 #include <linux/elf.h>
8 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
9 #include <asm/crash_reserve.h>
10 #endif
11 
12 /* Location of a reserved region to hold the crash kernel.
13  */
14 extern struct resource crashk_res;
15 extern struct resource crashk_low_res;
16 
17 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
18 		unsigned long long *crash_size, unsigned long long *crash_base,
19 		unsigned long long *low_size, bool *high);
20 
21 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
22 #ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
23 #define DEFAULT_CRASH_KERNEL_LOW_SIZE	(128UL << 20)
24 #endif
25 #ifndef CRASH_ALIGN
26 #define CRASH_ALIGN			SZ_2M
27 #endif
28 #ifndef CRASH_ADDR_LOW_MAX
29 #define CRASH_ADDR_LOW_MAX		SZ_4G
30 #endif
31 #ifndef CRASH_ADDR_HIGH_MAX
32 #define CRASH_ADDR_HIGH_MAX		memblock_end_of_DRAM()
33 #endif
34 
35 void __init reserve_crashkernel_generic(char *cmdline,
36 		unsigned long long crash_size,
37 		unsigned long long crash_base,
38 		unsigned long long crash_low_size,
39 		bool high);
40 #else
reserve_crashkernel_generic(char * cmdline,unsigned long long crash_size,unsigned long long crash_base,unsigned long long crash_low_size,bool high)41 static inline void __init reserve_crashkernel_generic(char *cmdline,
42 		unsigned long long crash_size,
43 		unsigned long long crash_base,
44 		unsigned long long crash_low_size,
45 		bool high)
46 {}
47 #endif
48 #endif /* LINUX_CRASH_RESERVE_H */
49