V4L/DVB: V4L: v4l2-subdev driver for AK8813 and AK8814 TV-encoders from AKM
[safe/jmp/linux-2.6] / include / scsi / scsi_host.h
index d967d6d..c50a97f 100644 (file)
@@ -43,13 +43,12 @@ struct blk_queue_tags;
 #define DISABLE_CLUSTERING 0
 #define ENABLE_CLUSTERING 1
 
-enum scsi_eh_timer_return {
-       EH_NOT_HANDLED,
-       EH_HANDLED,
-       EH_RESET_TIMER,
+enum {
+       SCSI_QDEPTH_DEFAULT,    /* default requested change, e.g. from sysfs */
+       SCSI_QDEPTH_QFULL,      /* scsi-ml requested due to queue full */
+       SCSI_QDEPTH_RAMP_UP,    /* scsi-ml requested due to threshhold event */
 };
 
-
 struct scsi_host_template {
        struct module *module;
        const char *name;
@@ -301,7 +300,7 @@ struct scsi_host_template {
         *
         * Status: OPTIONAL
         */
-       int (* change_queue_depth)(struct scsi_device *, int);
+       int (* change_queue_depth)(struct scsi_device *, int, int);
 
        /*
         * Fill in this function to allow the changing of tag types
@@ -347,7 +346,7 @@ struct scsi_host_template {
         *
         * Status: OPTIONAL
         */
-       enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
+       enum blk_eh_timer_return (*eh_timed_out)(struct scsi_cmnd *);
 
        /*
         * Name of proc directory
@@ -485,6 +484,15 @@ struct scsi_host_template {
         * module_init/module_exit.
         */
        struct list_head legacy_hosts;
+
+       /*
+        * Vendor Identifier associated with the host
+        *
+        * Note: When specifying vendor_id, be sure to read the
+        *   Vendor Type and ID formatting requirements specified in
+        *   scsi_netlink.h
+        */
+       u64 vendor_id;
 };
 
 /*
@@ -547,7 +555,7 @@ struct Scsi_Host {
        unsigned int host_failed;          /* commands that failed. */
        unsigned int host_eh_scheduled;    /* EH scheduled without command */
     
-       unsigned short host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
+       unsigned int host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
        int resetting; /* if set, it means that last_reset is a valid value */
        unsigned long last_reset;
 
@@ -573,13 +581,11 @@ struct Scsi_Host {
        /*
         * The maximum length of SCSI commands that this host can accept.
         * Probably 12 for most host adapters, but could be 16 for others.
+        * or 260 if the driver supports variable length cdbs.
         * For drivers that don't set this field, a value of 12 is
-        * assumed.  I am leaving this as a number rather than a bit
-        * because you never know what subsequent SCSI standards might do
-        * (i.e. could there be a 20 byte or a 24-byte command a few years
-        * down the road?).  
+        * assumed.
         */
-       unsigned char max_cmd_len;
+       unsigned short max_cmd_len;
 
        int this_id;
        int can_queue;
@@ -625,7 +631,7 @@ struct Scsi_Host {
        /*
         * Optional work queue to be utilized by the transport
         */
-       char work_q_name[KOBJ_NAME_LEN];
+       char work_q_name[20];
        struct workqueue_struct *work_q;
 
        /*
@@ -638,6 +644,10 @@ struct Scsi_Host {
         */
        unsigned int max_host_blocked;
 
+       /* Protection Information */
+       unsigned int prot_capabilities;
+       unsigned char prot_guard_type;
+
        /*
         * q used for scsi_tgt msgs, async events or any other requests that
         * need to be processed in userspace
@@ -673,6 +683,12 @@ struct Scsi_Host {
        void *shost_data;
 
        /*
+        * Points to the physical bus device we'd use to do DMA
+        * Needed just in case we have virtual hosts.
+        */
+       struct device *dma_dev;
+
+       /*
         * We should ensure that this is aligned, both for better performance
         * and also because some compilers (m68k) don't automatically force
         * alignment to a long boundary.
@@ -716,7 +732,9 @@ extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
 extern void scsi_flush_work(struct Scsi_Host *);
 
 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
-extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *);
+extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
+                                              struct device *,
+                                              struct device *);
 extern void scsi_scan_host(struct Scsi_Host *);
 extern void scsi_rescan_device(struct device *);
 extern void scsi_remove_host(struct Scsi_Host *);
@@ -727,6 +745,12 @@ extern const char *scsi_host_state_name(enum scsi_host_state);
 
 extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
 
+static inline int __must_check scsi_add_host(struct Scsi_Host *host,
+                                            struct device *dev)
+{
+       return scsi_add_host_with_dma(host, dev, dev);
+}
+
 static inline struct device *scsi_get_device(struct Scsi_Host *shost)
 {
         return shost->shost_gendev.parent;
@@ -758,6 +782,86 @@ extern struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
 extern void scsi_free_host_dev(struct scsi_device *);
 extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *);
 
+/*
+ * DIF defines the exchange of protection information between
+ * initiator and SBC block device.
+ *
+ * DIX defines the exchange of protection information between OS and
+ * initiator.
+ */
+enum scsi_host_prot_capabilities {
+       SHOST_DIF_TYPE1_PROTECTION = 1 << 0, /* T10 DIF Type 1 */
+       SHOST_DIF_TYPE2_PROTECTION = 1 << 1, /* T10 DIF Type 2 */
+       SHOST_DIF_TYPE3_PROTECTION = 1 << 2, /* T10 DIF Type 3 */
+
+       SHOST_DIX_TYPE0_PROTECTION = 1 << 3, /* DIX between OS and HBA only */
+       SHOST_DIX_TYPE1_PROTECTION = 1 << 4, /* DIX with DIF Type 1 */
+       SHOST_DIX_TYPE2_PROTECTION = 1 << 5, /* DIX with DIF Type 2 */
+       SHOST_DIX_TYPE3_PROTECTION = 1 << 6, /* DIX with DIF Type 3 */
+};
+
+/*
+ * SCSI hosts which support the Data Integrity Extensions must
+ * indicate their capabilities by setting the prot_capabilities using
+ * this call.
+ */
+static inline void scsi_host_set_prot(struct Scsi_Host *shost, unsigned int mask)
+{
+       shost->prot_capabilities = mask;
+}
+
+static inline unsigned int scsi_host_get_prot(struct Scsi_Host *shost)
+{
+       return shost->prot_capabilities;
+}
+
+static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type)
+{
+       static unsigned char cap[] = { 0,
+                                      SHOST_DIF_TYPE1_PROTECTION,
+                                      SHOST_DIF_TYPE2_PROTECTION,
+                                      SHOST_DIF_TYPE3_PROTECTION };
+
+       return shost->prot_capabilities & cap[target_type] ? target_type : 0;
+}
+
+static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsigned int target_type)
+{
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+       static unsigned char cap[] = { SHOST_DIX_TYPE0_PROTECTION,
+                                      SHOST_DIX_TYPE1_PROTECTION,
+                                      SHOST_DIX_TYPE2_PROTECTION,
+                                      SHOST_DIX_TYPE3_PROTECTION };
+
+       return shost->prot_capabilities & cap[target_type];
+#endif
+       return 0;
+}
+
+/*
+ * All DIX-capable initiators must support the T10-mandated CRC
+ * checksum.  Controllers can optionally implement the IP checksum
+ * scheme which has much lower impact on system performance.  Note
+ * that the main rationale for the checksum is to match integrity
+ * metadata with data.  Detecting bit errors are a job for ECC memory
+ * and buses.
+ */
+
+enum scsi_host_guard_type {
+       SHOST_DIX_GUARD_CRC = 1 << 0,
+       SHOST_DIX_GUARD_IP  = 1 << 1,
+};
+
+static inline void scsi_host_set_guard(struct Scsi_Host *shost, unsigned char type)
+{
+       shost->prot_guard_type = type;
+}
+
+static inline unsigned char scsi_host_get_guard(struct Scsi_Host *shost)
+{
+       return shost->prot_guard_type;
+}
+
 /* legacy interfaces */
 extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int);
 extern void scsi_unregister(struct Scsi_Host *);