summaryrefslogtreecommitdiffstats
path: root/Nt32Pkg/FvbServicesRuntimeDxe
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-01-31 06:10:38 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-01-31 06:10:38 +0000
commit00d00b6dfd446d04ed44f8cf2b4a1810409578ac (patch)
tree50684048401e753e2020d6fa870dcb2d475961cb /Nt32Pkg/FvbServicesRuntimeDxe
parent07220da0c03149ec30459ed1fc2421c3526e06b5 (diff)
downloadedk2-00d00b6dfd446d04ed44f8cf2b4a1810409578ac.tar.gz
edk2-00d00b6dfd446d04ed44f8cf2b4a1810409578ac.tar.bz2
edk2-00d00b6dfd446d04ed44f8cf2b4a1810409578ac.zip
Fix bug in CustomErashFlashRange function.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4643 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg/FvbServicesRuntimeDxe')
-rw-r--r--Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c
index a95d3b400d..72c2006443 100644
--- a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c
+++ b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c
@@ -646,11 +646,15 @@ Returns:
EFI_LBA Index;
UINTN LbaSize;
UINTN ScratchLbaSizeData;
+ EFI_STATUS Status;
//
// First LBA
//
- FvbGetLbaAddress (Instance, StartLba, NULL, &LbaSize, NULL, Global, Virtual);
+ Status = FvbGetLbaAddress (Instance, StartLba, NULL, &LbaSize, NULL, Global, Virtual);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
//
// Use the scratch space as the intermediate buffer to transfer data
@@ -668,7 +672,10 @@ Returns:
// write the data back to the first block
//
if (ScratchLbaSizeData > 0) {
- FvbWriteBlock (Instance, StartLba, 0, &ScratchLbaSizeData, Global->FvbScratchSpace[Virtual], Global, Virtual);
+ Status = FvbWriteBlock (Instance, StartLba, 0, &ScratchLbaSizeData, Global->FvbScratchSpace[Virtual], Global, Virtual);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
//
// Middle LBAs
@@ -682,22 +689,29 @@ Returns:
// Last LBAs, the same as first LBAs
//
if (LastLba > StartLba) {
- FvbGetLbaAddress (Instance, LastLba, NULL, &LbaSize, NULL, Global, Virtual);
+ Status = FvbGetLbaAddress (Instance, LastLba, NULL, &LbaSize, NULL, Global, Virtual);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
FvbReadBlock (Instance, LastLba, 0, &LbaSize, Global->FvbScratchSpace[Virtual], Global, Virtual);
FvbEraseBlock (Instance, LastLba, Global, Virtual);
}
- ScratchLbaSizeData = LbaSize - (OffsetStartLba + 1);
+ ScratchLbaSizeData = LbaSize - (OffsetLastLba + 1);
+
+ if (ScratchLbaSizeData > 0) {
+ Status = FvbWriteBlock (
+ Instance,
+ LastLba,
+ (OffsetLastLba + 1),
+ &ScratchLbaSizeData,
+ Global->FvbScratchSpace[Virtual] + OffsetLastLba + 1,
+ Global,
+ Virtual
+ );
+ }
- return FvbWriteBlock (
- Instance,
- LastLba,
- (OffsetLastLba + 1),
- &ScratchLbaSizeData,
- Global->FvbScratchSpace[Virtual],
- Global,
- Virtual
- );
+ return Status;
}
EFI_STATUS