summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Drivers/NorFlashDxe
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-05-14 22:11:04 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-05-14 22:11:04 +0000
commit36d66acf275135699fea9243e58e25990ab0db7f (patch)
tree296b0a2409660d57ecc99338ed8ed022c40c5766 /ArmPlatformPkg/Drivers/NorFlashDxe
parent7c794bf4a04e483540e9490b8eaed2cfbc7499ea (diff)
downloadedk2-platforms-36d66acf275135699fea9243e58e25990ab0db7f.tar.xz
ArmPlatformPkg/NorFlashDxe: Fixed LBA for FVB
FVB (for instance for UEFI Variable) might not be at the start of the NOR Flash. 'Lba' needs to be fixed up for it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15532 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Drivers/NorFlashDxe')
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c9
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c2
2 files changed, 5 insertions, 6 deletions
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
index 7030a3c866..4fac20199b 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
@@ -886,7 +886,7 @@ NorFlashWriteSingleBlock (
Instance->Initialize(Instance);
}
- DEBUG ((DEBUG_BLKIO, "NorFlashWriteSingleBlock(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Instance->StartLba + Lba, Offset, *NumBytes, Buffer));
+ DEBUG ((DEBUG_BLKIO, "NorFlashWriteSingleBlock(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Lba, Offset, *NumBytes, Buffer));
// Detect WriteDisabled state
if (Instance->Media.ReadOnly == TRUE) {
@@ -928,8 +928,7 @@ NorFlashWriteSingleBlock (
while (BytesToWrite > 0) {
// Read full word from NOR, splice as required. A word is the smallest
// unit we can write.
- TempStatus = NorFlashRead (Instance, Instance->StartLba + Lba,
- CurOffset & ~(0x3), sizeof(Tmp), &Tmp);
+ TempStatus = NorFlashRead (Instance, Lba, CurOffset & ~(0x3), sizeof(Tmp), &Tmp);
if (EFI_ERROR (TempStatus)) {
return EFI_DEVICE_ERROR;
}
@@ -1042,7 +1041,7 @@ NorFlashWriteSingleBlock (
}
// Read NOR Flash data into shadow buffer
- TempStatus = NorFlashReadBlocks (Instance, Instance->StartLba + Lba, BlockSize, Instance->ShadowBuffer);
+ TempStatus = NorFlashReadBlocks (Instance, Lba, BlockSize, Instance->ShadowBuffer);
if (EFI_ERROR (TempStatus)) {
// Return one of the pre-approved error statuses
return EFI_DEVICE_ERROR;
@@ -1052,7 +1051,7 @@ NorFlashWriteSingleBlock (
CopyMem ((VOID*)((UINTN)Instance->ShadowBuffer + Offset), Buffer, *NumBytes);
// Write the modified buffer back to the NorFlash
- TempStatus = NorFlashWriteBlocks (Instance, Instance->StartLba + Lba, BlockSize, Instance->ShadowBuffer);
+ TempStatus = NorFlashWriteBlocks (Instance, Lba, BlockSize, Instance->ShadowBuffer);
if (EFI_ERROR (TempStatus)) {
// Return one of the pre-approved error statuses
return EFI_DEVICE_ERROR;
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
index bf420853b0..efe87e57fd 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
@@ -535,7 +535,7 @@ FvbWrite (
Instance = INSTANCE_FROM_FVB_THIS (This);
- return NorFlashWriteSingleBlock (Instance, Lba, Offset, NumBytes, Buffer);
+ return NorFlashWriteSingleBlock (Instance, Instance->StartLba + Lba, Offset, NumBytes, Buffer);
}
/**