Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_SETUP_H
0003 #define _ASM_X86_SETUP_H
0004 
0005 #include <uapi/asm/setup.h>
0006 
0007 #define COMMAND_LINE_SIZE 2048
0008 
0009 #include <linux/linkage.h>
0010 #include <asm/page_types.h>
0011 #include <asm/ibt.h>
0012 
0013 #ifdef __i386__
0014 
0015 #include <linux/pfn.h>
0016 /*
0017  * Reserved space for vmalloc and iomap - defined in asm/page.h
0018  */
0019 #define MAXMEM_PFN  PFN_DOWN(MAXMEM)
0020 #define MAX_NONPAE_PFN  (1 << 20)
0021 
0022 #endif /* __i386__ */
0023 
0024 #define PARAM_SIZE 4096     /* sizeof(struct boot_params) */
0025 
0026 #define OLD_CL_MAGIC        0xA33F
0027 #define OLD_CL_ADDRESS      0x020   /* Relative to real mode data */
0028 #define NEW_CL_POINTER      0x228   /* Relative to real mode data */
0029 
0030 #ifndef __ASSEMBLY__
0031 #include <asm/bootparam.h>
0032 #include <asm/x86_init.h>
0033 
0034 extern u64 relocated_ramdisk;
0035 
0036 /* Interrupt control for vSMPowered x86_64 systems */
0037 #ifdef CONFIG_X86_64
0038 void vsmp_init(void);
0039 #else
0040 static inline void vsmp_init(void) { }
0041 #endif
0042 
0043 struct pt_regs;
0044 
0045 void setup_bios_corruption_check(void);
0046 void early_platform_quirks(void);
0047 
0048 extern unsigned long saved_video_mode;
0049 
0050 extern void reserve_standard_io_resources(void);
0051 extern void i386_reserve_resources(void);
0052 extern unsigned long __startup_64(unsigned long physaddr, struct boot_params *bp);
0053 extern void startup_64_setup_env(unsigned long physbase);
0054 extern void early_setup_idt(void);
0055 extern void __init do_early_exception(struct pt_regs *regs, int trapnr);
0056 
0057 #ifdef CONFIG_X86_INTEL_MID
0058 extern void x86_intel_mid_early_setup(void);
0059 #else
0060 static inline void x86_intel_mid_early_setup(void) { }
0061 #endif
0062 
0063 #ifdef CONFIG_X86_INTEL_CE
0064 extern void x86_ce4100_early_setup(void);
0065 #else
0066 static inline void x86_ce4100_early_setup(void) { }
0067 #endif
0068 
0069 #ifndef _SETUP
0070 
0071 #include <asm/espfix.h>
0072 #include <linux/kernel.h>
0073 
0074 /*
0075  * This is set up by the setup-routine at boot-time
0076  */
0077 extern struct boot_params boot_params;
0078 extern char _text[];
0079 
0080 static inline bool kaslr_enabled(void)
0081 {
0082     return IS_ENABLED(CONFIG_RANDOMIZE_MEMORY) &&
0083         !!(boot_params.hdr.loadflags & KASLR_FLAG);
0084 }
0085 
0086 /*
0087  * Apply no randomization if KASLR was disabled at boot or if KASAN
0088  * is enabled. KASAN shadow mappings rely on regions being PGD aligned.
0089  */
0090 static inline bool kaslr_memory_enabled(void)
0091 {
0092     return kaslr_enabled() && !IS_ENABLED(CONFIG_KASAN);
0093 }
0094 
0095 static inline unsigned long kaslr_offset(void)
0096 {
0097     return (unsigned long)&_text - __START_KERNEL;
0098 }
0099 
0100 /*
0101  * Do NOT EVER look at the BIOS memory size location.
0102  * It does not work on many machines.
0103  */
0104 #define LOWMEMSIZE()    (0x9f000)
0105 
0106 /* exceedingly early brk-like allocator */
0107 extern unsigned long _brk_end;
0108 void *extend_brk(size_t size, size_t align);
0109 
0110 /*
0111  * Reserve space in the .brk section, which is a block of memory from which the
0112  * caller is allowed to allocate very early (before even memblock is available)
0113  * by calling extend_brk().  All allocated memory will be eventually converted
0114  * to memblock.  Any leftover unallocated memory will be freed.
0115  *
0116  * The size is in bytes.
0117  */
0118 #define RESERVE_BRK(name, size)                 \
0119     __section(".bss..brk") __aligned(1) __used  \
0120     static char __brk_##name[size]
0121 
0122 extern void probe_roms(void);
0123 
0124 void clear_bss(void);
0125 
0126 #ifdef __i386__
0127 
0128 asmlinkage void __init i386_start_kernel(void);
0129 
0130 #else
0131 asmlinkage void __init x86_64_start_kernel(char *real_mode);
0132 asmlinkage void __init x86_64_start_reservations(char *real_mode_data);
0133 
0134 #endif /* __i386__ */
0135 #endif /* _SETUP */
0136 
0137 #else  /* __ASSEMBLY */
0138 
0139 .macro __RESERVE_BRK name, size
0140     .pushsection .bss..brk, "aw"
0141 SYM_DATA_START(__brk_\name)
0142     .skip \size
0143 SYM_DATA_END(__brk_\name)
0144     .popsection
0145 .endm
0146 
0147 #define RESERVE_BRK(name, size) __RESERVE_BRK name, size
0148 
0149 #endif /* __ASSEMBLY__ */
0150 
0151 #endif /* _ASM_X86_SETUP_H */