diff options
author | Laszlo Ersek <lersek@redhat.com> | 2014-03-04 08:01:32 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-03-04 08:01:32 +0000 |
commit | 8f5ca05b0d423de6da0208979aa82ccacfa9ce01 (patch) | |
tree | c027ae5150b01ce70bee08591cace5e679822569 /OvmfPkg/PlatformPei | |
parent | bb97e78852ffadafce09523b304c7e5b4f6b30ee (diff) | |
download | edk2-8f5ca05b0d423de6da0208979aa82ccacfa9ce01.tar.gz edk2-8f5ca05b0d423de6da0208979aa82ccacfa9ce01.tar.bz2 edk2-8f5ca05b0d423de6da0208979aa82ccacfa9ce01.zip |
OvmfPkg: PlatformPei: detect S3 Resume in CMOS and set boot mode accordingly
Data is transferred between S3 Suspend and S3 Resume as follows:
S3 Suspend (DXE):
(1) BdsLibBootViaBootOption()
EFI_ACPI_S3_SAVE_PROTOCOL [AcpiS3SaveDxe]
- saves ACPI S3 Context to LockBox ---------------------+
(including FACS address -- FACS ACPI table |
contains OS waking vector) |
|
- prepares boot script: |
EFI_S3_SAVE_STATE_PROTOCOL.Write() [S3SaveStateDxe] |
S3BootScriptLib [PiDxeS3BootScriptLib] |
- opcodes & arguments are saved in NVS. --+ |
| |
- issues a notification by installing | |
EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL | |
| |
(2) EFI_S3_SAVE_STATE_PROTOCOL [S3SaveStateDxe] | |
S3BootScriptLib [PiDxeS3BootScriptLib] | |
- closes script with special opcode <---------+ |
- script is available in non-volatile memory |
via PcdS3BootScriptTablePrivateDataPtr --+ |
| |
BootScriptExecutorDxe | |
S3BootScriptLib [PiDxeS3BootScriptLib] | |
- Knows about boot script location by <----+ |
synchronizing with the other library |
instance via |
PcdS3BootScriptTablePrivateDataPtr. |
- Copies relocated image of itself to |
reserved memory. --------------------------------+ |
- Saved image contains pointer to boot script. ---|--+ |
| | |
Runtime: | | |
| | |
(3) OS is booted, writes OS waking vector to FACS, | | |
suspends machine | | |
| | |
S3 Resume (PEI): | | |
| | |
(4) PlatformPei sets S3 Boot Mode based on CMOS | | |
| | |
(5) DXE core is skipped and EFI_PEI_S3_RESUME2 is | | |
called as last step of PEI | | |
| | |
(6) S3Resume2Pei retrieves from LockBox: | | |
- ACPI S3 Context (path to FACS) <------------------|--|--+
| | |
+------------------|--|--+
- Boot Script Executor Image <----------------------+ | |
| |
(7) BootScriptExecutorDxe | |
S3BootScriptLib [PiDxeS3BootScriptLib] | |
- executes boot script <-----------------------------+ |
|
(8) OS waking vector available from ACPI S3 Context / FACS <--+
is called
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: move code into BootModeInitialization]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15290 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/PlatformPei')
-rw-r--r-- | OvmfPkg/PlatformPei/Platform.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index a7221b317b..a74d353fd3 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -266,11 +266,19 @@ MiscInitialization ( VOID
BootModeInitialization (
+ VOID
)
{
- EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ EFI_STATUS Status;
+
+ if (CmosRead8 (0xF) == 0xFE) {
+ BootMode = BOOT_ON_S3_RESUME;
+ } else {
+ BootMode = BOOT_WITH_FULL_CONFIGURATION;
+ }
- Status = PeiServicesSetBootMode (BOOT_WITH_FULL_CONFIGURATION);
+ Status = PeiServicesSetBootMode (BootMode);
ASSERT_EFI_ERROR (Status);
Status = PeiServicesInstallPpi (mPpiBootMode);
|