Commit | Line | Data |
---|---|---|
8f75582a VG |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef BOOT_BOOT_H | |
3 | #define BOOT_BOOT_H | |
4 | ||
256d78d0 | 5 | #include <linux/types.h> |
9a78c70a | 6 | |
834979c2 HC |
7 | #define IPL_START 0x200 |
8 | ||
9 | #ifndef __ASSEMBLY__ | |
10 | ||
f913a660 VG |
11 | #include <asm/physmem_info.h> |
12 | ||
bd50b743 AG |
13 | struct machine_info { |
14 | unsigned char has_edat1 : 1; | |
15 | unsigned char has_edat2 : 1; | |
16 | unsigned char has_nx : 1; | |
17 | }; | |
18 | ||
9c3205b2 | 19 | struct vmlinux_info { |
bb1520d5 | 20 | unsigned long entry; |
9c3205b2 AG |
21 | unsigned long image_size; /* does not include .bss */ |
22 | unsigned long bss_size; /* uncompressed image .bss size */ | |
23 | unsigned long bootdata_off; | |
24 | unsigned long bootdata_size; | |
25 | unsigned long bootdata_preserved_off; | |
26 | unsigned long bootdata_preserved_size; | |
3334fda6 AG |
27 | unsigned long got_start; |
28 | unsigned long got_end; | |
9c3205b2 | 29 | unsigned long amode31_size; |
bb1520d5 AG |
30 | unsigned long init_mm_off; |
31 | unsigned long swapper_pg_dir_off; | |
32 | unsigned long invalid_pg_dir_off; | |
7f9d8599 SS |
33 | unsigned long alt_instructions; |
34 | unsigned long alt_instructions_end; | |
557b1970 VG |
35 | #ifdef CONFIG_KASAN |
36 | unsigned long kasan_early_shadow_page_off; | |
37 | unsigned long kasan_early_shadow_pte_off; | |
38 | unsigned long kasan_early_shadow_pmd_off; | |
39 | unsigned long kasan_early_shadow_pud_off; | |
40 | unsigned long kasan_early_shadow_p4d_off; | |
41 | #endif | |
9c3205b2 AG |
42 | }; |
43 | ||
8f75582a | 44 | void startup_kernel(void); |
f913a660 VG |
45 | unsigned long detect_max_physmem_end(void); |
46 | void detect_physmem_online_ranges(unsigned long max_physmem_end); | |
8c37cb7d | 47 | void physmem_set_usable_limit(unsigned long limit); |
f913a660 VG |
48 | void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size); |
49 | void physmem_free(enum reserved_range_type type); | |
50 | /* for continuous/multiple allocations per type */ | |
51 | unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size, | |
52 | unsigned long align); | |
53 | /* for single allocations, 1 per type */ | |
54 | unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size, | |
55 | unsigned long align, unsigned long min, unsigned long max, | |
56 | bool die_on_oom); | |
6e259bc5 | 57 | unsigned long get_physmem_alloc_pos(void); |
f913a660 VG |
58 | bool ipl_report_certs_intersects(unsigned long addr, unsigned long size, |
59 | unsigned long *intersection_start); | |
73045a08 | 60 | bool is_ipl_block_dump(void); |
49698745 | 61 | void store_ipl_parmblock(void); |
f913a660 VG |
62 | int read_ipl_report(void); |
63 | void save_ipl_cert_comp_list(void); | |
49698745 | 64 | void setup_boot_command_line(void); |
b5e80459 | 65 | void parse_boot_command_line(void); |
868202ce | 66 | void verify_facilities(void); |
6d85dac2 | 67 | void print_missing_facilities(void); |
f1d3c532 | 68 | void sclp_early_setup_buffer(void); |
724dc336 | 69 | void print_pgm_check_info(void); |
6e259bc5 VG |
70 | unsigned long randomize_within_range(unsigned long size, unsigned long align, |
71 | unsigned long min, unsigned long max); | |
c98d2eca | 72 | void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned long asce_limit); |
bfda6108 | 73 | void __printf(1, 2) boot_printk(const char *fmt, ...); |
f913a660 | 74 | void print_stacktrace(unsigned long sp); |
9c3205b2 | 75 | void error(char *m); |
c98d2eca | 76 | int get_random(unsigned long limit, unsigned long *value); |
b2d24b97 | 77 | |
bd50b743 AG |
78 | extern struct machine_info machine; |
79 | ||
7fadcc07 | 80 | /* Symbols defined by linker scripts */ |
6abe2819 | 81 | extern const char kernel_version[]; |
73045a08 | 82 | extern unsigned long memory_limit; |
0c4f2623 | 83 | extern unsigned long vmalloc_size; |
73045a08 | 84 | extern int vmalloc_size_set; |
7fadcc07 AE |
85 | extern char __boot_data_start[], __boot_data_end[]; |
86 | extern char __boot_data_preserved_start[], __boot_data_preserved_end[]; | |
4394a507 | 87 | extern char __vmlinux_relocs_64_start[], __vmlinux_relocs_64_end[]; |
7fadcc07 | 88 | extern char _decompressor_syms_start[], _decompressor_syms_end[]; |
256d78d0 | 89 | extern char _stack_start[], _stack_end[]; |
f913a660 | 90 | extern char _end[], _decompressor_end[]; |
9c3205b2 AG |
91 | extern unsigned char _compressed_start[]; |
92 | extern unsigned char _compressed_end[]; | |
93 | extern struct vmlinux_info _vmlinux_info; | |
5ade5be4 | 94 | |
9c3205b2 | 95 | #define vmlinux _vmlinux_info |
9641b8cc | 96 | |
5ade5be4 | 97 | #define __lowcore_pa(x) ((unsigned long)(x) % sizeof(struct lowcore)) |
2154e0b3 | 98 | #define __abs_lowcore_pa(x) (((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore)) |
c98d2eca AG |
99 | #define __kernel_va(x) ((void *)((unsigned long)(x) - __kaslr_offset_phys + __kaslr_offset)) |
100 | #define __kernel_pa(x) ((unsigned long)(x) - __kaslr_offset + __kaslr_offset_phys) | |
101 | #define __identity_va(x) ((void *)((unsigned long)(x) + __identity_base)) | |
102 | #define __identity_pa(x) ((unsigned long)(x) - __identity_base) | |
2154e0b3 | 103 | |
f913a660 VG |
104 | static inline bool intersects(unsigned long addr0, unsigned long size0, |
105 | unsigned long addr1, unsigned long size1) | |
106 | { | |
107 | return addr0 + size0 > addr1 && addr1 + size1 > addr0; | |
108 | } | |
834979c2 | 109 | #endif /* __ASSEMBLY__ */ |
8f75582a | 110 | #endif /* BOOT_BOOT_H */ |