mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
5e443e3769
commit
39dbc4d553
|
@ -336,6 +336,8 @@ DecompressMemFvs (
|
||||||
EFI_COMMON_SECTION_HEADER *FvSection;
|
EFI_COMMON_SECTION_HEADER *FvSection;
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *PeiMemFv;
|
EFI_FIRMWARE_VOLUME_HEADER *PeiMemFv;
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *DxeMemFv;
|
EFI_FIRMWARE_VOLUME_HEADER *DxeMemFv;
|
||||||
|
UINT32 FvHeaderSize;
|
||||||
|
UINT32 FvSectionSize;
|
||||||
|
|
||||||
FvSection = (EFI_COMMON_SECTION_HEADER*) NULL;
|
FvSection = (EFI_COMMON_SECTION_HEADER*) NULL;
|
||||||
|
|
||||||
|
@ -420,11 +422,19 @@ DecompressMemFvs (
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (FvSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE);
|
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);
|
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) {
|
if (DxeMemFv->Signature != EFI_FVH_SIGNATURE) {
|
||||||
DEBUG ((EFI_D_ERROR, "Extracted FV at %p does not have FV header signature\n", DxeMemFv));
|
DEBUG ((EFI_D_ERROR, "Extracted FV at %p does not have FV header signature\n", DxeMemFv));
|
||||||
|
|
Loading…
Reference in New Issue