Revision: 14521
          http://sourceforge.net/p/edk2/code/14521
Author:   erictian
Date:     2013-08-05 01:50:11 +0000 (Mon, 05 Aug 2013)
Log Message:
-----------
MdeMdeModulePkg/Scsi: Enlarge SCSI cmd timeout to a more reasonable experience 
value to cover more devices

Signed-off-by: Feng Tian <[email protected]>
Reviewed-by: Elvin Li <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
    trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h
    trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
    trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c       2013-07-31 
01:09:38 UTC (rev 14520)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c       2013-08-05 
01:50:11 UTC (rev 14521)
@@ -2,7 +2,7 @@
   SCSI Bus driver that layers on every SCSI Pass Thru and
   Extended SCSI Pass Thru protocol in the system.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -1293,7 +1293,7 @@
   for (Index = 0; Index < MaxRetry; Index++) {
     Status = ScsiInquiryCommand (
               &ScsiIoDevice->ScsiIo,
-              EFI_TIMER_PERIOD_SECONDS (1),
+              SCSI_BUS_TIMEOUT,
               NULL,
               &SenseDataLength,
               &HostAdapterStatus,

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h       2013-07-31 
01:09:38 UTC (rev 14520)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h       2013-08-05 
01:50:11 UTC (rev 14521)
@@ -1,7 +1,7 @@
 /** @file
   Header file for SCSI Bus Driver.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -61,6 +61,11 @@
 #define SCSI_BUS_DEVICE_SIGNATURE  SIGNATURE_32 ('s', 'c', 's', 'i')
 
 //
+// SCSI Bus Timeout Experience Value
+//
+#define SCSI_BUS_TIMEOUT           EFI_TIMER_PERIOD_SECONDS (3)
+
+//
 // The ScsiBusProtocol is just used to locate ScsiBusDev
 // structure in the SCSIBusDriverBindingStop(). Then we can
 // Close all opened protocols and release this structure.

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c     2013-07-31 
01:09:38 UTC (rev 14520)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c     2013-08-05 
01:50:11 UTC (rev 14521)
@@ -1,7 +1,7 @@
 /** @file
   SCSI disk driver that layers on every SCSI IO protocol in the system.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -957,7 +957,7 @@
 
   Status = ScsiInquiryCommand (
             ScsiDiskDevice->ScsiIo,
-            EFI_TIMER_PERIOD_SECONDS (1),
+            SCSI_DISK_TIMEOUT,
             NULL,
             &SenseDataLength,
             &HostAdapterStatus,
@@ -986,7 +986,7 @@
       SenseDataLength   = 0;
       Status = ScsiInquiryCommandEx (
                  ScsiDiskDevice->ScsiIo,
-                 EFI_TIMER_PERIOD_SECONDS (1),
+                 SCSI_DISK_TIMEOUT,
                  NULL,
                  &SenseDataLength,
                  &HostAdapterStatus,
@@ -1020,7 +1020,7 @@
           SenseDataLength   = 0;
           Status = ScsiInquiryCommandEx (
                      ScsiDiskDevice->ScsiIo,
-                     EFI_TIMER_PERIOD_SECONDS (1),
+                     SCSI_DISK_TIMEOUT,
                      NULL,
                      &SenseDataLength,
                      &HostAdapterStatus,
@@ -1157,7 +1157,7 @@
   //
   Status = ScsiTestUnitReadyCommand (
             ScsiDiskDevice->ScsiIo,
-            EFI_TIMER_PERIOD_SECONDS (1),
+            SCSI_DISK_TIMEOUT,
             NULL,
             &SenseDataLength,
             &HostAdapterStatus,
@@ -1376,7 +1376,7 @@
   //
   CommandStatus = ScsiReadCapacityCommand (
                     ScsiDiskDevice->ScsiIo,
-                    EFI_TIMER_PERIOD_SECONDS(1),
+                    SCSI_DISK_TIMEOUT,
                     NULL,
                     &SenseDataLength,
                     &HostAdapterStatus,
@@ -1399,7 +1399,7 @@
     //
     CommandStatus = ScsiReadCapacity16Command (
                       ScsiDiskDevice->ScsiIo,
-                      EFI_TIMER_PERIOD_SECONDS (1),
+                      SCSI_DISK_TIMEOUT,
                       NULL,
                       &SenseDataLength,
                       &HostAdapterStatus,
@@ -1623,7 +1623,7 @@
   for (SenseReq = TRUE; SenseReq;) {
     Status = ScsiRequestSenseCommand (
               ScsiDiskDevice->ScsiIo,
-              EFI_TIMER_PERIOD_SECONDS (2),
+              SCSI_DISK_TIMEOUT,
               PtrSenseData,
               &SenseDataLength,
               &HostAdapterStatus,
@@ -1843,8 +1843,11 @@
     // As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI 
devices, we have to use
     // the lowest transfer rate to calculate the possible maximum timeout 
value for each operation.
     // From the above table, we could know 2.1Mbytes per second is lowest one.
+    // The timout value is rounded up to nearest integar and here an 
additional 30s is added
+    // to follow ATA spec in which it mentioned that the device may take up to 
30s to respond
+    // commands in the Standby/Idle mode.
     //
-    Timeout   = EFI_TIMER_PERIOD_SECONDS (ByteCount / 2100000 + 1);
+    Timeout   = EFI_TIMER_PERIOD_SECONDS (ByteCount / 2100000 + 31);
 
     MaxRetry  = 2;
     for (Index = 0; Index < MaxRetry; Index++) {
@@ -1994,8 +1997,11 @@
     // As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI 
devices, we have to use
     // the lowest transfer rate to calculate the possible maximum timeout 
value for each operation.
     // From the above table, we could know 2.1Mbytes per second is lowest one.
+    // The timout value is rounded up to nearest integar and here an 
additional 30s is added
+    // to follow ATA spec in which it mentioned that the device may take up to 
30s to respond
+    // commands in the Standby/Idle mode.
     //
-    Timeout   = EFI_TIMER_PERIOD_SECONDS (ByteCount / 2100000 + 1);
+    Timeout   = EFI_TIMER_PERIOD_SECONDS (ByteCount / 2100000 + 31);
     MaxRetry  = 2;
     for (Index = 0; Index < MaxRetry; Index++) {
       if (!ScsiDiskDevice->Cdb16Byte) {
@@ -2925,7 +2931,7 @@
   ZeroMem (Cdb, sizeof (Cdb));
 
   Cdb[0] = ATA_CMD_IDENTIFY_DEVICE;
-  CommandPacket.Timeout = EFI_TIMER_PERIOD_SECONDS (1);
+  CommandPacket.Timeout = SCSI_DISK_TIMEOUT;
   CommandPacket.Cdb = Cdb;
   CommandPacket.CdbLength = (UINT8) sizeof (Cdb);
   CommandPacket.InDataBuffer = &ScsiDiskDevice->IdentifyData;

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h     2013-07-31 
01:09:38 UTC (rev 14520)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h     2013-08-05 
01:50:11 UTC (rev 14521)
@@ -1,7 +1,7 @@
 /** @file
   Header file for SCSI Disk Driver.
 
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -98,6 +98,10 @@
 #define SCSI_COMMAND_VERSION_2      0x02
 #define SCSI_COMMAND_VERSION_3      0x03
 
+//
+// SCSI Disk Timeout Experience Value
+//
+#define SCSI_DISK_TIMEOUT           EFI_TIMER_PERIOD_SECONDS (3)
 
 /**
   Test to see if this driver supports ControllerHandle.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to