libata: Implement support for sense data reporting
PATCH 7/9 libata: Implement support for sense data reporting
ACS-4 defines a sense data reporting feature set.
This patch implements support for it.
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/ata/libata-core.c | 20 ++++++++++- drivers/ata/libata-eh.c | 86 +++++++++++++++++++++++++++++++++++++++++++++-- include/linux/ata.h | 18 ++++++++++ 3 files changed, 120 insertions(+), 4 deletions(-)
drivers/ata/libata-core.c +19 -1
@@ -2144,6 +2144,24 @@ static int ata_dev_config_ncq(struct ata_device *dev,return 0 ; } +static void ata_dev_config_sense_reporting (struct ata_device *dev) +{ +unsigned int err_mask; + +if (!ata_id_has_sense_reporting (dev->id)) +return ; + +if (ata_id_sense_reporting_enabled (dev->id)) +return ; + + err_mask =ata_dev_set_feature (dev,SETFEATURE_SENSE_DATA ,0x1 ); +if (err_mask) { +ata_dev_dbg (dev, +"failed to enable Sense Data Reporting, Emask 0x%x\n" , + err_mask); + } +} +/** * ata_dev_configure - Configure the specified ATA/ATAPI device * @dev: Target device to configure
@@ -2366,7 +2384,7 @@ int ata_dev_configure(struct ata_device *dev) dev->devslp_timing[i] = sata_setting[j]; } } - +ata_dev_config_sense_reporting (dev); dev->cdb_len =16 ; }
drivers/ata/libata-eh.c +83 -3
110 lines not on this page · raw message
include/linux/ata.h +18 -0
@@ -94,6 +94,8 @@ enum {ATA_ID_SECTOR_SIZE =106 ,ATA_ID_WWN =108 ,ATA_ID_LOGICAL_SECTOR_SIZE =117 ,/* and 118 */ +ATA_ID_COMMAND_SET_3 =119 , +ATA_ID_COMMAND_SET_4 =120 ,ATA_ID_LAST_LUN =126 ,ATA_ID_DLF =128 , ATA_ID_CSFO = 129,
@@ -382,6 +384,8 @@ enum {SATA_SSP =0x06 ,/* Software Settings Preservation */ SATA_DEVSLP =0x09 ,/* Device Sleep */ +SETFEATURE_SENSE_DATA =0xC3 ,/* Sense Data Reporting feature */ +/* feature values for SET_MAX */ ATA_SET_MAX_ADDR =0x00 , ATA_SET_MAX_PASSWD = 0x01,
@@ -705,6 +709,20 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id)return id[ATA_ID_COMMAND_SET_3 ] & (1 <<3 ); } +static inline bool ata_id_has_sense_reporting (const u16 *id) +{ +if (!(id[ATA_ID_CFS_ENABLE_2 ] & (1 <<15 ))) +return false; +return id[ATA_ID_COMMAND_SET_3 ] & (1 <<6 ); +} + +static inline bool ata_id_sense_reporting_enabled (const u16 *id) +{ +if (!(id[ATA_ID_CFS_ENABLE_2 ] & (1 <<15 ))) +return false; +return id[ATA_ID_COMMAND_SET_4 ] & (1 <<6 ); +} +/** * ata_id_major_version - get ATA level of drive * @id: Identify data
Signature · 1 line
1.8.5.2