summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
diff options
context:
space:
mode:
authorFeng Tian <feng.tian@intel.com>2013-08-05 01:50:11 +0000
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-05 01:50:11 +0000
commit3cc033c51f62983cb13901bfd24a74f7aa241a24 (patch)
tree1d82b486db6e01f5bdea97bc700281509ba28240 /MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
parentb4e027f1c6063278c741757d82f3f787236673b6 (diff)
downloadedk2-platforms-3cc033c51f62983cb13901bfd24a74f7aa241a24.tar.xz
MdeMdeModulePkg/Scsi: Enlarge SCSI cmd timeout to a more reasonable experience value to cover more devices
Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Elvin Li <elvin.li@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14521 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c')
-rw-r--r--MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index c6d96caeb8..223dd4c475 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -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 @@ ScsiDiskInquiryDevice (
Status = ScsiInquiryCommand (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS (1),
+ SCSI_DISK_TIMEOUT,
NULL,
&SenseDataLength,
&HostAdapterStatus,
@@ -986,7 +986,7 @@ ScsiDiskInquiryDevice (
SenseDataLength = 0;
Status = ScsiInquiryCommandEx (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS (1),
+ SCSI_DISK_TIMEOUT,
NULL,
&SenseDataLength,
&HostAdapterStatus,
@@ -1020,7 +1020,7 @@ ScsiDiskInquiryDevice (
SenseDataLength = 0;
Status = ScsiInquiryCommandEx (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS (1),
+ SCSI_DISK_TIMEOUT,
NULL,
&SenseDataLength,
&HostAdapterStatus,
@@ -1157,7 +1157,7 @@ ScsiDiskTestUnitReady (
//
Status = ScsiTestUnitReadyCommand (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS (1),
+ SCSI_DISK_TIMEOUT,
NULL,
&SenseDataLength,
&HostAdapterStatus,
@@ -1376,7 +1376,7 @@ ScsiDiskReadCapacity (
//
CommandStatus = ScsiReadCapacityCommand (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS(1),
+ SCSI_DISK_TIMEOUT,
NULL,
&SenseDataLength,
&HostAdapterStatus,
@@ -1399,7 +1399,7 @@ ScsiDiskReadCapacity (
//
CommandStatus = ScsiReadCapacity16Command (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS (1),
+ SCSI_DISK_TIMEOUT,
NULL,
&SenseDataLength,
&HostAdapterStatus,
@@ -1623,7 +1623,7 @@ ScsiDiskRequestSenseKeys (
for (SenseReq = TRUE; SenseReq;) {
Status = ScsiRequestSenseCommand (
ScsiDiskDevice->ScsiIo,
- EFI_TIMER_PERIOD_SECONDS (2),
+ SCSI_DISK_TIMEOUT,
PtrSenseData,
&SenseDataLength,
&HostAdapterStatus,
@@ -1843,8 +1843,11 @@ ScsiDiskReadSectors (
// 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 @@ ScsiDiskWriteSectors (
// 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 @@ AtapiIdentifyDevice (
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;