]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - arch/x86/include/asm/setup.h
UBUNTU: SAUCE: (efi-lockdown) Add a SysRq option to lift kernel lockdown
[mirror_ubuntu-eoan-kernel.git] / arch / x86 / include / asm / setup.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1965aae3
PA
2#ifndef _ASM_X86_SETUP_H
3#define _ASM_X86_SETUP_H
ef685298 4
af170c50
DH
5#include <uapi/asm/setup.h>
6
ef685298
TG
7#define COMMAND_LINE_SIZE 2048
8
a1ed4ddf 9#include <linux/linkage.h>
35de5b06 10#include <asm/page_types.h>
a1ed4ddf 11
3da3c68e
KM
12#define LOCKDOWN_LIFT_KEY 'x'
13
ef685298
TG
14#ifdef __i386__
15
16#include <linux/pfn.h>
17/*
18 * Reserved space for vmalloc and iomap - defined in asm/page.h
19 */
20#define MAXMEM_PFN PFN_DOWN(MAXMEM)
21#define MAX_NONPAE_PFN (1 << 20)
22
fa76dab9
PA
23#endif /* __i386__ */
24
25#define PARAM_SIZE 4096 /* sizeof(struct boot_params) */
ef685298 26
ef685298 27#define OLD_CL_MAGIC 0xA33F
fa76dab9 28#define OLD_CL_ADDRESS 0x020 /* Relative to real mode data */
ef685298
TG
29#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
30
ef685298
TG
31#ifndef __ASSEMBLY__
32#include <asm/bootparam.h>
845b3944 33#include <asm/x86_init.h>
ef685298 34
5aa3d718
BP
35extern u64 relocated_ramdisk;
36
15c55443 37/* Interrupt control for vSMPowered x86_64 systems */
70511134 38#ifdef CONFIG_X86_64
15c55443 39void vsmp_init(void);
129d8bc8
YL
40#else
41static inline void vsmp_init(void) { }
42#endif
15c55443
JSR
43
44void setup_bios_corruption_check(void);
630b3aff 45void early_platform_quirks(void);
15c55443 46
15c55443
JSR
47extern unsigned long saved_video_mode;
48
8fee697d
TG
49extern void reserve_standard_io_resources(void);
50extern void i386_reserve_resources(void);
ad3bc25a
BP
51extern unsigned long __startup_64(unsigned long physaddr, struct boot_params *bp);
52extern unsigned long __startup_secondary_64(void);
53extern int early_make_pgtable(unsigned long address);
8fee697d 54
933b9463 55#ifdef CONFIG_X86_INTEL_MID
712b6aa8 56extern void x86_intel_mid_early_setup(void);
3f4110a4 57#else
712b6aa8 58static inline void x86_intel_mid_early_setup(void) { }
3f4110a4
TG
59#endif
60
c751e17b
TG
61#ifdef CONFIG_X86_INTEL_CE
62extern void x86_ce4100_early_setup(void);
63#else
64static inline void x86_ce4100_early_setup(void) { }
65#endif
66
fa76dab9
PA
67#ifndef _SETUP
68
e1fe9ed8 69#include <asm/espfix.h>
535b3ddc 70#include <linux/kernel.h>
e1fe9ed8 71
ef685298
TG
72/*
73 * This is set up by the setup-routine at boot-time
74 */
75extern struct boot_params boot_params;
4545c898 76extern char _text[];
ef685298 77
78cac48c
BP
78static inline bool kaslr_enabled(void)
79{
80 return !!(boot_params.hdr.loadflags & KASLR_FLAG);
81}
82
4545c898
JK
83static inline unsigned long kaslr_offset(void)
84{
85 return (unsigned long)&_text - __START_KERNEL;
86}
87
ef685298
TG
88/*
89 * Do NOT EVER look at the BIOS memory size location.
90 * It does not work on many machines.
91 */
92#define LOWMEMSIZE() (0x9f000)
93
93dbda7c
JF
94/* exceedingly early brk-like allocator */
95extern unsigned long _brk_end;
96void *extend_brk(size_t size, size_t align);
97
796216a5
JF
98/*
99 * Reserve space in the brk section. The name must be unique within
100 * the file, and somewhat descriptive. The size is in bytes. Must be
101 * used at file scope.
102 *
103 * (This uses a temp function to wrap the asm so we can pass it the
104 * size parameter; otherwise we wouldn't be able to. We can't use a
105 * "section" attribute on a normal variable because it always ends up
106 * being @progbits, which ends up allocating space in the vmlinux
107 * executable.)
108 */
109#define RESERVE_BRK(name,sz) \
2895cd2a 110 static void __section(.discard.text) __used notrace \
796216a5
JF
111 __brk_reservation_fn_##name##__(void) { \
112 asm volatile ( \
113 ".pushsection .brk_reservation,\"aw\",@nobits;" \
0b1c723d 114 ".brk." #name ":" \
796216a5 115 " 1:.skip %c0;" \
0b1c723d 116 " .size .brk." #name ", . - 1b;" \
796216a5
JF
117 " .popsection" \
118 : : "i" (sz)); \
119 }
120
161b0275
JF
121/* Helper for reserving space for arrays of things */
122#define RESERVE_BRK_ARRAY(type, name, entries) \
123 type *name; \
124 RESERVE_BRK(name, sizeof(type) * entries)
125
5d94e81f 126extern void probe_roms(void);
95a71a45
YL
127#ifdef __i386__
128
a1ed4ddf 129asmlinkage void __init i386_start_kernel(void);
746ef0cd 130
102e3b8d 131#else
a1ed4ddf
AK
132asmlinkage void __init x86_64_start_kernel(char *real_mode);
133asmlinkage void __init x86_64_start_reservations(char *real_mode_data);
f97013fd 134
ef685298 135#endif /* __i386__ */
fa76dab9 136#endif /* _SETUP */
796216a5
JF
137#else
138#define RESERVE_BRK(name,sz) \
139 .pushsection .brk_reservation,"aw",@nobits; \
0b1c723d 140.brk.name: \
796216a5 1411: .skip sz; \
0b1c723d 142 .size .brk.name,.-1b; \
796216a5 143 .popsection
ef685298 144#endif /* __ASSEMBLY__ */
1965aae3 145#endif /* _ASM_X86_SETUP_H */