summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Sec
diff options
context:
space:
mode:
authorThomas Palmer <thomas.palmer@hpe.com>2016-07-27 01:48:15 -0500
committerLaszlo Ersek <lersek@redhat.com>2016-07-27 15:41:19 +0200
commit39dbc4d5534790b5efcd67ce6b0f82ac23c6db6d (patch)
treec3a3ab68a27acfee5ff6b64a50af652d76a636e0 /OvmfPkg/Sec
parent5e443e376928de02ee5af8f151ad315e48372ff2 (diff)
downloadedk2-39dbc4d5534790b5efcd67ce6b0f82ac23c6db6d.tar.gz
edk2-39dbc4d5534790b5efcd67ce6b0f82ac23c6db6d.tar.bz2
edk2-39dbc4d5534790b5efcd67ce6b0f82ac23c6db6d.zip
OvmfPkg/Sec: Support SECTION2 DXEFV types
Support down-stream projects that require large DXEFV sizes greater than 16MB by handling SECTION2 common headers. These are already created by the build tools when necessary. Use IS_SECTION2 and SECTION2_SIZE macros to calculate accurate image sizes when appropriate. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: fix NB->MB typo in commit message] Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/Sec')
-rw-r--r--OvmfPkg/Sec/SecMain.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 384fa74735..464de10507 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -336,6 +336,8 @@ DecompressMemFvs (
EFI_COMMON_SECTION_HEADER *FvSection;
EFI_FIRMWARE_VOLUME_HEADER *PeiMemFv;
EFI_FIRMWARE_VOLUME_HEADER *DxeMemFv;
+ UINT32 FvHeaderSize;
+ UINT32 FvSectionSize;
FvSection = (EFI_COMMON_SECTION_HEADER*) NULL;
@@ -420,11 +422,19 @@ DecompressMemFvs (
}
ASSERT (FvSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE);
- ASSERT (SECTION_SIZE (FvSection) ==
- (PcdGet32 (PcdOvmfDxeMemFvSize) + sizeof (*FvSection)));
+
+ if (IS_SECTION2 (FvSection)) {
+ FvSectionSize = SECTION2_SIZE (FvSection);
+ FvHeaderSize = sizeof (EFI_COMMON_SECTION_HEADER2);
+ } else {
+ FvSectionSize = SECTION_SIZE (FvSection);
+ FvHeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
+ }
+
+ ASSERT (FvSectionSize == (PcdGet32 (PcdOvmfDxeMemFvSize) + FvHeaderSize));
DxeMemFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase);
- CopyMem (DxeMemFv, (VOID*) (FvSection + 1), PcdGet32 (PcdOvmfDxeMemFvSize));
+ CopyMem (DxeMemFv, (VOID*) ((UINTN)FvSection + FvHeaderSize), PcdGet32 (PcdOvmfDxeMemFvSize));
if (DxeMemFv->Signature != EFI_FVH_SIGNATURE) {
DEBUG ((EFI_D_ERROR, "Extracted FV at %p does not have FV header signature\n", DxeMemFv));