| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 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 |  | 
 | 9 | #ifndef __LINUX_USB_USUAL_H | 
 | 10 | #define __LINUX_USB_USUAL_H | 
 | 11 |  | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 12 |  | 
 | 13 | /* We should do this for cleanliness... But other usb_foo.h do not do this. */ | 
 | 14 | /* #include <linux/usb.h> */ | 
 | 15 |  | 
 | 16 | /* | 
 | 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. | 
 | 19 |  */ | 
 | 20 |  | 
 | 21 | /* | 
 | 22 |  * Static flag definitions.  We use this roundabout technique so that the | 
 | 23 |  * proc_info() routine can automatically display a message for each flag. | 
 | 24 |  */ | 
 | 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 */		\ | 
| Phil Dibowitz | 883d989 | 2006-06-24 17:27:10 -0700 | [diff] [blame] | 46 | 	US_FLAG(MAX_SECTORS_64,	0x00000400)			\ | 
| Daniel Drake | 3c33242 | 2006-07-26 13:59:23 +0100 | [diff] [blame] | 47 | 		/* Sets max_sectors to 64    */			\ | 
 | 48 | 	US_FLAG(IGNORE_DEVICE,	0x00000800)			\ | 
| Oliver Neukum | 61bf54b | 2007-02-08 09:04:48 +0100 | [diff] [blame] | 49 | 		/* Don't claim device */			\ | 
 | 50 | 	US_FLAG(CAPACITY_HEURISTICS,	0x00001000)		\ | 
| Doug Maxey | 33abc04 | 2007-12-05 23:36:45 -0600 | [diff] [blame] | 51 | 		/* sometimes sizes is too big */		\ | 
 | 52 | 	US_FLAG(MAX_SECTORS_MIN,0x00002000)			\ | 
| Constantin Baranov | cc36bdd | 2008-03-16 20:04:23 +0000 | [diff] [blame] | 53 | 		/* Sets max_sectors to arch min */		\ | 
 | 54 | 	US_FLAG(BULK_IGNORE_TAG,0x00004000)			\ | 
| Ben Efros | 1537e0a | 2008-11-18 13:31:13 -0800 | [diff] [blame] | 55 | 		/* Ignore tag mismatch in bulk operations */    \ | 
| Alan Stern | 25ff1c3 | 2008-12-15 12:43:41 -0500 | [diff] [blame] | 56 | 	US_FLAG(SANE_SENSE,     0x00008000)			\ | 
 | 57 | 		/* Sane Sense (> 18 bytes) */			\ | 
 | 58 | 	US_FLAG(CAPACITY_OK,	0x00010000)			\ | 
 | 59 | 		/* READ CAPACITY response is correct */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 60 |  | 
 | 61 | #define US_FLAG(name, value)	US_FL_##name = value , | 
 | 62 | enum { US_DO_ALL_FLAGS }; | 
 | 63 | #undef US_FLAG | 
 | 64 |  | 
 | 65 | /* | 
 | 66 |  * The bias field for libusual and friends. | 
 | 67 |  */ | 
 | 68 | #define USB_US_TYPE_NONE   0 | 
 | 69 | #define USB_US_TYPE_STOR   1		/* usb-storage */ | 
 | 70 | #define USB_US_TYPE_UB     2		/* ub */ | 
 | 71 |  | 
 | 72 | #define USB_US_TYPE(flags) 		(((flags) >> 24) & 0xFF) | 
 | 73 | #define USB_US_ORIG_FLAGS(flags)	((flags) & 0x00FFFFFF) | 
 | 74 |  | 
 | 75 | /* | 
 | 76 |  * This is probably not the best place to keep these constants, conceptually. | 
 | 77 |  * But it's the only header included into all places which need them. | 
 | 78 |  */ | 
 | 79 |  | 
 | 80 | /* Sub Classes */ | 
 | 81 |  | 
 | 82 | #define US_SC_RBC	0x01		/* Typically, flash devices */ | 
 | 83 | #define US_SC_8020	0x02		/* CD-ROM */ | 
 | 84 | #define US_SC_QIC	0x03		/* QIC-157 Tapes */ | 
 | 85 | #define US_SC_UFI	0x04		/* Floppy */ | 
 | 86 | #define US_SC_8070	0x05		/* Removable media */ | 
 | 87 | #define US_SC_SCSI	0x06		/* Transparent */ | 
