11965aae3SH. Peter Anvin #ifndef _ASM_X86_SETUP_H 21965aae3SH. Peter Anvin #define _ASM_X86_SETUP_H 3bb898558SAl Viro 4dbca1df4SCyrill Gorcunov #ifdef __KERNEL__ 5dbca1df4SCyrill Gorcunov 6bb898558SAl Viro #define COMMAND_LINE_SIZE 2048 7bb898558SAl Viro 8bb898558SAl Viro #ifndef __ASSEMBLY__ 9bb898558SAl Viro 10bb898558SAl Viro /* 11bb898558SAl Viro * Any setup quirks to be performed? 12bb898558SAl Viro */ 13f4f21b71SJaswinder Singh Rajput struct mpc_cpu; 1400fb8606SJaswinder Singh Rajput struct mpc_bus; 15b0e239ffSJaswinder Singh Rajput struct mpc_oemtable; 168e6dafd6SIngo Molnar 17bb898558SAl Viro struct x86_quirks { 18bb898558SAl Viro int (*arch_pre_time_init)(void); 19bb898558SAl Viro int (*arch_time_init)(void); 20bb898558SAl Viro int (*arch_pre_intr_init)(void); 21bb898558SAl Viro int (*arch_intr_init)(void); 22bb898558SAl Viro int (*arch_trap_init)(void); 23bb898558SAl Viro char * (*arch_memory_setup)(void); 24bb898558SAl Viro int (*mach_get_smp_config)(unsigned int early); 25bb898558SAl Viro int (*mach_find_smp_config)(unsigned int reserve); 26bb898558SAl Viro 27bb898558SAl Viro int *mpc_record; 28f4f21b71SJaswinder Singh Rajput int (*mpc_apic_id)(struct mpc_cpu *m); 2900fb8606SJaswinder Singh Rajput void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); 3000fb8606SJaswinder Singh Rajput void (*mpc_oem_pci_bus)(struct mpc_bus *m); 31b0e239ffSJaswinder Singh Rajput void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, 32bb898558SAl Viro unsigned short oemsize); 33bb898558SAl Viro int (*setup_ioapic_ids)(void); 34bb898558SAl Viro }; 35bb898558SAl Viro 368e6dafd6SIngo Molnar extern void x86_quirk_pre_intr_init(void); 378e6dafd6SIngo Molnar extern void x86_quirk_intr_init(void); 388e6dafd6SIngo Molnar 398e6dafd6SIngo Molnar extern void x86_quirk_trap_init(void); 408e6dafd6SIngo Molnar 418e6dafd6SIngo Molnar extern void x86_quirk_pre_time_init(void); 428e6dafd6SIngo Molnar extern void x86_quirk_time_init(void); 438e6dafd6SIngo Molnar 44bb898558SAl Viro #endif /* __ASSEMBLY__ */ 45bb898558SAl Viro 46bb898558SAl Viro #ifdef __i386__ 47bb898558SAl Viro 48bb898558SAl Viro #include <linux/pfn.h> 49bb898558SAl Viro /* 50bb898558SAl Viro * Reserved space for vmalloc and iomap - defined in asm/page.h 51bb898558SAl Viro */ 52bb898558SAl Viro #define MAXMEM_PFN PFN_DOWN(MAXMEM) 53bb898558SAl Viro #define MAX_NONPAE_PFN (1 << 20) 54bb898558SAl Viro 55bb898558SAl Viro #endif /* __i386__ */ 56bb898558SAl Viro 57bb898558SAl Viro #define PARAM_SIZE 4096 /* sizeof(struct boot_params) */ 58bb898558SAl Viro 59bb898558SAl Viro #define OLD_CL_MAGIC 0xA33F 60bb898558SAl Viro #define OLD_CL_ADDRESS 0x020 /* Relative to real mode data */ 61bb898558SAl Viro #define NEW_CL_POINTER 0x228 /* Relative to real mode data */ 62bb898558SAl Viro 63bb898558SAl Viro #ifndef __ASSEMBLY__ 64bb898558SAl Viro #include <asm/bootparam.h> 65bb898558SAl Viro 6615c55443SJaswinder Singh Rajput /* Interrupt control for vSMPowered x86_64 systems */ 67129d8bc8SYinghai Lu #ifdef CONFIG_X86_VSMP 6815c55443SJaswinder Singh Rajput void vsmp_init(void); 69129d8bc8SYinghai Lu #else 70129d8bc8SYinghai Lu static inline void vsmp_init(void) { } 71129d8bc8SYinghai Lu #endif 7215c55443SJaswinder Singh Rajput 7315c55443SJaswinder Singh Rajput void setup_bios_corruption_check(void); 7415c55443SJaswinder Singh Rajput 7515c55443SJaswinder Singh Rajput #ifdef CONFIG_X86_VISWS 7615c55443SJaswinder Singh Rajput extern void visws_early_detect(void); 7715c55443SJaswinder Singh Rajput extern int is_visws_box(void); 7815c55443SJaswinder Singh Rajput #else 7915c55443SJaswinder Singh Rajput static inline void visws_early_detect(void) { } 8015c55443SJaswinder Singh Rajput static inline int is_visws_box(void) { return 0; } 8115c55443SJaswinder Singh Rajput #endif 8215c55443SJaswinder Singh Rajput 8315c55443SJaswinder Singh Rajput extern struct x86_quirks *x86_quirks; 8415c55443SJaswinder Singh Rajput extern unsigned long saved_video_mode; 8515c55443SJaswinder Singh Rajput 8615c55443SJaswinder Singh Rajput #ifndef CONFIG_PARAVIRT 8715c55443SJaswinder Singh Rajput #define paravirt_post_allocator_init() do {} while (0) 8815c55443SJaswinder Singh Rajput #endif 8915c55443SJaswinder Singh Rajput 90bb898558SAl Viro #ifndef _SETUP 91bb898558SAl Viro 92bb898558SAl Viro /* 93bb898558SAl Viro * This is set up by the setup-routine at boot-time 94bb898558SAl Viro */ 95bb898558SAl Viro extern struct boot_params boot_params; 96bb898558SAl Viro 97bb898558SAl Viro /* 98bb898558SAl Viro * Do NOT EVER look at the BIOS memory size location. 99bb898558SAl Viro * It does not work on many machines. 100bb898558SAl Viro */ 101bb898558SAl Viro #define LOWMEMSIZE() (0x9f000) 102bb898558SAl Viro 10393dbda7cSJeremy Fitzhardinge /* exceedingly early brk-like allocator */ 10493dbda7cSJeremy Fitzhardinge extern unsigned long _brk_end; 10593dbda7cSJeremy Fitzhardinge void *extend_brk(size_t size, size_t align); 10693dbda7cSJeremy Fitzhardinge 107*796216a5SJeremy Fitzhardinge /* 108*796216a5SJeremy Fitzhardinge * Reserve space in the brk section. The name must be unique within 109*796216a5SJeremy Fitzhardinge * the file, and somewhat descriptive. The size is in bytes. Must be 110*796216a5SJeremy Fitzhardinge * used at file scope. 111*796216a5SJeremy Fitzhardinge * 112*796216a5SJeremy Fitzhardinge * (This uses a temp function to wrap the asm so we can pass it the 113*796216a5SJeremy Fitzhardinge * size parameter; otherwise we wouldn't be able to. We can't use a 114*796216a5SJeremy Fitzhardinge * "section" attribute on a normal variable because it always ends up 115*796216a5SJeremy Fitzhardinge * being @progbits, which ends up allocating space in the vmlinux 116*796216a5SJeremy Fitzhardinge * executable.) 117*796216a5SJeremy Fitzhardinge */ 118*796216a5SJeremy Fitzhardinge #define RESERVE_BRK(name,sz) \ 119*796216a5SJeremy Fitzhardinge static void __section(.discard) __used \ 120*796216a5SJeremy Fitzhardinge __brk_reservation_fn_##name##__(void) { \ 121*796216a5SJeremy Fitzhardinge asm volatile ( \ 122*796216a5SJeremy Fitzhardinge ".pushsection .brk_reservation,\"aw\",@nobits;" \ 123*796216a5SJeremy Fitzhardinge "__brk_reservation_" #name "__:" \ 124*796216a5SJeremy Fitzhardinge " 1:.skip %c0;" \ 125*796216a5SJeremy Fitzhardinge " .size __brk_reservation_" #name "__, . - 1b;" \ 126*796216a5SJeremy Fitzhardinge " .popsection" \ 127*796216a5SJeremy Fitzhardinge : : "i" (sz)); \ 128*796216a5SJeremy Fitzhardinge } 129*796216a5SJeremy Fitzhardinge 130bb898558SAl Viro #ifdef __i386__ 131bb898558SAl Viro 132bb898558SAl Viro void __init i386_start_kernel(void); 133bb898558SAl Viro extern void probe_roms(void); 134bb898558SAl Viro 135bb898558SAl Viro #else 136bb898558SAl Viro void __init x86_64_start_kernel(char *real_mode); 137bb898558SAl Viro void __init x86_64_start_reservations(char *real_mode_data); 138bb898558SAl Viro 139bb898558SAl Viro #endif /* __i386__ */ 140bb898558SAl Viro #endif /* _SETUP */ 141*796216a5SJeremy Fitzhardinge #else 142*796216a5SJeremy Fitzhardinge #define RESERVE_BRK(name,sz) \ 143*796216a5SJeremy Fitzhardinge .pushsection .brk_reservation,"aw",@nobits; \ 144*796216a5SJeremy Fitzhardinge __brk_reservation_##name##__: \ 145*796216a5SJeremy Fitzhardinge 1: .skip sz; \ 146*796216a5SJeremy Fitzhardinge .size __brk_reservation_##name##__,.-1b; \ 147*796216a5SJeremy Fitzhardinge .popsection 148bb898558SAl Viro #endif /* __ASSEMBLY__ */ 149bb898558SAl Viro #endif /* __KERNEL__ */ 150bb898558SAl Viro 1511965aae3SH. Peter Anvin #endif /* _ASM_X86_SETUP_H */ 152