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