usb_usual.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. US_FLAG(MAX_SECTORS_MIN,0x00002000) \
  48. /* Sets max_sectors to arch min */ \
  49. US_FLAG(BULK_IGNORE_TAG,0x00004000) \
  50. /* Ignore tag mismatch in bulk operations */ \
  51. US_FLAG(SANE_SENSE, 0x00008000) \
  52. /* Sane Sense (> 18 bytes) */ \
  53. US_FLAG(CAPACITY_OK, 0x00010000) \
  54. /* READ CAPACITY response is correct */ \
  55. US_FLAG(BAD_SENSE, 0x00020000) \
  56. /* Bad Sense (never more than 18 bytes) */ \
  57. US_FLAG(NO_READ_DISC_INFO, 0x00040000) \
  58. /* cannot handle READ_DISC_INFO */ \
  59. US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
  60. /* cannot handle READ_CAPACITY_16 */ \
  61. US_FLAG(INITIAL_READ10, 0x00100000) \
  62. /* Initial READ(10) (and others) must be retried */ \
  63. US_FLAG(BROKEN_FUA, 0x01000000) \
  64. /* Cannot handle FUA in WRITE or READ CDBs */ \
  65. #define US_FLAG(name, value) US_FL_##name = value ,
  66. enum { US_DO_ALL_FLAGS };
  67. #undef US_FLAG
  68. /*
  69. * The bias field for libusual and friends.
  70. */
  71. #define USB_US_TYPE_NONE 0
  72. #define USB_US_TYPE_STOR 1 /* usb-storage */
  73. #define USB_US_TYPE_UB 2 /* ub */
  74. #define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
  75. #define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
  76. #include <linux/usb/storage.h>
  77. /*
  78. */
  79. extern int usb_usual_ignore_device(struct usb_interface *intf);
  80. extern struct usb_device_id usb_storage_usb_ids[];
  81. #ifdef CONFIG_USB_LIBUSUAL
  82. extern void usb_usual_set_present(int type);
  83. extern void usb_usual_clear_present(int type);
  84. extern int usb_usual_check_type(const struct usb_device_id *, int type);
  85. #else
  86. #define usb_usual_set_present(t) do { } while(0)
  87. #define usb_usual_clear_present(t) do { } while(0)
  88. #define usb_usual_check_type(id, t) (0)
  89. #endif /* CONFIG_USB_LIBUSUAL */
  90. #endif /* __LINUX_USB_USUAL_H */