misc.h 2.7 KB

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