mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
To: Santosh Y <santoshsy@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	linux-scsi@vger.kernel.org, patches@linaro.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	arnd.bergmann@linaro.org, saugata.das@linaro.org,
	dsaxena@linaro.org, stephen.doel@linaro.org, venkat@linaro.org,
	ilho215.lee@samsung.com, nala.la@samsung.com,
	girish.shivananjappa@linaro.org, vishak.g@samsung.com,
	k.rajesh@samsung.com, yejin.moon@samsung.com,
	sreekumar.c@samsung.com, vinholikatti@gmail.com,
	linkinjeon@gmail.com, michaelc@cs.wisc.edu
Subject: Re: [PATCH v3 2/5] [SCSI] ufshcd: UFS UTP Transfer requests handling
Date: Mon, 26 Mar 2012 13:34:43 +0900	[thread overview]
Message-ID: <4F6FF1E3.7080908@toshiba.co.jp> (raw)
In-Reply-To: <1330497714-26504-3-git-send-email-santoshsy@gmail.com>

Santosh Y wrote:
> +        ucd_cmd_ptr->exp_data_transfer_len =
> +            cpu_to_be32(lrbp->cmd->transfersize);
> +
> +        memcpy(ucd_cmd_ptr->cdb,
> +               lrbp->cmd->cmnd,
> +               (min_t(unsigned short,
> +                  lrbp->cmd->cmd_len,
> +                  MAX_CDB_SIZE)));

"Exptected Data Transfer Length" field contains a value that
represents the number of bytes that are required to complete the
SCSI command request and the number of bytes that the Initiator
expects to be transferred to/from the Target.
(JEDEC Standard 220 Table7-7)
On the other hand, "transfersize" in a scsi_cmnd struct is trimmed
to the sector size when requested transfer length exceeds it.
You may derive the actual transfer length from SCSI command itself like following.

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index feffe65..e63fecb 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -647,6 +647,34 @@ static void ufshcd_compose_upiu(struct ufshcd_lrb *lrbp)
                        (min_t(unsigned short,
                               lrbp->cmd->cmd_len,
                               MAX_CDB_SIZE)));
+
+               /* Overwrite exptected transfer length by using TRANSFER_LENGTH in SCSI commands */
+               switch(ucd_cmd_ptr->cdb[0]) {
+               case READ_6:
+               case WRITE_6:
+                       ucd_cmd_ptr->exp_data_transfer_len =
+                               cpu_to_be32(lrbp->cmd->transfersize *
+                                           ucd_cmd_ptr->cdb[4]);
+                       break;
+               case READ_10:
+               case WRITE_10:
+                       ucd_cmd_ptr->exp_data_transfer_len =
+                               cpu_to_be32(lrbp->cmd->transfersize *
+                                           ((ucd_cmd_ptr->cdb[7] << 8) |
+                                            ucd_cmd_ptr->cdb[8]));
+                       break;
+               case READ_12:
+               case WRITE_12:
+                       ucd_cmd_ptr->exp_data_transfer_len =
+                               cpu_to_be32(lrbp->cmd->transfersize *
+                                           ((ucd_cmd_ptr->cdb[10] << 24) |
+                                            (ucd_cmd_ptr->cdb[11] << 16) |
+                                            (ucd_cmd_ptr->cdb[12] << 8) |
+                                            ucd_cmd_ptr->cdb[13]));
+                       break;
+               default:
+                       break;
+               }
                 break;
         case UTP_CMD_TYPE_DEV_MANAGE:
                 /* For query function implementation */


  reply	other threads:[~2012-03-26  5:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29  6:41 [PATCH v3 0/5] [SCSI] ufshcd: UFS Host Controller Driver Santosh Y
2012-02-29  6:41 ` [PATCH v3 1/5] [SCSI] ufshcd: UFS Host controller driver Santosh Y
2012-03-26  4:32   ` KOBAYASHI Yoshitake
2012-03-27  4:01     ` Santosh Y
2012-02-29  6:41 ` [PATCH v3 2/5] [SCSI] ufshcd: UFS UTP Transfer requests handling Santosh Y
2012-03-26  4:34   ` KOBAYASHI Yoshitake [this message]
2012-03-27  4:03     ` Santosh Y
2012-03-27  5:52     ` Santosh Y
2012-03-29  1:40       ` KOBAYASHI Yoshitake
2012-04-10 11:08     ` Venkatraman S
2012-02-29  6:41 ` [PATCH v3 3/5] [SCSI] ufshcd: UFSHCI error handling Santosh Y
2012-02-29  6:41 ` [PATCH v3 4/5] [SCSI] ufshcd: SCSI " Santosh Y
2012-02-29  6:41 ` [PATCH v3 5/5] Documentation: UFS Host Controller Driver Santosh Y
2012-03-22 13:51 ` [PATCH v3 0/5] [SCSI] ufshcd: " James Bottomley

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=4F6FF1E3.7080908@toshiba.co.jp \
    --to=yoshitake.kobayashi@toshiba.co.jp \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=arnd.bergmann@linaro.org \
    --cc=dsaxena@linaro.org \
    --cc=girish.shivananjappa@linaro.org \
    --cc=ilho215.lee@samsung.com \
    --cc=k.rajesh@samsung.com \
    --cc=linkinjeon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=nala.la@samsung.com \
    --cc=patches@linaro.org \
    --cc=santoshsy@gmail.com \
    --cc=saugata.das@linaro.org \
    --cc=sreekumar.c@samsung.com \
    --cc=stephen.doel@linaro.org \
    --cc=venkat@linaro.org \
    --cc=vinholikatti@gmail.com \
    --cc=vishak.g@samsung.com \
    --cc=yejin.moon@samsung.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

all inboxes | Powered by JetHome®