• Niklas Cassel's avatar
    ata: libata: fetch sense data for ATA devices supporting sense reporting · 013115d9
    Niklas Cassel authored
    Currently, the sense data reporting feature set is enabled for all ATA
    devices which supports the feature set (ata_id_has_sense_reporting()),
    see ata_dev_config_sense_reporting().
    
    However, even if sense data reporting is enabled, and the device
    indicates that sense data is available, the sense data is only fetched
    for ATA ZAC devices. For regular ATA devices, the available sense data
    is never fetched, it is simply ignored. Instead, libata will use the
    ERROR + STATUS fields and map them to a very generic and reduced set
    of sense data, see ata_gen_ata_sense() and ata_to_sense_error().
    
    When sense data reporting was first implemented, regular ATA devices
    did fetch the sense data from the device. However, this was restricted
    to only ATA ZAC devices in commit ca156e00 ("libata: don't request
    sense data on !ZAC ATA devices").
    
    With recent changes related to sense data and NCQ autosense, we want
    to, once again, fetch the sense data for all ATA devices supporting
    sense reporting.
    ata_gen_ata_sense() should only be used for devices that don't support
    the sense data reporting feature set.
    hopefully the features will be more robust this time around.
    
    It is not just ZAC, many new ATA features, e.g. Command Duration
    Limits, relies on working NCQ autosense and sense data. Therefore,
    it is not really an option to avoid fetching the sense data forever.
    
    If we encounter a device that is misbehaving because the sense data is
    actually fetched, then that device should be quirked such that it
    never enables the sense data reporting feature set in the first place,
    since such a device is obviously not compliant with the specification.
    
    The order in which we will try to add sense data to a scsi_cmnd:
    1) NCQ autosense (if supported) - ata_eh_analyze_ncq_error()
    2) REQUEST SENSE DATA EXT (if supported) - ata_eh_request_sense()
    3) error + status field translation - ata_gen_ata_sense(), called
       by ata_scsi_qc_complete() if neither 1) or 2) is supported.
    Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    013115d9
libata-eh.c 106 KB