iPXE
CIB_PRM.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2013-2015 Mellanox Technologies Ltd.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  */
00019 
00020 FILE_LICENCE ( GPL2_OR_LATER );
00021 
00022 #ifndef __CIB_PRM__
00023 #define __CIB_PRM__
00024 
00025 typedef unsigned long long      __be64;
00026 typedef uint32_t                __be32;
00027 typedef uint16_t                __be16;
00028 
00029 #define GOLAN_CMD_DATA_BLOCK_SIZE       (1 << 9)
00030 #define GOLAN_CMD_PAS_CNT                       (GOLAN_CMD_DATA_BLOCK_SIZE / sizeof(__be64))
00031 #define MAILBOX_STRIDE                          (1 << 10)
00032 #define MAILBOX_MASK                            (MAILBOX_STRIDE - 1)
00033 
00034 #define GOLAN_PCI_CMD_XPORT                     7
00035 #define CMD_OWNER_HW                            0x1
00036 #define GOLAN_LOG_MAX_QP                        0x1
00037 #define IB_NUM_PKEYS            0x20
00038 
00039 struct health_buffer {
00040         __be32          assert_var[5];
00041         __be32          rsvd0[3];
00042         __be32          assert_exit_ptr;
00043         __be32          assert_callra;
00044         __be32          rsvd1[2];
00045         __be32          fw_ver;
00046         __be32          hw_id;
00047         __be32          rsvd2;
00048         u8              irisc_index;
00049         u8              synd;
00050         __be16          ext_sync;
00051 } __attribute ( ( packed ) );
00052 
00053 struct golan_hca_init_seg {
00054         __be32                  fw_rev;
00055         __be32                  cmdif_rev_fw_sub;
00056         __be32                  rsvd0[2];
00057         __be32                  cmdq_addr_h;
00058         __be32                  cmdq_addr_l_sz;
00059         __be32                  cmd_dbell;
00060         __be32                  rsvd1[121];
00061         struct health_buffer    health;
00062         __be32                  rsvd2[884];
00063         __be32                  health_counter;
00064         __be32                  rsvd3[1023];
00065         __be64                  ieee1588_clk;
00066         __be32                  ieee1588_clk_type;
00067         __be32                  clr_intx;
00068 } __attribute ( ( packed ) );
00069 
00070 enum golan_manage_pages_mode {
00071         GOLAN_PAGES_CANT_GIVE    = 0,
00072         GOLAN_PAGES_GIVE         = 1,
00073         GOLAN_PAGES_TAKE         = 2
00074 };
00075 
00076 enum golan_qry_pages_mode {
00077         GOLAN_BOOT_PAGES        = 0x1,
00078         GOLAN_INIT_PAGES        = 0x2,
00079         GOLAN_REG_PAGES         = 0x3,
00080 };
00081 
00082 enum {
00083         GOLAN_REG_PCAP           = 0x5001,
00084         GOLAN_REG_PMTU           = 0x5003,
00085         GOLAN_REG_PTYS           = 0x5004,
00086         GOLAN_REG_PAOS           = 0x5006,
00087         GOLAN_REG_PMAOS          = 0x5012,
00088         GOLAN_REG_PUDE           = 0x5009,
00089         GOLAN_REG_PMPE           = 0x5010,
00090         GOLAN_REG_PELC           = 0x500e,
00091         GOLAN_REG_PMLP           = 0, /* TBD */
00092         GOLAN_REG_NODE_DESC      = 0x6001,
00093         GOLAN_REG_HOST_ENDIANESS = 0x7004,
00094 };
00095 
00096 enum {
00097         GOLAN_CMD_OP_QUERY_HCA_CAP              = 0x100,
00098         GOLAN_CMD_OP_QUERY_ADAPTER              = 0x101,
00099         GOLAN_CMD_OP_INIT_HCA                   = 0x102,
00100         GOLAN_CMD_OP_TEARDOWN_HCA               = 0x103,
00101         GOLAN_CMD_OP_ENABLE_HCA                 = 0x104,
00102         GOLAN_CMD_OP_DISABLE_HCA                = 0x105,
00103 
00104         GOLAN_CMD_OP_QUERY_PAGES                = 0x107,
00105         GOLAN_CMD_OP_MANAGE_PAGES               = 0x108,
00106         GOLAN_CMD_OP_SET_HCA_CAP                = 0x109,
00107 
00108         GOLAN_CMD_OP_CREATE_MKEY                = 0x200,
00109         GOLAN_CMD_OP_QUERY_MKEY                 = 0x201,
00110         GOLAN_CMD_OP_DESTROY_MKEY               = 0x202,
00111         GOLAN_CMD_OP_QUERY_SPECIAL_CONTEXTS     = 0x203,
00112 
00113         GOLAN_CMD_OP_CREATE_EQ                  = 0x301,
00114         GOLAN_CMD_OP_DESTROY_EQ                 = 0x302,
00115         GOLAN_CMD_OP_QUERY_EQ                   = 0x303,
00116 
00117         GOLAN_CMD_OP_CREATE_CQ                  = 0x400,
00118         GOLAN_CMD_OP_DESTROY_CQ                 = 0x401,
00119         GOLAN_CMD_OP_QUERY_CQ                   = 0x402,
00120         GOLAN_CMD_OP_MODIFY_CQ                  = 0x403,
00121 
00122         GOLAN_CMD_OP_CREATE_QP                  = 0x500,
00123         GOLAN_CMD_OP_DESTROY_QP                 = 0x501,
00124         GOLAN_CMD_OP_RST2INIT_QP                = 0x502,
00125         GOLAN_CMD_OP_INIT2RTR_QP                = 0x503,
00126         GOLAN_CMD_OP_RTR2RTS_QP                 = 0x504,
00127         GOLAN_CMD_OP_RTS2RTS_QP                 = 0x505,
00128         GOLAN_CMD_OP_SQERR2RTS_QP               = 0x506,
00129         GOLAN_CMD_OP_2ERR_QP                    = 0x507,
00130         GOLAN_CMD_OP_RTS2SQD_QP                 = 0x508,
00131         GOLAN_CMD_OP_SQD2RTS_QP                 = 0x509,
00132         GOLAN_CMD_OP_2RST_QP                    = 0x50a,
00133         GOLAN_CMD_OP_QUERY_QP                   = 0x50b,
00134         GOLAN_CMD_OP_CONF_SQP                   = 0x50c,
00135         GOLAN_CMD_OP_MAD_IFC                    = 0x50d,
00136         GOLAN_CMD_OP_INIT2INIT_QP               = 0x50e,
00137         GOLAN_CMD_OP_SUSPEND_QP                 = 0x50f,
00138         GOLAN_CMD_OP_UNSUSPEND_QP               = 0x510,
00139         GOLAN_CMD_OP_SQD2SQD_QP                 = 0x511,
00140         GOLAN_CMD_OP_ALLOC_QP_COUNTER_SET       = 0x512,
00141         GOLAN_CMD_OP_DEALLOC_QP_COUNTER_SET     = 0x513,
00142         GOLAN_CMD_OP_QUERY_QP_COUNTER_SET       = 0x514,
00143 
00144         GOLAN_CMD_OP_CREATE_PSV                 = 0x600,
00145         GOLAN_CMD_OP_DESTROY_PSV                = 0x601,
00146         GOLAN_CMD_OP_QUERY_PSV                  = 0x602,
00147         GOLAN_CMD_OP_QUERY_SIG_RULE_TABLE       = 0x603,
00148         GOLAN_CMD_OP_QUERY_BLOCK_SIZE_TABLE     = 0x604,
00149 
00150         GOLAN_CMD_OP_CREATE_SRQ                 = 0x700,
00151         GOLAN_CMD_OP_DESTROY_SRQ                = 0x701,
00152         GOLAN_CMD_OP_QUERY_SRQ                  = 0x702,
00153         GOLAN_CMD_OP_ARM_RQ                     = 0x703,
00154         GOLAN_CMD_OP_RESIZE_SRQ                 = 0x704,
00155 
00156         GOLAN_CMD_OP_QUERY_HCA_VPORT_CONTEXT    = 0x762,
00157         GOLAN_CMD_OP_QUERY_HCA_VPORT_GID                = 0x764,
00158         GOLAN_CMD_OP_QUERY_HCA_VPORT_PKEY       = 0x765,
00159 
00160         GOLAN_CMD_OP_ALLOC_PD                   = 0x800,
00161         GOLAN_CMD_OP_DEALLOC_PD                 = 0x801,
00162         GOLAN_CMD_OP_ALLOC_UAR                  = 0x802,
00163         GOLAN_CMD_OP_DEALLOC_UAR                = 0x803,
00164 
00165         GOLAN_CMD_OP_ATTACH_TO_MCG              = 0x806,
00166         GOLAN_CMD_OP_DETACH_FROM_MCG            = 0x807,
00167 
00168 
00169         GOLAN_CMD_OP_ALLOC_XRCD                 = 0x80e,
00170         GOLAN_CMD_OP_DEALLOC_XRCD               = 0x80f,
00171 
00172         GOLAN_CMD_OP_ACCESS_REG                 = 0x805,
00173 };
00174 
00175 struct golan_inbox_hdr {
00176         __be16          opcode;
00177         u8              rsvd[4];
00178         __be16          opmod;
00179 } __attribute ( ( packed ) );
00180 
00181 struct golan_cmd_layout {
00182         u8              type;
00183         u8              rsvd0[3];
00184         __be32          inlen;
00185         union {
00186                 __be64          in_ptr;
00187                 __be32          in_ptr32[2];
00188         };
00189         __be32          in[4];
00190         __be32          out[4];
00191         union {
00192                 __be64          out_ptr;
00193                 __be32          out_ptr32[2];
00194         };
00195         __be32          outlen;
00196         u8              token;
00197         u8              sig;
00198         u8              rsvd1;
00199         volatile u8     status_own;
00200 } __attribute ( ( packed ) );
00201 
00202 struct golan_outbox_hdr {
00203         u8              status;
00204         u8              rsvd[3];
00205         __be32          syndrome;
00206 } __attribute ( ( packed ) );
00207 
00208 enum {
00209     GOLAN_DEV_CAP_FLAG_RC               = 1LL <<  0,
00210     GOLAN_DEV_CAP_FLAG_UC               = 1LL <<  1,
00211     GOLAN_DEV_CAP_FLAG_UD               = 1LL <<  2,
00212     GOLAN_DEV_CAP_FLAG_XRC              = 1LL <<  3,
00213     GOLAN_DEV_CAP_FLAG_SRQ              = 1LL <<  6,
00214     GOLAN_DEV_CAP_FLAG_BAD_PKEY_CNTR    = 1LL <<  8,
00215     GOLAN_DEV_CAP_FLAG_BAD_QKEY_CNTR    = 1LL <<  9,
00216     GOLAN_DEV_CAP_FLAG_APM              = 1LL << 17,
00217     GOLAN_DEV_CAP_FLAG_ATOMIC           = 1LL << 18,
00218     GOLAN_DEV_CAP_FLAG_ON_DMND_PG       = 1LL << 24,
00219     GOLAN_DEV_CAP_FLAG_RESIZE_SRQ       = 1LL << 32,
00220     GOLAN_DEV_CAP_FLAG_REMOTE_FENCE     = 1LL << 38,
00221     GOLAN_DEV_CAP_FLAG_TLP_HINTS        = 1LL << 39,
00222     GOLAN_DEV_CAP_FLAG_SIG_HAND_OVER    = 1LL << 40,
00223     GOLAN_DEV_CAP_FLAG_DCT              = 1LL << 41,
00224     GOLAN_DEV_CAP_FLAG_CMDIF_CSUM       = 1LL << 46,
00225 };
00226 
00227 
00228 struct golan_hca_cap {
00229         u8              rsvd1[16];
00230         u8              log_max_srq_sz;
00231         u8              log_max_qp_sz;
00232         __be16          log_max_qp;
00233         u8              log_max_strq_sz;
00234         u8              log_max_srqs;
00235         u8              rsvd4[2];
00236         u8              rsvd5;
00237         u8              log_max_cq_sz;
00238         u8              rsvd6;
00239         u8              log_max_cq;
00240         u8              log_max_eq_sz;
00241         u8              log_max_mkey;
00242         u8              rsvd7;
00243         u8              log_max_eq;
00244         u8              max_indirection;
00245         u8              log_max_mrw_sz;
00246         u8              log_max_bsf_list_sz;
00247         u8              log_max_klm_list_sz;
00248         u8              rsvd_8_0;
00249         u8              log_max_ra_req_dc;
00250         u8              rsvd_8_1;
00251         u8              log_max_ra_res_dc;
00252         u8              rsvd9;
00253         u8              log_max_ra_req_qp;
00254         u8              rsvd10;
00255         u8              log_max_ra_res_qp;
00256         u8              rsvd11[4];
00257         __be16          max_qp_count;
00258         __be16          pkey_table_size;
00259         u8              rsvd13;
00260         u8              local_ca_ack_delay;
00261         u8              rsvd14;
00262         u8              num_ports;
00263         u8              log_max_msg;
00264         u8              rsvd15[3];
00265         __be16          stat_rate_support;
00266         u8              rsvd16[2];
00267         __be64          flags;
00268         u8              rsvd17;
00269         u8              uar_sz;
00270         u8              rsvd18;
00271         u8              log_pg_sz;
00272         __be16          bf_log_bf_reg_size;
00273         u8              rsvd19[4];
00274         __be16          max_wqe_sz_sq;
00275         u8              rsvd20[2];
00276         __be16          max_wqe_sz_rq;
00277         u8              rsvd21[2];
00278         __be16          max_wqe_sz_sq_dc;
00279         u8              rsvd22[4];
00280         __be16          max_qp_mcg;
00281         u8              rsvd23;
00282         u8              log_max_mcg;
00283         u8              rsvd24;
00284         u8              log_max_pd;
00285         u8              rsvd25;
00286         u8              log_max_xrcd;
00287         u8              rsvd26[40];
00288         __be32          uar_page_sz;
00289         u8              rsvd27[28];
00290         u8              log_msx_atomic_size_qp;
00291         u8              rsvd28[2];
00292         u8              log_msx_atomic_size_dc;
00293         u8              rsvd29[76];
00294 } __attribute ( ( packed ) );
00295 
00296 struct golan_query_pages_inbox {
00297         struct golan_inbox_hdr  hdr;
00298         u8                      rsvd[8];
00299 } __attribute ( ( packed ) );
00300 
00301 struct golan_query_pages_outbox {
00302         struct golan_outbox_hdr hdr;
00303         u8                      rsvd[2];
00304         __be16                  func_id;
00305         __be32                  num_pages;
00306 } __attribute ( ( packed ) );
00307 
00308 struct golan_cmd_query_hca_cap_mbox_in {
00309         struct golan_inbox_hdr  hdr;
00310         u8                                              rsvd[8];
00311 } __attribute ( ( packed ) );
00312 
00313 struct golan_cmd_query_hca_cap_mbox_out {
00314         struct golan_outbox_hdr hdr;
00315         u8                                              rsvd0[8];
00316         struct golan_hca_cap    hca_cap;
00317 } __attribute ( ( packed ) );
00318 
00319 struct golan_cmd_set_hca_cap_mbox_in {
00320         struct golan_inbox_hdr  hdr;
00321         u8                                              rsvd[8];
00322         struct golan_hca_cap    hca_cap;
00323 } __attribute ( ( packed ) );
00324 
00325 struct golan_cmd_set_hca_cap_mbox_out {
00326         struct golan_outbox_hdr hdr;
00327         u8                                              rsvd0[8];
00328 } __attribute ( ( packed ) );
00329 
00330 struct golan_cmd_init_hca_mbox_in {
00331         struct golan_inbox_hdr  hdr;
00332         u8                                              rsvd0[2];
00333         __be16                                  profile;
00334         u8                                              rsvd1[4];
00335 } __attribute ( ( packed ) );
00336 
00337 struct golan_cmd_init_hca_mbox_out {
00338         struct golan_outbox_hdr hdr;
00339         u8                                              rsvd[8];
00340 } __attribute ( ( packed ) );
00341 
00342 enum golan_teardown {
00343         GOLAN_TEARDOWN_GRACEFUL = 0x0,
00344         GOLAN_TEARDOWN_PANIC    = 0x1
00345 };
00346 
00347 struct golan_cmd_teardown_hca_mbox_in {
00348     struct golan_inbox_hdr      hdr;
00349     u8                                  rsvd0[2];
00350     __be16                      profile;
00351     u8                                  rsvd1[4];
00352 } __attribute ( ( packed ) );
00353 
00354 struct golan_cmd_teardown_hca_mbox_out {
00355     struct golan_outbox_hdr hdr;
00356     u8                                  rsvd[8];
00357 } __attribute ( ( packed ) );
00358 
00359 struct golan_enable_hca_mbox_in {
00360         struct golan_inbox_hdr  hdr;
00361         u8                      rsvd[8];
00362 } __attribute ( ( packed ) );
00363 
00364 struct golan_enable_hca_mbox_out {
00365         struct golan_outbox_hdr hdr;
00366         u8                      rsvd[8];
00367 } __attribute ( ( packed ) );
00368 
00369 struct golan_disable_hca_mbox_in {
00370     struct golan_inbox_hdr  hdr;
00371     u8                                  rsvd[8];
00372 } __attribute ( ( packed ) );
00373 
00374 struct golan_disable_hca_mbox_out {
00375     struct golan_outbox_hdr     hdr;
00376     u8                                  rsvd[8];
00377 } __attribute ( ( packed ) );
00378 
00379 struct golan_manage_pages_inbox_data {
00380         u8                      rsvd2[16];
00381         __be64                  pas[0];
00382 } __attribute ( ( packed ) );
00383 
00384 struct golan_manage_pages_inbox {
00385         struct golan_inbox_hdr  hdr;
00386         __be16                  rsvd0;
00387         __be16                  func_id;
00388         __be32                  num_entries;
00389         struct golan_manage_pages_inbox_data    data;
00390 } __attribute ( ( packed ) );
00391 
00392 struct golan_manage_pages_outbox_data {
00393         __be64                  pas[0];
00394 } __attribute ( ( packed ) );
00395 
00396 struct golan_manage_pages_outbox {
00397         struct golan_outbox_hdr                 hdr;
00398         __be32                                  num_entries;
00399         __be32                                  rsrvd;
00400         struct golan_manage_pages_outbox_data   data;
00401 } __attribute ( ( packed ) );
00402 
00403 struct golan_reg_host_endianess {
00404         u8      he;
00405         u8      rsvd[15];
00406 } __attribute ( ( packed ) );
00407 
00408 struct golan_cmd_prot_block {
00409         union {
00410                 __be64          data[GOLAN_CMD_PAS_CNT];
00411                 u8          bdata[GOLAN_CMD_DATA_BLOCK_SIZE];
00412         };
00413         u8              rsvd0[48];
00414         __be64          next;
00415         __be32          block_num;
00416         u8              rsvd1;
00417         u8              token;
00418         u8              ctrl_sig;
00419         u8              sig;
00420 } __attribute ( ( packed ) );
00421 
00422 /* MAD IFC structures */
00423 #define GOLAN_MAD_SIZE                                          256
00424 #define GOLAN_MAD_IFC_NO_VALIDATION                     0x3
00425 #define GOLAN_MAD_IFC_RLID_BIT                          16
00426 
00427 struct golan_mad_ifc_mbox_in {
00428     struct golan_inbox_hdr      hdr;
00429     __be16                      remote_lid;
00430     u8                                  rsvd0;
00431     u8                                  port;
00432     u8                                  rsvd1[4];
00433     u8                                          mad[GOLAN_MAD_SIZE];
00434 } __attribute ( ( packed ) );
00435 
00436 struct golan_mad_ifc_mbox_out {
00437     struct golan_outbox_hdr     hdr;
00438     u8                                  rsvd[8];
00439     u8                                          mad[GOLAN_MAD_SIZE];
00440 } __attribute ( ( packed ) );
00441 
00442 /* UAR Structures */
00443 struct golan_alloc_uar_mbox_in {
00444     struct golan_inbox_hdr  hdr;
00445     u8                      rsvd[8];
00446 } __attribute ( ( packed ) );
00447 
00448 struct golan_alloc_uar_mbox_out {
00449     struct golan_outbox_hdr hdr;
00450     __be32                  uarn;
00451     u8                      rsvd[4];
00452 } __attribute ( ( packed ) );
00453 
00454 struct golan_free_uar_mbox_in {
00455     struct golan_inbox_hdr  hdr;
00456     __be32                  uarn;
00457     u8                      rsvd[4];
00458 } __attribute ( ( packed ) );
00459 
00460 struct golan_free_uar_mbox_out {
00461     struct golan_outbox_hdr hdr;
00462     u8                      rsvd[8];
00463 } __attribute ( ( packed ) );
00464 
00465 /* Event Queue Structures */
00466 enum {
00467     GOLAN_EQ_STATE_ARMED        = 0x9,
00468     GOLAN_EQ_STATE_FIRED        = 0xa,
00469     GOLAN_EQ_STATE_ALWAYS_ARMED = 0xb,
00470 };
00471 
00472 
00473 struct golan_eq_context {
00474         u8                      status;
00475         u8                      ec_oi;
00476         u8                      st;
00477         u8                      rsvd2[7];
00478         __be16          page_pffset;
00479         __be32          log_sz_usr_page;
00480         u8                      rsvd3[7];
00481         u8                      intr;
00482         u8                      log_page_size;
00483         u8                      rsvd4[15];
00484         __be32          consumer_counter;
00485         __be32          produser_counter;
00486         u8                      rsvd5[16];
00487 } __attribute ( ( packed ) );
00488 
00489 struct golan_create_eq_mbox_in_data {
00490         struct golan_eq_context ctx;
00491         u8                                              rsvd2[8];
00492         __be64                                  events_mask;
00493         u8                                              rsvd3[176];
00494         __be64                                  pas[0];
00495 } __attribute ( ( packed ) );
00496 
00497 struct golan_create_eq_mbox_in {
00498         struct golan_inbox_hdr                          hdr;
00499         u8                                                                      rsvd0[3];
00500         u8                                                                      input_eqn;
00501         u8                                                                      rsvd1[4];
00502         struct golan_create_eq_mbox_in_data data;
00503 } __attribute ( ( packed ) );
00504 
00505 struct golan_create_eq_mbox_out {
00506         struct golan_outbox_hdr hdr;
00507         u8                                              rsvd0[3];
00508         u8                                              eq_number;
00509         u8                                              rsvd1[4];
00510 } __attribute ( ( packed ) );
00511 
00512 struct golan_destroy_eq_mbox_in {
00513         struct golan_inbox_hdr  hdr;
00514         u8                                              rsvd0[3];
00515         u8                                              eqn;
00516         u8                                              rsvd1[4];
00517 } __attribute ( ( packed ) );
00518 
00519 struct golan_destroy_eq_mbox_out {
00520         struct golan_outbox_hdr hdr;
00521         u8                                              rsvd[8];
00522 } __attribute ( ( packed ) );
00523 
00524 /***********************************************/
00525 /************** Query Vport ****************/
00526 struct golan_query_hca_vport_context_inbox {
00527         struct golan_inbox_hdr  hdr;
00528         __be16                  other_vport     : 1;
00529         __be16                  rsvd1           : 7;
00530         __be16                  port_num                : 4;
00531         __be16                  rsvd2           : 4;
00532         __be16                  vport_number;
00533         u8                      rsvd[4];
00534 } __attribute ( ( packed ) );
00535 
00536 struct golan_query_hca_vport_context_data {
00537         __be32                  field_select;
00538         __be32                  rsvd1[7];
00539         //****
00540         __be16                  sm_virt_aware                   : 1;
00541         __be16                  has_smi                         : 1;
00542         __be16                  has_raw                         : 1;
00543         __be16                  grh_required                    : 1;
00544         __be16                  rsvd2                           : 12;
00545         u8                      port_physical_state     : 4;
00546         u8                      vport_state_policy      : 4;
00547         u8                      port_state                      : 4;
00548         u8                      vport_state                     : 4;
00549         //****
00550         u8                      rsvd3[4];
00551         //****
00552         __be32                  system_image_guid[2];
00553         //****
00554         __be32                  port_guid[2];
00555         //****
00556         __be32                  node_guid[2];
00557         //****
00558         __be32                  cap_mask1;
00559         __be32                  cap_mask1_field_select;
00560         __be32                  cap_mask2;
00561         __be32                  cap_mask2_field_select;
00562         u8                      rsvd4[16];
00563         __be16                  lid;
00564         u8                      rsvd5                           : 4;
00565         u8                      init_type_reply         : 4;
00566         u8                      lmc                                     : 3;
00567         u8                      subnet_timeout          : 5;
00568         __be16                  sm_lid;
00569         u8                      sm_sl                           : 4;
00570         u8                      rsvd6                           : 4;
00571         u8                      rsvd7;
00572         __be16                  qkey_violation_counter;
00573         __be16                  pkey_violation_counter;
00574         u8                      rsvd8[100];
00575 } __attribute ( ( packed ) );
00576 
00577 struct golan_query_hca_vport_context_outbox {
00578         struct golan_outbox_hdr hdr;
00579         u8                      rsvd[8];
00580         struct golan_query_hca_vport_context_data context_data;
00581 } __attribute ( ( packed ) );
00582 
00583 struct golan_query_hca_vport_gid_inbox {
00584         struct golan_inbox_hdr  hdr;
00585         u8                      other_vport     : 1;
00586         u8                      rsvd1           : 7;
00587         u8                      port_num                : 4;
00588         u8                      rsvd2           : 4;
00589         __be16                  vport_number;
00590         __be16                  rsvd3;
00591         __be16                  gid_index;
00592 } __attribute ( ( packed ) );
00593 
00594 struct golan_query_hca_vport_gid_outbox {
00595         struct golan_outbox_hdr hdr;
00596         u8                      rsvd0[4];
00597         __be16                  gids_num;
00598         u8                      rsvd1[2];
00599         __be32          gid0[4];
00600 } __attribute ( ( packed ) );
00601 
00602 struct golan_query_hca_vport_pkey_inbox {
00603         struct golan_inbox_hdr  hdr;
00604         u8                      other_vport     : 1;
00605         u8                      rsvd1           : 7;
00606         u8                      port_num                : 4;
00607         u8                      rsvd2           : 4;
00608         __be16                  vport_number;
00609         __be16                  rsvd3;
00610         __be16                  pkey_index;
00611 } __attribute ( ( packed ) );
00612 
00613 struct golan_query_hca_vport_pkey_data {
00614         __be16                  rsvd1;
00615         __be16                  pkey0;
00616 } __attribute ( ( packed ) );
00617 
00618 struct golan_query_hca_vport_pkey_outbox {
00619         struct golan_outbox_hdr hdr;
00620         u8                      rsvd[8];
00621         struct golan_query_hca_vport_pkey_data *pkey_data;
00622 } __attribute ( ( packed ) );
00623 
00624 struct golan_eqe_comp {
00625         __be32  reserved[6];
00626         __be32  cqn;
00627 } __attribute ( ( packed ) );
00628 
00629 struct golan_eqe_qp_srq {
00630         __be32  reserved[6];
00631         __be32  qp_srq_n;
00632 } __attribute ( ( packed ) );
00633 
00634 struct golan_eqe_cq_err {
00635         __be32  cqn;
00636         u8      reserved1[7];
00637         u8      syndrome;
00638 } __attribute ( ( packed ) );
00639 
00640 struct golan_eqe_dropped_packet {
00641 };
00642 
00643 struct golan_eqe_port_state {
00644         u8      reserved0[8];
00645         u8      port;
00646 } __attribute ( ( packed ) );
00647 
00648 struct golan_eqe_gpio {
00649         __be32  reserved0[2];
00650         __be64  gpio_event;
00651 } __attribute ( ( packed ) );
00652 
00653 struct golan_eqe_congestion {
00654         u8      type;
00655         u8      rsvd0;
00656         u8      congestion_level;
00657 } __attribute ( ( packed ) );
00658 
00659 struct golan_eqe_stall_vl {
00660         u8      rsvd0[3];
00661         u8      port_vl;
00662 } __attribute ( ( packed ) );
00663 
00664 struct golan_eqe_cmd {
00665         __be32  vector;
00666         __be32  rsvd[6];
00667 } __attribute ( ( packed ) );
00668 
00669 struct golan_eqe_page_req {
00670         u8              rsvd0[2];
00671         __be16          func_id;
00672         u8              rsvd1[2];
00673         __be16          num_pages;
00674         __be32          rsvd2[5];
00675 } __attribute ( ( packed ) );
00676 
00677 union ev_data {
00678         __be32                          raw[7];
00679         struct golan_eqe_cmd            cmd;
00680         struct golan_eqe_comp           comp;
00681         struct golan_eqe_qp_srq         qp_srq;
00682         struct golan_eqe_cq_err         cq_err;
00683         struct golan_eqe_dropped_packet dp;
00684         struct golan_eqe_port_state     port;
00685         struct golan_eqe_gpio           gpio;
00686         struct golan_eqe_congestion     cong;
00687         struct golan_eqe_stall_vl       stall_vl;
00688         struct golan_eqe_page_req       req_pages;
00689 } __attribute__ ((packed));
00690 
00691 struct golan_eqe {
00692         u8                              rsvd0;
00693         u8                              type;
00694         u8                              rsvd1;
00695         u8                              sub_type;
00696         __be32                  rsvd2[7];
00697         union ev_data   data;
00698         __be16                  rsvd3;
00699         u8                              signature;
00700         u8                              owner;
00701 } __attribute__ ((packed));
00702 
00703 /* Protection Domain Structures */
00704 struct golan_alloc_pd_mbox_in {
00705         struct golan_inbox_hdr  hdr;
00706         u8                      rsvd[8];
00707 } __attribute ( ( packed ) );
00708 
00709 struct golan_alloc_pd_mbox_out {
00710         struct golan_outbox_hdr hdr;
00711         __be32                  pdn;
00712         u8                      rsvd[4];
00713 } __attribute ( ( packed ) );
00714 
00715 struct golan_dealloc_pd_mbox_in {
00716         struct golan_inbox_hdr  hdr;
00717         __be32                  pdn;
00718         u8                      rsvd[4];
00719 } __attribute ( ( packed ) );
00720 
00721 struct golan_dealloc_pd_mbox_out {
00722         struct golan_outbox_hdr hdr;
00723         u8                      rsvd[8];
00724 } __attribute ( ( packed ) );
00725 
00726 /* Memory key structures */
00727 #define GOLAN_IB_ACCESS_LOCAL_READ      (1 << 2)
00728 #define GOLAN_IB_ACCESS_LOCAL_WRITE     (1 << 3)
00729 #define GOLAN_MKEY_LEN64                (1 << 31)
00730 #define GOLAN_CREATE_MKEY_SEG_QPN_BIT   8
00731 
00732 struct golan_mkey_seg {
00733         /*
00734          * This is a two bit field occupying bits 31-30.
00735          * bit 31 is always 0,
00736          * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
00737          */
00738         u8              status;
00739         u8              pcie_control;
00740         u8              flags;
00741         u8              version;
00742         __be32          qpn_mkey7_0;
00743         u8              rsvd1[4];
00744         __be32          flags_pd;
00745         __be64          start_addr;
00746         __be64          len;
00747         __be32          bsfs_octo_size;
00748         u8              rsvd2[16];
00749         __be32          xlt_oct_size;
00750         u8              rsvd3[3];
00751         u8              log2_page_size;
00752         u8              rsvd4[4];
00753 } __attribute ( ( packed ) );
00754 
00755 struct golan_create_mkey_mbox_in_data {
00756         struct golan_mkey_seg   seg;
00757         u8                      rsvd1[16];
00758         __be32                  xlat_oct_act_size;
00759         __be32                  bsf_coto_act_size;
00760         u8                      rsvd2[168];
00761         __be64                  pas[0];
00762 } __attribute ( ( packed ) );
00763 
00764 struct golan_create_mkey_mbox_in {
00765         struct golan_inbox_hdr                  hdr;
00766         __be32                                  input_mkey_index;
00767         u8                                      rsvd0[4];
00768         struct golan_create_mkey_mbox_in_data   data;
00769 } __attribute ( ( packed ) );
00770 
00771 struct golan_create_mkey_mbox_out {
00772         struct golan_outbox_hdr hdr;
00773         __be32                  mkey;
00774         u8                      rsvd[4];
00775 } __attribute ( ( packed ) );
00776 
00777 struct golan_destroy_mkey_mbox_in {
00778         struct golan_inbox_hdr  hdr;
00779         __be32                  mkey;
00780         u8                      rsvd[4];
00781 } __attribute ( ( packed ) );
00782 
00783 struct golan_destroy_mkey_mbox_out {
00784         struct golan_outbox_hdr hdr;
00785         u8                      rsvd[8];
00786 } __attribute ( ( packed ) );
00787 
00788 /* Completion Queue Structures */
00789 enum {
00790     GOLAN_CQ_STATE_ARMED        = 9,
00791     GOLAN_CQ_STATE_ALWAYS_ARMED = 0xb,
00792     GOLAN_CQ_STATE_FIRED        = 0xa
00793 };
00794 
00795 enum {
00796     GOLAN_CQE_REQ               = 0,
00797     GOLAN_CQE_RESP_WR_IMM       = 1,
00798     GOLAN_CQE_RESP_SEND         = 2,
00799     GOLAN_CQE_RESP_SEND_IMM     = 3,
00800     GOLAN_CQE_RESP_SEND_INV     = 4,
00801     GOLAN_CQE_RESIZE_CQ         = 0xff, /* TBD */
00802     GOLAN_CQE_REQ_ERR           = 13,
00803     GOLAN_CQE_RESP_ERR          = 14
00804 };
00805 
00806 struct golan_cq_context {
00807         u8              status;
00808         u8              cqe_sz_flags;
00809         u8              st;
00810         u8              rsvd3;
00811         u8              rsvd4[6];
00812         __be16          page_offset;
00813         __be32          log_sz_usr_page;
00814         __be16          cq_period;
00815         __be16          cq_max_count;
00816         __be16          rsvd20;
00817         __be16          c_eqn;
00818         u8              log_pg_sz;
00819         u8              rsvd25[7];
00820         __be32          last_notified_index;
00821         __be32          solicit_producer_index;
00822         __be32          consumer_counter;
00823         __be32          producer_counter;
00824         u8              rsvd48[8];
00825         __be64          db_record_addr;
00826 } __attribute ( ( packed ) );
00827 
00828 
00829 struct golan_create_cq_mbox_in_data     {
00830         struct golan_cq_context ctx;
00831         u8                                              rsvd6[192];
00832         __be64                                  pas[0];
00833 } __attribute ( ( packed ) );
00834 
00835 struct golan_create_cq_mbox_in {
00836         struct golan_inbox_hdr                          hdr;
00837         __be32                                                          input_cqn;
00838         u8                                                                      rsvdx[4];
00839         struct golan_create_cq_mbox_in_data     data;
00840 } __attribute ( ( packed ) );
00841 
00842 struct golan_create_cq_mbox_out {
00843         struct golan_outbox_hdr hdr;
00844         __be32                                  cqn;
00845         u8                                              rsvd0[4];
00846 } __attribute ( ( packed ) );
00847 
00848 struct golan_destroy_cq_mbox_in {
00849         struct golan_inbox_hdr  hdr;
00850         __be32                                  cqn;
00851         u8                                              rsvd0[4];
00852 } __attribute ( ( packed ) );
00853 
00854 struct golan_destroy_cq_mbox_out {
00855         struct golan_outbox_hdr hdr;
00856         u8                                              rsvd0[8];
00857 } __attribute ( ( packed ) );
00858 
00859 struct golan_err_cqe {
00860         u8              rsvd0[32];
00861         __be32  srqn;
00862         u8              rsvd1[16];
00863         u8              hw_syndrom;
00864         u8              rsvd2;
00865         u8              vendor_err_synd;
00866         u8              syndrome;
00867         __be32  s_wqe_opcode_qpn;
00868         __be16  wqe_counter;
00869         u8              signature;
00870         u8              op_own;
00871 } __attribute ( ( packed ) );
00872 
00873 struct golan_cqe64 {
00874         u8              rsvd0[17];
00875         u8              ml_path;
00876         u8              rsvd20[4];
00877         __be16  slid;
00878         __be32  flags_rqpn;
00879         u8              rsvd28[4];
00880         __be32  srqn;
00881         __be32  imm_inval_pkey;
00882         u8              rsvd40[4];
00883         __be32  byte_cnt;
00884         __be64  timestamp;
00885         __be32  sop_drop_qpn;
00886         __be16  wqe_counter;
00887         u8              signature;
00888         u8              op_own;
00889 } __attribute ( ( packed ) );
00890 
00891 /* Queue Pair Structures */
00892 #define GOLAN_QP_CTX_ST_BIT                     16
00893 #define GOLAN_QP_CTX_PM_STATE_BIT               11
00894 #define GOLAN_QP_CTX_FRE_BIT                    11
00895 #define GOLAN_QP_CTX_RLKY_BIT                   4
00896 #define GOLAN_QP_CTX_RQ_SIZE_BIT                3
00897 #define GOLAN_QP_CTX_SQ_SIZE_BIT                11
00898 #define GOLAN_QP_CTX_MTU_BIT                    5
00899 #define GOLAN_QP_CTX_ACK_REQ_FREQ_BIT           28
00900 
00901 enum {
00902         GOLAN_QP_CTX_DONT_USE_RSRVD_LKEY        = 0,
00903         GOLAN_QP_CTX_USE_RSRVD_LKEY             = 1
00904 };
00905 
00906 enum {
00907         GOLAN_IB_ACK_REQ_FREQ                   = 8,
00908 };
00909 
00910 enum golan_qp_optpar {
00911         GOLAN_QP_PARAM_ALT_ADDR_PATH            = 1 << 0,
00912         GOLAN_QP_PARAM_RRE                      = 1 << 1,
00913         GOLAN_QP_PARAM_RAE                      = 1 << 2,
00914         GOLAN_QP_PARAM_RWE                      = 1 << 3,
00915         GOLAN_QP_PARAM_PKEY_INDEX               = 1 << 4,
00916         GOLAN_QP_PARAM_Q_KEY                    = 1 << 5,
00917         GOLAN_QP_PARAM_RNR_TIMEOUT              = 1 << 6,
00918         GOLAN_QP_PARAM_PRIMARY_ADDR_PATH        = 1 << 7,
00919         GOLAN_QP_PARAM_SRA_MAX                  = 1 << 8,
00920         GOLAN_QP_PARAM_RRA_MAX                  = 1 << 9,
00921         GOLAN_QP_PARAM_PM_STATE                 = 1 << 10,
00922         GOLAN_QP_PARAM_RETRY_COUNT              = 1 << 12,
00923         GOLAN_QP_PARAM_RNR_RETRY                = 1 << 13,
00924         GOLAN_QP_PARAM_ACK_TIMEOUT              = 1 << 14,
00925         GOLAN_QP_PARAM_PRI_PORT                 = 1 << 16,
00926         GOLAN_QP_PARAM_SRQN                     = 1 << 18,
00927         GOLAN_QP_PARAM_CQN_RCV                  = 1 << 19,
00928         GOLAN_QP_PARAM_DC_HS                    = 1 << 20,
00929         GOLAN_QP_PARAM_DC_KEY                   = 1 << 21
00930 };
00931 
00932 #define GOLAN_QP_PARAMS_INIT2RTR_MASK   (GOLAN_QP_PARAM_PKEY_INDEX      |\
00933                                          GOLAN_QP_PARAM_Q_KEY           |\
00934                                          GOLAN_QP_PARAM_RWE             |\
00935                                          GOLAN_QP_PARAM_RRE)
00936 
00937 #define GOLAN_QP_PARAMS_RTR2RTS_MASK    (GOLAN_QP_PARAM_PM_STATE        |\
00938                                          GOLAN_QP_PARAM_RNR_TIMEOUT     |\
00939                                          GOLAN_QP_PARAM_Q_KEY           |\
00940                                          GOLAN_QP_PARAM_RWE             |\
00941                                          GOLAN_QP_PARAM_RRE)
00942 
00943 
00944 enum {
00945         GOLAN_QP_ST_RC                  = 0x0,
00946         GOLAN_QP_ST_UC                  = 0x1,
00947         GOLAN_QP_ST_UD                  = 0x2,
00948         GOLAN_QP_ST_XRC                 = 0x3,
00949         GOLAN_QP_ST_MLX                 = 0x4,
00950         GOLAN_QP_ST_DC                  = 0x5,
00951         GOLAN_QP_ST_QP0                 = 0x7,
00952         GOLAN_QP_ST_QP1                 = 0x8,
00953         GOLAN_QP_ST_RAW_ETHERTYPE       = 0x9,
00954         GOLAN_QP_ST_RAW_IPV6            = 0xa,
00955         GOLAN_QP_ST_SNIFFER             = 0xb,
00956         GOLAN_QP_ST_SYNC_UMR            = 0xe,
00957         GOLAN_QP_ST_PTP_1588            = 0xd,
00958         GOLAN_QP_ST_REG_UMR             = 0xc,
00959         GOLAN_QP_ST_MAX
00960 };
00961 
00962 enum {
00963         GOLAN_QP_PM_MIGRATED    = 0x3,
00964         GOLAN_QP_PM_ARMED       = 0x0,
00965         GOLAN_QP_PM_REARM       = 0x1
00966 };
00967 
00968 enum {
00969         GOLAN_QP_LAT_SENSITIVE  = 1 << 28,
00970         GOLAN_QP_ENABLE_SIG     = 1 << 31
00971 };
00972 
00973 
00974 struct golan_qp_db {
00975         u8              rsvd0[2];
00976         __be16  recv_db;
00977         u8              rsvd1[2];
00978         __be16  send_db;
00979 } __attribute ( ( packed ) );
00980 
00981 enum {
00982         GOLAN_WQE_CTRL_CQ_UPDATE     = 2 << 2, /*Wissam, wtf?*/
00983         GOLAN_WQE_CTRL_SOLICITED     = 1 << 1
00984 };
00985 
00986 struct golan_wqe_ctrl_seg {
00987         __be32          opmod_idx_opcode;
00988         __be32          qpn_ds;
00989         u8                      signature;
00990         u8                      rsvd[2];
00991         u8                      fm_ce_se;
00992         __be32          imm;
00993 } __attribute ( ( packed ) );
00994 
00995 struct golan_av {
00996         union {
00997                 struct {
00998                         __be32  qkey;
00999                         __be32  reserved;
01000                 } qkey;
01001                 __be64  dc_key;
01002         } key;
01003         __be32  dqp_dct;
01004         u8              stat_rate_sl;
01005         u8              fl_mlid;
01006         __be16  rlid;
01007         u8              reserved0[10];
01008         u8              tclass;
01009         u8              hop_limit;
01010         __be32  grh_gid_fl;
01011         u8              rgid[16];
01012 } __attribute ( ( packed ) );
01013 
01014 struct golan_wqe_data_seg {
01015         __be32  byte_count;
01016         __be32  lkey;
01017         __be64  addr;
01018 } __attribute ( ( packed ) );
01019 
01020 struct golan_wqe_signature_seg {
01021         u8      rsvd0[4];
01022         u8      signature;
01023         u8      rsvd1[11];
01024 } __attribute ( ( packed ) );
01025 
01026 struct golan_wqe_inline_seg {
01027         __be32  byte_count;
01028 } __attribute ( ( packed ) );
01029 
01030 struct golan_qp_path {
01031         u8                      fl;
01032         u8                      rsvd3;
01033         u8                      free_ar;
01034         u8                      pkey_index;
01035         u8                      rsvd0;
01036         u8                      grh_mlid;
01037         __be16          rlid;
01038         u8                      ackto_lt;
01039         u8                      mgid_index;
01040         u8                      static_rate;
01041         u8                      hop_limit;
01042         __be32          tclass_flowlabel;
01043         u8                      rgid[16];
01044         u8                      rsvd1[4];
01045         u8                      sl;
01046         u8                      port;
01047         u8                      rsvd2[6];
01048 } __attribute ( ( packed ) );
01049 
01050 struct golan_qp_context {
01051         __be32                  flags;
01052         __be32                  flags_pd;
01053         u8                      mtu_msgmax;
01054         u8                      rq_size_stride;
01055         __be16                  sq_crq_size;
01056         __be32                  qp_counter_set_usr_page;
01057         __be32                  wire_qpn;
01058         __be32                  log_pg_sz_remote_qpn;
01059         struct                  golan_qp_path pri_path;
01060         struct                  golan_qp_path alt_path;
01061         __be32                  params1;
01062         u8                      reserved2[4];
01063         __be32                  next_send_psn;
01064         __be32                  cqn_send;
01065         u8                      reserved3[8];
01066         __be32                  last_acked_psn;
01067         __be32                  ssn;
01068         __be32                  params2;
01069         __be32                  rnr_nextrecvpsn;
01070         __be32                  xrcd;
01071         __be32                  cqn_recv;
01072         __be64                  db_rec_addr;
01073         __be32                  qkey;
01074         __be32                  rq_type_srqn;
01075         __be32                  rmsn;
01076         __be16                  hw_sq_wqe_counter;
01077         __be16                  sw_sq_wqe_counter;
01078         __be16                  hw_rcyclic_byte_counter;
01079         __be16                  hw_rq_counter;
01080         __be16                  sw_rcyclic_byte_counter;
01081         __be16                  sw_rq_counter;
01082         u8                      rsvd0[5];
01083         u8                      cgs;
01084         u8                      cs_req;
01085         u8                      cs_res;
01086         __be64                  dc_access_key;
01087         u8                      rsvd1[24];
01088 } __attribute ( ( packed ) );
01089 
01090 struct golan_create_qp_mbox_in_data {
01091         __be32                          opt_param_mask;
01092         u8                              rsvd1[4];
01093         struct golan_qp_context         ctx;
01094         u8                              rsvd3[16];
01095         __be64                          pas[0];
01096 } __attribute ( ( packed ) );
01097 
01098 struct golan_create_qp_mbox_in {
01099         struct golan_inbox_hdr                  hdr;
01100         __be32                                  input_qpn;
01101         u8                                      rsvd0[4];
01102         struct golan_create_qp_mbox_in_data     data;
01103 } __attribute ( ( packed ) );
01104 
01105 struct golan_create_qp_mbox_out {
01106         struct golan_outbox_hdr hdr;
01107         __be32                  qpn;
01108         u8                      rsvd0[4];
01109 } __attribute ( ( packed ) );
01110 
01111 struct golan_destroy_qp_mbox_in {
01112         struct golan_inbox_hdr  hdr;
01113         __be32                  qpn;
01114         u8                      rsvd0[4];
01115 } __attribute ( ( packed ) );
01116 
01117 struct golan_destroy_qp_mbox_out {
01118         struct golan_outbox_hdr hdr;
01119         u8                      rsvd0[8];
01120 } __attribute ( ( packed ) );
01121 
01122 struct golan_modify_qp_mbox_in_data {
01123         __be32                  optparam;
01124         u8                      rsvd0[4];
01125         struct golan_qp_context ctx;
01126 } __attribute ( ( packed ) );
01127 
01128 struct golan_modify_qp_mbox_in {
01129         struct golan_inbox_hdr          hdr;
01130         __be32                          qpn;
01131         u8                              rsvd1[4];
01132         struct golan_modify_qp_mbox_in_data     data;
01133 } __attribute ( ( packed ) );
01134 
01135 struct golan_modify_qp_mbox_out {
01136         struct golan_outbox_hdr         hdr;
01137         u8                              rsvd0[8];
01138 } __attribute ( ( packed ) );
01139 
01140 struct golan_attach_mcg_mbox_in {
01141     struct golan_inbox_hdr      hdr;
01142     __be32                      qpn;
01143     __be32                      rsvd;
01144     u8                          gid[16];
01145 } __attribute ( ( packed ) );
01146 
01147 struct golan_attach_mcg_mbox_out {
01148     struct golan_outbox_hdr     hdr;
01149     u8                          rsvf[8];
01150 } __attribute ( ( packed ) );
01151 
01152 struct golan_detach_mcg_mbox_in {
01153     struct golan_inbox_hdr      hdr;
01154     __be32                      qpn;
01155     __be32                      rsvd;
01156     u8                          gid[16];
01157 } __attribute ( ( packed ) );
01158 
01159 struct golan_detach_mcg_mbox_out {
01160     struct golan_outbox_hdr     hdr;
01161     u8                                  rsvf[8];
01162 } __attribute ( ( packed ) );
01163 
01164 
01165 #define MAILBOX_SIZE   sizeof(struct golan_cmd_prot_block)
01166 
01167 #endif /* __CIB_PRM__ */