]> Pileus Git - ~andy/linux/blobdiff - drivers/scsi/qla2xxx/qla_def.h
Merge branch 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[~andy/linux] / drivers / scsi / qla2xxx / qla_def.h
index af1003f9de1e44debaf0dda711e36f6d834b663c..a2443031dbe76c68c617f26767e269105f075343 100644 (file)
  * Fibre Channel device definitions.
  */
 #define WWN_SIZE               8       /* Size of WWPN, WWN & WWNN */
-#define MAX_FIBRE_DEVICES      512
+#define MAX_FIBRE_DEVICES_2100 512
+#define MAX_FIBRE_DEVICES_2400 2048
+#define MAX_FIBRE_DEVICES_LOOP 128
+#define MAX_FIBRE_DEVICES_MAX  MAX_FIBRE_DEVICES_2400
 #define MAX_FIBRE_LUNS         0xFFFF
-#define        MAX_RSCN_COUNT          32
 #define        MAX_HOST_COUNT          16
 
 /*
  * Host adapter default definitions.
  */
 #define MAX_BUSES              1  /* We only have one bus today */
-#define MAX_TARGETS_2100       MAX_FIBRE_DEVICES
-#define MAX_TARGETS_2200       MAX_FIBRE_DEVICES
 #define MIN_LUNS               8
 #define MAX_LUNS               MAX_FIBRE_LUNS
 #define MAX_CMDS_PER_LUN       255
