]> err.no Git - linux-2.6/blobdiff - include/scsi/scsi_host.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6] / include / scsi / scsi_host.h
index 6d8945d71c65af1cc8cf847a86be4454123f57c2..0fd4746ee39d4437e788c37b9a7f59d9b65dc11a 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/workqueue.h>
 #include <linux/mutex.h>
 
+struct request_queue;
 struct block_device;
 struct completion;
 struct module;
@@ -31,10 +32,16 @@ struct blk_queue_tags;
 #define SG_NONE 0
 #define SG_ALL 0xff
 
+#define MODE_UNKNOWN 0x00
+#define MODE_INITIATOR 0x01
+#define MODE_TARGET 0x02
 
 #define DISABLE_CLUSTERING 0
 #define ENABLE_CLUSTERING 1
 
+#define DISABLE_SG_CHAINING 0
+#define ENABLE_SG_CHAINING 1
+
 enum scsi_eh_timer_return {
        EH_NOT_HANDLED,
        EH_HANDLED,
@@ -123,6 +130,27 @@ struct scsi_host_template {
        int (* queuecommand)(struct scsi_cmnd *,
                             void (*done)(struct scsi_cmnd *));
 
+       /*
+        * The transfer functions are used to queue a scsi command to
+        * the LLD. When the driver is finished processing the command
+        * the done callback is invoked.
+        *
+        * This is called to inform the LLD to transfer
+        * cmd->request_bufflen bytes. The cmd->use_sg speciefies the
+        * number of scatterlist entried in the command and
+        * cmd->request_buffer contains the scatterlist.
+        *
+        * return values: see queuecommand
+        *
+        * If the LLD accepts the cmd, it should set the result to an
+        * appropriate value when completed before calling the done function.
+        *
+        * STATUS: REQUIRED FOR TARGET DRIVERS
+        */
+       /* TODO: rename */
+       int (* transfer_response)(struct scsi_cmnd *,
+                                 void (*done)(struct scsi_cmnd *));
+
        /*
         * This is an error handling strategy routine.  You don't need to
         * define one of these if you don't want to - there is a default
@@ -301,15 +329,22 @@ struct scsi_host_template {
        int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
 
        /*
-        * suspend support
+        * This is an optional routine that allows the transport to become
+        * involved when a scsi io timer fires. The return value tells the
+        * timer routine how to finish the io timeout handling:
+        * EH_HANDLED:          I fixed the error, please complete the command
+        * EH_RESET_TIMER:      I need more time, reset the timer and
+        *                      begin counting again
+        * EH_NOT_HANDLED       Begin normal error recovery
+        *
+        * Status: OPTIONAL
         */
-       int (*resume)(struct scsi_device *);
-       int (*suspend)(struct scsi_device *, pm_message_t state);
+       enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
 
        /*
         * Name of proc directory
         */
-       char *proc_name;
+       const char *proc_name;
 
        /*
         * Used to store the procfs directory if a driver implements the
@@ -375,6 +410,11 @@ struct scsi_host_template {
         */
        unsigned char present;
 
+       /*
+        * This specifies the mode that a LLD supports.
+        */
+       unsigned supported_mode:2;
+
        /*
         * true if this host adapter uses unchecked DMA onto an ISA bus.
         */
@@ -405,6 +445,15 @@ struct scsi_host_template {
         */
        unsigned ordered_tag:1;
 
+       /*
+        * true if the low-level driver can support sg chaining. this
+        * will be removed eventually when all the drivers are
+        * converted to support sg chaining.
+        *
+        * Status: OBSOLETE
+        */
+       unsigned use_sg_chaining:1;
+
        /*
         * Countdown for host blocking with no commands outstanding
         */
@@ -543,11 +592,13 @@ struct Scsi_Host {
         * Used to assign serial numbers to the cmds.
         * Protected by the host lock.
         */
-       unsigned long cmd_serial_number, cmd_pid; 
+       unsigned long cmd_serial_number;
        
+       unsigned active_mode:2;
        unsigned unchecked_isa_dma:1;
        unsigned use_clustering:1;
        unsigned use_blk_tcq:1;
+       unsigned use_sg_chaining:1;
 
        /*
         * Host has requested that no further requests come through for the
@@ -589,6 +640,12 @@ struct Scsi_Host {
         */
        unsigned int max_host_blocked;
 
+       /*
+        * q used for scsi_tgt msgs, async events or any other requests that
+        * need to be processed in userspace
+        */
+       struct request_queue *uspace_req_q;
+
        /* legacy crap */
        unsigned long base;
        unsigned long io_port;
@@ -633,6 +690,10 @@ struct Scsi_Host {
 #define shost_printk(prefix, shost, fmt, a...) \
        dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
 
+static inline void *shost_priv(struct Scsi_Host *shost)
+{
+       return (void *)shost->hostdata;
+}
 
 int scsi_is_host_device(const struct device *);
 
@@ -687,6 +748,9 @@ extern void scsi_unblock_requests(struct Scsi_Host *);
 extern void scsi_block_requests(struct Scsi_Host *);
 
 struct class_container;
+
+extern struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
+                                               void (*) (struct request_queue *));
 /*
  * These two functions are used to allocate and free a pseudo device
  * which will connect to the host adapter itself rather than any