diff options
Diffstat (limited to 'include/scsi/scsi_host.h')
-rw-r--r-- | include/scsi/scsi_host.h | 69 |
1 files changed, 64 insertions, 5 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 39c6f8cc20c3..7f1f411d07af 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/workqueue.h> | 7 | #include <linux/workqueue.h> |
8 | #include <linux/mutex.h> | 8 | #include <linux/mutex.h> |
9 | 9 | ||
10 | struct request_queue; | ||
10 | struct block_device; | 11 | struct block_device; |
11 | struct completion; | 12 | struct completion; |
12 | struct module; | 13 | struct module; |
@@ -124,6 +125,39 @@ struct scsi_host_template { | |||
124 | void (*done)(struct scsi_cmnd *)); | 125 | void (*done)(struct scsi_cmnd *)); |
125 | 126 | ||
126 | /* | 127 | /* |
128 | * The transfer functions are used to queue a scsi command to | ||
129 | * the LLD. When the driver is finished processing the command | ||
130 | * the done callback is invoked. | ||
131 | * | ||
132 | * return values: see queuecommand | ||
133 | * | ||
134 | * If the LLD accepts the cmd, it should set the result to an | ||
135 | * appropriate value when completed before calling the done function. | ||
136 | * | ||
137 | * STATUS: REQUIRED FOR TARGET DRIVERS | ||
138 | */ | ||
139 | /* TODO: rename */ | ||
140 | int (* transfer_response)(struct scsi_cmnd *, | ||
141 | void (*done)(struct scsi_cmnd *)); | ||
142 | /* | ||
143 | * This is called to inform the LLD to transfer cmd->request_bufflen | ||
144 | * bytes of the cmd at cmd->offset in the cmd. The cmd->use_sg | ||
145 | * speciefies the number of scatterlist entried in the command | ||
146 | * and cmd->request_buffer contains the scatterlist. | ||
147 | * | ||
148 | * If the command cannot be processed in one transfer_data call | ||
149 | * becuase a scatterlist within the LLD's limits cannot be | ||
150 | * created then transfer_data will be called multiple times. | ||
151 | * It is initially called from process context, and later | ||
152 | * calls are from the interrup context. | ||
153 | */ | ||
154 | int (* transfer_data)(struct scsi_cmnd *, | ||
155 | void (*done)(struct scsi_cmnd *)); | ||
156 | |||
157 | /* Used as callback for the completion of task management request. */ | ||
158 | int (* tsk_mgmt_response)(u64 mid, int result); | ||
159 | |||
160 | /* | ||
127 | * This is an error handling strategy routine. You don't need to | 161 | * This is an error handling strategy routine. You don't need to |
128 | * define one of these if you don't want to - there is a default | 162 | * define one of these if you don't want to - there is a default |
129 | * routine that is present that should work in most cases. For those | 163 | * routine that is present that should work in most cases. For those |
@@ -241,6 +275,24 @@ struct scsi_host_template { | |||
241 | void (* target_destroy)(struct scsi_target *); | 275 | void (* target_destroy)(struct scsi_target *); |
242 | 276 | ||
243 | /* | 277 | /* |
278 | * If a host has the ability to discover targets on its own instead | ||
279 | * of scanning the entire bus, it can fill in this function and | ||
280 | * call scsi_scan_host(). This function will be called periodically | ||
281 | * until it returns 1 with the scsi_host and the elapsed time of | ||
282 | * the scan in jiffies. | ||
283 | * | ||
284 | * Status: OPTIONAL | ||
285 | */ | ||
286 | int (* scan_finished)(struct Scsi_Host *, unsigned long); | ||
287 | |||
288 | /* | ||
289 | * If the host wants to be called before the scan starts, but | ||
290 | * after the midlayer has set up ready for the scan, it can fill | ||
291 | * in this function. | ||
292 | */ | ||
293 | void (* scan_start)(struct Scsi_Host *); | ||
294 | |||
295 | /* | ||
244 | * fill in this function to allow the queue depth of this host | 296 | * fill in this function to allow the queue depth of this host |
245 | * to be changeable (on a per device basis). returns either | 297 | * to be changeable (on a per device basis). returns either |
246 | * the current queue depth setting (may be different from what | 298 | * the current queue depth setting (may be different from what |
@@ -552,6 +604,9 @@ struct Scsi_Host { | |||
552 | /* task mgmt function in progress */ | 604 | /* task mgmt function in progress */ |
553 | unsigned tmf_in_progress:1; | 605 | unsigned tmf_in_progress:1; |
554 | 606 | ||
607 | /* Asynchronous scan in progress */ | ||
608 | unsigned async_scan:1; | ||
609 | |||
555 | /* | 610 | /* |
556 | * Optional work queue to be utilized by the transport | 611 | * Optional work queue to be utilized by the transport |
557 | */ | 612 | */ |
@@ -568,6 +623,12 @@ struct Scsi_Host { | |||
568 | */ | 623 | */ |
569 | unsigned int max_host_blocked; | 624 | unsigned int max_host_blocked; |
570 | 625 | ||
626 | /* | ||
627 | * q used for scsi_tgt msgs, async events or any other requests that | ||
628 | * need to be processed in userspace | ||
629 | */ | ||
630 | struct request_queue *uspace_req_q; | ||
631 | |||
571 | /* legacy crap */ | 632 | /* legacy crap */ |
572 | unsigned long base; | 633 | unsigned long base; |
573 | unsigned long io_port; | 634 | unsigned long io_port; |
@@ -648,11 +709,6 @@ extern const char *scsi_host_state_name(enum scsi_host_state); | |||
648 | 709 | ||
649 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); | 710 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); |
650 | 711 | ||
651 | static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock) | ||
652 | { | ||
653 | shost->host_lock = lock; | ||
654 | } | ||
655 | |||
656 | static inline struct device *scsi_get_device(struct Scsi_Host *shost) | 712 | static inline struct device *scsi_get_device(struct Scsi_Host *shost) |
657 | { | 713 | { |
658 | return shost->shost_gendev.parent; | 714 | return shost->shost_gendev.parent; |
@@ -671,6 +727,9 @@ extern void scsi_unblock_requests(struct Scsi_Host *); | |||
671 | extern void scsi_block_requests(struct Scsi_Host *); | 727 | extern void scsi_block_requests(struct Scsi_Host *); |
672 | 728 | ||
673 | struct class_container; | 729 | struct class_container; |
730 | |||
731 | extern struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | ||
732 | void (*) (struct request_queue *)); | ||
674 | /* | 733 | /* |
675 | * These two functions are used to allocate and free a pseudo device | 734 | * These two functions are used to allocate and free a pseudo device |
676 | * which will connect to the host adapter itself rather than any | 735 | * which will connect to the host adapter itself rather than any |