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 | ||
d538fdc4 | 11 | #include <linux/printk.h> |
f913a660 VG |
12 | #include <asm/physmem_info.h> |
13 | ||
9c3205b2 | 14 | struct vmlinux_info { |
bb1520d5 | 15 | unsigned long entry; |
9c3205b2 AG |
16 | unsigned long image_size; /* does not include .bss */ |
17 | unsigned long bss_size; /* uncompressed image .bss size */ | |
18 | unsigned long bootdata_off; | |
19 | unsigned long bootdata_size; | |
20 | unsigned long bootdata_preserved_off; | |
21 | unsigned long bootdata_preserved_size; | |
3334fda6 AG |
22 | unsigned long got_start; |
23 | unsigned long got_end; | |
9c3205b2 | 24 | unsigned long amode31_size; |
bb1520d5 AG |
25 | unsigned long init_mm_off; |
26 | unsigned long swapper_pg_dir_off; | |
27 | unsigned long invalid_pg_dir_off; | |
7f9d8599 SS |
28 | unsigned long alt_instructions; |
29 | unsigned long alt_instructions_end; | |
557b1970 VG |
30 | #ifdef CONFIG_KASAN |
31 | unsigned long kasan_early_shadow_page_off; | |
32 | unsigned long kasan_early_shadow_pte_off; | |
33 | unsigned long kasan_early_shadow_pmd_off; | |
34 | unsigned long kasan_early_shadow_pud_off; | |
35 | unsigned long kasan_early_shadow_p4d_off; | |
36 | #endif | |
9c3205b2 AG |
37 | }; |
38 | ||
8f75582a | 39 | void startup_kernel(void); |
f913a660 VG |
40 | unsigned long detect_max_physmem_end(void); |
41 | void detect_physmem_online_ranges(unsigned long max_physmem_end); | |
8c37cb7d | 42 | void physmem_set_usable_limit(unsigned long limit); |
f913a660 VG |
43 | void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size); |
44 | void physmem_free(enum reserved_range_type type); | |
45 | /* for continuous/multiple allocations per type */ | |
02415f1c VG |
46 | unsigned long physmem_alloc_or_die(enum reserved_range_type type, unsigned long size, |
47 | unsigned long align); | |
aeb4358a VG |
48 | unsigned long physmem_alloc(enum reserved_range_type type, unsigned long size, |
49 | unsigned long align, bool die_on_oom); | |
f913a660 VG |
50 | /* for single allocations, 1 per type */ |
51 | unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size, | |
52 | unsigned long align, unsigned long min, unsigned long max, | |
53 | bool die_on_oom); | |
6e259bc5 | 54 | unsigned long get_physmem_alloc_pos(void); |
9688b17b | 55 | void dump_physmem_reserved(void); |
f913a660 VG |
56 | bool ipl_report_certs_intersects(unsigned long addr, unsigned long size, |
57 | unsigned long *intersection_start); | |
73045a08 | 58 | bool is_ipl_block_dump(void); |
49698745 | 59 | void store_ipl_parmblock(void); |
f913a660 VG |
60 | int read_ipl_report(void); |
61 | void save_ipl_cert_comp_list(void); | |
49698745 | 62 | void setup_boot_command_line(void); |
b5e80459 | 63 | void parse_boot_command_line(void); |
868202ce | 64 | void verify_facilities(void); |
6d85dac2 | 65 | void print_missing_facilities(void); |
f1d3c532 | 66 | void sclp_early_setup_buffer(void); |
f0f6db9f | 67 | void alt_debug_setup(char *str); |
6067891b | 68 | void do_pgm_check(struct pt_regs *regs); |
6e259bc5 VG |
69 | unsigned long randomize_within_range(unsigned long size, unsigned long align, |
70 | unsigned long min, unsigned long max); | |
c98d2eca | 71 | void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned long asce_limit); |
847e5a4c | 72 | int __printf(1, 2) boot_printk(const char *fmt, ...); |
f913a660 | 73 | void print_stacktrace(unsigned long sp); |
9c3205b2 | 74 | void error(char *m); |
c98d2eca | 75 | int get_random(unsigned long limit, unsigned long *value); |
b2a992a5 | 76 | void boot_rb_dump(void); |
b2d24b97 | 77 | |
b79015ae VG |
78 | #ifndef boot_fmt |
79 | #define boot_fmt(fmt) fmt | |
80 | #endif | |
81 | ||
82 | #define boot_emerg(fmt, ...) boot_printk(KERN_EMERG boot_fmt(fmt), ##__VA_ARGS__) | |
83 | #define boot_alert(fmt, ...) boot_printk(KERN_ALERT boot_fmt(fmt), ##__VA_ARGS__) | |
84 | #define boot_crit(fmt, ...) boot_printk(KERN_CRIT boot_fmt(fmt), ##__VA_ARGS__) | |
85 | #define boot_err(fmt, ...) boot_printk(KERN_ERR boot_fmt(fmt), ##__VA_ARGS__) | |
86 | #define boot_warn(fmt, ...) boot_printk(KERN_WARNING boot_fmt(fmt), ##__VA_ARGS__) | |
87 | #define boot_notice(fmt, ...) boot_printk(KERN_NOTICE boot_fmt(fmt), ##__VA_ARGS__) | |
88 | #define boot_info(fmt, ...) boot_printk(KERN_INFO boot_fmt(fmt), ##__VA_ARGS__) | |
89 | #define boot_debug(fmt, ...) boot_printk(KERN_DEBUG boot_fmt(fmt), ##__VA_ARGS__) | |
d538fdc4 | 90 | |
bd50b743 | 91 | extern struct machine_info machine; |
d538fdc4 VG |
92 | extern int boot_console_loglevel; |
93 | extern bool boot_ignore_loglevel; | |
bd50b743 | 94 | |
7fadcc07 | 95 | /* Symbols defined by linker scripts */ |
6abe2819 | 96 | extern const char kernel_version[]; |
73045a08 | 97 | extern unsigned long memory_limit; |
0c4f2623 | 98 | extern unsigned long vmalloc_size; |
73045a08 | 99 | extern int vmalloc_size_set; |
7fadcc07 AE |
100 | extern char __boot_data_start[], __boot_data_end[]; |
101 | extern char __boot_data_preserved_start[], __boot_data_preserved_end[]; | |
4394a507 | 102 | extern char __vmlinux_relocs_64_start[], __vmlinux_relocs_64_end[]; |
7fadcc07 | 103 | extern char _decompressor_syms_start[], _decompressor_syms_end[]; |
256d78d0 | 104 | extern char _stack_start[], _stack_end[]; |
f913a660 | 105 | extern char _end[], _decompressor_end[]; |
9c3205b2 AG |
106 | extern unsigned char _compressed_start[]; |
107 | extern unsigned char _compressed_end[]; | |
108 | extern struct vmlinux_info _vmlinux_info; | |
5ade5be4 | 109 | |
9c3205b2 | 110 | #define vmlinux _vmlinux_info |
9641b8cc | 111 | |
5ade5be4 | 112 | #define __lowcore_pa(x) ((unsigned long)(x) % sizeof(struct lowcore)) |
2154e0b3 | 113 | #define __abs_lowcore_pa(x) (((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore)) |
c98d2eca AG |
114 | #define __kernel_va(x) ((void *)((unsigned long)(x) - __kaslr_offset_phys + __kaslr_offset)) |
115 | #define __kernel_pa(x) ((unsigned long)(x) - __kaslr_offset + __kaslr_offset_phys) | |
116 | #define __identity_va(x) ((void *)((unsigned long)(x) + __identity_base)) | |
117 | #define __identity_pa(x) ((unsigned long)(x) - __identity_base) | |
2154e0b3 | 118 | |
f913a660 VG |
119 | static inline bool intersects(unsigned long addr0, unsigned long size0, |
120 | unsigned long addr1, unsigned long size1) | |
121 | { | |
122 | return addr0 + size0 > addr1 && addr1 + size1 > addr0; | |
123 | } | |
834979c2 | 124 | #endif /* __ASSEMBLY__ */ |
8f75582a | 125 | #endif /* BOOT_BOOT_H */ |