|author||Zheng Bao <email@example.com>||2013-02-26 18:10:52 +0800|
|committer||Martin Roth <firstname.lastname@example.org>||2013-04-16 02:31:08 +0200|
documentation: Complete the AMD-S3.txt
Fix some typos and finish empty sections. Change-Id: I08cc971e763252b035ab8ed2118180140e34ac72 Signed-off-by: Zheng Bao <email@example.com> Signed-off-by: Zheng Bao <firstname.lastname@example.org> Reviewed-on: http://review.coreboot.org/2483 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <email@example.com>
1 files changed, 31 insertions, 6 deletions
diff --git a/documentation/AMD-S3.txt b/documentation/AMD-S3.txt
index 1ef87c035..48d4c8f3e 100644
@@ -13,7 +13,7 @@
/_/ \_\_| |_|_____/ |_____/ |____/
- S3 in Coreboot (V 1.1)
+ S3 in Coreboot (V 1.2)
@@ -22,7 +22,7 @@
This document is about how the feature S3 is implemented on coreboot,
-specificly on AMD platform. This topic deals with ACPI spec, hardware,
+specifically on AMD platform. This topic deals with ACPI spec, hardware,
BIOS, OS. We try to help coreboot users to realize their own S3.
S3 in a nutshell
@@ -103,20 +103,45 @@ Lifecycle of booting, sleeping and waking Coreboot and Ubuntu
1. Cold boot.
For a system with S3 feature, the BIOS needs to save some data to
-non-volitile storage at cold boot stage. What data need to be save are
+non-volatile storage at cold boot stage. What data need to be save are
provided by AmdS3Save. After the wrapper calls the AmdS3Save, it gets
the VolatileStorage and NvStorage, which are where the data are
located. It is the wrappers's responsibility to save the data.
-Currently, the wrappers allocate a CBFS modules in BIOS image. Todo
+Currently, the wrappers allocate a CBFS modules in BIOS image. To do
that, the wrapper needs to have the ability to write flash chips. It
is not as comprehensive as flashrom. But for the SST chip on Parmer,
MX chip on Thather, coreboot works well.
2. OS goes in S3.
-3. BIOS detect S3 wakeup
+For Linux, besides the kernel needs to do some saving, most distributions
+run some scripts. For Ubuntu, scripts are located at /usr/lib/pm-utils/sleep.d.
+ # ls /usr/lib/pm-utils/sleep.d
+ 000kernel-change 49bluetooth 90clock 95led
+ 00logging 55NetworkManager 94cpufreq 98video-quirk-db-handler
+ 00powersave 60_wpa_supplicant 95anacron 99video
+ 01PulseAudio 75modules 95hdparm-apm
+The script with lower prefix runs before the one with higher prefix.
+99video is the last one.
+Those scripts have hooks called hibernate, suspend, thaw, resume. For
+each script, suspend is called when system sleeps and wakeup is called
+when system wakeups.
+3. Firmware detects S3 wakeup
+As we mentioned, Firmware detects the SLP_TYPx to find out if the board
+wakes up. In romstage.c, AmdInitReset and AmdInitEarly are called
+as they are during cold boot. AmdInitResume and AmdS3LateRestore are
+called only during resume. For whole ramstage, Coreboot goes through
+almost the same way as cold boot, other than not calling the AmdInitMid,
+AmdInitLate and AmdS3Save, and restoring all the MTRRs.
+At last step of coreboot stage, coreboot finds out the wakeup vector in FADT,
+written by OS, and jump.
4. OS resumes.
+When Linux resumes, all the sleeping scripts call their resume
+hooks. If we are more lucky, all the scripts can go through. More
+chances that the 99video hangs or fails to get the display
+back. Sometimes it can fixed if CONFIG_S3_VGA_ROM_RUN is unset in
+Coreboot/Kconfig. That needs more troubleshooting.