Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #ifndef __LINUX_USB_STORAGE_H
0003 #define __LINUX_USB_STORAGE_H
0004 
0005 /*
0006  * linux/usb/storage.h
0007  *
0008  * Copyright Matthew Wilcox for Intel Corp, 2010
0009  *
0010  * This file contains definitions taken from the
0011  * USB Mass Storage Class Specification Overview
0012  */
0013 
0014 /* Storage subclass codes */
0015 
0016 #define USB_SC_RBC  0x01        /* Typically, flash devices */
0017 #define USB_SC_8020 0x02        /* CD-ROM */
0018 #define USB_SC_QIC  0x03        /* QIC-157 Tapes */
0019 #define USB_SC_UFI  0x04        /* Floppy */
0020 #define USB_SC_8070 0x05        /* Removable media */
0021 #define USB_SC_SCSI 0x06        /* Transparent */
0022 #define USB_SC_LOCKABLE 0x07        /* Password-protected */
0023 
0024 #define USB_SC_ISD200   0xf0        /* ISD200 ATA */
0025 #define USB_SC_CYP_ATACB    0xf1    /* Cypress ATACB */
0026 #define USB_SC_DEVICE   0xff        /* Use device's value */
0027 
0028 /* Storage protocol codes */
0029 
0030 #define USB_PR_CBI  0x00        /* Control/Bulk/Interrupt */
0031 #define USB_PR_CB   0x01        /* Control/Bulk w/o interrupt */
0032 #define USB_PR_BULK 0x50        /* bulk only */
0033 #define USB_PR_UAS  0x62        /* USB Attached SCSI */
0034 
0035 #define USB_PR_USBAT    0x80        /* SCM-ATAPI bridge */
0036 #define USB_PR_EUSB_SDDR09  0x81    /* SCM-SCSI bridge for SDDR-09 */
0037 #define USB_PR_SDDR55   0x82        /* SDDR-55 (made up) */
0038 #define USB_PR_DPCM_USB 0xf0        /* Combination CB/SDDR09 */
0039 #define USB_PR_FREECOM  0xf1        /* Freecom */
0040 #define USB_PR_DATAFAB  0xf2        /* Datafab chipsets */
0041 #define USB_PR_JUMPSHOT 0xf3        /* Lexar Jumpshot */
0042 #define USB_PR_ALAUDA   0xf4        /* Alauda chipsets */
0043 #define USB_PR_KARMA    0xf5        /* Rio Karma */
0044 
0045 #define USB_PR_DEVICE   0xff        /* Use device's value */
0046 
0047 /*
0048  * Bulk only data structures
0049  */
0050 
0051 /* command block wrapper */
0052 struct bulk_cb_wrap {
0053     __le32  Signature;      /* contains 'USBC' */
0054     __u32   Tag;            /* unique per command id */
0055     __le32  DataTransferLength; /* size of data */
0056     __u8    Flags;          /* direction in bit 0 */
0057     __u8    Lun;            /* LUN normally 0 */
0058     __u8    Length;         /* length of the CDB */
0059     __u8    CDB[16];        /* max command */
0060 };
0061 
0062 #define US_BULK_CB_WRAP_LEN 31
0063 #define US_BULK_CB_SIGN     0x43425355  /* spells out 'USBC' */
0064 #define US_BULK_FLAG_IN     (1 << 7)
0065 #define US_BULK_FLAG_OUT    0
0066 
0067 /* command status wrapper */
0068 struct bulk_cs_wrap {
0069     __le32  Signature;  /* contains 'USBS' */
0070     __u32   Tag;        /* same as original command */
0071     __le32  Residue;    /* amount not transferred */
0072     __u8    Status;     /* see below */
0073 };
0074 
0075 #define US_BULK_CS_WRAP_LEN 13
0076 #define US_BULK_CS_SIGN     0x53425355      /* spells out 'USBS' */
0077 #define US_BULK_STAT_OK     0
0078 #define US_BULK_STAT_FAIL   1
0079 #define US_BULK_STAT_PHASE  2
0080 
0081 /* bulk-only class specific requests */
0082 #define US_BULK_RESET_REQUEST   0xff
0083 #define US_BULK_GET_MAX_LUN     0xfe
0084 
0085 #endif