X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fstorage%2Fusb.h;h=21f3ddbc90805ca6f93f58c514d00fc49e63e320;hb=refs%2Fheads%2Fvserver;hp=625b7aa98074112080590a3e104f8288b9f85021;hpb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;p=linux-2.6.git diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 625b7aa98..21f3ddbc9 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h @@ -45,9 +45,11 @@ #define _USB_H_ #include +#include #include #include #include +#include #include struct us_data; @@ -63,38 +65,8 @@ struct us_unusual_dev { __u8 useProtocol; __u8 useTransport; int (*initFunction)(struct us_data *); - unsigned int flags; }; -/* - * Static flag definitions. We use this roundabout technique so that the - * proc_info() routine can automatically display a message for each flag. - */ -#define US_DO_ALL_FLAGS \ - US_FLAG(SINGLE_LUN, 0x00000001) \ - /* allow access to only LUN 0 */ \ - US_FLAG(NEED_OVERRIDE, 0x00000002) \ - /* unusual_devs entry is necessary */ \ - US_FLAG(SCM_MULT_TARG, 0x00000004) \ - /* supports multiple targets */ \ - US_FLAG(FIX_INQUIRY, 0x00000008) \ - /* INQUIRY response needs faking */ \ - US_FLAG(FIX_CAPACITY, 0x00000010) \ - /* READ CAPACITY response too big */ \ - US_FLAG(IGNORE_RESIDUE, 0x00000020) \ - /* reported residue is wrong */ \ - US_FLAG(BULK32, 0x00000040) \ - /* Uses 32-byte CBW length */ \ - US_FLAG(NOT_LOCKABLE, 0x00000080) \ - /* PREVENT/ALLOW not supported */ \ - US_FLAG(GO_SLOW, 0x00000100) \ - /* Need delay after Command phase */ \ - US_FLAG(NO_WP_DETECT, 0x00000200) \ - /* Don't check for write-protect */ \ - -#define US_FLAG(name, value) US_FL_##name = value , -enum { US_DO_ALL_FLAGS }; -#undef US_FLAG /* Dynamic flag definitions: used in set_bit() etc. */ #define US_FLIDX_URB_ACTIVE 18 /* 0x00040000 current_urb is in use */ @@ -117,19 +89,24 @@ enum { US_DO_ALL_FLAGS }; */ #define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */ +#define US_SENSE_SIZE 18 /* Size of the autosense data buffer */ typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*); typedef int (*trans_reset)(struct us_data*); typedef void (*proto_cmnd)(struct scsi_cmnd*, struct us_data*); -typedef void (*extra_data_destructor)(void *); /* extra data destructor */ +typedef void (*extra_data_destructor)(void *); /* extra data destructor */ +typedef void (*pm_hook)(struct us_data *, int); /* power management hook */ + +#define US_SUSPEND 0 +#define US_RESUME 1 /* we allocate one of these for every device that we remember */ struct us_data { /* The device we're working with * It's important to note: - * (o) you must hold dev_semaphore to change pusb_dev + * (o) you must hold dev_mutex to change pusb_dev */ - struct semaphore dev_semaphore; /* protect pusb_dev */ + struct mutex dev_mutex; /* protect pusb_dev */ struct usb_device *pusb_dev; /* this usb_device */ struct usb_interface *pusb_intf; /* this interface */ struct us_unusual_dev *unusual_dev; /* device-filter entry */ @@ -158,15 +135,14 @@ struct us_data { /* SCSI interfaces */ struct scsi_cmnd *srb; /* current srb */ - - /* thread information */ - int pid; /* control thread */ + unsigned int tag; /* current dCBWTag */ /* control and bulk communications data */ struct urb *current_urb; /* USB requests */ struct usb_ctrlrequest *cr; /* control requests */ struct usb_sg_request current_sg; /* scatter-gather req. */ unsigned char *iobuf; /* I/O buffer */ + unsigned char *sensebuf; /* sense data buffer */ dma_addr_t cr_dma; /* buffer DMA addresses */ dma_addr_t iobuf_dma; @@ -178,13 +154,16 @@ struct us_data { /* subdriver information */ void *extra; /* Any extra data */ extra_data_destructor extra_destructor;/* extra data destructor */ +#ifdef CONFIG_PM + pm_hook suspend_resume_hook; +#endif }; /* Convert between us_data and the corresponding Scsi_Host */ -static struct Scsi_Host inline *us_to_host(struct us_data *us) { +static inline struct Scsi_Host *us_to_host(struct us_data *us) { return container_of((void *) us, struct Scsi_Host, hostdata); } -static struct us_data inline *host_to_us(struct Scsi_Host *host) { +static inline struct us_data *host_to_us(struct Scsi_Host *host) { return (struct us_data *) host->hostdata; } @@ -197,8 +176,4 @@ extern void fill_inquiry_response(struct us_data *us, #define scsi_unlock(host) spin_unlock_irq(host->host_lock) #define scsi_lock(host) spin_lock_irq(host->host_lock) - -/* Vendor ID list for devices that require special handling */ -#define USB_VENDOR_ID_GENESYS 0x05e3 /* Genesys Logic */ - #endif