I don't have all relevant SCSI Specs in front of me. Therefore, I'm assuming you're building the SATL (SCSI ATA Translation Layer) CDB correctly. The first thing to check for is whether the ioctl completed. That is, check the return code of DeviceIoControl()
for True
or False
and then check GetLastError()
to determine what went wrong (if applicable). If the ioctl was fine, check the SCSI_PASS_THROUGH_DIRECT structure member .ScsiStatus
. If this is 0, then the command completed just fine. If the status was 0, this may well be the reason for no valid sense info.
I was actually researching this very command when I stumbled onto this thread. The most recent ATA Command Spec, ACS-3 (dated October 28, 2013) shows that the Read Native Max Address and Read Native Max Address Ext commands are now obsolete. I found their definition in ACS-2. The most recent draft, dated August 3, 2009, shows that the output of this command won't be a buffer. Rather, the output will be in the LBA field of the returned Device-To-Host FIS.
Addendum
The verbiage of the original post lead me to believe this was being done in Windows. I should have included that the process will be the same for Linux, if that is what you're using. However, don't use GetLastError()
to determine what went wrong. In Linux, the return code from ioctl()
will be the code you need.
If in Linux, you're most likely using the sg driver and the sg_io_hdr_t structure. This structure also has a .status
member which contains the SCSI Status code. Whether in Linux or Windows, you should always check this code because assuming the command succeeded because the ioctl did is a fallacy. There are other pass through drivers available in Linux, e.g. the LSI MPT interface. The process is still the same if this is what you're using.