1 /* This file is part of the coreboot project. */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 #include <console/console.h>
11 * Intel 82371EB (PIIX4E) datasheet, section 7.2.3, page 142
13 * 0: soft off/suspend to disk S5
14 * 1: suspend to ram S3
15 * 2: powered on suspend, context lost S2
16 * Note: 'context lost' means the CPU restarts at the reset
18 * 3: powered on suspend, CPU context lost S1
19 * Note: Looks like 'CPU context lost' does _not_ mean the
20 * CPU restarts at the reset vector. Most likely only
21 * caches are lost, so both 0x3 and 0x4 map to acpi S1
22 * 4: powered on suspend, context maintained S1
23 * 5: working (clock control) S0
27 static const u8 acpi_sus_to_slp_typ
[8] = {
28 5, 3, 2, 1, 1, 0, 0, 0
31 int acpi_get_sleep_type(void)
35 reg
= inw(DEFAULT_PMBASE
+ PMCNTRL
);
36 result
= acpi_sus_to_slp_typ
[(reg
>> 10) & 7];
38 printk(BIOS_DEBUG
, "Wakeup from ACPI sleep type S%d (PMCNTRL=%04x)\n", result
, reg
);