nfsd4: setclientid_confirm callback-change fixes
[safe/jmp/linux-2.6] / drivers / scsi / lpfc / lpfc_hw.h
index 4304168..4168c7b 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2007 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2008 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
 #define SLI3_IOCB_CMD_SIZE     128
 #define SLI3_IOCB_RSP_SIZE     64
 
+
+/* vendor ID used in SCSI netlink calls */
+#define LPFC_NL_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX)
+
 /* Common Transport structures and definitions */
 
 union CtRevisionId {
@@ -84,6 +88,9 @@ union CtCommandResponse {
        uint32_t word;
 };
 
+#define FC4_FEATURE_INIT 0x2
+#define FC4_FEATURE_TARGET 0x1
+
 struct lpfc_sli_ct_request {
        /* Structure is in Big Endian format */
        union CtRevisionId RevisionId;
@@ -126,20 +133,6 @@ struct lpfc_sli_ct_request {
 
                        uint32_t rsvd[7];
                } rft;
-               struct rff {
-                       uint32_t PortId;
-                       uint8_t reserved[2];
-#ifdef __BIG_ENDIAN_BITFIELD
-                       uint8_t feature_res:6;
-                       uint8_t feature_init:1;
-                       uint8_t feature_tgt:1;
-#else  /*  __LITTLE_ENDIAN_BITFIELD */
-                       uint8_t feature_tgt:1;
-                       uint8_t feature_init:1;
-                       uint8_t feature_res:6;
-#endif
-                       uint8_t type_code;     /* type=8 for FCP */
-               } rff;
                struct rnn {
                        uint32_t PortId;        /* For RNN_ID requests */
                        uint8_t wwnn[8];
@@ -149,15 +142,47 @@ struct lpfc_sli_ct_request {
                        uint8_t len;
                        uint8_t symbname[255];
                } rsnn;
+               struct da_id { /* For DA_ID requests */
+                       uint32_t port_id;
+               } da_id;
+               struct rspn {   /* For RSPN_ID requests */
+                       uint32_t PortId;
+                       uint8_t len;
+                       uint8_t symbname[255];
+               } rspn;
+               struct gff {
+                       uint32_t PortId;
+               } gff;
+               struct gff_acc {
+                       uint8_t fbits[128];
+               } gff_acc;
+#define FCP_TYPE_FEATURE_OFFSET 7
+               struct rff {
+                       uint32_t PortId;
+                       uint8_t reserved[2];
+                       uint8_t fbits;
+                       uint8_t type_code;     /* type=8 for FCP */
+               } rff;
        } un;
 };
 
 #define  SLI_CT_REVISION        1
-#define  GID_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 260)
-#define  RFT_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 228)
-#define  RFF_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 235)
-#define  RNN_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 252)
-#define  RSNN_REQUEST_SZ        (sizeof(struct lpfc_sli_ct_request))
+#define  GID_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct gid))
+#define  GFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct gff))
+#define  RFT_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct rft))
+#define  RFF_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct rff))
+#define  RNN_REQUEST_SZ   (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct rnn))
+#define  RSNN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct rsnn))
+#define DA_ID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
+                         sizeof(struct da_id))
+#define  RSPN_REQUEST_SZ  (offsetof(struct lpfc_sli_ct_request, un) + \
+                          sizeof(struct rspn))
 
 /*
  * FsType Definitions
@@ -232,6 +257,7 @@ struct lpfc_sli_ct_request {
 #define  SLI_CTNS_GFT_ID      0x0117
 #define  SLI_CTNS_GSPN_ID     0x0118
 #define  SLI_CTNS_GPT_ID      0x011A
+#define  SLI_CTNS_GFF_ID      0x011F
 #define  SLI_CTNS_GID_PN      0x0121
 #define  SLI_CTNS_GID_NN      0x0131
 #define  SLI_CTNS_GIP_NN      0x0135
@@ -245,9 +271,9 @@ struct lpfc_sli_ct_request {
 #define  SLI_CTNS_RNN_ID      0x0213
 #define  SLI_CTNS_RCS_ID      0x0214
 #define  SLI_CTNS_RFT_ID      0x0217
-#define  SLI_CTNS_RFF_ID      0x021F
 #define  SLI_CTNS_RSPN_ID     0x0218
 #define  SLI_CTNS_RPT_ID      0x021A
+#define  SLI_CTNS_RFF_ID      0x021F
 #define  SLI_CTNS_RIP_NN      0x0235
 #define  SLI_CTNS_RIPA_NN     0x0236
 #define  SLI_CTNS_RSNN_NN     0x0239
@@ -316,8 +342,9 @@ struct csp {
        uint8_t bbCreditlsb;    /* FC Word 0, byte 3 */
 
 #ifdef __BIG_ENDIAN_BITFIELD
-       uint16_t increasingOffset:1;    /* FC Word 1, bit 31 */
-       uint16_t response_multiple_Nport:1;     /* FC Word 1, bit 29 */
+       uint16_t request_multiple_Nport:1;      /* FC Word 1, bit 31 */
+       uint16_t randomOffset:1;        /* FC Word 1, bit 30 */
+       uint16_t response_multiple_NPort:1;     /* FC Word 1, bit 29 */
        uint16_t fPort:1;       /* FC Word 1, bit 28 */
        uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
        uint16_t edtovResolution:1;     /* FC Word 1, bit 26 */
