setup.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef _ASM_X86_SETUP_H
  2. #define _ASM_X86_SETUP_H
  3. #include <uapi/asm/setup.h>
  4. #define COMMAND_LINE_SIZE 2048
  5. #include <linux/linkage.h>
  6. #ifdef __i386__
  7. #include <linux/pfn.h>
  8. /*
  9. * Reserved space for vmalloc and iomap - defined in asm/page.h
  10. */
  11. #define MAXMEM_PFN PFN_DOWN(MAXMEM)
  12. #define MAX_NONPAE_PFN (1 << 20)
  13. #endif /* __i386__ */
  14. #define PARAM_SIZE 4096 /* sizeof(struct boot_params) */
  15. #define OLD_CL_MAGIC 0xA33F
  16. #define OLD_CL_ADDRESS 0x020 /* Relative to real mode data */
  17. #define NEW_CL_POINTER 0x228 /* Relative to real mode data */
  18. #ifndef __ASSEMBLY__
  19. #include <asm/bootparam.h>
  20. #include <asm/x86_init.h>
  21. extern u64 relocated_ramdisk;
  22. /* Interrupt control for vSMPowered x86_64 systems */
  23. #ifdef CONFIG_X86_64
  24. void vsmp_init(void);
  25. #else
  26. static inline void vsmp_init(void) { }
  27. #endif
  28. void setup_bios_corruption_check(void);
  29. extern unsigned long saved_video_mode;
  30. extern void reserve_standard_io_resources(void);
  31. extern void i386_reserve_resources(void);
  32. extern void setup_default_timer_irq(void);
  33. #ifdef CONFIG_X86_INTEL_MID
  34. extern void x86_intel_mid_early_setup(void);
  35. #else
  36. static inline void x86_intel_mid_early_setup(void) { }
  37. #endif
  38. #ifdef CONFIG_X86_INTEL_CE
  39. extern void x86_ce4100_early_setup(void);
  40. #else
  41. static inline void x86_ce4100_early_setup(void) { }
  42. #endif
  43. #ifndef _SETUP
  44. #include <asm/espfix.h>
  45. /*
  46. * This is set up by the setup-routine at boot-time
  47. */
  48. extern struct boot_params boot_params;
  49. static inline bool kaslr_enabled(void)
  50. {
  51. return !!(boot_params.hdr.loadflags & KASLR_FLAG);
  52. }
  53. /*
  54. * Do NOT EVER look at the BIOS memory size location.
  55. * It does not work on many machines.
  56. */
  57. #define LOWMEMSIZE() (0x9f000)
  58. /* exceedingly early brk-like allocator */
  59. extern unsigned long _brk_end;
  60. void *extend_brk(size_t size, size_t align);
  61. /*
  62. * Reserve space in the brk section. The name must be unique within
  63. * the file, and somewhat descriptive. The size is in bytes. Must be
  64. * used at file scope.
  65. *
  66. * (This uses a temp function to wrap the asm so we can pass it the
  67. * size parameter; otherwise we wouldn't be able to. We can't use a
  68. * "section" attribute on a normal variable because it always ends up
  69. * being @progbits, which ends up allocating space in the vmlinux
  70. * executable.)
  71. */
  72. #define RESERVE_BRK(name,sz) \
  73. static void __section(.discard.text) __used notrace \
  74. __brk_reservation_fn_##name##__(void) { \
  75. asm volatile ( \
  76. ".pushsection .brk_reservation,\"aw\",@nobits;" \
  77. ".brk." #name ":" \
  78. " 1:.skip %c0;" \
  79. " .size .brk." #name ", . - 1b;" \
  80. " .popsection" \
  81. : : "i" (sz)); \
  82. }
  83. /* Helper for reserving space for arrays of things */
  84. #define RESERVE_BRK_ARRAY(type, name, entries) \
  85. type *name; \
  86. RESERVE_BRK(name, sizeof(type) * entries)
  87. extern void probe_roms(void);
  88. #ifdef __i386__
  89. asmlinkage void __init i386_start_kernel(void);
  90. #else
  91. asmlinkage void __init x86_64_start_kernel(char *real_mode);
  92. asmlinkage void __init x86_64_start_reservations(char *real_mode_data);
  93. #endif /* __i386__ */
  94. #endif /* _SETUP */
  95. #else
  96. #define RESERVE_BRK(name,sz) \
  97. .pushsection .brk_reservation,"aw",@nobits; \
  98. .brk.name: \
  99. 1: .skip sz; \
  100. .size .brk.name,.-1b; \
  101. .popsection
  102. #endif /* __ASSEMBLY__ */
  103. #endif /* _ASM_X86_SETUP_H */