Re: [edk2] [PATCH 1/1] MdeModulePkg/ScsiDiskDxe: introduce a Pcd for maximum blocks transferred by Read10/Write10 commands

Subject: Re: [edk2] [PATCH 1/1] MdeModulePkg/ScsiDiskDxe: introduce a Pcd for maximum blocks transferred by Read10/Write10 commands

From: "Tian, Feng" <feng.tian@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2014-05-21 08:23:43

HI, Mike

We (Intel) have had another solution to solve this issue. We use back-off algorithm to dynamically calculate the transfer length in single transfer till it succeeds or fails.

Please use latest ScsiDisk driver to see if it solves your problem.

Thanks
Feng

-----Original Message-----
From: Mike Maslenkin [mailto:mihailm@parallels.com] 
Sent: Wednesday, May 21, 2014 07:17
To: edk2-devel@lists.sourceforge.net
Cc: Mike Maslenkin
Subject: [edk2] [PATCH 1/1] MdeModulePkg/ScsiDiskDxe: introduce a Pcd for maximum blocks transferred by Read10/Write10 commands

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mike Maslenkin 
---
 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 
 #include   #include 
+#include 
 #include 
 #include   #include  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

------------------------------------------------------------------------------
"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