2 * This file is part of the coreboot project.
4 * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include <arch/acpi.h>
20 #include <console/console.h>
24 * Intel 82371EB (PIIX4E) datasheet, section 7.2.3, page 142
26 * 0: soft off/suspend to disk S5
27 * 1: suspend to ram S3
28 * 2: powered on suspend, context lost S2
29 * Note: 'context lost' means the CPU restarts at the reset
31 * 3: powered on suspend, CPU context lost S1
32 * Note: Looks like 'CPU context lost' does _not_ mean the
33 * CPU restarts at the reset vector. Most likely only
34 * caches are lost, so both 0x3 and 0x4 map to acpi S1
35 * 4: powered on suspend, context maintained S1
36 * 5: working (clock control) S0
40 static const u8 acpi_sus_to_slp_typ
[8] = {
41 5, 3, 2, 1, 1, 0, 0, 0
44 int acpi_get_sleep_type(void)
48 reg
= inw(DEFAULT_PMBASE
+ PMCNTRL
);
49 result
= acpi_sus_to_slp_typ
[(reg
>> 10) & 7];
51 printk(BIOS_DEBUG
, "Wakeup from ACPI sleep type S%d (PMCNTRL=%04x)\n", result
, reg
);