USB Mass Storage and Compliance

This post has been republished via RSS; it originally appeared at: Microsoft USB Blog articles.

First published on MSDN on Jul 21, 2011

Hi, I’m Ram Valliyappan and I am a Program Manager on the Windows team responsible for USB mass storage drivers. We often get asked the following questions:


· What is USB-IF compliance for USB mass storage devices?


· What is SCSI compliance for USB mass storage devices?


· Why is compliance for USB mass storage devices important?


I will answer these questions in this post.



What is USB-IF compliance for USB mass storage devices?


It is very important for USB devices to be compliant with the USB specification. This allows the device to interoperate on a Windows platform and deliver the best user experience.


The USB-IF compliance is certification program that is defined by the USB standards body. This program verifies that a device complies with the interfaces that are defined by the USB specification. If a USB device passes the compliance tests, the device is added to the Integrators List that is published by the USB standards body. Also, the independent hardware vendor (IHV) can license the USB-IF Logo for devices that are compliant with the USB-IF compliance program.


For more information, please refer to the USB-IF Compliance program .



What is SCSI compliance for USB mass storage devices?


SCSI compliance is verified through a set of Windows Logo Kit (WLK) tests. These tests verify that a block storage device is compliant with SCSI standards and specifications, such as the SCSI Primary Commands (SPC) and SCSI Block Commands (SBC). For more information about the SCI compliance tests, please refer to the MSDN documentation on SCSI Compliance .


The Windows storage driver stack is developed by using industry standards and expects device to be compliant to same standards. With each new Windows release, the driver stack has expanded its dependency on SCSI commands. Because of this, it is extremely important that the storage device provides the SCSI functionality that the driver stack requires. As a result, the WLK SCSI compliance tests are revised with each new Windows release to verify this requirement with storage devices.


To guarantee that USB devices can interoperate with the Windows storage driver stack and deliver the best user experience, we introduced the SCSI compliance tests for USB in the WLK 1.6. For more information about these tests, please refer to the MSDN documentation on the USB 2.0 and 3.0 SCSI Compliance test . For more information about the WLK and how to download WLK 1.6, please refer to the Windows Logo Kit .


The following provides an overview of the SCSI commands that are verified through the Windows SCSI compliance WLK tests:




SCSI command



Industry specification requirement



WLK requirement



Logo test policy (USB Disks)



Logo test policy (USB Card Readers)



Reference



Inquiry



Mandatory



Mandatory



Required



Required



Required by industry standards



Maintenance IN



Optional



Optional



Optional



Optional



Windows recommended



Mode Select 6



Optional



Mandatory



Required



Required



Windows required



Mode Select 10



Optional



Optional



Optional



Not Required



Windows recommended



Mode Sense 6



Optional



Mandatory



Required



Required



Windows required



Mode Sense 10



Optional



Optional



Optional



Not Required



Windows recommended



Receive Diagnostic Results - ENCSERV = 1



Mandatory



Mandatory



Required


Required

Required by industry standards



Receive Diagnostic Results - ENCSERV = 0



Optional



Optional



Optional



Optional



Windows recommended



Report LUNS - UAS



Mandatory



Mandatory



Required


Required

Required by industry standards



Report LUNS - BOT



Mandatory



Optional



Optional



Optional



Windows recommended



Request Sense



Mandatory



Mandatory



Required



Required



Required by industry standards



Security Protocol IN



Optional



Mandatory



Required



Optional



Windows required



Security Protocol OUT



Optional



Mandatory



Required



Optional



Windows required



Send Diagnostic



Mandatory



Mandatory



Required



Not Required



Required by industry standards



Test Unit Ready



Mandatory



Mandatory



Required



Required



Required by industry standards



Format Unit



Mandatory



Mandatory



Required



Required



Required by industry standards



Prevent Allow Medium Removal



Optional



Mandatory



Required



Required



Windows required



Read 6



Mandatory



Optional



Optional



Optional



Windows Recommended



Read 10



Mandatory



Mandatory



Required



Required



Required by industry standards



Read 16



Optional



Optional



Optional



Optional



Windows recommended



Read Capacity 10



Mandatory



Mandatory



Required



Required



Required by industry standards



Read Capacity 16



Optional



Mandatory



Optional



Required



Windows required



Start Stop Unit



Optional



Mandatory



Required



Required



Windows required



Synchronize cache



Optional



Mandatory



Required



Not Required



Windows required



Write 6



Optional



Optional



Optional



Optional



Windows recommended



Write 10



Optional



Mandatory



Required



Required



Windows required



Write 16



Optional



Optional



Optional



Optional



Windows recommended




If you are qualifying a USB Card Reader device, then please read the following to make sure you support the commands as required for Windows:



SCSI Commands



Test Details



Brief Description



Inquiry


(REQUIRED)



Basic verification test



Expect GOOD status and data of size
smaller than or equal to 255 bytes





Extended verification test



When allocation length is set to more
than 255 bytes, device must not return CHECK condition





PageCodeEVPD test



PC=non-zero; EVPD=0; expect CHECK
CONDITION





RetrieveData Test



