libata: implement SECURITY PROTOCOL IN/OUT
This allows us to use the generic OPAL code with ATA devices. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
committed by
Tejun Heo
parent
a0fd2454a3
commit
818831c8b2
@@ -2405,6 +2405,37 @@ static void ata_dev_config_zac(struct ata_device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static void ata_dev_config_trusted(struct ata_device *dev)
|
||||
{
|
||||
struct ata_port *ap = dev->link->ap;
|
||||
u64 trusted_cap;
|
||||
unsigned int err;
|
||||
|
||||
if (!ata_identify_page_supported(dev, ATA_LOG_SECURITY)) {
|
||||
ata_dev_warn(dev,
|
||||
"Security Log not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
err = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, ATA_LOG_SECURITY,
|
||||
ap->sector_buf, 1);
|
||||
if (err) {
|
||||
ata_dev_dbg(dev,
|
||||
"failed to read Security Log, Emask 0x%x\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
trusted_cap = get_unaligned_le64(&ap->sector_buf[40]);
|
||||
if (!(trusted_cap & (1ULL << 63))) {
|
||||
ata_dev_dbg(dev,
|
||||
"Trusted Computing capability qword not valid!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (trusted_cap & (1 << 0))
|
||||
dev->flags |= ATA_DFLAG_TRUSTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* ata_dev_configure - Configure the specified ATA/ATAPI device
|
||||
* @dev: Target device to configure
|
||||
@@ -2629,6 +2660,7 @@ int ata_dev_configure(struct ata_device *dev)
|
||||
}
|
||||
ata_dev_config_sense_reporting(dev);
|
||||
ata_dev_config_zac(dev);
|
||||
ata_dev_config_trusted(dev);
|
||||
dev->cdb_len = 16;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user