aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-11-28 09:16:09 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-01 17:35:58 -0500
commitabb6a88974a8c92b049eddf37685899c4021cf0a (patch)
tree2d7effa375b1494212a11019c9f21158459578be /drivers/ata/libata-eh.c
parent1c20a493caa30c5d47a394f9dbd86e6282323db9 (diff)
libata: report protocol and full CDB on error
Protocol and CDB allocation size field are important in determining what went wrong with ATAPI commands. Report them on failure. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 0dac69db1fdf..e6605f038647 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1850,30 +1850,54 @@ static void ata_eh_link_report(struct ata_link *link)
1850 ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : ""); 1850 ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : "");
1851 1851
1852 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 1852 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
1853 static const char *dma_str[] = {
1854 [DMA_BIDIRECTIONAL] = "bidi",
1855 [DMA_TO_DEVICE] = "out",
1856 [DMA_FROM_DEVICE] = "in",
1857 [DMA_NONE] = "",
1858 };
1859 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 1853 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
1860 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; 1854 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf;
1855 const u8 *cdb = qc->cdb;
1856 char data_buf[20] = "";
1857 char cdb_buf[70] = "";
1861 1858
1862 if (!(qc->flags & ATA_QCFLAG_FAILED) || 1859 if (!(qc->flags & ATA_QCFLAG_FAILED) ||
1863 qc->dev->link != link || !qc->err_mask) 1860 qc->dev->link != link || !qc->err_mask)
1864 continue; 1861 continue;
1865 1862
1863 if (qc->dma_dir != DMA_NONE) {
1864 static const char *dma_str[] = {
1865 [DMA_BIDIRECTIONAL] = "bidi",
1866 [DMA_TO_DEVICE] = "out",
1867 [DMA_FROM_DEVICE] = "in",
1868 };
1869 static const char *prot_str[] = {
1870 [ATA_PROT_PIO] = "pio",
1871 [ATA_PROT_DMA] = "dma",
1872 [ATA_PROT_NCQ] = "ncq",
1873 [ATA_PROT_ATAPI] = "pio",
1874 [ATA_PROT_ATAPI_DMA] = "dma",
1875 };
1876
1877 snprintf(data_buf, sizeof(data_buf), " %s %u %s",
1878 prot_str[qc->tf.protocol], qc->nbytes,
1879 dma_str[qc->dma_dir]);
1880 }
1881
1882 if (is_atapi_taskfile(&qc->tf))
1883 snprintf(cdb_buf, sizeof(cdb_buf),
1884 "cdb %02x %02x %02x %02x %02x %02x %02x %02x "
1885 "%02x %02x %02x %02x %02x %02x %02x %02x\n ",
1886 cdb[0], cdb[1], cdb[2], cdb[3],
1887 cdb[4], cdb[5], cdb[6], cdb[7],
1888 cdb[8], cdb[9], cdb[10], cdb[11],
1889 cdb[12], cdb[13], cdb[14], cdb[15]);
1890
1866 ata_dev_printk(qc->dev, KERN_ERR, 1891 ata_dev_printk(qc->dev, KERN_ERR,
1867 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " 1892 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
1868 "tag %d cdb 0x%x data %u %s\n " 1893 "tag %d%s\n %s"
1869 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " 1894 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
1870 "Emask 0x%x (%s)%s\n", 1895 "Emask 0x%x (%s)%s\n",
1871 cmd->command, cmd->feature, cmd->nsect, 1896 cmd->command, cmd->feature, cmd->nsect,
1872 cmd->lbal, cmd->lbam, cmd->lbah, 1897 cmd->lbal, cmd->lbam, cmd->lbah,
1873 cmd->hob_feature, cmd->hob_nsect, 1898 cmd->hob_feature, cmd->hob_nsect,
1874 cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah, 1899 cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah,
1875 cmd->device, qc->tag, qc->cdb[0], qc->nbytes, 1900 cmd->device, qc->tag, data_buf, cdb_buf,
1876 dma_str[qc->dma_dir],
1877 res->command, res->feature, res->nsect, 1901 res->command, res->feature, res->nsect,
1878 res->lbal, res->lbam, res->lbah, 1902 res->lbal, res->lbam, res->lbah,
1879 res->hob_feature, res->hob_nsect, 1903 res->hob_feature, res->hob_nsect,