This source file includes following definitions.
- real_mode_size_needed
- set_real_mode_mem
1
2 #ifndef _ARCH_X86_REALMODE_H
3 #define _ARCH_X86_REALMODE_H
4
5
6
7
8
9 #define TH_FLAGS_SME_ACTIVE_BIT 0
10 #define TH_FLAGS_SME_ACTIVE BIT(TH_FLAGS_SME_ACTIVE_BIT)
11
12 #ifndef __ASSEMBLY__
13
14 #include <linux/types.h>
15 #include <asm/io.h>
16
17
18 struct real_mode_header {
19 u32 text_start;
20 u32 ro_end;
21
22 u32 trampoline_start;
23 u32 trampoline_header;
24 #ifdef CONFIG_X86_64
25 u32 trampoline_pgd;
26 #endif
27
28 #ifdef CONFIG_ACPI_SLEEP
29 u32 wakeup_start;
30 u32 wakeup_header;
31 #endif
32
33 u32 machine_real_restart_asm;
34 #ifdef CONFIG_X86_64
35 u32 machine_real_restart_seg;
36 #endif
37 };
38
39
40 struct trampoline_header {
41 #ifdef CONFIG_X86_32
42 u32 start;
43 u16 gdt_pad;
44 u16 gdt_limit;
45 u32 gdt_base;
46 #else
47 u64 start;
48 u64 efer;
49 u32 cr4;
50 u32 flags;
51 #endif
52 };
53
54 extern struct real_mode_header *real_mode_header;
55 extern unsigned char real_mode_blob_end[];
56
57 extern unsigned long initial_code;
58 extern unsigned long initial_gs;
59 extern unsigned long initial_stack;
60
61 extern unsigned char real_mode_blob[];
62 extern unsigned char real_mode_relocs[];
63
64 #ifdef CONFIG_X86_32
65 extern unsigned char startup_32_smp[];
66 extern unsigned char boot_gdt[];
67 #else
68 extern unsigned char secondary_startup_64[];
69 #endif
70
71 static inline size_t real_mode_size_needed(void)
72 {
73 if (real_mode_header)
74 return 0;
75
76 return ALIGN(real_mode_blob_end - real_mode_blob, PAGE_SIZE);
77 }
78
79 static inline void set_real_mode_mem(phys_addr_t mem)
80 {
81 real_mode_header = (struct real_mode_header *) __va(mem);
82 }
83
84 void reserve_real_mode(void);
85
86 #endif
87
88 #endif