提交 e8f11db9 编写于 作者: C Christoph Hellwig 提交者: Tejun Heo

libata: check for trusted computing in IDENTIFY DEVICE data

ATA-8 and later mirrors the TRUSTED COMPUTING SUPPORTED bit in word 48 of
the IDENTIFY DEVICE data.  Check this before issuing a READ LOG PAGE
command to avoid issues with buggy devices.  The only downside is that
we can't support Security Send / Receive for a device with an older
revision due to the conflicting use of this field in earlier
specifications.

tj: The reason we need this is because some devices which don't
    support READ LOG PAGE lock up after getting issued that command.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Tested-by: NDavid Ahern <dsahern@gmail.com>
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 35f0b6a7
...@@ -2413,6 +2413,9 @@ static void ata_dev_config_trusted(struct ata_device *dev) ...@@ -2413,6 +2413,9 @@ static void ata_dev_config_trusted(struct ata_device *dev)
u64 trusted_cap; u64 trusted_cap;
unsigned int err; unsigned int err;
if (!ata_id_has_trusted(dev->id))
return;
if (!ata_identify_page_supported(dev, ATA_LOG_SECURITY)) { if (!ata_identify_page_supported(dev, ATA_LOG_SECURITY)) {
ata_dev_warn(dev, ata_dev_warn(dev,
"Security Log not supported\n"); "Security Log not supported\n");
......
...@@ -60,7 +60,8 @@ enum { ...@@ -60,7 +60,8 @@ enum {
ATA_ID_FW_REV = 23, ATA_ID_FW_REV = 23,
ATA_ID_PROD = 27, ATA_ID_PROD = 27,
ATA_ID_MAX_MULTSECT = 47, ATA_ID_MAX_MULTSECT = 47,
ATA_ID_DWORD_IO = 48, ATA_ID_DWORD_IO = 48, /* before ATA-8 */
ATA_ID_TRUSTED = 48, /* ATA-8 and later */
ATA_ID_CAPABILITY = 49, ATA_ID_CAPABILITY = 49,
ATA_ID_OLD_PIO_MODES = 51, ATA_ID_OLD_PIO_MODES = 51,
ATA_ID_OLD_DMA_MODES = 52, ATA_ID_OLD_DMA_MODES = 52,
...@@ -889,6 +890,13 @@ static inline bool ata_id_has_dword_io(const u16 *id) ...@@ -889,6 +890,13 @@ static inline bool ata_id_has_dword_io(const u16 *id)
return id[ATA_ID_DWORD_IO] & (1 << 0); return id[ATA_ID_DWORD_IO] & (1 << 0);
} }
static inline bool ata_id_has_trusted(const u16 *id)
{
if (ata_id_major_version(id) <= 7)
return false;
return id[ATA_ID_TRUSTED] & (1 << 0);
}
static inline bool ata_id_has_unload(const u16 *id) static inline bool ata_id_has_unload(const u16 *id)
{ {
if (ata_id_major_version(id) >= 7 && if (ata_id_major_version(id) >= 7 &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册