On 07.09.2008 21:28, Rudolf Marek wrote:
Carl-Daniel Hailfinger napsal(a):
Rudolf, thanks for giving us that overview. I see that it is a description of S3 wakeup. Could you perhaps supplement that with a description of S3 suspend?
S3 suspend is just this line in ACPI ASL:
+Name (_S3, Package () {0x01, 0x01, 0x00, 0x00 })
OS will write the 0x1 to SLP register in ACPI PMIO. OS will take care of cache flushes etc. The write to this register will cause the SMAF Stop grant message to be send to CPU, CPU will disconnect the bus, and SB will sequence all signals similar to power off. The only problem is suspend signal which goes to superIO, which is needed not to cut power to RAM.
In other words, you dont need to preserve anything/no need for SMM. ACPI allows that the hardware is in same state as it was during normal power on (for HW managed by BIOS).
CAR will write to memory locations below 1M. There are three ways to cope with that: 1. Back up that area during suspend and restore it as last instruction of resume. 2. Declare the CAR area (48 kB) as reserved memory. 3. Write excessively clever and fragile code which performs a double stack switch during resume. Evaluation: 1. Needs a SMM handler or some other way to trigger execution of the backup routine on suspend. 2. Reduces the amount of available low memory a bit, may be a problem for 16-bit operating systems like DOS. 3. Will NOT work for Geode, may not work for Intel and VIA. The existing CAR enabling/disabling code will seem trivial in comparison.
If needed, writing to SLP register might be traped by SMM, and BIOS can save some values to NVRAM regs, sometimes found in chipsets (memory timing etc) to ease the startup. But we dont need that we are fast anyway.
Some extra hw clobber might be done in ACPI ASL code, there are methods which will be called during wakeup or during resume.
In theory, the ASL could contain a memory backup routine as suspend preparation, but this would probably impractical.
Regards, Carl-Daniel