diff options
author | Dong Guo <guo.dong@intel.com> | 2014-12-31 01:46:50 +0000 |
---|---|---|
committer | gdong1 <gdong1@Edk2> | 2014-12-31 01:46:50 +0000 |
commit | 1fcbeaeacd1fb2d9dbc6d6c92d75d785b71df4b3 (patch) | |
tree | 919aa3252b3567f49e7aac1a4d92d64bfca8ac0b /MdeModulePkg/Universal | |
parent | 42435671334345f91e7cb2e5e963ed457fbb61d6 (diff) | |
download | edk2-platforms-1fcbeaeacd1fb2d9dbc6d6c92d75d785b71df4b3.tar.xz |
Remove the FV header assumption in variable driver.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dong Guo <guo.dong@intel.com>
Reviewed-by: Gao Liming <liming.gao@intel.com>
Reviewed-by: Zeng Star <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16564 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index b545a05530..3dac84a6b9 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -3370,10 +3370,10 @@ GetFvbInfoByAddress ( UINTN Index;
EFI_PHYSICAL_ADDRESS FvbBaseAddress;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
EFI_FVB_ATTRIBUTES_2 Attributes;
-
- Fvb = NULL;
+ UINTN BlockSize;
+ UINTN NumberOfBlocks;
+
HandleBuffer = NULL;
//
@@ -3400,9 +3400,9 @@ GetFvbInfoByAddress ( //
Status = Fvb->GetAttributes (Fvb, &Attributes);
if (EFI_ERROR (Status) || ((Attributes & EFI_FVB2_WRITE_STATUS) == 0)) {
- continue;
+ continue;
}
-
+
//
// Compare the address and select the right one.
//
@@ -3411,8 +3411,15 @@ GetFvbInfoByAddress ( continue;
}
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvbBaseAddress);
- if ((Address >= FvbBaseAddress) && (Address < (FvbBaseAddress + FwVolHeader->FvLength))) {
+ //
+ // Assume one FVB has one type of BlockSize.
+ //
+ Status = Fvb->GetBlockSize (Fvb, 0, &BlockSize, &NumberOfBlocks);
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ if ((Address >= FvbBaseAddress) && (Address < (FvbBaseAddress + BlockSize * NumberOfBlocks))) {
if (FvbHandle != NULL) {
*FvbHandle = HandleBuffer[Index];
}
|