Repository navigation
ata_id: Add check for fixed format sense codes - #13654
Conversation
Original revisions of the SAT (SCSI-ATA Translation) specification required that all sense data be reported in Descriptor Format (72h). Later revisions specifcally allow and account for sense data being reported in Fixed Format (70h). The current code checks for a Descriptor Format sense structure (0x72), then looks specifically at the first byte of the first descriptor for the ATA specific code 0x9, cross referencing it with the first byte which is just a length field 0x0c (as a sanity check). In the Fixed Format case(0x70), we can fall back to using the top-level SCSI Sense data for the Additional Sense code (0x0) and then the Additional Sense Code Qualifier (0x1d), That identifies that the sense data is of the format associated with: `ATA PASS THROUGH INFORMATION AVAILABLE`. This fallback mechanism retains support for SATLs compliant with ANSI INCITS 431-2007, and enables support for Fixed Format Sense data enabled by SATLs with later revisions.
|
I authored this PR, despite the warnings around support for ata_id(#2362 (comment), others in that chain), and other hardware centric udev utilities, primarily as informational to other users that there is a relatively straightforward change if you are looking for it |
|
Could you give an example of the changed output? |
|
Glad to do so. This patch allows ata_id to export attributes correctly. I believe that any drive can potentially return information in this format on any SATL (including the Linux builtin SATL), but in this particular case, it appears it is a function of the SATL. Attaching the disk to the AHCI controller changes the behavior impacted here. (Not entirely surprisingly, SATLs are are pretty inconsistent). This case specifically is an LSI SATL. I'll illustrate that without the patch, ata_id does not return any output for a valid SATA drive but after the patch does.
Sense buffers visible with the strace:
If I install the same disk into a machine using the AHCI driver(Linux SATL), this behavior changes: |
|
Thanks! I pasted your comment into the commit message, because that makes it more accesible to people later on. |
Backport of udev id_ata changes: systemd/systemd#13654 systemd/systemd#24923
Backport of udev id_ata changes: systemd/systemd#13654 systemd/systemd#24923
Original revisions of the SAT (SCSI-ATA Translation) specification
required that all sense data be reported in Descriptor Format (72h).
Later revisions specifcally allow and account for sense data being
reported in Fixed Format (70h).
The current code checks for a Descriptor Format sense structure (0x72),
then looks specifically at the first byte of the first descriptor for the
ATA specific code 0x9, cross referencing it with the first byte which is
just a length field 0x0c (as a sanity check).
In the Fixed Format case(0x70), we can fall back to using the top-level
SCSI Sense data for the Additional Sense code (0x0) and then the
Additional Sense Code Qualifier (0x1d),
That identifies that the sense data is of the format associated with:
ATA PASS THROUGH INFORMATION AVAILABLE.This fallback mechanism retains support for SATLs compliant with ANSI
INCITS 431-2007, and enables support for Fixed Format Sense data
enabled by SATLs with later revisions.