usb_usual.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Interface to the libusual.
  4. *
  5. * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com>
  6. * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
  7. * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com)
  8. */
  9. #ifndef __LINUX_USB_USUAL_H
  10. #define __LINUX_USB_USUAL_H
  11. /* We should do this for cleanliness... But other usb_foo.h do not do this. */
  12. /* #include <linux/usb.h> */
  13. /*
  14. * The flags field, which we store in usb_device_id.driver_info.
  15. * It is compatible with the old usb-storage flags in lower 24 bits.
  16. */
  17. /*
  18. * Static flag definitions. We use this roundabout technique so that the
  19. * proc_info() routine can automatically display a message for each flag.
  20. */
  21. #define US_DO_ALL_FLAGS \
  22. US_FLAG(SINGLE_LUN, 0x00000001) \
  23. /* allow access to only LUN 0 */ \
  24. US_FLAG(NEED_OVERRIDE, 0x00000002) \
  25. /* unusual_devs entry is necessary */ \
  26. US_FLAG(SCM_MULT_TARG, 0x00000004) \
  27. /* supports multiple targets */ \
  28. US_FLAG(FIX_INQUIRY, 0x00000008) \
  29. /* INQUIRY response needs faking */ \
  30. US_FLAG(FIX_CAPACITY, 0x00000010) \
  31. /* READ CAPACITY response too big */ \
  32. US_FLAG(IGNORE_RESIDUE, 0x00000020) \
  33. /* reported residue is wrong */ \
  34. US_FLAG(BULK32, 0x00000040) \
  35. /* Uses 32-byte CBW length */ \
  36. US_FLAG(NOT_LOCKABLE, 0x00000080) \
  37. /* PREVENT/ALLOW not supported */ \
  38. US_FLAG(GO_SLOW, 0x00000100) \
  39. /* Need delay after Command phase */ \
  40. US_FLAG(NO_WP_DETECT, 0x00000200) \
  41. /* Don't check for write-protect */ \
  42. US_FLAG(MAX_SECTORS_64, 0x00000400) \
  43. /* Sets max_sectors to 64 */ \
  44. US_FLAG(IGNORE_DEVICE, 0x00000800) \
  45. /* Don't claim device */ \
  46. US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
  47. /* sometimes sizes is too big */ \
  48. US_FLAG(MAX_SECTORS_MIN,0x00002000) \
  49. /* Sets max_sectors to arch min */ \
  50. US_FLAG(BULK_IGNORE_TAG,0x00004000) \
  51. /* Ignore tag mismatch in bulk operations */ \
  52. US_FLAG(SANE_SENSE, 0x00008000) \
  53. /* Sane Sense (> 18 bytes) */ \
  54. US_FLAG(CAPACITY_OK, 0x00010000) \
  55. /* READ CAPACITY response is correct */ \
  56. US_FLAG(BAD_SENSE, 0x00020000) \
  57. /* Bad Sense (never more than 18 bytes) */ \
  58. US_FLAG(NO_READ_DISC_INFO, 0x00040000) \
  59. /* cannot handle READ_DISC_INFO */ \
  60. US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
  61. /* cannot handle READ_CAPACITY_16 */ \
  62. US_FLAG(INITIAL_READ10, 0x00100000) \
  63. /* Initial READ(10) (and others) must be retried */ \
  64. US_FLAG(WRITE_CACHE, 0x00200000) \
  65. /* Write Cache status is not available */ \
  66. US_FLAG(NEEDS_CAP16, 0x00400000) \
  67. /* cannot handle READ_CAPACITY_10 */ \
  68. US_FLAG(IGNORE_UAS, 0x00800000) \
  69. /* Device advertises UAS but it is broken */ \
  70. US_FLAG(BROKEN_FUA, 0x01000000) \
  71. /* Cannot handle FUA in WRITE or READ CDBs */ \
  72. US_FLAG(NO_ATA_1X, 0x02000000) \
  73. /* Cannot handle ATA_12 or ATA_16 CDBs */ \
  74. US_FLAG(NO_REPORT_OPCODES, 0x04000000) \
  75. /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \
  76. US_FLAG(MAX_SECTORS_240, 0x08000000) \
  77. /* Sets max_sectors to 240 */ \
  78. US_FLAG(NO_REPORT_LUNS, 0x10000000) \
  79. /* Cannot handle REPORT_LUNS */ \
  80. US_FLAG(ALWAYS_SYNC, 0x20000000) \
  81. /* lies about caching, so always sync */ \
  82. US_FLAG(NO_SAME, 0x40000000) \
  83. /* Cannot handle WRITE_SAME */ \
  84. US_FLAG(SENSE_AFTER_SYNC, 0x80000000) \
  85. /* Do REQUEST_SENSE after SYNCHRONIZE_CACHE */ \
  86. #define US_FLAG(name, value) US_FL_##name = value ,
  87. enum { US_DO_ALL_FLAGS };
  88. #undef US_FLAG
  89. #include <linux/usb/storage.h>
  90. extern int usb_usual_ignore_device(struct usb_interface *intf);
  91. extern const struct usb_device_id usb_storage_usb_ids[];
  92. #endif /* __LINUX_USB_USUAL_H */