OSDN Git Service

[SCSI] qla2xxx: Support for loading Unified ROM Image (URI) format firmware file.
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / scsi / qla2xxx / qla_def.h
index 08f5fd5..f0e792a 100644 (file)
 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
  */
 typedef struct srb {
+       atomic_t ref_count;
        struct fc_port *fcport;
        uint32_t handle;
 
@@ -208,8 +219,14 @@ 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.
@@ -223,6 +240,26 @@ struct srb_iocb {
 #define SRB_LOGIN_SKIP_PRLI    BIT_2
                        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;
@@ -239,6 +276,8 @@ struct srb_iocb {
 #define SRB_ELS_CMD_HST 4
 #define SRB_CT_CMD     5
 #define SRB_ADISC_CMD  6
+#define SRB_TM_CMD     7
+#define SRB_MARKER_CMD 8
 
 struct srb_ctx {
        uint16_t type;
@@ -675,6 +714,8 @@ typedef struct {
 #define MBC_SEND_RNFT_ELS              0x5e    /* Send RNFT ELS request */
 #define MBC_GET_LINK_PRIV_STATS                0x6d    /* Get link & private data. */
 #define MBC_SET_VENDOR_ID              0x76    /* Set Vendor ID. */
+#define MBC_SET_PORT_CONFIG            0x122   /* Set port configuration */
+#define MBC_GET_PORT_CONFIG            0x123   /* Get port configuration */
 
 /* Firmware return data sizes */
 #define FCAL_MAP_SIZE  128
@@ -1308,6 +1349,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.
  */
@@ -1368,6 +1469,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. */
@@ -2531,6 +2633,8 @@ struct qla_hw_data {
        struct mutex vport_lock;        /* Virtual port synchronization */
        struct completion mbx_cmd_comp; /* Serialize mbx access */
        struct completion mbx_intr_comp;  /* Used for completion notification */
+       struct completion dcbx_comp;    /* For set port config notification */
+       int notify_dcbx_comp;
 
        /* Basic firmware related information. */
        uint16_t        fw_major_version;
@@ -2665,8 +2769,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;
@@ -2686,6 +2788,9 @@ struct qla_hw_data {
        uint16_t        gbl_dsd_avail;
        struct list_head gbl_dsd_list;
 #define NUM_DSD_CHAIN 4096
+
+       uint8_t fw_type;
+       __le32 file_prd_off;    /* File firmware product offset */
 };
 
 /*
@@ -2710,6 +2815,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;
@@ -2861,6 +2967,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"