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 12927392d7SIngo Molnar #undef CONFIG_PARAVIRT_SPINLOCKS 13393f203fSAndrey Ryabinin #undef CONFIG_KASAN 148fee13a4SYinghai Lu 158fee13a4SYinghai Lu #include <linux/linkage.h> 168fee13a4SYinghai Lu #include <linux/screen_info.h> 178fee13a4SYinghai Lu #include <linux/elf.h> 188fee13a4SYinghai Lu #include <linux/io.h> 198fee13a4SYinghai Lu #include <asm/page.h> 208fee13a4SYinghai Lu #include <asm/boot.h> 218fee13a4SYinghai Lu #include <asm/bootparam.h> 225dcd14ecSH. Peter Anvin #include <asm/bootparam_utils.h> 238fee13a4SYinghai Lu 248fee13a4SYinghai Lu #define BOOT_BOOT_H 256238b47bSH. Peter Anvin #include "../ctype.h" 268fee13a4SYinghai Lu 2782fa9637SKees Cook #ifdef CONFIG_X86_64 2882fa9637SKees Cook #define memptr long 2982fa9637SKees Cook #else 3082fa9637SKees Cook #define memptr unsigned 3182fa9637SKees Cook #endif 3282fa9637SKees Cook 338fee13a4SYinghai Lu /* misc.c */ 3482fa9637SKees Cook extern memptr free_mem_ptr; 3582fa9637SKees Cook extern memptr free_mem_end_ptr; 366655e0aaSKees Cook extern struct boot_params *boot_params; 377aac3015SJoe Millenbach void __putstr(const char *s); 3879063a7cSKees Cook void __puthex(unsigned long value); 397aac3015SJoe Millenbach #define error_putstr(__x) __putstr(__x) 4079063a7cSKees Cook #define error_puthex(__x) __puthex(__x) 417aac3015SJoe Millenbach 427aac3015SJoe Millenbach #ifdef CONFIG_X86_VERBOSE_BOOTUP 437aac3015SJoe Millenbach 447aac3015SJoe Millenbach #define debug_putstr(__x) __putstr(__x) 4579063a7cSKees Cook #define debug_puthex(__x) __puthex(__x) 4679063a7cSKees Cook #define debug_putaddr(__x) { \ 4779063a7cSKees Cook debug_putstr(#__x ": 0x"); \ 4879063a7cSKees Cook debug_puthex((unsigned long)(__x)); \ 4979063a7cSKees Cook debug_putstr("\n"); \ 5079063a7cSKees Cook } 517aac3015SJoe Millenbach 527aac3015SJoe Millenbach #else 537aac3015SJoe Millenbach 547aac3015SJoe Millenbach static inline void debug_putstr(const char *s) 557aac3015SJoe Millenbach { } 5679063a7cSKees Cook static inline void debug_puthex(const char *s) 5779063a7cSKees Cook { } 5879063a7cSKees Cook #define debug_putaddr(x) /* */ 597aac3015SJoe Millenbach 607aac3015SJoe Millenbach #endif 618fee13a4SYinghai Lu 628ab3820fSKees Cook #if CONFIG_EARLY_PRINTK || CONFIG_RANDOMIZE_BASE 638fee13a4SYinghai Lu /* cmdline.c */ 648fee13a4SYinghai Lu int cmdline_find_option(const char *option, char *buffer, int bufsize); 658fee13a4SYinghai Lu int cmdline_find_option_bool(const char *option); 668ab3820fSKees Cook #endif 678fee13a4SYinghai Lu 688ab3820fSKees Cook 698ab3820fSKees Cook #if CONFIG_RANDOMIZE_BASE 709b238748SKees Cook /* kaslr.c */ 718391c73cSBaoquan He void choose_random_location(unsigned long input, 728ab3820fSKees Cook unsigned long input_size, 738391c73cSBaoquan He unsigned long *output, 748391c73cSBaoquan He unsigned long output_size, 758391c73cSBaoquan He unsigned long *virt_addr); 765bfce5efSKees Cook /* cpuflags.c */ 775bfce5efSKees Cook bool has_cpuflag(int flag); 788ab3820fSKees Cook #else 798391c73cSBaoquan He static inline void choose_random_location(unsigned long input, 808ab3820fSKees Cook unsigned long input_size, 818391c73cSBaoquan He unsigned long *output, 828391c73cSBaoquan He unsigned long output_size, 838391c73cSBaoquan He unsigned long *virt_addr) 848ab3820fSKees Cook { 858ab3820fSKees Cook } 868ab3820fSKees Cook #endif 878ab3820fSKees Cook 883a94707dSKees Cook #ifdef CONFIG_X86_64 8911fdf97aSKees Cook void initialize_identity_maps(void); 903a94707dSKees Cook void add_identity_map(unsigned long start, unsigned long size); 913a94707dSKees Cook void finalize_identity_maps(void); 923a94707dSKees Cook extern unsigned char _pgtable[]; 933a94707dSKees Cook #else 9411fdf97aSKees Cook static inline void initialize_identity_maps(void) 9511fdf97aSKees Cook { } 963a94707dSKees Cook static inline void add_identity_map(unsigned long start, unsigned long size) 973a94707dSKees Cook { } 983a94707dSKees Cook static inline void finalize_identity_maps(void) 993a94707dSKees Cook { } 1003a94707dSKees Cook #endif 1013a94707dSKees Cook 1028ab3820fSKees Cook #ifdef CONFIG_EARLY_PRINTK 1038fee13a4SYinghai Lu /* early_serial_console.c */ 1048fee13a4SYinghai Lu extern int early_serial_base; 1058fee13a4SYinghai Lu void console_init(void); 106cec49df9SJoe Millenbach #else 107cec49df9SJoe Millenbach static const int early_serial_base; 108cec49df9SJoe Millenbach static inline void console_init(void) 109cec49df9SJoe Millenbach { } 110cec49df9SJoe Millenbach #endif 111cec49df9SJoe Millenbach 112*1958b5fcSTom Lendacky unsigned long get_sev_encryption_mask(void); 113*1958b5fcSTom Lendacky 1148fee13a4SYinghai Lu #endif 115