[SCSI] qla2xxx: Correct compilation failures when DEBUG'n' options are enabled.
[safe/jmp/linux-2.6] / drivers / scsi / qla2xxx / qla_def.h
index d6f6579..645cfd9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2005 QLogic Corporation
+ * Copyright (c)  2003-2008 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
@@ -23,7 +23,8 @@
 #include <linux/interrupt.h>
 #include <linux/workqueue.h>
 #include <linux/firmware.h>
-#include <asm/semaphore.h>
+#include <linux/aer.h>
+#include <linux/mutex.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 /* ISP request and response entry counts (37-65535) */
 #define REQUEST_ENTRY_CNT_2100         128     /* Number of request entries. */
 #define REQUEST_ENTRY_CNT_2200         2048    /* Number of request entries. */
-#define REQUEST_ENTRY_CNT_2XXX_EXT_MEM 4096    /* Number of request entries. */
-#define REQUEST_ENTRY_CNT_24XX         4096    /* Number of request entries. */
+#define REQUEST_ENTRY_CNT_24XX         2048    /* Number of request entries. */
 #define RESPONSE_ENTRY_CNT_2100                64      /* Number of response entries.*/
 #define RESPONSE_ENTRY_CNT_2300                512     /* Number of response entries.*/
 
+struct req_que;
+
 /*
  * SCSI Request Block
  */
 typedef struct srb {
-       struct list_head list;
-
-       struct scsi_qla_host *ha;       /* HA the SP is queued on */
+       struct req_que *que;
        struct fc_port *fcport;
 
        struct scsi_cmnd *cmd;          /* Linux SCSI command pkt */
 
        uint16_t flags;
 
-       /* Single transfer DMA context */
-       dma_addr_t dma_handle;
-
        uint32_t request_sense_length;
        uint8_t *request_sense_ptr;
 } srb_t;
@@ -203,20 +200,7 @@ typedef struct srb {
 /*
  * SRB flag definitions
  */
-#define SRB_TIMEOUT            BIT_0   /* Command timed out */
-#define SRB_DMA_VALID          BIT_1   /* Command sent to ISP */
-#define SRB_WATCHDOG           BIT_2   /* Command on watchdog list */
-#define SRB_ABORT_PENDING      BIT_3   /* Command abort sent to device */
-
-#define SRB_ABORTED            BIT_4   /* Command aborted command already */
-#define SRB_RETRY              BIT_5   /* Command needs retrying */
-#define SRB_GOT_SENSE          BIT_6   /* Command has sense data */
-#define SRB_FAILOVER           BIT_7   /* Command in failover state */
-
-#define SRB_BUSY               BIT_8   /* Command is in busy retry state */
-#define SRB_FO_CANCEL          BIT_9   /* Command don't need to do failover */
-#define SRB_IOCTL              BIT_10  /* IOCTL command. */
-#define SRB_TAPE               BIT_11  /* FCP2 (Tape) command. */
+#define SRB_DMA_VALID          BIT_0   /* Command sent to ISP */
 
 /*
  * ISP I/O Register Set structure definitions.
@@ -316,7 +300,9 @@ struct device_reg_2xxx {
        } u;
 
        uint16_t fpm_diag_config;
-       uint16_t unused_5[0x6];         /* Gap */
+       uint16_t unused_5[0x4];         /* Gap */
+       uint16_t risc_hw;
+       uint16_t unused_5_1;            /* Gap */
        uint16_t pcr;                   /* Processor Control Register. */
        uint16_t unused_6[0x5];         /* Gap */
        uint16_t mctr;                  /* Memory Configuration and Timing. */
@@ -371,9 +357,17 @@ struct device_reg_2xxx {
        } u_end;
 };
 
+struct device_reg_25xxmq {
+       uint32_t req_q_in;
+       uint32_t req_q_out;
+       uint32_t rsp_q_in;
+       uint32_t rsp_q_out;
+};
+
 typedef union {
                struct device_reg_2xxx isp;
                struct device_reg_24xx isp24;
+               struct device_reg_25xxmq isp25mq;
 } device_reg_t;
 
 #define ISP_REQ_Q_IN(ha, reg) \
