1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * Interface to the libusual. 2 * Interface to the libusual. 4 * 3 * 5 * Copyright (c) 2005 Pete Zaitcev <zaitcev@re 4 * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com> 6 * Copyright (c) 1999-2002 Matthew Dharm (mdha 5 * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) 7 * Copyright (c) 1999 Michael Gee (michael@lin 6 * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com) 8 */ 7 */ 9 8 10 #ifndef __LINUX_USB_USUAL_H 9 #ifndef __LINUX_USB_USUAL_H 11 #define __LINUX_USB_USUAL_H 10 #define __LINUX_USB_USUAL_H 12 11 13 12 14 /* We should do this for cleanliness... But ot 13 /* We should do this for cleanliness... But other usb_foo.h do not do this. */ 15 /* #include <linux/usb.h> */ 14 /* #include <linux/usb.h> */ 16 15 17 /* 16 /* 18 * The flags field, which we store in usb_devi 17 * The flags field, which we store in usb_device_id.driver_info. 19 * It is compatible with the old usb-storage f 18 * It is compatible with the old usb-storage flags in lower 24 bits. 20 */ 19 */ 21 20 22 /* 21 /* 23 * Static flag definitions. We use this round 22 * Static flag definitions. We use this roundabout technique so that the 24 * proc_info() routine can automatically displ 23 * proc_info() routine can automatically display a message for each flag. 25 */ 24 */ 26 #define US_DO_ALL_FLAGS 25 #define US_DO_ALL_FLAGS \ 27 US_FLAG(SINGLE_LUN, 0x00000001) 26 US_FLAG(SINGLE_LUN, 0x00000001) \ 28 /* allow access to only LUN 0 27 /* allow access to only LUN 0 */ \ 29 US_FLAG(NEED_OVERRIDE, 0x00000002) 28 US_FLAG(NEED_OVERRIDE, 0x00000002) \ 30 /* unusual_devs entry is neces 29 /* unusual_devs entry is necessary */ \ 31 US_FLAG(SCM_MULT_TARG, 0x00000004) 30 US_FLAG(SCM_MULT_TARG, 0x00000004) \ 32 /* supports multiple targets * 31 /* supports multiple targets */ \ 33 US_FLAG(FIX_INQUIRY, 0x00000008) 32 US_FLAG(FIX_INQUIRY, 0x00000008) \ 34 /* INQUIRY response needs faki 33 /* INQUIRY response needs faking */ \ 35 US_FLAG(FIX_CAPACITY, 0x00000010) 34 US_FLAG(FIX_CAPACITY, 0x00000010) \ 36 /* READ CAPACITY response too 35 /* READ CAPACITY response too big */ \ 37 US_FLAG(IGNORE_RESIDUE, 0x00000020) 36 US_FLAG(IGNORE_RESIDUE, 0x00000020) \ 38 /* reported residue is wrong * 37 /* reported residue is wrong */ \ 39 US_FLAG(BULK32, 0x00000040) 38 US_FLAG(BULK32, 0x00000040) \ 40 /* Uses 32-byte CBW length */ 39 /* Uses 32-byte CBW length */ \ 41 US_FLAG(NOT_LOCKABLE, 0x00000080) 40 US_FLAG(NOT_LOCKABLE, 0x00000080) \ 42 /* PREVENT/ALLOW not supported 41 /* PREVENT/ALLOW not supported */ \ 43 US_FLAG(GO_SLOW, 0x00000100) 42 US_FLAG(GO_SLOW, 0x00000100) \ 44 /* Need delay after Command ph 43 /* Need delay after Command phase */ \ 45 US_FLAG(NO_WP_DETECT, 0x00000200) 44 US_FLAG(NO_WP_DETECT, 0x00000200) \ 46 /* Don't check for write-prote 45 /* Don't check for write-protect */ \ 47 US_FLAG(MAX_SECTORS_64, 0x00000400) 46 US_FLAG(MAX_SECTORS_64, 0x00000400) \ 48 /* Sets max_sectors to 64 * 47 /* Sets max_sectors to 64 */ \ 49 US_FLAG(IGNORE_DEVICE, 0x00000800) 48 US_FLAG(IGNORE_DEVICE, 0x00000800) \ 50 /* Don't claim device */ 49 /* Don't claim device */ \ 51 US_FLAG(CAPACITY_HEURISTICS, 0x0000 50 US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \ 52 /* sometimes sizes is too big 51 /* sometimes sizes is too big */ \ 53 US_FLAG(MAX_SECTORS_MIN,0x00002000) 52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \ 54 /* Sets max_sectors to arch mi 53 /* Sets max_sectors to arch min */ \ 55 US_FLAG(BULK_IGNORE_TAG,0x00004000) 54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \ 56 /* Ignore tag mismatch in bulk 55 /* Ignore tag mismatch in bulk operations */ \ 57 US_FLAG(SANE_SENSE, 0x00008000) 56 US_FLAG(SANE_SENSE, 0x00008000) \ 58 /* Sane Sense (> 18 bytes) */ 57 /* Sane Sense (> 18 bytes) */ \ 59 US_FLAG(CAPACITY_OK, 0x00010000) 58 US_FLAG(CAPACITY_OK, 0x00010000) \ 60 /* READ CAPACITY response is c 59 /* READ CAPACITY response is correct */ \ 61 US_FLAG(BAD_SENSE, 0x00020000) 60 US_FLAG(BAD_SENSE, 0x00020000) \ 62 /* Bad Sense (never more than !! 61 /* Bad Sense (never more than 18 bytes) */ 63 US_FLAG(NO_READ_DISC_INFO, 0x0004 << 64 /* cannot handle READ_DISC_INF << 65 US_FLAG(NO_READ_CAPACITY_16, 0x0008 << 66 /* cannot handle READ_CAPACITY << 67 US_FLAG(INITIAL_READ10, 0x00100000) << 68 /* Initial READ(10) (and other << 69 US_FLAG(WRITE_CACHE, 0x00200000) << 70 /* Write Cache status is not a << 71 US_FLAG(NEEDS_CAP16, 0x00400000) << 72 /* cannot handle READ_CAPACITY << 73 US_FLAG(IGNORE_UAS, 0x00800000) << 74 /* Device advertises UAS but i << 75 US_FLAG(BROKEN_FUA, 0x01000000) << 76 /* Cannot handle FUA in WRITE << 77 US_FLAG(NO_ATA_1X, 0x02000000) << 78 /* Cannot handle ATA_12 or ATA << 79 US_FLAG(NO_REPORT_OPCODES, 0x0400 << 80 /* Cannot handle MI_REPORT_SUP << 81 US_FLAG(MAX_SECTORS_240, 0x0800 << 82 /* Sets max_sectors to 240 */ << 83 US_FLAG(NO_REPORT_LUNS, 0x10000000) << 84 /* Cannot handle REPORT_LUNS * << 85 US_FLAG(ALWAYS_SYNC, 0x20000000) << 86 /* lies about caching, so alwa << 87 US_FLAG(NO_SAME, 0x40000000) << 88 /* Cannot handle WRITE_SAME */ << 89 US_FLAG(SENSE_AFTER_SYNC, 0x80000000) << 90 /* Do REQUEST_SENSE after SYNC << 91 62 92 #define US_FLAG(name, value) US_FL_##name = 63 #define US_FLAG(name, value) US_FL_##name = value , 93 enum { US_DO_ALL_FLAGS }; 64 enum { US_DO_ALL_FLAGS }; 94 #undef US_FLAG 65 #undef US_FLAG 95 66 96 #include <linux/usb/storage.h> !! 67 /* >> 68 * The bias field for libusual and friends. >> 69 */ >> 70 #define USB_US_TYPE_NONE 0 >> 71 #define USB_US_TYPE_STOR 1 /* usb-storage */ >> 72 #define USB_US_TYPE_UB 2 /* ub */ >> 73 >> 74 #define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF) >> 75 #define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF) >> 76 >> 77 /* >> 78 * This is probably not the best place to keep these constants, conceptually. >> 79 * But it's the only header included into all places which need them. >> 80 */ >> 81 >> 82 /* Sub Classes */ 97 83 >> 84 #define US_SC_RBC 0x01 /* Typically, flash devices */ >> 85 #define US_SC_8020 0x02 /* CD-ROM */ >> 86 #define US_SC_QIC 0x03 /* QIC-157 Tapes */ >> 87 #define US_SC_UFI 0x04 /* Floppy */ >> 88 #define US_SC_8070 0x05 /* Removable media */ >> 89 #define US_SC_SCSI 0x06 /* Transparent */ >> 90 #define US_SC_LOCKABLE 0x07 /* Password-protected */ >> 91 >> 92 #define US_SC_ISD200 0xf0 /* ISD200 ATA */ >> 93 #define US_SC_CYP_ATACB 0xf1 /* Cypress ATACB */ >> 94 #define US_SC_DEVICE 0xff /* Use device's value */ >> 95 >> 96 /* Protocols */ >> 97 >> 98 #define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */ >> 99 #define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */ >> 100 #define US_PR_BULK 0x50 /* bulk only */ >> 101 >> 102 #define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */ >> 103 #define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ >> 104 #define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */ >> 105 #define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */ >> 106 #define US_PR_FREECOM 0xf1 /* Freecom */ >> 107 #define US_PR_DATAFAB 0xf2 /* Datafab chipsets */ >> 108 #define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */ >> 109 #define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ >> 110 #define US_PR_KARMA 0xf5 /* Rio Karma */ >> 111 >> 112 #define US_PR_DEVICE 0xff /* Use device's value */ >> 113 >> 114 /* >> 115 */ 98 extern int usb_usual_ignore_device(struct usb_ 116 extern int usb_usual_ignore_device(struct usb_interface *intf); 99 extern const struct usb_device_id usb_storage_ !! 117 extern struct usb_device_id usb_storage_usb_ids[]; >> 118 >> 119 #ifdef CONFIG_USB_LIBUSUAL >> 120 >> 121 extern void usb_usual_set_present(int type); >> 122 extern void usb_usual_clear_present(int type); >> 123 extern int usb_usual_check_type(const struct usb_device_id *, int type); >> 124 #else >> 125 >> 126 #define usb_usual_set_present(t) do { } while(0) >> 127 #define usb_usual_clear_present(t) do { } while(0) >> 128 #define usb_usual_check_type(id, t) (0) >> 129 #endif /* CONFIG_USB_LIBUSUAL */ 100 130 101 #endif /* __LINUX_USB_USUAL_H */ 131 #endif /* __LINUX_USB_USUAL_H */ 102 132
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.