From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Tejun Heo <htejun@gmail.com>, Alan Cox <alan@redhat.com>,
IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: PATCH:
Date: Sat, 28 Apr 2007 17:47:12 -0400 [thread overview]
Message-ID: <4633C0E0.60706@rtr.ca> (raw)
(resending..)
This patch adds support for issuing ATA_16 passthru commands
to ATAPI devices managed by libata. It requires the previous
CDB length fix patch.
A boot/module parameter, "ata16_passthru=1" can be used to
globally disable this feature, if ever desired.
Signed-Off-By: Mark Lord <mlord@pobox.com>
---
diff -u --recursive --new-file --exclude-from=old/Documentation/dontdiff old/drivers/ata/libata-core.c new/drivers/ata/libata-core.c
--- old/drivers/ata/libata-core.c 2007-02-02 12:29:10.000000000 -0500
+++ new/drivers/ata/libata-core.c 2007-02-02 12:29:03.000000000 -0500
@@ -82,6 +82,10 @@
module_param(atapi_dmadir, int, 0444);
MODULE_PARM_DESC(atapi_dmadir, "Enable ATAPI DMADIR bridge support (0=off, 1=on)");
+int ata16_passthru = 0;
+module_param(ata16_passthru, int, 0444);
+MODULE_PARM_DESC(ata16_passthru, "Enable passthru of SCSI opcode 0x85 to ATAPI devices (0=off, 1=on)");
+
int libata_fua = 0;
module_param_named(fua, libata_fua, int, 0444);
MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on)");
diff -u --recursive --new-file --exclude-from=old/Documentation/dontdiff old/drivers/ata/libata-scsi.c new/drivers/ata/libata-scsi.c
--- old/drivers/ata/libata-scsi.c 2007-02-02 12:29:10.000000000 -0500
+++ new/drivers/ata/libata-scsi.c 2007-02-02 12:29:25.000000000 -0500
@@ -2688,6 +2688,10 @@
static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
{
+ if (dev->class == ATA_DEV_ATAPI)
+ if (cmd != ATA_16 || ata16_passthru)
+ return atapi_xlat;
+
switch (cmd) {
case READ_6:
case READ_10:
@@ -2746,27 +2750,28 @@
void (*done)(struct scsi_cmnd *),
struct ata_device *dev)
{
- int rc = 0;
-
- 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);
+ ata_xlat_func_t xlat_func;
+ int rc = 0, max_len;
+ u8 scsi_op = scmd->cmnd[0];
+
+ if (scsi_op == ATA_16 && dev->class == ATA_DEV_ATAPI && !ata16_passthru)
+ max_len = 16;
+ else
+ max_len = dev->cdb_len;
+
+ if (unlikely(!scmd->cmd_len || scmd->cmd_len > max_len)) {
+ DPRINTK("bad CDB len=%u, max=%u\n",
+ scmd->cmd_len, max_len);
scmd->result = DID_ERROR << 16;
done(scmd);
return 0;
}
- if (dev->class == ATA_DEV_ATA) {
- ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
- scmd->cmnd[0]);
-
- if (xlat_func)
- rc = ata_scsi_translate(dev, scmd, done, xlat_func);
- else
- ata_scsi_simulate(dev, scmd, done);
- } else
- rc = ata_scsi_translate(dev, scmd, done, atapi_xlat);
-
+ xlat_func = ata_get_xlat_func(dev, scsi_op);
+ if (xlat_func)
+ rc = ata_scsi_translate(dev, scmd, done, xlat_func);
+ else
+ ata_scsi_simulate(dev, scmd, done);
return rc;
}
diff -u --recursive --new-file --exclude-from=old/Documentation/dontdiff old/drivers/ata/libata.h new/drivers/ata/libata.h
--- old/drivers/ata/libata.h 2007-02-02 12:26:28.000000000 -0500
+++ new/drivers/ata/libata.h 2007-02-02 12:29:03.000000000 -0500
@@ -47,6 +47,7 @@
extern struct workqueue_struct *ata_aux_wq;
extern int atapi_enabled;
extern int atapi_dmadir;
+extern int ata16_passthru;
extern int libata_fua;
extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
next reply other threads:[~2007-04-28 21:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-28 21:47 Mark Lord [this message]
2007-04-28 21:48 ` PATCH: libata: add support for ATA_16 on ATAPI Mark Lord
2007-04-29 7:46 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2004-11-21 23:58 Patch, Andreas Fenkart
2004-11-22 6:37 ` Patch, Jaroslav Kysela
2004-10-01 13:46 Issues with a Doc Milplus Nicolas Pouillon
2004-10-01 13:57 ` David Woodhouse
2004-10-01 14:27 ` Nicolas Pouillon
2004-10-02 13:55 ` Patch ! Nicolas Pouillon
2004-10-02 20:42 ` Thomas Gleixner
2004-10-03 1:11 ` Nicolas Pouillon
[not found] ` <20041003030653.2e0452a7.nipo@ssji.net>
[not found] ` <1096768161.21297.129.camel@thomas>
2004-10-03 20:18 ` Nicolas Pouillon
2004-10-04 8:05 ` Thomas Gleixner
2004-10-04 16:38 ` Nicolas Pouillon
2004-10-04 17:59 ` Thomas Gleixner
2004-10-04 20:47 ` Nicolas Pouillon
2004-10-04 21:04 ` Thomas Gleixner
2000-07-12 16:24 PATCH: Juan J. Quintela
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=4633C0E0.60706@rtr.ca \
--to=liml@rtr.ca \
--cc=alan@redhat.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.