Commit a836d3e8 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

libata-sff: improve HSM violation reporting

Improve SFF HSM violation reporting such that each HSM violation can
be distinguished using ehi_desc.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent ea0c62f7
...@@ -1094,6 +1094,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) ...@@ -1094,6 +1094,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
u8 status, int in_wq) u8 status, int in_wq)
{ {
struct ata_eh_info *ehi = &ap->link.eh_info;
unsigned long flags = 0; unsigned long flags = 0;
int poll_next; int poll_next;
...@@ -1125,9 +1126,12 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, ...@@ -1125,9 +1126,12 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
if (likely(status & (ATA_ERR | ATA_DF))) if (likely(status & (ATA_ERR | ATA_DF)))
/* device stops HSM for abort/error */ /* device stops HSM for abort/error */
qc->err_mask |= AC_ERR_DEV; qc->err_mask |= AC_ERR_DEV;
else else {
/* HSM violation. Let EH handle this */ /* HSM violation. Let EH handle this */
ata_ehi_push_desc(ehi,
"ST_FIRST: !(DRQ|ERR|DF)");
qc->err_mask |= AC_ERR_HSM; qc->err_mask |= AC_ERR_HSM;
}
ap->hsm_task_state = HSM_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start; goto fsm_start;
...@@ -1146,9 +1150,9 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, ...@@ -1146,9 +1150,9 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
* the CDB. * the CDB.
*/ */
if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) { if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
ata_port_printk(ap, KERN_WARNING, ata_ehi_push_desc(ehi, "ST_FIRST: "
"DRQ=1 with device error, " "DRQ=1 with device error, "
"dev_stat 0x%X\n", status); "dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM; qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start; goto fsm_start;
...@@ -1205,9 +1209,9 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, ...@@ -1205,9 +1209,9 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
* let the EH abort the command or reset the device. * let the EH abort the command or reset the device.
*/ */
if (unlikely(status & (ATA_ERR | ATA_DF))) { if (unlikely(status & (ATA_ERR | ATA_DF))) {
ata_port_printk(ap, KERN_WARNING, "DRQ=1 with " ata_ehi_push_desc(ehi, "ST-ATAPI: "
"device error, dev_stat 0x%X\n", "DRQ=1 with device error, "
status); "dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM; qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start; goto fsm_start;
...@@ -1226,13 +1230,17 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, ...@@ -1226,13 +1230,17 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
if (likely(status & (ATA_ERR | ATA_DF))) if (likely(status & (ATA_ERR | ATA_DF)))
/* device stops HSM for abort/error */ /* device stops HSM for abort/error */
qc->err_mask |= AC_ERR_DEV; qc->err_mask |= AC_ERR_DEV;
else else {
/* HSM violation. Let EH handle this. /* HSM violation. Let EH handle this.
* Phantom devices also trigger this * Phantom devices also trigger this
* condition. Mark hint. * condition. Mark hint.
*/ */
ata_ehi_push_desc(ehi, "ST-ATA: "
"DRQ=1 with device error, "
"dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM | qc->err_mask |= AC_ERR_HSM |
AC_ERR_NODEV_HINT; AC_ERR_NODEV_HINT;
}
ap->hsm_task_state = HSM_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start; goto fsm_start;
...@@ -1257,8 +1265,12 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, ...@@ -1257,8 +1265,12 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
status = ata_wait_idle(ap); status = ata_wait_idle(ap);
} }
if (status & (ATA_BUSY | ATA_DRQ)) if (status & (ATA_BUSY | ATA_DRQ)) {
ata_ehi_push_desc(ehi, "ST-ATA: "
"BUSY|DRQ persists on ERR|DF, "
"dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM; qc->err_mask |= AC_ERR_HSM;
}
/* ata_pio_sectors() might change the /* ata_pio_sectors() might change the
* state to HSM_ST_LAST. so, the state * state to HSM_ST_LAST. so, the state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment