xref: /openbmc/linux/arch/x86/include/asm/realmode.h (revision 4f6cce39)
1 #ifndef _ARCH_X86_REALMODE_H
2 #define _ARCH_X86_REALMODE_H
3 
4 #include <linux/types.h>
5 #include <asm/io.h>
6 
7 /* This must match data at realmode.S */
8 struct real_mode_header {
9 	u32	text_start;
10 	u32	ro_end;
11 	/* SMP trampoline */
12 	u32	trampoline_start;
13 	u32	trampoline_status;
14 	u32	trampoline_header;
15 #ifdef CONFIG_X86_64
16 	u32	trampoline_pgd;
17 #endif
18 	/* ACPI S3 wakeup */
19 #ifdef CONFIG_ACPI_SLEEP
20 	u32	wakeup_start;
21 	u32	wakeup_header;
22 #endif
23 	/* APM/BIOS reboot */
24 	u32	machine_real_restart_asm;
25 #ifdef CONFIG_X86_64
26 	u32	machine_real_restart_seg;
27 #endif
28 };
29 
30 /* This must match data at trampoline_32/64.S */
31 struct trampoline_header {
32 #ifdef CONFIG_X86_32
33 	u32 start;
34 	u16 gdt_pad;
35 	u16 gdt_limit;
36 	u32 gdt_base;
37 #else
38 	u64 start;
39 	u64 efer;
40 	u32 cr4;
41 #endif
42 };
43 
44 extern struct real_mode_header *real_mode_header;
45 extern unsigned char real_mode_blob_end[];
46 
47 extern unsigned long initial_code;
48 extern unsigned long initial_gs;
49 extern unsigned long initial_stack;
50 
51 extern unsigned char real_mode_blob[];
52 extern unsigned char real_mode_relocs[];
53 
54 #ifdef CONFIG_X86_32
55 extern unsigned char startup_32_smp[];
56 extern unsigned char boot_gdt[];
57 #else
58 extern unsigned char secondary_startup_64[];
59 #endif
60 
61 static inline size_t real_mode_size_needed(void)
62 {
63 	if (real_mode_header)
64 		return 0;	/* already allocated. */
65 
66 	return ALIGN(real_mode_blob_end - real_mode_blob, PAGE_SIZE);
67 }
68 
69 void set_real_mode_mem(phys_addr_t mem, size_t size);
70 void reserve_real_mode(void);
71 
72 #endif /* _ARCH_X86_REALMODE_H */
73