All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Tejun Heo <htejun@gmail.com>, Doug Maxey <dwm@maxeymade.com>,
	Linux IDE <linux-ide@vger.kernel.org>
Subject: [PATCH/RFC 2/5] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr()
Date: Thu, 09 Mar 2006 16:49:32 +0800	[thread overview]
Message-ID: <440FEC1C.30601@tw.ibm.com> (raw)
In-Reply-To: <440FEA4B.10500@tw.ibm.com>

Minor fix for ata_hsm_move() to work with ata_host_intr().

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
---

Changes:
- WARN_ON() and comment fix
- Make the HSM_ST_LAST device status checking more rigid. 
- Treate unknown HSM state as BUG().

--- 01_move_out/drivers/scsi/libata-core.c	2006-03-08 18:10:21.000000000 +0800
+++ 02_minor_fix/drivers/scsi/libata-core.c	2006-03-08 18:58:16.000000000 +0800
@@ -3631,6 +3631,9 @@ static void ata_pio_error(struct ata_por
 static void ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
 			u8 status)
 {
+	WARN_ON(qc == NULL);
+	WARN_ON((qc->flags & ATA_QCFLAG_ACTIVE) == 0);
+
 	/* check error */
 	if (unlikely(status & (ATA_ERR | ATA_DF))) {
 		qc->err_mask |= AC_ERR_DEV;
@@ -3640,10 +3643,6 @@ static void ata_hsm_move(struct ata_port
 fsm_start:
 	switch (ap->hsm_task_state) {
 	case HSM_ST_FIRST:
-		/* Some pre-ATAPI-4 devices assert INTRQ 
-		 * at this state when ready to receive CDB.
-		 */
-
 		/* check device status */
 		if (unlikely((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ)) {
 			/* Wrong status. Let EH handle this */
@@ -3696,9 +3695,8 @@ fsm_start:
 		break;
 
 	case HSM_ST_LAST:
-		if (unlikely(status & ATA_DRQ)) {
-			/* handle DRQ=1 as error */
-			qc->err_mask |= AC_ERR_HSM;
+		if (unlikely(!ata_ok(status))) {
+			qc->err_mask |= __ac_err_mask(status);
 			ap->hsm_task_state = HSM_ST_ERR;
 			goto fsm_start;
 		}
@@ -3707,17 +3705,18 @@ fsm_start:
 		DPRINTK("ata%u: command complete, drv_stat 0x%x\n",
 			ap->id, status);
 
+		WARN_ON(qc->err_mask);
+
 		ap->hsm_task_state = HSM_ST_IDLE;
 
 		/* complete taskfile transaction */
-		qc->err_mask |= ac_err_mask(status);
 		ata_qc_complete(qc);
 		break;
 
 	case HSM_ST_ERR:
 		if (qc->tf.command != ATA_CMD_PACKET)
-			printk(KERN_ERR "ata%u: command error, drv_stat 0x%x host_stat 0x%x\n",
-			       ap->id, status, host_stat);
+			printk(KERN_ERR "ata%u: command error, drv_stat 0x%x\n",
+			       ap->id, status);
 
 		/* make sure qc->err_mask is available to 
 		 * know what's wrong and recover
@@ -3728,7 +3727,7 @@ fsm_start:
 		ata_qc_complete(qc);
 		break;
 	default:
-		goto idle_irq;
+		BUG();
 	}
 
 }
@@ -4427,6 +4426,10 @@ inline unsigned int ata_host_intr (struc
 	/* Check whether we are expecting interrupt in this state */
 	switch (ap->hsm_task_state) {
 	case HSM_ST_FIRST:
+		/* Some pre-ATAPI-4 devices assert INTRQ 
+		 * at this state when ready to receive CDB.
+		 */
+
 		/* Check the ATA_DFLAG_CDB_INTR flag is enough here.
 		 * The flag was turned on only for atapi devices.
 		 * No need to check is_atapi_taskfile(&qc->tf) again.



  parent reply	other threads:[~2006-03-09  8:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09  8:41 [PATCH/RFC 0/5] libata-dev: integrate polling pio with irq-pio Albert Lee
2006-03-09  8:45 ` [PATCH/RFC 1/5] libata-dev: Move out the HSM code from ata_host_intr() Albert Lee
2006-03-10  9:18   ` Tejun Heo
2006-03-09  8:49 ` Albert Lee [this message]
2006-03-10  9:22   ` [PATCH/RFC 2/5] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr() Tejun Heo
2006-03-09  8:51 ` [PATCH/RFC 3/5] libata-dev: Let ata_hsm_move() work with both irq-pio and polling pio Albert Lee
2006-03-10  9:31   ` Tejun Heo
2006-03-10 13:52     ` Albert Lee
2006-03-10 17:32       ` Tejun Heo
2006-03-09  8:54 ` [PATCH/RFC 4/5] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move() Albert Lee
2006-03-10  9:35   ` Tejun Heo
2006-03-10 14:25     ` Albert Lee
2006-03-09  8:56 ` [PATCH/RFC 5/5] libata-dev: Cleanup unused enums/functions Albert Lee
2006-03-10  9:38 ` [PATCH/RFC 0/5] libata-dev: integrate polling pio with irq-pio Tejun Heo
2006-03-12  0:37 ` Jeff Garzik
2006-03-13  7:33   ` [PATCH 0/5] libata-dev: integrate polling pio with irq-pio (respin) Albert Lee
2006-03-13  7:37     ` [PATCH 1/5] libata-dev: Move out the HSM code from ata_host_intr() Albert Lee
2006-03-13  7:41     ` [PATCH 2/5] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr() Albert Lee
2006-03-13  7:45     ` [PATCH 3/5] libata-dev: Let ata_hsm_move() work with both irq-pio and polling pio Albert Lee
2006-03-13  7:55       ` Jeff Garzik
2006-03-13  8:42         ` [PATCH 1/1] libata-dev: Make the the in_wq check as an inline function Albert Lee
2006-03-13  8:56           ` Jeff Garzik
2006-03-13  7:47     ` [PATCH 4/5] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move() Albert Lee
2006-03-13  7:49     ` [PATCH 5/5] libata-dev: Cleanup unused enums/functions Albert Lee

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=440FEC1C.30601@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=albertl@mail.com \
    --cc=dwm@maxeymade.com \
    --cc=htejun@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.