Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-2.6
[pandora-kernel.git] / drivers / scsi / bfa / bfi.h
index 72b69a0..1e258d5 100644 (file)
 
 #pragma pack(1)
 
+/* Per dma segment max size */
+#define BFI_MEM_DMA_SEG_SZ     (131072)
+
+/* Get number of dma segments required */
+#define BFI_MEM_DMA_NSEGS(_num_reqs, _req_sz)                          \
+       ((u16)(((((_num_reqs) * (_req_sz)) + BFI_MEM_DMA_SEG_SZ - 1) &  \
+        ~(BFI_MEM_DMA_SEG_SZ - 1)) / BFI_MEM_DMA_SEG_SZ))
+
+/* Get num dma reqs - that fit in a segment */
+#define BFI_MEM_NREQS_SEG(_rqsz) (BFI_MEM_DMA_SEG_SZ / (_rqsz))
+
+/* Get segment num from tag */
+#define BFI_MEM_SEG_FROM_TAG(_tag, _rqsz) ((_tag) / BFI_MEM_NREQS_SEG(_rqsz))
+
+/* Get dma req offset in a segment */
+#define BFI_MEM_SEG_REQ_OFFSET(_tag, _sz)      \
+       ((_tag) - (BFI_MEM_SEG_FROM_TAG(_tag, _sz) * BFI_MEM_NREQS_SEG(_sz)))
+
 /*
  * BFI FW image type
  */
 #define        BFI_FLASH_CHUNK_SZ                      256     /*  Flash chunk size */
 #define        BFI_FLASH_CHUNK_SZ_WORDS        (BFI_FLASH_CHUNK_SZ/sizeof(u32))
-enum {
-       BFI_IMAGE_CB_FC,
-       BFI_IMAGE_CT_FC,
-       BFI_IMAGE_CT_CNA,
-       BFI_IMAGE_MAX,
-};
 
 /*
  * Msg header common to all msgs
@@ -43,17 +55,20 @@ struct bfi_mhdr_s {
        u8              msg_id;         /*  msg opcode with in the class   */
        union {
                struct {
-                       u8      rsvd;
-                       u8      lpu_id; /*  msg destination                 */
+                       u8      qid;
+                       u8      fn_lpu; /*  msg destination                 */
                } h2i;
                u16     i2htok; /*  token in msgs to host           */
        } mtag;
 };
 
-#define bfi_h2i_set(_mh, _mc, _op, _lpuid) do {                \
+#define bfi_fn_lpu(__fn, __lpu)        ((__fn) << 1 | (__lpu))
+#define bfi_mhdr_2_fn(_mh)     ((_mh)->mtag.h2i.fn_lpu >> 1)
+
+#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do {               \
        (_mh).msg_class         = (_mc);      \
        (_mh).msg_id            = (_op);      \
-       (_mh).mtag.h2i.lpu_id   = (_lpuid);      \
+       (_mh).mtag.h2i.fn_lpu   = (_fn_lpu);      \
 } while (0)
 
 #define bfi_i2h_set(_mh, _mc, _op, _i2htok) do {               \
