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 11*f913a660SVasily Gorbik #include <asm/physmem_info.h> 12*f913a660SVasily 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; 359c3205b2SAlexander Gordeev }; 369c3205b2SAlexander Gordeev 378f75582aSVasily Gorbik void startup_kernel(void); 38*f913a660SVasily Gorbik unsigned long detect_max_physmem_end(void); 39*f913a660SVasily Gorbik void detect_physmem_online_ranges(unsigned long max_physmem_end); 408c37cb7dSVasily Gorbik void physmem_set_usable_limit(unsigned long limit); 41*f913a660SVasily Gorbik void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size); 42*f913a660SVasily Gorbik void physmem_free(enum reserved_range_type type); 43*f913a660SVasily Gorbik /* for continuous/multiple allocations per type */ 44*f913a660SVasily Gorbik unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size, 45*f913a660SVasily Gorbik unsigned long align); 46*f913a660SVasily Gorbik /* for single allocations, 1 per type */ 47*f913a660SVasily Gorbik unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size, 48*f913a660SVasily Gorbik unsigned long align, unsigned long min, unsigned long max, 49*f913a660SVasily Gorbik bool die_on_oom); 50*f913a660SVasily Gorbik bool ipl_report_certs_intersects(unsigned long addr, unsigned long size, 51*f913a660SVasily Gorbik unsigned long *intersection_start); 5273045a08SVasily Gorbik bool is_ipl_block_dump(void); 5349698745SVasily Gorbik void store_ipl_parmblock(void); 54*f913a660SVasily Gorbik int read_ipl_report(void); 55*f913a660SVasily Gorbik void save_ipl_cert_comp_list(void); 5649698745SVasily Gorbik void setup_boot_command_line(void); 57b5e80459SVasily Gorbik void parse_boot_command_line(void); 58868202ceSVasily Gorbik void verify_facilities(void); 596d85dac2SVasily Gorbik void print_missing_facilities(void); 60f1d3c532SAlexander Egorenkov void sclp_early_setup_buffer(void); 61724dc336SVasily Gorbik void print_pgm_check_info(void); 62*f913a660SVasily Gorbik unsigned long get_random_base(void); 63bf64f051SVasily Gorbik void setup_vmem(unsigned long asce_limit); 649a78c70aSVasily Gorbik void __printf(1, 2) decompressor_printk(const char *fmt, ...); 65*f913a660SVasily Gorbik void print_stacktrace(unsigned long sp); 669c3205b2SAlexander Gordeev void error(char *m); 67b2d24b97SGerald Schaefer 68bd50b743SAlexander Gordeev extern struct machine_info machine; 69bd50b743SAlexander Gordeev 707fadcc07SAlexander Egorenkov /* Symbols defined by linker scripts */ 716abe2819SVasily Gorbik extern const char kernel_version[]; 7273045a08SVasily Gorbik extern unsigned long memory_limit; 730c4f2623SVasily Gorbik extern unsigned long vmalloc_size; 7473045a08SVasily Gorbik extern int vmalloc_size_set; 7573045a08SVasily Gorbik extern int kaslr_enabled; 767fadcc07SAlexander Egorenkov extern char __boot_data_start[], __boot_data_end[]; 777fadcc07SAlexander Egorenkov extern char __boot_data_preserved_start[], __boot_data_preserved_end[]; 787fadcc07SAlexander Egorenkov extern char _decompressor_syms_start[], _decompressor_syms_end[]; 79256d78d0SAlexander Egorenkov extern char _stack_start[], _stack_end[]; 80*f913a660SVasily Gorbik extern char _end[], _decompressor_end[]; 819c3205b2SAlexander Gordeev extern unsigned char _compressed_start[]; 829c3205b2SAlexander Gordeev extern unsigned char _compressed_end[]; 839c3205b2SAlexander Gordeev extern struct vmlinux_info _vmlinux_info; 849c3205b2SAlexander Gordeev #define vmlinux _vmlinux_info 859641b8ccSMartin Schwidefsky 862154e0b3SAlexander Gordeev #define __abs_lowcore_pa(x) (((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore)) 872154e0b3SAlexander Gordeev 88*f913a660SVasily Gorbik static inline bool intersects(unsigned long addr0, unsigned long size0, 89*f913a660SVasily Gorbik unsigned long addr1, unsigned long size1) 90*f913a660SVasily Gorbik { 91*f913a660SVasily Gorbik return addr0 + size0 > addr1 && addr1 + size1 > addr0; 92*f913a660SVasily Gorbik } 93834979c2SHeiko Carstens #endif /* __ASSEMBLY__ */ 948f75582aSVasily Gorbik #endif /* BOOT_BOOT_H */ 95