All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Linux IDE <linux-ide@vger.kernel.org>,
	Doug Maxey <dwm@enoyolf.org>, Mark Lord <mlord@pobox.com>
Subject: [PATCH 5/6] libata: support ATAPI devices
Date: Thu, 07 Jun 2007 15:59:05 +0800	[thread overview]
Message-ID: <4667BAC9.2090406@tw.ibm.com> (raw)
In-Reply-To: <4667B767.5060601@tw.ibm.com>

Patch 5/6:
 Support ATA passthru to ATAPI devices.
Revised based on Mark's patch and Jeff's comments.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Cc: Mark Lord <mlord@pobox.com> 
---
After reading Mark's patch, I guess we can safely by-pass the 
cdb_len check: the ATA_12/ATA_16 are for the libata SATL and
get unwrapped to ATA taskfiles before the devices ever see them.

diff -Nrup 04_dev_bit/drivers/ata/libata-scsi.c 05_supp_atapi/drivers/ata/libata-scsi.c
--- 04_dev_bit/drivers/ata/libata-scsi.c	2007-06-07 14:44:27.000000000 +0800
+++ 05_supp_atapi/drivers/ata/libata-scsi.c	2007-06-07 14:44:30.000000000 +0800
@@ -2701,10 +2701,6 @@ static inline ata_xlat_func_t ata_get_xl
 	case VERIFY_16:
 		return ata_scsi_verify_xlat;
 
-	case ATA_12:
-	case ATA_16:
-		return ata_scsi_pass_thru;
-
 	case START_STOP:
 		return ata_scsi_start_stop_xlat;
 	}
@@ -2740,8 +2736,14 @@ static inline int __ata_scsi_queuecmd(st
 				      void (*done)(struct scsi_cmnd *),
 				      struct ata_device *dev)
 {
+	u8 cmd = scmd->cmnd[0];
 	int rc = 0;
 
+	if (unlikely(cmd == ATA_12 || cmd == ATA_16)) {
+		rc = ata_scsi_translate(dev, scmd, done, ata_scsi_pass_thru);
+		return rc;
+	}
+
 	if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) {
 		DPRINTK("bad CDB len=%u, max=%u\n",
 			scmd->cmd_len, dev->cdb_len);
@@ -2751,8 +2753,7 @@ static inline int __ata_scsi_queuecmd(st
 	}
 
 	if (dev->class == ATA_DEV_ATA) {
-		ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
-							      scmd->cmnd[0]);
+		ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, cmd);
 
 		if (xlat_func)
 			rc = ata_scsi_translate(dev, scmd, done, xlat_func);



  parent reply	other threads:[~2007-06-07  7:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07  7:44 [PATCH 0/6] libata: ATA passthru fixes Albert Lee
2007-06-07  7:47 ` [PATCH 1/6] libata: update protocol numbers Albert Lee
2007-06-10  2:46   ` Jeff Garzik
2007-06-10  3:12   ` Jeff Garzik
2007-06-10 22:31     ` Mark Lord
2007-06-15 14:45       ` Jeff Garzik
2007-06-07  7:49 ` [PATCH 2/6] libata: support PIO multi commands Albert Lee
2007-06-07  7:50 ` [PATCH 3/6] libata: map UDMA protocols Albert Lee
2007-06-07  7:52 ` [PATCH 4/6] libata: always enforce correct DEV bit Albert Lee
2007-06-07  7:59 ` Albert Lee [this message]
2007-06-07  8:01 ` [PATCH 6/6] libata: update cached device paramters 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=4667BAC9.2090406@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=albertl@mail.com \
    --cc=dwm@enoyolf.org \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=mlord@pobox.com \
    /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.