treewide: replace GPLv2 long form headers with SPDX header
[coreboot.git] / src / southbridge / intel / i82371eb / wakeup.c
blobe1f74562c1867e7556fc1e411c2259bbeeb4779c
1 /* This file is part of the coreboot project. */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 #include <stdint.h>
5 #include <acpi/acpi.h>
6 #include <arch/io.h>
7 #include <console/console.h>
8 #include "i82371eb.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
17 * vector
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
24 * 6: reserved
25 * 7: reserved
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)
33 u16 reg, result;
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);
40 return result;