Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[sfrench/cifs-2.6.git] / arch / x86 / include / asm / realmode.h
1 #ifndef _ARCH_X86_REALMODE_H
2 #define _ARCH_X86_REALMODE_H
3
4 /*
5  * Flag bit definitions for use with the flags field of the trampoline header
6  * in the CONFIG_X86_64 variant.
7  */
8 #define TH_FLAGS_SME_ACTIVE_BIT         0
9 #define TH_FLAGS_SME_ACTIVE             BIT(TH_FLAGS_SME_ACTIVE_BIT)
10
11 #ifndef __ASSEMBLY__
12
13 #include <linux/types.h>
14 #include <asm/io.h>
15
16 /* This must match data at realmode.S */
17 struct real_mode_header {
18         u32     text_start;
19         u32     ro_end;
20         /* SMP trampoline */
21         u32     trampoline_start;
22         u32     trampoline_status;
23         u32     trampoline_header;
24 #ifdef CONFIG_X86_64
25         u32     trampoline_pgd;
26 #endif
27         /* ACPI S3 wakeup */
28 #ifdef CONFIG_ACPI_SLEEP
29         u32     wakeup_start;
30         u32     wakeup_header;
31 #endif
32         /* APM/BIOS reboot */
33         u32     machine_real_restart_asm;
34 #ifdef CONFIG_X86_64
35         u32     machine_real_restart_seg;
36 #endif
37 };
38
39 /* This must match data at trampoline_32/64.S */
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;       /* already allocated. */
75
76         return ALIGN(real_mode_blob_end - real_mode_blob, PAGE_SIZE);
77 }
78
79 void set_real_mode_mem(phys_addr_t mem, size_t size);
80 void reserve_real_mode(void);
81
82 #endif /* __ASSEMBLY__ */
83
84 #endif /* _ARCH_X86_REALMODE_H */