diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-04-14 09:25:34 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-04-14 09:25:34 +0000 |
commit | 3d783074e1a965dcbcb8f7bb78caf0880b672ed0 (patch) | |
tree | 553680243d5a0731883b65357304c4bb689d5e8d /ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c | |
parent | 09f2cf829584d14a913834413ba20511148f8452 (diff) |
ArmPlatformPkg/NorFlashDxe: Make the driver more compliant with the UEFI specification
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14263 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c')
-rw-r--r-- | ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c index a9c589b744..7953b6c9f5 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c @@ -1,6 +1,6 @@ /** @file NorFlashDxe.c
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -721,19 +721,20 @@ NorFlashReadBlocks ( UINT32 NumBlocks;
UINTN StartAddress;
+ DEBUG((DEBUG_BLKIO, "NorFlashReadBlocks: BufferSize=0x%xB BlockSize=0x%xB LastBlock=%ld, Lba=%ld.\n",
+ BufferSizeInBytes, Instance->Media.BlockSize, Instance->Media.LastBlock, Lba));
+
// The buffer must be valid
if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
- // We must have some bytes to read
- DEBUG((DEBUG_BLKIO, "NorFlashReadBlocks: BufferSize=0x%x bytes.\n", BufferSizeInBytes));
- if(BufferSizeInBytes == 0) {
- return EFI_BAD_BUFFER_SIZE;
+ // Return if we have not any byte to read
+ if (BufferSizeInBytes == 0) {
+ return EFI_SUCCESS;
}
// The size of the buffer must be a multiple of the block size
- DEBUG((DEBUG_BLKIO, "NorFlashReadBlocks: BlockSize=0x%x bytes.\n", Instance->Media.BlockSize));
if ((BufferSizeInBytes % Instance->Media.BlockSize) != 0) {
return EFI_BAD_BUFFER_SIZE;
}
@@ -741,8 +742,6 @@ NorFlashReadBlocks ( // All blocks must be within the device
NumBlocks = ((UINT32)BufferSizeInBytes) / Instance->Media.BlockSize ;
- DEBUG((DEBUG_BLKIO, "NorFlashReadBlocks: NumBlocks=%d, LastBlock=%ld, Lba=%ld\n", NumBlocks, Instance->Media.LastBlock, Lba));
-
if ((Lba + NumBlocks) > (Instance->Media.LastBlock + 1)) {
DEBUG((EFI_D_ERROR, "NorFlashReadBlocks: ERROR - Read will exceed last block\n"));
return EFI_INVALID_PARAMETER;
|