@@ -336,9 +363,9 @@ struct csp {
        uint16_t edtovResolution:1;     /* FC Word 1, bit 26 */
        uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
        uint16_t fPort:1;       /* FC Word 1, bit 28 */
-       uint16_t word1Reserved2:1;      /* FC Word 1, bit 29 */
+       uint16_t response_multiple_NPort:1;     /* FC Word 1, bit 29 */
        uint16_t randomOffset:1;        /* FC Word 1, bit 30 */
-       uint16_t increasingOffset:1;    /* FC Word 1, bit 31 */
+       uint16_t request_multiple_Nport:1;      /* FC Word 1, bit 31 */
 
        uint16_t payloadlength:1;       /* FC Word 1, bit 16 */
        uint16_t contIncSeqCnt:1;       /* FC Word 1, bit 17 */
@@ -557,6 +584,7 @@ struct ls_rjt {     /* Structure is in Big Endian format */
 #define LSEXP_INVALID_O_SID     0x15
 #define LSEXP_INVALID_OX_RX     0x17
 #define LSEXP_CMD_IN_PROGRESS   0x19
+#define LSEXP_PORT_LOGIN_REQ    0x1E
 #define LSEXP_INVALID_NPORT_ID  0x1F
 #define LSEXP_INVALID_SEQ_ID    0x21
 #define LSEXP_INVALID_XCHG      0x23
@@ -786,7 +814,7 @@ typedef struct _RNID {              /* Structure is in Big Endian format */
        } un;
 } RNID;
 
-typedef struct  _RPS {         /* Structure is in Big Endian format */
+typedef struct  _RPS {         /* Structure is in Big Endian format */
        union {
                uint32_t portNum;
                struct lpfc_name portName;
@@ -804,7 +832,7 @@ typedef struct  _RPS_RSP {  /* Structure is in Big Endian format */
        uint32_t crcCnt;
 } RPS_RSP;
 
-typedef struct  _RPL {         /* Structure is in Big Endian format */
+typedef struct  _RPL {         /* Structure is in Big Endian format */
        uint32_t maxsize;
        uint32_t index;
 } RPL;
@@ -815,7 +843,7 @@ typedef struct  _PORT_NUM_BLK {
        struct lpfc_name portName;
 } PORT_NUM_BLK;
 
-typedef struct  _RPL_RSP {     /* Structure is in Big Endian format */
+typedef struct  _RPL_RSP {     /* Structure is in Big Endian format */
        uint32_t listLen;
        uint32_t index;
        PORT_NUM_BLK port_num_blk;
@@ -841,6 +869,12 @@ typedef struct _D_ID {             /* Structure is in Big Endian format */
        } un;
 } D_ID;
 
+#define RSCN_ADDRESS_FORMAT_PORT       0x0
+#define RSCN_ADDRESS_FORMAT_AREA       0x1
+#define RSCN_ADDRESS_FORMAT_DOMAIN     0x2
+#define RSCN_ADDRESS_FORMAT_FABRIC     0x3
+#define RSCN_ADDRESS_FORMAT_MASK       0x3
+
 /*
  *  Structure to define all ELS Payload types
  */
@@ -1082,6 +1116,8 @@ typedef struct {
 /* Start FireFly Register definitions */
 #define PCI_VENDOR_ID_EMULEX        0x10df
 #define PCI_DEVICE_ID_FIREFLY       0x1ae5
+#define PCI_DEVICE_ID_PROTEUS_VF    0xe100
+#define PCI_DEVICE_ID_PROTEUS_PF    0xe180
 #define PCI_DEVICE_ID_SAT_SMB       0xf011
 #define PCI_DEVICE_ID_SAT_MID       0xf015
 #define PCI_DEVICE_ID_RFLY          0xf095
@@ -1108,10 +1144,12 @@ typedef struct {
 #define PCI_DEVICE_ID_LP11000S      0xfc10
 #define PCI_DEVICE_ID_LPE11000S     0xfc20
 #define PCI_DEVICE_ID_SAT_S         0xfc40
+#define PCI_DEVICE_ID_PROTEUS_S     0xfc50
 #define PCI_DEVICE_ID_HELIOS        0xfd00
 #define PCI_DEVICE_ID_HELIOS_SCSP   0xfd11
 #define PCI_DEVICE_ID_HELIOS_DCSP   0xfd12
 #define PCI_DEVICE_ID_ZEPHYR        0xfe00
+#define PCI_DEVICE_ID_HORNET        0xfe05
 #define PCI_DEVICE_ID_ZEPHYR_SCSP   0xfe11
 #define PCI_DEVICE_ID_ZEPHYR_DCSP   0xfe12
 
@@ -1129,6 +1167,7 @@ typedef struct {
 #define ZEPHYR_JEDEC_ID             0x0577
 #define VIPER_JEDEC_ID              0x4838
 #define SATURN_JEDEC_ID             0x1004
+#define HORNET_JDEC_ID              0x2057706D
 
 #define JEDEC_ID_MASK               0x0FFFF000
 #define JEDEC_ID_SHIFT              12
@@ -1173,6 +1212,18 @@ typedef struct {         /* FireFly BIU registers */
 #define HA_RXATT       0x00000008      /* Bit  3 */
 #define HA_RXMASK      0x0000000f
 
+#define HA_R0_CLR_MSK  (HA_R0RE_REQ | HA_R0CE_RSP | HA_R0ATT)
+#define HA_R1_CLR_MSK  (HA_R1RE_REQ | HA_R1CE_RSP | HA_R1ATT)
+#define HA_R2_CLR_MSK  (HA_R2RE_REQ | HA_R2CE_RSP | HA_R2ATT)
+#define HA_R3_CLR_MSK  (HA_R3RE_REQ | HA_R3CE_RSP | HA_R3ATT)
+
+#define HA_R0_POS      3
+#define HA_R1_POS      7
+#define HA_R2_POS      11
+#define HA_R3_POS      15
+#define HA_LE_POS      29
+#define HA_MB_POS      30
+#define HA_ER_POS      31
 /* Chip Attention Register */
 
 #define CA_REG_OFFSET  4       /* Byte offset from register base address */
@@ -1205,11 +1256,12 @@ typedef struct {                /* FireFly BIU registers */
 #define HS_FFER3       0x20000000      /* Bit 29 */
 #define HS_FFER2       0x40000000      /* Bit 30 */
 #define HS_FFER1       0x80000000      /* Bit 31 */
-#define HS_FFERM       0xFF000000      /* Mask for error bits 31:24 */
+#define HS_CRIT_TEMP   0x00000100      /* Bit 8  */
+#define HS_FFERM       0xFF000100      /* Mask for error bits 31:24 and 8 */
 
 /* Host Control Register */
 
-#define HC_REG_OFFSET  12      /* Word offset from register base address */
+#define HC_REG_OFFSET  12      /* Byte offset from register base address */
 
 #define HC_MBINT_ENA   0x00000001      /* Bit  0 */
 #define HC_R0INT_ENA   0x00000002      /* Bit  1 */
@@ -1222,6 +1274,19 @@ typedef struct {         /* FireFly BIU registers */
 #define HC_LAINT_ENA   0x20000000      /* Bit 29 */
 #define HC_ERINT_ENA   0x80000000      /* Bit 31 */
 
+/* Message Signaled Interrupt eXtension (MSI-X) message identifiers */
+#define MSIX_DFLT_ID   0
+#define MSIX_RNG0_ID   0
+#define MSIX_RNG1_ID   1
+#define MSIX_RNG2_ID   2
+#define MSIX_RNG3_ID   3
+
+#define MSIX_LINK_ID   4
+#define MSIX_MBOX_ID   5
+
+#define MSIX_SPARE0_ID 6
+#define MSIX_SPARE1_ID 7
+
 /* Mailbox Commands */
 #define MBX_SHUTDOWN        0x00       /* terminate testing */
 #define MBX_LOAD_SM         0x01
@@ -1254,11 +1319,18 @@ typedef struct {                /* FireFly BIU registers */
 #define MBX_DEL_LD_ENTRY    0x1D
 #define MBX_RUN_PROGRAM     0x1E
 #define MBX_SET_MASK        0x20
-#define MBX_SET_SLIM        0x21
+#define MBX_SET_VARIABLE    0x21
 #define MBX_UNREG_D_ID      0x23
 #define MBX_KILL_BOARD      0x24
 #define MBX_CONFIG_FARP     0x25
 #define MBX_BEACON          0x2A
+#define MBX_CONFIG_MSI      0x30
+#define MBX_HEARTBEAT       0x31
+#define MBX_WRITE_VPARMS    0x32
+#define MBX_ASYNCEVT_ENABLE 0x33
+
+#define MBX_PORT_CAPABILITIES 0x3B
+#define MBX_PORT_IOV_CONTROL 0x3C
 
 #define MBX_CONFIG_HBQ     0x7C
 #define MBX_LOAD_AREA       0x81
@@ -1268,8 +1340,12 @@ typedef struct {         /* FireFly BIU registers */
 #define MBX_READ_RPI64      0x8F
 #define MBX_REG_LOGIN64     0x93
 #define MBX_READ_LA64       0x95
+#define MBX_REG_VPI        0x96
+#define MBX_UNREG_VPI      0x97
+#define MBX_REG_VNPID      0x96
+#define MBX_UNREG_VNPID            0x97
 
-#define MBX_FLASH_WR_ULA    0x98
+#define MBX_WRITE_WWN       0x98
 #define MBX_SET_DEBUG       0x99
 #define MBX_LOAD_EXP_ROM    0x9C
 
@@ -1316,6 +1392,7 @@ typedef struct {          /* FireFly BIU registers */
 
 /*  SLI_2 IOCB Command Set */
 
+#define CMD_ASYNC_STATUS        0x7C
 #define CMD_RCV_SEQUENCE64_CX   0x81
 #define CMD_XMIT_SEQUENCE64_CR  0x82
 #define CMD_XMIT_SEQUENCE64_CX  0x83
@@ -1340,13 +1417,29 @@ typedef struct {                /* FireFly BIU registers */
 #define CMD_FCP_TRECEIVE64_CX   0xA1
 #define CMD_FCP_TRSP64_CX       0xA3
 
+#define CMD_QUE_XRI64_CX       0xB3
 #define CMD_IOCB_RCV_SEQ64_CX  0xB5
 #define CMD_IOCB_RCV_ELS64_CX  0xB7
+#define CMD_IOCB_RET_XRI64_CX  0xB9
 #define CMD_IOCB_RCV_CONT64_CX 0xBB
 
 #define CMD_GEN_REQUEST64_CR    0xC2
 #define CMD_GEN_REQUEST64_CX    0xC3
 
+/* Unhandled SLI-3 Commands */
+#define CMD_IOCB_XMIT_MSEQ64_CR                0xB0
+#define CMD_IOCB_XMIT_MSEQ64_CX                0xB1
+#define CMD_IOCB_RCV_SEQ_LIST64_CX     0xC1
+#define CMD_IOCB_RCV_ELS_LIST64_CX     0xCD
+#define CMD_IOCB_CLOSE_EXTENDED_CN     0xB6
+#define CMD_IOCB_ABORT_EXTENDED_CN     0xBA
+#define CMD_IOCB_RET_HBQE64_CN         0xCA
+#define CMD_IOCB_FCP_IBIDIR64_CR       0xAC
+#define CMD_IOCB_FCP_IBIDIR64_CX       0xAD
+#define CMD_IOCB_FCP_ITASKMGT64_CX     0xAF
+#define CMD_IOCB_LOGENTRY_CN           0x94
+#define CMD_IOCB_LOGENTRY_ASYNC_CN     0x96
+
 #define CMD_MAX_IOCB_CMD        0xE6
 #define CMD_IOCB_MASK           0xff
 
@@ -1378,6 +1471,8 @@ typedef struct {          /* FireFly BIU registers */
 #define MBX_BUSY                   0xffffff /* Attempted cmd to busy Mailbox */
 #define MBX_TIMEOUT                0xfffffe /* time-out expired waiting for */
 
+#define TEMPERATURE_OFFSET 0xB0        /* Slim offset for critical temperature event */
+
 /*
  *    Begin Structure Definitions for Mailbox Commands
  */
@@ -1422,24 +1517,18 @@ struct ulp_bde64 {      /* SLI-2 */
                        uint32_t bdeFlags:8;    /* BDE Flags 0 IS A SUPPORTED
                                                   VALUE !! */
 #endif
-
-#define BUFF_USE_RSVD       0x01       /* bdeFlags */
-#define BUFF_USE_INTRPT     0x02       /* Not Implemented with LP6000 */
-#define BUFF_USE_CMND       0x04       /* Optional, 1=cmd/rsp 0=data buffer */
-#define BUFF_USE_RCV        0x08       /*  "" "", 1=rcv buffer, 0=xmit
-                                           buffer */
-#define BUFF_TYPE_32BIT     0x10       /*  "" "", 1=32 bit addr 0=64 bit
-                                           addr */
-#define BUFF_TYPE_SPECIAL   0x20       /* Not Implemented with LP6000  */
-#define BUFF_TYPE_BDL       0x40       /* Optional,  may be set in BDL */
-#define BUFF_TYPE_INVALID   0x80       /*  ""  "" */
+#define BUFF_TYPE_BDE_64    0x00       /* BDE (Host_resident) */
+#define BUFF_TYPE_BDE_IMMED 0x01       /* Immediate Data BDE */
+#define BUFF_TYPE_BDE_64P   0x02       /* BDE (Port-resident) */
+#define BUFF_TYPE_BDE_64I   0x08       /* Input BDE (Host-resident) */
+#define BUFF_TYPE_BDE_64IP  0x0A       /* Input BDE (Port-resident) */
+#define BUFF_TYPE_BLP_64    0x40       /* BLP (Host-resident) */
+#define BUFF_TYPE_BLP_64P   0x42       /* BLP (Port-resident) */
                } f;
        } tus;
        uint32_t addrLow;
        uint32_t addrHigh;
 };
-#define BDE64_SIZE_WORD 0
-#define BPL64_SIZE_WORD 0x40
 
 typedef struct ULP_BDL {       /* SLI-2 */
 #ifdef __BIG_ENDIAN_BITFIELD
@@ -1455,6 +1544,108 @@ typedef struct ULP_BDL {        /* SLI-2 */
        uint32_t ulpIoTag32;    /* Can be used for 32 bit I/O Tag */
 } ULP_BDL;
 
+/*
+ * BlockGuard Definitions
+ */
+
+enum lpfc_protgrp_type {
+       LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors                  */
+       LPFC_PG_TYPE_NO_DIF,      /* no DIF data pointed to by prot grp       */
+       LPFC_PG_TYPE_EMBD_DIF,    /* DIF is embedded (inline) with data       */
+       LPFC_PG_TYPE_DIF_BUF      /* DIF has its own scatter/gather list      */
+};
+
+/* PDE Descriptors */
+#define LPFC_PDE1_DESCRIPTOR           0x81
+#define LPFC_PDE2_DESCRIPTOR           0x82
+#define LPFC_PDE3_DESCRIPTOR           0x83
+
+/* BlockGuard Profiles */
+enum lpfc_bg_prof_codes {
+       LPFC_PROF_INVALID,
+       LPFC_PROF_A1    = 128,  /* Full Protection                            */
+       LPFC_PROF_A2,           /* Disabled Protection Checks:A2~A4           */
+       LPFC_PROF_A3,
+       LPFC_PROF_A4,
+       LPFC_PROF_B1,           /* Embedded DIFs: B1~B3                       */
+       LPFC_PROF_B2,
+       LPFC_PROF_B3,
+       LPFC_PROF_C1,           /* Separate DIFs: C1~C3                       */
+       LPFC_PROF_C2,
+       LPFC_PROF_C3,
+       LPFC_PROF_D1,           /* Full Protection                            */
+       LPFC_PROF_D2,           /* Partial Protection & Check Disabling       */
+       LPFC_PROF_D3,
+       LPFC_PROF_E1,           /* E1~E4:out - check-only, in - update apptag */
+       LPFC_PROF_E2,
+       LPFC_PROF_E3,
+       LPFC_PROF_E4,
+       LPFC_PROF_F1,           /* Full Translation - F1 Prot Descriptor      */
+                               /* F1 Translation BDE                         */
+       LPFC_PROF_ANT1,         /* TCP checksum, DIF inline with data buffers */
+       LPFC_PROF_AST1,         /* TCP checksum, DIF split from data buffer   */
+       LPFC_PROF_ANT2,
+       LPFC_PROF_AST2
+};
+
+/* BlockGuard error-control defines */
+#define BG_EC_STOP_ERR                 0x00
+#define BG_EC_CONT_ERR                 0x01
+#define BG_EC_IGN_UNINIT_STOP_ERR      0x10
+#define BG_EC_IGN_UNINIT_CONT_ERR      0x11
+
+/* PDE (Protection Descriptor Entry) word 0 bit masks and shifts */
+#define PDE_DESC_TYPE_MASK             0xff000000
+#define PDE_DESC_TYPE_SHIFT            24
+#define PDE_BG_PROFILE_MASK            0x00ff0000
+#define PDE_BG_PROFILE_SHIFT           16
+#define PDE_BLOCK_LEN_MASK             0x0000fffc
+#define PDE_BLOCK_LEN_SHIFT            2
+#define PDE_ERR_CTRL_MASK              0x00000003
+#define PDE_ERR_CTRL_SHIFT             0
+/* PDE word 1 bit masks and shifts */
+#define PDE_APPTAG_MASK_MASK           0xffff0000
+#define PDE_APPTAG_MASK_SHIFT          16
+#define PDE_APPTAG_VAL_MASK            0x0000ffff
+#define PDE_APPTAG_VAL_SHIFT           0
+struct lpfc_pde {
+       uint32_t parms;     /* bitfields of descriptor, prof, len, and ec */
+       uint32_t apptag;    /* bitfields of app tag maskand app tag value */
+       uint32_t reftag;    /* reference tag occupying all 32 bits        */
+};
+
+/* inline function to set fields in parms of PDE */
+static inline void
+lpfc_pde_set_bg_parms(struct lpfc_pde *p, u8 desc, u8 prof, u16 len, u8 ec)
+{
+       uint32_t *wp = &p->parms;
+
+       /* spec indicates that adapter appends two 0's to length field */
+       len = len >> 2;
+
+       *wp &= 0;
+       *wp |= ((desc << PDE_DESC_TYPE_SHIFT) & PDE_DESC_TYPE_MASK);
+       *wp |= ((prof << PDE_BG_PROFILE_SHIFT) & PDE_BG_PROFILE_MASK);
+       *wp |= ((len << PDE_BLOCK_LEN_SHIFT) & PDE_BLOCK_LEN_MASK);
+       *wp |= ((ec << PDE_ERR_CTRL_SHIFT) & PDE_ERR_CTRL_MASK);
+       *wp = le32_to_cpu(*wp);
+}
+
+/* inline function to set apptag and reftag fields of PDE */
+static inline void
+lpfc_pde_set_dif_parms(struct lpfc_pde *p, u16 apptagmask, u16 apptagval,
+               u32 reftag)
+{
+       uint32_t *wp = &p->apptag;
+       *wp &= 0;
+       *wp |= ((apptagmask << PDE_APPTAG_MASK_SHIFT) & PDE_APPTAG_MASK_MASK);
+       *wp |= ((apptagval << PDE_APPTAG_VAL_SHIFT) & PDE_APPTAG_VAL_MASK);
+       *wp = le32_to_cpu(*wp);
+       wp = &p->reftag;
+       *wp = le32_to_cpu(reftag);
+}
+
+
 /* Structure for MB Command LOAD_SM and DOWN_LOAD */
 
 typedef struct {
@@ -1570,7 +1761,7 @@ typedef struct {
 #define FLAGS_TOPOLOGY_MODE_PT_PT    0x02 /* Attempt pt-pt only */
 #define FLAGS_TOPOLOGY_MODE_LOOP     0x04 /* Attempt loop only */
 #define FLAGS_TOPOLOGY_MODE_PT_LOOP  0x06 /* Attempt pt-pt then loop */
-#define FLAGS_UNREG_LOGIN_ALL        0x08 /* UNREG_LOGIN all on link down */
+#define        FLAGS_UNREG_LOGIN_ALL        0x08 /* UNREG_LOGIN all on link down */
 #define FLAGS_LIRP_LILP              0x80 /* LIRP / LILP is disabled */
 
 #define FLAGS_TOPOLOGY_FAILOVER      0x0400    /* Bit 10 */
@@ -1754,8 +1945,6 @@ typedef struct {
 #define LMT_4Gb       0x040
 #define LMT_8Gb       0x080
 #define LMT_10Gb      0x100
-
-
        uint32_t rsvd2;
        uint32_t rsvd3;
        uint32_t max_xri;
@@ -1764,7 +1953,10 @@ typedef struct {
        uint32_t avail_xri;
        uint32_t avail_iocb;
        uint32_t avail_rpi;
-       uint32_t default_rpi;
+       uint32_t max_vpi;
+       uint32_t rsvd4;
+       uint32_t rsvd5;
+       uint32_t avail_vpi;
 } READ_CONFIG_VAR;
 
 /* Structure for MB Command READ_RCONFIG (12) */
@@ -2086,6 +2278,45 @@ typedef struct {
 #endif
 } UNREG_LOGIN_VAR;
 
+/* Structure for MB Command REG_VPI (0x96) */
+typedef struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t rsvd1;
+       uint32_t rsvd2:8;
+       uint32_t sid:24;
+       uint32_t rsvd3;
+       uint32_t rsvd4;
+       uint32_t rsvd5;
+       uint16_t rsvd6;
+       uint16_t vpi;
+#else  /*  __LITTLE_ENDIAN */
+       uint32_t rsvd1;
+       uint32_t sid:24;
+       uint32_t rsvd2:8;
+       uint32_t rsvd3;
+       uint32_t rsvd4;
+       uint32_t rsvd5;
+       uint16_t vpi;
+       uint16_t rsvd6;
+#endif
+} REG_VPI_VAR;
+
+/* Structure for MB Command UNREG_VPI (0x97) */
+typedef struct {
+       uint32_t rsvd1;
+       uint32_t rsvd2;
+       uint32_t rsvd3;
+       uint32_t rsvd4;
+       uint32_t rsvd5;
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint16_t rsvd6;
+       uint16_t vpi;
+#else  /*  __LITTLE_ENDIAN */
+       uint16_t vpi;
+       uint16_t rsvd6;
+#endif
+} UNREG_VPI_VAR;
+
 /* Structure for MB Command UNREG_D_ID (0x23) */
 
 typedef struct {
@@ -2109,7 +2340,10 @@ typedef struct {
 typedef struct {
        uint32_t eventTag;      /* Event tag */
 #ifdef __BIG_ENDIAN_BITFIELD
-       uint32_t rsvd1:22;
+       uint32_t rsvd1:19;
+       uint32_t fa:1;
+       uint32_t mm:1;          /* Menlo Maintenance mode enabled */
+       uint32_t rx:1;
        uint32_t pb:1;
        uint32_t il:1;
        uint32_t attType:8;
@@ -2117,7 +2351,10 @@ typedef struct {
        uint32_t attType:8;
        uint32_t il:1;
        uint32_t pb:1;
-       uint32_t rsvd1:22;
+       uint32_t rx:1;
+       uint32_t mm:1;
+       uint32_t fa:1;
+       uint32_t rsvd1:19;
 #endif
 
 #define AT_RESERVED    0x00    /* Reserved - attType */
@@ -2138,6 +2375,7 @@ typedef struct {
 
 #define TOPOLOGY_PT_PT 0x01    /* Topology is pt-pt / pt-fabric */
 #define TOPOLOGY_LOOP  0x02    /* Topology is FC-AL */
+#define TOPOLOGY_LNK_MENLO_MAINTENANCE 0x05 /* maint mode zephtr to menlo */
 
        union {
                struct ulp_bde lilpBde; /* This BDE points to a 128 byte buffer
@@ -2232,6 +2470,60 @@ typedef struct {
 #define  DMP_RSP_OFFSET          0x14   /* word 5 contains first word of rsp */
 #define  DMP_RSP_SIZE            0x6C   /* maximum of 27 words of rsp data */
 
+#define  WAKE_UP_PARMS_REGION_ID    4
+#define  WAKE_UP_PARMS_WORD_SIZE   15
+
+/* Option rom version structure */
+struct prog_id {
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint8_t  type;
+       uint8_t  id;
+       uint32_t ver:4;  /* Major Version */
+       uint32_t rev:4;  /* Revision */
+       uint32_t lev:2;  /* Level */
+       uint32_t dist:2; /* Dist Type */
+       uint32_t num:4;  /* number after dist type */
+#else /*  __LITTLE_ENDIAN_BITFIELD */
+       uint32_t num:4;  /* number after dist type */
+       uint32_t dist:2; /* Dist Type */
+       uint32_t lev:2;  /* Level */
+       uint32_t rev:4;  /* Revision */
+       uint32_t ver:4;  /* Major Version */
+       uint8_t  id;
+       uint8_t  type;
+#endif
+};
+
+/* Structure for MB Command UPDATE_CFG (0x1B) */
+
+struct update_cfg_var {
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t rsvd2:16;
+       uint32_t type:8;
+       uint32_t rsvd:1;
+       uint32_t ra:1;
+       uint32_t co:1;
+       uint32_t cv:1;
+       uint32_t req:4;
+       uint32_t entry_length:16;
+       uint32_t region_id:16;
+#else  /*  __LITTLE_ENDIAN_BITFIELD */
+       uint32_t req:4;
+       uint32_t cv:1;
+       uint32_t co:1;
+       uint32_t ra:1;
+       uint32_t rsvd:1;
+       uint32_t type:8;
+       uint32_t rsvd2:16;
+       uint32_t region_id:16;
+       uint32_t entry_length:16;
+#endif
+
+       uint32_t resp_info;
+       uint32_t byte_cnt;
+       uint32_t data_offset;
+};
+
 struct hbq_mask {
 #ifdef __BIG_ENDIAN_BITFIELD
        uint8_t tmatch;
@@ -2395,11 +2687,19 @@ typedef struct {
 
        uint32_t pcbLow;       /* bit 31:0  of memory based port config block */
        uint32_t pcbHigh;      /* bit 63:32 of memory based port config block */
-       uint32_t hbainit[6];
+       uint32_t hbainit[5];
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t hps       :  1; /* bit 31 word9 Host Pointer in slim */
+       uint32_t rsvd      : 31; /* least significant 31 bits of word 9 */
+#else   /*  __LITTLE_ENDIAN */
+       uint32_t rsvd      : 31; /* least significant 31 bits of word 9 */
+       uint32_t hps       :  1; /* bit 31 word9 Host Pointer in slim */
+#endif
 
 #ifdef __BIG_ENDIAN_BITFIELD
-       uint32_t rsvd      : 24;  /* Reserved                             */
-       uint32_t cmv       :  1;  /* Configure Max VPIs                   */
+       uint32_t rsvd1     : 23;  /* Reserved                             */
+       uint32_t cbg       :  1;  /* Configure BlockGuard                 */
+       uint32_t cmv       :  1;  /* Configure Max VPIs                   */
        uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
        uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
        uint32_t chbs      :  1;  /* Cofigure Host Backing store          */
@@ -2416,10 +2716,12 @@ typedef struct {
        uint32_t csah      :  1;  /* Configure Synchronous Abort Handling */
        uint32_t ccrp      :  1;  /* Config Command Ring Polling          */
        uint32_t cmv       :  1;  /* Configure Max VPIs                   */
-       uint32_t rsvd      : 24;  /* Reserved                             */
+       uint32_t cbg       :  1;  /* Configure BlockGuard                 */
+       uint32_t rsvd1     : 23;  /* Reserved                             */
 #endif
 #ifdef __BIG_ENDIAN_BITFIELD
-       uint32_t rsvd2     : 24;  /* Reserved                             */
+       uint32_t rsvd2     : 23;  /* Reserved                             */
+       uint32_t gbg       :  1;  /* Grant BlockGuard                     */
        uint32_t gmv       :  1;  /* Grant Max VPIs                       */
        uint32_t gcrp      :  1;  /* Grant Command Ring Polling           */
        uint32_t gsah      :  1;  /* Grant Synchronous Abort Handling     */
@@ -2437,7 +2739,8 @@ typedef struct {
        uint32_t gsah      :  1;  /* Grant Synchronous Abort Handling     */
        uint32_t gcrp      :  1;  /* Grant Command Ring Polling           */
        uint32_t gmv       :  1;  /* Grant Max VPIs                       */
-       uint32_t rsvd2     : 24;  /* Reserved                             */
+       uint32_t gbg       :  1;  /* Grant BlockGuard                     */
+       uint32_t rsvd2     : 23;  /* Reserved                             */
 #endif
 
 #ifdef __BIG_ENDIAN_BITFIELD
@@ -2468,6 +2771,40 @@ typedef struct {
 
 } CONFIG_PORT_VAR;
 
+/* Structure for MB Command CONFIG_MSI (0x30) */
+struct config_msi_var {
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t dfltMsgNum:8;  /* Default message number            */
+       uint32_t rsvd1:11;      /* Reserved                          */
+       uint32_t NID:5;         /* Number of secondary attention IDs */
+       uint32_t rsvd2:5;       /* Reserved                          */
+       uint32_t dfltPresent:1; /* Default message number present    */
+       uint32_t addFlag:1;     /* Add association flag              */
+       uint32_t reportFlag:1;  /* Report association flag           */
+#else  /*  __LITTLE_ENDIAN_BITFIELD */
+       uint32_t reportFlag:1;  /* Report association flag           */
+       uint32_t addFlag:1;     /* Add association flag              */
+       uint32_t dfltPresent:1; /* Default message number present    */
+       uint32_t rsvd2:5;       /* Reserved                          */
+       uint32_t NID:5;         /* Number of secondary attention IDs */
+       uint32_t rsvd1:11;      /* Reserved                          */
+       uint32_t dfltMsgNum:8;  /* Default message number            */
+#endif
+       uint32_t attentionConditions[2];
+       uint8_t  attentionId[16];
+       uint8_t  messageNumberByHA[64];
+       uint8_t  messageNumberByID[16];
+       uint32_t autoClearHA[2];
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t rsvd3:16;
+       uint32_t autoClearID:16;
+#else  /*  __LITTLE_ENDIAN_BITFIELD */
+       uint32_t autoClearID:16;
+       uint32_t rsvd3:16;
+#endif
+       uint32_t rsvd4;
+};
+
 /* SLI-2 Port Control Block */
 
 /* SLIM POINTER */
@@ -2538,6 +2875,18 @@ typedef struct {
        uint32_t IPAddress;
 } CONFIG_FARP_VAR;
 
+/* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
+
+typedef struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t rsvd:30;
+       uint32_t ring:2;        /* Ring for ASYNC_EVENT iocb Bits 0-1*/
+#else /*  __LITTLE_ENDIAN */
+       uint32_t ring:2;        /* Ring for ASYNC_EVENT iocb Bits 0-1*/
+       uint32_t rsvd:30;
+#endif
+} ASYNCEVT_ENABLE_VAR;
+
 /* Union of all Mailbox Command types */
 #define MAILBOX_CMD_WSIZE      32
 #define MAILBOX_CMD_SIZE       (MAILBOX_CMD_WSIZE * sizeof(uint32_t))
@@ -2574,7 +2923,12 @@ typedef union {
                                         * NEW_FEATURE
                                         */
        struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ)  */
+       struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
        CONFIG_PORT_VAR varCfgPort;     /* cmd = 0x88 (CONFIG_PORT)  */
+       REG_VPI_VAR varRegVpi;          /* cmd = 0x96 (REG_VPI) */
+       UNREG_VPI_VAR varUnregVpi;      /* cmd = 0x97 (UNREG_VPI) */
+       ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
+       struct config_msi_var varCfgMSI;/* cmd = x30 (CONFIG_MSI)     */
 } MAILVARIANTS;
 
 /*
@@ -2608,12 +2962,19 @@ struct sli3_pgp {
        uint32_t hbq_get[16];
 };
 
-typedef union {
-       struct sli2_desc s2;
-       struct sli3_desc s3;
-       struct sli3_pgp  s3_pgp;
-} SLI_VAR;
+struct sli3_inb_pgp {
+       uint32_t ha_copy;
+       uint32_t counter;
+       struct lpfc_pgp port[MAX_RINGS];
+       uint32_t hbq_get[16];
+};
 
+union sli_var {
+       struct sli2_desc        s2;
+       struct sli3_desc        s3;
+       struct sli3_pgp         s3_pgp;
+       struct sli3_inb_pgp     s3_inb_pgp;
+};
 
 typedef struct {
 #ifdef __BIG_ENDIAN_BITFIELD
@@ -2631,7 +2992,7 @@ typedef struct {
 #endif
 
        MAILVARIANTS un;
-       SLI_VAR us;
+       union sli_var us;
 } MAILBOX_t;
 
 /*
@@ -2904,6 +3265,34 @@ typedef struct {
 #endif
 } RCV_ELS_REQ64;
 
+/* IOCB Command template for RCV_SEQ64 */
+struct rcv_seq64 {
+       struct ulp_bde64 elsReq;
+       uint32_t hbq_1;
+       uint32_t parmRo;
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint32_t rctl:8;
+       uint32_t type:8;
+       uint32_t dfctl:8;
+       uint32_t ls:1;
+       uint32_t fs:1;
+       uint32_t rsvd2:3;
+       uint32_t si:1;
+       uint32_t bc:1;
+       uint32_t rsvd3:1;
+#else  /*  __LITTLE_ENDIAN_BITFIELD */
+       uint32_t rsvd3:1;
+       uint32_t bc:1;
+       uint32_t si:1;
+       uint32_t rsvd2:3;
+       uint32_t fs:1;
+       uint32_t ls:1;
+       uint32_t dfctl:8;
+       uint32_t type:8;
+       uint32_t rctl:8;
+#endif
+};
+
 /* IOCB Command template for all 64 bit FCP Initiator commands */
 typedef struct {
        ULP_BDL bdl;
@@ -2918,6 +3307,21 @@ typedef struct {
        uint32_t fcpt_Length;   /* transfer ready for IWRITE */
 } FCPT_FIELDS64;
 
+/* IOCB Command template for Async Status iocb commands */
+typedef struct {
+       uint32_t rsvd[4];
+       uint32_t param;
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint16_t evt_code;              /* High order bits word 5 */
+       uint16_t sub_ctxt_tag;          /* Low  order bits word 5 */
+#else   /*  __LITTLE_ENDIAN_BITFIELD */
+       uint16_t sub_ctxt_tag;          /* High order bits word 5 */
+       uint16_t evt_code;              /* Low  order bits word 5 */
+#endif
+} ASYNCSTAT_FIELDS;
+#define ASYNC_TEMP_WARN                0x100
+#define ASYNC_TEMP_SAFE                0x101
+
 /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
    or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
 
@@ -2935,6 +3339,136 @@ struct rcv_sli3 {
        struct ulp_bde64 bde2;
 };
 
+/* Structure used for a single HBQ entry */
+struct lpfc_hbq_entry {
+       struct ulp_bde64 bde;
+       uint32_t buffer_tag;
+};
+
+/* IOCB Command template for QUE_XRI64_CX (0xB3) command */
+typedef struct {
+       struct lpfc_hbq_entry   buff;
+       uint32_t                rsvd;
+       uint32_t                rsvd1;
+} QUE_XRI64_CX_FIELDS;
+
+struct que_xri64cx_ext_fields {
+       uint32_t        iotag64_low;
+       uint32_t        iotag64_high;
+       uint32_t        ebde_count;
+       uint32_t        rsvd;
+       struct lpfc_hbq_entry   buff[5];
+};
+
+struct sli3_bg_fields {
+       uint32_t filler[6];     /* word 8-13 in IOCB */
+       uint32_t bghm;          /* word 14 - BlockGuard High Water Mark */
+/* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */
+#define BGS_BIDIR_BG_PROF_MASK         0xff000000
+#define BGS_BIDIR_BG_PROF_SHIFT                24
+#define BGS_BIDIR_ERR_COND_FLAGS_MASK  0x003f0000
+#define BGS_BIDIR_ERR_COND_SHIFT       16
+#define BGS_BG_PROFILE_MASK            0x0000ff00
+#define BGS_BG_PROFILE_SHIFT           8
+#define BGS_INVALID_PROF_MASK          0x00000020
+#define BGS_INVALID_PROF_SHIFT         5
+#define BGS_UNINIT_DIF_BLOCK_MASK      0x00000010
+#define BGS_UNINIT_DIF_BLOCK_SHIFT     4
+#define BGS_HI_WATER_MARK_PRESENT_MASK 0x00000008
+#define BGS_HI_WATER_MARK_PRESENT_SHIFT        3
+#define BGS_REFTAG_ERR_MASK            0x00000004
+#define BGS_REFTAG_ERR_SHIFT           2
+#define BGS_APPTAG_ERR_MASK            0x00000002
+#define BGS_APPTAG_ERR_SHIFT           1
+#define BGS_GUARD_ERR_MASK             0x00000001
+#define BGS_GUARD_ERR_SHIFT            0
+       uint32_t bgstat;        /* word 15 - BlockGuard Status */
+};
+
+static inline uint32_t
+lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_BIDIR_BG_PROF_MASK) >>
+                               BGS_BIDIR_BG_PROF_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_bidir_err_cond(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_BIDIR_ERR_COND_FLAGS_MASK) >>
+                               BGS_BIDIR_ERR_COND_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_bg_prof(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_BG_PROFILE_MASK) >>
+                               BGS_BG_PROFILE_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_invalid_prof(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_INVALID_PROF_MASK) >>
+                               BGS_INVALID_PROF_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_uninit_dif_block(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_UNINIT_DIF_BLOCK_MASK) >>
+                               BGS_UNINIT_DIF_BLOCK_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_HI_WATER_MARK_PRESENT_MASK) >>
+                               BGS_HI_WATER_MARK_PRESENT_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_reftag_err(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_REFTAG_ERR_MASK) >>
+                               BGS_REFTAG_ERR_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_apptag_err(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_APPTAG_ERR_MASK) >>
+                               BGS_APPTAG_ERR_SHIFT;
+}
+
+static inline uint32_t
+lpfc_bgs_get_guard_err(uint32_t bgstat)
+{
+       return (le32_to_cpu(bgstat) & BGS_GUARD_ERR_MASK) >>
+                               BGS_GUARD_ERR_SHIFT;
+}
+
+#define LPFC_EXT_DATA_BDE_COUNT 3
+struct fcp_irw_ext {
+       uint32_t        io_tag64_low;
+       uint32_t        io_tag64_high;
+#ifdef __BIG_ENDIAN_BITFIELD
+       uint8_t         reserved1;
+       uint8_t         reserved2;
+       uint8_t         reserved3;
+       uint8_t         ebde_count;
+#else  /* __LITTLE_ENDIAN */
+       uint8_t         ebde_count;
+       uint8_t         reserved3;
+       uint8_t         reserved2;
+       uint8_t         reserved1;
+#endif
+       uint32_t        reserved4;
+       struct ulp_bde64 rbde;          /* response bde */
+       struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT]; /* data BDE or BPL */
+       uint8_t icd[32];                /* immediate command data (32 bytes) */
+};
+
 typedef struct _IOCB { /* IOCB structure */
        union {
                GENERIC_RSP grsp;       /* Generic response */
@@ -2957,6 +3491,9 @@ typedef struct _IOCB {    /* IOCB structure */
                XMT_SEQ_FIELDS64 xseq64;        /* XMIT / BCAST cmd */
                FCPI_FIELDS64 fcpi64;   /* FCP 64 bit Initiator template */
                FCPT_FIELDS64 fcpt64;   /* FCP 64 bit target template */
+               ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
+               QUE_XRI64_CX_FIELDS quexri64cx; /* que_xri64_cx fields */
+               struct rcv_seq64 rcvseq64;      /* RCV_SEQ64 and RCV_CONT64 */
 
                uint32_t ulpWord[IOCB_WORD_SZ - 2];     /* generic 6 'words' */
        } un;
@@ -3011,9 +3548,17 @@ typedef struct _IOCB {   /* IOCB structure */
        uint32_t ulpXS:1;
        uint32_t ulpTimeout:8;
 #endif
+
        union {
                struct rcv_sli3 rcvsli3; /* words 8 - 15 */
+
+               /* words 8-31 used for que_xri_cx iocb */
+               struct que_xri64cx_ext_fields que_xri64cx_ext_words;
+               struct fcp_irw_ext fcp_ext;
                uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
+
+               /* words 8-15 for BlockGuard */
+               struct sli3_bg_fields sli3_bg;
        } unsli3;
 
 #define ulpCt_h ulpXS
@@ -3024,6 +3569,7 @@ typedef struct _IOCB {    /* IOCB structure */
 #define PARM_UNUSED        0   /* PU field (Word 4) not used */
 #define PARM_REL_OFF       1   /* PU field (Word 4) = R. O. */
 #define PARM_READ_CHECK    2   /* PU field (Word 4) = Data Transfer Length */
+#define PARM_NPIV_DID     3
 #define CLASS1             0   /* Class 1 */
 #define CLASS2             1   /* Class 2 */
 #define CLASS3             2   /* Class 3 */
@@ -3044,19 +3590,13 @@ typedef struct _IOCB {  /* IOCB structure */
 #define IOSTAT_RSVD2           0xC
 #define IOSTAT_RSVD3           0xD
 #define IOSTAT_RSVD4           0xE
-#define IOSTAT_RSVD5           0xF
+#define IOSTAT_NEED_BUFFER     0xF
 #define IOSTAT_DRIVER_REJECT   0x10   /* ulpStatus  - Driver defined */
 #define IOSTAT_DEFAULT         0xF    /* Same as rsvd5 for now */
 #define IOSTAT_CNT             0x11
 
 } IOCB_t;
 
-/* Structure used for a single HBQ entry */
-struct lpfc_hbq_entry {
-       struct ulp_bde64 bde;
-       uint32_t buffer_tag;
-};
-
 
 #define SLI1_SLIM_SIZE   (4 * 1024)
 
@@ -3099,8 +3639,30 @@ lpfc_is_LC_HBA(unsigned short device)
            (device == PCI_DEVICE_ID_BSMB) ||
            (device == PCI_DEVICE_ID_ZMID) ||
            (device == PCI_DEVICE_ID_ZSMB) ||
+           (device == PCI_DEVICE_ID_SAT_MID) ||
+           (device == PCI_DEVICE_ID_SAT_SMB) ||
            (device == PCI_DEVICE_ID_RFLY))
                return 1;
        else
                return 0;
 }
+
+/*
+ * Determine if an IOCB failed because of a link event or firmware reset.
+ */
+
+static inline int
+lpfc_error_lost_link(IOCB_t *iocbp)
+{
+       return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
+               (iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
+                iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
+                iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
+}
+
+#define MENLO_TRANSPORT_TYPE 0xfe
+#define MENLO_CONTEXT 0
+#define MENLO_PU 3
+#define MENLO_TIMEOUT 30
+#define SETVAR_MLOMNT 0x103107
+#define SETVAR_MLORST 0x103007