Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
[pandora-kernel.git] / drivers / scsi / qla2xxx / qla_def.h
index edb7a70..8396109 100644 (file)
@@ -35,7 +35,8 @@
 
 #include "qla_bsg.h"
 #include "qla_nx.h"
-#define QLA2XXX_DRIVER_NAME  "qla2xxx"
+#define QLA2XXX_DRIVER_NAME    "qla2xxx"
+#define QLA2XXX_APIDEV         "ql2xapidev"
 
 /*
  * We have MAILBOX_REGISTER_COUNT sized arrays in a few places,
 
 struct req_que;
 
+/*
+ * (sd.h is not exported, hence local inclusion)
+ * Data Integrity Field tuple.
+ */
+struct sd_dif_tuple {
+       __be16 guard_tag;       /* Checksum */
+       __be16 app_tag;         /* Opaque storage */
+       __be32 ref_tag;         /* Target LBA or indirect LBA */
+};
+
 /*
  * SCSI Request Block
  */
@@ -207,41 +218,73 @@ typedef struct srb {
 /*
  * SRB flag definitions
  */
-#define SRB_DMA_VALID          BIT_0   /* Command sent to ISP */
-#define SRB_FCP_CMND_DMA_VALID BIT_12  /* FCP command in IOCB */
+#define SRB_DMA_VALID                  BIT_0   /* Command sent to ISP */
+#define SRB_FCP_CMND_DMA_VALID         BIT_12  /* DIF: DSD List valid */
+#define SRB_CRC_CTX_DMA_VALID          BIT_2   /* DIF: context DMA valid */
+#define SRB_CRC_PROT_DMA_VALID         BIT_4   /* DIF: prot DMA valid */
+#define SRB_CRC_CTX_DSD_VALID          BIT_5   /* DIF: dsd_list valid */
+
+/* To identify if a srb is of T10-CRC type. @sp => srb_t pointer */
+#define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID)
 
 /*
  * SRB extensions.
  */
-struct srb_ctx {
-#define SRB_LOGIN_CMD  1
-#define SRB_LOGOUT_CMD 2
-       uint16_t type;
-       struct timer_list timer;
-
-       void (*free)(srb_t *sp);
-       void (*timeout)(srb_t *sp);
-};
-
-struct srb_logio {
-       struct srb_ctx ctx;
-
+struct srb_iocb {
+       union {
+               struct {
+                       uint16_t flags;
 #define SRB_LOGIN_RETRIED      BIT_0
 #define SRB_LOGIN_COND_PLOGI   BIT_1
 #define SRB_LOGIN_SKIP_PRLI    BIT_2
-       uint16_t flags;
+                       uint16_t data[2];
+               } logio;
+               struct {
+                       /*
+                        * Values for flags field below are as
+                        * defined in tsk_mgmt_entry struct
+                        * for control_flags field in qla_fw.h.
+                        */
+                       uint32_t flags;
+                       uint32_t lun;
+                       uint32_t data;
+               } tmf;
+               struct {
+                       /*
+                        * values for modif field below are as
+                        * defined in mrk_entry_24xx struct
+                        * for the modifier field in qla_fw.h.
+                        */
+                       uint8_t modif;
+                       uint16_t lun;
+                       uint32_t data;
+               } marker;
+       } u;
+
+       struct timer_list timer;
+
+       void (*done)(srb_t *);
+       void (*free)(srb_t *);
+       void (*timeout)(srb_t *);
 };
 
-struct srb_bsg_ctx {
+/* Values for srb_ctx type */
+#define SRB_LOGIN_CMD  1
+#define SRB_LOGOUT_CMD 2
 #define SRB_ELS_CMD_RPT 3
 #define SRB_ELS_CMD_HST 4
-#define SRB_CT_CMD 5
-       uint16_t type;
-};
+#define SRB_CT_CMD     5
+#define SRB_ADISC_CMD  6
+#define SRB_TM_CMD     7
+#define SRB_MARKER_CMD 8
 
-struct srb_bsg {
-       struct srb_bsg_ctx ctx;
-       struct fc_bsg_job *bsg_job;
+struct srb_ctx {
+       uint16_t type;
+       char *name;
+       union {
+               struct srb_iocb *iocb_cmd;
+               struct fc_bsg_job *bsg_job;
+       } u;
 };
 
 struct msg_echo_lb {
@@ -1303,6 +1346,66 @@ typedef struct {
        uint32_t dseg_4_length;         /* Data segment 4 length. */
 } cont_a64_entry_t;
 
+#define PO_MODE_DIF_INSERT     0
+#define PO_MODE_DIF_REMOVE     BIT_0
+#define PO_MODE_DIF_PASS       BIT_1
+#define PO_MODE_DIF_REPLACE    (BIT_0 + BIT_1)
+#define PO_ENABLE_DIF_BUNDLING BIT_8
+#define PO_ENABLE_INCR_GUARD_SEED      BIT_3
+#define PO_DISABLE_INCR_REF_TAG        BIT_5
+#define PO_DISABLE_GUARD_CHECK BIT_4
+/*
+ * ISP queue - 64-Bit addressing, continuation crc entry structure definition.
+ */
+struct crc_context {
+       uint32_t handle;                /* System handle. */
+       uint32_t ref_tag;
+       uint16_t app_tag;
+       uint8_t ref_tag_mask[4];        /* Validation/Replacement Mask*/
+       uint8_t app_tag_mask[2];        /* Validation/Replacement Mask*/
+       uint16_t guard_seed;            /* Initial Guard Seed */
+       uint16_t prot_opts;             /* Requested Data Protection Mode */
+       uint16_t blk_size;              /* Data size in bytes */
+       uint16_t runt_blk_guard;        /* Guard value for runt block (tape
+                                        * only) */
+       uint32_t byte_count;            /* Total byte count/ total data
+                                        * transfer count */
+       union {
+               struct {
+                       uint32_t        reserved_1;
+                       uint16_t        reserved_2;
+                       uint16_t        reserved_3;
+                       uint32_t        reserved_4;
+                       uint32_t        data_address[2];
+                       uint32_t        data_length;
+                       uint32_t        reserved_5[2];
+                       uint32_t        reserved_6;
+               } nobundling;
+               struct {
+                       uint32_t        dif_byte_count; /* Total DIF byte
+                                                        * count */
+                       uint16_t        reserved_1;
+                       uint16_t        dseg_count;     /* Data segment count */
+                       uint32_t        reserved_2;
+                       uint32_t        data_address[2];
+                       uint32_t        data_length;
+                       uint32_t        dif_address[2];
+                       uint32_t        dif_length;     /* Data segment 0
+                                                        * length */
+               } bundling;
+       } u;
+
+       struct fcp_cmnd fcp_cmnd;
+       dma_addr_t      crc_ctx_dma;
+       /* List of DMA context transfers */
+       struct list_head dsd_list;
+
+       /* This structure should not exceed 512 bytes */
+};
+
+#define CRC_CONTEXT_LEN_FW     (offsetof(struct crc_context, fcp_cmnd.lun))
+#define CRC_CONTEXT_FCPCMND_OFF        (offsetof(struct crc_context, fcp_cmnd.lun))
+
 /*
  * ISP queue - status entry structure definition.
  */
@@ -1363,6 +1466,7 @@ typedef struct {
 #define CS_ABORTED             0x5     /* System aborted command. */
 #define CS_TIMEOUT             0x6     /* Timeout error. */
 #define CS_DATA_OVERRUN                0x7     /* Data overrun. */
+#define CS_DIF_ERROR           0xC     /* DIF error detected  */
 
 #define CS_DATA_UNDERRUN       0x15    /* Data Underrun. */
 #define CS_QUEUE_FULL          0x1C    /* Queue Full. */
@@ -1617,6 +1721,7 @@ typedef struct fc_port {
 #define FCF_FABRIC_DEVICE      BIT_0
 #define FCF_LOGIN_NEEDED       BIT_1
 #define FCF_FCP2_DEVICE                BIT_2
+#define FCF_ASYNC_SENT         BIT_3
 
 /* No loop ID flag. */
 #define FC_NO_LOOP_ID          0x1000
@@ -2150,6 +2255,8 @@ enum qla_work_type {
        QLA_EVT_ASYNC_LOGIN_DONE,
        QLA_EVT_ASYNC_LOGOUT,
        QLA_EVT_ASYNC_LOGOUT_DONE,
+       QLA_EVT_ASYNC_ADISC,
+       QLA_EVT_ASYNC_ADISC_DONE,
        QLA_EVT_UEVENT,
 };
 
@@ -2508,6 +2615,9 @@ struct qla_hw_data {
        dma_addr_t      ex_init_cb_dma;
        struct ex_init_cb_81xx *ex_init_cb;
 
+       void            *async_pd;
+       dma_addr_t      async_pd_dma;
+
        /* These are used by mailbox operations. */
        volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
 
@@ -2654,8 +2764,6 @@ struct qla_hw_data {
        unsigned long   nx_pcibase;             /* Base I/O address */
        uint8_t         *nxdb_rd_ptr;           /* Doorbell read pointer */
        unsigned long   nxdb_wr_ptr;            /* Door bell write pointer */
-       unsigned long   first_page_group_start;
-       unsigned long   first_page_group_end;
 
        uint32_t        crb_win;
        uint32_t        curr_window;
@@ -2699,6 +2807,7 @@ typedef struct scsi_qla_host {
 
                uint32_t        management_server_logged_in :1;
                uint32_t        process_response_queue  :1;
+               uint32_t        difdix_supported:1;
        } flags;
 
        atomic_t        loop_state;
@@ -2850,6 +2959,8 @@ typedef struct scsi_qla_host {
 #define OPTROM_BURST_SIZE      0x1000
 #define OPTROM_BURST_DWORDS    (OPTROM_BURST_SIZE / 4)
 
+#define        QLA_DSDS_PER_IOCB       37
+
 #include "qla_gbl.h"
 #include "qla_dbg.h"
 #include "qla_inline.h"