Since we marked the FV at PcdOvmfPeiMemFvBase as ACPI NVS memory,
we can use it on S3 resume.
The FV at PcdOvmfDxeMemFvBase may have been overwritten by the OS,
but we do not use it's contents on S3 resume.
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@15296
6f19259b-4bc3-4df7-8a09-
765794883524
return EFI_SUCCESS;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
+\r
+/**\r
+ Reads 8-bits of CMOS data.\r
+\r
+ Reads the 8-bits of CMOS data at the location specified by Index.\r
+ The 8-bit read value is returned.\r
+\r
+ @param Index The CMOS location to read.\r
+\r
+ @return The value read.\r
+\r
+**/\r
+STATIC\r
+UINT8\r
+CmosRead8 (\r
+ IN UINTN Index\r
+ )\r
+{\r
+ IoWrite8 (0x70, (UINT8) Index);\r
+ return IoRead8 (0x71);\r
+}\r
+\r
+\r
+STATIC\r
+BOOLEAN\r
+IsS3Resume (\r
+ VOID\r
+ )\r
+{\r
+ return (CmosRead8 (0xF) == 0xFE);\r
+}\r
+\r
+\r
+STATIC\r
+EFI_STATUS\r
+GetS3ResumePeiFv (\r
+ IN OUT EFI_FIRMWARE_VOLUME_HEADER **PeiFv\r
+ )\r
+{\r
+ *PeiFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfPeiMemFvBase);\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
/**\r
Locates the PEI Core entry point address\r
\r
/**\r
Locates the PEI Core entry point address\r
\r
{\r
*PeiCoreImageBase = 0;\r
\r
{\r
*PeiCoreImageBase = 0;\r
\r
+ if (IsS3Resume ()) {\r
+ DEBUG ((EFI_D_VERBOSE, "SEC: S3 resume\n"));\r
+ GetS3ResumePeiFv (BootFv);\r
+ } else {\r
+ DEBUG ((EFI_D_VERBOSE, "SEC: Normal boot\n"));\r
+ FindMainFv (BootFv);\r
- DecompressMemFvs (BootFv);\r
+ DecompressMemFvs (BootFv);\r
+ }\r
\r
FindPeiCoreImageBaseInFv (*BootFv, PeiCoreImageBase);\r
}\r
\r
FindPeiCoreImageBaseInFv (*BootFv, PeiCoreImageBase);\r
}\r