1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef BOOT_COMPRESSED_MISC_H
3 #define BOOT_COMPRESSED_MISC_H
6 * Special hack: we have to be careful, because no indirections are allowed here,
7 * and paravirt_ops is a kind of one. As it will only run in baremetal anyway,
8 * we just keep it from happening. (This list needs to be extended when new
9 * paravirt and debugging variants are added.)
11 #undef CONFIG_PARAVIRT
12 #undef CONFIG_PARAVIRT_XXL
13 #undef CONFIG_PARAVIRT_SPINLOCKS
16 /* cpu_feature_enabled() cannot be used this early */
17 #define USE_EARLY_PGTABLE_L5
19 #include <linux/linkage.h>
20 #include <linux/screen_info.h>
21 #include <linux/elf.h>
25 #include <asm/bootparam.h>
26 #include <asm/desc_defs.h>
29 #include <linux/acpi.h>
37 #define memptr unsigned
40 /* boot/compressed/vmlinux start and end markers */
41 extern char _head[], _end[];
44 extern memptr free_mem_ptr;
45 extern memptr free_mem_end_ptr;
46 extern struct boot_params *boot_params;
47 void __putstr(const char *s);
48 void __puthex(unsigned long value);
49 #define error_putstr(__x) __putstr(__x)
50 #define error_puthex(__x) __puthex(__x)
52 #ifdef CONFIG_X86_VERBOSE_BOOTUP
54 #define debug_putstr(__x) __putstr(__x)
55 #define debug_puthex(__x) __puthex(__x)
56 #define debug_putaddr(__x) { \
57 debug_putstr(#__x ": 0x"); \
58 debug_puthex((unsigned long)(__x)); \
64 static inline void debug_putstr(const char *s)
66 static inline void debug_puthex(unsigned long value)
68 #define debug_putaddr(x) /* */
73 int cmdline_find_option(const char *option, char *buffer, int bufsize);
74 int cmdline_find_option_bool(const char *option);
81 #if CONFIG_RANDOMIZE_BASE
83 void choose_random_location(unsigned long input,
84 unsigned long input_size,
85 unsigned long *output,
86 unsigned long output_size,
87 unsigned long *virt_addr);
89 static inline void choose_random_location(unsigned long input,
90 unsigned long input_size,
91 unsigned long *output,
92 unsigned long output_size,
93 unsigned long *virt_addr)
99 bool has_cpuflag(int flag);
102 extern int set_page_decrypted(unsigned long address);
103 extern int set_page_encrypted(unsigned long address);
104 extern int set_page_non_present(unsigned long address);
105 extern unsigned char _pgtable[];
108 #ifdef CONFIG_EARLY_PRINTK
109 /* early_serial_console.c */
110 extern int early_serial_base;
111 void console_init(void);
113 static const int early_serial_base;
114 static inline void console_init(void)
118 void set_sev_encryption_mask(void);
120 #ifdef CONFIG_AMD_MEM_ENCRYPT
121 void sev_es_shutdown_ghcb(void);
122 extern bool sev_es_check_ghcb_fault(unsigned long address);
124 static inline void sev_es_shutdown_ghcb(void) { }
125 static inline bool sev_es_check_ghcb_fault(unsigned long address)
133 acpi_physical_address get_rsdp_addr(void);
135 static inline acpi_physical_address get_rsdp_addr(void) { return 0; }
138 #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE) && defined(CONFIG_ACPI)
139 extern struct mem_vector immovable_mem[MAX_NUMNODES*2];
140 int count_immovable_mem_regions(void);
142 static inline int count_immovable_mem_regions(void) { return 0; }
146 #ifdef CONFIG_X86_5LEVEL
147 extern unsigned int __pgtable_l5_enabled, pgdir_shift, ptrs_per_p4d;
150 /* Used by PAGE_KERN* macros: */
151 extern pteval_t __default_kernel_pte_mask;
154 extern gate_desc boot_idt[BOOT_IDT_ENTRIES];
155 extern struct desc_ptr boot_idt_desc;
157 /* IDT Entry Points */
158 void boot_page_fault(void);
159 void boot_stage1_vc(void);
160 void boot_stage2_vc(void);
162 #endif /* BOOT_COMPRESSED_MISC_H */