linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Tejun Heo <htejun@gmail.com>, linux-ide@vger.kernel.org
Subject: Re: [PATCH] libata: fix ATA passthrough handling for ATAPI devices
Date: Sat, 21 Oct 2006 16:00:43 -0400	[thread overview]
Message-ID: <453A7C6B.3050108@torque.net> (raw)
In-Reply-To: <453A720C.6070905@pobox.com>

Jeff Garzik wrote:
> Tejun Heo wrote:
>> libata used to pass all SCSI commands directly to ATAPI devices.
>> However, this is incorrect for ATA passthrough commands as they must
>> be handled by the SAT layer in libata.  Also, regardless of the
>> attached ATAPI device's supported packet length, SAT says that both
>> flavors of passthrough commands (ATA12 and ATA16) should work.
>>
>> This patch makes the following changes to fix ATA passthrough handling
>> for ATAPI devices.
>>
>> * implement atapi_get_xlat_func() and make libata handle ATA12 and
>>   ATA16 in SAT layer instead of passing it directly to the target
>>   device even if the device is ATAPI.
>>
>> * Always allow 16byte CDBs for ATAPI devices.  This makes
> 
> This is definitely wrong.  Some ATAPI devices are limited to 12-byte CDBs.

Jeff,
The 16 byte CDB that Tejun is talking about is the
ATA PASS THROUGH (16) SCSI command. That is valid to
send to SATL (in front of a ATAPI device) for certain
values of EXTEND and T_LENGTH in that CDB (see
sat-r09.pdf section 12.2.4).

> Also, are we sure that no ATAPI device ever implements these opcodes?

The SATL is on the computer side of the ATAPI host
(initiator) so the ATA PASS THROUGH (12+16) SCSI
commands should never be seen by the ATAPI device
(target). Reason: the SATL translates those SCSI
commands into ATA commands prior to them being presented
to the ATAPI host.

> Prior to the SAT spec -- which includes most ATAPI firmwares -- those
> opcodes might have been vendor-reserved space.  Did you or Doug verify
> against the older specifications who might care about these opcodes?

The only clash between MMC and SATL SCSI opcodes is
with opcode 0xA1: BLANK in MMC and ATA PASS THROUGH (12)
in SAT. So, in the future, one way to resolve this is
to optionally tell the SATL not to translate the ATA PASS
THROUGH (12) SCSI command and send it through to the
ATAPI device which would interpret it as BLANK. That would
leave SATL users with the ATA PASS THROUGH (16) SCSI command
for sending ATA commands to the ATAPI device. And that ....
is definitely valid IMO.

> Or maybe there is a flag somewhere we can abuse, that permits support of
> both scenarios -- passing the command to the device, and handling the
> command internally?

This is all about being able to send ATA commands to
ATAPI devices that are valid for PACKET devices, examples:
    IDENTIFY PACKET DEVICE
    SET FEATURES
    IDENTIFY DEVICE (should abort command + set signature)
    DEVICE RESET
and I assume there are others.

Doug Gilbert


  reply	other threads:[~2006-10-21 19:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20  5:09 [PATCH] libata: fix ATA passthrough handling for ATAPI devices Tejun Heo
2006-10-21 19:16 ` Jeff Garzik
2006-10-21 20:00   ` Douglas Gilbert [this message]
2006-10-21 20:13     ` Jeff Garzik
2006-10-21 21:18       ` Douglas Gilbert
2006-10-21 21:40         ` Jeff Garzik
2006-10-21 23:11           ` Douglas Gilbert
2006-10-23  2:55             ` Tejun Heo
2006-10-23 13:58               ` Douglas Gilbert
2006-11-01  2:03 ` Jeff Garzik

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=453A7C6B.3050108@torque.net \
    --to=dougg@torque.net \
    --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 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).