Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Interface to the libusual. |
| 4 | * |
| 5 | * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com> |
| 6 | * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
| 7 | * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com) |
| 8 | */ |
| 9 | |
| 10 | #ifndef __LINUX_USB_USUAL_H |
| 11 | #define __LINUX_USB_USUAL_H |
| 12 | |
Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 13 | |
| 14 | /* We should do this for cleanliness... But other usb_foo.h do not do this. */ |
| 15 | /* #include <linux/usb.h> */ |
| 16 | |
| 17 | /* |
| 18 | * The flags field, which we store in usb_device_id.driver_info. |
| 19 | * It is compatible with the old usb-storage flags in lower 24 bits. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * Static flag definitions. We use this roundabout technique so that the |
| 24 | * proc_info() routine can automatically display a message for each flag. |
| 25 | */ |
| 26 | #define US_DO_ALL_FLAGS \ |
| 27 | US_FLAG(SINGLE_LUN, 0x00000001) \ |
| 28 | /* allow access to only LUN 0 */ \ |
| 29 | US_FLAG(NEED_OVERRIDE, 0x00000002) \ |
| 30 | /* unusual_devs entry is necessary */ \ |
| 31 | US_FLAG(SCM_MULT_TARG, 0x00000004) \ |
| 32 | /* supports multiple targets */ \ |
| 33 | US_FLAG(FIX_INQUIRY, 0x00000008) \ |
| 34 | /* INQUIRY response needs faking */ \ |
| 35 | US_FLAG(FIX_CAPACITY, 0x00000010) \ |
| 36 | /* READ CAPACITY response too big */ \ |
| 37 | US_FLAG(IGNORE_RESIDUE, 0x00000020) \ |
| 38 | /* reported residue is wrong */ \ |
| 39 | US_FLAG(BULK32, 0x00000040) \ |
| 40 | /* Uses 32-byte CBW length */ \ |
| 41 | US_FLAG(NOT_LOCKABLE, 0x00000080) \ |
| 42 | /* PREVENT/ALLOW not supported */ \ |
| 43 | US_FLAG(GO_SLOW, 0x00000100) \ |
| 44 | /* Need delay after Command phase */ \ |
| 45 | US_FLAG(NO_WP_DETECT, 0x00000200) \ |
| 46 | /* Don't check for write-protect */ \ |
Phil Dibowitz | 883d989 | 2006-06-24 17:27:10 -0700 | [diff] [blame] | 47 | US_FLAG(MAX_SECTORS_64, 0x00000400) \ |
Daniel Drake | 3c33242 | 2006-07-26 13:59:23 +0100 | [diff] [blame] | 48 | /* Sets max_sectors to 64 */ \ |
| 49 | US_FLAG(IGNORE_DEVICE, 0x00000800) \ |
Oliver Neukum | 61bf54b | 2007-02-08 09:04:48 +0100 | [diff] [blame] | 50 | /* Don't claim device */ \ |
| 51 | US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \ |
Doug Maxey | 33abc04 | 2007-12-05 23:36:45 -0600 | [diff] [blame] | 52 | /* sometimes sizes is too big */ \ |
| 53 | US_FLAG(MAX_SECTORS_MIN,0x00002000) \ |
Constantin Baranov | cc36bdd | 2008-03-16 20:04:23 +0000 | [diff] [blame] | 54 | /* Sets max_sectors to arch min */ \ |
| 55 | US_FLAG(BULK_IGNORE_TAG,0x00004000) \ |
Ben Efros | 1537e0a | 2008-11-18 13:31:13 -0800 | [diff] [blame] | 56 | /* Ignore tag mismatch in bulk operations */ \ |
Alan Stern | 25ff1c3 | 2008-12-15 12:43:41 -0500 | [diff] [blame] | 57 | US_FLAG(SANE_SENSE, 0x00008000) \ |
| 58 | /* Sane Sense (> 18 bytes) */ \ |
| 59 | US_FLAG(CAPACITY_OK, 0x00010000) \ |
Alan Stern | a0bb108 | 2009-12-07 16:39:16 -0500 | [diff] [blame] | 60 | /* READ CAPACITY response is correct */ \ |
| 61 | US_FLAG(BAD_SENSE, 0x00020000) \ |
Hans de Goede | ae38c78 | 2010-10-01 14:20:10 -0700 | [diff] [blame] | 62 | /* Bad Sense (never more than 18 bytes) */ \ |
| 63 | US_FLAG(NO_READ_DISC_INFO, 0x00040000) \ |
Hans de Goede | 0091402 | 2010-10-01 14:20:11 -0700 | [diff] [blame] | 64 | /* cannot handle READ_DISC_INFO */ \ |
| 65 | US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \ |
Alan Stern | 21c13a4 | 2011-06-07 11:35:52 -0400 | [diff] [blame] | 66 | /* cannot handle READ_CAPACITY_16 */ \ |
| 67 | US_FLAG(INITIAL_READ10, 0x00100000) \ |
Namjae Jeon | eaa05df | 2012-07-07 23:05:28 -0400 | [diff] [blame] | 68 | /* Initial READ(10) (and others) must be retried */ \ |
| 69 | US_FLAG(WRITE_CACHE, 0x00200000) \ |
Oliver Neukum | 32c37fc | 2013-10-14 15:24:55 +0200 | [diff] [blame] | 70 | /* Write Cache status is not available */ \ |
Hans de Goede | 79b4c06 | 2013-10-25 17:04:33 +0100 | [diff] [blame] | 71 | US_FLAG(NEEDS_CAP16, 0x00400000) \ |
| 72 | /* cannot handle READ_CAPACITY_10 */ \ |
| 73 | US_FLAG(IGNORE_UAS, 0x00800000) \ |
Alan Stern | b14bf2d | 2014-06-30 11:04:21 -0400 | [diff] [blame] | 74 | /* Device advertises UAS but it is broken */ \ |
| 75 | US_FLAG(BROKEN_FUA, 0x01000000) \ |
| 76 | /* Cannot handle FUA in WRITE or READ CDBs */ \ |
Hans de Goede | 5930785 | 2014-09-15 16:04:12 +0200 | [diff] [blame] | 77 | US_FLAG(NO_ATA_1X, 0x02000000) \ |
| 78 | /* Cannot handle ATA_12 or ATA_16 CDBs */ \ |
Hans de Goede | 734016b | 2014-09-16 18:36:52 +0200 | [diff] [blame] | 79 | US_FLAG(NO_REPORT_OPCODES, 0x04000000) \ |
| 80 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ |
Hans de Goede | ee136af | 2015-04-21 11:20:31 +0200 | [diff] [blame] | 81 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ |
| 82 | /* Sets max_sectors to 240 */ \ |
Hans de Goede | 1363074 | 2016-04-12 12:27:09 +0200 | [diff] [blame] | 83 | US_FLAG(NO_REPORT_LUNS, 0x10000000) \ |
| 84 | /* Cannot handle REPORT_LUNS */ \ |
Oliver Neukum | 050bc4e | 2016-09-12 15:19:41 +0200 | [diff] [blame] | 85 | US_FLAG(ALWAYS_SYNC, 0x20000000) \ |
| 86 | /* lies about caching, so always sync */ \ |
Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 87 | |
| 88 | #define US_FLAG(name, value) US_FL_##name = value , |
| 89 | enum { US_DO_ALL_FLAGS }; |
| 90 | #undef US_FLAG |
| 91 | |
Matthew Wilcox | ae6d22f | 2010-10-07 13:05:22 +0200 | [diff] [blame] | 92 | #include <linux/usb/storage.h> |
Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 93 | |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 94 | extern int usb_usual_ignore_device(struct usb_interface *intf); |
Joe Perches | 1089284 | 2020-02-17 16:59:54 -0800 | [diff] [blame] | 95 | extern const struct usb_device_id usb_storage_usb_ids[]; |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 96 | |
Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 97 | #endif /* __LINUX_USB_USUAL_H */ |