misc.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef BOOT_COMPRESSED_MISC_H
  3. #define BOOT_COMPRESSED_MISC_H
  4. /*
  5. * Special hack: we have to be careful, because no indirections are allowed here,
  6. * and paravirt_ops is a kind of one. As it will only run in baremetal anyway,
  7. * we just keep it from happening. (This list needs to be extended when new
  8. * paravirt and debugging variants are added.)
  9. */
  10. #undef CONFIG_PARAVIRT
  11. #undef CONFIG_PARAVIRT_XXL
  12. #undef CONFIG_PARAVIRT_SPINLOCKS
  13. #undef CONFIG_KASAN
  14. /* cpu_feature_enabled() cannot be used this early */
  15. #define USE_EARLY_PGTABLE_L5
  16. #include <linux/linkage.h>
  17. #include <linux/screen_info.h>
  18. #include <linux/elf.h>
  19. #include <linux/io.h>
  20. #include <asm/page.h>
  21. #include <asm/boot.h>
  22. #include <asm/bootparam.h>
  23. #include <asm/bootparam_utils.h>
  24. #define BOOT_BOOT_H
  25. #include "../ctype.h"
  26. #ifdef CONFIG_X86_64
  27. #define memptr long
  28. #else
  29. #define memptr unsigned
  30. #endif
  31. /* misc.c */
  32. extern memptr free_mem_ptr;
  33. extern memptr free_mem_end_ptr;
  34. extern struct boot_params *boot_params;
  35. void __putstr(const char *s);
  36. void __puthex(unsigned long value);
  37. #define error_putstr(__x) __putstr(__x)
  38. #define error_puthex(__x) __puthex(__x)
  39. #ifdef CONFIG_X86_VERBOSE_BOOTUP
  40. #define debug_putstr(__x) __putstr(__x)
  41. #define debug_puthex(__x) __puthex(__x)
  42. #define debug_putaddr(__x) { \
  43. debug_putstr(#__x ": 0x"); \
  44. debug_puthex((unsigned long)(__x)); \
  45. debug_putstr("\n"); \
  46. }
  47. #else
  48. static inline void debug_putstr(const char *s)
  49. { }
  50. static inline void debug_puthex(const char *s)
  51. { }
  52. #define debug_putaddr(x) /* */
  53. #endif
  54. #if CONFIG_EARLY_PRINTK || CONFIG_RANDOMIZE_BASE
  55. /* cmdline.c */
  56. int cmdline_find_option(const char *option, char *buffer, int bufsize);
  57. int cmdline_find_option_bool(const char *option);
  58. #endif
  59. #if CONFIG_RANDOMIZE_BASE
  60. /* kaslr.c */
  61. void choose_random_location(unsigned long input,
  62. unsigned long input_size,
  63. unsigned long *output,
  64. unsigned long output_size,
  65. unsigned long *virt_addr);
  66. /* cpuflags.c */
  67. bool has_cpuflag(int flag);
  68. #else
  69. static inline void choose_random_location(unsigned long input,
  70. unsigned long input_size,
  71. unsigned long *output,
  72. unsigned long output_size,
  73. unsigned long *virt_addr)
  74. {
  75. }
  76. #endif
  77. #ifdef CONFIG_X86_64
  78. void initialize_identity_maps(void);
  79. void add_identity_map(unsigned long start, unsigned long size);
  80. void finalize_identity_maps(void);
  81. extern unsigned char _pgtable[];
  82. #else
  83. static inline void initialize_identity_maps(void)
  84. { }
  85. static inline void add_identity_map(unsigned long start, unsigned long size)
  86. { }
  87. static inline void finalize_identity_maps(void)
  88. { }
  89. #endif
  90. #ifdef CONFIG_EARLY_PRINTK
  91. /* early_serial_console.c */
  92. extern int early_serial_base;
  93. void console_init(void);
  94. #else
  95. static const int early_serial_base;
  96. static inline void console_init(void)
  97. { }
  98. #endif
  99. void set_sev_encryption_mask(void);
  100. #endif