Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mike Maslenkin <miha...@parallels.com>
---
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c      |    6 +++---
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h      |    1 +
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf |    6 +++++-
 MdeModulePkg/MdeModulePkg.dec                     |    2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index 223dd4c47586..14600d65bde8 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -1795,7 +1795,7 @@ ScsiDiskReadSectors (
   // limit the data bytes that can be transferred by one Read(10) or Read(16) 
Command
   //
   if (!ScsiDiskDevice->Cdb16Byte) {
-    MaxBlock         = 0xFFFF;
+    MaxBlock         = PcdGet16 (PcdScsiMaximumTransferredBlocks);
   } else {
     MaxBlock         = 0xFFFFFFFF;
   }
@@ -1946,10 +1946,10 @@ ScsiDiskWriteSectors (
   BlockSize         = ScsiDiskDevice->BlkIo.Media->BlockSize;
 
   //
-  // limit the data bytes that can be transferred by one Read(10) or Read(16) 
Command
+  // limit the data bytes that can be transferred by one Write(10) or 
Write(16) Command
   //
   if (!ScsiDiskDevice->Cdb16Byte) {
-    MaxBlock         = 0xFFFF;
+    MaxBlock         = PcdGet16 (PcdScsiMaximumTransferredBlocks);
   } else {
     MaxBlock         = 0xFFFFFFFF;
   }
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
index 21dcbd32d4af..4836d3f8c146 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
@@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include <Library/DebugLib.h>
 #include <Library/UefiDriverEntryPoint.h>
 #include <Library/UefiLib.h>
+#include <Library/PcdLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/UefiScsiLib.h>
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
index dd94eac5401a..724aaa971f93 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
@@ -40,7 +40,7 @@
 
 [Packages]
   MdePkg/MdePkg.dec
-
+  MdeModulePkg/MdeModulePkg.dec
 
 [LibraryClasses]
   UefiBootServicesTableLib
@@ -51,6 +51,7 @@
   UefiDriverEntryPoint
   DebugLib
   DevicePathLib
+  PcdLib
 
 [Protocols]
   gEfiDiskInfoProtocolGuid                      ## BY_START
@@ -63,3 +64,6 @@
   gEfiDiskInfoScsiInterfaceGuid                 ## SOMETIME_PRODUCES (The 
device is physical SCSI disk)
   gEfiDiskInfoIdeInterfaceGuid                  ## SOMETIME_PRODUCES (The 
device is ATAPI device in IDE mode)
   gEfiDiskInfoAhciInterfaceGuid                 ## SOMETIME_PRODUCES (The 
device is ATAPI device in AHCI mode)
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdScsiMaximumTransferredBlocks
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index c2a6decbd46b..04db5973991b 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -881,6 +881,8 @@
   ## This PCD specifies whether full PCI enumeration is disabled.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048
 
+  ## This PCD specifies a maximum blocks number transferred during 
Read10/Write10 command
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdScsiMaximumTransferredBlocks|0xFFFF|UINT16|0x10000049
 [PcdsPatchableInModule]
   ## Specify  memory size with page number for PEI code when 
   #  the feature of Loading Module at Fixed Address is enabled
-- 
1.7.10.4


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to