[T10] [EXT] Re: Difficulty forming an ATA PASS-THROUGH(12) for READ_SECTOR(S)

Aaron Bufkin bufkin at marvell.com
Tue Jul 2 15:39:51 PDT 2019


Thank you, James!  This solution works for me.


From: James C Hatfield [mailto:james.c.hatfield at seagate.com]
Sent: Friday, June 7, 2019 2:49 PM
To: Aaron Bufkin <bufkin at marvell.com>
Subject: Re: [EXT] Re: [T10] Difficulty forming an ATA PASS-THROUGH(12) for READ_SECTOR(S)

Aaron,

I'm sorry for the delay. I have been preparing for a big meeting for next week.

Your read and write commands are both wrong.

Error 1:
In the T_TYPE parameter in byte 2 of the CDB (for both) you have '0', and it needs to be '1'.
Why? because you want to transfer LOGICAL BLOCKS, and you can't just assume that they are 512-bytes long.
Many newer drives have 4096 byte logical blocks.

Error 2:
The Feature field for these commands is N/A, so you should probably just make them 00h.
It has no meaning for these commands.

So your correct parameters should be:

for READ SECTOR(S):  Feature=10h Count=10h LBA= 000001Fh
sg_raw -v -o output.txt -r 8192 /dev/sdb 0xa1 0x8 0x1e 0x00 0x10 0x1f 0x0 0x0 0x0 0x20 0x0 0x1

for WRITE SECTOR(S):  Feature=10h Count=10h LBA= 000001Fh
sg_raw -v -o output.txt -r 8192 /dev/sdb 0xa1 0x8 0x16 0x00 0x10 0x1f 0x0 0x0 0x0 0x20 0x0 0x1

Please try these recommendations and tell me what happens.

Thank You !!!
-----------------------------------------------------------------
Jim Hatfield
Seagate Technology LLC
   e-mail:  James.C.Hatfield at seagate.com<mailto:James.C.Hatfield at seagate.com>
   s-mail:  389 Disc Drive;  Longmont, CO 80503 USA
   voice:  720-684-2120
   fax....: 720-684-2711
   cell...: 720-771-8914


On Fri, May 31, 2019 at 1:34 PM Aaron Bufkin <bufkin at marvell.com<mailto:bufkin at marvell.com>> wrote:
Hi James,

Thank you for your help.

Interestingly, this morning I ran my program so I could show you the error messages and the bytes sent to the sg_raw command and the READ SECTOR(s) command worked!  But I do want your thoughts on why it works.

So I send the following to sg_raw:

sg_raw -v -o output.txt -r 8192 /dev/sdb 0xa1 0x8 0xe 0x10 0x10 0x1f 0x0 0x0 0x0 0x20 0x0 0x1

My intent here was to set the following fields:

Byte\Bit
7
6
5
4
3
2
1
0
0
OPERATION CODE = A1h
1
MULTIPLE_COUNT = 0
PROTOCOL = 4
Reserved=0
2
OFF_LINE = 0
CK_COND=0
Reserved=0
T_DIR=1
BYTE_BLOCK=1
T_LENGTH = 2h
3
FEATURES(7:0) = 10h
4
SECTOR_COUNT(7:0) = 10h
5
LBA_LOW(7:0) = 1Fh
6
LBA_MID(7:0) = 0
7
LBA_HIGH(7:0) = 0
8
DEVICE = 0
9
COMMAND = 20h
10
Reserved = 0
11
CONTROL = 1

I set the FEATURES field to SECTOR_COUNT in case the command behaves like FPDMA QUEUED READ where the FEATURES field contains the count.

This is my WRITE_SECTOR(s) command:

sg_raw -v -i input.txt -s 8192 /dev/sdb 0xa1 0xa 0x6 0x10 0x10 0x1f 0x0 0x0 0x0 0x30 0x0 0x0

Please let me know your thoughts.

Aaron Bufkin | Hardware Validation Engineer
Marvell Semiconductor Inc. | 1750 East Northrop Blvd, Suite 100, Chandler, AZ 85286-1705
|Phone: +1.480.612.9575 |  Mobile: +1.480.779.8389
M A R V E L L | www.marvell.com<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.marvell.com_&d=DwMGaQ&c=IGDlg0lD0b-nebmJJ0Kp8A&r=8mNfn1gTL7YQs9S_a4U_7b-WpO2_x-7ODMYXVic49hQ&m=waKlTJ51zJrnMmW4X4m2-tEdpFUN6WQ_2iwUk-ZiOPI&s=YXxUU2104S8Q5zIZqlTM2B_NFYmRQV7RZBOqlc1WJjM&e=> | bufkin at marvell.com<mailto:pmohanra at marvell.com>
NOTICE: This e-mail message, including any attachments and appended messages, is for the sole use of the intended recipients and may contain confidential information. If you are not the intended recipient, any review, dissemination, distribution, copying, storage or other use of all or any portion of this message is strictly prohibited. If you received this message in error, please immediately notify the sender by reply e-mail and delete this message in its entirety.


From: James C Hatfield [mailto:james.c.hatfield at seagate.com<mailto:james.c.hatfield at seagate.com>]
Sent: Friday, May 31, 2019 9:15 AM
To: Aaron Bufkin <bufkin at marvell.com<mailto:bufkin at marvell.com>>
Cc: t10 at t10.org<mailto:t10 at t10.org>
Subject: [EXT] Re: [T10] Difficulty forming an ATA PASS-THROUGH(12) for READ_SECTOR(S)

External Email
________________________________
Aaron,

I think I can assist.

Please send me a copy of all parameters you are using for the  ATA PASS-THROUGH(12)  command and for the READ SECTOR(s) command you are attempting to transport.

Thank You !!!
-----------------------------------------------------------------
Jim Hatfield
Seagate Technology LLC
   e-mail:  James.C.Hatfield at seagate.com<mailto:James.C.Hatfield at seagate.com>
   s-mail:  389 Disc Drive;  Longmont, CO 80503 USA
   voice:  720-684-2120
   fax....: 720-684-2711
   cell...: 720-771-8914


On Thu, May 30, 2019 at 2:09 PM Aaron Bufkin <bufkin at marvell.com<mailto:bufkin at marvell.com>> wrote:
Hi,

I am trying to create a proper ATA PASS-THROUGH(12) packet with a SATA READ_SECTOR(S) command.  I am using the sg_raw tool.  I am able to create a WRITE_SECTOR(S) command and read back the data with a READ_DMA command.  My READ_SECTOR(S) packet is identical to the WRITE_SECTOR(S) packet with the exceptions of the T_DIR bit, COMMAND field (20h for the read, 30h for the write), and the PROTOCOL (PIO Data-In vs PIO Data-Out).  Does this sound like the correct approach?

Regards,
Aaron

_______________________________________________
T10 mailing list
T10 at t10.org<mailto:T10 at t10.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.t10.org_mailman_listinfo_t10&d=DwICAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=8mNfn1gTL7YQs9S_a4U_7b-WpO2_x-7ODMYXVic49hQ&m=gHWme8OOgpnl3Kl9VZZhDv8X3Y-mq7GXFRL5xJduSfA&s=vlabGkAi2VC7CPuGbiktJl5RZmVlvlvdkKBZlTsIGnI&e=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.t10.org/pipermail/t10/attachments/20190702/fc964732/attachment.html>


More information about the T10 mailing list