aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/mtip32xx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/mtip32xx')
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c19
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h3
2 files changed, 18 insertions, 4 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index f946d31d6917..adc6f36564cf 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2035,8 +2035,9 @@ static unsigned int implicit_sector(unsigned char command,
2035 } 2035 }
2036 return rv; 2036 return rv;
2037} 2037}
2038 2038static void mtip_set_timeout(struct driver_data *dd,
2039static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) 2039 struct host_to_dev_fis *fis,
2040 unsigned int *timeout, u8 erasemode)
2040{ 2041{
2041 switch (fis->command) { 2042 switch (fis->command) {
2042 case ATA_CMD_DOWNLOAD_MICRO: 2043 case ATA_CMD_DOWNLOAD_MICRO:
@@ -2044,7 +2045,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
2044 break; 2045 break;
2045 case ATA_CMD_SEC_ERASE_UNIT: 2046 case ATA_CMD_SEC_ERASE_UNIT:
2046 case 0xFC: 2047 case 0xFC:
2047 *timeout = 240000; /* 4 minutes */ 2048 if (erasemode)
2049 *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
2050 else
2051 *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
2048 break; 2052 break;
2049 case ATA_CMD_STANDBYNOW1: 2053 case ATA_CMD_STANDBYNOW1:
2050 *timeout = 120000; /* 2 minutes */ 2054 *timeout = 120000; /* 2 minutes */
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
2087 unsigned int transfer_size; 2091 unsigned int transfer_size;
2088 unsigned long task_file_data; 2092 unsigned long task_file_data;
2089 int intotal = outtotal + req_task->out_size; 2093 int intotal = outtotal + req_task->out_size;
2094 int erasemode = 0;
2090 2095
2091 taskout = req_task->out_size; 2096 taskout = req_task->out_size;
2092 taskin = req_task->in_size; 2097 taskin = req_task->in_size;
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd,
2212 fis.lba_hi, 2217 fis.lba_hi,
2213 fis.device); 2218 fis.device);
2214 2219
2215 mtip_set_timeout(&fis, &timeout); 2220 /* check for erase mode support during secure erase.*/
2221 if ((fis.command == ATA_CMD_SEC_ERASE_UNIT)
2222 && (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
2223 erasemode = 1;
2224 }
2225
2226 mtip_set_timeout(dd, &fis, &timeout, erasemode);
2216 2227
2217 /* Determine the correct transfer size.*/ 2228 /* Determine the correct transfer size.*/
2218 if (force_single_sector) 2229 if (force_single_sector)
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 18627a1d04c5..5f4a917bd8bb 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -33,6 +33,9 @@
33/* offset of Device Control register in PCIe extended capabilites space */ 33/* offset of Device Control register in PCIe extended capabilites space */
34#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 34#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48
35 35
36/* check for erase mode support during secure erase */
37#define MTIP_SEC_ERASE_MODE 0x3
38
36/* # of times to retry timed out/failed IOs */ 39/* # of times to retry timed out/failed IOs */
37#define MTIP_MAX_RETRIES 2 40#define MTIP_MAX_RETRIES 2
38 41