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