summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2014-03-04 08:02:37 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2014-03-04 08:02:37 +0000
commita781f7099bc2584fd065f1947bedd49adfea0fa5 (patch)
tree39673698749efc4903e717d557cc9aba9f81eb7d
parentbd386eaf86f1f55dd28d2c5b26a8c80b2a9002a8 (diff)
OvmfPkg/Sec: Don't decompress the FV on S3 resume
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
-rw-r--r--OvmfPkg/Sec/SecMain.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 0edc4f9af..670ad8d76 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -469,6 +469,50 @@ FindPeiCoreImageBaseInFv (
return EFI_SUCCESS;
}
+
+/**
+ Reads 8-bits of CMOS data.
+
+ Reads the 8-bits of CMOS data at the location specified by Index.
+ The 8-bit read value is returned.
+
+ @param Index The CMOS location to read.
+
+ @return The value read.
+
+**/
+STATIC
+UINT8
+CmosRead8 (
+ IN UINTN Index
+ )
+{
+ IoWrite8 (0x70, (UINT8) Index);
+ return IoRead8 (0x71);
+}
+
+
+STATIC
+BOOLEAN
+IsS3Resume (
+ VOID
+ )
+{
+ return (CmosRead8 (0xF) == 0xFE);
+}
+
+
+STATIC
+EFI_STATUS
+GetS3ResumePeiFv (
+ IN OUT EFI_FIRMWARE_VOLUME_HEADER **PeiFv
+ )
+{
+ *PeiFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfPeiMemFvBase);
+ return EFI_SUCCESS;
+}
+
+
/**
Locates the PEI Core entry point address
@@ -488,9 +532,15 @@ FindPeiCoreImageBase (
{
*PeiCoreImageBase = 0;
- FindMainFv (BootFv);
+ if (IsS3Resume ()) {
+ DEBUG ((EFI_D_VERBOSE, "SEC: S3 resume\n"));
+ GetS3ResumePeiFv (BootFv);
+ } else {
+ DEBUG ((EFI_D_VERBOSE, "SEC: Normal boot\n"));
+ FindMainFv (BootFv);
- DecompressMemFvs (BootFv);
+ DecompressMemFvs (BootFv);
+ }
FindPeiCoreImageBaseInFv (*BootFv, PeiCoreImageBase);
}