1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 28fee13a4SYinghai Lu #ifndef BOOT_COMPRESSED_MISC_H 38fee13a4SYinghai Lu #define BOOT_COMPRESSED_MISC_H 48fee13a4SYinghai Lu 58fee13a4SYinghai Lu /* 6927392d7SIngo Molnar * Special hack: we have to be careful, because no indirections are allowed here, 7927392d7SIngo Molnar * and paravirt_ops is a kind of one. As it will only run in baremetal anyway, 8927392d7SIngo Molnar * we just keep it from happening. (This list needs to be extended when new 9927392d7SIngo Molnar * paravirt and debugging variants are added.) 108fee13a4SYinghai Lu */ 118fee13a4SYinghai Lu #undef CONFIG_PARAVIRT 12c00a280aSJuergen Gross #undef CONFIG_PARAVIRT_XXL 13927392d7SIngo Molnar #undef CONFIG_PARAVIRT_SPINLOCKS 14393f203fSAndrey Ryabinin #undef CONFIG_KASAN 158fee13a4SYinghai Lu 16ad3fe525SKirill A. Shutemov /* cpu_feature_enabled() cannot be used this early */ 17ad3fe525SKirill A. Shutemov #define USE_EARLY_PGTABLE_L5 1839b95522SKirill A. Shutemov 198fee13a4SYinghai Lu #include <linux/linkage.h> 208fee13a4SYinghai Lu #include <linux/screen_info.h> 218fee13a4SYinghai Lu #include <linux/elf.h> 228fee13a4SYinghai Lu #include <linux/io.h> 238fee13a4SYinghai Lu #include <asm/page.h> 248fee13a4SYinghai Lu #include <asm/boot.h> 258fee13a4SYinghai Lu #include <asm/bootparam.h> 265dcd14ecSH. Peter Anvin #include <asm/bootparam_utils.h> 278fee13a4SYinghai Lu 28*3c98e71bSChao Fan #define BOOT_CTYPE_H 29*3c98e71bSChao Fan #include <linux/acpi.h> 30*3c98e71bSChao Fan 318fee13a4SYinghai Lu #define BOOT_BOOT_H 326238b47bSH. Peter Anvin #include "../ctype.h" 338fee13a4SYinghai Lu 3482fa9637SKees Cook #ifdef CONFIG_X86_64 3582fa9637SKees Cook #define memptr long 3682fa9637SKees Cook #else 3782fa9637SKees Cook #define memptr unsigned 3882fa9637SKees Cook #endif 3982fa9637SKees Cook 408fee13a4SYinghai Lu /* misc.c */ 4182fa9637SKees Cook extern memptr free_mem_ptr; 4282fa9637SKees Cook extern memptr free_mem_end_ptr; 436655e0aaSKees Cook extern struct boot_params *boot_params; 447aac3015SJoe Millenbach void __putstr(const char *s); 4579063a7cSKees Cook void __puthex(unsigned long value); 467aac3015SJoe Millenbach #define error_putstr(__x) __putstr(__x) 4779063a7cSKees Cook #define error_puthex(__x) __puthex(__x) 487aac3015SJoe Millenbach 497aac3015SJoe Millenbach #ifdef CONFIG_X86_VERBOSE_BOOTUP 507aac3015SJoe Millenbach 517aac3015SJoe Millenbach #define debug_putstr(__x) __putstr(__x) 5279063a7cSKees Cook #define debug_puthex(__x) __puthex(__x) 5379063a7cSKees Cook #define debug_putaddr(__x) { \ 5479063a7cSKees Cook debug_putstr(#__x ": 0x"); \ 5579063a7cSKees Cook debug_puthex((unsigned long)(__x)); \ 5679063a7cSKees Cook debug_putstr("\n"); \ 5779063a7cSKees Cook } 587aac3015SJoe Millenbach 597aac3015SJoe Millenbach #else 607aac3015SJoe Millenbach 617aac3015SJoe Millenbach static inline void debug_putstr(const char *s) 627aac3015SJoe Millenbach { } 6379063a7cSKees Cook static inline void debug_puthex(const char *s) 6479063a7cSKees Cook { } 6579063a7cSKees Cook #define debug_putaddr(x) /* */ 667aac3015SJoe Millenbach 677aac3015SJoe Millenbach #endif 688fee13a4SYinghai Lu 698ab3820fSKees Cook #if CONFIG_EARLY_PRINTK || CONFIG_RANDOMIZE_BASE 708fee13a4SYinghai Lu /* cmdline.c */ 718fee13a4SYinghai Lu int cmdline_find_option(const char *option, char *buffer, int bufsize); 728fee13a4SYinghai Lu int cmdline_find_option_bool(const char *option); 738ab3820fSKees Cook #endif 748fee13a4SYinghai Lu 758ab3820fSKees Cook 768ab3820fSKees Cook #if CONFIG_RANDOMIZE_BASE 779b238748SKees Cook /* kaslr.c */ 788391c73cSBaoquan He void choose_random_location(unsigned long input, 798ab3820fSKees Cook unsigned long input_size, 808391c73cSBaoquan He unsigned long *output, 818391c73cSBaoquan He unsigned long output_size, 828391c73cSBaoquan He unsigned long *virt_addr); 835bfce5efSKees Cook /* cpuflags.c */ 845bfce5efSKees Cook bool has_cpuflag(int flag); 858ab3820fSKees Cook #else 868391c73cSBaoquan He static inline void choose_random_location(unsigned long input, 878ab3820fSKees Cook unsigned long input_size, 888391c73cSBaoquan He unsigned long *output, 898391c73cSBaoquan He unsigned long output_size, 908391c73cSBaoquan He unsigned long *virt_addr) 918ab3820fSKees Cook { 928ab3820fSKees Cook } 938ab3820fSKees Cook #endif 948ab3820fSKees Cook 953a94707dSKees Cook #ifdef CONFIG_X86_64 9611fdf97aSKees Cook void initialize_identity_maps(void); 973a94707dSKees Cook void add_identity_map(unsigned long start, unsigned long size); 983a94707dSKees Cook void finalize_identity_maps(void); 993a94707dSKees Cook extern unsigned char _pgtable[]; 1003a94707dSKees Cook #else 10111fdf97aSKees Cook static inline void initialize_identity_maps(void) 10211fdf97aSKees Cook { } 1033a94707dSKees Cook static inline void add_identity_map(unsigned long start, unsigned long size) 1043a94707dSKees Cook { } 1053a94707dSKees Cook static inline void finalize_identity_maps(void) 1063a94707dSKees Cook { } 1073a94707dSKees Cook #endif 1083a94707dSKees Cook 1098ab3820fSKees Cook #ifdef CONFIG_EARLY_PRINTK 1108fee13a4SYinghai Lu /* early_serial_console.c */ 1118fee13a4SYinghai Lu extern int early_serial_base; 1128fee13a4SYinghai Lu void console_init(void); 113cec49df9SJoe Millenbach #else 114cec49df9SJoe Millenbach static const int early_serial_base; 115cec49df9SJoe Millenbach static inline void console_init(void) 116cec49df9SJoe Millenbach { } 117cec49df9SJoe Millenbach #endif 118cec49df9SJoe Millenbach 11907344b15STom Lendacky void set_sev_encryption_mask(void); 1201958b5fcSTom Lendacky 1218fee13a4SYinghai Lu #endif 122