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