| Alan Stern | 676d3aa | 2007-11-08 15:15:28 -0500 | [diff] [blame] | 88 | #define US_SC_LOCKABLE	0x07		/* Password-protected */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 89 |  | 
| Alan Stern | 676d3aa | 2007-11-08 15:15:28 -0500 | [diff] [blame] | 90 | #define US_SC_ISD200    0xf0		/* ISD200 ATA */ | 
| matthieu castet | d277064 | 2008-03-19 19:40:52 +0100 | [diff] [blame] | 91 | #define US_SC_CYP_ATACB 0xf1		/* Cypress ATACB */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 92 | #define US_SC_DEVICE	0xff		/* Use device's value */ | 
 | 93 |  | 
 | 94 | /* Protocols */ | 
 | 95 |  | 
 | 96 | #define US_PR_CBI	0x00		/* Control/Bulk/Interrupt */ | 
 | 97 | #define US_PR_CB	0x01		/* Control/Bulk w/o interrupt */ | 
 | 98 | #define US_PR_BULK	0x50		/* bulk only */ | 
| Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 99 |  | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 100 | #define US_PR_USBAT	0x80		/* SCM-ATAPI bridge */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 101 | #define US_PR_EUSB_SDDR09	0x81	/* SCM-SCSI bridge for SDDR-09 */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 102 | #define US_PR_SDDR55	0x82		/* SDDR-55 (made up) */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 103 | #define US_PR_DPCM_USB  0xf0		/* Combination CB/SDDR09 */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 104 | #define US_PR_FREECOM   0xf1		/* Freecom */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 105 | #define US_PR_DATAFAB   0xf2		/* Datafab chipsets */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 106 | #define US_PR_JUMPSHOT  0xf3		/* Lexar Jumpshot */ | 
| Matthew Dharm | e80b0fa | 2005-12-04 22:02:44 -0800 | [diff] [blame] | 107 | #define US_PR_ALAUDA    0xf4		/* Alauda chipsets */ | 
| Matthew Dharm | dfe0d3b | 2006-08-13 17:30:14 -0700 | [diff] [blame] | 108 | #define US_PR_KARMA     0xf5		/* Rio Karma */ | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 109 |  | 
 | 110 | #define US_PR_DEVICE	0xff		/* Use device's value */ | 
 | 111 |  | 
 | 112 | /* | 
 | 113 |  */ | 
| Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 114 | extern int usb_usual_ignore_device(struct usb_interface *intf); | 
 | 115 | extern struct usb_device_id usb_storage_usb_ids[]; | 
 | 116 |  | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 117 | #ifdef CONFIG_USB_LIBUSUAL | 
 | 118 |  | 
| Pete Zaitcev | a00828e | 2005-10-22 20:15:09 -0700 | [diff] [blame] | 119 | extern void usb_usual_set_present(int type); | 
 | 120 | extern void usb_usual_clear_present(int type); | 
 | 121 | extern int usb_usual_check_type(const struct usb_device_id *, int type); | 
 | 122 | #else | 
 | 123 |  | 
 | 124 | #define usb_usual_set_present(t)	do { } while(0) | 
 | 125 | #define usb_usual_clear_present(t)	do { } while(0) | 
 | 126 | #define usb_usual_check_type(id, t)	(0) | 
 | 127 | #endif /* CONFIG_USB_LIBUSUAL */ | 
 | 128 |  | 
 | 129 | #endif /* __LINUX_USB_USUAL_H */ |