@@ -202,20 +202,12 @@ struct sd_dif_tuple {
 /*
  * SCSI Request Block
  */
-typedef struct srb {
-       atomic_t ref_count;
-       struct fc_port *fcport;
-       uint32_t handle;
-
+struct srb_cmd {
        struct scsi_cmnd *cmd;          /* Linux SCSI command pkt */
-
-       uint16_t flags;
-
        uint32_t request_sense_length;
        uint8_t *request_sense_ptr;
-
        void *ctx;
-} srb_t;
+};
 
 /*
  * SRB flag definitions
@@ -254,10 +246,7 @@ struct srb_iocb {
        } u;
 
        struct timer_list timer;
-
-       void (*done)(srb_t *);
-       void (*free)(srb_t *);
-       void (*timeout)(srb_t *);
+       void (*timeout)(void *);
 };
 
 /* Values for srb_ctx type */
@@ -268,16 +257,37 @@ struct srb_iocb {
 #define SRB_CT_CMD     5
 #define SRB_ADISC_CMD  6
 #define SRB_TM_CMD     7
+#define SRB_SCSI_CMD   8
 
-struct srb_ctx {
+typedef struct srb {
+       atomic_t ref_count;
+       struct fc_port *fcport;
+       uint32_t handle;
+       uint16_t flags;
        uint16_t type;
        char *name;
        int iocbs;
        union {
-               struct srb_iocb *iocb_cmd;
+               struct srb_iocb iocb_cmd;
                struct fc_bsg_job *bsg_job;
+               struct srb_cmd scmd;
        } u;
-};
+       void (*done)(void *, void *, int);
+       void (*free)(void *, void *);
+} srb_t;
+
+#define GET_CMD_SP(sp) (sp->u.scmd.cmd)
+#define SET_CMD_SP(sp, cmd) (sp->u.scmd.cmd = cmd)
+#define GET_CMD_CTX_SP(sp) (sp->u.scmd.ctx)
+
+#define GET_CMD_SENSE_LEN(sp) \
+       (sp->u.scmd.request_sense_length)
+#define SET_CMD_SENSE_LEN(sp, len) \
+       (sp->u.scmd.request_sense_length = len)
+#define GET_CMD_SENSE_PTR(sp) \
+       (sp->u.scmd.request_sense_ptr)
+#define SET_CMD_SENSE_PTR(sp, ptr) \
+       (sp->u.scmd.request_sense_ptr = ptr)
 
 struct msg_echo_lb {
        dma_addr_t send_dma;
@@ -653,8 +663,10 @@ typedef struct {
 #define MBC_DIAGNOSTIC_LOOP_BACK       0x45    /* Diagnostic loop back. */
 #define MBC_ONLINE_SELF_TEST           0x46    /* Online self-test. */
 #define MBC_ENHANCED_GET_PORT_DATABASE 0x47    /* Get port database + login */
+#define MBC_CONFIGURE_VF               0x4b    /* Configure VFs */
 #define MBC_RESET_LINK_STATUS          0x52    /* Reset Link Error Status */
 #define MBC_IOCB_COMMAND_A64           0x54    /* Execute IOCB command (64) */
+#define MBC_PORT_LOGOUT                        0x56    /* Port Logout request */
 #define MBC_SEND_RNID_ELS              0x57    /* Send RNID ELS request */
 #define MBC_SET_RNID_PARAMS            0x59    /* Set RNID parameters */
 #define MBC_GET_RNID_PARAMS            0x5a    /* Data Rate */
@@ -1709,6 +1721,7 @@ typedef struct fc_port {
 
        uint16_t vp_idx;
        uint8_t fc4_type;
+       uint8_t scan_state;
 } fc_port_t;
 
 /*
@@ -1761,7 +1774,6 @@ static const char * const port_state_str[] = {
 
 #define        GID_PT_CMD      0x1A1
 #define        GID_PT_REQ_SIZE (16 + 4)
-#define        GID_PT_RSP_SIZE (16 + (MAX_FIBRE_DEVICES * 4))
 
 #define        GPN_ID_CMD      0x112
 #define        GPN_ID_REQ_SIZE (16 + 4)
@@ -2051,7 +2063,9 @@ struct ct_sns_rsp {
                } ga_nxt;
 
                struct {
-                       struct ct_sns_gid_pt_data entries[MAX_FIBRE_DEVICES];
+                       /* Assume the largest number of targets for the union */
+                       struct ct_sns_gid_pt_data
+                           entries[MAX_FIBRE_DEVICES_MAX];
                } gid_pt;
 
                struct {
@@ -2112,7 +2126,11 @@ struct ct_sns_pkt {
 
 #define        GID_PT_SNS_SCMD_LEN     6
 #define        GID_PT_SNS_CMD_SIZE     28
-#define        GID_PT_SNS_DATA_SIZE    (MAX_FIBRE_DEVICES * 4 + 16)
+/*
+ * Assume MAX_FIBRE_DEVICES_2100 as these defines are only used with older
+ * adapters.
+ */
+#define        GID_PT_SNS_DATA_SIZE    (MAX_FIBRE_DEVICES_2100 * 4 + 16)
 
 #define        GPN_ID_SNS_SCMD_LEN     6
 #define        GPN_ID_SNS_CMD_SIZE     28
@@ -2160,7 +2178,6 @@ struct gid_list_info {
        uint16_t loop_id;       /* ISP23XX         -- 6 bytes. */
        uint16_t reserved_1;    /* ISP24XX         -- 8 bytes. */
 };
-#define GID_LIST_SIZE (sizeof(struct gid_list_info) * MAX_FIBRE_DEVICES)
 
 /* NPIV */
 typedef struct vport_info {
@@ -2261,6 +2278,7 @@ struct isp_operations {
 #define QLA_MIDX_DEFAULT       0
 #define QLA_MIDX_RSP_Q         1
 #define QLA_PCI_MSIX_CONTROL   0xa2
+#define QLA_83XX_PCI_MSIX_CONTROL      0x92
 
 struct scsi_qla_host;
 
@@ -2341,7 +2359,7 @@ struct qla_statistics {
 #define QLA_MQ_SIZE 32
 #define QLA_MAX_QUEUES 256
 #define ISP_QUE_REG(ha, id) \
-       ((ha->mqenable) ? \
+       ((ha->mqenable || IS_QLA83XX(ha)) ? \
        ((void *)(ha->mqiobase) +\
        (QLA_QUE_PAGE * id)) :\
        ((void *)(ha->iobase)))
@@ -2461,6 +2479,7 @@ struct qla_hw_data {
 #define MIN_IOBASE_LEN          0x100
 /* Multi queue data structs */
        device_reg_t __iomem *mqiobase;
+       device_reg_t __iomem *msixbase;
        uint16_t        msix_count;
        uint8_t         mqenable;
        struct req_que **req_q_map;
@@ -2485,6 +2504,7 @@ struct qla_hw_data {
        atomic_t        loop_down_timer;         /* loop down timer */
        uint8_t         link_down_timeout;       /* link down timeout */
        uint16_t        max_loop_id;
+       uint16_t        max_fibre_devices;      /* Maximum number of targets */
 
        uint16_t        fb_rev;
        uint16_t        min_external_loopid;    /* First external loop Id */
@@ -2494,6 +2514,7 @@ struct qla_hw_data {
 #define PORT_SPEED_2GB  0x01
 #define PORT_SPEED_4GB  0x03
 #define PORT_SPEED_8GB  0x04
+#define PORT_SPEED_16GB 0x05
 #define PORT_SPEED_10GB        0x13
        uint16_t        link_data_rate;         /* F/W operating speed */
 
@@ -2515,6 +2536,8 @@ struct qla_hw_data {
 #define PCI_DEVICE_ID_QLOGIC_ISP2532    0x2532
 #define PCI_DEVICE_ID_QLOGIC_ISP8432    0x8432
 #define PCI_DEVICE_ID_QLOGIC_ISP8001   0x8001
+#define PCI_DEVICE_ID_QLOGIC_ISP8031   0x8031
+#define PCI_DEVICE_ID_QLOGIC_ISP2031   0x2031
        uint32_t        device_type;
 #define DT_ISP2100                      BIT_0
 #define DT_ISP2200                      BIT_1
@@ -2531,7 +2554,9 @@ struct qla_hw_data {
 #define DT_ISP8432                      BIT_12
 #define DT_ISP8001                     BIT_13
 #define DT_ISP8021                     BIT_14
-#define DT_ISP_LAST                    (DT_ISP8021 << 1)
+#define DT_ISP2031                     BIT_15
+#define DT_ISP8031                     BIT_16
+#define DT_ISP_LAST                    (DT_ISP8031 << 1)
 
 #define DT_T10_PI                       BIT_25
 #define DT_IIDMA                        BIT_26
@@ -2555,26 +2580,30 @@ struct qla_hw_data {
 #define IS_QLA2532(ha)  (DT_MASK(ha) & DT_ISP2532)
 #define IS_QLA8432(ha)  (DT_MASK(ha) & DT_ISP8432)
 #define IS_QLA8001(ha) (DT_MASK(ha) & DT_ISP8001)
+#define IS_QLA81XX(ha) (IS_QLA8001(ha))
 #define IS_QLA82XX(ha) (DT_MASK(ha) & DT_ISP8021)
+#define IS_QLA2031(ha) (DT_MASK(ha) & DT_ISP2031)
+#define IS_QLA8031(ha) (DT_MASK(ha) & DT_ISP8031)
 
 #define IS_QLA23XX(ha)  (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
                        IS_QLA6312(ha) || IS_QLA6322(ha))
 #define IS_QLA24XX(ha)  (IS_QLA2422(ha) || IS_QLA2432(ha))
 #define IS_QLA54XX(ha)  (IS_QLA5422(ha) || IS_QLA5432(ha))
 #define IS_QLA25XX(ha)  (IS_QLA2532(ha))
+#define IS_QLA83XX(ha) (IS_QLA2031(ha) || IS_QLA8031(ha))
 #define IS_QLA84XX(ha)  (IS_QLA8432(ha))
 #define IS_QLA24XX_TYPE(ha)     (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
                                IS_QLA84XX(ha))
-#define IS_QLA81XX(ha)         (IS_QLA8001(ha))
-#define IS_QLA8XXX_TYPE(ha)    (IS_QLA81XX(ha) || IS_QLA82XX(ha))
+#define IS_CNA_CAPABLE(ha)     (IS_QLA81XX(ha) || IS_QLA82XX(ha) || \
+                               IS_QLA8031(ha))
 #define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \
                                IS_QLA25XX(ha) || IS_QLA81XX(ha) || \
-                               IS_QLA82XX(ha))
-#define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha))
-#define IS_NOPOLLING_TYPE(ha)  ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && \
-                               (ha)->flags.msix_enabled)
-#define IS_FAC_REQUIRED(ha)    (IS_QLA81XX(ha))
-#define IS_NOCACHE_VPD_TYPE(ha)        (IS_QLA81XX(ha))
+                               IS_QLA82XX(ha) || IS_QLA83XX(ha))
+#define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha))
+#define IS_NOPOLLING_TYPE(ha)  ((IS_QLA25XX(ha) || IS_QLA81XX(ha) || \
+                       IS_QLA83XX(ha)) && (ha)->flags.msix_enabled)
+#define IS_FAC_REQUIRED(ha)    (IS_QLA81XX(ha) || IS_QLA83XX(ha))
+#define IS_NOCACHE_VPD_TYPE(ha)        (IS_QLA81XX(ha) || IS_QLA83XX(ha))
 #define IS_ALOGIO_CAPABLE(ha)  (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha))
 
 #define IS_T10_PI_CAPABLE(ha)   ((ha)->device_type & DT_T10_PI)
@@ -2583,6 +2612,8 @@ struct qla_hw_data {
 #define IS_ZIO_SUPPORTED(ha)    ((ha)->device_type & DT_ZIO_SUPPORTED)
 #define IS_OEM_001(ha)          ((ha)->device_type & DT_OEM_001)
 #define HAS_EXTENDED_IDS(ha)    ((ha)->device_type & DT_EXTENDED_IDS)
+#define IS_CT6_SUPPORTED(ha)   ((ha)->device_type & DT_CT6_SUPPORTED)
+#define IS_MQUE_CAPABLE(ha)    ((ha)->mqenable || IS_QLA83XX(ha))
 
        /* HBA serial number */
        uint8_t         serial0;
@@ -2621,10 +2652,6 @@ struct qla_hw_data {
        void            *sfp_data;
        dma_addr_t      sfp_data_dma;
 
-       uint8_t         *edc_data;
-       dma_addr_t      edc_data_dma;
-       uint16_t        edc_data_len;
-
 #define XGMAC_DATA_SIZE        4096
        void            *xgmac_data;
        dma_addr_t      xgmac_data_dma;
@@ -2653,6 +2680,8 @@ struct qla_hw_data {
        void            *async_pd;
        dma_addr_t      async_pd_dma;
 
+       void            *swl;
+
        /* These are used by mailbox operations. */
        volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
 
@@ -2674,6 +2703,8 @@ struct qla_hw_data {
        uint16_t        fw_minor_version;
        uint16_t        fw_subminor_version;
        uint16_t        fw_attributes;
+       uint16_t        fw_attributes_h;
+       uint16_t        fw_attributes_ext[2];
        uint32_t        fw_memory_size;
        uint32_t        fw_transfer_size;
        uint32_t        fw_srisc_address;
@@ -2851,7 +2882,6 @@ typedef struct scsi_qla_host {
        volatile struct {
                uint32_t        init_done               :1;
                uint32_t        online                  :1;
-               uint32_t        rscn_queue_overflow     :1;
                uint32_t        reset_active            :1;
 
                uint32_t        management_server_logged_in :1;
@@ -2905,11 +2935,6 @@ typedef struct scsi_qla_host {
 
 
 
-       /* RSCN queue. */
-       uint32_t rscn_queue[MAX_RSCN_COUNT];
-       uint8_t rscn_in_ptr;
-       uint8_t rscn_out_ptr;
-
        /* Timeout timers. */
        uint8_t         loop_down_abort_time;    /* port down timer */
        atomic_t        loop_down_timer;         /* loop down timer */
@@ -3005,7 +3030,6 @@ typedef struct scsi_qla_host {
 #define QLA_ABORTED                    0x105
 #define QLA_SUSPENDED                  0x106
 #define QLA_BUSY                       0x107
-#define QLA_RSCNS_HANDLED              0x108
 #define QLA_ALREADY_REGISTERED         0x109
 
 #define NVRAM_DELAY()          udelay(10)
@@ -3021,6 +3045,7 @@ typedef struct scsi_qla_host {
 #define OPTROM_SIZE_25XX       0x200000
 #define OPTROM_SIZE_81XX       0x400000
 #define OPTROM_SIZE_82XX       0x800000
+#define OPTROM_SIZE_83XX       0x1000000
 
 #define OPTROM_BURST_SIZE      0x1000
 #define OPTROM_BURST_DWORDS    (OPTROM_BURST_SIZE / 4)