[PATCH 1/1] libata: dump full ATA firmware revision to dmesg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SCSI only supports a 4-character firmware revision string, while ATA
uses 8 characters.  Since it can be useful for debugging drive/host
issues, and because not everyone has a working hdparm on their system,
dump the full ATA firmware revision into dmesg at drive detection.
Only affects ATA devices connected via libata, and not ATAPI (since
they likely use SCSI conventions anyway).

Sample output from my dmesg:

ata1.00: ATA-7, max UDMA/133, 488395055 sectors: LBA48 NCQ (depth 0/32)
ata1.00: ata1: dev 0 multi count 16
ata1.00: ata1: Firmware Revision: 3.AAC
ata1.00: configured for UDMA/133
ata2.00: ATA-7, max UDMA/133, 195813072 sectors: LBA48 NCQ (depth 0/32)
ata2.00: ata2: dev 0 multi count 16
ata2.00: ata2: Firmware Revision: VA111910
ata2.00: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA      ST3250820AS      3.AA PQ: 0 ANSI: 5
scsi 1:0:0:0: Direct-Access     ATA      Maxtor 6V100E0   VA11 PQ: 0 ANSI: 5

Signed-off-by: Eric D. Mudama <edmudama@xxxxxxxxx>

---

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a388a8d..7dc4dad 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1607,6 +1607,7 @@ int ata_dev_configure(struct ata_device *dev)
       const u16 *id = dev->id;
       unsigned int xfer_mask;
       char revbuf[7];         /* XYZ-99\0 */
+       char fwrevbuf[9];
       int rc;

       if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
@@ -1721,6 +1722,16 @@ int ata_dev_configure(struct ata_device *dev)
                                       ap->id, dev->devno, dev->multi_count);
               }

+               if (ata_msg_drv(ap) && print_info) {
+                       /* SCSI only uses 4-char revisions, dump full
8 chars from ATA */
+                       ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV_OFS,
+                                       sizeof(fwrevbuf));
+
+                       ata_dev_printk(dev, KERN_INFO,
+                                      "ata%u: Firmware Revision: %s\n",
+                                      ap->id, fwrevbuf);
+               }
+
               dev->cdb_len = 16;
       }
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux