]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/AtaBus: wait up to 30s for ATA cmd response in Standby/Idle mode to...
authorFeng Tian <feng.tian@intel.com>
Tue, 18 Jun 2013 03:36:11 +0000 (03:36 +0000)
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 18 Jun 2013 03:36:11 +0000 (03:36 +0000)
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14428 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c

index 2c79f46ed9cc57a8132c1461b89ad815a018f84c..b1bedd80e819a02ea72931d34a58e187bd8f8c9e 100644 (file)
@@ -10,7 +10,7 @@
   for Security Protocol Specific layout. This implementation uses big endian for\r
   Cylinder register.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -541,19 +541,21 @@ TransferAtaDevice (
   //\r
   // As AtaBus is used to manage ATA devices, we have to use the lowest transfer rate to\r
   // calculate the possible maximum timeout value for each read/write operation.\r
+  // The timout value is rounded up to nearest integar and here an additional 30s is added\r
+  // to follow ATA spec in which it mentioned that the device may take up to 30s to respond\r
+  // commands in the Standby/Idle mode.\r
   //\r
   if (AtaDevice->UdmaValid) {\r
     //\r
     // Calculate the maximum timeout value for DMA read/write operation.\r
     //\r
-    Packet->Timeout  = EFI_TIMER_PERIOD_SECONDS ((TransferLength * AtaDevice->BlockMedia.BlockSize) / 2100000 + 1);\r
+    Packet->Timeout  = EFI_TIMER_PERIOD_SECONDS (DivU64x32 (MultU64x32 (TransferLength, AtaDevice->BlockMedia.BlockSize), 2100000) + 31);\r
   } else {\r
     //\r
     // Calculate the maximum timeout value for PIO read/write operation\r
     //\r
-    Packet->Timeout  = EFI_TIMER_PERIOD_SECONDS ((TransferLength * AtaDevice->BlockMedia.BlockSize) / 3300000 + 1);\r
+    Packet->Timeout  = EFI_TIMER_PERIOD_SECONDS (DivU64x32 (MultU64x32 (TransferLength, AtaDevice->BlockMedia.BlockSize), 3300000) + 31);\r
   }\r
-  \r
 \r
   return AtaDevicePassThru (AtaDevice, TaskPacket, Event);\r
 }\r