linux/drivers/scsi/bfa/bfi_ms.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
   3 * Copyright (c) 2014- QLogic Corporation.
   4 * All rights reserved
   5 * www.qlogic.com
   6 *
   7 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
   8 *
   9 * This program is free software; you can redistribute it and/or modify it
  10 * under the terms of the GNU General Public License (GPL) Version 2 as
  11 * published by the Free Software Foundation
  12 *
  13 * This program is distributed in the hope that it will be useful, but
  14 * WITHOUT ANY WARRANTY; without even the implied warranty of
  15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16 * General Public License for more details.
  17 */
  18
  19#ifndef __BFI_MS_H__
  20#define __BFI_MS_H__
  21
  22#include "bfi.h"
  23#include "bfa_fc.h"
  24#include "bfa_defs_svc.h"
  25
  26#pragma pack(1)
  27
  28enum bfi_iocfc_h2i_msgs {
  29        BFI_IOCFC_H2I_CFG_REQ           = 1,
  30        BFI_IOCFC_H2I_SET_INTR_REQ      = 2,
  31        BFI_IOCFC_H2I_UPDATEQ_REQ       = 3,
  32        BFI_IOCFC_H2I_FAA_QUERY_REQ     = 4,
  33        BFI_IOCFC_H2I_ADDR_REQ          = 5,
  34};
  35
  36enum bfi_iocfc_i2h_msgs {
  37        BFI_IOCFC_I2H_CFG_REPLY         = BFA_I2HM(1),
  38        BFI_IOCFC_I2H_UPDATEQ_RSP       = BFA_I2HM(3),
  39        BFI_IOCFC_I2H_FAA_QUERY_RSP     = BFA_I2HM(4),
  40        BFI_IOCFC_I2H_ADDR_MSG          = BFA_I2HM(5),
  41};
  42
  43struct bfi_iocfc_cfg_s {
  44        u8      num_cqs;        /*  Number of CQs to be used    */
  45        u8       sense_buf_len; /*  SCSI sense length       */
  46        u16     rsvd_1;
  47        u32     endian_sig;     /*  endian signature of host     */
  48        u8      rsvd_2;
  49        u8      single_msix_vec;
  50        u8      rsvd[2];
  51        __be16  num_ioim_reqs;
  52        __be16  num_fwtio_reqs;
  53
  54
  55        /*
  56         * Request and response circular queue base addresses, size and
  57         * shadow index pointers.
  58         */
  59        union bfi_addr_u  req_cq_ba[BFI_IOC_MAX_CQS];
  60        union bfi_addr_u  req_shadow_ci[BFI_IOC_MAX_CQS];
  61        __be16    req_cq_elems[BFI_IOC_MAX_CQS];
  62        union bfi_addr_u  rsp_cq_ba[BFI_IOC_MAX_CQS];
  63        union bfi_addr_u  rsp_shadow_pi[BFI_IOC_MAX_CQS];
  64        __be16    rsp_cq_elems[BFI_IOC_MAX_CQS];
  65
  66        union bfi_addr_u  stats_addr;   /*  DMA-able address for stats    */
  67        union bfi_addr_u  cfgrsp_addr;  /*  config response dma address  */
  68        union bfi_addr_u  ioim_snsbase[BFI_IOIM_SNSBUF_SEGS];
  69                                        /*  IO sense buf base addr segments */
  70        struct bfa_iocfc_intr_attr_s intr_attr; /*  IOC interrupt attributes */
  71};
  72
  73/*
  74 * Boot target wwn information for this port. This contains either the stored
  75 * or discovered boot target port wwns for the port.
  76 */
  77struct bfi_iocfc_bootwwns {
  78        wwn_t           wwn[BFA_BOOT_BOOTLUN_MAX];
  79        u8              nwwns;
  80        u8              rsvd[7];
  81};
  82
  83/**
  84 * Queue configuration response from firmware
  85 */
  86struct bfi_iocfc_qreg_s {
  87        u32     cpe_q_ci_off[BFI_IOC_MAX_CQS];
  88        u32     cpe_q_pi_off[BFI_IOC_MAX_CQS];
  89        u32     cpe_qctl_off[BFI_IOC_MAX_CQS];
  90        u32     rme_q_ci_off[BFI_IOC_MAX_CQS];
  91        u32     rme_q_pi_off[BFI_IOC_MAX_CQS];
  92        u32     rme_qctl_off[BFI_IOC_MAX_CQS];
  93        u8      hw_qid[BFI_IOC_MAX_CQS];
  94};
  95
  96struct bfi_iocfc_cfgrsp_s {
  97        struct bfa_iocfc_fwcfg_s        fwcfg;
  98        struct bfa_iocfc_intr_attr_s    intr_attr;
  99        struct bfi_iocfc_bootwwns       bootwwns;
 100        struct bfi_pbc_s                pbc_cfg;
 101        struct bfi_iocfc_qreg_s         qreg;
 102};
 103
 104/*
 105 * BFI_IOCFC_H2I_CFG_REQ message
 106 */
 107struct bfi_iocfc_cfg_req_s {
 108        struct bfi_mhdr_s      mh;
 109        union bfi_addr_u      ioc_cfg_dma_addr;
 110};
 111
 112
 113/*
 114 * BFI_IOCFC_I2H_CFG_REPLY message
 115 */
 116struct bfi_iocfc_cfg_reply_s {
 117        struct bfi_mhdr_s  mh;          /*  Common msg header     */
 118        u8       cfg_success;   /*  cfg reply status       */
 119        u8       lpu_bm;                /*  LPUs assigned for this IOC */
 120        u8       rsvd[2];
 121};
 122
 123
 124/*
 125 * BFI_IOCFC_H2I_SET_INTR_REQ message
 126 */
 127struct bfi_iocfc_set_intr_req_s {
 128        struct bfi_mhdr_s mh;           /*  common msg header           */
 129        u8              coalesce;       /*  enable intr coalescing      */
 130        u8              rsvd[3];
 131        __be16  delay;          /*  delay timer 0..1125us       */
 132        __be16  latency;        /*  latency timer 0..225us      */
 133};
 134
 135
 136/*
 137 * BFI_IOCFC_H2I_UPDATEQ_REQ message
 138 */
 139struct bfi_iocfc_updateq_req_s {
 140        struct bfi_mhdr_s mh;           /*  common msg header           */
 141        u32 reqq_ba;            /*  reqq base addr              */
 142        u32 rspq_ba;            /*  rspq base addr              */
 143        u32 reqq_sci;           /*  reqq shadow ci              */
 144        u32 rspq_spi;           /*  rspq shadow pi              */
 145};
 146
 147
 148/*
 149 * BFI_IOCFC_I2H_UPDATEQ_RSP message
 150 */
 151struct bfi_iocfc_updateq_rsp_s {
 152        struct bfi_mhdr_s mh;           /*  common msg header   */
 153        u8      status;                 /*  updateq  status     */
 154        u8      rsvd[3];
 155};
 156
 157
 158/*
 159 * H2I Messages
 160 */
 161union bfi_iocfc_h2i_msg_u {
 162        struct bfi_mhdr_s               mh;
 163        struct bfi_iocfc_cfg_req_s      cfg_req;
 164        struct bfi_iocfc_updateq_req_s updateq_req;
 165        u32 mboxmsg[BFI_IOC_MSGSZ];
 166};
 167
 168
 169/*
 170 * I2H Messages
 171 */
 172union bfi_iocfc_i2h_msg_u {
 173        struct bfi_mhdr_s               mh;
 174        struct bfi_iocfc_cfg_reply_s    cfg_reply;
 175        struct bfi_iocfc_updateq_rsp_s updateq_rsp;
 176        u32 mboxmsg[BFI_IOC_MSGSZ];
 177};
 178
 179/*
 180 * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
 181 */
 182struct bfi_faa_en_dis_s {
 183        struct bfi_mhdr_s mh;   /* common msg header    */
 184};
 185
 186struct bfi_faa_addr_msg_s {
 187        struct  bfi_mhdr_s mh;  /* common msg header    */
 188        u8      rsvd[4];
 189        wwn_t   pwwn;           /* Fabric acquired PWWN */
 190        wwn_t   nwwn;           /* Fabric acquired PWWN */
 191};
 192
 193/*
 194 * BFI_IOCFC_H2I_FAA_QUERY_REQ message
 195 */
 196struct bfi_faa_query_s {
 197        struct bfi_mhdr_s mh;   /* common msg header    */
 198        u8      faa_status;     /* FAA status           */
 199        u8      addr_source;    /* PWWN source          */
 200        u8      rsvd[2];
 201        wwn_t   faa;            /* Fabric acquired PWWN */
 202};
 203
 204/*
 205 * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
 206 */
 207struct bfi_faa_en_dis_rsp_s {
 208        struct bfi_mhdr_s mh;   /* common msg header    */
 209        u8      status;         /* updateq  status      */
 210        u8      rsvd[3];
 211};
 212
 213/*
 214 * BFI_IOCFC_I2H_FAA_QUERY_RSP message
 215 */
 216#define bfi_faa_query_rsp_t struct bfi_faa_query_s
 217
 218enum bfi_fcport_h2i {
 219        BFI_FCPORT_H2I_ENABLE_REQ               = (1),
 220        BFI_FCPORT_H2I_DISABLE_REQ              = (2),
 221        BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ       = (3),
 222        BFI_FCPORT_H2I_STATS_GET_REQ            = (4),
 223        BFI_FCPORT_H2I_STATS_CLEAR_REQ          = (5),
 224};
 225
 226
 227enum bfi_fcport_i2h {
 228        BFI_FCPORT_I2H_ENABLE_RSP               = BFA_I2HM(1),
 229        BFI_FCPORT_I2H_DISABLE_RSP              = BFA_I2HM(2),
 230        BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP       = BFA_I2HM(3),
 231        BFI_FCPORT_I2H_STATS_GET_RSP            = BFA_I2HM(4),
 232        BFI_FCPORT_I2H_STATS_CLEAR_RSP          = BFA_I2HM(5),
 233        BFI_FCPORT_I2H_EVENT                    = BFA_I2HM(6),
 234        BFI_FCPORT_I2H_TRUNK_SCN                = BFA_I2HM(7),
 235        BFI_FCPORT_I2H_ENABLE_AEN               = BFA_I2HM(8),
 236        BFI_FCPORT_I2H_DISABLE_AEN              = BFA_I2HM(9),
 237};
 238
 239
 240/*
 241 * Generic REQ type
 242 */
 243struct bfi_fcport_req_s {
 244        struct bfi_mhdr_s  mh;          /*  msg header                      */
 245        u32        msgtag;      /*  msgtag for reply                */
 246};
 247
 248/*
 249 * Generic RSP type
 250 */
 251struct bfi_fcport_rsp_s {
 252        struct bfi_mhdr_s  mh;          /*  common msg header               */
 253        u8                 status;      /*  port enable status              */
 254        u8                 rsvd[3];
 255        struct  bfa_port_cfg_s port_cfg;/* port configuration   */
 256        u32     msgtag;                 /* msgtag for reply     */
 257};
 258
 259/*
 260 * BFI_FCPORT_H2I_ENABLE_REQ
 261 */
 262struct bfi_fcport_enable_req_s {
 263        struct bfi_mhdr_s  mh;          /*  msg header                      */
 264        u32        rsvd1;
 265        wwn_t              nwwn;        /*  node wwn of physical port       */
 266        wwn_t              pwwn;        /*  port wwn of physical port       */
 267        struct bfa_port_cfg_s port_cfg; /*  port configuration      */
 268        union bfi_addr_u   stats_dma_addr; /*  DMA address for stats        */
 269        u32        msgtag;      /*  msgtag for reply                */
 270        u8      use_flash_cfg;  /* get prot cfg from flash */
 271        u8      rsvd2[3];
 272};
 273
 274/*
 275 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
 276 */
 277struct bfi_fcport_set_svc_params_req_s {
 278        struct bfi_mhdr_s  mh;          /*  msg header */
 279        __be16     tx_bbcredit; /*  Tx credits */
 280        u8      rsvd[2];
 281};
 282
 283/*
 284 * BFI_FCPORT_I2H_EVENT
 285 */
 286struct bfi_fcport_event_s {
 287        struct bfi_mhdr_s       mh;     /*  common msg header */
 288        struct bfa_port_link_s  link_state;
 289};
 290
 291/*
 292 * BFI_FCPORT_I2H_TRUNK_SCN
 293 */
 294struct bfi_fcport_trunk_link_s {
 295        wwn_t                   trunk_wwn;
 296        u8                      fctl;           /* bfa_trunk_link_fctl_t */
 297        u8                      state;          /* bfa_trunk_link_state_t */
 298        u8                      speed;          /* bfa_port_speed_t */
 299        u8                      rsvd;
 300        __be32          deskew;
 301};
 302
 303#define BFI_FCPORT_MAX_LINKS    2
 304struct bfi_fcport_trunk_scn_s {
 305        struct bfi_mhdr_s       mh;
 306        u8                      trunk_state;    /* bfa_trunk_state_t */
 307        u8                      trunk_speed;    /* bfa_port_speed_t */
 308        u8                      rsvd_a[2];
 309        struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
 310};
 311
 312/*
 313 * fcport H2I message
 314 */
 315union bfi_fcport_h2i_msg_u {
 316        struct bfi_mhdr_s                       *mhdr;
 317        struct bfi_fcport_enable_req_s          *penable;
 318        struct bfi_fcport_req_s                 *pdisable;
 319        struct bfi_fcport_set_svc_params_req_s  *psetsvcparams;
 320        struct bfi_fcport_req_s                 *pstatsget;
 321        struct bfi_fcport_req_s                 *pstatsclear;
 322};
 323
 324/*
 325 * fcport I2H message
 326 */
 327union bfi_fcport_i2h_msg_u {
 328        struct bfi_msg_s                        *msg;
 329        struct bfi_fcport_rsp_s                 *penable_rsp;
 330        struct bfi_fcport_rsp_s                 *pdisable_rsp;
 331        struct bfi_fcport_rsp_s                 *psetsvcparams_rsp;
 332        struct bfi_fcport_rsp_s                 *pstatsget_rsp;
 333        struct bfi_fcport_rsp_s                 *pstatsclear_rsp;
 334        struct bfi_fcport_event_s               *event;
 335        struct bfi_fcport_trunk_scn_s           *trunk_scn;
 336};
 337
 338enum bfi_fcxp_h2i {
 339        BFI_FCXP_H2I_SEND_REQ = 1,
 340};
 341
 342enum bfi_fcxp_i2h {
 343        BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
 344};
 345
 346#define BFA_FCXP_MAX_SGES       2
 347
 348/*
 349 * FCXP send request structure
 350 */
 351struct bfi_fcxp_send_req_s {
 352        struct bfi_mhdr_s  mh;          /*  Common msg header               */
 353        __be16  fcxp_tag;       /*  driver request tag              */
 354        __be16  max_frmsz;      /*  max send frame size     */
 355        __be16  vf_id;          /*  vsan tag if applicable          */
 356        u16     rport_fw_hndl;  /*  FW Handle for the remote port  */
 357        u8       class;         /*  FC class used for req/rsp       */
 358        u8       rsp_timeout;   /*  timeout in secs, 0-no response */
 359        u8       cts;           /*  continue sequence               */
 360        u8       lp_fwtag;      /*  lport tag                       */
 361        struct fchs_s   fchs;   /*  request FC header structure    */
 362        __be32  req_len;        /*  request payload length          */
 363        __be32  rsp_maxlen;     /*  max response length expected   */
 364        struct bfi_alen_s req_alen;     /* request buffer       */
 365        struct bfi_alen_s rsp_alen;     /* response buffer      */
 366};
 367
 368/*
 369 * FCXP send response structure
 370 */
 371struct bfi_fcxp_send_rsp_s {
 372        struct bfi_mhdr_s  mh;          /*  Common msg header               */
 373        __be16  fcxp_tag;       /*  send request tag                */
 374        u8       req_status;    /*  request status                  */
 375        u8       rsvd;
 376        __be32  rsp_len;        /*  actual response length          */
 377        __be32  residue_len;    /*  residual response length        */
 378        struct fchs_s   fchs;   /*  response FC header structure   */
 379};
 380
 381enum bfi_uf_h2i {
 382        BFI_UF_H2I_BUF_POST = 1,
 383};
 384
 385enum bfi_uf_i2h {
 386        BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
 387};
 388
 389#define BFA_UF_MAX_SGES 2
 390
 391struct bfi_uf_buf_post_s {
 392        struct bfi_mhdr_s  mh;          /*  Common msg header           */
 393        u16     buf_tag;        /*  buffer tag                  */
 394        __be16  buf_len;        /*  total buffer length */
 395        struct bfi_alen_s alen; /* buffer address/len pair      */
 396};
 397
 398struct bfi_uf_frm_rcvd_s {
 399        struct bfi_mhdr_s  mh;          /*  Common msg header           */
 400        u16     buf_tag;        /*  buffer tag                  */
 401        u16     rsvd;
 402        u16     frm_len;        /*  received frame length       */
 403        u16     xfr_len;        /*  tranferred length           */
 404};
 405
 406enum bfi_lps_h2i_msgs {
 407        BFI_LPS_H2I_LOGIN_REQ   = 1,
 408        BFI_LPS_H2I_LOGOUT_REQ  = 2,
 409        BFI_LPS_H2I_N2N_PID_REQ = 3,
 410};
 411
 412enum bfi_lps_i2h_msgs {
 413        BFI_LPS_I2H_LOGIN_RSP   = BFA_I2HM(1),
 414        BFI_LPS_I2H_LOGOUT_RSP  = BFA_I2HM(2),
 415        BFI_LPS_I2H_CVL_EVENT   = BFA_I2HM(3),
 416};
 417
 418struct bfi_lps_login_req_s {
 419        struct bfi_mhdr_s  mh;          /*  common msg header           */
 420        u8              bfa_tag;
 421        u8              alpa;
 422        __be16          pdu_size;
 423        wwn_t           pwwn;
 424        wwn_t           nwwn;
 425        u8              fdisc;
 426        u8              auth_en;
 427        u8              lps_role;
 428        u8              bb_scn;
 429        u32             vvl_flag;
 430};
 431
 432struct bfi_lps_login_rsp_s {
 433        struct bfi_mhdr_s  mh;          /*  common msg header           */
 434        u8              fw_tag;
 435        u8              status;
 436        u8              lsrjt_rsn;
 437        u8              lsrjt_expl;
 438        wwn_t           port_name;
 439        wwn_t           node_name;
 440        __be16          bb_credit;
 441        u8              f_port;
 442        u8              npiv_en;
 443        u32     lp_pid:24;
 444        u32     auth_req:8;
 445        mac_t           lp_mac;
 446        mac_t           fcf_mac;
 447        u8              ext_status;
 448        u8              brcd_switch;    /*  attached peer is brcd switch */
 449        u8              bfa_tag;
 450        u8              rsvd;
 451};
 452
 453struct bfi_lps_logout_req_s {
 454        struct bfi_mhdr_s  mh;          /*  common msg header           */
 455        u8              fw_tag;
 456        u8              rsvd[3];
 457        wwn_t           port_name;
 458};
 459
 460struct bfi_lps_logout_rsp_s {
 461        struct bfi_mhdr_s  mh;          /*  common msg header           */
 462        u8              bfa_tag;
 463        u8              status;
 464        u8              rsvd[2];
 465};
 466
 467struct bfi_lps_cvl_event_s {
 468        struct bfi_mhdr_s  mh;          /*  common msg header           */
 469        u8              bfa_tag;
 470        u8              rsvd[3];
 471};
 472
 473struct bfi_lps_n2n_pid_req_s {
 474        struct bfi_mhdr_s       mh;     /*  common msg header           */
 475        u8      fw_tag;
 476        u32     lp_pid:24;
 477};
 478
 479union bfi_lps_h2i_msg_u {
 480        struct bfi_mhdr_s               *msg;
 481        struct bfi_lps_login_req_s      *login_req;
 482        struct bfi_lps_logout_req_s     *logout_req;
 483        struct bfi_lps_n2n_pid_req_s    *n2n_pid_req;
 484};
 485
 486union bfi_lps_i2h_msg_u {
 487        struct bfi_msg_s                *msg;
 488        struct bfi_lps_login_rsp_s      *login_rsp;
 489        struct bfi_lps_logout_rsp_s     *logout_rsp;
 490        struct bfi_lps_cvl_event_s      *cvl_event;
 491};
 492
 493enum bfi_rport_h2i_msgs {
 494        BFI_RPORT_H2I_CREATE_REQ = 1,
 495        BFI_RPORT_H2I_DELETE_REQ = 2,
 496        BFI_RPORT_H2I_SET_SPEED_REQ  = 3,
 497};
 498
 499enum bfi_rport_i2h_msgs {
 500        BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
 501        BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
 502        BFI_RPORT_I2H_QOS_SCN    = BFA_I2HM(3),
 503        BFI_RPORT_I2H_LIP_SCN_ONLINE =  BFA_I2HM(4),
 504        BFI_RPORT_I2H_LIP_SCN_OFFLINE = BFA_I2HM(5),
 505        BFI_RPORT_I2H_NO_DEV    = BFA_I2HM(6),
 506};
 507
 508struct bfi_rport_create_req_s {
 509        struct bfi_mhdr_s  mh;          /*  common msg header           */
 510        u16     bfa_handle;     /*  host rport handle           */
 511        __be16  max_frmsz;      /*  max rcv pdu size            */
 512        u32     pid:24, /*  remote port ID              */
 513                lp_fwtag:8;     /*  local port tag              */
 514        u32     local_pid:24,   /*  local port ID               */
 515                cisc:8;
 516        u8      fc_class;       /*  supported FC classes        */
 517        u8      vf_en;          /*  virtual fabric enable       */
 518        u16     vf_id;          /*  virtual fabric ID           */
 519};
 520
 521struct bfi_rport_create_rsp_s {
 522        struct bfi_mhdr_s  mh;          /*  common msg header           */
 523        u8              status;         /*  rport creation status       */
 524        u8              rsvd[3];
 525        u16     bfa_handle;     /*  host rport handle           */
 526        u16     fw_handle;      /*  firmware rport handle       */
 527        struct bfa_rport_qos_attr_s qos_attr;  /* QoS Attributes */
 528};
 529
 530struct bfa_rport_speed_req_s {
 531        struct bfi_mhdr_s  mh;          /*  common msg header           */
 532        u16     fw_handle;      /*  firmware rport handle       */
 533        u8              speed;          /*  rport's speed via RPSC      */
 534        u8              rsvd;
 535};
 536
 537struct bfi_rport_delete_req_s {
 538        struct bfi_mhdr_s  mh;          /*  common msg header           */
 539        u16     fw_handle;      /*  firmware rport handle       */
 540        u16     rsvd;
 541};
 542
 543struct bfi_rport_delete_rsp_s {
 544        struct bfi_mhdr_s  mh;          /*  common msg header           */
 545        u16     bfa_handle;     /*  host rport handle           */
 546        u8              status;         /*  rport deletion status       */
 547        u8              rsvd;
 548};
 549
 550struct bfi_rport_qos_scn_s {
 551        struct bfi_mhdr_s  mh;          /*  common msg header           */
 552        u16     bfa_handle;     /*  host rport handle           */
 553        u16     rsvd;
 554        struct bfa_rport_qos_attr_s old_qos_attr;  /* Old QoS Attributes */
 555        struct bfa_rport_qos_attr_s new_qos_attr;  /* New QoS Attributes */
 556};
 557
 558struct bfi_rport_lip_scn_s {
 559        struct bfi_mhdr_s  mh;          /*!< common msg header  */
 560        u16     bfa_handle;     /*!< host rport handle  */
 561        u8              status;         /*!< scn online status  */
 562        u8              rsvd;
 563        struct bfa_fcport_loop_info_s   loop_info;
 564};
 565
 566union bfi_rport_h2i_msg_u {
 567        struct bfi_msg_s                *msg;
 568        struct bfi_rport_create_req_s   *create_req;
 569        struct bfi_rport_delete_req_s   *delete_req;
 570        struct bfi_rport_speed_req_s    *speed_req;
 571};
 572
 573union bfi_rport_i2h_msg_u {
 574        struct bfi_msg_s                *msg;
 575        struct bfi_rport_create_rsp_s   *create_rsp;
 576        struct bfi_rport_delete_rsp_s   *delete_rsp;
 577        struct bfi_rport_qos_scn_s      *qos_scn_evt;
 578        struct bfi_rport_lip_scn_s      *lip_scn;
 579};
 580
 581/*
 582 * Initiator mode I-T nexus interface defines.
 583 */
 584
 585enum bfi_itn_h2i {
 586        BFI_ITN_H2I_CREATE_REQ = 1,     /*  i-t nexus creation */
 587        BFI_ITN_H2I_DELETE_REQ = 2,     /*  i-t nexus deletion */
 588};
 589
 590enum bfi_itn_i2h {
 591        BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
 592        BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
 593        BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
 594};
 595
 596struct bfi_itn_create_req_s {
 597        struct bfi_mhdr_s  mh;          /*  common msg header            */
 598        u16     fw_handle;      /*  f/w handle for itnim         */
 599        u8      class;          /*  FC class for IO              */
 600        u8      seq_rec;        /*  sequence recovery support    */
 601        u8      msg_no;         /*  seq id of the msg            */
 602        u8      role;
 603};
 604
 605struct bfi_itn_create_rsp_s {
 606        struct bfi_mhdr_s  mh;          /*  common msg header            */
 607        u16     bfa_handle;     /*  bfa handle for itnim         */
 608        u8      status;         /*  fcp request status           */
 609        u8      seq_id;         /*  seq id of the msg            */
 610};
 611
 612struct bfi_itn_delete_req_s {
 613        struct bfi_mhdr_s  mh;          /*  common msg header            */
 614        u16     fw_handle;      /*  f/w itnim handle             */
 615        u8      seq_id;         /*  seq id of the msg            */
 616        u8      rsvd;
 617};
 618
 619struct bfi_itn_delete_rsp_s {
 620        struct bfi_mhdr_s  mh;          /*  common msg header            */
 621        u16     bfa_handle;     /*  bfa handle for itnim         */
 622        u8      status;         /*  fcp request status           */
 623        u8      seq_id;         /*  seq id of the msg            */
 624};
 625
 626struct bfi_itn_sler_event_s {
 627        struct bfi_mhdr_s  mh;          /*  common msg header            */
 628        u16     bfa_handle;     /*  bfa handle for itnim         */
 629        u16     rsvd;
 630};
 631
 632union bfi_itn_h2i_msg_u {
 633        struct bfi_itn_create_req_s *create_req;
 634        struct bfi_itn_delete_req_s *delete_req;
 635        struct bfi_msg_s        *msg;
 636};
 637
 638union bfi_itn_i2h_msg_u {
 639        struct bfi_itn_create_rsp_s *create_rsp;
 640        struct bfi_itn_delete_rsp_s *delete_rsp;
 641        struct bfi_itn_sler_event_s *sler_event;
 642        struct bfi_msg_s        *msg;
 643};
 644
 645/*
 646 * Initiator mode IO interface defines.
 647 */
 648
 649enum bfi_ioim_h2i {
 650        BFI_IOIM_H2I_IOABORT_REQ = 1,   /*  IO abort request     */
 651        BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /*  IO cleanup request   */
 652};
 653
 654enum bfi_ioim_i2h {
 655        BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1),      /*  non-fp IO response   */
 656        BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /*  ABORT rsp    */
 657};
 658
 659/*
 660 * IO command DIF info
 661 */
 662struct bfi_ioim_dif_s {
 663        u32     dif_info[4];
 664};
 665
 666/*
 667 * FCP IO messages overview
 668 *
 669 * @note
 670 * - Max CDB length supported is 64 bytes.
 671 * - SCSI Linked commands and SCSI bi-directional Commands not
 672 *      supported.
 673 *
 674 */
 675struct bfi_ioim_req_s {
 676        struct bfi_mhdr_s  mh;          /*  Common msg header            */
 677        __be16  io_tag;         /*  I/O tag                      */
 678        u16     rport_hdl;      /*  itnim/rport firmware handle */
 679        struct fcp_cmnd_s       cmnd;   /*  IO request info     */
 680
 681        /*
 682         * SG elements array within the IO request must be double word
 683         * aligned. This alignment is required to optimize SGM setup for the IO.
 684         */
 685        struct bfi_sge_s        sges[BFI_SGE_INLINE_MAX];
 686        u8      io_timeout;
 687        u8      dif_en;
 688        u8      rsvd_a[2];
 689        struct bfi_ioim_dif_s  dif;
 690};
 691
 692/*
 693 *      This table shows various IO status codes from firmware and their
 694 *      meaning. Host driver can use these status codes to further process
 695 *      IO completions.
 696 *
 697 *      BFI_IOIM_STS_OK         : IO completed with error free SCSI &
 698 *                                      transport status.
 699 *                                       io-tag can be reused.
 700 *
 701 *      BFA_IOIM_STS_SCSI_ERR           : IO completed with scsi error.
 702 *      - io-tag can be reused.
 703 *
 704 *      BFI_IOIM_STS_HOST_ABORTED       : IO was aborted successfully due to
 705 *                                              host request.
 706 *                                      - io-tag cannot be reused yet.
 707 *
 708 *      BFI_IOIM_STS_ABORTED            : IO was aborted successfully
 709 *                                              internally by f/w.
 710 *                                      - io-tag cannot be reused yet.
 711 *
 712 *      BFI_IOIM_STS_TIMEDOUT   : IO timedout and ABTS/RRQ is happening
 713 *                                      in the firmware and
 714 *                                      - io-tag cannot be reused yet.
 715 *
 716 *      BFI_IOIM_STS_SQER_NEEDED        : Firmware could not recover the IO
 717 *                                        with sequence level error
 718 *      logic and hence host needs to retry
 719 *                                        this IO with a different IO tag
 720 *                                      - io-tag cannot be used yet.
 721 *
 722 *      BFI_IOIM_STS_NEXUS_ABORT        : Second Level Error Recovery from host
 723 *                                        is required because 2 consecutive ABTS
 724 *                                        timedout and host needs logout and
 725 *                                        re-login with the target
 726 *                                      - io-tag cannot be used yet.
 727 *
 728 *      BFI_IOIM_STS_UNDERRUN   : IO completed with SCSI status good,
 729 *                                        but the data tranferred is less than
 730 *                                        the fcp data length in the command.
 731 *                                        ex. SCSI INQUIRY where transferred
 732 *                                        data length and residue count in FCP
 733 *                                        response accounts for total fcp-dl
 734 *                                        - io-tag can be reused.
 735 *
 736 *      BFI_IOIM_STS_OVERRUN    : IO completed with SCSI status good,
 737 *                                        but the data transerred is more than
 738 *                                        fcp data length in the command. ex.
 739 *                                        TAPE IOs where blocks can of unequal
 740 *                                        lengths.
 741 *                                      - io-tag can be reused.
 742 *
 743 *      BFI_IOIM_STS_RES_FREE   : Firmware has completed using io-tag
 744 *                                        during abort process
 745 *                                      - io-tag can be reused.
 746 *
 747 *      BFI_IOIM_STS_PROTO_ERR  : Firmware detected a protocol error.
 748 *                                        ex target sent more data than
 749 *                                        requested, or there was data frame
 750 *                                        loss and other reasons
 751 *                                      - io-tag cannot be used yet.
 752 *
 753 *      BFI_IOIM_STS_DIF_ERR    : Firwmare detected DIF error. ex: DIF
 754 *                                      CRC err or Ref Tag err or App tag err.
 755 *                                      - io-tag can be reused.
 756 *
 757 *      BFA_IOIM_STS_TSK_MGT_ABORT      : IO was aborted because of Task
 758 *                                        Management command from the host
 759 *                                        - io-tag can be reused.
 760 *
 761 *      BFI_IOIM_STS_UTAG               : Firmware does not know about this
 762 *                                        io_tag.
 763 *                                      - io-tag can be reused.
 764 */
 765enum bfi_ioim_status {
 766        BFI_IOIM_STS_OK = 0,
 767        BFI_IOIM_STS_HOST_ABORTED = 1,
 768        BFI_IOIM_STS_ABORTED = 2,
 769        BFI_IOIM_STS_TIMEDOUT = 3,
 770        BFI_IOIM_STS_RES_FREE = 4,
 771        BFI_IOIM_STS_SQER_NEEDED = 5,
 772        BFI_IOIM_STS_PROTO_ERR = 6,
 773        BFI_IOIM_STS_UTAG = 7,
 774        BFI_IOIM_STS_PATHTOV = 8,
 775};
 776
 777/*
 778 * I/O response message
 779 */
 780struct bfi_ioim_rsp_s {
 781        struct bfi_mhdr_s       mh;     /*  common msg header           */
 782        __be16  io_tag;         /*  completed IO tag             */
 783        u16     bfa_rport_hndl; /*  releated rport handle        */
 784        u8      io_status;      /*  IO completion status         */
 785        u8      reuse_io_tag;   /*  IO tag can be reused        */
 786        u16     abort_tag;      /*  host abort request tag      */
 787        u8              scsi_status;    /*  scsi status from target      */
 788        u8              sns_len;        /*  scsi sense length            */
 789        u8              resid_flags;    /*  IO residue flags             */
 790        u8              rsvd_a;
 791        __be32  residue;        /*  IO residual length in bytes */
 792        u32     rsvd_b[3];
 793};
 794
 795struct bfi_ioim_abort_req_s {
 796        struct bfi_mhdr_s  mh;  /*  Common msg header  */
 797        __be16  io_tag; /*  I/O tag     */
 798        u16     abort_tag;      /*  unique request tag */
 799};
 800
 801/*
 802 * Initiator mode task management command interface defines.
 803 */
 804
 805enum bfi_tskim_h2i {
 806        BFI_TSKIM_H2I_TM_REQ    = 1, /*  task-mgmt command      */
 807        BFI_TSKIM_H2I_ABORT_REQ = 2, /*  task-mgmt command      */
 808};
 809
 810enum bfi_tskim_i2h {
 811        BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
 812};
 813
 814struct bfi_tskim_req_s {
 815        struct bfi_mhdr_s  mh;  /*  Common msg header   */
 816        __be16  tsk_tag;        /*  task management tag */
 817        u16     itn_fhdl;       /*  itn firmware handle */
 818        struct  scsi_lun lun;   /*  LU number   */
 819        u8      tm_flags;       /*  see enum fcp_tm_cmnd        */
 820        u8      t_secs; /*  Timeout value in seconds    */
 821        u8      rsvd[2];
 822};
 823
 824struct bfi_tskim_abortreq_s {
 825        struct bfi_mhdr_s  mh;  /*  Common msg header   */
 826        __be16  tsk_tag;        /*  task management tag */
 827        u16     rsvd;
 828};
 829
 830enum bfi_tskim_status {
 831        /*
 832         * Following are FCP-4 spec defined status codes,
 833         * **DO NOT CHANGE THEM **
 834         */
 835        BFI_TSKIM_STS_OK        = 0,
 836        BFI_TSKIM_STS_NOT_SUPP = 4,
 837        BFI_TSKIM_STS_FAILED    = 5,
 838
 839        /*
 840         * Defined by BFA
 841         */
 842        BFI_TSKIM_STS_TIMEOUT  = 10,    /*  TM request timedout */
 843        BFI_TSKIM_STS_ABORTED  = 11,    /*  Aborted on host request */
 844        BFI_TSKIM_STS_UTAG     = 12,    /*  unknown tag for request */
 845};
 846
 847struct bfi_tskim_rsp_s {
 848        struct bfi_mhdr_s  mh;          /*  Common msg header            */
 849        __be16  tsk_tag;        /*  task mgmt cmnd tag           */
 850        u8      tsk_status;     /*  @ref bfi_tskim_status */
 851        u8      rsvd;
 852};
 853
 854#pragma pack()
 855
 856/*
 857 * Crossbow PCI MSI-X vector defines
 858 */
 859enum {
 860        BFI_MSIX_CPE_QMIN_CB = 0,
 861        BFI_MSIX_CPE_QMAX_CB = 7,
 862        BFI_MSIX_RME_QMIN_CB = 8,
 863        BFI_MSIX_RME_QMAX_CB = 15,
 864        BFI_MSIX_CB_MAX = 22,
 865};
 866
 867/*
 868 * Catapult FC PCI MSI-X vector defines
 869 */
 870enum {
 871        BFI_MSIX_LPU_ERR_CT = 0,
 872        BFI_MSIX_CPE_QMIN_CT = 1,
 873        BFI_MSIX_CPE_QMAX_CT = 4,
 874        BFI_MSIX_RME_QMIN_CT = 5,
 875        BFI_MSIX_RME_QMAX_CT = 8,
 876        BFI_MSIX_CT_MAX = 9,
 877};
 878
 879#endif /* __BFI_MS_H__ */
 880