From: Sergei Shtylyov <sshtylyov@mvista.com>
To: "Thang Q. Nguyen" <tqnguyen@apm.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 3/5] sata_dwc: Add support ATAPI transfer
Date: Thu, 10 May 2012 13:50:09 +0400 [thread overview]
Message-ID: <4FAB8F51.3010004@mvista.com> (raw)
In-Reply-To: <1336623449-7697-1-git-send-email-tqnguyen@apm.com>
Hello.
On 10-05-2012 8:17, Thang Q. Nguyen wrote:
> Signed-off-by: Thang Q. Nguyen<tqnguyen@apm.com>
> ---
> drivers/ata/sata_dwc_460ex.c | 64 ++++++++++++++++++++++++++++++++++++++++--
> 1 files changed, 61 insertions(+), 3 deletions(-)
> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
> index 937aeb3..6175e01 100755
> --- a/drivers/ata/sata_dwc_460ex.c
> +++ b/drivers/ata/sata_dwc_460ex.c
[...]
> @@ -1385,6 +1389,58 @@ static void sata_dwc_port_stop(struct ata_port *ap)
> ap->private_data = NULL;
> }
>
> +/**
> + * sata_dwc_check_atapi_dma - Filter ATAPI cmds which are unsuitable for DMA.
> + * @qc: queued command to check for chipset/DMA compatibility.
> + *
> + * The bmdma engines cannot handle speculative data sizes (bytecount
> + * under/over flow). So only allow DMA for data transfer commands with
> + * known data sizes.
> + */
> +static int sata_dwc_check_atapi_dma(struct ata_queued_cmd *qc)
> +{
[...]
> +
> + /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */
Sector numbers are unsigned entities.
> + if (scmd->cmnd[0] == WRITE_10) {
> + lba = (scmd->cmnd[2] << 24) |
> + (scmd->cmnd[3] << 16) |
> + (scmd->cmnd[4] << 8) |
> + scmd->cmnd[5];
> + if (lba>= 0xFFFF4FA2)
> + pio = 1;
> + }
> + /*
> + * WORK AROUND: Fix DMA issue when blank CD/DVD disc in the drive
> + * and user use the 'fdisk -l' command. No DMA data returned so
> + * we can not complete the QC.
The user shouldn't use 'fdisk' command on CD/DVD disks. On the other
hand, he could use something like 'hdparm -t' od 'dd' with offset in which
case I'm not sure this heuristics will work.
> + */
> + else if (scmd->cmnd[0] == READ_10) {
> + lba = (scmd->cmnd[2] << 24) |
> + (scmd->cmnd[3] << 16) |
> + (scmd->cmnd[4] << 8) |
> + scmd->cmnd[5];
> + if (lba < 0x20)
> + pio = 1;
> + }
> + }
> + return pio;
> +}
> +
> /*
> * Function : sata_dwc_exec_command_by_tag
> * arguments : ata_port *ap, ata_taskfile *tf, u8 tag, u32 cmd_issued
WBR, Sergei
next prev parent reply other threads:[~2012-05-10 9:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 4:17 [PATCH 3/5] sata_dwc: Add support ATAPI transfer Thang Q. Nguyen
2012-05-10 9:50 ` Sergei Shtylyov [this message]
[not found] ` <CAKrQpSvqz-+w=Rvq_jtGwkEue0Tf6rh9Z5c9j4edbgeuWeMCVQ@mail.gmail.com>
2012-05-10 10:52 ` Sergei Shtylyov
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=4FAB8F51.3010004@mvista.com \
--to=sshtylyov@mvista.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tqnguyen@apm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox