Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/acpica/acpi_wakeup.c
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | |||||
#ifdef __i386__ | #ifdef __i386__ | ||||
/* | /* | ||||
* Remove the identity mapping of low memory for all CPUs and sync | * Remove the identity mapping of low memory for all CPUs and sync | ||||
* the TLB for the BSP. The APs are now spinning in | * the TLB for the BSP. The APs are now spinning in | ||||
* cpususpend_handler() and we will release them soon. Then each | * cpususpend_handler() and we will release them soon. Then each | ||||
* will invalidate its TLB. | * will invalidate its TLB. | ||||
*/ | */ | ||||
PTD[KPTDI] = 0; | pmap_remap_lowptdi(false); | ||||
invltlb_glob(); | |||||
#endif | #endif | ||||
/* restore the warmstart vector */ | /* restore the warmstart vector */ | ||||
*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; | *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; | ||||
outb(CMOS_REG, BIOS_RESET); | outb(CMOS_REG, BIOS_RESET); | ||||
outb(CMOS_DATA, mpbiosreason); | outb(CMOS_DATA, mpbiosreason); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | #ifdef __i386__ | ||||
* Map some low memory with virt == phys for ACPI wakecode | * Map some low memory with virt == phys for ACPI wakecode | ||||
* to use to jump to high memory after enabling paging. This | * to use to jump to high memory after enabling paging. This | ||||
* is the same as for similar jump in locore, except the | * is the same as for similar jump in locore, except the | ||||
* jump is a single instruction, and we know its address | * jump is a single instruction, and we know its address | ||||
* more precisely so only need a single PTD, and we have to | * more precisely so only need a single PTD, and we have to | ||||
* be careful to use the kernel map (PTD[0] is for curthread | * be careful to use the kernel map (PTD[0] is for curthread | ||||
* which may be a user thread in deprecated APIs). | * which may be a user thread in deprecated APIs). | ||||
*/ | */ | ||||
PTD[KPTDI] = PTD[LOWPTDI]; | pmap_remap_lowptdi(true); | ||||
#endif | #endif | ||||
/* Call ACPICA to enter the desired sleep state */ | /* Call ACPICA to enter the desired sleep state */ | ||||
if (state == ACPI_STATE_S4 && sc->acpi_s4bios) | if (state == ACPI_STATE_S4 && sc->acpi_s4bios) | ||||
status = AcpiEnterSleepStateS4bios(); | status = AcpiEnterSleepStateS4bios(); | ||||
else | else | ||||
status = AcpiEnterSleepState(state); | status = AcpiEnterSleepState(state); | ||||
if (ACPI_FAILURE(status)) { | if (ACPI_FAILURE(status)) { | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | #ifdef __amd64__ | ||||
WAKECODE_FIXUP((wakeup_sw64 + 1), uint32_t, | WAKECODE_FIXUP((wakeup_sw64 + 1), uint32_t, | ||||
sc->acpi_wakephys + wakeup_64); | sc->acpi_wakephys + wakeup_64); | ||||
WAKECODE_FIXUP(wakeup_pagetables, uint32_t, pt4pa); | WAKECODE_FIXUP(wakeup_pagetables, uint32_t, pt4pa); | ||||
#endif | #endif | ||||
/* Save pointers to some global data. */ | /* Save pointers to some global data. */ | ||||
WAKECODE_FIXUP(wakeup_ret, void *, resumectx); | WAKECODE_FIXUP(wakeup_ret, void *, resumectx); | ||||
#ifndef __amd64__ | #ifndef __amd64__ | ||||
#if defined(PAE) || defined(PAE_TABLES) | WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); | ||||
WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdpt)); | |||||
#else | |||||
WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdir)); | |||||
#endif | |||||
#else /* __amd64__ */ | #else /* __amd64__ */ | ||||
/* Create the initial 1GB replicated page tables */ | /* Create the initial 1GB replicated page tables */ | ||||
for (i = 0; i < 512; i++) { | for (i = 0; i < 512; i++) { | ||||
/* | /* | ||||
* Each slot of the level 4 pages points | * Each slot of the level 4 pages points | ||||
* to the same level 3 page | * to the same level 3 page | ||||
*/ | */ | ||||
pt4[i] = (uint64_t)pt3pa; | pt4[i] = (uint64_t)pt3pa; | ||||
Show All 19 Lines |