misc.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_KASAN
  12. #include <linux/linkage.h>
  13. #include <linux/screen_info.h>
  14. #include <linux/elf.h>
  15. #include <linux/io.h>
  16. #include <asm/page.h>
  17. #include <asm/boot.h>
  18. #include <asm/bootparam.h>
  19. #include <asm/bootparam_utils.h>
  20. #define BOOT_BOOT_H
  21. #include "../ctype.h"
  22. #ifdef CONFIG_X86_64
  23. #define memptr long
  24. #else
  25. #define memptr unsigned
  26. #endif
  27. /* misc.c */
  28. extern memptr free_mem_ptr;
  29. extern memptr free_mem_end_ptr;
  30. extern struct boot_params *boot_params;
  31. void __putstr(const char *s);
  32. void __puthex(unsigned long value);
  33. #define error_putstr(__x) __putstr(__x)
  34. #define error_puthex(__x) __puthex(__x)
  35. #ifdef CONFIG_X86_VERBOSE_BOOTUP
  36. #define debug_putstr(__x) __putstr(__x)
  37. #define debug_puthex(__x) __puthex(__x)
  38. #define debug_putaddr(__x) { \
  39. debug_putstr(#__x ": 0x"); \
  40. debug_puthex((unsigned long)(__x)); \
  41. debug_putstr("\n"); \
  42. }
  43. #else
  44. static inline void debug_putstr(const char *s)
  45. { }
  46. static inline void debug_puthex(const char *s)
  47. { }
  48. #define debug_putaddr(x) /* */
  49. #endif
  50. #if CONFIG_EARLY_PRINTK || CONFIG_RANDOMIZE_BASE
  51. /* cmdline.c */
  52. int cmdline_find_option(const char *option, char *buffer, int bufsize);
  53. int cmdline_find_option_bool(const char *option);
  54. #endif
  55. #if CONFIG_RANDOMIZE_BASE
  56. /* kaslr.c */
  57. void choose_random_location(unsigned long input,
  58. unsigned long input_size,
  59. unsigned long *output,
  60. unsigned long output_size,
  61. unsigned long *virt_addr);
  62. /* cpuflags.c */
  63. bool has_cpuflag(int flag);
  64. #else
  65. static inline void choose_random_location(unsigned long input,
  66. unsigned long input_size,
  67. unsigned long *output,
  68. unsigned long output_size,
  69. unsigned long *virt_addr)
  70. {
  71. }
  72. #endif
  73. #ifdef CONFIG_X86_64
  74. void initialize_identity_maps(void);
  75. void add_identity_map(unsigned long start, unsigned long size);
  76. void finalize_identity_maps(void);
  77. extern unsigned char _pgtable[];
  78. #else
  79. static inline void initialize_identity_maps(void)
  80. { }
  81. static inline void add_identity_map(unsigned long start, unsigned long size)
  82. { }
  83. static inline void finalize_identity_maps(void)
  84. { }
  85. #endif
  86. #ifdef CONFIG_EARLY_PRINTK
  87. /* early_serial_console.c */
  88. extern int early_serial_base;
  89. void console_init(void);
  90. #else
  91. static const int early_serial_base;
  92. static inline void console_init(void)
  93. { }
  94. #endif
  95. #endif