scsi: ata: libata: Detect support for command duration limits

Use the supported capabilities identify device data log page to detect if a
device supports the command duration limits feature. For devices supporting
this feature, set the device flag ATA_DFLAG_CDL. To support SCSI-ATA
translation, retrieve the command duration limits log page 18h and cache
this page content using the cdl array added to the ata_device data
structure.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Co-developed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20230511011356.227789-15-nks@flawful.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Damien Le Moal
2023-05-11 03:13:47 +02:00
committed by Martin K. Petersen
parent 24aeebbf8e
commit 62e4a60e0c
4 changed files with 78 additions and 21 deletions

View File

@@ -94,17 +94,18 @@ enum {
ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */
ATA_DFLAG_NCQ_SEND_RECV = (1 << 11), /* device supports NCQ SEND and RECV */
ATA_DFLAG_NCQ_PRIO = (1 << 12), /* device supports NCQ priority */
ATA_DFLAG_CFG_MASK = (1 << 13) - 1,
ATA_DFLAG_CDL = (1 << 13), /* supports cmd duration limits */
ATA_DFLAG_CFG_MASK = (1 << 14) - 1,
ATA_DFLAG_PIO = (1 << 13), /* device limited to PIO mode */
ATA_DFLAG_NCQ_OFF = (1 << 14), /* device limited to non-NCQ mode */
ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
ATA_DFLAG_INIT_MASK = (1 << 19) - 1,
ATA_DFLAG_PIO = (1 << 14), /* device limited to PIO mode */
ATA_DFLAG_NCQ_OFF = (1 << 15), /* device limited to non-NCQ mode */
ATA_DFLAG_SLEEPING = (1 << 16), /* device is sleeping */
ATA_DFLAG_DUBIOUS_XFER = (1 << 17), /* data transfer not verified */
ATA_DFLAG_NO_UNLOAD = (1 << 18), /* device doesn't support unload */
ATA_DFLAG_UNLOCK_HPA = (1 << 19), /* unlock HPA */
ATA_DFLAG_INIT_MASK = (1 << 20) - 1,
ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 19), /* Priority cmds sent to dev */
ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */
ATA_DFLAG_DETACH = (1 << 24),
ATA_DFLAG_DETACHED = (1 << 25),
ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
@@ -115,7 +116,8 @@ enum {
ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \
ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \
ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA),
ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \
ATA_DFLAG_CDL),
ATA_DEV_UNKNOWN = 0, /* unknown device */
ATA_DEV_ATA = 1, /* ATA device */
@@ -709,6 +711,9 @@ struct ata_device {
/* Concurrent positioning ranges */
struct ata_cpr_log *cpr_log;
/* Command Duration Limits log support */
u8 cdl[ATA_LOG_CDL_SIZE];
/* error history */
int spdn_cnt;
/* ering is CLEAR_END, read comment above CLEAR_END */