Merge with Linux 2.5.74.
[linux-2.6/linux-mips.git] / include / scsi / scsi_device.h
blobc49c124fde7471f20557bd284cfe4eb088389c5e
1 #ifndef _SCSI_SCSI_DEVICE_H
2 #define _SCSI_SCSI_DEVICE_H
4 #include <linux/device.h>
5 #include <linux/list.h>
6 #include <linux/spinlock.h>
8 struct request_queue;
9 struct scsi_cmnd;
10 struct scsi_mode_data;
13 struct scsi_device {
14 struct class_device sdev_classdev;
16 struct list_head siblings; /* list of all devices on this host */
17 struct list_head same_target_siblings; /* just the devices sharing same target id */
18 struct Scsi_Host *host;
19 struct request_queue *request_queue;
20 volatile unsigned short device_busy; /* commands actually active on low-level */
21 spinlock_t sdev_lock; /* also the request queue_lock */
22 spinlock_t list_lock;
23 struct list_head cmd_list; /* queue of in use SCSI Command structures */
24 struct list_head starved_entry;
25 struct scsi_cmnd *current_cmnd; /* currently active command */
26 unsigned short queue_depth; /* How deep of a queue we want */
27 unsigned short last_queue_full_depth; /* These two are used by */
28 unsigned short last_queue_full_count; /* scsi_track_queue_full() */
29 unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same
30 jiffie count on our counter, they
31 could all be from the same event. */
33 unsigned int id, lun, channel;
35 unsigned int manufacturer; /* Manufacturer of device, for using
36 * vendor-specific cmd's */
37 unsigned sector_size; /* size in bytes */
39 int access_count; /* Count of open channels/mounts */
41 void *hostdata; /* available to low-level driver */
42 char devfs_name[256]; /* devfs junk */
43 char type;
44 char scsi_level;
45 unsigned char inquiry_len; /* valid bytes in 'inquiry' */
46 unsigned char * inquiry; /* INQUIRY response data */
47 char * vendor; /* [back_compat] point into 'inquiry' ... */
48 char * model; /* ... after scan; point to static string */
49 char * rev; /* ... "nullnullnullnull" before scan */
50 unsigned char current_tag; /* current tag */
51 struct scsi_target *sdev_target; /* used only for single_lun */
53 unsigned online:1;
55 unsigned writeable:1;
56 unsigned removable:1;
57 unsigned changed:1; /* Data invalid due to media change */
58 unsigned busy:1; /* Used to prevent races */
59 unsigned lockable:1; /* Able to prevent media removal */
60 unsigned locked:1; /* Media removal disabled */
61 unsigned borken:1; /* Tell the Seagate driver to be
62 * painfully slow on this device */
63 unsigned disconnect:1; /* can disconnect */
64 unsigned soft_reset:1; /* Uses soft reset option */
65 unsigned sdtr:1; /* Device supports SDTR messages */
66 unsigned wdtr:1; /* Device supports WDTR messages */
67 unsigned ppr:1; /* Device supports PPR messages */
68 unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */
69 unsigned tagged_queue:1;/* This is going away!!!! Look at simple_tags
70 instead!!! Please fix your driver now!! */
71 unsigned simple_tags:1; /* simple queue tag messages are enabled */
72 unsigned ordered_tags:1;/* ordered queue tag messages are enabled */
73 unsigned single_lun:1; /* Indicates we should only allow I/O to
74 * one of the luns for the device at a
75 * time. */
76 unsigned was_reset:1; /* There was a bus reset on the bus for
77 * this device */
78 unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN
79 * because we did a bus reset. */
80 unsigned use_10_for_rw:1; /* first try 10-byte read / write */
81 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
82 unsigned no_start_on_add:1; /* do not issue start on add */
84 unsigned int device_blocked; /* Device returned QUEUE_FULL. */
86 unsigned int max_device_blocked; /* what device_blocked counts down from */
87 #define SCSI_DEFAULT_DEVICE_BLOCKED 3
89 struct device sdev_driverfs_dev;
91 #define to_scsi_device(d) \
92 container_of(d, struct scsi_device, sdev_driverfs_dev)
94 extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
95 uint, uint, uint);
96 extern int scsi_remove_device(struct scsi_device *);
97 extern void scsi_set_device_offline(struct scsi_device *);
99 extern int scsi_device_get(struct scsi_device *);
100 extern void scsi_device_put(struct scsi_device *);
102 extern void scsi_adjust_queue_depth(struct scsi_device *, int, int);
103 extern int scsi_track_queue_full(struct scsi_device *, int);
105 extern int scsi_set_medium_removal(struct scsi_device *, char);
107 extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
108 unsigned char *buffer, int len, int timeout,
109 int retries, struct scsi_mode_data *data);
111 #endif /* _SCSI_SCSI_DEVICE_H */