[coreboot] New patch to review for coreboot: 7930ea3 AMD S3: Add a document about S3 on AMD platform

Zheng Bao (zheng.bao@amd.com) gerrit at coreboot.org
Fri Aug 3 06:08:29 CEST 2012


Zheng Bao (zheng.bao at amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1400

-gerrit

commit 7930ea30fbd307013159deeb1aeee0ca80d05736
Author: zbao <fishbaozi at gmail.com>
Date:   Fri Aug 3 13:53:10 2012 +0800

    AMD S3: Add a document about S3 on AMD platform
    
    See the document. Need review. Everything should be in Authentic
    English.
    
    Change-Id: Idc528b8c6b0d5afe08fc4f4387b7bff30698f677
    Signed-off-by: Zheng Bao <zheng.bao at amd.com>
    Signed-off-by: zbao <fishbaozi at gmail.com>
---
 documentation/AMD-S3.txt |   95 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/documentation/AMD-S3.txt b/documentation/AMD-S3.txt
new file mode 100644
index 0000000..58ee0d7
--- /dev/null
+++ b/documentation/AMD-S3.txt
@@ -0,0 +1,95 @@
+   _____ ____  _____  ______ ____   ____   ____ _______
+  / ____/ __ \|  __ \|  ____|  _ \ / __ \ / __ \__   __|
+ | |   | |  | | |__) | |__  | |_) | |  | | |  | | | |
+ | |   | |  | |  _  /|  __| |  _ <| |  | | |  | | | |
+ | |___| |__| | | \ \| |____| |_) | |__| | |__| | | |
+  \_____\____/|_|  \_\______|____/ \____/ \____/  |_|
+
+           __  __ _____     _____   ____
+     /\   |  \/  |  __ \   / ____| |___ \
+    /  \  | \  / | |  | | | (___     __) |
+   / /\ \ | |\/| | |  | |  \___ \   |__ <
+  / ____ \| |  | | |__| |  ____) |  ___) |
+ /_/    \_\_|  |_|_____/  |_____/  |____/
+
+
+               S3 in Coreboot
+----------------------------------------
+                Zheng Bao
+            <zheng.bao at amd.com>
+            <fishbaozi at gmail.com>
+
+Introduction
+============
+This document is about how the feature S3 is implemented on coreboot,
+specificly 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
+================
+The S3 sleeping state is a low wake latency sleeping state where all
+system context is lost except system memory. [1]. S3 is a ACPI
+definition.
+To enter S3, write 3 in SLP_TYPx and setting the SLP_EN bit. But if
+you do that, board can not resume at where it sleeps, because you
+don't save the context. More often than not, we make the board go into
+S3 by the tools which OSes provide. For windows, click
+Start->sleep. For linux, some distribution provide a tools called
+pm-suspend, which can make the system goto S3. If pm-suspend is not
+available, we can run "echo mem > /sys/power/state", but this way may
+not save all the needed context.
+In S3 state, the power is off. So when the power button is pressed,
+BIOS runs as it does in cold boot. If BIOS didn't detect whether
+board boots or resume, it would go the same way as boot. It is not
+what we expect. BIOS detects the SLP_TYPx. If it is 3, it means BIOS
+are waking up.
+BIOS is responsible for restore the machine state as it is before
+sleep. It needs restore the memory controller, not overwriting memory
+which is marked as reserved. For the peripheral which loses its
+registers, BIOS needs to write the original value.
+When everything is done, BIOS needs to find out the wakeup vector
+provided by OSes and jump there. OSes also have work to do. We can go
+to linux kernel or some other open source projects to find out how they
+handle S3 resume.
+
+Memory Layout
+=============
+Restoring memory is the most important job done by BIOS. When the
+power is off, the memory is maintained by standby power. BIOS need to
+make sure that when flow goes to OS, everything in memory should be
+the same as it was.
+
+The chip vendor will provide a way, or code, to wake up the memory
+from sleeping. In AGESA 2008 arch, it is called AmdInitResume.
+
+The BIOS itself needs some memory to run. Either, BIOS marks the erea
+as reserved in e820, or BIOS saves the content into reserved space.
+
+Here is the address Map for S3 Resume. Assumingly the total memory is 1GB.
+00000000 --- 00100000      BIOS Reserved area.
+00100000 --- 00200000      Free
+00200000 --- 01000000      Coreboot ramstage area.
+01000000 --- 2e160000      Free
+2e160000 --- 2e170000      ACPI table
+2e170000 --- 2ef70000      OSRAM
+2ef70000 --- 2efe0000      Stack in highmem
+2efe0000 --- 2f000000      heap in highmem
+2f000000                   TOM
+
+AMD requirements in S3
+======================
+Chip vendor like AMD will provide bunch of routines to restore the
+board.[2]
+ * AmdS3Save: It is called in cold boot, save required register into
+ non-volatile storage. Currently, we use SPI flash to store the data.
+ * AmdInitResume: Restore the memory controller.
+ * AmdS3LateRestore: Called after AmdInitResume, restore other
+ register that memory.
+ * (SouthBridge)InitS3EarlyRestore, (SouthBridge)InitS3LateRestore:
+ Provided by Southbridge vendor code. Early is called before PCI
+ enumeration, and Late is called after that.
+
+Reference
+=========
+[1]    ACPI40
+[2]    Coreboot Vendorcode




More information about the coreboot mailing list