What is in this article?:
Additional Details of UAS and UASP
As noted earlier, the impetus for UAS and UASP originates in the SCSI Standards (Small Computer System Interface), specifically the "SAM-4" standard. ("SAM" stands for SCSI Architecture Model). The UAS standard defines how SAM-4 can be implemented on a USB link, either USB 2.0 High Speed or USB 3.0 Super Speed. UASP defines additional details of the USB implementation of UAS.
UAS defines the abstract concept of an "I_T Nexus," where "I" means UAS Initiator and "T" means UAS Target. For transferring requests, data, and status between the Initiator and the Target, the "Nexus" includes the "Default" USB pipe (utilizing USB Control Transfers) and four "Bulk" USB pipes:
- A Bulk Out pipe for UAS Commands from the Initiator to the Target
- A Bulk In pipe for UAS Status responses (command completions) from Target to Initiator
- A Bulk Out pipe for UAS write data (from Initiator to Target)
- A Bulk In pipe for UAS read data (from Target to Initiator)
UAS Commands, Data and Status are transported using Information Units ("IU") of various types specified in the UAS standard. Every IU includes a 4-byte header that specifies the type of IU, a "reserved" byte, and the two-byte Tag that correlates IU's to the originating Command.
"Pipe" is entirely an abstraction. On the actual USB link, the fields in the various types of USB packets specify the Device Address, the Endpoint number, and the Endpoint Direction bit, which together represent a "pipe." IU transfer in a pipe is performed by USB packet sequences such as IN-DATA-ACK and OUT-DATA-ACK for USB 2.0. In USB 3.0, ERDY, NRDY, and INACK packets replace the separate ACK or NAK used in USB 2.0.
At the UAS level, a complete data transfer consists of the following sequence:
- Command IU from initiator to target
- Read (or Write) Ready IU from target to initiator
- One or more data transfers (read or write)
- Status (Sense IU) from target to initiator
All of these IU's and data blocks are transported within USB Bulk In or Bulk Out packet sequences on the actual USB link. Also, on a USB 3.0 link the Read (or Write) Ready IU is replaced by ERDY for greater bus utilization efficiency compared to USB 2.0. Multiple transfers in the same pipe (same initiator and target) can be intermixed together, as described in the UAS specification. The correlation of each IU to the originating Command IU is defined by each IU's Tag field (for USB 2.0), or the Stream ID (for USB 3.0).
In effect, there is an overall hierarchy associated with UAS and UASP, consisting of SCSI and SAM-4 at the top level, then the T10 UAS standard, supported by the USB UASP standard and driver, which interfaces with a USB Host Controller driver (EHCI for USB 2.0 High Speed, xHCI for USB 3.0 Super Speed), and finally the hardware, i.e., the actual USB Host Controller and the USB mass storage device. In the hardware, there can also be up to five levels of USB hubs between the Host Controller and the mass storage device.
Referring again to Figure 3, the actual details of the various transfers summarized by the arrows involve UAS requests for status as well as UAS commands, which the target mass storage device fulfills after the requested data transfer has been completed. There will also be many ACK or ERDY packets in the communication, not explicitly shown in the figure. The blocks labeled "Cmd" actually denote an OUT-DATA-ACK packet sequence, with the UAS Command IU itself contained in the DATA packet. Similarly, the blocks labeled "Sta" (Status) actually denote an IN-DATA-ACK packet sequence with the UAS Status IU contained in the DATA packet. The UAS and UASP standards provide detailed protocol exchange diagrams showing all the various transfers at both the hardware and UAS/UASP software levels.
At the highest hierarchical level, all of the complexity is well hidden from the typical end user, and everything "just works" (if all the standards are properly followed).