diff options
author | Selvan Mani <smani@micron.com> | 2012-09-27 08:36:43 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-10-30 03:37:27 -0400 |
commit | 4453bc88f0f7be6d84b50b2e1c1ed239c45fb14a (patch) | |
tree | bd63f04dabeb4ad0ed35608e37f7554317a83a1a /drivers/block/mtip32xx/mtip32xx.c | |
parent | 1f999572f244f266c5b1b855025723541b0b475d (diff) |
mtip32xx:Added appropriate timeout value for secure erase
Added appropriate timeout value for secure erase based on identify device data
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/mtip32xx/mtip32xx.c')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 19 |
1 files changed, 15 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 | 2038 | static void mtip_set_timeout(struct driver_data *dd, | |
2039 | static 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) |