Checking if we can retrieve standard
inquiry data





CheckDataSize Test



Standard INQUIRY data shall contain at
least 36 bytes





DevType Test



Expect direct access device





PeripheralQualifier Test



Peripheral qualifier field == 0.





Version Test



USB3: SPC4; USB2: Don’t care





RespDataFormat Test



RESPONSE DATA FORMAT == 2





AdditionalLength Test



Additional Length field == Total Data
size - 5





VendorID Test



VENDOR IDENTIFICATION field contains
valid ASCII





ProductID Test



PRODUCT IDENTIFICATION field contains
valid ASCII





ProductRevLevel Test



PRODUCT REVISION LEVEL field contains
valid ASCII





VerDescr Test



USB2BOT: no version desc


USB2UAS: UAS version desc


USB3BOT: SPC, SBC version desc


USB3UAS: SPC, SBC, UAS version desc





CMDQUE Test



UAS: CMDQUE=1, BOT: CMDQUE=0





RMB Test



RMB=1



Security protocol IN/OUT


(IF-IMPLEMENTED)



Security Protocol Out Basic Test



Expect GOOD/CHECK_CONDITION





Security Protocol IN Basic Test



Expect GOOD/CHECK_CONDITION



Report supported OP codes


(IF-IMPLEMENTED)



ClearRTCD Test



Expect GOOD/CHECK_CONDITION





SetRTCD Test



Expect GOOD/CHECK_CONDITION



Read Capacity 10


(REQUIRED)



Basic Verification Test



The device must return GOOD (0x0) SCSI
status and 8 bytes of parameter data describing the capacity and medium
format of the block device to the data-in buffer.



Request Sense


(REQUIRED)



Support Test



Expect GOOD status.





Response code test



Expect valid response code





Sense data length test



Additional Sense Length <= Sense
data size - 8



Test Unit Ready


(REQUIRED)



Basic verification test



Expect GOOD status



Start Stop Unit


(REQUIRED)



Spin down IMMED=0 test



Spin down drive





Spin up IMMED=0 test



Spin up drive





Spin down IMMED=1 (optional)



Spin down drive





Spin up IMMED=1 (optional)



Spin up drive





Unload test (optional)



Unload medium



Read 6


(IF-IMPLEMENTED)



Basic verification test



Expect GOOD status





Sequential test



The device must read 1000 sequential
blocks of data correctly





Random test



The device must read 1000 random blocks
of data correctly





Disk cached cleared test



Read 12 MB data, read 12 MB random data
and read 12 MB initial data again



Read 10


(REQUIRED)



Basic verification test



Expect GOOD status





Read sequential test



The device must read 1000 sequential
blocks of data correctly





Read random test



The device must read 1000 random blocks
of data correctly





Disk cached cleared test



Read 12 MB data, read 12 MB random data
and read 12 MB initial data again



Write 6


(IF-IMPLEMENTED)



Basic verification test



Expect GOOD status





Sequential test



The command writes 1000 sequential
blocks of data correctly





Random test



The command writes 1000 random blocks
of data correctly



Write 10


(REQUIRED)



Basic verification test



Expect GOOD status





Sequential test



The command writes 1000 sequential
blocks of data correctly





Random test



The command writes 1000 random blocks
of data correctly



Mode Sense 6


(REQUIRED)



Basic verification test



Expect CHECK CONDITION





Check size test



Data Transfer Length >= 4 bytes





Check mode parameter header test



ModeDataLength = Data Transfer Length -
1





DBD test



Testing to make sure that, when DBD bit
is set, no block descriptors are returned





Check data length test



Testing that new data length should
equal old data length minus block descriptor length





Compare data test



Testing that page data is the same
before and after DBD bit is set



Report LUNS


(MANDATORY for UAS, IF-IMPLEMENTED for
BOT)



Basic verification test



Expect GOOD Status





LUNO test (only UAS)



The device must return GOOD (0x0) SCSI
status and data of size smaller than or equal to 255 bytes





Data valid test (only UAS)



Each reported LUN uses single level
numbers restricted to <= 255



Read Capacity 16


(Required for USB3)



Invalid service action test



Send RC16 with Invalid SA, get
CHECK_CONDITION





Basic verification test



Send RC16 and get GOOD Status





Capacity test



Send a READ CAPACITY command to check
the reported block address. If the block address is greater than the READ
CAPACITY 10 limit, ensure READ CAPACITY 10 block address is set to
0xFFFF_FFFF.





Lowest Aligned LBA test



Verify if the lowest aligned LBA is not
greater than number of logical blocks per physical block






Why is compliance for USB mass storage devices important?


With millions of USB mass storage devices in the market, it is extremely important that these devices comply with a common set of standards. Compliant USB mass storage devices deliver the best user experience when they are connected across different Windows platforms.


To verify compliance, we require USB mass storage devices to pass the USB-IF compliance and WLK programs. This guarantees that Windows users get the maximum value out with their USB mass storage devices.


Thanks for reading! In our next blog, we will talk about common device failures, how to avoid them and make device interoperate with Windows well.


Ram Valliyappan (USB Mass Storage)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.