aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-08 05:39:55 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-08 05:39:55 -0400
commitc324b44c34050cf2a9b58830e11c974806bd85d8 (patch)
tree3ac45a783221283925cd698334a8f5e7dd4c1df8 /include/scsi
parent2fcf522509cceea524b6e7ece8fd6759b682175a (diff)
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_cmnd.h8
-rw-r--r--include/scsi/scsi_dbg.h2
-rw-r--r--include/scsi/scsi_device.h22
-rw-r--r--include/scsi/scsi_eh.h11
-rw-r--r--include/scsi/scsi_host.h26
-rw-r--r--include/scsi/scsi_request.h16
-rw-r--r--include/scsi/scsi_transport_spi.h6
7 files changed, 61 insertions, 30 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 9957f16dcc5d..bed4b7c9be99 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -51,12 +51,16 @@ struct scsi_cmnd {
51 * printk's to use ->pid, so that we can kill this field. 51 * printk's to use ->pid, so that we can kill this field.
52 */ 52 */
53 unsigned long serial_number; 53 unsigned long serial_number;
54 /*
55 * This is set to jiffies as it was when the command was first
56 * allocated. It is used to time how long the command has
57 * been outstanding
58 */
59 unsigned long jiffies_at_alloc;
54 60
55 int retries; 61 int retries;
56 int allowed; 62 int allowed;
57 int timeout_per_command; 63 int timeout_per_command;
58 int timeout_total;
59 int timeout;
60 64
61 unsigned char cmd_len; 65 unsigned char cmd_len;
62 unsigned char old_cmd_len; 66 unsigned char old_cmd_len;
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 12e90934a7a8..b090a11d7e1c 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -3,8 +3,10 @@
3 3
4struct scsi_cmnd; 4struct scsi_cmnd;
5struct scsi_request; 5struct scsi_request;
6struct scsi_sense_hdr;
6 7
7extern void scsi_print_command(struct scsi_cmnd *); 8extern void scsi_print_command(struct scsi_cmnd *);
9extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
8extern void __scsi_print_command(unsigned char *); 10extern void __scsi_print_command(unsigned char *);
9extern void scsi_print_sense(const char *, struct scsi_cmnd *); 11extern void scsi_print_sense(const char *, struct scsi_cmnd *);
10extern void scsi_print_req_sense(const char *, struct scsi_request *); 12extern void scsi_print_req_sense(const char *, struct scsi_request *);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 835af8ecbb7c..da63722c0123 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -8,8 +8,17 @@
8 8
9struct request_queue; 9struct request_queue;
10struct scsi_cmnd; 10struct scsi_cmnd;
11struct scsi_mode_data;
12struct scsi_lun; 11struct scsi_lun;
12struct scsi_sense_hdr;
13
14struct scsi_mode_data {
15 __u32 length;
16 __u16 block_descriptor_length;
17 __u8 medium_type;
18 __u8 device_specific;
19 __u8 header_length;
20 __u8 longlba:1;
21};
13 22
14/* 23/*
15 * sdev state: If you alter this, you also need to alter scsi_sysfs.c 24 * sdev state: If you alter this, you also need to alter scsi_sysfs.c
@@ -228,7 +237,8 @@ extern int scsi_set_medium_removal(struct scsi_device *, char);
228 237
229extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, 238extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
230 unsigned char *buffer, int len, int timeout, 239 unsigned char *buffer, int len, int timeout,
231 int retries, struct scsi_mode_data *data); 240 int retries, struct scsi_mode_data *data,
241 struct scsi_sense_hdr *);
232extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, 242extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
233 int retries); 243 int retries);
234extern int scsi_device_set_state(struct scsi_device *sdev, 244extern int scsi_device_set_state(struct scsi_device *sdev,
@@ -247,6 +257,14 @@ extern void int_to_scsilun(unsigned int, struct scsi_lun *);
247extern const char *scsi_device_state_name(enum scsi_device_state); 257extern const char *scsi_device_state_name(enum scsi_device_state);
248extern int scsi_is_sdev_device(const struct device *); 258extern int scsi_is_sdev_device(const struct device *);
249extern int scsi_is_target_device(const struct device *); 259extern int scsi_is_target_device(const struct device *);
260extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
261 int data_direction, void *buffer, unsigned bufflen,
262 unsigned char *sense, int timeout, int retries,
263 int flag);
264extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
265 int data_direction, void *buffer, unsigned bufflen,
266 struct scsi_sense_hdr *, int timeout, int retries);
267
250static inline int scsi_device_online(struct scsi_device *sdev) 268static inline int scsi_device_online(struct scsi_device *sdev)
251{ 269{
252 return sdev->sdev_state != SDEV_OFFLINE; 270 return sdev->sdev_state != SDEV_OFFLINE;
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 80557f879e3e..fabd879c2f2e 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -26,10 +26,15 @@ struct scsi_sense_hdr { /* See SPC-3 section 4.5 */
26 u8 additional_length; /* always 0 for fixed sense format */ 26 u8 additional_length; /* always 0 for fixed sense format */
27}; 27};
28 28
29static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr)
30{
31 if (!sshdr)
32 return 0;
33
34 return (sshdr->response_code & 0x70) == 0x70;
35}
36
29 37
30extern void scsi_add_timer(struct scsi_cmnd *, int,
31 void (*)(struct scsi_cmnd *));
32extern int scsi_delete_timer(struct scsi_cmnd *);
33extern void scsi_report_bus_reset(struct Scsi_Host *, int); 38extern void scsi_report_bus_reset(struct Scsi_Host *, int);
34extern void scsi_report_device_reset(struct Scsi_Host *, int, int); 39extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
35extern int scsi_block_when_processing_errors(struct scsi_device *); 40extern int scsi_block_when_processing_errors(struct scsi_device *);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 81d5234f6771..916144be208b 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -429,12 +429,15 @@ struct scsi_host_template {
429}; 429};
430 430
431/* 431/*
432 * shost states 432 * shost state: If you alter this, you also need to alter scsi_sysfs.c
433 * (for the ascii descriptions) and the state model enforcer:
434 * scsi_host_set_state()
433 */ 435 */
434enum { 436enum scsi_host_state {
435 SHOST_ADD, 437 SHOST_CREATED = 1,
436 SHOST_DEL, 438 SHOST_RUNNING,
437 SHOST_CANCEL, 439 SHOST_CANCEL,
440 SHOST_DEL,
438 SHOST_RECOVERY, 441 SHOST_RECOVERY,
439}; 442};
440 443
@@ -464,12 +467,10 @@ struct Scsi_Host {
464 struct task_struct * ehandler; /* Error recovery thread. */ 467 struct task_struct * ehandler; /* Error recovery thread. */
465 struct semaphore * eh_wait; /* The error recovery thread waits 468 struct semaphore * eh_wait; /* The error recovery thread waits
466 on this. */ 469 on this. */
467 struct completion * eh_notify; /* wait for eh to begin or end */
468 struct semaphore * eh_action; /* Wait for specific actions on the 470 struct semaphore * eh_action; /* Wait for specific actions on the
469 host. */ 471 host. */
470 unsigned int eh_active:1; /* Indicates the eh thread is awake and active if 472 unsigned int eh_active:1; /* Indicates the eh thread is awake and active if
471 this is true. */ 473 this is true. */
472 unsigned int eh_kill:1; /* set when killing the eh thread */
473 wait_queue_head_t host_wait; 474 wait_queue_head_t host_wait;
474 struct scsi_host_template *hostt; 475 struct scsi_host_template *hostt;
475 struct scsi_transport_template *transportt; 476 struct scsi_transport_template *transportt;
@@ -575,7 +576,7 @@ struct Scsi_Host {
575 unsigned int irq; 576 unsigned int irq;
576 577
577 578
578 unsigned long shost_state; 579 enum scsi_host_state shost_state;
579 580
580 /* ldm bits */ 581 /* ldm bits */
581 struct device shost_gendev; 582 struct device shost_gendev;
@@ -633,6 +634,7 @@ extern void scsi_remove_host(struct Scsi_Host *);
633extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); 634extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
634extern void scsi_host_put(struct Scsi_Host *t); 635extern void scsi_host_put(struct Scsi_Host *t);
635extern struct Scsi_Host *scsi_host_lookup(unsigned short); 636extern struct Scsi_Host *scsi_host_lookup(unsigned short);
637extern const char *scsi_host_state_name(enum scsi_host_state);
636 638
637extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 639extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
638 640
@@ -646,6 +648,15 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost)
646 return shost->shost_gendev.parent; 648 return shost->shost_gendev.parent;
647} 649}
648 650
651/**
652 * scsi_host_scan_allowed - Is scanning of this host allowed
653 * @shost: Pointer to Scsi_Host.
654 **/
655static inline int scsi_host_scan_allowed(struct Scsi_Host *shost)
656{
657 return shost->shost_state == SHOST_RUNNING;
658}
659
649extern void scsi_unblock_requests(struct Scsi_Host *); 660extern void scsi_unblock_requests(struct Scsi_Host *);
650extern void scsi_block_requests(struct Scsi_Host *); 661extern void scsi_block_requests(struct Scsi_Host *);
651 662
@@ -663,5 +674,6 @@ extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *);
663/* legacy interfaces */ 674/* legacy interfaces */
664extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); 675extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int);
665extern void scsi_unregister(struct Scsi_Host *); 676extern void scsi_unregister(struct Scsi_Host *);
677extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state);
666 678
667#endif /* _SCSI_SCSI_HOST_H */ 679#endif /* _SCSI_SCSI_HOST_H */
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h
index 98719407d554..6a140020d7cb 100644
--- a/include/scsi/scsi_request.h
+++ b/include/scsi/scsi_request.h
@@ -54,20 +54,4 @@ extern void scsi_do_req(struct scsi_request *, const void *cmnd,
54 void *buffer, unsigned bufflen, 54 void *buffer, unsigned bufflen,
55 void (*done) (struct scsi_cmnd *), 55 void (*done) (struct scsi_cmnd *),
56 int timeout, int retries); 56 int timeout, int retries);
57
58struct scsi_mode_data {
59 __u32 length;
60 __u16 block_descriptor_length;
61 __u8 medium_type;
62 __u8 device_specific;
63 __u8 header_length;
64 __u8 longlba:1;
65};
66
67extern int __scsi_mode_sense(struct scsi_request *SRpnt, int dbd,
68 int modepage, unsigned char *buffer, int len,
69 int timeout, int retries,
70 struct scsi_mode_data *data);
71
72
73#endif /* _SCSI_SCSI_REQUEST_H */ 57#endif /* _SCSI_SCSI_REQUEST_H */
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index a30d6cd4c0e8..6bdc4afb2483 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -39,6 +39,7 @@ struct spi_transport_attrs {
39 unsigned int rd_strm:1; /* Read streaming enabled */ 39 unsigned int rd_strm:1; /* Read streaming enabled */
40 unsigned int rti:1; /* Retain Training Information */ 40 unsigned int rti:1; /* Retain Training Information */
41 unsigned int pcomp_en:1;/* Precompensation enabled */ 41 unsigned int pcomp_en:1;/* Precompensation enabled */
42 unsigned int hold_mcs:1;/* Hold Margin Control Settings */
42 unsigned int initial_dv:1; /* DV done to this target yet */ 43 unsigned int initial_dv:1; /* DV done to this target yet */
43 unsigned long flags; /* flags field for drivers to use */ 44 unsigned long flags; /* flags field for drivers to use */
44 /* Device Properties fields */ 45 /* Device Properties fields */
@@ -78,6 +79,7 @@ struct spi_host_attrs {
78#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) 79#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm)
79#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) 80#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti)
80#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en) 81#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en)
82#define spi_hold_mcs(x) (((struct spi_transport_attrs *)&(x)->starget_data)->hold_mcs)
81#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv) 83#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv)
82 84
83#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync) 85#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync)
@@ -114,8 +116,11 @@ struct spi_function_template {
114 void (*set_rti)(struct scsi_target *, int); 116 void (*set_rti)(struct scsi_target *, int);
115 void (*get_pcomp_en)(struct scsi_target *); 117 void (*get_pcomp_en)(struct scsi_target *);
116 void (*set_pcomp_en)(struct scsi_target *, int); 118 void (*set_pcomp_en)(struct scsi_target *, int);
119 void (*get_hold_mcs)(struct scsi_target *);
120 void (*set_hold_mcs)(struct scsi_target *, int);
117 void (*get_signalling)(struct Scsi_Host *); 121 void (*get_signalling)(struct Scsi_Host *);
118 void (*set_signalling)(struct Scsi_Host *, enum spi_signal_type); 122 void (*set_signalling)(struct Scsi_Host *, enum spi_signal_type);
123 int (*deny_binding)(struct scsi_target *);
119 /* The driver sets these to tell the transport class it 124 /* The driver sets these to tell the transport class it
120 * wants the attributes displayed in sysfs. If the show_ flag 125 * wants the attributes displayed in sysfs. If the show_ flag
121 * is not set, the attribute will be private to the transport 126 * is not set, the attribute will be private to the transport
@@ -130,6 +135,7 @@ struct spi_function_template {
130 unsigned long show_rd_strm:1; 135 unsigned long show_rd_strm:1;
131 unsigned long show_rti:1; 136 unsigned long show_rti:1;
132 unsigned long show_pcomp_en:1; 137 unsigned long show_pcomp_en:1;
138 unsigned long show_hold_mcs:1;
133}; 139};
134 140
135struct scsi_transport_template *spi_attach_transport(struct spi_function_template *); 141struct scsi_transport_template *spi_attach_transport(struct spi_function_template *);