diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-02-12 11:37:57 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-02-12 11:37:57 +0000 |
commit | e645bd857df95a8e2fac220fe98772cc6d37dee4 (patch) | |
tree | b72615389f5742b89b3e3be6d5284593eca56db8 /MdeModulePkg/Universal/Disk | |
parent | 336c8e116b3e2e11dccdac163d0a85fc3c58fd3d (diff) | |
download | edk2-platforms-e645bd857df95a8e2fac220fe98772cc6d37dee4.tar.xz |
MdeModulePkg/DiskIo: Introduced 'PcdDiskIoDataBufferBlockNum'
PcdDiskIoDataBufferBlockNum replaced the hardcoded value into
the Disk I/O driver.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-By: Tian, Feng <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15235 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Disk')
-rw-r--r-- | MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c | 10 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h | 7 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf | 6 |
3 files changed, 9 insertions, 14 deletions
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c index eb3edeb53c..0658299288 100644 --- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c +++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c @@ -183,7 +183,7 @@ DiskIoDriverBindingStart ( InitializeListHead (&Instance->TaskQueue);
EfiInitializeLock (&Instance->TaskQueueLock, TPL_NOTIFY);
Instance->SharedWorkingBuffer = AllocateAlignedPages (
- EFI_SIZE_TO_PAGES (DATA_BUFFER_BLOCK_NUM * Instance->BlockIo->Media->BlockSize),
+ EFI_SIZE_TO_PAGES (PcdGet32 (PcdDiskIoDataBufferBlockNum) * Instance->BlockIo->Media->BlockSize),
Instance->BlockIo->Media->IoAlign
);
if (Instance->SharedWorkingBuffer == NULL) {
@@ -214,7 +214,7 @@ ErrorExit: if (Instance != NULL && Instance->SharedWorkingBuffer != NULL) {
FreeAlignedPages (
Instance->SharedWorkingBuffer,
- EFI_SIZE_TO_PAGES (DATA_BUFFER_BLOCK_NUM * Instance->BlockIo->Media->BlockSize)
+ EFI_SIZE_TO_PAGES (PcdGet32 (PcdDiskIoDataBufferBlockNum) * Instance->BlockIo->Media->BlockSize)
);
}
@@ -324,7 +324,7 @@ DiskIoDriverBindingStop ( FreeAlignedPages (
Instance->SharedWorkingBuffer,
- EFI_SIZE_TO_PAGES (DATA_BUFFER_BLOCK_NUM * Instance->BlockIo->Media->BlockSize)
+ EFI_SIZE_TO_PAGES (PcdGet32 (PcdDiskIoDataBufferBlockNum) * Instance->BlockIo->Media->BlockSize)
);
Status = gBS->CloseProtocol (
@@ -655,8 +655,8 @@ DiskIoCreateSubtaskList ( // Use the allocated buffer instead of the original buffer
// to avoid alignment issue.
//
- for (; Lba < OverRunLba; Lba += DATA_BUFFER_BLOCK_NUM) {
- DataBufferSize = MIN (BufferSize, DATA_BUFFER_BLOCK_NUM * BlockSize);
+ for (; Lba < OverRunLba; Lba += PcdGet32 (PcdDiskIoDataBufferBlockNum)) {
+ DataBufferSize = MIN (BufferSize, PcdGet32 (PcdDiskIoDataBufferBlockNum) * BlockSize);
Subtask = DiskIoCreateSubtask (Write, Lba, 0, DataBufferSize, SharedWorkingBuffer, BufferPtr, Blocking);
if (Subtask == NULL) {
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h index a08d4df799..5e89684f66 100644 --- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h +++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h @@ -30,13 +30,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
-//
-// Pre-allocate an aligned buffer of 64 blocks so very large Disk I/O requests
-// will be broken up into 64 * BlockSize chunks to provide better performance
-// than allocating an aligned 1 block buffer.
-//
-#define DATA_BUFFER_BLOCK_NUM 64
-
#define DISK_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('d', 's', 'k', 'I')
typedef struct {
UINT32 Signature;
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf index 8cf2595dfa..ec1f75f954 100644 --- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf +++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf @@ -45,7 +45,7 @@ [Packages]
MdePkg/MdePkg.dec
-
+ MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
UefiBootServicesTableLib
@@ -55,7 +55,7 @@ UefiLib
UefiDriverEntryPoint
DebugLib
-
+ PcdLib
[Protocols]
gEfiDiskIoProtocolGuid ## BY_START
@@ -63,3 +63,5 @@ gEfiBlockIoProtocolGuid ## TO_START
gEfiBlockIo2ProtocolGuid ## TO_START
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdDiskIoDataBufferBlockNum
|