Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/acpica/acpi_wakeup.c
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | for (ms = 0; ms < 5000; ms++) { | ||||
if (!CPU_ISSET(cpu, &suspended_cpus)) | if (!CPU_ISSET(cpu, &suspended_cpus)) | ||||
return (1); /* return SUCCESS */ | return (1); /* return SUCCESS */ | ||||
DELAY(1000); | DELAY(1000); | ||||
} | } | ||||
return (0); /* return FAILURE */ | return (0); /* return FAILURE */ | ||||
} | } | ||||
#define WARMBOOT_TARGET 0 | #define WARMBOOT_TARGET 0 | ||||
#ifdef __amd64__ | |||||
#define WARMBOOT_OFF (KERNBASE + 0x0467) | #define WARMBOOT_OFF (KERNBASE + 0x0467) | ||||
#define WARMBOOT_SEG (KERNBASE + 0x0469) | #define WARMBOOT_SEG (KERNBASE + 0x0469) | ||||
#else /* __i386__ */ | |||||
#define WARMBOOT_OFF (PMAP_MAP_LOW + 0x0467) | |||||
#define WARMBOOT_SEG (PMAP_MAP_LOW + 0x0469) | |||||
#endif | |||||
#define CMOS_REG (0x70) | #define CMOS_REG (0x70) | ||||
#define CMOS_DATA (0x71) | #define CMOS_DATA (0x71) | ||||
#define BIOS_RESET (0x0f) | #define BIOS_RESET (0x0f) | ||||
#define BIOS_WARM (0x0a) | #define BIOS_WARM (0x0a) | ||||
static void | static void | ||||
acpi_wakeup_cpus(struct acpi_softc *sc) | acpi_wakeup_cpus(struct acpi_softc *sc) | ||||
Show All 27 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. | ||||
*/ | */ | ||||
kernel_pmap->pm_pdir[0] = 0; | PTD[KPTDI] = 0; | ||||
invltlb_glob(); | 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 53 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). | ||||
*/ | */ | ||||
kernel_pmap->pm_pdir[0] = PTD[KPTDI]; | PTD[KPTDI] = PTD[LOWPTDI]; | ||||
#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 186 Lines • Show Last 20 Lines |