xref: /linux/arch/s390/boot/boot.h (revision 7255fcc80d4b525cc10cfaaf7f485830d4ed2000)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef BOOT_BOOT_H
3 #define BOOT_BOOT_H
4 
5 #include <linux/types.h>
6 
7 #define IPL_START	0x200
8 
9 #ifndef __ASSEMBLY__
10 
11 #include <asm/physmem_info.h>
12 
13 struct machine_info {
14 	unsigned char has_edat1 : 1;
15 	unsigned char has_edat2 : 1;
16 	unsigned char has_nx : 1;
17 };
18 
19 struct vmlinux_info {
20 	unsigned long default_lma;
21 	unsigned long entry;
22 	unsigned long image_size;	/* does not include .bss */
23 	unsigned long bss_size;		/* uncompressed image .bss size */
24 	unsigned long bootdata_off;
25 	unsigned long bootdata_size;
26 	unsigned long bootdata_preserved_off;
27 	unsigned long bootdata_preserved_size;
28 #ifdef CONFIG_PIE_BUILD
29 	unsigned long dynsym_start;
30 	unsigned long rela_dyn_start;
31 	unsigned long rela_dyn_end;
32 #else
33 	unsigned long got_start;
34 	unsigned long got_end;
35 #endif
36 	unsigned long amode31_size;
37 	unsigned long init_mm_off;
38 	unsigned long swapper_pg_dir_off;
39 	unsigned long invalid_pg_dir_off;
40 #ifdef CONFIG_KASAN
41 	unsigned long kasan_early_shadow_page_off;
42 	unsigned long kasan_early_shadow_pte_off;
43 	unsigned long kasan_early_shadow_pmd_off;
44 	unsigned long kasan_early_shadow_pud_off;
45 	unsigned long kasan_early_shadow_p4d_off;
46 #endif
47 };
48 
49 void startup_kernel(void);
50 unsigned long detect_max_physmem_end(void);
51 void detect_physmem_online_ranges(unsigned long max_physmem_end);
52 void physmem_set_usable_limit(unsigned long limit);
53 void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size);
54 void physmem_free(enum reserved_range_type type);
55 /* for continuous/multiple allocations per type */
56 unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size,
57 				     unsigned long align);
58 /* for single allocations, 1 per type */
59 unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size,
60 				  unsigned long align, unsigned long min, unsigned long max,
61 				  bool die_on_oom);
62 unsigned long get_physmem_alloc_pos(void);
63 bool ipl_report_certs_intersects(unsigned long addr, unsigned long size,
64 				 unsigned long *intersection_start);
65 bool is_ipl_block_dump(void);
66 void store_ipl_parmblock(void);
67 int read_ipl_report(void);
68 void save_ipl_cert_comp_list(void);
69 void setup_boot_command_line(void);
70 void parse_boot_command_line(void);
71 void verify_facilities(void);
72 void print_missing_facilities(void);
73 void sclp_early_setup_buffer(void);
74 void print_pgm_check_info(void);
75 unsigned long randomize_within_range(unsigned long size, unsigned long align,
76 				     unsigned long min, unsigned long max);
77 void setup_vmem(unsigned long asce_limit);
78 void __printf(1, 2) decompressor_printk(const char *fmt, ...);
79 void print_stacktrace(unsigned long sp);
80 void error(char *m);
81 
82 extern struct machine_info machine;
83 
84 /* Symbols defined by linker scripts */
85 extern const char kernel_version[];
86 extern unsigned long memory_limit;
87 extern unsigned long vmalloc_size;
88 extern int vmalloc_size_set;
89 extern char __boot_data_start[], __boot_data_end[];
90 extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
91 extern char __vmlinux_relocs_64_start[], __vmlinux_relocs_64_end[];
92 extern char _decompressor_syms_start[], _decompressor_syms_end[];
93 extern char _stack_start[], _stack_end[];
94 extern char _end[], _decompressor_end[];
95 extern unsigned char _compressed_start[];
96 extern unsigned char _compressed_end[];
97 extern struct vmlinux_info _vmlinux_info;
98 #define vmlinux _vmlinux_info
99 
100 #define __abs_lowcore_pa(x)	(((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore))
101 
102 static inline bool intersects(unsigned long addr0, unsigned long size0,
103 			      unsigned long addr1, unsigned long size1)
104 {
105 	return addr0 + size0 > addr1 && addr1 + size1 > addr0;
106 }
107 #endif /* __ASSEMBLY__ */
108 #endif /* BOOT_BOOT_H */
109