aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/acpi/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/acpi/sleep.c')
-rw-r--r--arch/x86/kernel/acpi/sleep.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 882e970032d5..868de3d5c39d 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -23,6 +23,15 @@ static unsigned long acpi_realmode;
23static char temp_stack[10240]; 23static char temp_stack[10240];
24#endif 24#endif
25 25
26/* XXX: this macro should move to asm-x86/segment.h and be shared with the
27 boot code... */
28#define GDT_ENTRY(flags, base, limit) \
29 (((u64)(base & 0xff000000) << 32) | \
30 ((u64)flags << 40) | \
31 ((u64)(limit & 0x00ff0000) << 32) | \
32 ((u64)(base & 0x00ffffff) << 16) | \
33 ((u64)(limit & 0x0000ffff)))
34
26/** 35/**
27 * acpi_save_state_mem - save kernel state 36 * acpi_save_state_mem - save kernel state
28 * 37 *
@@ -50,6 +59,29 @@ int acpi_save_state_mem(void)
50 59
51 header->video_mode = saved_video_mode; 60 header->video_mode = saved_video_mode;
52 61
62 header->wakeup_jmp_seg = acpi_wakeup_address >> 4;
63
64 /*
65 * Set up the wakeup GDT. We set these up as Big Real Mode,
66 * that is, with limits set to 4 GB. At least the Lenovo
67 * Thinkpad X61 is known to need this for the video BIOS
68 * initialization quirk to work; this is likely to also
69 * be the case for other laptops or integrated video devices.
70 */
71
72 /* GDT[0]: GDT self-pointer */
73 header->wakeup_gdt[0] =
74 (u64)(sizeof(header->wakeup_gdt) - 1) +
75 ((u64)(acpi_wakeup_address +
76 ((char *)&header->wakeup_gdt - (char *)acpi_realmode))
77 << 16);
78 /* GDT[1]: big real mode-like code segment */
79 header->wakeup_gdt[1] =
80 GDT_ENTRY(0x809b, acpi_wakeup_address, 0xfffff);
81 /* GDT[2]: big real mode-like data segment */
82 header->wakeup_gdt[2] =
83 GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
84
53#ifndef CONFIG_64BIT 85#ifndef CONFIG_64BIT
54 store_gdt((struct desc_ptr *)&header->pmode_gdt); 86 store_gdt((struct desc_ptr *)&header->pmode_gdt);
55 87
@@ -72,7 +104,9 @@ int acpi_save_state_mem(void)
72 saved_magic = 0x12345678; 104 saved_magic = 0x12345678;
73#else /* CONFIG_64BIT */ 105#else /* CONFIG_64BIT */
74 header->trampoline_segment = setup_trampoline() >> 4; 106 header->trampoline_segment = setup_trampoline() >> 4;
75 init_rsp = (unsigned long)temp_stack + 4096; 107#ifdef CONFIG_SMP
108 stack_start.sp = temp_stack + 4096;
109#endif
76 initial_code = (unsigned long)wakeup_long64; 110 initial_code = (unsigned long)wakeup_long64;
77 saved_magic = 0x123456789abcdef0; 111 saved_magic = 0x123456789abcdef0;
78#endif /* CONFIG_64BIT */ 112#endif /* CONFIG_64BIT */
@@ -111,7 +145,7 @@ void __init acpi_reserve_bootmem(void)
111 return; 145 return;
112 } 146 }
113 147
114 acpi_wakeup_address = acpi_realmode; 148 acpi_wakeup_address = virt_to_phys((void *)acpi_realmode);
115} 149}
116 150
117 151