Revision: 16564
http://sourceforge.net/p/edk2/code/16564
Author: gdong1
Date: 2014-12-31 01:46:50 +0000 (Wed, 31 Dec 2014)
Log Message:
-----------
Remove the FV header assumption in variable driver.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dong Guo <[email protected]>
Reviewed-by: Gao Liming <[email protected]>
Reviewed-by: Zeng Star <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
Modified: trunk/edk2/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
2014-12-31 01:31:00 UTC (rev 16563)
+++ trunk/edk2/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
2014-12-31 01:46:50 UTC (rev 16564)
@@ -3370,10 +3370,10 @@
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 @@
//
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 @@
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];
}
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits