aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-03-20 02:24:11 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:02 -0400
commita51d644af6eb0a93bc383e5f005faa445c87f335 (patch)
treeb1392796d9766e86e7a87d57dd0f7d62e0fa0dfa /drivers/ata/libata-core.c
parent55a6adeea4077521b4bba1dfe674f5835157a00b (diff)
libata: improve AC_ERR_DEV handling for ->post_internal_cmd
->post_internal_cmd is simplified EH for internal commands. Its primary mission is to stop the controller such that no rogue memory access or other activities occur after the internal command is released. It may provide error diagnostics by setting qc->err_mask but this hasn't been a requirement. To ignore SETXFER failure for CFA devices, libata needs to know whether a command was failed by the device or for any other reason. ie. internal command needs to get AC_ERR_DEV right. This patch makes the following changes to AC_ERR_DEV handling and ->post_internal_cmd semantics to accomodate this need and simplify callback implementation. 1. As long as the correct bits in the result TF registers are set, there is no need to set AC_ERR_DEV explicitly. libata EH core takes care of that for both normal and internal commands. 2. The only requirement for ->post_internal_cmd() is to put the controller into quiescent state. It needs not to set any err_mask. 3. ata_exec_internal_sg() performs minimal error analysis such that AC_ERR_DEV is automatically set as long as result_tf is filled correctly. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 96bf86f67388..2f2884b92434 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1270,12 +1270,16 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1270 if (ap->ops->post_internal_cmd) 1270 if (ap->ops->post_internal_cmd)
1271 ap->ops->post_internal_cmd(qc); 1271 ap->ops->post_internal_cmd(qc);
1272 1272
1273 if ((qc->flags & ATA_QCFLAG_FAILED) && !qc->err_mask) { 1273 /* perform minimal error analysis */
1274 if (ata_msg_warn(ap)) 1274 if (qc->flags & ATA_QCFLAG_FAILED) {
1275 ata_dev_printk(dev, KERN_WARNING, 1275 if (qc->result_tf.command & (ATA_ERR | ATA_DF))
1276 "zero err_mask for failed " 1276 qc->err_mask |= AC_ERR_DEV;
1277 "internal command, assuming AC_ERR_OTHER\n"); 1277
1278 qc->err_mask |= AC_ERR_OTHER; 1278 if (!qc->err_mask)
1279 qc->err_mask |= AC_ERR_OTHER;
1280
1281 if (qc->err_mask & ~AC_ERR_OTHER)
1282 qc->err_mask &= ~AC_ERR_OTHER;
1279 } 1283 }
1280 1284
1281 /* finish up */ 1285 /* finish up */