(See update at end of post)
Just out of curiosity, have you got your driver to the point where you can read sectors from the disk?
I have a working driver and can read up to 16 sectors just fine. However, when I try to read more than 16 sectors at a time, it fails.
It fails with the error: (Specs: v1.2, page 65, Figure 30)
Quote:
02: Invalid Field in Command: An invalid or unsupported field specified in the command parameters.
Therefore I thought it might be the maximum allowed transfer size per transfer. (Specs: v1.2, page 100, Figure 90, Byte 77)
Quote:
If a command is submitted that exceeds the transfer size, then the command is aborted with a status of Invalid Field in Command.
However, the value at Byte 77 returns 0. (Specs: v1.2, page 100, Figure 90, Byte 77)
Quote:
A value of 0h indicates no restrictions on transfer size.
I am using a Scatter/Gather list (not PRPs) with a single Data Block Segment Entry since the buffer used is physically continuous.
Here are my concerns.
1) Sixteen 512-byte sectors is 8192 bytes, exactly two (2) pages of data. Doesn't mean anything at the moment, that I can tell.
2) Does QEMU's emulation actually have a transfer limit, they just forgot to update Byte 77 in the Indentify block?
The check is at:
https://github.com/qemu/qemu/blob/maste ... vme.c#L575I believe that the mdts member is 7 (
https://github.com/qemu/qemu/blob/maste ... me.c#L2453) which using the test at Line 575 is well above the 8192+ bytes I am trying to transfer.
Line 18 shows that I can add a parameter to set this value, though my version of QEMU barks at the parameter stating it is not a member of nvme.
(A note if you haven't thought of it already. The value at Byte 77 is:
Quote:
The value is in units of the minimum memory page size (CAP.MPSMIN) and is reported as a power of two (2^n).
Therefore, the limit is calculated with the minimum page size, NOT the current page size. Therefore, if you use a page size other than the Minimum, remember that this limit is calculated on the Minimum page size, not the current used page size you specify in CC.MPS)
I don't find where QEMU actually sets Byte 77 of the (Controller) Identify block, but I am reading a value of zero from that byte where as I believe
Line 2453 is setting it to 7 (4096 << 7 = 524,288).
Just wondering if anyone has any thoughts about this. I am sure I am missing something simple. Just can't pin-point it at the moment.
Ben
P.S. I guess one thing I need to mention and it has a bit to do with it (though I didn't think of it until just now), I am using the Windows version of QEMU which has a
different source listing still reporting version 1.2. I will have to study this code instead.
Update: (At a glance) it looks like version 1.2 (of the QEMU code) doesn't support Scatter Gather, so it was taking my SGL address as the PRP1 address and PRP2 as the length of the data as an actual address. Since PRP1 points to the first page, and PRP2 points to the second page, this is the 8192 bytes it will transfer. Again, (at a glance) it looks like version 1.2 doesn't support Scatter Gather.
.
.
.
Proof:
Patch for version 1.3 states
Quote:
- adds support for scatter gather lists (SGLs)