@@ -101,7 +116,7 @@ union bfi_addr_u {
 };
 
 /*
- * Scatter Gather Element
+ * Scatter Gather Element used for fast-path IO requests
  */
 struct bfi_sge_s {
 #ifdef __BIG_ENDIAN
@@ -116,6 +131,14 @@ struct bfi_sge_s {
        union bfi_addr_u sga;
 };
 
+/**
+ * Generic DMA addr-len pair.
+ */
+struct bfi_alen_s {
+       union bfi_addr_u        al_addr;        /* DMA addr of buffer   */
+       u32                     al_len;         /* length of buffer     */
+};
+
 /*
  * Scatter Gather Page
  */
@@ -127,6 +150,12 @@ struct bfi_sgpg_s {
        u32     rsvd[BFI_SGPG_RSVD_WD_LEN];
 };
 
+/* FCP module definitions */
+#define BFI_IO_MAX     (2000)
+#define BFI_IOIM_SNSLEN        (256)
+#define BFI_IOIM_SNSBUF_SEGS   \
+       BFI_MEM_DMA_NSEGS(BFI_IO_MAX, BFI_IOIM_SNSLEN)
+
 /*
  * Large Message structure - 128 Bytes size Msgs
  */
@@ -148,19 +177,30 @@ struct bfi_mbmsg_s {
        u32             pl[BFI_MBMSG_SZ];
 };
 
+/*
+ * Supported PCI function class codes (personality)
+ */
+enum bfi_pcifn_class {
+       BFI_PCIFN_CLASS_FC  = 0x0c04,
+       BFI_PCIFN_CLASS_ETH = 0x0200,
+};
+
 /*
  * Message Classes
  */
 enum bfi_mclass {
        BFI_MC_IOC              = 1,    /*  IO Controller (IOC)     */
+       BFI_MC_DIAG             = 2,    /*  Diagnostic Msgs            */
+       BFI_MC_FLASH            = 3,    /*  Flash message class */
+       BFI_MC_CEE              = 4,    /*  CEE */
        BFI_MC_FCPORT           = 5,    /*  FC port                         */
        BFI_MC_IOCFC            = 6,    /*  FC - IO Controller (IOC)        */
-       BFI_MC_LL               = 7,    /*  Link Layer                      */
+       BFI_MC_ABLK             = 7,    /*  ASIC block configuration        */
        BFI_MC_UF               = 8,    /*  Unsolicited frame receive       */
        BFI_MC_FCXP             = 9,    /*  FC Transport                    */
        BFI_MC_LPS              = 10,   /*  lport fc login services         */
        BFI_MC_RPORT            = 11,   /*  Remote port             */
-       BFI_MC_ITNIM            = 12,   /*  I-T nexus (Initiator mode)      */
+       BFI_MC_ITN              = 12,   /*  I-T nexus (Initiator mode)      */
        BFI_MC_IOIM_READ        = 13,   /*  read IO (Initiator mode)        */
        BFI_MC_IOIM_WRITE       = 14,   /*  write IO (Initiator mode)       */
        BFI_MC_IOIM_IO          = 15,   /*  IO (Initiator mode)     */
@@ -168,6 +208,8 @@ enum bfi_mclass {
        BFI_MC_IOIM_IOCOM       = 17,   /*  good IO completion              */
        BFI_MC_TSKIM            = 18,   /*  Initiator Task management       */
        BFI_MC_PORT             = 21,   /*  Physical port                   */
+       BFI_MC_SFP              = 22,   /*  SFP module  */
+       BFI_MC_PHY              = 25,   /*  External PHY message class  */
        BFI_MC_MAX              = 32
 };
 
@@ -175,23 +217,28 @@ enum bfi_mclass {
 #define BFI_IOC_MAX_CQS_ASIC   8
 #define BFI_IOC_MSGLEN_MAX     32      /* 32 bytes */
 
-#define BFI_BOOT_TYPE_OFF              8
-#define BFI_BOOT_LOADER_OFF            12
-
-#define BFI_BOOT_TYPE_NORMAL           0
-#define        BFI_BOOT_TYPE_FLASH             1
-#define        BFI_BOOT_TYPE_MEMTEST           2
-
-#define BFI_BOOT_LOADER_OS             0
-#define BFI_BOOT_LOADER_BIOS           1
-#define BFI_BOOT_LOADER_UEFI           2
-
 /*
  *----------------------------------------------------------------------
  *                             IOC
  *----------------------------------------------------------------------
  */
 
+/*
+ * Different asic generations
+ */
+enum bfi_asic_gen {
+       BFI_ASIC_GEN_CB         = 1,    /* crossbow 8G FC               */
+       BFI_ASIC_GEN_CT         = 2,    /* catapult 8G FC or 10G CNA    */
+       BFI_ASIC_GEN_CT2        = 3,    /* catapult-2 16G FC or 10G CNA */
+};
+
+enum bfi_asic_mode {
+       BFI_ASIC_MODE_FC        = 1,    /* FC upto 8G speed             */
+       BFI_ASIC_MODE_FC16      = 2,    /* FC upto 16G speed            */
+       BFI_ASIC_MODE_ETH       = 3,    /* Ethernet ports               */
+       BFI_ASIC_MODE_COMBO     = 4,    /* FC 16G and Ethernet 10G port */
+};
+
 enum bfi_ioc_h2i_msgs {
        BFI_IOC_H2I_ENABLE_REQ          = 1,
        BFI_IOC_H2I_DISABLE_REQ         = 2,
@@ -204,8 +251,8 @@ enum bfi_ioc_i2h_msgs {
        BFI_IOC_I2H_ENABLE_REPLY        = BFA_I2HM(1),
        BFI_IOC_I2H_DISABLE_REPLY       = BFA_I2HM(2),
        BFI_IOC_I2H_GETATTR_REPLY       = BFA_I2HM(3),
-       BFI_IOC_I2H_READY_EVENT         = BFA_I2HM(4),
-       BFI_IOC_I2H_HBEAT               = BFA_I2HM(5),
+       BFI_IOC_I2H_HBEAT               = BFA_I2HM(4),
+       BFI_IOC_I2H_ACQ_ADDR_REPLY      = BFA_I2HM(5),
 };
 
 /*
@@ -220,7 +267,8 @@ struct bfi_ioc_attr_s {
        wwn_t           mfg_pwwn;       /*  Mfg port wwn           */
        wwn_t           mfg_nwwn;       /*  Mfg node wwn           */
        mac_t           mfg_mac;        /*  Mfg mac                */
-       u16     rsvd_a;
+       u8              port_mode;      /* bfi_port_mode           */
+       u8              rsvd_a;
        wwn_t           pwwn;
        wwn_t           nwwn;
        mac_t           mac;            /*  PBC or Mfg mac         */
@@ -272,21 +320,33 @@ struct bfi_ioc_getattr_reply_s {
 #define BFI_IOC_FW_SIGNATURE   (0xbfadbfad)
 #define BFI_IOC_MD5SUM_SZ      4
 struct bfi_ioc_image_hdr_s {
-       u32     signature;      /*  constant signature */
-       u32     rsvd_a;
-       u32     exec;           /*  exec vector */
-       u32     param;          /*  parameters          */
+       u32     signature;      /* constant signature           */
+       u8      asic_gen;       /* asic generation              */
+       u8      asic_mode;
+       u8      port0_mode;     /* device mode for port 0       */
+       u8      port1_mode;     /* device mode for port 1       */
+       u32     exec;           /* exec vector                  */
+       u32     bootenv;        /* fimware boot env             */
        u32     rsvd_b[4];
        u32     md5sum[BFI_IOC_MD5SUM_SZ];
 };
 
-/*
- *  BFI_IOC_I2H_READY_EVENT message
- */
-struct bfi_ioc_rdy_event_s {
-       struct bfi_mhdr_s       mh;             /*  common msg header */
-       u8                      init_status;    /*  init event status */
-       u8                      rsvd[3];
+#define BFI_FWBOOT_DEVMODE_OFF         4
+#define BFI_FWBOOT_TYPE_OFF            8
+#define BFI_FWBOOT_ENV_OFF             12
+#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
+       (((u32)(__asic_gen)) << 24 |            \
+        ((u32)(__asic_mode)) << 16 |           \
+        ((u32)(__p0_mode)) << 8 |              \
+        ((u32)(__p1_mode)))
+
+#define BFI_FWBOOT_TYPE_NORMAL 0
+#define BFI_FWBOOT_TYPE_MEMTEST        2
+#define BFI_FWBOOT_ENV_OS       0
+
+enum bfi_port_mode {
+       BFI_PORT_MODE_FC        = 1,
+       BFI_PORT_MODE_ETH       = 2,
 };
 
 struct bfi_ioc_hbeat_s {
@@ -345,8 +405,8 @@ enum {
  */
 struct bfi_ioc_ctrl_req_s {
        struct bfi_mhdr_s       mh;
-       u8                      ioc_class;
-       u8                      rsvd[3];
+       u16                     clscode;
+       u16                     rsvd;
        u32             tv_sec;
 };
 #define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
@@ -358,7 +418,9 @@ struct bfi_ioc_ctrl_req_s {
 struct bfi_ioc_ctrl_reply_s {
        struct bfi_mhdr_s       mh;             /*  Common msg header     */
        u8                      status;         /*  enable/disable status */
-       u8                      rsvd[3];
+       u8                      port_mode;      /*  bfa_mode_s  */
+       u8                      cap_bm;         /*  capability bit mask */
+       u8                      rsvd;
 };
 #define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
 #define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
@@ -380,7 +442,7 @@ union bfi_ioc_h2i_msg_u {
  */
 union bfi_ioc_i2h_msg_u {
        struct bfi_mhdr_s               mh;
-       struct bfi_ioc_rdy_event_s      rdy_event;
+       struct bfi_ioc_ctrl_reply_s     fw_event;
        u32                     mboxmsg[BFI_IOC_MSGSZ];
 };
 
@@ -393,6 +455,7 @@ union bfi_ioc_i2h_msg_u {
 
 #define BFI_PBC_MAX_BLUNS      8
 #define BFI_PBC_MAX_VPORTS     16
+#define BFI_PBC_PORT_DISABLED  2
 
 /*
  * PBC boot lun configuration
@@ -574,6 +637,496 @@ union bfi_port_i2h_msg_u {
        struct bfi_port_generic_rsp_s   clearstats_rsp;
 };
 
+/*
+ *----------------------------------------------------------------------
+ *                             ABLK
+ *----------------------------------------------------------------------
+ */
+enum bfi_ablk_h2i_msgs_e {
+       BFI_ABLK_H2I_QUERY              = 1,
+       BFI_ABLK_H2I_ADPT_CONFIG        = 2,
+       BFI_ABLK_H2I_PORT_CONFIG        = 3,
+       BFI_ABLK_H2I_PF_CREATE          = 4,
+       BFI_ABLK_H2I_PF_DELETE          = 5,
+       BFI_ABLK_H2I_PF_UPDATE          = 6,
+       BFI_ABLK_H2I_OPTROM_ENABLE      = 7,
+       BFI_ABLK_H2I_OPTROM_DISABLE     = 8,
+};
+
+enum bfi_ablk_i2h_msgs_e {
+       BFI_ABLK_I2H_QUERY              = BFA_I2HM(BFI_ABLK_H2I_QUERY),
+       BFI_ABLK_I2H_ADPT_CONFIG        = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
+       BFI_ABLK_I2H_PORT_CONFIG        = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
+       BFI_ABLK_I2H_PF_CREATE          = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
+       BFI_ABLK_I2H_PF_DELETE          = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
+       BFI_ABLK_I2H_PF_UPDATE          = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
+       BFI_ABLK_I2H_OPTROM_ENABLE      = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
+       BFI_ABLK_I2H_OPTROM_DISABLE     = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
+};
+
+/* BFI_ABLK_H2I_QUERY */
+struct bfi_ablk_h2i_query_s {
+       struct bfi_mhdr_s       mh;
+       union bfi_addr_u        addr;
+};
+
+/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
+struct bfi_ablk_h2i_cfg_req_s {
+       struct bfi_mhdr_s       mh;
+       u8                      mode;
+       u8                      port;
+       u8                      max_pf;
+       u8                      max_vf;
+};
+
+/*
+ * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
+ */
+struct bfi_ablk_h2i_pf_req_s {
+       struct bfi_mhdr_s       mh;
+       u8                      pcifn;
+       u8                      port;
+       u16                     pers;
+       u32                     bw;
+};
+
+/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
+struct bfi_ablk_h2i_optrom_s {
+       struct bfi_mhdr_s       mh;
+};
+
+/*
+ * BFI_ABLK_I2H_QUERY
+ * BFI_ABLK_I2H_PORT_CONFIG
+ * BFI_ABLK_I2H_PF_CREATE
+ * BFI_ABLK_I2H_PF_DELETE
+ * BFI_ABLK_I2H_PF_UPDATE
+ * BFI_ABLK_I2H_OPTROM_ENABLE
+ * BFI_ABLK_I2H_OPTROM_DISABLE
+ */
+struct bfi_ablk_i2h_rsp_s {
+       struct bfi_mhdr_s       mh;
+       u8                      status;
+       u8                      pcifn;
+       u8                      port_mode;
+};
+
+
+/*
+ *     CEE module specific messages
+ */
+
+/* Mailbox commands from host to firmware */
+enum bfi_cee_h2i_msgs_e {
+       BFI_CEE_H2I_GET_CFG_REQ = 1,
+       BFI_CEE_H2I_RESET_STATS = 2,
+       BFI_CEE_H2I_GET_STATS_REQ = 3,
+};
+
+enum bfi_cee_i2h_msgs_e {
+       BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
+       BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
+       BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
+};
+
+/*
+ * H2I command structure for resetting the stats
+ */
+struct bfi_cee_reset_stats_s {
+       struct bfi_mhdr_s  mh;
+};
+
+/*
+ * Get configuration  command from host
+ */
+struct bfi_cee_get_req_s {
+       struct bfi_mhdr_s       mh;
+       union bfi_addr_u        dma_addr;
+};
+
+/*
+ * Reply message from firmware
+ */
+struct bfi_cee_get_rsp_s {
+       struct bfi_mhdr_s       mh;
+       u8                      cmd_status;
+       u8                      rsvd[3];
+};
+
+/*
+ * Reply message from firmware
+ */
+struct bfi_cee_stats_rsp_s {
+       struct bfi_mhdr_s       mh;
+       u8                      cmd_status;
+       u8                      rsvd[3];
+};
+
+/* Mailbox message structures from firmware to host    */
+union bfi_cee_i2h_msg_u {
+       struct bfi_mhdr_s               mh;
+       struct bfi_cee_get_rsp_s        get_rsp;
+       struct bfi_cee_stats_rsp_s      stats_rsp;
+};
+
+/*
+ * SFP related
+ */
+
+enum bfi_sfp_h2i_e {
+       BFI_SFP_H2I_SHOW        = 1,
+       BFI_SFP_H2I_SCN         = 2,
+};
+
+enum bfi_sfp_i2h_e {
+       BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
+       BFI_SFP_I2H_SCN  = BFA_I2HM(BFI_SFP_H2I_SCN),
+};
+
+/*
+ *     SFP state
+ */
+enum bfa_sfp_stat_e {
+       BFA_SFP_STATE_INIT      = 0,    /* SFP state is uninit  */
+       BFA_SFP_STATE_REMOVED   = 1,    /* SFP is removed       */
+       BFA_SFP_STATE_INSERTED  = 2,    /* SFP is inserted      */
+       BFA_SFP_STATE_VALID     = 3,    /* SFP is valid         */
+       BFA_SFP_STATE_UNSUPPORT = 4,    /* SFP is unsupport     */
+       BFA_SFP_STATE_FAILED    = 5,    /* SFP i2c read fail    */
+};
+
+/*
+ *  SFP memory access type
+ */
+enum bfi_sfp_mem_e {
+       BFI_SFP_MEM_ALL         = 0x1,  /* access all data field */
+       BFI_SFP_MEM_DIAGEXT     = 0x2,  /* access diag ext data field only */
+};
+
+struct bfi_sfp_req_s {
+       struct bfi_mhdr_s       mh;
+       u8                      memtype;
+       u8                      rsvd[3];
+       struct bfi_alen_s       alen;
+};
+
+struct bfi_sfp_rsp_s {
+       struct bfi_mhdr_s       mh;
+       u8                      status;
+       u8                      state;
+       u8                      rsvd[2];
+};
+
+/*
+ *     FLASH module specific
+ */
+enum bfi_flash_h2i_msgs {
+       BFI_FLASH_H2I_QUERY_REQ = 1,
+       BFI_FLASH_H2I_ERASE_REQ = 2,
+       BFI_FLASH_H2I_WRITE_REQ = 3,
+       BFI_FLASH_H2I_READ_REQ = 4,
+       BFI_FLASH_H2I_BOOT_VER_REQ = 5,
+};
+
+enum bfi_flash_i2h_msgs {
+       BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
+       BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
+       BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
+       BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
+       BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
+       BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
+};
+
+/*
+ * Flash query request
+ */
+struct bfi_flash_query_req_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       struct bfi_alen_s alen;
+};
+
+/*
+ * Flash erase request
+ */
+struct bfi_flash_erase_req_s {
+       struct bfi_mhdr_s       mh;     /* Common msg header */
+       u32     type;   /* partition type */
+       u8      instance; /* partition instance */
+       u8      rsv[3];
+};
+
+/*
+ * Flash write request
+ */
+struct bfi_flash_write_req_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       struct bfi_alen_s alen;
+       u32     type;   /* partition type */
+       u8      instance; /* partition instance */
+       u8      last;
+       u8      rsv[2];
+       u32     offset;
+       u32     length;
+};
+
+/*
+ * Flash read request
+ */
+struct bfi_flash_read_req_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       u32     type;           /* partition type */
+       u8      instance;       /* partition instance */
+       u8      rsv[3];
+       u32     offset;
+       u32     length;
+       struct bfi_alen_s alen;
+};
+
+/*
+ * Flash query response
+ */
+struct bfi_flash_query_rsp_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       u32     status;
+};
+
+/*
+ * Flash read response
+ */
+struct bfi_flash_read_rsp_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       u32     type;       /* partition type */
+       u8      instance;   /* partition instance */
+       u8      rsv[3];
+       u32     status;
+       u32     length;
+};
+
+/*
+ * Flash write response
+ */
+struct bfi_flash_write_rsp_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       u32     type;       /* partition type */
+       u8      instance;   /* partition instance */
+       u8      rsv[3];
+       u32     status;
+       u32     length;
+};
+
+/*
+ * Flash erase response
+ */
+struct bfi_flash_erase_rsp_s {
+       struct bfi_mhdr_s mh;   /* Common msg header */
+       u32     type;           /* partition type */
+       u8      instance;       /* partition instance */
+       u8      rsv[3];
+       u32     status;
+};
+
+/*
+ *----------------------------------------------------------------------
+ *                             DIAG
+ *----------------------------------------------------------------------
+ */
+enum bfi_diag_h2i {
+       BFI_DIAG_H2I_PORTBEACON = 1,
+       BFI_DIAG_H2I_LOOPBACK = 2,
+       BFI_DIAG_H2I_FWPING = 3,
+       BFI_DIAG_H2I_TEMPSENSOR = 4,
+       BFI_DIAG_H2I_LEDTEST = 5,
+       BFI_DIAG_H2I_QTEST      = 6,
+};
+
+enum bfi_diag_i2h {
+       BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
+       BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
+       BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
+       BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
+       BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
+       BFI_DIAG_I2H_QTEST      = BFA_I2HM(BFI_DIAG_H2I_QTEST),
+};
+
+#define BFI_DIAG_MAX_SGES      2
+#define BFI_DIAG_DMA_BUF_SZ    (2 * 1024)
+#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
+#define BFI_BOOT_MEMTEST_RES_SIG  0xA0A1A2A3
+
+struct bfi_diag_lb_req_s {
+       struct bfi_mhdr_s mh;
+       u32     loopcnt;
+       u32     pattern;
+       u8      lb_mode;        /*!< bfa_port_opmode_t */
+       u8      speed;          /*!< bfa_port_speed_t */
+       u8      rsvd[2];
+};
+
+struct bfi_diag_lb_rsp_s {
+       struct bfi_mhdr_s  mh;          /* 4 bytes */
+       struct bfa_diag_loopback_result_s res; /* 16 bytes */
+};
+
+struct bfi_diag_fwping_req_s {
+       struct bfi_mhdr_s mh;   /* 4 bytes */
+       struct bfi_alen_s alen; /* 12 bytes */
+       u32     data;           /* user input data pattern */
+       u32     count;          /* user input dma count */
+       u8      qtag;           /* track CPE vc */
+       u8      rsv[3];
+};
+
+struct bfi_diag_fwping_rsp_s {
+       struct bfi_mhdr_s  mh;          /* 4 bytes */
+       u32     data;           /* user input data pattern    */
+       u8      qtag;           /* track CPE vc               */
+       u8      dma_status;     /* dma status                 */
+       u8      rsv[2];
+};
+
+/*
+ * Temperature Sensor
+ */
+struct bfi_diag_ts_req_s {
+       struct bfi_mhdr_s mh;   /* 4 bytes */
+       u16     temp;           /* 10-bit A/D value */
+       u16     brd_temp;       /* 9-bit board temp */
+       u8      status;
+       u8      ts_junc;        /* show junction tempsensor   */
+       u8      ts_brd;         /* show board tempsensor      */
+       u8      rsv;
+};
+#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
+
+struct bfi_diag_ledtest_req_s {
+       struct bfi_mhdr_s  mh;  /* 4 bytes */
+       u8      cmd;
+       u8      color;
+       u8      portid;
+       u8      led;    /* bitmap of LEDs to be tested */
+       u16     freq;   /* no. of blinks every 10 secs */
+       u8      rsv[2];
+};
+
+/* notify host led operation is done */
+struct bfi_diag_ledtest_rsp_s {
+       struct bfi_mhdr_s  mh;  /* 4 bytes */
+};
+
+struct bfi_diag_portbeacon_req_s {
+       struct bfi_mhdr_s  mh;  /* 4 bytes */
+       u32     period; /* beaconing period */
+       u8      beacon; /* 1: beacon on */
+       u8      rsvd[3];
+};
+
+/* notify host the beacon is off */
+struct bfi_diag_portbeacon_rsp_s {
+       struct bfi_mhdr_s  mh;  /* 4 bytes */
+};
+
+struct bfi_diag_qtest_req_s {
+       struct bfi_mhdr_s       mh;             /* 4 bytes */
+       u32     data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
+};
+#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
+
+/*
+ *     PHY module specific
+ */
+enum bfi_phy_h2i_msgs_e {
+       BFI_PHY_H2I_QUERY_REQ = 1,
+       BFI_PHY_H2I_STATS_REQ = 2,
+       BFI_PHY_H2I_WRITE_REQ = 3,
+       BFI_PHY_H2I_READ_REQ = 4,
+};
+
+enum bfi_phy_i2h_msgs_e {
+       BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
+       BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
+       BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
+       BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
+};
+
+/*
+ * External PHY query request
+ */
+struct bfi_phy_query_req_s {
+       struct bfi_mhdr_s       mh;             /* Common msg header */
+       u8                      instance;
+       u8                      rsv[3];
+       struct bfi_alen_s       alen;
+};
+
+/*
+ * External PHY stats request
+ */
+struct bfi_phy_stats_req_s {
+       struct bfi_mhdr_s       mh;             /* Common msg header */
+       u8                      instance;
+       u8                      rsv[3];
+       struct bfi_alen_s       alen;
+};
+
+/*
+ * External PHY write request
+ */
+struct bfi_phy_write_req_s {
+       struct bfi_mhdr_s       mh;             /* Common msg header */
+       u8              instance;
+       u8              last;
+       u8              rsv[2];
+       u32             offset;
+       u32             length;
+       struct bfi_alen_s       alen;
+};
+
+/*
+ * External PHY read request
+ */
+struct bfi_phy_read_req_s {
+       struct bfi_mhdr_s       mh;     /* Common msg header */
+       u8              instance;
+       u8              rsv[3];
+       u32             offset;
+       u32             length;
+       struct bfi_alen_s       alen;
+};
+
+/*
+ * External PHY query response
+ */
+struct bfi_phy_query_rsp_s {
+       struct bfi_mhdr_s       mh;     /* Common msg header */
+       u32                     status;
+};
+
+/*
+ * External PHY stats response
+ */
+struct bfi_phy_stats_rsp_s {
+       struct bfi_mhdr_s       mh;     /* Common msg header */
+       u32                     status;
+};
+
+/*
+ * External PHY read response
+ */
+struct bfi_phy_read_rsp_s {
+       struct bfi_mhdr_s       mh;     /* Common msg header */
+       u32                     status;
+       u32             length;
+};
+
+/*
+ * External PHY write response
+ */
+struct bfi_phy_write_rsp_s {
+       struct bfi_mhdr_s       mh;     /* Common msg header */
+       u32                     status;
+       u32                     length;
+};
+
 #pragma pack()
 
 #endif /* __BFI_H__ */