162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef BOOT_BOOT_H 362306a36Sopenharmony_ci#define BOOT_BOOT_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/types.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define IPL_START 0x200 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <asm/physmem_info.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cistruct machine_info { 1462306a36Sopenharmony_ci unsigned char has_edat1 : 1; 1562306a36Sopenharmony_ci unsigned char has_edat2 : 1; 1662306a36Sopenharmony_ci unsigned char has_nx : 1; 1762306a36Sopenharmony_ci}; 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_cistruct vmlinux_info { 2062306a36Sopenharmony_ci unsigned long default_lma; 2162306a36Sopenharmony_ci unsigned long entry; 2262306a36Sopenharmony_ci unsigned long image_size; /* does not include .bss */ 2362306a36Sopenharmony_ci unsigned long bss_size; /* uncompressed image .bss size */ 2462306a36Sopenharmony_ci unsigned long bootdata_off; 2562306a36Sopenharmony_ci unsigned long bootdata_size; 2662306a36Sopenharmony_ci unsigned long bootdata_preserved_off; 2762306a36Sopenharmony_ci unsigned long bootdata_preserved_size; 2862306a36Sopenharmony_ci unsigned long dynsym_start; 2962306a36Sopenharmony_ci unsigned long rela_dyn_start; 3062306a36Sopenharmony_ci unsigned long rela_dyn_end; 3162306a36Sopenharmony_ci unsigned long amode31_size; 3262306a36Sopenharmony_ci unsigned long init_mm_off; 3362306a36Sopenharmony_ci unsigned long swapper_pg_dir_off; 3462306a36Sopenharmony_ci unsigned long invalid_pg_dir_off; 3562306a36Sopenharmony_ci#ifdef CONFIG_KASAN 3662306a36Sopenharmony_ci unsigned long kasan_early_shadow_page_off; 3762306a36Sopenharmony_ci unsigned long kasan_early_shadow_pte_off; 3862306a36Sopenharmony_ci unsigned long kasan_early_shadow_pmd_off; 3962306a36Sopenharmony_ci unsigned long kasan_early_shadow_pud_off; 4062306a36Sopenharmony_ci unsigned long kasan_early_shadow_p4d_off; 4162306a36Sopenharmony_ci#endif 4262306a36Sopenharmony_ci}; 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_civoid startup_kernel(void); 4562306a36Sopenharmony_ciunsigned long detect_max_physmem_end(void); 4662306a36Sopenharmony_civoid detect_physmem_online_ranges(unsigned long max_physmem_end); 4762306a36Sopenharmony_civoid physmem_set_usable_limit(unsigned long limit); 4862306a36Sopenharmony_civoid physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size); 4962306a36Sopenharmony_civoid physmem_free(enum reserved_range_type type); 5062306a36Sopenharmony_ci/* for continuous/multiple allocations per type */ 5162306a36Sopenharmony_ciunsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size, 5262306a36Sopenharmony_ci unsigned long align); 5362306a36Sopenharmony_ci/* for single allocations, 1 per type */ 5462306a36Sopenharmony_ciunsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size, 5562306a36Sopenharmony_ci unsigned long align, unsigned long min, unsigned long max, 5662306a36Sopenharmony_ci bool die_on_oom); 5762306a36Sopenharmony_ciunsigned long get_physmem_alloc_pos(void); 5862306a36Sopenharmony_cibool ipl_report_certs_intersects(unsigned long addr, unsigned long size, 5962306a36Sopenharmony_ci unsigned long *intersection_start); 6062306a36Sopenharmony_cibool is_ipl_block_dump(void); 6162306a36Sopenharmony_civoid store_ipl_parmblock(void); 6262306a36Sopenharmony_ciint read_ipl_report(void); 6362306a36Sopenharmony_civoid save_ipl_cert_comp_list(void); 6462306a36Sopenharmony_civoid setup_boot_command_line(void); 6562306a36Sopenharmony_civoid parse_boot_command_line(void); 6662306a36Sopenharmony_civoid verify_facilities(void); 6762306a36Sopenharmony_civoid print_missing_facilities(void); 6862306a36Sopenharmony_civoid sclp_early_setup_buffer(void); 6962306a36Sopenharmony_civoid print_pgm_check_info(void); 7062306a36Sopenharmony_ciunsigned long randomize_within_range(unsigned long size, unsigned long align, 7162306a36Sopenharmony_ci unsigned long min, unsigned long max); 7262306a36Sopenharmony_civoid setup_vmem(unsigned long asce_limit); 7362306a36Sopenharmony_civoid __printf(1, 2) decompressor_printk(const char *fmt, ...); 7462306a36Sopenharmony_civoid print_stacktrace(unsigned long sp); 7562306a36Sopenharmony_civoid error(char *m); 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ciextern struct machine_info machine; 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/* Symbols defined by linker scripts */ 8062306a36Sopenharmony_ciextern const char kernel_version[]; 8162306a36Sopenharmony_ciextern unsigned long memory_limit; 8262306a36Sopenharmony_ciextern unsigned long vmalloc_size; 8362306a36Sopenharmony_ciextern int vmalloc_size_set; 8462306a36Sopenharmony_ciextern char __boot_data_start[], __boot_data_end[]; 8562306a36Sopenharmony_ciextern char __boot_data_preserved_start[], __boot_data_preserved_end[]; 8662306a36Sopenharmony_ciextern char _decompressor_syms_start[], _decompressor_syms_end[]; 8762306a36Sopenharmony_ciextern char _stack_start[], _stack_end[]; 8862306a36Sopenharmony_ciextern char _end[], _decompressor_end[]; 8962306a36Sopenharmony_ciextern unsigned char _compressed_start[]; 9062306a36Sopenharmony_ciextern unsigned char _compressed_end[]; 9162306a36Sopenharmony_ciextern struct vmlinux_info _vmlinux_info; 9262306a36Sopenharmony_ci#define vmlinux _vmlinux_info 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define __abs_lowcore_pa(x) (((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore)) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_cistatic inline bool intersects(unsigned long addr0, unsigned long size0, 9762306a36Sopenharmony_ci unsigned long addr1, unsigned long size1) 9862306a36Sopenharmony_ci{ 9962306a36Sopenharmony_ci return addr0 + size0 > addr1 && addr1 + size1 > addr0; 10062306a36Sopenharmony_ci} 10162306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */ 10262306a36Sopenharmony_ci#endif /* BOOT_BOOT_H */ 103