usb_usual.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. #include <linux/config.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. #define US_FLAG(name, value) US_FL_##name = value ,
  43. enum { US_DO_ALL_FLAGS };
  44. #undef US_FLAG
  45. /*
  46. * The bias field for libusual and friends.
  47. */
  48. #define USB_US_TYPE_NONE 0
  49. #define USB_US_TYPE_STOR 1 /* usb-storage */
  50. #define USB_US_TYPE_UB 2 /* ub */
  51. #define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
  52. #define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
  53. /*
  54. * This is probably not the best place to keep these constants, conceptually.
  55. * But it's the only header included into all places which need them.
  56. */
  57. /* Sub Classes */
  58. #define US_SC_RBC 0x01 /* Typically, flash devices */
  59. #define US_SC_8020 0x02 /* CD-ROM */
  60. #define US_SC_QIC 0x03 /* QIC-157 Tapes */
  61. #define US_SC_UFI 0x04 /* Floppy */
  62. #define US_SC_8070 0x05 /* Removable media */
  63. #define US_SC_SCSI 0x06 /* Transparent */
  64. #define US_SC_ISD200 0x07 /* ISD200 ATA */
  65. #define US_SC_MIN US_SC_RBC
  66. #define US_SC_MAX US_SC_ISD200
  67. #define US_SC_DEVICE 0xff /* Use device's value */
  68. /* Protocols */
  69. #define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
  70. #define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
  71. #define US_PR_BULK 0x50 /* bulk only */
  72. #ifdef CONFIG_USB_STORAGE_USBAT
  73. #define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
  74. #endif
  75. #ifdef CONFIG_USB_STORAGE_SDDR09
  76. #define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
  77. #endif
  78. #ifdef CONFIG_USB_STORAGE_SDDR55
  79. #define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
  80. #endif
  81. #define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
  82. #ifdef CONFIG_USB_STORAGE_FREECOM
  83. #define US_PR_FREECOM 0xf1 /* Freecom */
  84. #endif
  85. #ifdef CONFIG_USB_STORAGE_DATAFAB
  86. #define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
  87. #endif
  88. #ifdef CONFIG_USB_STORAGE_JUMPSHOT
  89. #define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
  90. #endif
  91. #ifdef CONFIG_USB_STORAGE_ALAUDA
  92. #define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
  93. #endif
  94. #define US_PR_DEVICE 0xff /* Use device's value */
  95. /*
  96. */
  97. #ifdef CONFIG_USB_LIBUSUAL
  98. extern struct usb_device_id storage_usb_ids[];
  99. extern void usb_usual_set_present(int type);
  100. extern void usb_usual_clear_present(int type);
  101. extern int usb_usual_check_type(const struct usb_device_id *, int type);
  102. #else
  103. #define usb_usual_set_present(t) do { } while(0)
  104. #define usb_usual_clear_present(t) do { } while(0)
  105. #define usb_usual_check_type(id, t) (0)
  106. #endif /* CONFIG_USB_LIBUSUAL */
  107. #endif /* __LINUX_USB_USUAL_H */