linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB
@ 2010-03-12 11:46 amruth pattanada
  2010-03-12 13:21 ` Jeff Garzik
  2010-03-12 22:06 ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: amruth pattanada @ 2010-03-12 11:46 UTC (permalink / raw)
  To: linux-ide; +Cc: Tejun Heo, Jeff Garzik

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB
  2010-03-12 11:46 CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB amruth pattanada
@ 2010-03-12 13:21 ` Jeff Garzik
  2010-03-12 22:06 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2010-03-12 13:21 UTC (permalink / raw)
  To: amruth pattanada; +Cc: linux-ide, Tejun Heo

On 03/12/2010 06:46 AM, amruth pattanada wrote:
> 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.

Use the source, Luke.

All the answers you seek, drivers/ata/libata-scsi.c has, Yoda says.

	Jeff




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB
  2010-03-12 11:46 CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB amruth pattanada
  2010-03-12 13:21 ` Jeff Garzik
@ 2010-03-12 22:06 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2010-03-12 22:06 UTC (permalink / raw)
  To: amruth pattanada; +Cc: linux-ide, Jeff Garzik

On 03/12/2010 08:46 PM, amruth pattanada wrote:
> 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.

They are all LBAs.  You can find relevant documentation at
www.t10.org.  RW commands are defined in SBC.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-12 22:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 11:46 CHS to LBA mapping for SCSI 6/10/12/16 byte RW CDB amruth pattanada
2010-03-12 13:21 ` Jeff Garzik
2010-03-12 22:06 ` Tejun Heo

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).