Search code examples
scsi

Meaning of the PMI bit in the SCSI READ CAPACITY command


I'm looking at the SBC-3 item 5.15 (READ CAPACITY (10) command). The description of the PMI bit (bit 0 of byte 8 in the CDB) is copied below:

"A PMI bit set to one specifies that the device server return information on the last logical block after that specified in the LOGICAL BLOCK ADDRESS field before a substantial vendor specific delay in data transfer may be encountered."

My questions:

  • If both PMI bit and LOGICAL BLOCK ADDRESS (bytes 2-5 in the CDB) aren't zero, should I (as a target) still report the last LBA on my disk?
  • If not the above, that what should be reported in this case?
  • What should I do with the LOGICAL BLOCK ADDRESS (bytes 2-5) value when the PMI bit is set?

(I know, that the PMI bit became obsolete in the SBC-4, but I still need to implement this functionality according to the current standard)


Solution

  • This is actually out in SBC-3 too now, as of revision 28 (January, 2011) You can see the change here: (sign up required) http://www.t10.org/cgi-bin/ac.pl?t=d&f=11-010r0.pdf . So, you're talking SBC-2 compatibility.

    Anyway, I don't think you'll ever see these fields set in practice. But, for the sake of completeness, you may wish to incorporate some additional error handling.

    1. Fail the request if PMI is zero, but the initiator specified an LBA.
    2. Fail the request if the LBA specified in the CDB is greater than the last LBA of your disk.

    Presuming your implementation always knows what the capacity of your disk is, then there should never be a "substantial vendor specific delay". You can read the standard, then, as "return information on the last logical block after that specified in the LOGICAL BLOCK ADDRESS field". This should simply be the last LBA of your disk.

    To answer your questions directly: when PMI is set, and an LBA is specified, you should report the last LBA on your disk, subject to the above error handling. And, you only need to look at the LBA field to do the error handling.