usb_usual.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Interface to the libusual.
  3. *
  4. * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com>
  5. * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
  6. * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com)
  7. */
  8. #ifndef __LINUX_USB_USUAL_H
  9. #define __LINUX_USB_USUAL_H
  10. /* We should do this for cleanliness... But other usb_foo.h do not do this. */
  11. /* #include <linux/usb.h> */
  12. /*
  13. * The flags field, which we store in usb_device_id.driver_info.
  14. * It is compatible with the old usb-storage flags in lower 24 bits.
  15. */
  16. /*
  17. * Static flag definitions. We use this roundabout technique so that the
  18. * proc_info() routine can automatically display a message for each flag.
  19. */
  20. #define US_DO_ALL_FLAGS \
  21. US_FLAG(SINGLE_LUN, 0x00000001) \
  22. /* allow access to only LUN 0 */ \
  23. US_FLAG(NEED_OVERRIDE, 0x00000002) \
  24. /* unusual_devs entry is necessary */ \
  25. US_FLAG(SCM_MULT_TARG, 0x00000004) \
  26. /* supports multiple targets */ \
  27. US_FLAG(FIX_INQUIRY, 0x00000008) \
  28. /* INQUIRY response needs faking */ \
  29. US_FLAG(FIX_CAPACITY, 0x00000010) \
  30. /* READ CAPACITY response too big */ \
  31. US_FLAG(IGNORE_RESIDUE, 0x00000020) \
  32. /* reported residue is wrong */ \
  33. US_FLAG(BULK32, 0x00000040) \
  34. /* Uses 32-byte CBW length */ \
  35. US_FLAG(NOT_LOCKABLE, 0x00000080) \
  36. /* PREVENT/ALLOW not supported */ \
  37. US_FLAG(GO_SLOW, 0x00000100) \
  38. /* Need delay after Command phase */ \
  39. US_FLAG(NO_WP_DETECT, 0x00000200) \
  40. /* Don't check for write-protect */ \
  41. US_FLAG(MAX_SECTORS_64, 0x00000400) \
  42. /* Sets max_sectors to 64 */ \
  43. US_FLAG(IGNORE_DEVICE, 0x00000800) \
  44. /* Don't claim device */ \
  45. US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
  46. /* sometimes sizes is too big */
  47. #define US_FLAG(name, value) US_FL_##name = value ,
  48. enum { US_DO_ALL_FLAGS };
  49. #undef US_FLAG
  50. /*
  51. * The bias field for libusual and friends.
  52. */
  53. #define USB_US_TYPE_NONE 0
  54. #define USB_US_TYPE_STOR 1 /* usb-storage */
  55. #define USB_US_TYPE_UB 2 /* ub */
  56. #define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
  57. #define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
  58. /*
  59. * This is probably not the best place to keep these constants, conceptually.
  60. * But it's the only header included into all places which need them.
  61. */
  62. /* Sub Classes */
  63. #define US_SC_RBC 0x01 /* Typically, flash devices */
  64. #define US_SC_8020 0x02 /* CD-ROM */
  65. #define US_SC_QIC 0x03 /* QIC-157 Tapes */
  66. #define US_SC_UFI 0x04 /* Floppy */
  67. #define US_SC_8070 0x05 /* Removable media */
  68. #define US_SC_SCSI 0x06 /* Transparent */
  69. #define US_SC_ISD200 0x07 /* ISD200 ATA */
  70. #define US_SC_MIN US_SC_RBC
  71. #define US_SC_MAX US_SC_ISD200
  72. #define US_SC_DEVICE 0xff /* Use device's value */
  73. /* Protocols */
  74. #define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
  75. #define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
  76. #define US_PR_BULK 0x50 /* bulk only */
  77. #ifdef CONFIG_USB_STORAGE_USBAT
  78. #define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
  79. #endif
  80. #ifdef CONFIG_USB_STORAGE_SDDR09
  81. #define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
  82. #endif
  83. #ifdef CONFIG_USB_STORAGE_SDDR55
  84. #define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
  85. #endif
  86. #define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
  87. #ifdef CONFIG_USB_STORAGE_FREECOM
  88. #define US_PR_FREECOM 0xf1 /* Freecom */
  89. #endif
  90. #ifdef CONFIG_USB_STORAGE_DATAFAB
  91. #define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
  92. #endif
  93. #ifdef CONFIG_USB_STORAGE_JUMPSHOT
  94. #define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
  95. #endif
  96. #ifdef CONFIG_USB_STORAGE_ALAUDA
  97. #define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
  98. #endif
  99. #ifdef CONFIG_USB_STORAGE_KARMA
  100. #define US_PR_KARMA 0xf5 /* Rio Karma */
  101. #endif
  102. #define US_PR_DEVICE 0xff /* Use device's value */
  103. /*
  104. */
  105. #ifdef CONFIG_USB_LIBUSUAL
  106. extern struct usb_device_id storage_usb_ids[];
  107. extern void usb_usual_set_present(int type);
  108. extern void usb_usual_clear_present(int type);
  109. extern int usb_usual_check_type(const struct usb_device_id *, int type);
  110. #else
  111. #define usb_usual_set_present(t) do { } while(0)
  112. #define usb_usual_clear_present(t) do { } while(0)
  113. #define usb_usual_check_type(id, t) (0)
  114. #endif /* CONFIG_USB_LIBUSUAL */
  115. #endif /* __LINUX_USB_USUAL_H */