aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorSam Bradshaw <sbradshaw@micron.com>2013-10-03 13:18:05 -0400
committerJens Axboe <axboe@kernel.dk>2014-01-21 23:20:44 -0500
commit26d580575b4b8c3c83137315c9a2a77e60a2f716 (patch)
tree3b17a0e384cae65f77f833186362ea9286441828 /drivers/block
parent188b9f49d4b156b0c07ee05bf90ab7b290077d0f (diff)
mtip32xx: Correctly handle security locked condition
If power is removed during a secure erase, the drive will end up in a security locked condition. This patch causes the driver to identify, log, and flag the security lock state. IOs are prevented from submission to the drive until the locked state is addressed with a secure erase. Bumped version number to reflect this capability. Signed-off-by: Sam Bradshaw <sbradshaw@micron.com> Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c16
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 966b4371a30f..516026954be6 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -920,8 +920,9 @@ static void mtip_handle_tfe(struct driver_data *dd)
920 fail_reason = "thermal shutdown"; 920 fail_reason = "thermal shutdown";
921 } 921 }
922 if (buf[288] == 0xBF) { 922 if (buf[288] == 0xBF) {
923 set_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag);
923 dev_info(&dd->pdev->dev, 924 dev_info(&dd->pdev->dev,
924 "Drive indicates rebuild has failed.\n"); 925 "Drive indicates rebuild has failed. Secure erase required.\n");
925 fail_all_ncq_cmds = 1; 926 fail_all_ncq_cmds = 1;
926 fail_reason = "rebuild failed"; 927 fail_reason = "rebuild failed";
927 } 928 }
@@ -1587,6 +1588,12 @@ static int mtip_get_identify(struct mtip_port *port, void __user *user_buffer)
1587 } 1588 }
1588#endif 1589#endif
1589 1590
1591 /* Check security locked state */
1592 if (port->identify[128] & 0x4)
1593 set_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
1594 else
1595 clear_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
1596
1590#ifdef MTIP_TRIM /* Disabling TRIM support temporarily */ 1597#ifdef MTIP_TRIM /* Disabling TRIM support temporarily */
1591 /* Demux ID.DRAT & ID.RZAT to determine trim support */ 1598 /* Demux ID.DRAT & ID.RZAT to determine trim support */
1592 if (port->identify[69] & (1 << 14) && port->identify[69] & (1 << 5)) 1599 if (port->identify[69] & (1 << 14) && port->identify[69] & (1 << 5))
@@ -1908,6 +1915,10 @@ static void mtip_dump_identify(struct mtip_port *port)
1908 strlcpy(cbuf, (char *)(port->identify+27), 41); 1915 strlcpy(cbuf, (char *)(port->identify+27), 41);
1909 dev_info(&port->dd->pdev->dev, "Model: %s\n", cbuf); 1916 dev_info(&port->dd->pdev->dev, "Model: %s\n", cbuf);
1910 1917
1918 dev_info(&port->dd->pdev->dev, "Security: %04x %s\n",
1919 port->identify[128],
1920 port->identify[128] & 0x4 ? "(LOCKED)" : "");
1921
1911 if (mtip_hw_get_capacity(port->dd, &sectors)) 1922 if (mtip_hw_get_capacity(port->dd, &sectors))
1912 dev_info(&port->dd->pdev->dev, 1923 dev_info(&port->dd->pdev->dev,
1913 "Capacity: %llu sectors (%llu MB)\n", 1924 "Capacity: %llu sectors (%llu MB)\n",
@@ -3678,7 +3689,8 @@ static int mtip_hw_exit(struct driver_data *dd)
3678 * saves its state. 3689 * saves its state.
3679 */ 3690 */
3680 if (!dd->sr) { 3691 if (!dd->sr) {
3681 if (!test_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag)) 3692 if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags) &&
3693 !test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))
3682 if (mtip_standby_immediate(dd->port)) 3694 if (mtip_standby_immediate(dd->port))
3683 dev_warn(&dd->pdev->dev, 3695 dev_warn(&dd->pdev->dev,
3684 "STANDBY IMMEDIATE failed\n"); 3696 "STANDBY IMMEDIATE failed\n");
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index bda35d97246a..b52e9a6d6aad 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -92,7 +92,7 @@
92 92
93/* Driver name and version strings */ 93/* Driver name and version strings */
94#define MTIP_DRV_NAME "mtip32xx" 94#define MTIP_DRV_NAME "mtip32xx"
95#define MTIP_DRV_VERSION "1.2.6os3" 95#define MTIP_DRV_VERSION "1.3.0"
96 96
97/* Maximum number of minor device numbers per device. */ 97/* Maximum number of minor device numbers per device. */
98#define MTIP_MAX_MINORS 16 98#define MTIP_MAX_MINORS 16