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
This commit is contained in:
Olivier Martin 2014-02-12 11:37:57 +00:00 committed by oliviermartin
parent 336c8e116b
commit e645bd857d
4 changed files with 14 additions and 14 deletions

View File

@ -882,6 +882,11 @@
## This PCD specifies whether full PCI enumeration is disabled. ## This PCD specifies whether full PCI enumeration is disabled.
gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048 gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048
## Disk I/O - Number of Data Buffer block
# Define the size in block of the pre-allocated buffer. It provide better
# performance for large Disk I/O requests
gEfiMdeModulePkgTokenSpaceGuid.PcdDiskIoDataBufferBlockNum|64|UINT32|0x30001039
[PcdsPatchableInModule] [PcdsPatchableInModule]
## Specify memory size with page number for PEI code when ## Specify memory size with page number for PEI code when
# the feature of Loading Module at Fixed Address is enabled # the feature of Loading Module at Fixed Address is enabled

View File

@ -183,7 +183,7 @@ DiskIoDriverBindingStart (
InitializeListHead (&Instance->TaskQueue); InitializeListHead (&Instance->TaskQueue);
EfiInitializeLock (&Instance->TaskQueueLock, TPL_NOTIFY); EfiInitializeLock (&Instance->TaskQueueLock, TPL_NOTIFY);
Instance->SharedWorkingBuffer = AllocateAlignedPages ( 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 Instance->BlockIo->Media->IoAlign
); );
if (Instance->SharedWorkingBuffer == NULL) { if (Instance->SharedWorkingBuffer == NULL) {
@ -214,7 +214,7 @@ ErrorExit:
if (Instance != NULL && Instance->SharedWorkingBuffer != NULL) { if (Instance != NULL && Instance->SharedWorkingBuffer != NULL) {
FreeAlignedPages ( FreeAlignedPages (
Instance->SharedWorkingBuffer, 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 ( FreeAlignedPages (
Instance->SharedWorkingBuffer, 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 ( Status = gBS->CloseProtocol (
@ -655,8 +655,8 @@ DiskIoCreateSubtaskList (
// Use the allocated buffer instead of the original buffer // Use the allocated buffer instead of the original buffer
// to avoid alignment issue. // to avoid alignment issue.
// //
for (; Lba < OverRunLba; Lba += DATA_BUFFER_BLOCK_NUM) { for (; Lba < OverRunLba; Lba += PcdGet32 (PcdDiskIoDataBufferBlockNum)) {
DataBufferSize = MIN (BufferSize, DATA_BUFFER_BLOCK_NUM * BlockSize); DataBufferSize = MIN (BufferSize, PcdGet32 (PcdDiskIoDataBufferBlockNum) * BlockSize);
Subtask = DiskIoCreateSubtask (Write, Lba, 0, DataBufferSize, SharedWorkingBuffer, BufferPtr, Blocking); Subtask = DiskIoCreateSubtask (Write, Lba, 0, DataBufferSize, SharedWorkingBuffer, BufferPtr, Blocking);
if (Subtask == NULL) { if (Subtask == NULL) {

View File

@ -30,13 +30,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.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') #define DISK_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('d', 's', 'k', 'I')
typedef struct { typedef struct {
UINT32 Signature; UINT32 Signature;

View File

@ -45,7 +45,7 @@
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses] [LibraryClasses]
UefiBootServicesTableLib UefiBootServicesTableLib
@ -55,7 +55,7 @@
UefiLib UefiLib
UefiDriverEntryPoint UefiDriverEntryPoint
DebugLib DebugLib
PcdLib
[Protocols] [Protocols]
gEfiDiskIoProtocolGuid ## BY_START gEfiDiskIoProtocolGuid ## BY_START
@ -63,3 +63,5 @@
gEfiBlockIoProtocolGuid ## TO_START gEfiBlockIoProtocolGuid ## TO_START
gEfiBlockIo2ProtocolGuid ## TO_START gEfiBlockIo2ProtocolGuid ## TO_START
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdDiskIoDataBufferBlockNum