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; 35*557b1970SVasily Gorbik #ifdef CONFIG_KASAN 36*557b1970SVasily Gorbik unsigned long kasan_early_shadow_page_off; 37*557b1970SVasily Gorbik unsigned long kasan_early_shadow_pte_off; 38*557b1970SVasily Gorbik unsigned long kasan_early_shadow_pmd_off; 39*557b1970SVasily Gorbik unsigned long kasan_early_shadow_pud_off; 40*557b1970SVasily Gorbik unsigned long kasan_early_shadow_p4d_off; 41*557b1970SVasily 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); 57f913a660SVasily Gorbik bool ipl_report_certs_intersects(unsigned long addr, unsigned long size, 58f913a660SVasily Gorbik unsigned long *intersection_start); 5973045a08SVasily Gorbik bool is_ipl_block_dump(void); 6049698745SVasily Gorbik void store_ipl_parmblock(void); 61f913a660SVasily Gorbik int read_ipl_report(void); 62f913a660SVasily Gorbik void save_ipl_cert_comp_list(void); 6349698745SVasily Gorbik void setup_boot_command_line(void); 64b5e80459SVasily Gorbik void parse_boot_command_line(void); 65868202ceSVasily Gorbik void verify_facilities(void); 666d85dac2SVasily Gorbik void print_missing_facilities(void); 67f1d3c532SAlexander Egorenkov void sclp_early_setup_buffer(void); 68724dc336SVasily Gorbik void print_pgm_check_info(void); 69f913a660SVasily Gorbik unsigned long get_random_base(void); 70bf64f051SVasily Gorbik void setup_vmem(unsigned long asce_limit); 719a78c70aSVasily Gorbik void __printf(1, 2) decompressor_printk(const char *fmt, ...); 72f913a660SVasily Gorbik void print_stacktrace(unsigned long sp); 739c3205b2SAlexander Gordeev void error(char *m); 74b2d24b97SGerald Schaefer 75bd50b743SAlexander Gordeev extern struct machine_info machine; 76bd50b743SAlexander Gordeev 777fadcc07SAlexander Egorenkov /* Symbols defined by linker scripts */ 786abe2819SVasily Gorbik extern const char kernel_version[]; 7973045a08SVasily Gorbik extern unsigned long memory_limit; 800c4f2623SVasily Gorbik extern unsigned long vmalloc_size; 8173045a08SVasily Gorbik extern int vmalloc_size_set; 8273045a08SVasily Gorbik extern int kaslr_enabled; 837fadcc07SAlexander Egorenkov extern char __boot_data_start[], __boot_data_end[]; 847fadcc07SAlexander Egorenkov extern char __boot_data_preserved_start[], __boot_data_preserved_end[]; 857fadcc07SAlexander Egorenkov extern char _decompressor_syms_start[], _decompressor_syms_end[]; 86256d78d0SAlexander Egorenkov extern char _stack_start[], _stack_end[]; 87f913a660SVasily Gorbik extern char _end[], _decompressor_end[]; 889c3205b2SAlexander Gordeev extern unsigned char _compressed_start[]; 899c3205b2SAlexander Gordeev extern unsigned char _compressed_end[]; 909c3205b2SAlexander Gordeev extern struct vmlinux_info _vmlinux_info; 919c3205b2SAlexander Gordeev #define vmlinux _vmlinux_info 929641b8ccSMartin Schwidefsky 932154e0b3SAlexander Gordeev #define __abs_lowcore_pa(x) (((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore)) 942154e0b3SAlexander Gordeev 95f913a660SVasily Gorbik static inline bool intersects(unsigned long addr0, unsigned long size0, 96f913a660SVasily Gorbik unsigned long addr1, unsigned long size1) 97f913a660SVasily Gorbik { 98f913a660SVasily Gorbik return addr0 + size0 > addr1 && addr1 + size1 > addr0; 99f913a660SVasily Gorbik } 100834979c2SHeiko Carstens #endif /* __ASSEMBLY__ */ 1018f75582aSVasily Gorbik #endif /* BOOT_BOOT_H */ 102