aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsai Thambi S P <asamymuthupa@micron.com>2012-09-05 12:31:36 -0400
committerJens Axboe <axboe@kernel.dk>2012-09-12 16:19:39 -0400
commit12a166c919310f4c967d0959b4ed073cced850d7 (patch)
treef69b3585f47fbed5f1eb55c1260e8bbe712e032b
parent1a131458ddf24d3dddb355ce00f32365557c1eed (diff)
mtip32xx: Handle NCQ commands during the security locked state
Return error for NCQ commands when the drive is in security locked state 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>
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c10
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index a935f4f7a53a..2553c7353115 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -1148,11 +1148,15 @@ static bool mtip_pause_ncq(struct mtip_port *port,
1148 reply = port->rxfis + RX_FIS_D2H_REG; 1148 reply = port->rxfis + RX_FIS_D2H_REG;
1149 task_file_data = readl(port->mmio+PORT_TFDATA); 1149 task_file_data = readl(port->mmio+PORT_TFDATA);
1150 1150
1151 if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) 1151 if (fis->command == ATA_CMD_SEC_ERASE_UNIT)
1152 clear_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
1153
1154 if ((task_file_data & 1))
1152 return false; 1155 return false;
1153 1156
1154 if (fis->command == ATA_CMD_SEC_ERASE_PREP) { 1157 if (fis->command == ATA_CMD_SEC_ERASE_PREP) {
1155 set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); 1158 set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);
1159 set_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
1156 port->ic_pause_timer = jiffies; 1160 port->ic_pause_timer = jiffies;
1157 return true; 1161 return true;
1158 } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && 1162 } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) &&
@@ -3619,6 +3623,10 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio)
3619 bio_endio(bio, -ENODATA); 3623 bio_endio(bio, -ENODATA);
3620 return; 3624 return;
3621 } 3625 }
3626 if (unlikely(test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))) {
3627 bio_endio(bio, -ENODATA);
3628 return;
3629 }
3622 } 3630 }
3623 3631
3624 if (unlikely(!bio_has_data(bio))) { 3632 if (unlikely(!bio_has_data(bio))) {
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 0255d19a17fa..18627a1d04c5 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -137,10 +137,12 @@ enum {
137 MTIP_PF_SVC_THD_STOP_BIT = 8, 137 MTIP_PF_SVC_THD_STOP_BIT = 8,
138 138
139 /* below are bit numbers in 'dd_flag' defined in driver_data */ 139 /* below are bit numbers in 'dd_flag' defined in driver_data */
140 MTIP_DDF_SEC_LOCK_BIT = 0,
140 MTIP_DDF_REMOVE_PENDING_BIT = 1, 141 MTIP_DDF_REMOVE_PENDING_BIT = 1,
141 MTIP_DDF_OVER_TEMP_BIT = 2, 142 MTIP_DDF_OVER_TEMP_BIT = 2,
142 MTIP_DDF_WRITE_PROTECT_BIT = 3, 143 MTIP_DDF_WRITE_PROTECT_BIT = 3,
143 MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ 144 MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \
145 (1 << MTIP_DDF_SEC_LOCK_BIT) | \
144 (1 << MTIP_DDF_OVER_TEMP_BIT) | \ 146 (1 << MTIP_DDF_OVER_TEMP_BIT) | \
145 (1 << MTIP_DDF_WRITE_PROTECT_BIT)), 147 (1 << MTIP_DDF_WRITE_PROTECT_BIT)),
146 148