public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Re: LIBATA AHCI engine timeout hang with ATAPI devices
       [not found] <4256D1A9.6080401@shore.net>
@ 2005-04-08 19:13 ` Jeff Garzik
  2005-04-08 23:08   ` Eric A. Cottrell
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Garzik @ 2005-04-08 19:13 UTC (permalink / raw)
  To: Eric A. Cottrell; +Cc: linux-ide, Linux Kernel

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

Eric A. Cottrell wrote:
> Hello,
> 
> I made the mistake of getting the Plextor SATA DVD Recorder with my new 
> system not realizing that SATA support is just coming online.  I want to 
> turn this into an opportunity to make the Plextor work.  Thanks to the 
> IDE information pages I got a good start.
> 
> I have success using the ata_piix and ahci drivers with SATA Hard 
> Drives.  I noticed that the Plextor works with the ata_piix driver  but 
> not with the AHCI driver.  The AHCI driver hangs after the INQUIRY is 
> printed.

You need something like the attached patch.

In general, ATAPI is still very much experimental at this point.  One 
known bug that affects libata is that ATAPI DMA is not aligned to a 
4-byte boundary.

	Jeff



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1874 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/17 04:43:52-05:00 jgarzik@pobox.com 
#   [libata ahci] finish ATAPI support
# 
# drivers/scsi/ahci.c
#   2005/02/17 04:42:57-05:00 jgarzik@pobox.com +9 -13
#   [libata ahci] finish ATAPI support
# 
diff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
--- a/drivers/scsi/ahci.c	2005-04-08 15:10:54 -04:00
+++ b/drivers/scsi/ahci.c	2005-04-08 15:10:54 -04:00
@@ -38,7 +38,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME	"ahci"
-#define DRV_VERSION	"1.00"
+#define DRV_VERSION	"1.10"
 
 
 enum {
@@ -49,6 +49,7 @@
 	AHCI_CMD_SLOT_SZ	= 32 * 32,
 	AHCI_RX_FIS_SZ		= 256,
 	AHCI_CMD_TBL_HDR	= 0x80,
+	AHCI_CMD_TBL_CDB	= 0x40,
 	AHCI_CMD_TBL_SZ		= AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16),
 	AHCI_PORT_PRIV_DMA_SZ	= AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ +
 				  AHCI_RX_FIS_SZ,
@@ -477,7 +478,8 @@
 
 static void ahci_qc_prep(struct ata_queued_cmd *qc)
 {
-	struct ahci_port_priv *pp = qc->ap->private_data;
+	struct ata_port *ap = qc->ap;
+	struct ahci_port_priv *pp = ap->private_data;
 	u32 opts;
 	const u32 cmd_fis_len = 5; /* five dwords */
 
@@ -489,18 +491,8 @@
 	opts = (qc->n_elem << 16) | cmd_fis_len;
 	if (qc->tf.flags & ATA_TFLAG_WRITE)
 		opts |= AHCI_CMD_WRITE;
-
-	switch (qc->tf.protocol) {
-	case ATA_PROT_ATAPI:
-	case ATA_PROT_ATAPI_NODATA:
-	case ATA_PROT_ATAPI_DMA:
+	if (is_atapi_taskfile(&qc->tf))
 		opts |= AHCI_CMD_ATAPI;
-		break;
-
-	default:
-		/* do nothing */
-		break;
-	}
 
 	pp->cmd_slot[0].opts = cpu_to_le32(opts);
 	pp->cmd_slot[0].status = 0;
@@ -512,6 +504,10 @@
 	 * a SATA Register - Host to Device command FIS.
 	 */
 	ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0);
+	if (opts & AHCI_CMD_ATAPI) {
+		memset(pp->cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32);
+		memcpy(pp->cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, ap->cdb_len);
+	}
 
 	if (!(qc->flags & ATA_QCFLAG_DMAMAP))
 		return;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: LIBATA AHCI engine timeout hang with ATAPI devices
  2005-04-08 19:13 ` [PATCH] Re: LIBATA AHCI engine timeout hang with ATAPI devices Jeff Garzik
@ 2005-04-08 23:08   ` Eric A. Cottrell
  0 siblings, 0 replies; 2+ messages in thread
From: Eric A. Cottrell @ 2005-04-08 23:08 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, Linux Kernel

Jeff Garzik wrote:
> You need something like the attached patch.
> 
> In general, ATAPI is still very much experimental at this point.  One 
> known bug that affects libata is that ATAPI DMA is not aligned to a 
> 4-byte boundary.
> 
Hello,

Thanks.

I already have that patch applied.  I will poke around the code over the weekend and see if I can figure out the problem.
I am alittle rusty as my last disk driver code was modifying Heathkit CPM BIOS to support a SMS SASI board for 8 inch floppies and 
Shugart SA1000 series hard drives!

I would like to help get ATAPI to work as I suspect more SATA ATAPI stuff will appear as motherboards use SATA.  It appears that the 
ahci/libata code is missing some needed steps that the ata_piix/libata code does.  Looking at the code and patches I can see that 
libata had to change to permit the hardware to perform tasks that libata did.

Thank you for your web page on IDE drives.  I downloaded alot of specs and even read a small bit of them.

73 Eric eac@shore.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-08 23:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4256D1A9.6080401@shore.net>
2005-04-08 19:13 ` [PATCH] Re: LIBATA AHCI engine timeout hang with ATAPI devices Jeff Garzik
2005-04-08 23:08   ` Eric A. Cottrell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox