From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, alan@lxorguk.ukuu.org.uk, albertcc@tw.ibm.com,
linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 10/14] libata: don't read TF directly from sense generation functions
Date: Sat, 1 Apr 2006 19:48:37 +0900 [thread overview]
Message-ID: <11438885171262-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11438885151530-git-send-email-htejun@gmail.com>
TF register might not be directly accessible depending on errors.
e.g. TF of failed NCQ command is in log page 10h. Make reading TF
responsibility of error handlers. For the current EH, simply push TF
reading into qc completion functions as they are practically part of
EH. New EH will fill qc->tf with status registers before complting
qcs.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/scsi/libata-scsi.c | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
d7387c910d1b6c1e9019e71e014758e77aff18e6
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index ec628ce..2870652 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -546,12 +546,6 @@ void ata_gen_ata_desc_sense(struct ata_q
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
/*
- * Read the controller registers.
- */
- WARN_ON(qc->ap->ops->tf_read == NULL);
- qc->ap->ops->tf_read(qc->ap, tf);
-
- /*
* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
*/
@@ -622,12 +616,6 @@ void ata_gen_fixed_sense(struct ata_queu
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
/*
- * Read the controller registers.
- */
- WARN_ON(qc->ap->ops->tf_read == NULL);
- qc->ap->ops->tf_read(qc->ap, tf);
-
- /*
* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
*/
@@ -1337,11 +1325,14 @@ static void ata_scsi_qc_complete(struct
*/
if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) &&
((cdb[2] & 0x20) || need_sense)) {
+ qc->ap->ops->tf_read(qc->ap, &qc->tf);
ata_gen_ata_desc_sense(qc);
} else {
if (!need_sense) {
cmd->result = SAM_STAT_GOOD;
} else {
+ qc->ap->ops->tf_read(qc->ap, &qc->tf);
+
/* TODO: decide which descriptor format to use
* for 48b LBA devices and call that here
* instead of the fixed desc, which is only
@@ -2133,13 +2124,15 @@ void ata_scsi_badcmd(struct scsi_cmnd *c
static void atapi_sense_complete(struct ata_queued_cmd *qc)
{
- if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0))
+ if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) {
/* FIXME: not quite right; we don't want the
* translation of taskfile registers into
* a sense descriptors, since that's only
* correct for ATA, not ATAPI
*/
+ qc->ap->ops->tf_read(qc->ap, &qc->tf);
ata_gen_ata_desc_sense(qc);
+ }
qc->scsidone(qc->scsicmd);
ata_qc_free(qc);
@@ -2207,17 +2200,15 @@ static void atapi_qc_complete(struct ata
cmd->result = SAM_STAT_CHECK_CONDITION;
atapi_request_sense(qc);
return;
- }
-
- else if (unlikely(err_mask))
+ } else if (unlikely(err_mask)) {
/* FIXME: not quite right; we don't want the
* translation of taskfile registers into
* a sense descriptors, since that's only
* correct for ATA, not ATAPI
*/
+ qc->ap->ops->tf_read(qc->ap, &qc->tf);
ata_gen_ata_desc_sense(qc);
-
- else {
+ } else {
u8 *scsicmd = cmd->cmnd;
if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
--
1.2.4
next prev parent reply other threads:[~2006-04-01 10:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-01 10:48 [PATCHSET] libata: prep for new EH Tejun Heo
2006-04-01 10:48 ` [PATCH 09/14] libata: always generate sense if qc->err_mask is non-zero Tejun Heo
2006-04-01 20:02 ` Jeff Garzik
2006-04-01 10:48 ` [PATCH 01/14] libata: report device number when PIO fails Tejun Heo
2006-04-01 10:48 ` [PATCH 07/14] libata: add ATA_QCFLAG_IO Tejun Heo
2006-04-01 10:48 ` [PATCH 06/14] libata: clear ATA_DFLAG_PIO before setting it Tejun Heo
2006-04-01 10:48 ` [PATCH 05/14] libata: clear only affected flags during ata_dev_configure() Tejun Heo
2006-04-01 10:48 ` [PATCH 02/14] libata: ata_dev_revalidate() printk update Tejun Heo
2006-04-01 10:48 ` [PATCH 04/14] libata: clean up constants Tejun Heo
2006-04-01 20:02 ` Jeff Garzik
2006-04-01 10:48 ` [PATCH 08/14] libata: pass qc around intead of ap during PIO Tejun Heo
2006-04-01 10:48 ` [PATCH 03/14] libata: ATA_FLAG_IN_EH is not used, kill it Tejun Heo
2006-04-01 10:48 ` [PATCH 13/14] libata: separate out libata-eh.c Tejun Heo
2006-04-01 10:48 ` [PATCH 11/14] libata: add @cdb to ata_exec_internal() Tejun Heo
2006-04-01 10:48 ` [PATCH 14/14] libata: make some libata-core routines extern Tejun Heo
2006-04-01 10:48 ` Tejun Heo [this message]
2006-04-01 20:05 ` [PATCH 10/14] libata: don't read TF directly from sense generation functions Jeff Garzik
2006-04-01 10:48 ` [PATCH 12/14] libata: dec scmd->retries for qcs with zero err_mask Tejun Heo
2006-04-01 10:51 ` [PATCHSET] libata: prep for new EH Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11438885171262-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertcc@tw.ibm.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).