summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c')
-rw-r--r--MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
index 523738d52d..27a7f43fe5 100644
--- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
+++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
@@ -474,22 +474,31 @@ ProduceFVBProtocolOnBuffer (
if (FwVolHeader->Signature != EFI_FVH_SIGNATURE) {
return EFI_VOLUME_CORRUPTED;
}
+
//
- // Get FvHeader alignment
- //
- FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
- //
- // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value.
+ // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
+ // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from
+ // its initial linked location and maintain its alignment.
//
- if (FvAlignment < 8) {
- FvAlignment = 8;
- }
- if ((UINTN)BaseAddress % FvAlignment != 0) {
+ if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) {
//
- // FvImage buffer is not at its required alignment.
+ // Get FvHeader alignment
//
- return EFI_VOLUME_CORRUPTED;
+ FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+ //
+ // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value.
+ //
+ if (FvAlignment < 8) {
+ FvAlignment = 8;
+ }
+ if ((UINTN)BaseAddress % FvAlignment != 0) {
+ //
+ // FvImage buffer is not at its required alignment.
+ //
+ return EFI_VOLUME_CORRUPTED;
+ }
}
+
//
// Allocate EFI_FW_VOL_BLOCK_DEVICE
//