xref: /linux/arch/x86/boot/compressed/misc.h (revision 79063a7c0239419d5f6bee63228f66256fdc0fc4)
18fee13a4SYinghai Lu #ifndef BOOT_COMPRESSED_MISC_H
28fee13a4SYinghai Lu #define BOOT_COMPRESSED_MISC_H
38fee13a4SYinghai Lu 
48fee13a4SYinghai Lu /*
5927392d7SIngo Molnar  * Special hack: we have to be careful, because no indirections are allowed here,
6927392d7SIngo Molnar  * and paravirt_ops is a kind of one. As it will only run in baremetal anyway,
7927392d7SIngo Molnar  * we just keep it from happening. (This list needs to be extended when new
8927392d7SIngo Molnar  * paravirt and debugging variants are added.)
98fee13a4SYinghai Lu  */
108fee13a4SYinghai Lu #undef CONFIG_PARAVIRT
11927392d7SIngo Molnar #undef CONFIG_PARAVIRT_SPINLOCKS
12393f203fSAndrey Ryabinin #undef CONFIG_KASAN
138fee13a4SYinghai Lu 
148fee13a4SYinghai Lu #include <linux/linkage.h>
158fee13a4SYinghai Lu #include <linux/screen_info.h>
168fee13a4SYinghai Lu #include <linux/elf.h>
178fee13a4SYinghai Lu #include <linux/io.h>
188fee13a4SYinghai Lu #include <asm/page.h>
198fee13a4SYinghai Lu #include <asm/boot.h>
208fee13a4SYinghai Lu #include <asm/bootparam.h>
215dcd14ecSH. Peter Anvin #include <asm/bootparam_utils.h>
228fee13a4SYinghai Lu 
238fee13a4SYinghai Lu #define BOOT_BOOT_H
246238b47bSH. Peter Anvin #include "../ctype.h"
258fee13a4SYinghai Lu 
2682fa9637SKees Cook #ifdef CONFIG_X86_64
2782fa9637SKees Cook #define memptr long
2882fa9637SKees Cook #else
2982fa9637SKees Cook #define memptr unsigned
3082fa9637SKees Cook #endif
3182fa9637SKees Cook 
328fee13a4SYinghai Lu /* misc.c */
3382fa9637SKees Cook extern memptr free_mem_ptr;
3482fa9637SKees Cook extern memptr free_mem_end_ptr;
358fee13a4SYinghai Lu extern struct boot_params *real_mode;		/* Pointer to real-mode data */
367aac3015SJoe Millenbach void __putstr(const char *s);
37*79063a7cSKees Cook void __puthex(unsigned long value);
387aac3015SJoe Millenbach #define error_putstr(__x)  __putstr(__x)
39*79063a7cSKees Cook #define error_puthex(__x)  __puthex(__x)
407aac3015SJoe Millenbach 
417aac3015SJoe Millenbach #ifdef CONFIG_X86_VERBOSE_BOOTUP
427aac3015SJoe Millenbach 
437aac3015SJoe Millenbach #define debug_putstr(__x)  __putstr(__x)
44*79063a7cSKees Cook #define debug_puthex(__x)  __puthex(__x)
45*79063a7cSKees Cook #define debug_putaddr(__x) { \
46*79063a7cSKees Cook 		debug_putstr(#__x ": 0x"); \
47*79063a7cSKees Cook 		debug_puthex((unsigned long)(__x)); \
48*79063a7cSKees Cook 		debug_putstr("\n"); \
49*79063a7cSKees Cook 	}
507aac3015SJoe Millenbach 
517aac3015SJoe Millenbach #else
527aac3015SJoe Millenbach 
537aac3015SJoe Millenbach static inline void debug_putstr(const char *s)
547aac3015SJoe Millenbach { }
55*79063a7cSKees Cook static inline void debug_puthex(const char *s)
56*79063a7cSKees Cook { }
57*79063a7cSKees Cook #define debug_putaddr(x) /* */
587aac3015SJoe Millenbach 
597aac3015SJoe Millenbach #endif
608fee13a4SYinghai Lu 
618ab3820fSKees Cook #if CONFIG_EARLY_PRINTK || CONFIG_RANDOMIZE_BASE
628fee13a4SYinghai Lu /* cmdline.c */
638fee13a4SYinghai Lu int cmdline_find_option(const char *option, char *buffer, int bufsize);
648fee13a4SYinghai Lu int cmdline_find_option_bool(const char *option);
658ab3820fSKees Cook #endif
668fee13a4SYinghai Lu 
678ab3820fSKees Cook 
688ab3820fSKees Cook #if CONFIG_RANDOMIZE_BASE
698ab3820fSKees Cook /* aslr.c */
7078cac48cSBorislav Petkov unsigned char *choose_kernel_location(struct boot_params *boot_params,
7178cac48cSBorislav Petkov 				      unsigned char *input,
728ab3820fSKees Cook 				      unsigned long input_size,
738ab3820fSKees Cook 				      unsigned char *output,
748ab3820fSKees Cook 				      unsigned long output_size);
755bfce5efSKees Cook /* cpuflags.c */
765bfce5efSKees Cook bool has_cpuflag(int flag);
778ab3820fSKees Cook #else
788ab3820fSKees Cook static inline
7978cac48cSBorislav Petkov unsigned char *choose_kernel_location(struct boot_params *boot_params,
8078cac48cSBorislav Petkov 				      unsigned char *input,
818ab3820fSKees Cook 				      unsigned long input_size,
828ab3820fSKees Cook 				      unsigned char *output,
838ab3820fSKees Cook 				      unsigned long output_size)
848ab3820fSKees Cook {
858ab3820fSKees Cook 	return output;
868ab3820fSKees Cook }
878ab3820fSKees Cook #endif
888ab3820fSKees Cook 
898ab3820fSKees Cook #ifdef CONFIG_EARLY_PRINTK
908fee13a4SYinghai Lu /* early_serial_console.c */
918fee13a4SYinghai Lu extern int early_serial_base;
928fee13a4SYinghai Lu void console_init(void);
93cec49df9SJoe Millenbach #else
94cec49df9SJoe Millenbach static const int early_serial_base;
95cec49df9SJoe Millenbach static inline void console_init(void)
96cec49df9SJoe Millenbach { }
97cec49df9SJoe Millenbach #endif
98cec49df9SJoe Millenbach 
998fee13a4SYinghai Lu #endif
100