xref: /openbmc/linux/arch/s390/boot/boot.h (revision 6e259bc5)
18f75582aSVasily Gorbik /* SPDX-License-Identifier: GPL-2.0 */
28f75582aSVasily Gorbik #ifndef BOOT_BOOT_H
38f75582aSVasily Gorbik #define BOOT_BOOT_H
48f75582aSVasily Gorbik 
5256d78d0SAlexander Egorenkov #include <linux/types.h>
69a78c70aSVasily Gorbik 
7834979c2SHeiko Carstens #define IPL_START	0x200
8834979c2SHeiko Carstens 
9834979c2SHeiko Carstens #ifndef __ASSEMBLY__
10834979c2SHeiko Carstens 
11f913a660SVasily Gorbik #include <asm/physmem_info.h>
12f913a660SVasily Gorbik 
13bd50b743SAlexander Gordeev struct machine_info {
14bd50b743SAlexander Gordeev 	unsigned char has_edat1 : 1;
15bd50b743SAlexander Gordeev 	unsigned char has_edat2 : 1;
16bd50b743SAlexander Gordeev 	unsigned char has_nx : 1;
17bd50b743SAlexander Gordeev };
18bd50b743SAlexander Gordeev 
199c3205b2SAlexander Gordeev struct vmlinux_info {
209c3205b2SAlexander Gordeev 	unsigned long default_lma;
21bb1520d5SAlexander Gordeev 	unsigned long entry;
229c3205b2SAlexander Gordeev 	unsigned long image_size;	/* does not include .bss */
239c3205b2SAlexander Gordeev 	unsigned long bss_size;		/* uncompressed image .bss size */
249c3205b2SAlexander Gordeev 	unsigned long bootdata_off;
259c3205b2SAlexander Gordeev 	unsigned long bootdata_size;
269c3205b2SAlexander Gordeev 	unsigned long bootdata_preserved_off;
279c3205b2SAlexander Gordeev 	unsigned long bootdata_preserved_size;
289c3205b2SAlexander Gordeev 	unsigned long dynsym_start;
299c3205b2SAlexander Gordeev 	unsigned long rela_dyn_start;
309c3205b2SAlexander Gordeev 	unsigned long rela_dyn_end;
319c3205b2SAlexander Gordeev 	unsigned long amode31_size;
32bb1520d5SAlexander Gordeev 	unsigned long init_mm_off;
33bb1520d5SAlexander Gordeev 	unsigned long swapper_pg_dir_off;
34bb1520d5SAlexander Gordeev 	unsigned long invalid_pg_dir_off;
35557b1970SVasily Gorbik #ifdef CONFIG_KASAN
36557b1970SVasily Gorbik 	unsigned long kasan_early_shadow_page_off;
37557b1970SVasily Gorbik 	unsigned long kasan_early_shadow_pte_off;
38557b1970SVasily Gorbik 	unsigned long kasan_early_shadow_pmd_off;
39557b1970SVasily Gorbik 	unsigned long kasan_early_shadow_pud_off;
40557b1970SVasily Gorbik 	unsigned long kasan_early_shadow_p4d_off;
41557b1970SVasily Gorbik #endif
429c3205b2SAlexander Gordeev };
439c3205b2SAlexander Gordeev 
448f75582aSVasily Gorbik void startup_kernel(void);
45f913a660SVasily Gorbik unsigned long detect_max_physmem_end(void);
46f913a660SVasily Gorbik void detect_physmem_online_ranges(unsigned long max_physmem_end);
478c37cb7dSVasily Gorbik void physmem_set_usable_limit(unsigned long limit);
48f913a660SVasily Gorbik void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size);
49f913a660SVasily Gorbik void physmem_free(enum reserved_range_type type);
50f913a660SVasily Gorbik /* for continuous/multiple allocations per type */
51f913a660SVasily Gorbik unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size,
52f913a660SVasily Gorbik 				     unsigned long align);
53f913a660SVasily Gorbik /* for single allocations, 1 per type */
54f913a660SVasily Gorbik unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size,
55f913a660SVasily Gorbik 				  unsigned long align, unsigned long min, unsigned long max,
56f913a660SVasily Gorbik 				  bool die_on_oom);
57*6e259bc5SVasily Gorbik unsigned long get_physmem_alloc_pos(void);
58f913a660SVasily Gorbik bool ipl_report_certs_intersects(unsigned long addr, unsigned long size,
59f913a660SVasily Gorbik 				 unsigned long *intersection_start);
6073045a08SVasily Gorbik bool is_ipl_block_dump(void);
6149698745SVasily Gorbik void store_ipl_parmblock(void);
62f913a660SVasily Gorbik int read_ipl_report(void);
63f913a660SVasily Gorbik void save_ipl_cert_comp_list(void);
6449698745SVasily Gorbik void setup_boot_command_line(void);
65b5e80459SVasily Gorbik void parse_boot_command_line(void);
66868202ceSVasily Gorbik void verify_facilities(void);
676d85dac2SVasily Gorbik void print_missing_facilities(void);
68f1d3c532SAlexander Egorenkov void sclp_early_setup_buffer(void);
69724dc336SVasily Gorbik void print_pgm_check_info(void);
70*6e259bc5SVasily Gorbik unsigned long randomize_within_range(unsigned long size, unsigned long align,
71*6e259bc5SVasily Gorbik 				     unsigned long min, unsigned long max);
72bf64f051SVasily Gorbik void setup_vmem(unsigned long asce_limit);
739a78c70aSVasily Gorbik void __printf(1, 2) decompressor_printk(const char *fmt, ...);
74f913a660SVasily Gorbik void print_stacktrace(unsigned long sp);
759c3205b2SAlexander Gordeev void error(char *m);
76b2d24b97SGerald Schaefer 
77bd50b743SAlexander Gordeev extern struct machine_info machine;
78bd50b743SAlexander Gordeev 
797fadcc07SAlexander Egorenkov /* Symbols defined by linker scripts */
806abe2819SVasily Gorbik extern const char kernel_version[];
8173045a08SVasily Gorbik extern unsigned long memory_limit;
820c4f2623SVasily Gorbik extern unsigned long vmalloc_size;
8373045a08SVasily Gorbik extern int vmalloc_size_set;
847fadcc07SAlexander Egorenkov extern char __boot_data_start[], __boot_data_end[];
857fadcc07SAlexander Egorenkov extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
867fadcc07SAlexander Egorenkov extern char _decompressor_syms_start[], _decompressor_syms_end[];
87256d78d0SAlexander Egorenkov extern char _stack_start[], _stack_end[];
88f913a660SVasily Gorbik extern char _end[], _decompressor_end[];
899c3205b2SAlexander Gordeev extern unsigned char _compressed_start[];
909c3205b2SAlexander Gordeev extern unsigned char _compressed_end[];
919c3205b2SAlexander Gordeev extern struct vmlinux_info _vmlinux_info;
929c3205b2SAlexander Gordeev #define vmlinux _vmlinux_info
939641b8ccSMartin Schwidefsky 
942154e0b3SAlexander Gordeev #define __abs_lowcore_pa(x)	(((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore))
952154e0b3SAlexander Gordeev 
intersects(unsigned long addr0,unsigned long size0,unsigned long addr1,unsigned long size1)96f913a660SVasily Gorbik static inline bool intersects(unsigned long addr0, unsigned long size0,
97f913a660SVasily Gorbik 			      unsigned long addr1, unsigned long size1)
98f913a660SVasily Gorbik {
99f913a660SVasily Gorbik 	return addr0 + size0 > addr1 && addr1 + size1 > addr0;
100f913a660SVasily Gorbik }
101834979c2SHeiko Carstens #endif /* __ASSEMBLY__ */
1028f75582aSVasily Gorbik #endif /* BOOT_BOOT_H */
103