@@ -487,6 +481,7 @@ typedef struct {
 #define MBA_IP_RCV_BUFFER_EMPTY 0x8026 /* IP receive buffer queue empty. */
 #define MBA_IP_HDR_DATA_SPLIT  0x8027  /* IP header/data splitting feature */
                                        /* used. */
+#define MBA_TRACE_NOTIFICATION 0x8028  /* Trace/Diagnostic notification. */
 #define MBA_POINT_TO_POINT     0x8030  /* Point to point mode. */
 #define MBA_CMPLT_1_16BIT      0x8031  /* Completion 1 16bit IOSB. */
 #define MBA_CMPLT_2_16BIT      0x8032  /* Completion 2 16bit IOSB. */
@@ -607,8 +602,12 @@ typedef struct {
  */
 #define MBC_SERDES_PARAMS              0x10    /* Serdes Tx Parameters. */
 #define MBC_GET_IOCB_STATUS            0x12    /* Get IOCB status command. */
+#define MBC_PORT_PARAMS                        0x1A    /* Port iDMA Parameters. */
 #define MBC_GET_TIMEOUT_PARAMS         0x22    /* Get FW timeouts. */
+#define MBC_TRACE_CONTROL              0x27    /* Trace control command. */
 #define MBC_GEN_SYSTEM_ERROR           0x2a    /* Generate System Error. */
+#define MBC_WRITE_SFP                  0x30    /* Write SFP Data. */
+#define MBC_READ_SFP                   0x31    /* Read SFP Data. */
 #define MBC_SET_TIMEOUT_PARAMS         0x32    /* Set FW timeouts. */
 #define MBC_MID_INITIALIZE_FIRMWARE    0x48    /* MID Initialize firmware. */
 #define MBC_MID_GET_VP_DATABASE                0x49    /* MID Get VP Database. */
@@ -854,14 +853,21 @@ typedef struct {
 #define GLSO_SEND_RPS  BIT_0
 #define GLSO_USE_DID   BIT_3
 
-typedef struct {
-       uint32_t        link_fail_cnt;
-       uint32_t        loss_sync_cnt;
-       uint32_t        loss_sig_cnt;
-       uint32_t        prim_seq_err_cnt;
-       uint32_t        inval_xmit_word_cnt;
-       uint32_t        inval_crc_cnt;
-} link_stat_t;
+struct link_statistics {
+       uint32_t link_fail_cnt;
+       uint32_t loss_sync_cnt;
+       uint32_t loss_sig_cnt;
+       uint32_t prim_seq_err_cnt;
+       uint32_t inval_xmit_word_cnt;
+       uint32_t inval_crc_cnt;
+       uint32_t lip_cnt;
+       uint32_t unused1[0x1a];
+       uint32_t tx_frames;
+       uint32_t rx_frames;
+       uint32_t dumped_frames;
+       uint32_t unused2[2];
+       uint32_t nos_rcvd;
+};
 
 /*
  * NVRAM Command values.
@@ -1471,14 +1477,17 @@ typedef union {
        uint32_t b24 : 24;
 
        struct {
-               uint8_t d_id[3];
-               uint8_t rsvd_1;
-       } r;
-
-       struct {
+#ifdef __BIG_ENDIAN
+               uint8_t domain;
+               uint8_t area;
+               uint8_t al_pa;
+#elif __LITTLE_ENDIAN
                uint8_t al_pa;
                uint8_t area;
                uint8_t domain;
+#else
+#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!"
+#endif
                uint8_t rsvd_1;
        } b;
 } port_id_t;
@@ -1491,6 +1500,8 @@ typedef struct {
        port_id_t d_id;
        uint8_t node_name[WWN_SIZE];
        uint8_t port_name[WWN_SIZE];
+       uint8_t fabric_port_name[WWN_SIZE];
+       uint16_t fp_speed;
 } sw_info_t;
 
 /*
@@ -1510,7 +1521,7 @@ typedef struct {
  */
 typedef struct fc_port {
        struct list_head list;
-       struct scsi_qla_host *ha;
+       struct scsi_qla_host *vha;
 
        uint8_t node_name[WWN_SIZE];
        uint8_t port_name[WWN_SIZE];
@@ -1518,20 +1529,25 @@ typedef struct fc_port {
        uint16_t loop_id;
        uint16_t old_loop_id;
 
+       uint8_t fabric_port_name[WWN_SIZE];
+       uint16_t fp_speed;
+
        fc_port_type_t port_type;
 
        atomic_t state;
        uint32_t flags;
 
-       unsigned int os_target_id;
-
        int port_login_retry_count;
        int login_retry;
        atomic_t port_down_timer;
 
-       spinlock_t rport_lock;
        struct fc_rport *rport, *drport;
        u32 supported_classes;
+
+       unsigned long last_queue_full;
+       unsigned long last_ramp_up;
+
+       uint16_t vp_idx;
 } fc_port_t;
 
 /*
@@ -1541,39 +1557,13 @@ typedef struct fc_port {
 #define FCS_DEVICE_DEAD                2
 #define FCS_DEVICE_LOST                3
 #define FCS_ONLINE             4
-#define FCS_NOT_SUPPORTED      5
-#define FCS_FAILOVER           6
-#define FCS_FAILOVER_FAILED    7
 
 /*
  * FC port flags.
  */
 #define FCF_FABRIC_DEVICE      BIT_0
 #define FCF_LOGIN_NEEDED       BIT_1
-#define FCF_FO_MASKED          BIT_2
-#define FCF_FAILOVER_NEEDED    BIT_3
-#define FCF_RESET_NEEDED       BIT_4
-#define FCF_PERSISTENT_BOUND   BIT_5
-#define FCF_TAPE_PRESENT       BIT_6
-#define FCF_FARP_DONE          BIT_7
-#define FCF_FARP_FAILED                BIT_8
-#define FCF_FARP_REPLY_NEEDED  BIT_9
-#define FCF_AUTH_REQ           BIT_10
-#define FCF_SEND_AUTH_REQ      BIT_11
-#define FCF_RECEIVE_AUTH_REQ   BIT_12
-#define FCF_AUTH_SUCCESS       BIT_13
-#define FCF_RLC_SUPPORT                BIT_14
-#define FCF_CONFIG             BIT_15  /* Needed? */
-#define FCF_RESCAN_NEEDED      BIT_16
-#define FCF_XP_DEVICE          BIT_17
-#define FCF_MSA_DEVICE         BIT_18
-#define FCF_EVA_DEVICE         BIT_19
-#define FCF_MSA_PORT_ACTIVE    BIT_20
-#define FCF_FAILBACK_DISABLE   BIT_21
-#define FCF_FAILOVER_DISABLE   BIT_22
-#define FCF_DSXXX_DEVICE       BIT_23
-#define FCF_AA_EVA_DEVICE      BIT_24
-#define FCF_AA_MSA_DEVICE      BIT_25
+#define FCF_TAPE_PRESENT       BIT_2
 
 /* No loop ID flag. */
 #define FC_NO_LOOP_ID          0x1000
@@ -1586,7 +1576,9 @@ typedef struct fc_port {
 
 #define CT_REJECT_RESPONSE     0x8001
 #define CT_ACCEPT_RESPONSE     0x8002
+#define CT_REASON_INVALID_COMMAND_CODE 0x01
 #define CT_REASON_CANNOT_PERFORM       0x09
+#define CT_REASON_COMMAND_UNSUPPORTED  0x0b
 #define CT_EXPL_ALREADY_REGISTERED     0x10
 
 #define NS_N_PORT_TYPE 0x01
@@ -1629,6 +1621,15 @@ typedef struct fc_port {
 #define        RSNN_NN_REQ_SIZE (16 + 8 + 1 + 255)
 #define        RSNN_NN_RSP_SIZE 16
 
+#define        GFPN_ID_CMD     0x11C
+#define        GFPN_ID_REQ_SIZE (16 + 4)
+#define        GFPN_ID_RSP_SIZE (16 + 8)
+
+#define        GPSC_CMD        0x127
+#define        GPSC_REQ_SIZE   (16 + 8)
+#define        GPSC_RSP_SIZE   (16 + 2 + 2)
+
+
 /*
  * HBA attribute types.
  */
@@ -1671,7 +1672,7 @@ struct ct_fdmi_hba_attributes {
 /*
  * Port attribute types.
  */
-#define FDMI_PORT_ATTR_COUNT           5
+#define FDMI_PORT_ATTR_COUNT           6
 #define FDMI_PORT_FC4_TYPES            1
 #define FDMI_PORT_SUPPORT_SPEED                2
 #define FDMI_PORT_CURRENT_SPEED                3
@@ -1679,6 +1680,14 @@ struct ct_fdmi_hba_attributes {
 #define FDMI_PORT_OS_DEVICE_NAME       5
 #define FDMI_PORT_HOST_NAME            6
 
+#define FDMI_PORT_SPEED_1GB            0x1
+#define FDMI_PORT_SPEED_2GB            0x2
+#define FDMI_PORT_SPEED_10GB           0x4
+#define FDMI_PORT_SPEED_4GB            0x8
+#define FDMI_PORT_SPEED_8GB            0x10
+#define FDMI_PORT_SPEED_16GB           0x20
+#define FDMI_PORT_SPEED_UNKNOWN                0x8000
+
 struct ct_fdmi_port_attr {
        uint16_t type;
        uint16_t len;
@@ -1742,7 +1751,7 @@ struct ct_sns_req {
        uint8_t reserved[3];
 
        union {
-               /* GA_NXT, GPN_ID, GNN_ID, GFT_ID */
+               /* GA_NXT, GPN_ID, GNN_ID, GFT_ID, GFPN_ID */
                struct {
                        uint8_t reserved;
                        uint8_t port_id[3];
@@ -1817,6 +1826,10 @@ struct ct_sns_req {
                struct {
                        uint8_t port_name[8];
                } dpa;
+
+               struct {
+                       uint8_t port_name[8];
+               } gpsc;
        } req;
 };
 
@@ -1880,6 +1893,15 @@ struct ct_sns_rsp {
                        uint8_t port_name[8];
                        struct ct_fdmi_hba_attributes attrs;
                } ghat;
+
+               struct {
+                       uint8_t port_name[8];
+               } gfpn_id;
+
+               struct {
+                       uint16_t speeds;
+                       uint16_t speed;
+               } gpsc;
        } rsp;
 };
 
@@ -1957,6 +1979,36 @@ struct gid_list_info {
 };
 #define GID_LIST_SIZE (sizeof(struct gid_list_info) * MAX_FIBRE_DEVICES)
 
+/* NPIV */
+typedef struct vport_info {
+       uint8_t         port_name[WWN_SIZE];
+       uint8_t         node_name[WWN_SIZE];
+       int             vp_id;
+       uint16_t        loop_id;
+       unsigned long   host_no;
+       uint8_t         port_id[3];
+       int             loop_state;
+} vport_info_t;
+
+typedef struct vport_params {
+       uint8_t         port_name[WWN_SIZE];
+       uint8_t         node_name[WWN_SIZE];
+       uint32_t        options;
+#define        VP_OPTS_RETRY_ENABLE    BIT_0
+#define        VP_OPTS_VP_DISABLE      BIT_1
+} vport_params_t;
+
+/* NPIV - return codes of VP create and modify */
+#define VP_RET_CODE_OK                 0
+#define VP_RET_CODE_FATAL              1
+#define VP_RET_CODE_WRONG_ID           2
+#define VP_RET_CODE_WWPN               3
+#define VP_RET_CODE_RESOURCES          4
+#define VP_RET_CODE_NO_MEM             5
+#define VP_RET_CODE_NOT_FOUND          6
+
+struct qla_hw_data;
+
 /*
  * ISP operations
  */
@@ -1974,12 +2026,14 @@ struct isp_operations {
        char * (*pci_info_str) (struct scsi_qla_host *, char *);
        char * (*fw_version_str) (struct scsi_qla_host *, char *);
 
-       irqreturn_t (*intr_handler) (int, void *, struct pt_regs *);
-       void (*enable_intrs) (struct scsi_qla_host *);
-       void (*disable_intrs) (struct scsi_qla_host *);
+       irq_handler_t intr_handler;
+       void (*enable_intrs) (struct qla_hw_data *);
+       void (*disable_intrs) (struct qla_hw_data *);
 
-       int (*abort_command) (struct scsi_qla_host *, srb_t *);
-       int (*abort_target) (struct fc_port *);
+       int (*abort_command) (struct scsi_qla_host *, srb_t *,
+               struct req_que *);
+       int (*target_reset) (struct fc_port *, unsigned int);
+       int (*lun_reset) (struct fc_port *, unsigned int);
        int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t,
                uint8_t, uint8_t, uint16_t *, uint8_t);
        int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t,
@@ -1997,7 +2051,6 @@ struct isp_operations {
                uint32_t);
 
        void (*fw_dump) (struct scsi_qla_host *, int);
-       void (*ascii_fw_dump) (struct scsi_qla_host *);
 
        int (*beacon_on) (struct scsi_qla_host *);
        int (*beacon_off) (struct scsi_qla_host *);
@@ -2007,180 +2060,217 @@ struct isp_operations {
                uint32_t, uint32_t);
        int (*write_optrom) (struct scsi_qla_host *, uint8_t *, uint32_t,
                uint32_t);
+
+       int (*get_flash_version) (struct scsi_qla_host *, void *);
+       int (*start_scsi) (srb_t *);
 };
 
-/*
- * Linux Host Adapter structure
- */
-typedef struct scsi_qla_host {
+/* MSI-X Support *************************************************************/
+
+#define QLA_MSIX_CHIP_REV_24XX 3
+#define QLA_MSIX_FW_MODE(m)    (((m) & (BIT_7|BIT_8|BIT_9)) >> 7)
+#define QLA_MSIX_FW_MODE_1(m)  (QLA_MSIX_FW_MODE(m) == 1)
+
+#define QLA_MSIX_DEFAULT       0x00
+#define QLA_MSIX_RSP_Q         0x01
+
+#define QLA_MIDX_DEFAULT       0
+#define QLA_MIDX_RSP_Q         1
+#define QLA_PCI_MSIX_CONTROL   0xa2
+
+struct scsi_qla_host;
+struct rsp_que;
+
+struct qla_msix_entry {
+       int have_irq;
+       uint32_t vector;
+       uint16_t entry;
+       struct rsp_que *rsp;
+};
+
+#define        WATCH_INTERVAL          1       /* number of seconds */
+
+/* Work events.  */
+enum qla_work_type {
+       QLA_EVT_AEN,
+       QLA_EVT_IDC_ACK,
+};
+
+
+struct qla_work_evt {
+       struct list_head        list;
+       enum qla_work_type      type;
+       u32                     flags;
+#define QLA_EVT_FLAG_FREE      0x1
+
+       union {
+               struct {
+                       enum fc_host_event_code code;
+                       u32 data;
+               } aen;
+               struct {
+#define QLA_IDC_ACK_REGS       7
+                       uint16_t mb[QLA_IDC_ACK_REGS];
+               } idc_ack;
+       } u;
+};
+
+struct qla_chip_state_84xx {
        struct list_head list;
+       struct kref kref;
+
+       void *bus;
+       spinlock_t access_lock;
+       struct mutex fw_update_mutex;
+       uint32_t fw_update;
+       uint32_t op_fw_version;
+       uint32_t op_fw_size;
+       uint32_t op_fw_seq_size;
+       uint32_t diag_fw_version;
+       uint32_t gold_fw_version;
+};
 
-       /* Commonly used flags and state information. */
-       struct Scsi_Host *host;
-       struct pci_dev  *pdev;
+struct qla_statistics {
+       uint32_t total_isp_aborts;
+       uint64_t input_bytes;
+       uint64_t output_bytes;
+};
 
-       unsigned long   host_no;
-       unsigned long   instance;
+/* Multi queue support */
+#define MBC_INITIALIZE_MULTIQ 0x1f
+#define QLA_QUE_PAGE 0X1000
+#define QLA_MQ_SIZE 32
+#define QLA_MAX_HOST_QUES 16
+#define QLA_MAX_QUEUES 256
+#define ISP_QUE_REG(ha, id) \
+       ((ha->mqenable) ? \
+       ((void *)(ha->mqiobase) +\
+       (QLA_QUE_PAGE * id)) :\
+       ((void *)(ha->iobase)))
+#define QLA_REQ_QUE_ID(tag) \
+       ((tag < QLA_MAX_QUEUES && tag > 0) ? tag : 0)
+#define QLA_DEFAULT_QUE_QOS 5
+#define QLA_PRECONFIG_VPORTS 32
+#define QLA_MAX_VPORTS_QLA24XX 128
+#define QLA_MAX_VPORTS_QLA25XX 256
+/* Response queue data structure */
+struct rsp_que {
+       dma_addr_t  dma;
+       response_t *ring;
+       response_t *ring_ptr;
+       uint32_t __iomem *rsp_q_in;     /* FWI2-capable only. */
+       uint32_t __iomem *rsp_q_out;
+       uint16_t  ring_index;
+       uint16_t  out_ptr;
+       uint16_t  length;
+       uint16_t  options;
+       uint16_t  rid;
+       uint16_t  id;
+       uint16_t  vp_idx;
+       struct qla_hw_data *hw;
+       struct qla_msix_entry *msix;
+       struct req_que *req;
+};
+
+/* Request queue data structure */
+struct req_que {
+       dma_addr_t  dma;
+       request_t *ring;
+       request_t *ring_ptr;
+       uint32_t __iomem *req_q_in;     /* FWI2-capable only. */
+       uint32_t __iomem *req_q_out;
+       uint16_t  ring_index;
+       uint16_t  in_ptr;
+       uint16_t  cnt;
+       uint16_t  length;
+       uint16_t  options;
+       uint16_t  rid;
+       uint16_t  id;
+       uint16_t  qos;
+       uint16_t  vp_idx;
+       struct rsp_que *rsp;
+       srb_t *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
+       uint32_t current_outstanding_cmd;
+       int max_q_depth;
+};
+
+/*
+ * Qlogic host adapter specific data structure.
+*/
+struct qla_hw_data {
+       struct pci_dev  *pdev;
+       /* SRB cache. */
+#define SRB_MIN_REQ     128
+       mempool_t       *srb_mempool;
 
        volatile struct {
-               uint32_t        init_done               :1;
-               uint32_t        online                  :1;
                uint32_t        mbox_int                :1;
                uint32_t        mbox_busy               :1;
-               uint32_t        rscn_queue_overflow     :1;
-               uint32_t        reset_active            :1;
-
-               uint32_t        management_server_logged_in :1;
-                uint32_t       process_response_queue  :1;
 
                uint32_t        disable_risc_code_load  :1;
                uint32_t        enable_64bit_addressing :1;
                uint32_t        enable_lip_reset        :1;
-               uint32_t        enable_lip_full_login   :1;
                uint32_t        enable_target_reset     :1;
+               uint32_t        enable_lip_full_login   :1;
                uint32_t        enable_led_scheme       :1;
+               uint32_t        inta_enabled            :1;
                uint32_t        msi_enabled             :1;
                uint32_t        msix_enabled            :1;
+               uint32_t        disable_serdes          :1;
+               uint32_t        gpsc_supported          :1;
+               uint32_t        npiv_supported          :1;
+               uint32_t        fce_enabled             :1;
+               uint32_t        fac_supported           :1;
+               uint32_t        chip_reset_done         :1;
        } flags;
 
-       atomic_t        loop_state;
-#define LOOP_TIMEOUT   1
-#define LOOP_DOWN      2
-#define LOOP_UP                3
-#define LOOP_UPDATE    4
-#define LOOP_READY     5
-#define LOOP_DEAD      6
-
-       unsigned long   dpc_flags;
-#define        RESET_MARKER_NEEDED     0       /* Send marker to ISP. */
-#define        RESET_ACTIVE            1
-#define        ISP_ABORT_NEEDED        2       /* Initiate ISP abort. */
-#define        ABORT_ISP_ACTIVE        3       /* ISP abort in progress. */
-#define        LOOP_RESYNC_NEEDED      4       /* Device Resync needed. */
-#define        LOOP_RESYNC_ACTIVE      5
-#define LOCAL_LOOP_UPDATE       6      /* Perform a local loop update. */
-#define RSCN_UPDATE             7      /* Perform an RSCN update. */
-#define MAILBOX_RETRY           8
-#define ISP_RESET_NEEDED        9      /* Initiate a ISP reset. */
-#define FAILOVER_EVENT_NEEDED   10
-#define FAILOVER_EVENT         11
-#define FAILOVER_NEEDED        12
-#define SCSI_RESTART_NEEDED    13      /* Processes SCSI retry queue. */
-#define PORT_RESTART_NEEDED    14      /* Processes Retry queue. */
-#define RESTART_QUEUES_NEEDED  15      /* Restarts the Lun queue. */
-#define ABORT_QUEUES_NEEDED    16
-#define RELOGIN_NEEDED         17
-#define LOGIN_RETRY_NEEDED     18      /* Initiate required fabric logins. */
-#define REGISTER_FC4_NEEDED    19      /* SNS FC4 registration required. */
-#define ISP_ABORT_RETRY         20      /* ISP aborted. */
-#define FCPORT_RESCAN_NEEDED   21      /* IO descriptor processing needed */
-#define IODESC_PROCESS_NEEDED  22      /* IO descriptor processing needed */
-#define IOCTL_ERROR_RECOVERY   23
-#define LOOP_RESET_NEEDED      24
-#define BEACON_BLINK_NEEDED    25
-#define REGISTER_FDMI_NEEDED   26
-#define FCPORT_UPDATE_NEEDED   27
-
-       uint32_t        device_flags;
-#define DFLG_LOCAL_DEVICES             BIT_0
-#define DFLG_RETRY_LOCAL_DEVICES       BIT_1
-#define DFLG_FABRIC_DEVICES            BIT_2
-#define        SWITCH_FOUND                    BIT_3
-#define        DFLG_NO_CABLE                   BIT_4
-
-       uint32_t        device_type;
-#define DT_ISP2100                     BIT_0
-#define DT_ISP2200                     BIT_1
-#define DT_ISP2300                     BIT_2
-#define DT_ISP2312                     BIT_3
-#define DT_ISP2322                     BIT_4
-#define DT_ISP6312                     BIT_5
-#define DT_ISP6322                     BIT_6
-#define DT_ISP2422                     BIT_7
-#define DT_ISP2432                     BIT_8
-#define DT_ISP5422                     BIT_9
-#define DT_ISP5432                     BIT_10
-#define DT_ISP_LAST                    (DT_ISP5432 << 1)
-
-#define DT_ZIO_SUPPORTED               BIT_28
-#define DT_OEM_001                     BIT_29
-#define DT_ISP2200A                    BIT_30
-#define DT_EXTENDED_IDS                        BIT_31
-
-#define DT_MASK(ha)    ((ha)->device_type & (DT_ISP_LAST - 1))
-#define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100)
-#define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200)
-#define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300)
-#define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312)
-#define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322)
-#define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312)
-#define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322)
-#define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422)
-#define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432)
-#define IS_QLA5422(ha) (DT_MASK(ha) & DT_ISP5422)
-#define IS_QLA5432(ha) (DT_MASK(ha) & DT_ISP5432)
-
-#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_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)
-
-       /* SRB cache. */
-#define SRB_MIN_REQ    128
-       mempool_t       *srb_mempool;
-
        /* This spinlock is used to protect "io transactions", you must
-        * aquire it before doing any IO to the card, eg with RD_REG*() and
-        * WRT_REG*() for the duration of your entire commandtransaction.
-        *
-        * This spinlock is of lower priority than the io request lock.
-        */
-
-       spinlock_t              hardware_lock ____cacheline_aligned;
-
-       device_reg_t __iomem *iobase;           /* Base I/O address */
-       unsigned long   pio_address;
-       unsigned long   pio_length;
-#define MIN_IOBASE_LEN         0x100
-
-       /* ISP ring lock, rings, and indexes */
-       dma_addr_t      request_dma;        /* Physical address. */
-       request_t       *request_ring;      /* Base virtual address */
-       request_t       *request_ring_ptr;  /* Current address. */
-       uint16_t        req_ring_index;     /* Current index. */
-       uint16_t        req_q_cnt;          /* Number of available entries. */
-       uint16_t        request_q_length;
-
-       dma_addr_t      response_dma;       /* Physical address. */
-       response_t      *response_ring;     /* Base virtual address */
-       response_t      *response_ring_ptr; /* Current address. */
-       uint16_t        rsp_ring_index;     /* Current index. */
-       uint16_t        response_q_length;
-
-       struct isp_operations isp_ops;
-
-       /* Outstandings ISP commands. */
-       srb_t           *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
-       uint32_t        current_outstanding_cmd;
-       srb_t           *status_srb;    /* Status continuation entry. */
+       * acquire it before doing any IO to the card, eg with RD_REG*() and
+       * WRT_REG*() for the duration of your entire commandtransaction.
+       *
+       * This spinlock is of lower priority than the io request lock.
+       */
+
+       spinlock_t      hardware_lock ____cacheline_aligned;
+       int             bars;
+       int             mem_only;
+       device_reg_t __iomem *iobase;           /* Base I/O address */
+       resource_size_t pio_address;
+
+#define MIN_IOBASE_LEN          0x100
+/* Multi queue data structs */
+       device_reg_t __iomem *mqiobase;
+       uint16_t        msix_count;
+       uint8_t         mqenable;
+       struct req_que **req_q_map;
+       struct rsp_que **rsp_q_map;
+       unsigned long req_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
+       unsigned long rsp_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
+       uint16_t        max_queues;
+       struct qla_npiv_entry *npiv_info;
+       uint16_t        nvram_npiv_size;
+
+       uint16_t        switch_cap;
+#define FLOGI_SEQ_DEL           BIT_8
+#define FLOGI_MID_SUPPORT       BIT_10
+#define FLOGI_VSAN_SUPPORT      BIT_12
+#define FLOGI_SP_SUPPORT        BIT_13
+       /* Timeout timers. */
+       uint8_t         loop_down_abort_time;    /* port down timer */
+       atomic_t        loop_down_timer;         /* loop down timer */
+       uint8_t         link_down_timeout;       /* link down timeout */
+       uint16_t        max_loop_id;
 
-       /* ISP configuration data. */
-       uint16_t        loop_id;                /* Host adapter loop id */
        uint16_t        fb_rev;
+       uint16_t        min_external_loopid;    /* First external loop Id */
 
-       port_id_t       d_id;                   /* Host adapter port id */
-       uint16_t        max_public_loop_ids;
-       uint16_t        min_external_loopid;    /* First external loop Id */
-
-       uint16_t        link_data_rate;         /* F/W operating speed */
-#define LDR_1GB                0
-#define LDR_2GB                1
-#define LDR_4GB                3
-#define LDR_UNKNOWN    0xFFFF
+#define PORT_SPEED_UNKNOWN 0xFFFF
+#define PORT_SPEED_1GB  0x00
+#define PORT_SPEED_2GB  0x01
+#define PORT_SPEED_4GB  0x03
+#define PORT_SPEED_8GB  0x04
+#define PORT_SPEED_10GB        0x13
+       uint16_t        link_data_rate;         /* F/W operating speed */
 
        uint8_t         current_topology;
        uint8_t         prev_topology;
@@ -2189,15 +2279,77 @@ typedef struct scsi_qla_host {
 #define ISP_CFG_FL     4
 #define ISP_CFG_F      8
 
-       uint8_t         operating_mode;         /* F/W operating mode */
+       uint8_t         operating_mode;         /* F/W operating mode */
 #define LOOP      0
 #define P2P       1
 #define LOOP_P2P  2
 #define P2P_LOOP  3
-
-        uint8_t                marker_needed;
-
        uint8_t         interrupts_on;
+       uint32_t        isp_abort_cnt;
+
+#define PCI_DEVICE_ID_QLOGIC_ISP2532    0x2532
+#define PCI_DEVICE_ID_QLOGIC_ISP8432    0x8432
+#define PCI_DEVICE_ID_QLOGIC_ISP8001   0x8001
+       uint32_t        device_type;
+#define DT_ISP2100                      BIT_0
+#define DT_ISP2200                      BIT_1
+#define DT_ISP2300                      BIT_2
+#define DT_ISP2312                      BIT_3
+#define DT_ISP2322                      BIT_4
+#define DT_ISP6312                      BIT_5
+#define DT_ISP6322                      BIT_6
+#define DT_ISP2422                      BIT_7
+#define DT_ISP2432                      BIT_8
+#define DT_ISP5422                      BIT_9
+#define DT_ISP5432                      BIT_10
+#define DT_ISP2532                      BIT_11
+#define DT_ISP8432                      BIT_12
+#define DT_ISP8001                     BIT_13
+#define DT_ISP_LAST                    (DT_ISP8001 << 1)
+
+#define DT_IIDMA                        BIT_26
+#define DT_FWI2                         BIT_27
+#define DT_ZIO_SUPPORTED                BIT_28
+#define DT_OEM_001                      BIT_29
+#define DT_ISP2200A                     BIT_30
+#define DT_EXTENDED_IDS                 BIT_31
+#define DT_MASK(ha)     ((ha)->device_type & (DT_ISP_LAST - 1))
+#define IS_QLA2100(ha)  (DT_MASK(ha) & DT_ISP2100)
+#define IS_QLA2200(ha)  (DT_MASK(ha) & DT_ISP2200)
+#define IS_QLA2300(ha)  (DT_MASK(ha) & DT_ISP2300)
+#define IS_QLA2312(ha)  (DT_MASK(ha) & DT_ISP2312)
+#define IS_QLA2322(ha)  (DT_MASK(ha) & DT_ISP2322)
+#define IS_QLA6312(ha)  (DT_MASK(ha) & DT_ISP6312)
+#define IS_QLA6322(ha)  (DT_MASK(ha) & DT_ISP6322)
+#define IS_QLA2422(ha)  (DT_MASK(ha) & DT_ISP2422)
+#define IS_QLA2432(ha)  (DT_MASK(ha) & DT_ISP2432)
+#define IS_QLA5422(ha)  (DT_MASK(ha) & DT_ISP5422)
+#define IS_QLA5432(ha)  (DT_MASK(ha) & DT_ISP5432)
+#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_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_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_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \
+                               IS_QLA25XX(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))
+
+#define IS_IIDMA_CAPABLE(ha)    ((ha)->device_type & DT_IIDMA)
+#define IS_FWI2_CAPABLE(ha)     ((ha)->device_type & DT_FWI2)
+#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)
 
        /* HBA serial number */
        uint8_t         serial0;
@@ -2205,10 +2357,14 @@ typedef struct scsi_qla_host {
        uint8_t         serial2;
 
        /* NVRAM configuration data */
+#define MAX_NVRAM_SIZE  4096
+#define VPD_OFFSET      MAX_NVRAM_SIZE / 2
        uint16_t        nvram_size;
        uint16_t        nvram_base;
+       void            *nvram;
        uint16_t        vpd_size;
        uint16_t        vpd_base;
+       void            *vpd;
 
        uint16_t        loop_reset_delay;
        uint8_t         retry_count;
@@ -2216,19 +2372,8 @@ typedef struct scsi_qla_host {
        uint16_t        r_a_tov;
        int             port_down_retry_count;
        uint8_t         mbx_count;
-       uint16_t        last_loop_id;
-       uint16_t        mgmt_svr_loop_id;
-
-        uint32_t       login_retry_count;
-
-       /* Fibre Channel Device List. */
-       struct list_head        fcports;
-
-       /* RSCN queue. */
-       uint32_t rscn_queue[MAX_RSCN_COUNT];
-       uint8_t rscn_in_ptr;
-       uint8_t rscn_out_ptr;
 
+       uint32_t        login_retry_count;
        /* SNS command interfaces. */
        ms_iocb_entry_t         *ms_iocb;
        dma_addr_t              ms_iocb_dma;
@@ -2238,53 +2383,44 @@ typedef struct scsi_qla_host {
        struct sns_cmd_pkt      *sns_cmd;
        dma_addr_t              sns_cmd_dma;
 
-       struct task_struct      *dpc_thread;
-       uint8_t dpc_active;                  /* DPC routine is active */
+#define SFP_DEV_SIZE    256
+#define SFP_BLOCK_SIZE  64
+       void            *sfp_data;
+       dma_addr_t      sfp_data_dma;
 
-       /* Timeout timers. */
-       uint8_t         loop_down_abort_time;    /* port down timer */
-       atomic_t        loop_down_timer;         /* loop down timer */
-       uint8_t         link_down_timeout;       /* link down timeout */
+       uint8_t         *edc_data;
+       dma_addr_t      edc_data_dma;
+       uint16_t        edc_data_len;
 
-       uint32_t        timer_active;
-       struct timer_list        timer;
+       struct task_struct      *dpc_thread;
+       uint8_t dpc_active;                  /* DPC routine is active */
 
        dma_addr_t      gid_list_dma;
        struct gid_list_info *gid_list;
        int             gid_list_info_size;
 
        /* Small DMA pool allocations -- maximum 256 bytes in length. */
-#define DMA_POOL_SIZE  256
+#define DMA_POOL_SIZE   256
        struct dma_pool *s_dma_pool;
 
        dma_addr_t      init_cb_dma;
        init_cb_t       *init_cb;
        int             init_cb_size;
+       dma_addr_t      ex_init_cb_dma;
+       struct ex_init_cb_81xx *ex_init_cb;
 
        /* These are used by mailbox operations. */
        volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
 
        mbx_cmd_t       *mcp;
        unsigned long   mbx_cmd_flags;
-#define MBX_INTERRUPT  1
-#define MBX_INTR_WAIT  2
+#define MBX_INTERRUPT          1
+#define MBX_INTR_WAIT          2
 #define MBX_UPDATE_FLASH_ACTIVE        3
 
-       spinlock_t      mbx_reg_lock;   /* Mbx Cmd Register Lock */
-
-       struct semaphore mbx_cmd_sem;   /* Serialialize mbx access */
-       struct semaphore mbx_intr_sem;  /* Used for completion notification */
-
-       uint32_t        mbx_flags;
-#define  MBX_IN_PROGRESS       BIT_0
-#define  MBX_BUSY              BIT_1   /* Got the Access */
-#define  MBX_SLEEPING_ON_SEM   BIT_2
-#define  MBX_POLLING_FOR_COMP  BIT_3
-#define  MBX_COMPLETED         BIT_4
-#define  MBX_TIMEDOUT          BIT_5
-#define  MBX_ACCESS_TIMEDOUT   BIT_6
-
-       mbx_cmd_t       mc;
+       struct mutex vport_lock;        /* Virtual port synchronization */
+       struct completion mbx_cmd_comp; /* Serialize mbx access */
+       struct completion mbx_intr_comp;  /* Used for completion notification */
 
        /* Basic firmware related information. */
        uint16_t        fw_major_version;
@@ -2297,32 +2433,44 @@ typedef struct scsi_qla_host {
 #define RISC_START_ADDRESS_2100 0x1000
 #define RISC_START_ADDRESS_2300 0x800
 #define RISC_START_ADDRESS_2400 0x100000
+       uint16_t        fw_xcb_count;
 
-       uint16_t        fw_options[16];         /* slots: 1,2,3,10,11 */
+       uint16_t        fw_options[16];         /* slots: 1,2,3,10,11 */
        uint8_t         fw_seriallink_options[4];
        uint16_t        fw_seriallink_options24[4];
 
+       uint8_t         mpi_version[3];
+       uint32_t        mpi_capabilities;
+       uint8_t         phy_version[3];
+
        /* Firmware dump information. */
-       void            *fw_dump;
+       struct qla2xxx_fw_dump *fw_dump;
+       uint32_t        fw_dump_len;
        int             fw_dumped;
        int             fw_dump_reading;
-       char            *fw_dump_buffer;
-       int             fw_dump_buffer_len;
+       dma_addr_t      eft_dma;
+       void            *eft;
+
+       uint32_t        chain_offset;
+       struct dentry *dfs_dir;
+       struct dentry *dfs_fce;
+       dma_addr_t      fce_dma;
+       void            *fce;
+       uint32_t        fce_bufs;
+       uint16_t        fce_mb[8];
+       uint64_t        fce_wr, fce_rd;
+       struct mutex    fce_mutex;
 
-       uint8_t         host_str[16];
        uint32_t        pci_attr;
+       uint16_t        chip_revision;
 
        uint16_t        product_id[4];
 
        uint8_t         model_number[16+1];
 #define BINZERO                "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-       char            *model_desc;
+       char            model_desc[80];
        uint8_t         adapter_id[16+1];
 
-       uint8_t         *node_name;
-       uint8_t         *port_name;
-       uint32_t    isp_abort_cnt;
-
        /* Option ROM information. */
        char            *optrom_buffer;
        uint32_t        optrom_size;
@@ -2330,21 +2478,178 @@ typedef struct scsi_qla_host {
 #define QLA_SWAITING   0
 #define QLA_SREADING   1
 #define QLA_SWRITING   2
+       uint32_t        optrom_region_start;
+       uint32_t        optrom_region_size;
+
+/* PCI expansion ROM image information. */
+#define ROM_CODE_TYPE_BIOS     0
+#define ROM_CODE_TYPE_FCODE    1
+#define ROM_CODE_TYPE_EFI      3
+       uint8_t         bios_revision[2];
+       uint8_t         efi_revision[2];
+       uint8_t         fcode_revision[16];
+       uint32_t        fw_revision[4];
+
+       /* Offsets for flash/nvram access (set to ~0 if not used). */
+       uint32_t        flash_conf_off;
+       uint32_t        flash_data_off;
+       uint32_t        nvram_conf_off;
+       uint32_t        nvram_data_off;
+
+       uint32_t        fdt_wrt_disable;
+       uint32_t        fdt_erase_cmd;
+       uint32_t        fdt_block_size;
+       uint32_t        fdt_unprotect_sec_cmd;
+       uint32_t        fdt_protect_sec_cmd;
+
+       uint32_t        flt_region_flt;
+       uint32_t        flt_region_fdt;
+       uint32_t        flt_region_boot;
+       uint32_t        flt_region_fw;
+       uint32_t        flt_region_vpd_nvram;
+       uint32_t        flt_region_vpd;
+       uint32_t        flt_region_nvram;
+       uint32_t        flt_region_npiv_conf;
 
        /* Needed for BEACON */
-       uint16_t        beacon_blink_led;
-       uint8_t         beacon_color_state;
+       uint16_t        beacon_blink_led;
+       uint8_t         beacon_color_state;
 #define QLA_LED_GRN_ON         0x01
 #define QLA_LED_YLW_ON         0x02
 #define QLA_LED_ABR_ON         0x04
 #define QLA_LED_ALL_ON         0x07    /* yellow, green, amber. */
                                        /* ISP2322: red, green, amber. */
-
-       uint16_t        zio_mode;
-       uint16_t        zio_timer;
+       uint16_t        zio_mode;
+       uint16_t        zio_timer;
        struct fc_host_statistics fc_host_stat;
-} scsi_qla_host_t;
 
+       struct qla_msix_entry *msix_entries;
+
+       struct list_head        vp_list;        /* list of VP */
+       unsigned long   vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) /
+                       sizeof(unsigned long)];
+       uint16_t        num_vhosts;     /* number of vports created */
+       uint16_t        num_vsans;      /* number of vsan created */
+       uint16_t        max_npiv_vports;        /* 63 or 125 per topoloty */
+       int             cur_vport_count;
+
+       struct qla_chip_state_84xx *cs84xx;
+       struct qla_statistics qla_stats;
+       struct isp_operations *isp_ops;
+};
+
+/*
+ * Qlogic scsi host structure
+ */
+typedef struct scsi_qla_host {
+       struct list_head list;
+       struct list_head vp_fcports;    /* list of fcports */
+       struct list_head work_list;
+       /* Commonly used flags and state information. */
+       struct Scsi_Host *host;
+       unsigned long   host_no;
+       uint8_t         host_str[16];
+
+       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;
+               uint32_t        process_response_queue  :1;
+       } flags;
+
+       atomic_t        loop_state;
+#define LOOP_TIMEOUT   1
+#define LOOP_DOWN      2
+#define LOOP_UP                3
+#define LOOP_UPDATE    4
+#define LOOP_READY     5
+#define LOOP_DEAD      6
+
+       unsigned long   dpc_flags;
+#define RESET_MARKER_NEEDED    0       /* Send marker to ISP. */
+#define RESET_ACTIVE           1
+#define ISP_ABORT_NEEDED       2       /* Initiate ISP abort. */
+#define ABORT_ISP_ACTIVE       3       /* ISP abort in progress. */
+#define LOOP_RESYNC_NEEDED     4       /* Device Resync needed. */
+#define LOOP_RESYNC_ACTIVE     5
+#define LOCAL_LOOP_UPDATE      6       /* Perform a local loop update. */
+#define RSCN_UPDATE            7       /* Perform an RSCN update. */
+#define RELOGIN_NEEDED         8
+#define REGISTER_FC4_NEEDED    9       /* SNS FC4 registration required. */
+#define ISP_ABORT_RETRY                10      /* ISP aborted. */
+#define BEACON_BLINK_NEEDED    11
+#define REGISTER_FDMI_NEEDED   12
+#define FCPORT_UPDATE_NEEDED   13
+#define VP_DPC_NEEDED          14      /* wake up for VP dpc handling */
+#define UNLOADING              15
+#define NPIV_CONFIG_NEEDED     16
+
+       uint32_t        device_flags;
+#define SWITCH_FOUND           BIT_0
+#define DFLG_NO_CABLE          BIT_1
+
+       srb_t           *status_srb;    /* Status continuation entry. */
+
+       /* ISP configuration data. */
+       uint16_t        loop_id;                /* Host adapter loop id */
+
+       port_id_t       d_id;                   /* Host adapter port id */
+       uint8_t         marker_needed;
+       uint16_t        mgmt_svr_loop_id;
+
+
+
+       /* 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 */
+       uint8_t         link_down_timeout;       /* link down timeout */
+
+       uint32_t        timer_active;
+       struct timer_list        timer;
+
+       uint8_t         node_name[WWN_SIZE];
+       uint8_t         port_name[WWN_SIZE];
+       uint8_t         fabric_node_name[WWN_SIZE];
+
+       uint16_t        fcoe_vlan_id;
+       uint16_t        fcoe_fcf_idx;
+       uint8_t         fcoe_vn_port_mac[6];
+
+       uint32_t        vp_abort_cnt;
+
+       struct fc_vport *fc_vport;      /* holds fc_vport * for each vport */
+       uint16_t        vp_idx;         /* vport ID */
+
+       unsigned long           vp_flags;
+#define VP_IDX_ACQUIRED                0       /* bit no 0 */
+#define VP_CREATE_NEEDED       1
+#define VP_BIND_NEEDED         2
+#define VP_DELETE_NEEDED       3
+#define VP_SCR_NEEDED          4       /* State Change Request registration */
+       atomic_t                vp_state;
+#define VP_OFFLINE             0
+#define VP_ACTIVE              1
+#define VP_FAILED              2
+// #define VP_DISABLE          3
+       uint16_t        vp_err_state;
+       uint16_t        vp_prev_err_state;
+#define VP_ERR_UNKWN           0
+#define VP_ERR_PORTDWN         1
+#define VP_ERR_FAB_UNSUPPORTED 2
+#define VP_ERR_FAB_NORESOURCES 3
+#define VP_ERR_FAB_LOGOUT      4
+#define VP_ERR_ADAP_NORESOURCES        5
+       struct qla_hw_data *hw;
+       int     req_ques[QLA_MAX_HOST_QUES];
+} scsi_qla_host_t;
 
 /*
  * Macros to help code, maintain, etc.
@@ -2354,8 +2659,6 @@ typedef struct scsi_qla_host {
         test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
         atomic_read(&ha->loop_state) == LOOP_DOWN)
 
-#define to_qla_host(x)         ((scsi_qla_host_t *) (x)->hostdata)
-
 #define qla_printk(level, ha, format, arg...) \
        dev_printk(level , &((ha)->pdev->dev) , format , ## arg)
 
@@ -2396,16 +2699,13 @@ typedef struct scsi_qla_host {
 #define OPTROM_SIZE_2300       0x20000
 #define OPTROM_SIZE_2322       0x100000
 #define OPTROM_SIZE_24XX       0x100000
+#define OPTROM_SIZE_25XX       0x200000
+#define OPTROM_SIZE_81XX       0x400000
 
 #include "qla_gbl.h"
 #include "qla_dbg.h"
 #include "qla_inline.h"
 
 #define CMD_SP(Cmnd)           ((Cmnd)->SCp.ptr)
-#define CMD_COMPL_STATUS(Cmnd)  ((Cmnd)->SCp.this_residual)
-#define CMD_RESID_LEN(Cmnd)    ((Cmnd)->SCp.buffers_residual)
-#define CMD_SCSI_STATUS(Cmnd)  ((Cmnd)->SCp.Status)
-#define CMD_ACTUAL_SNSLEN(Cmnd)        ((Cmnd)->SCp.Message)
-#define CMD_ENTRY_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in)
 
 #endif