summaryrefslogtreecommitdiffstats
path: root/sys/amd64/acpica
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-02-15 23:33:22 +0000
committerjkim <jkim@FreeBSD.org>2012-02-15 23:33:22 +0000
commitc13c2b79cf89ae77278f4504a1760066513b18f8 (patch)
tree52a4a402fa08f0d383233452bed8c1794d36cf43 /sys/amd64/acpica
parent626117dcad75e9526ae6bc4c7b0e7d93aea9a8c1 (diff)
downloadFreeBSD-src-c13c2b79cf89ae77278f4504a1760066513b18f8.zip
FreeBSD-src-c13c2b79cf89ae77278f4504a1760066513b18f8.tar.gz
Clean up RFLAG and CR3 register handling and nearby comments. For BSP, use
spinlock_enter()/spinlock_exit() to save/restore RFLAGS. We know interrupt is disabled when returning from S3. For AP, we do not have to save/restore it because IRET will do it for us any way. Do not save CR3 locally because savectx() does it and BSP does not have to switch to kernel map for amd64. Change contigmalloc(9) flag while I am in the neighborhood.
Diffstat (limited to 'sys/amd64/acpica')
-rw-r--r--sys/amd64/acpica/acpi_wakeup.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c
index e2e3bb6..c36f3bf 100644
--- a/sys/amd64/acpica/acpi_wakeup.c
+++ b/sys/amd64/acpica/acpi_wakeup.c
@@ -223,7 +223,6 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
#ifdef SMP
cpuset_t wakeup_cpus;
#endif
- register_t cr3, rf;
ACPI_STATUS status;
int ret;
@@ -255,17 +254,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
- rf = intr_disable();
+ spinlock_enter();
intr_suspend();
- /*
- * Temporarily switch to the kernel pmap because it provides
- * an identity mapping (setup at boot) for the low physical
- * memory region containing the wakeup code.
- */
- cr3 = rcr3();
- load_cr3(KPML4phys);
-
if (savectx(susppcbs[0])) {
ctx_fpusave(suspfpusave[0]);
#ifdef SMP
@@ -304,6 +295,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
ia32_pause();
} else {
pmap_init_pat();
+ load_cr3(susppcbs[0]->pcb_cr3);
PCPU_SET(switchtime, 0);
PCPU_SET(switchticks, ticks);
#ifdef SMP
@@ -319,10 +311,9 @@ out:
restart_cpus(wakeup_cpus);
#endif
- load_cr3(cr3);
mca_resume();
intr_resume();
- intr_restore(rf);
+ spinlock_exit();
AcpiSetFirmwareWakingVector(0);
@@ -346,7 +337,7 @@ acpi_alloc_wakeup_handler(void)
* and ROM area (0xa0000 and above). The temporary page tables must be
* page-aligned.
*/
- wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0x500,
+ wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK, 0x500,
0xa0000, PAGE_SIZE, 0ul);
if (wakeaddr == NULL) {
printf("%s: can't alloc wake memory\n", __func__);
OpenPOWER on IntegriCloud