linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: amruth pattanada <amruth.vamadev@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Jeff Garzik <jeff@garzik.org>
Subject: CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB
Date: Fri, 12 Mar 2010 17:16:17 +0530	[thread overview]
Message-ID: <9edb119c1003120346r34c1c145t2be07595f9b151c6@mail.gmail.com> (raw)

Hi
All
I require clarification regarding how bytes are stored in scsi_rw
Command Descriptor Block for READ_6/WRITE_6 commands. In the
structures below addr is either defined as 3 bytes or 4 bytes or 8
bytes.How does it correspond to CHS in ATA. I assume addr[0]=Cylinder,
addr[1]=head and addr[2]=sectors.Is my assumption correct. How does it
map if it is 4/8 bytes addr.Is 3 bytes addr corresponds to 24 bit LBA,
then how do we map 48 bit LBA. All scsi CDB structures are below.Any
inputs will be highly appreciated.

//6 byte CDB
struct scsi_rw_6
{
        u_int8_t opcode;
        u_int8_t addr[3];
/* only 5 bits are valid in the MSB address byte */
#define SRW_TOPADDR     0x1F
        u_int8_t length;
        u_int8_t control;
};
//10 bytes CDB
struct scsi_rw_10
{
        u_int8_t opcode;
#define SRW10_RELADDR   0x01
/* EBP defined for WRITE(10) only */
#define SRW10_EBP       0x04
#define SRW10_FUA       0x08
#define SRW10_DPO       0x10
        u_int8_t byte2;
        u_int8_t addr[4];
        u_int8_t reserved;
        u_int8_t length[2];
        u_int8_t control;
};
//12 bytes CDB
struct scsi_rw_12
{
        u_int8_t opcode;
#define SRW12_RELADDR   0x01
#define SRW12_FUA       0x08
#define SRW12_DPO       0x10
        u_int8_t byte2;
        u_int8_t addr[4];
        u_int8_t length[4];
        u_int8_t reserved;
        u_int8_t control;
};

//16 bytes CDB
struct scsi_rw_16
{
        u_int8_t opcode;
#define        SRW16_RELADDR   0x01
#define        SRW16_FUA       0x08
#define        SRW16_DPO       0x10
        u_int8_t byte2;
        u_int8_t addr[8];
        u_int8_t length[4];
        u_int8_t reserved;
        u_int8_t control;
};

Thanks
Amruth p.v

             reply	other threads:[~2010-03-12 11:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 11:46 amruth pattanada [this message]
2010-03-12 13:21 ` CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB Jeff Garzik
2010-03-12 22:06 ` 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=9edb119c1003120346r34c1c145t2be07595f9b151c6@mail.gmail.com \
    --to=amruth.vamadev@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@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).