11965aae3SH. Peter Anvin #ifndef _ASM_X86_SETUP_H 21965aae3SH. Peter Anvin #define _ASM_X86_SETUP_H 3bb898558SAl Viro 4af170c50SDavid Howells #include <uapi/asm/setup.h> 5af170c50SDavid Howells 6bb898558SAl Viro #define COMMAND_LINE_SIZE 2048 7bb898558SAl Viro 8a1ed4ddfSAndi Kleen #include <linux/linkage.h> 9a1ed4ddfSAndi Kleen 10bb898558SAl Viro #ifdef __i386__ 11bb898558SAl Viro 12bb898558SAl Viro #include <linux/pfn.h> 13bb898558SAl Viro /* 14bb898558SAl Viro * Reserved space for vmalloc and iomap - defined in asm/page.h 15bb898558SAl Viro */ 16bb898558SAl Viro #define MAXMEM_PFN PFN_DOWN(MAXMEM) 17bb898558SAl Viro #define MAX_NONPAE_PFN (1 << 20) 18bb898558SAl Viro 19bb898558SAl Viro #endif /* __i386__ */ 20bb898558SAl Viro 21bb898558SAl Viro #define PARAM_SIZE 4096 /* sizeof(struct boot_params) */ 22bb898558SAl Viro 23bb898558SAl Viro #define OLD_CL_MAGIC 0xA33F 24bb898558SAl Viro #define OLD_CL_ADDRESS 0x020 /* Relative to real mode data */ 25bb898558SAl Viro #define NEW_CL_POINTER 0x228 /* Relative to real mode data */ 26bb898558SAl Viro 27bb898558SAl Viro #ifndef __ASSEMBLY__ 28bb898558SAl Viro #include <asm/bootparam.h> 29845b3944SThomas Gleixner #include <asm/x86_init.h> 30bb898558SAl Viro 315aa3d718SBorislav Petkov extern u64 relocated_ramdisk; 325aa3d718SBorislav Petkov 3315c55443SJaswinder Singh Rajput /* Interrupt control for vSMPowered x86_64 systems */ 3470511134SRavikiran G Thirumalai #ifdef CONFIG_X86_64 3515c55443SJaswinder Singh Rajput void vsmp_init(void); 36129d8bc8SYinghai Lu #else 37129d8bc8SYinghai Lu static inline void vsmp_init(void) { } 38129d8bc8SYinghai Lu #endif 3915c55443SJaswinder Singh Rajput 4015c55443SJaswinder Singh Rajput void setup_bios_corruption_check(void); 4115c55443SJaswinder Singh Rajput 4215c55443SJaswinder Singh Rajput extern unsigned long saved_video_mode; 4315c55443SJaswinder Singh Rajput 448fee697dSThomas Gleixner extern void reserve_standard_io_resources(void); 458fee697dSThomas Gleixner extern void i386_reserve_resources(void); 46845b3944SThomas Gleixner extern void setup_default_timer_irq(void); 478fee697dSThomas Gleixner 48933b9463SAlan Cox #ifdef CONFIG_X86_INTEL_MID 49712b6aa8SKuppuswamy Sathyanarayanan extern void x86_intel_mid_early_setup(void); 503f4110a4SThomas Gleixner #else 51712b6aa8SKuppuswamy Sathyanarayanan static inline void x86_intel_mid_early_setup(void) { } 523f4110a4SThomas Gleixner #endif 533f4110a4SThomas Gleixner 54c751e17bSThomas Gleixner #ifdef CONFIG_X86_INTEL_CE 55c751e17bSThomas Gleixner extern void x86_ce4100_early_setup(void); 56c751e17bSThomas Gleixner #else 57c751e17bSThomas Gleixner static inline void x86_ce4100_early_setup(void) { } 58c751e17bSThomas Gleixner #endif 59c751e17bSThomas Gleixner 60bb898558SAl Viro #ifndef _SETUP 61bb898558SAl Viro 62e1fe9ed8SH. Peter Anvin #include <asm/espfix.h> 63*535b3ddcSJiri Kosina #include <linux/kernel.h> 64e1fe9ed8SH. Peter Anvin 65bb898558SAl Viro /* 66bb898558SAl Viro * This is set up by the setup-routine at boot-time 67bb898558SAl Viro */ 68bb898558SAl Viro extern struct boot_params boot_params; 694545c898SJiri Kosina extern char _text[]; 70bb898558SAl Viro 7178cac48cSBorislav Petkov static inline bool kaslr_enabled(void) 7278cac48cSBorislav Petkov { 7378cac48cSBorislav Petkov return !!(boot_params.hdr.loadflags & KASLR_FLAG); 7478cac48cSBorislav Petkov } 7578cac48cSBorislav Petkov 764545c898SJiri Kosina static inline unsigned long kaslr_offset(void) 774545c898SJiri Kosina { 784545c898SJiri Kosina return (unsigned long)&_text - __START_KERNEL; 794545c898SJiri Kosina } 804545c898SJiri Kosina 81bb898558SAl Viro /* 82bb898558SAl Viro * Do NOT EVER look at the BIOS memory size location. 83bb898558SAl Viro * It does not work on many machines. 84bb898558SAl Viro */ 85bb898558SAl Viro #define LOWMEMSIZE() (0x9f000) 86bb898558SAl Viro 8793dbda7cSJeremy Fitzhardinge /* exceedingly early brk-like allocator */ 8893dbda7cSJeremy Fitzhardinge extern unsigned long _brk_end; 8993dbda7cSJeremy Fitzhardinge void *extend_brk(size_t size, size_t align); 9093dbda7cSJeremy Fitzhardinge 91796216a5SJeremy Fitzhardinge /* 92796216a5SJeremy Fitzhardinge * Reserve space in the brk section. The name must be unique within 93796216a5SJeremy Fitzhardinge * the file, and somewhat descriptive. The size is in bytes. Must be 94796216a5SJeremy Fitzhardinge * used at file scope. 95796216a5SJeremy Fitzhardinge * 96796216a5SJeremy Fitzhardinge * (This uses a temp function to wrap the asm so we can pass it the 97796216a5SJeremy Fitzhardinge * size parameter; otherwise we wouldn't be able to. We can't use a 98796216a5SJeremy Fitzhardinge * "section" attribute on a normal variable because it always ends up 99796216a5SJeremy Fitzhardinge * being @progbits, which ends up allocating space in the vmlinux 100796216a5SJeremy Fitzhardinge * executable.) 101796216a5SJeremy Fitzhardinge */ 102796216a5SJeremy Fitzhardinge #define RESERVE_BRK(name,sz) \ 1032895cd2aSSteven Rostedt static void __section(.discard.text) __used notrace \ 104796216a5SJeremy Fitzhardinge __brk_reservation_fn_##name##__(void) { \ 105796216a5SJeremy Fitzhardinge asm volatile ( \ 106796216a5SJeremy Fitzhardinge ".pushsection .brk_reservation,\"aw\",@nobits;" \ 1070b1c723dSJeremy Fitzhardinge ".brk." #name ":" \ 108796216a5SJeremy Fitzhardinge " 1:.skip %c0;" \ 1090b1c723dSJeremy Fitzhardinge " .size .brk." #name ", . - 1b;" \ 110796216a5SJeremy Fitzhardinge " .popsection" \ 111796216a5SJeremy Fitzhardinge : : "i" (sz)); \ 112796216a5SJeremy Fitzhardinge } 113796216a5SJeremy Fitzhardinge 114161b0275SJeremy Fitzhardinge /* Helper for reserving space for arrays of things */ 115161b0275SJeremy Fitzhardinge #define RESERVE_BRK_ARRAY(type, name, entries) \ 116161b0275SJeremy Fitzhardinge type *name; \ 117161b0275SJeremy Fitzhardinge RESERVE_BRK(name, sizeof(type) * entries) 118161b0275SJeremy Fitzhardinge 1195d94e81fSDan Williams extern void probe_roms(void); 120bb898558SAl Viro #ifdef __i386__ 121bb898558SAl Viro 122a1ed4ddfSAndi Kleen asmlinkage void __init i386_start_kernel(void); 123bb898558SAl Viro 124bb898558SAl Viro #else 125a1ed4ddfSAndi Kleen asmlinkage void __init x86_64_start_kernel(char *real_mode); 126a1ed4ddfSAndi Kleen asmlinkage void __init x86_64_start_reservations(char *real_mode_data); 127bb898558SAl Viro 128bb898558SAl Viro #endif /* __i386__ */ 129bb898558SAl Viro #endif /* _SETUP */ 130796216a5SJeremy Fitzhardinge #else 131796216a5SJeremy Fitzhardinge #define RESERVE_BRK(name,sz) \ 132796216a5SJeremy Fitzhardinge .pushsection .brk_reservation,"aw",@nobits; \ 1330b1c723dSJeremy Fitzhardinge .brk.name: \ 134796216a5SJeremy Fitzhardinge 1: .skip sz; \ 1350b1c723dSJeremy Fitzhardinge .size .brk.name,.-1b; \ 136796216a5SJeremy Fitzhardinge .popsection 137bb898558SAl Viro #endif /* __ASSEMBLY__ */ 1381965aae3SH. Peter Anvin #endif /* _ASM_X86_SETUP_H */ 139