storage.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Copyright (c) 2019-2025 Allwinner Technology Co., Ltd. ALL rights reserved.
  2. * Allwinner is a trademark of Allwinner Technology Co.,Ltd., registered in
  3. * the the People's Republic of China and other countries.
  4. * All Allwinner Technology Co.,Ltd. trademarks are used with permission.
  5. * DISCLAIMER
  6. * THIRD PARTY LICENCES MAY BE REQUIRED TO IMPLEMENT THE SOLUTION/PRODUCT.
  7. * IF YOU NEED TO INTEGRATE THIRD PART'S TECHNOLOGY (SONY, DTS, DOLBY, AVS OR MPEGLA, ETC.)
  8. * IN ALLWINNER'SDK OR PRODUCTS, YOU SHALL BE SOLELY RESPONSIBLE TO OBTAIN
  9. * ALL APPROPRIATELY REQUIRED THIRD PARTY LICENCES.
  10. * ALLWINNER SHALL HAVE NO WARRANTY, INDEMNITY OR OTHER OBLIGATIONS WITH RESPECT TO MATTERS
  11. * COVERED UNDER ANY REQUIRED THIRD PARTY LICENSE.
  12. * YOU ARE SOLELY RESPONSIBLE FOR YOUR USAGE OF THIRD PART'S TECHNOLOGY.
  13. * THIS SOFTWARE IS PROVIDED BY ALLWINNER"AS IS" AND TO THE MAXIMUM EXTENT
  14. * PERMITTED BY LAW, ALLWINNER EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND,
  15. * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION REGARDING
  16. * THE TITLE, NON-INFRINGEMENT, ACCURACY, CONDITION, COMPLETENESS, PERFORMANCE
  17. * OR MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18. * IN NO EVENT SHALL ALLWINNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. * LOSS OF USE, DATA, OR PROFITS, OR BUSINESS INTERRUPTION)
  22. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  23. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  25. * OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef __USB_STORAGE_H__
  28. #define __USB_STORAGE_H__
  29. /*
  30. * linux/usb/storage.h
  31. *
  32. * Copyright Matthew Wilcox for Intel Corp, 2010
  33. *
  34. * This file contains definitions taken from the
  35. * USB Mass Storage Class Specification Overview
  36. *
  37. * Distributed under the terms of the GNU GPL, version two.
  38. */
  39. /* Storage subclass codes */
  40. #define USB_SC_RBC 0x01 /* Typically, flash devices */
  41. #define USB_SC_8020 0x02 /* CD-ROM */
  42. #define USB_SC_QIC 0x03 /* QIC-157 Tapes */
  43. #define USB_SC_UFI 0x04 /* Floppy */
  44. #define USB_SC_8070 0x05 /* Removable media */
  45. #define USB_SC_SCSI 0x06 /* Transparent */
  46. #define USB_SC_LOCKABLE 0x07 /* Password-protected */
  47. #define USB_SC_ISD200 0xf0 /* ISD200 ATA */
  48. #define USB_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
  49. #define USB_SC_DEVICE 0xff /* Use device's value */
  50. /* Storage protocol codes */
  51. #define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */
  52. #define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */
  53. #define USB_PR_BULK 0x50 /* bulk only */
  54. #define USB_PR_UAS 0x62 /* USB Attached SCSI */
  55. #define USB_PR_USBAT 0x80 /* SCM-ATAPI bridge */
  56. #define USB_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
  57. #define USB_PR_SDDR55 0x82 /* SDDR-55 (made up) */
  58. #define USB_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
  59. #define USB_PR_FREECOM 0xf1 /* Freecom */
  60. #define USB_PR_DATAFAB 0xf2 /* Datafab chipsets */
  61. #define USB_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
  62. #define USB_PR_ALAUDA 0xf4 /* Alauda chipsets */
  63. #define USB_PR_KARMA 0xf5 /* Rio Karma */
  64. #define USB_PR_DEVICE 0xff /* Use device's value */
  65. /*
  66. * Bulk only data structures
  67. */
  68. /* command block wrapper */
  69. struct bulk_cb_wrap {
  70. uint32_t Signature; /* contains 'USBC' */
  71. uint32_t Tag; /* unique per command id */
  72. uint32_t DataTransferLength; /* size of data */
  73. uint8_t Flags; /* direction in bit 0 */
  74. uint8_t Lun; /* LUN normally 0 */
  75. uint8_t Length; /* length of the CDB */
  76. uint8_t CDB[16]; /* max command */
  77. };
  78. #define US_BULK_CB_WRAP_LEN 31
  79. #define US_BULK_CB_SIGN 0x43425355 /* spells out 'USBC' */
  80. #define US_BULK_FLAG_IN (1 << 7)
  81. #define US_BULK_FLAG_OUT 0
  82. /* command status wrapper */
  83. struct bulk_cs_wrap {
  84. uint32_t Signature; /* contains 'USBS' */
  85. uint32_t Tag; /* same as original command */
  86. uint32_t Residue; /* amount not transferred */
  87. uint8_t Status; /* see below */
  88. };
  89. #define US_BULK_CS_WRAP_LEN 13
  90. #define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
  91. #define US_BULK_STAT_OK 0
  92. #define US_BULK_STAT_FAIL 1
  93. #define US_BULK_STAT_PHASE 2
  94. /* bulk-only class specific requests */
  95. #define US_BULK_RESET_REQUEST 0xff
  96. #define US_BULK_GET_MAX_LUN 0xfe
  97. #endif /* __USB_STORAGE_H__ */