All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akshat Jain <akshatzen@google.com>
To: Tejun Heo <tj@kernel.org>
Cc: Vishakha Channapattan <vishakhavc@google.com>,
	linux-ide@vger.kernel.org, John Grass <jgrass@google.com>,
	Thieu Le <thieule@google.com>
Subject: Question on ata_gen_passthru_sense interpretation of fixed format sense buffer
Date: Mon, 3 Aug 2020 09:44:26 -0700	[thread overview]
Message-ID: <CACqKpR-5=bDwODQFfMY+o8-XJMCQmtLVAOiCEY8ApFwQr04A8A@mail.gmail.com> (raw)

Hello Jens Tejun,
I have a question regarding the ata_gen_passthru_sense function (libata-scsi.c).

This function while generating fixed format sense blocks, puts the
INFORMATION field at offset 8 and COMMAND-SPECIFIC-INFORMATION at
offset 16.
While as per SCSI Primary commands - 4 specification, section 4.5.3
Fixed format sense data Table 53, the INFORMATION field is at offset 3
and COMMAND-SPECIFIC-INFORMATION is at offset 8.

Code snippet:

static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->result_tf;
unsigned char *sb = cmd->sense_buffer;
unsigned char *desc = sb + 8;
….
    if ((cmd->sense_buffer[0] & 0x7f) >= 0x72) {
    ....
    } else {
        /* Fixed sense format */
       desc[0] = tf->feature;
       desc[1] = tf->command; /* status */
       desc[2] = tf->device;
       desc[3] = tf->nsect;
       desc[7] = 0;
       if (tf->flags & ATA_TFLAG_LBA48)  {
           desc[8] |= 0x80;
           if (tf->hob_nsect)
               desc[8] |= 0x40;
           if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah)
               desc[8] |= 0x20;
       }
       desc[9] = tf->lbal;
       desc[10] = tf->lbam;
       desc[11] = tf->lbah;
    }
}

Link to spec: https://www.t10.org/cgi-bin/ac.pl?t=f&f=spc4r37a.pdf

My team has confirmed this observation. Do you believe our
interpretation of the specification is correct and if yes does this
need to be corrected?

Regards,
Akshat Jain

             reply	other threads:[~2020-08-03 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 16:44 Akshat Jain [this message]
2020-08-17 17:18 ` Question on ata_gen_passthru_sense interpretation of fixed format sense buffer Akshat Jain
2020-08-17 17:42 ` Tejun Heo
2020-08-19  4:12   ` Akshat Jain
2020-09-04 17:07     ` Tejun Heo

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='CACqKpR-5=bDwODQFfMY+o8-XJMCQmtLVAOiCEY8ApFwQr04A8A@mail.gmail.com' \
    --to=akshatzen@google.com \
    --cc=jgrass@google.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=thieule@google.com \
    --cc=tj@kernel.org \
    --cc=vishakhavc@google.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.