linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: IDE Linux <linux-ide@vger.kernel.org>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Doug Maxey <dwm@maxeymade.com>
Subject: [PATCH 3/3] libata-dev: pdc2027x ATAPI DMA lost irq problem workaround
Date: Fri, 12 Aug 2005 15:23:39 +0800	[thread overview]
Message-ID: <42FC4E7B.9030503@tw.ibm.com> (raw)
In-Reply-To: <42FC4B36.9080805@tw.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Jeff,

Patch 3/3: pdc2027x ATAPI DMA lost irq problem workaround

Description:
   Sometimes pdc2027x will lost irq after ATAPI DMA data transfer.
   With the previous workaround (cmd->request_bufflen % 256), the ATAPI DMA irq lost
problem still occurs during the test.

   Root cause for the irq lost is unknown yet. I've tried your ATAPI DMA alignment
patch, but the problem still occurs, even the buffer is aligned. I guess it is pdc2027x hardware problem.

   The following workarounds are adapted from the Promise pdc618 GPL driver.
They seem know about the problem and have the workarounds.

   In the Promise driver, there are 2 workarounds:
1. Only turn on ATAPI DMA for READ, WRITE, READ_CD and READ_DVD_STRUCTURE commands in the white list.
2. For WRITE_10, if LBA -45150 (FFFF4FA2h) to  -1 (FFFFFFFFh) then use PIO mode.
However, I've done some test. The negative LBA check seems not needed for pdc2027x.
So, only the command white list workaround is included in this patch.

Changes:
   - Only turn on ATAPI DMA for READ, WRITE, READ_CD and READ_DVD_STRUCTURE commands.

Tested OK on x86 + pdc20275 + Liteon CD-RW SOHR-5238S and LG DVDRAM GSA-4163B.

For your review, thanks.

Albert

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


[-- Attachment #2: pdc3.diff --]
[-- Type: text/plain, Size: 1150 bytes --]

--- 02_pdc_long/drivers/scsi/pata_pdc2027x.c	2005-08-12 11:39:32.000000000 +0800
+++ 03_pdc_lost_irq/drivers/scsi/pata_pdc2027x.c	2005-08-12 15:04:09.000000000 +0800
@@ -29,7 +29,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME	"pata_pdc2027x"
-#define DRV_VERSION	"0.71"
+#define DRV_VERSION	"0.72"
 #undef PDC_DEBUG
 
 #ifdef PDC_DEBUG
@@ -467,11 +467,30 @@
 static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc)
 {
 	struct scsi_cmnd *cmd = qc->scsicmd;
-	int rc = 0;
+	u8 *scsicmd = cmd->cmnd;
+	int rc = 1; /* atapi dma off by default */
 
-	/* pdc2027x can only do ATAPI DMA for specific buffer size */
-	if (cmd->request_bufflen % 256)
-		rc = 1;
+	/*
+	 * This workaround is from Promise's GPL driver.
+	 * If ATAPI DMA is used for commands not in the 
+	 * following white list, say MODE_SENSE and REQUEST_SENSE,
+	 * pdc2027x might hit the irq lost problem.
+	 */
+	switch (scsicmd[0]) {
+	case READ_10:
+	case WRITE_10:
+	case READ_12:
+	case WRITE_12:
+	case READ_6:
+	case WRITE_6:
+	case 0xad: /* READ_DVD_STRUCTURE */
+	case 0xbe: /* READ_CD */
+		/* ATAPI DMA is ok */
+		rc = 0;
+		break;
+	default:
+		;
+	}
 
 	return rc;
 }

  parent reply	other threads:[~2005-08-12  7:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-12  7:09 [PATCH 0/3] libata-dev: pdc2027x fixes Albert Lee
2005-08-12  7:19 ` [PATCH 1/3] libata-dev: Convert pdc2027x from PIO to MMIO Albert Lee
2005-08-12  7:21 ` [PATCH 2/3] libata-dev: pdc2027x use "long" for counter data type Albert Lee
2005-08-12  7:23 ` Albert Lee [this message]
2005-08-12  7:41   ` [PATCH 3/3] libata-dev: pdc2027x ATAPI DMA lost irq problem workaround Jeff Garzik
2005-08-12  8:20     ` Albert Lee
2005-08-12  7:37 ` [PATCH 0/3] libata-dev: pdc2027x fixes Jeff Garzik
2005-08-12  8:10   ` 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=42FC4E7B.9030503@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=bzolnier@gmail.com \
    --cc=dwm@maxeymade.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).