1*5fd54aceSGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 2ae6d22feSMatthew Wilcox #ifndef __LINUX_USB_STORAGE_H 3ae6d22feSMatthew Wilcox #define __LINUX_USB_STORAGE_H 4ae6d22feSMatthew Wilcox 5ae6d22feSMatthew Wilcox /* 6ae6d22feSMatthew Wilcox * linux/usb/storage.h 7ae6d22feSMatthew Wilcox * 8ae6d22feSMatthew Wilcox * Copyright Matthew Wilcox for Intel Corp, 2010 9ae6d22feSMatthew Wilcox * 10ae6d22feSMatthew Wilcox * This file contains definitions taken from the 11ae6d22feSMatthew Wilcox * USB Mass Storage Class Specification Overview 12ae6d22feSMatthew Wilcox */ 13ae6d22feSMatthew Wilcox 14ae6d22feSMatthew Wilcox /* Storage subclass codes */ 15ae6d22feSMatthew Wilcox 16ae6d22feSMatthew Wilcox #define USB_SC_RBC 0x01 /* Typically, flash devices */ 17ae6d22feSMatthew Wilcox #define USB_SC_8020 0x02 /* CD-ROM */ 18ae6d22feSMatthew Wilcox #define USB_SC_QIC 0x03 /* QIC-157 Tapes */ 19ae6d22feSMatthew Wilcox #define USB_SC_UFI 0x04 /* Floppy */ 20ae6d22feSMatthew Wilcox #define USB_SC_8070 0x05 /* Removable media */ 21ae6d22feSMatthew Wilcox #define USB_SC_SCSI 0x06 /* Transparent */ 22ae6d22feSMatthew Wilcox #define USB_SC_LOCKABLE 0x07 /* Password-protected */ 23ae6d22feSMatthew Wilcox 24ae6d22feSMatthew Wilcox #define USB_SC_ISD200 0xf0 /* ISD200 ATA */ 25ae6d22feSMatthew Wilcox #define USB_SC_CYP_ATACB 0xf1 /* Cypress ATACB */ 26ae6d22feSMatthew Wilcox #define USB_SC_DEVICE 0xff /* Use device's value */ 27ae6d22feSMatthew Wilcox 28ae6d22feSMatthew Wilcox /* Storage protocol codes */ 29ae6d22feSMatthew Wilcox 30ae6d22feSMatthew Wilcox #define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */ 31ae6d22feSMatthew Wilcox #define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */ 32ae6d22feSMatthew Wilcox #define USB_PR_BULK 0x50 /* bulk only */ 33ae6d22feSMatthew Wilcox #define USB_PR_UAS 0x62 /* USB Attached SCSI */ 34ae6d22feSMatthew Wilcox 35ae6d22feSMatthew Wilcox #define USB_PR_USBAT 0x80 /* SCM-ATAPI bridge */ 36ae6d22feSMatthew Wilcox #define USB_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ 37ae6d22feSMatthew Wilcox #define USB_PR_SDDR55 0x82 /* SDDR-55 (made up) */ 38ae6d22feSMatthew Wilcox #define USB_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */ 39ae6d22feSMatthew Wilcox #define USB_PR_FREECOM 0xf1 /* Freecom */ 40ae6d22feSMatthew Wilcox #define USB_PR_DATAFAB 0xf2 /* Datafab chipsets */ 41ae6d22feSMatthew Wilcox #define USB_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */ 42ae6d22feSMatthew Wilcox #define USB_PR_ALAUDA 0xf4 /* Alauda chipsets */ 43ae6d22feSMatthew Wilcox #define USB_PR_KARMA 0xf5 /* Rio Karma */ 44ae6d22feSMatthew Wilcox 45ae6d22feSMatthew Wilcox #define USB_PR_DEVICE 0xff /* Use device's value */ 46ae6d22feSMatthew Wilcox 477ac4704cSSebastian Andrzej Siewior /* 487ac4704cSSebastian Andrzej Siewior * Bulk only data structures 497ac4704cSSebastian Andrzej Siewior */ 507ac4704cSSebastian Andrzej Siewior 517ac4704cSSebastian Andrzej Siewior /* command block wrapper */ 527ac4704cSSebastian Andrzej Siewior struct bulk_cb_wrap { 537ac4704cSSebastian Andrzej Siewior __le32 Signature; /* contains 'USBC' */ 547ac4704cSSebastian Andrzej Siewior __u32 Tag; /* unique per command id */ 557ac4704cSSebastian Andrzej Siewior __le32 DataTransferLength; /* size of data */ 567ac4704cSSebastian Andrzej Siewior __u8 Flags; /* direction in bit 0 */ 577ac4704cSSebastian Andrzej Siewior __u8 Lun; /* LUN normally 0 */ 581b83349fSAntonio Ospite __u8 Length; /* length of the CDB */ 597ac4704cSSebastian Andrzej Siewior __u8 CDB[16]; /* max command */ 607ac4704cSSebastian Andrzej Siewior }; 617ac4704cSSebastian Andrzej Siewior 627ac4704cSSebastian Andrzej Siewior #define US_BULK_CB_WRAP_LEN 31 631b83349fSAntonio Ospite #define US_BULK_CB_SIGN 0x43425355 /* spells out 'USBC' */ 64b8db6d64SSebastian Andrzej Siewior #define US_BULK_FLAG_IN (1 << 7) 657ac4704cSSebastian Andrzej Siewior #define US_BULK_FLAG_OUT 0 667ac4704cSSebastian Andrzej Siewior 677ac4704cSSebastian Andrzej Siewior /* command status wrapper */ 687ac4704cSSebastian Andrzej Siewior struct bulk_cs_wrap { 691b83349fSAntonio Ospite __le32 Signature; /* contains 'USBS' */ 707ac4704cSSebastian Andrzej Siewior __u32 Tag; /* same as original command */ 717ac4704cSSebastian Andrzej Siewior __le32 Residue; /* amount not transferred */ 727ac4704cSSebastian Andrzej Siewior __u8 Status; /* see below */ 737ac4704cSSebastian Andrzej Siewior }; 747ac4704cSSebastian Andrzej Siewior 757ac4704cSSebastian Andrzej Siewior #define US_BULK_CS_WRAP_LEN 13 767ac4704cSSebastian Andrzej Siewior #define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */ 777ac4704cSSebastian Andrzej Siewior #define US_BULK_STAT_OK 0 787ac4704cSSebastian Andrzej Siewior #define US_BULK_STAT_FAIL 1 797ac4704cSSebastian Andrzej Siewior #define US_BULK_STAT_PHASE 2 807ac4704cSSebastian Andrzej Siewior 817ac4704cSSebastian Andrzej Siewior /* bulk-only class specific requests */ 827ac4704cSSebastian Andrzej Siewior #define US_BULK_RESET_REQUEST 0xff 837ac4704cSSebastian Andrzej Siewior #define US_BULK_GET_MAX_LUN 0xfe 847ac4704cSSebastian Andrzej Siewior 85ae6d22feSMatthew Wilcox #endif 86