]> git.openfabrics.org - ~adrianc/mstflint.git/commitdiff
- added support for accessing flash through ICMD in mstflint
authorAdrian Chiris <adrianc@mellanox.com>
Mon, 17 Nov 2014 16:11:43 +0000 (18:11 +0200)
committerAdrian Chiris <adrianc@mellanox.com>
Mon, 17 Nov 2014 16:11:43 +0000 (18:11 +0200)
- initial porting of mft-3.8.0 changes (mflash, mlxfwops, flint, mlxconfig, reg_access)
- added cmdif library : library for sending command to devices that support Tools HCR (ConnectX3 and Connect3Pro devices)

49 files changed:
Makefile.am
cmdif/Makefile.am [new file with mode: 0644]
cmdif/tools_cif.c [new file with mode: 0644]
cmdif/tools_cif.h [new file with mode: 0644]
common/tools_utils.h
configure.ac
debian/changelog
include/mtcr_ul/mtcr.h
mflash/mflash.c
mflash/mflash.h
mflash/mflash_access_layer.c
mflash/mflash_access_layer.h
mflash/mflash_common_structs.h
mflash/mflash_pack_layer.c
mflash/mflash_pack_layer.h
mflash/mflash_types.h
mlxconfig/Makefile.am
mlxconfig/mlxcfg_lib.cpp
mlxconfig/mlxcfg_lib.h
mlxconfig/mlxcfg_parser.cpp
mlxconfig/mlxcfg_ui.cpp
mlxconfig/mlxcfg_ui.h
mlxfwops/lib/flint_base.h
mlxfwops/lib/flint_io.cpp
mlxfwops/lib/flint_io.h
mlxfwops/lib/fs2_ops.cpp
mlxfwops/lib/fs3_ops.cpp
mlxfwops/lib/fs3_ops.h
mlxfwops/lib/fw_ops.cpp
mlxfwops/lib/fw_ops.h
mlxfwops/lib/mlxfwops_com.h
mtcr_ul/Makefile.am
mtcr_ul/mtcr_ib.h
mtcr_ul/mtcr_ib_ofed.c
mtcr_ul/mtcr_int_defs.h
mtcr_ul/mtcr_tools_cif.c
mtcr_ul/mtcr_tools_cif.h
mtcr_ul/mtcr_ul.c
reg_access/reg_access.c
reg_access/reg_access.h
tools_layouts/Makefile.am
tools_layouts/adb_to_c_utils.c
tools_layouts/adb_to_c_utils.h
tools_layouts/cibfw_layouts.c
tools_layouts/cibfw_layouts.h
tools_layouts/register_access_open_layouts.c
tools_layouts/register_access_open_layouts.h
tools_layouts/tools_open_layouts.c
tools_layouts/tools_open_layouts.h

index c269955f6cb48c631872f509cda044c634888864..87ab2e8a1cb30694f3891ca446dec481c5819d26 100644 (file)
@@ -30,7 +30,7 @@
 # SOFTWARE.
 #--
 
-SUBDIRS = mft_utils tools_layouts mtcr_ul reg_access dev_mgt mflash mlxconfig mlxfwops cmdparser flint small_utils mstdump 
+SUBDIRS = mft_utils tools_layouts mtcr_ul reg_access cmdif dev_mgt mflash mlxconfig mlxfwops cmdparser flint small_utils mstdump 
 
 man_MANS = man/mstflint.1
 
diff --git a/cmdif/Makefile.am b/cmdif/Makefile.am
new file mode 100644 (file)
index 0000000..b3ac612
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
+#
+# This software is available to you under a choice of one of two
+# licenses.  You may choose to be licensed under the terms of the GNU
+# General Public License (GPL) Version 2, available from the file
+# COPYING in the main directory of this source tree, or the
+# OpenIB.org BSD license below:
+#
+#     Redistribution and use in source and binary forms, with or
+#     without modification, are permitted provided that the following
+#     conditions are met:
+#
+#      - Redistributions of source code must retain the above
+#        copyright notice, this list of conditions and the following
+#        disclaimer.
+#
+#      - Redistributions in binary form must reproduce the above
+#        copyright notice, this list of conditions and the following
+#        disclaimer in the documentation and/or other materials
+#        provided with the distribution.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#--
+
+# Makefile.am -- Process this file with automake to produce Makefile.in
+
+USER_DIR = $(top_srcdir)
+MTCR_DIR = $(USER_DIR)/include/mtcr_ul
+TOOLS_LAYOUTS_DIR = $(USER_DIR)/tools_layouts
+INCLUDES = -I. -I../common -I../tools_layouts  -I$(MTCR_DIR) -I..
+
+AM_CFLAGS = -W -Wall -Werror -g -MP -MD $(COMPILER_FPIC) -DCMDIF_EXPORTS
+CMDIF_VERSION = 1
+noinst_LIBRARIES = libcmdif.a
+
+libcmdif_a_SOURCES = tools_cif.c
+
diff --git a/cmdif/tools_cif.c b/cmdif/tools_cif.c
new file mode 100644 (file)
index 0000000..2997cfd
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include <common/compatibility.h>
+#include "tools_cif.h"
+
+#define TOOLS_HCR_MAX_MBOX 256
+#define QUERY_DEV_CAP_OP 0x3
+#define QUERY_DEF_PARAMS_OP 0x73
+
+#define CHECK_RC(rc) \
+    if (rc) return rc;
+
+#define BE32_TO_CPU(s, n) do {                                          \
+       u_int32_t i;                                                   \
+    u_int32_t *p = (u_int32_t *)(s);                               \
+    for (i=0; i<(n); i++,p++)                                      \
+        *p = __be32_to_cpu(*p);                                    \
+    } while(0)
+
+//TODO: adrianc: if we find ourselves adding more and more commands consider using a macro to save code.
+//TODO: adrianc: when library expands consider returning its own error code
+
+MError tcif_query_dev_cap(mfile *dev, u_int32_t offset, u_int64_t* data)
+{
+    int rc = tools_cmdif_send_mbox_command(dev, QUERY_DEV_CAP_OP, 0, offset, data, 8, 1); CHECK_RC(rc);
+    BE32_TO_CPU(data, 2);
+    return ME_OK;
+}
+
+
+MError tcif_query_global_def_params(mfile* dev, struct tools_open_query_def_params_global* global_params)
+{
+    u_int8_t data[TOOLS_OPEN_QUERY_DEF_PARAMS_GLOBAL_SIZE] = {0};
+    int rc = tools_cmdif_send_mbox_command(dev, QUERY_DEF_PARAMS_OP, 0, 0, data, sizeof(data), 0);CHECK_RC(rc);
+    tools_open_query_def_params_global_unpack(global_params, data);
+    return ME_OK;
+}
+
+
+MError tcif_query_per_port_def_params(mfile* dev, u_int8_t port, struct tools_open_query_def_params_per_port* port_params)
+{
+    u_int8_t data[TOOLS_OPEN_QUERY_DEF_PARAMS_PER_PORT_SIZE] = {0};
+    int rc = tools_cmdif_send_mbox_command(dev, QUERY_DEF_PARAMS_OP, port, 0, data, sizeof(data), 0);CHECK_RC(rc);
+    tools_open_query_def_params_per_port_unpack(port_params, data);
+    return ME_OK;
+}
+
+
+const char* tcif_err2str(MError rc) {
+    return m_err2str(rc);
+}
+
diff --git a/cmdif/tools_cif.h b/cmdif/tools_cif.h
new file mode 100644 (file)
index 0000000..de9ccf4
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef TOOLS_CIF_H
+#define TOOLS_CIF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <mtcr.h>
+#include <tools_layouts/tools_open_layouts.h>
+
+
+/**
+ * tcif_query_dev_cap:
+ * @param[in]  dev           A pointer to a device context.
+ * @param[in]  offs          offset in even dword to read from the DEV_CAP vector
+ * @param[out] data          Quad-word read from the device capabilities vector from offset: offs
+
+ * @return     One of the MError* values, or a raw
+ **/
+MError tcif_query_dev_cap(mfile* dev, u_int32_t offs, u_int64_t* data);
+
+/**
+ * tcif_query_global_def_params:
+ * @param[in]     dev           A pointer to a device context.
+ * @param[in/out] global_params pointer to global params struct
+
+ * @return     One of the MError* values, or a raw
+ **/
+MError tcif_query_global_def_params(mfile* dev, struct tools_open_query_def_params_global* global_params);
+
+/**
+ * tcif_query_per_port_def_params:
+ * @param[in]     dev           A pointer to a device context.
+ * @param[in]     port          Port that the query will be performed on (1 or 2)
+ * @param[in/out] port_params   Pointer to port params struct
+
+ * @return     One of the MError* values, or a raw
+ **/
+MError tcif_query_per_port_def_params(mfile* dev, u_int8_t port, struct tools_open_query_def_params_per_port* port_params);
+
+/**
+ * tcif_err2str:
+ * @param[in]  rc            return code from one of the above functions
+
+ * @return     string describing the error occured.
+ **/
+const char* tcif_err2str(MError rc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TOOLS_CIF_H */
index 7e34ff8743ac4a7413c0224ddd38cee4c3a8e247..7fe1a5946e9f64d7db2f3fd262a810ae953ec7c5 100755 (executable)
@@ -65,6 +65,7 @@
 
 #define TOOLS_MAX(a,b) ((a) > (b) ? (a) : (b))
 #define TOOLS_MIN(a,b) ((a) < (b) ? (a) : (b))
+#define TOOLS_ARR_SZ(arr) (sizeof((arr))/sizeof((arr)[0]))
 
 /**
  * Suppress compiler warning about unused variable.
index b55870620434a25326c49174c4388c631243848c..ffd596a9f21c2930f9b507fc4f972c65ee2355be 100644 (file)
@@ -1,16 +1,16 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(mstflint, 3.7.1, orenk@mellanox.co.il)
+AC_INIT(mstflint, 3.8.0, orenk@mellanox.co.il)
 
 AC_DEFINE_UNQUOTED([PROJECT], ["mstflint"], [Define the project name.])
 AC_SUBST([PROJECT])
 
-AC_DEFINE_UNQUOTED([VERSION], ["3.7.1"], [Define the project version.])
+AC_DEFINE_UNQUOTED([VERSION], ["3.8.0"], [Define the project version.])
 AC_SUBST([VERSION])
 
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_SRCDIR([README])
-AM_INIT_AUTOMAKE(mstflint, 3.7.1)
+AM_INIT_AUTOMAKE(mstflint, 3.8.0)
 
 dnl Checks for programs
 AC_PROG_CC
@@ -52,7 +52,7 @@ CXXFLAGS="$CXXFLAGS -Werror -DMST_UL"
 
 AC_CONFIG_FILES( mstflint.spec )
 
-AC_OUTPUT( Makefile mft_utils/Makefile mtcr_ul/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile mlxconfig/Makefile \
+AC_OUTPUT( Makefile mft_utils/Makefile mtcr_ul/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile mlxconfig/Makefile \
                mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile \
                small_utils/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile  mstdump/mstdump_dbs/Makefile )
 
index ab5b97f7da283476332659cd5649caf44a7f0706..20ba67281fb03b26367329981a6ec79d96c49781 100644 (file)
@@ -1,9 +1,17 @@
+mstflint (3.8.0) unstable; urgency=low
+
+  * Updated from MFT-3.8.0
+
+ -- Adrian Chiris <adrianc@unknown>  Mon, 17 Nov 2014 09:00:33 +0200
+
+
 mstflint (3.7.1) unstable; urgency=low
 
   * Updated from MFT-3.7.1
 
  -- Adrian Chiris <adrianc@unknown>  Mon, 12 Oct 2014 09:00:33 +0200
 
+
 mstflint (3.7.0) unstable; urgency=low
 
   * Updated from MFT-3.7.0
@@ -31,6 +39,7 @@ mstflint (3.5.0) unstable; urgency=low
 
  -- Omer Dagan <omerd@unknown>  Tue, 25 Dec 2013 16:49:33 +0200
 
+
 mstflint (3.0) unstable; urgency=low
 
   * Initial Debian release
index a6bc67674000c4d427673b0cb163e9795e8b78c8..a704bd39c65a3dcc055c49f372aabc011a05e28f 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * Copyright (c) 2013 Mellanox Technologies Ltd.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -102,6 +103,8 @@ typedef enum MError {
     ME_CMDIF_NOT_SUPP,
     ME_CMDIF_BAD_SYS,
     ME_CMDIF_UNKN_TLV,
+    ME_CMDIF_RES_STATE,
+    ME_CMDIF_UNKN_STATUS,
 
     //errors regarding MAD IF
     ME_MAD_BUSY = 0x400,
@@ -267,6 +270,16 @@ int icmd_send_command(mfile *mf, int opcode, void* data, int data_size, int skip
 
 int icmd_clear_semaphore(mfile *mf);
 
+
+int tools_cmdif_send_inline_cmd(mfile* mf, u_int64_t in_param, u_int64_t* out_param,
+                                u_int32_t input_modifier, u_int16_t opcode, u_int8_t  opcode_modifier);
+
+int tools_cmdif_send_mbox_command(mfile* mf, u_int16_t opcode, u_int8_t  opcode_modifier,
+                                  int data_offs_in_mbox, void* data, int data_size, int skip_write);
+
+int tools_cmdif_unlock_semaphore(mfile *mf);
+
+
 int mget_max_reg_size(mfile *mf);
 
 const char* m_err2str(MError status);
@@ -274,7 +287,6 @@ const char* m_err2str(MError status);
 int mread_buffer(mfile *mf, unsigned int offset, u_int8_t* data, int byte_len);
 int mwrite_buffer(mfile *mf, unsigned int offset, u_int8_t* data, int byte_len);
 
-int tools_cmdif_query_dev_cap(mfile *mf, u_int32_t offset, u_int64_t* data);
 
 #ifdef __cplusplus
 }
index 93c7c5c83ef6624c45c91aa9fcda7a862ed9bf46..69d78522656f37a7d88104397ea3f9b87b5984b1 100644 (file)
@@ -50,6 +50,7 @@
 #include "mflash_pack_layer.h"
 #include "mflash_access_layer.h"
 #include "mflash.h"
+#include "reg_access.h"
 
 #define ICMD_MAX_BLOCK_WRITE   128
 #define INBAND_MAX_BLOCK_WRITE 32
@@ -188,6 +189,37 @@ int release_semaphore(mflash* mfl, int ignore_writer_lock);
 
 #define CONNECT_IB_HW_ID 0x1FF
 #define SWITCH_IB_HW_ID 0x247
+#define SWITCH_EN_HW_ID 0x249
+
+/*
+ * Device IDs Macros:
+ */
+
+#define IS_CONNECTX_4TH_GEN_FAMILY(dev_id) \
+        (((dev_id) == CONNECTX_HW_ID) || ((dev_id) == CX3_HW_ID) || ((dev_id) == CX3_PRO_HW_ID))
+#define HAS_TOOLS_CMDIF(dev_id) \
+       ((((dev_id) == CX3_HW_ID) || ((dev_id) == CX3_PRO_HW_ID)) && (0)) //adrianc: we dont enable this feature due to performance issues.
+#define IS_SX(dev_id) \
+        ((dev_id) == SWITCHX_HW_ID)
+#define IS_SIB(dev_id) \
+        ((dev_id) == SWITCH_IB_HW_ID)
+#define IS_SEN(dev_id) \
+        ((dev_id) == SWITCH_EN_HW_ID)
+#define IS_IS4_FAMILY(dev_id) \
+    (((dev_id) == 435) || ((dev_id) == 6100)) // 435 == InfiniScaleIV, 6100 == BridgeX
+#define IS_CONNECT_IB(dev_id) \
+        ((dev_id) ==CONNECT_IB_HW_ID)
+#define IS_CONNECTX4(dev_id) \
+        ((dev_id) ==CX4_HW_ID)
+#define HAS_ICMD_IF(dev_id) \
+    ((IS_CONNECT_IB(dev_id)) || (IS_SIB(dev_id)) || (IS_CONNECTX4(dev_id)) || (IS_SEN(dev_id)))
+#define IS_SWITCH(dev_id) \
+       ((IS_IS4_FAMILY(dev_id)) || (IS_SX(dev_id)) || (IS_SIB(dev_id)) || (IS_SEN(dev_id)))
+#define IS_REALLY_OLD_DEVICE(dev_id) \
+        (((dev_id) == 23108) || ((dev_id) == 25208) || ((dev_id) == 24204) || ((dev_id) == 25204))
+#define IS_OLD_DEVICE(dev_id) \
+    ((IS_REALLY_OLD_DEVICE(dev_id)) || (IS_CONNECTX_4TH_GEN_FAMILY(dev_id)))
+
 
 // Write/Erase delays
 // ------------------
@@ -257,7 +289,7 @@ static u_int32_t log2up (u_int32_t in) {
 }
 
 // ConnectX SPI interface:
-int cntx_flash_init      (mflash* mfl, flash_params_t* flash_params);
+int cntx_init_direct_access      (mflash* mfl, flash_params_t* flash_params);
 
 int cntx_fill_attr       (mflash* mfl);
 
@@ -705,13 +737,21 @@ int cntx_st_spi_get_status(mflash* mfl, u_int8_t op_type, u_int8_t* status) {
     *status = EXTRACT(flash_data, 0, 8);
     return MFE_OK;
 }
+
+int get_num_of_banks_int(mflash *mfl) {
+    int num;
+    if ( (mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] != ATBM_NO) && ((num = get_num_of_banks(mfl->mf)) != -1) ){
+        return num; // if mfpa register is supported get the exact number of flash banks
+    }
+    return mfl->opts[MFO_NUM_OF_BANKS];
+}
+
 int get_flash_params(mflash* mfl, flash_params_t *flash_params, unsigned *type_index)
 {
-    int num_of_flashes = mfl->opts[MFO_NUM_OF_BANKS];
+    int num_of_flashes = get_num_of_banks_int(mfl);
     int spi_sel, rc;
     int params_were_set = 0;
     flash_info_t *flash_info;
-
     memset(flash_params, 0, sizeof(flash_params_t));
 
     for (spi_sel = 0 ; spi_sel < num_of_flashes ; spi_sel++) {
@@ -840,6 +880,10 @@ int read_chunks   (mflash* mfl, u_int32_t addr, u_int32_t len, u_int8_t* data) {
     int       rc;
     u_int8_t  *p         = (u_int8_t *)data;
 
+    if (!mfl) {
+        return MFE_BAD_PARAMS;
+    }
+
     // Note:
     // Assuming read block is the same as write block size.
     // This is true for current Mellanox devices SPI flash access implementation.
@@ -847,14 +891,9 @@ int read_chunks   (mflash* mfl, u_int32_t addr, u_int32_t len, u_int8_t* data) {
     u_int32_t block_size = mfl->attr.block_write;
     u_int32_t block_mask;
 
-
     // TODO - Check MAX_WRITE_BUFFER_SIZE against block_size in open (or here)
     u_int8_t  tmp_buff[MAX_WRITE_BUFFER_SIZE];
 
-    if (!mfl) {
-        return MFE_BAD_PARAMS;
-    }
-
     if (len < block_size) {
         // If we're reading a small chunk, use the smallest block_size to avoid the extra reads and padding overhead
         block_size = 4;
@@ -914,9 +953,6 @@ int read_chunks   (mflash* mfl, u_int32_t addr, u_int32_t len, u_int8_t* data) {
     return MFE_OK;
 }
 
-
-
-
 ////////////////////////////////////////
 //
 // InfiniHostIIILx spi  access functions
@@ -1041,67 +1077,10 @@ int empty_set_bank(mflash* mfl, u_int32_t bank) {
     return MFE_OK;
 }
 
-int is_connectx_family(u_int32_t dev_id) {
-    if (dev_id == CONNECTX_HW_ID ||
-        dev_id == CX3_HW_ID ||
-        dev_id == CX3_PRO_HW_ID) {
-        return 1;
-    }
-    return 0;
-
-}
-
-int is_sx(u_int32_t dev_id) {
-    if (dev_id == SWITCHX_HW_ID) {
-        return 1;
-    }
-    return 0;
-}
-int is_sx_ib(u_int32_t dev_id) {
-    if (dev_id == SWITCH_IB_HW_ID) {
-        return 1;
-    }
-    return 0;
-}
-int is_is4_family(u_int32_t dev_id) {
-    if (dev_id == 435  ||  // InfiniScaleIV
-        dev_id == 6100) { // BridgeX
-        return 1;
-    }
-    return 0;
-}
-
-int is_connectib(u_int32_t dev_id) {
-    if (dev_id == CONNECT_IB_HW_ID) {
-        return 1;
-    }
-    return 0;
-}
-
-int is_connectx4(u_int32_t dev_id) {
-       return (dev_id == CX4_HW_ID) ? 1 : 0;
-}
-
-int has_icmd_if(u_int32_t dev_id) {
-       return  (is_connectib(dev_id) ||
-                        is_sx_ib(dev_id) ||
-                        is_connectx4(dev_id));
-
-}
-
-int is_4th_gen_switch_family(u_int32_t dev_id) {
-    if (is_is4_family(dev_id) ||
-        is_sx(dev_id)         ||
-        is_connectib(dev_id)  ||
-        is_sx_ib(dev_id)) {
-        return 1;
-    }
-    return 0;
-}
-
 int cntx_exec_cmd(mflash* mfl, u_int32_t gw_cmd, char* msg) {
-    if (is_4th_gen_switch_family(mfl->attr.hw_dev_id)) {
-        // For Infiniscale4 and BridgeX: keep the GW locked during flash ops
+    if (!IS_OLD_DEVICE(mfl->attr.hw_dev_id)) {
+        // for old devices lock bit is separate from the flash HW ifc
+        //for new devices need to make sure this bit remains locked when writing the dword
         gw_cmd = MERGE(gw_cmd,              1,       31,                       1);
     }
     gw_cmd = MERGE(gw_cmd,              1, HBO_BUSY,                       1);
@@ -1358,6 +1337,7 @@ int cntx_init_gpios(mflash* mfl) {
 int spi_get_num_of_flashes(int prev_num_of_flashes)
 {
     char* mflash_env;
+    int num;
 
     if (prev_num_of_flashes != 0) {
         return prev_num_of_flashes;
@@ -1365,7 +1345,10 @@ int spi_get_num_of_flashes(int prev_num_of_flashes)
 
     mflash_env = getenv(MFLASH_ENV);
     if (mflash_env) {
-        return atol(mflash_env);
+        num =  atoi(mflash_env);
+        // make sure the value makes sense
+        num = (num > 16 || num < 0) ? -1 : num;
+        return num;
     }
 
     return -1;
@@ -1377,7 +1360,7 @@ int spi_update_num_of_banks(mflash* mfl, int prev_num_of_flashes)
 
     num_of_banks = spi_get_num_of_flashes(prev_num_of_flashes);
     if (num_of_banks == -1) {
-        if (is_sx(mfl->attr.hw_dev_id)) {
+        if (IS_SX(mfl->attr.hw_dev_id) || IS_SIB(mfl->attr.hw_dev_id) || IS_SEN(mfl->attr.hw_dev_id)) {
             mfl->opts[MFO_NUM_OF_BANKS] = 2;
         } else {
             mfl->opts[MFO_NUM_OF_BANKS] = 1;
@@ -1749,7 +1732,7 @@ int old_flash_lock(mflash* mfl, int lock_state) {
 }
 
 
-int cntx_flash_init(mflash* mfl, flash_params_t* flash_params) {
+int cntx_flash_init_direct_access(mflash* mfl, flash_params_t* flash_params) {
     int rc;
     u_int32_t tmp;
 
@@ -1875,7 +1858,7 @@ int connectib_flash_lock(mflash* mfl, int lock_state)
 #define SX_CS_SUPPORT_ADDR 0xF0420
 
 int sx_init_cs_support(mflash* mfl) {
-    if (is_sx(mfl->attr.hw_dev_id)) {
+    if (IS_SX(mfl->attr.hw_dev_id)) {
         u_int8_t cs_support_mask = 0;
         u_int32_t data;
         if (mfl->opts[MFO_USER_BANKS_NUM] == 0) {
@@ -2010,7 +1993,7 @@ int sx_flash_init_direct_access(mflash* mfl, flash_params_t* flash_params)
     return gen4_flash_init_com(mfl, flash_params, 1);
 }
 
-int connectib_init_direct_access(mflash* mfl, flash_params_t* flash_params)
+int fifth_gen_init_direct_access(mflash* mfl, flash_params_t* flash_params)
 {
 
     mfl->f_lock           = connectib_flash_lock;
@@ -2073,6 +2056,7 @@ static int update_max_write_size(mflash* mfl)
     return ME_OK;
 }
 
+// access flash via FW using Flash Access Registers (either by INBAND/ICMD/TOOLS_HCR)
 int flash_init_inband_access(mflash* mfl, flash_params_t* flash_params)
 {
     int rc;
@@ -2152,7 +2136,7 @@ int sx_flash_init(mflash* mfl, flash_params_t* flash_params)
     return MFE_OK;
 }
 
-#ifndef MST_UL
+
 int icmd_init(mflash *mfl)
 {
     // Clear  semaphore when asked to by flint or any tool using mflash
@@ -2163,15 +2147,35 @@ int icmd_init(mflash *mfl)
     }
     return MFE_OK;
 }
-#else
 
-int icmd_init(mflash *mfl) {
-       (void)mfl;
-       return MFE_NOT_IMPLEMENTED;
-}
+
+int tools_cmdif_init(mflash *mfl)
+{
+    u_int32_t type;
+    int rc;
+    // Clear  semaphore when asked to by flint or any tool using mflash
+    if (mfl->opts[MFO_IGNORE_SEM_LOCK]) {
+        if (tools_cmdif_unlock_semaphore(mfl->mf) != ME_OK) {
+            return MFE_CR_ERROR;
+        }
+    }
+    // Check if we access device through pciconf
+    rc = mget_mdevs_type(mfl->mf, &type);
+    (void) rc; // method cant really fail;
+
+#ifdef MST_UL
+    if (!(type & MTCR_ACCESS_CONFIG)) {
+        return MFE_PCICONF;
+    }
+#else
+    if (!(type & MST_PCICONF)) {
+        return MFE_PCICONF;
+    }
 #endif
+    return MFE_OK;
+}
 
-int connectib_flash_init(mflash* mfl, flash_params_t* flash_params)
+int fifth_gen_flash_init(mflash* mfl, flash_params_t* flash_params)
 {
     int rc;
     u_int8_t needs_cache_replacement;
@@ -2184,7 +2188,21 @@ int connectib_flash_init(mflash* mfl, flash_params_t* flash_params)
         }
         rc = flash_init_fw_access(mfl, flash_params); CHECK_RC(rc);
     } else {
-        rc = connectib_init_direct_access(mfl, flash_params); CHECK_RC(rc);
+        rc = fifth_gen_init_direct_access(mfl, flash_params); CHECK_RC(rc);
+    }
+    return MFE_OK;
+}
+
+int cntx_flash_init(mflash* mfl, flash_params_t* flash_params)
+{
+    int rc;
+
+    if ( mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_TOOLS_CMDIF &&\
+         mfl->opts[MFO_IGNORE_CASHE_REP_GUARD] == 0) {
+        rc = tools_cmdif_init(mfl); CHECK_RC(rc);
+        rc = flash_init_fw_access(mfl, flash_params); CHECK_RC(rc);
+    } else {
+        rc = cntx_flash_init_direct_access(mfl, flash_params); CHECK_RC(rc);
     }
     return MFE_OK;
 }
@@ -2230,50 +2248,60 @@ int mf_open_ignore_lock(mflash* mfl) {
     return mf_open_fw(mfl, NULL, 0);
 }
 
-
-
-
 #define CR_LOCK_HW_ID 0xbad0cafe
 
-
 int get_dev_info(mflash* mfl)
 {
     u_int32_t dev_flags;
     int rc;
     u_int32_t dev_id;
-    // The opt MFO_FW_ACCESS_TYPE_BY_MFILE will be used only when work on SX device
     mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_NO;
     rc = mget_mdevs_flags(mfl->mf, &dev_flags); CHECK_RC(rc);
 
+    // get hw id
+    // Special case for MLNX OS getting dev_id using REG MGIR
+    if (dev_flags & MDEVS_MLNX_OS) {
+        reg_access_status_t rc;
+        struct register_access_sib_mgir mgir;
+        memset(&mgir, 0, sizeof(mgir));
+        rc = reg_access_mgir(mfl->mf, REG_ACCESS_METHOD_GET, &mgir);
+        //printf("-D- RC[%s] -- REVID: %d -- DEVID: %d hw_dev_id: %d\n", m_err2str(rc), mgir.HWInfo.REVID, mgir.HWInfo.DEVID, mgir.HWInfo.hw_dev_id);
+        if (rc) {
+            dev_id = SWITCHX_HW_ID;
+            mfl->attr.rev_id    = 0;
+            mfl->attr.hw_dev_id = SWITCHX_HW_ID;
+        } else {
+            dev_id = mgir.HWInfo.hw_dev_id;
+            if (dev_id == 0) {
+                dev_id = SWITCHX_HW_ID;
+                mfl->attr.hw_dev_id = SWITCHX_HW_ID;
+                mfl->attr.rev_id = mgir.HWInfo.REVID & 0xf;
+            } else {
+                mfl->attr.hw_dev_id = dev_id;
+                mfl->attr.rev_id = 0; //WA: MGIR should have also hw_rev_id and then we can use it.
+            }
+        }
+    } else {
+        MREAD4(HW_DEV_ID, &dev_id);
+        if (dev_id == CR_LOCK_HW_ID) {
+            return MFE_LOCKED_CRSPACE;
+        }
+        mfl->attr.rev_id    = (dev_id & 0xff0000) >> 16;
+        mfl->attr.hw_dev_id = dev_id & 0xffff;
+    }
     if (dev_flags & MDEVS_MLNX_OS) {
-         // HACK: When we have a mlnxsw device we don't have any access to cr-space so we will assume we work on SX
-         dev_id = SWITCHX_HW_ID;
-         mfl->attr.rev_id    = 0;
-         mfl->attr.hw_dev_id = SWITCHX_HW_ID;
          mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_MLNXOS_CMDIF;
-     } else {
-         MREAD4(HW_DEV_ID, &dev_id);
-         if (dev_id == CR_LOCK_HW_ID) {
-             return MFE_LOCKED_CRSPACE;
-         }
-         mfl->attr.rev_id    = (dev_id & 0xff0000) >> 16;
-         mfl->attr.hw_dev_id = dev_id & 0xffff;
-
-         if (dev_flags & MDEVS_IB) {
+     } else if (dev_flags & MDEVS_IB){
              mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_INBAND;
-         } else {
-             if (has_icmd_if(mfl->attr.hw_dev_id)) {
-                 if (mfl->opts[MFO_IGNORE_CASHE_REP_GUARD] == 0) {
-                    #ifdef MST_UL
-                         mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_INBAND;
-                    #else
-                         mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_ICMD;
-                    #endif
-                 }
+     } else if (HAS_ICMD_IF(mfl->attr.hw_dev_id)){
+             if (mfl->opts[MFO_IGNORE_CASHE_REP_GUARD] == 0) {
+                     mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_ICMD;
              }
-         }
+     } else if (HAS_TOOLS_CMDIF(mfl->attr.hw_dev_id)) {
+         if (mfl->opts[MFO_IGNORE_CASHE_REP_GUARD] == 0) {
+            mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_TOOLS_CMDIF;
+        }
      }
-
     return MFE_OK;
 
 }
@@ -2294,14 +2322,14 @@ int mf_open_fw(mflash* mfl, flash_params_t* flash_params, int num_of_banks)
 
         if (mfl->attr.hw_dev_id == 23108 || mfl->attr.hw_dev_id == 25208 || mfl->attr.hw_dev_id == 24204 || mfl->attr.hw_dev_id == 25204) {
             rc = MFE_OLD_DEVICE_TYPE;
-        } else if (is_connectx_family(mfl->attr.hw_dev_id)) {
+        } else if (IS_CONNECTX_4TH_GEN_FAMILY(mfl->attr.hw_dev_id)) {
             rc = cntx_flash_init(mfl, flash_params);
-        } else if (is_is4_family(mfl->attr.hw_dev_id)) {
+        } else if (IS_IS4_FAMILY(mfl->attr.hw_dev_id)) {
             rc = is4_flash_init(mfl, flash_params);
-        } else if (is_sx(mfl->attr.hw_dev_id)) {
+        } else if (IS_SX(mfl->attr.hw_dev_id)) {
             rc = sx_flash_init(mfl, flash_params);
-        } else if (has_icmd_if(mfl->attr.hw_dev_id)) {
-            rc = connectib_flash_init(mfl, flash_params);
+        } else if (HAS_ICMD_IF(mfl->attr.hw_dev_id)) {
+            rc = fifth_gen_flash_init(mfl, flash_params);
         } else if (mfl->attr.hw_dev_id == 0xffff) {
             rc = MFE_HW_DEVID_ERROR;
         } else {
@@ -2352,7 +2380,6 @@ int     mf_opend       (mflash** pmfl, struct mfile_t* mf, int num_of_banks, fla
 }
 
 
-
 int     mf_open_uefi(mflash** pmfl, uefi_Dev_t *uefi_dev, f_fw_cmd fw_cmd_func)
 {
 
@@ -2386,9 +2413,9 @@ int     mf_open        (mflash** pmfl, const char* dev, int num_of_banks, flash_
     return MFE_OK;
 }
 
-int     mf_close       (mflash* mfl) {
+void     mf_close       (mflash* mfl) {
     if (!mfl) {
-        return MFE_BAD_PARAMS;
+        return;
     }
 
     if (mfl->f_reset) {
@@ -2396,7 +2423,7 @@ int     mf_close       (mflash* mfl) {
     }
 
     if (mfl->f_set_bank) {
-        set_bank(mfl, 0);
+        (void)set_bank(mfl, 0);
     }
     // we release if we have writer_lock or not doesnt matter on close ...
     release_semaphore(mfl, 1);
@@ -2406,7 +2433,7 @@ int     mf_close       (mflash* mfl) {
     }
 
     free(mfl);
-    return MFE_OK;
+    return;
 }
 
 
@@ -2555,6 +2582,8 @@ const char*   mf_err2str (int err_code) {
         return "MFE_REG_ACCESS_UNKNOWN_ERR";
     case MFE_REG_ACCESS_SIZE_EXCCEEDS_LIMIT:
         return "MFE_REG_ACCESS_SIZE_EXCCEEDS_LIMIT";
+    case MFE_PCICONF:
+        return "Access to device should be through configuration cycles.";
     default:
         return "Unknown error";
     }
@@ -2592,11 +2621,11 @@ int     mf_cr_write    (mflash* mfl, u_int32_t cr_addr, u_int32_t  data) {
 
 int    mf_update_boot_addr(mflash* mfl, u_int32_t boot_addr)
 {
-       if (mfl->access_type != MFAT_UEFI && mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] != ATBM_MLNXOS_CMDIF) {
-               // the boot addr will be updated directly via cr-space
-               return mf_cr_write(mfl, BOOT_CR_SPACE_ADDR, ((boot_addr << 8) | 0x06));
-       }
-       // the boot addr will be updated via reg
+    if (mfl->access_type != MFAT_UEFI && mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] != ATBM_MLNXOS_CMDIF) {
+        // the boot addr will be updated directly via cr-space
+        return mf_cr_write(mfl, BOOT_CR_SPACE_ADDR, ((boot_addr << 8) | 0x06));
+    }
+    // the boot addr will be updated via reg
     return mf_update_boot_addr_by_type(mfl, boot_addr);
 }
 
index c5e269e7973a4c4661b78dbfa33de5667196691e..55a3bdc7baba6b8e91a28126ff4259423fb06f3e 100644 (file)
@@ -3,7 +3,7 @@
  * mflash.h - Mellanox Technilogies LTD. Flash access lib heared file
  * ==================================================================
  *
- * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -33,9 +33,8 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- *  Version: $Id: $
- *
  */
+
 #ifndef MFLASH_H
 #define MFLASH_H
 
@@ -117,7 +116,7 @@ int     mf_opend       (mflash** pmfl, struct mfile_t* mf, int num_of_banks,  fl
 int     mf_open_uefi(mflash** pmfl, uefi_Dev_t *uefi_dev, f_fw_cmd fw_cmd_func);
 
 int     mf_open_ignore_lock(mflash* mfl);
-int     mf_close       (mflash* mfl);
+void     mf_close       (mflash* mfl);
 
 //
 // Flash access functions:
index 10c9a55d3de4d0fd8f510b89f762908d59802023..d15b742488f7b2218fc0d09585303b2df49f954c 100755 (executable)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 #include <stdio.h>
@@ -54,6 +55,7 @@ int check_access_type(mflash* mfl)
         } else if ( mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_MLNXOS_CMDIF) {
 #endif
         } else if ( mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_ICMD) {
+        } else if ( mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_TOOLS_CMDIF) {
         } else {
             return MFE_UNKOWN_ACCESS_TYPE;
         }
@@ -138,19 +140,12 @@ int sx_erase_sect_by_type(mflash* mfl, u_int32_t addr)
     return MFE_OK;
 }
 
-int     mf_update_boot_addr_by_type(mflash* mfl, u_int32_t boot_addr)
+int mf_update_boot_addr_by_type(mflash* mfl, u_int32_t boot_addr)
 {
     int rc;
     if (mfl->access_type == MFAT_UEFI || mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_MLNXOS_CMDIF) {
-       // for inband or cib fwaccess return MFE_NOT_IMPLEMENTED
-       // for cmdIF fwaccess i.e mlnxOS update boot addr via reg access
-       if (mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_INBAND || mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] == ATBM_ICMD) {
-               return MFE_NOT_IMPLEMENTED;
-       }
-       else {
-       // uefi is supported and MLNXOS
-       rc = run_mfpa_command(mfl->mf, REG_ACCESS_METHOD_SET, mfl->curr_bank, boot_addr, NULL); CHECK_RC(rc);
-       }
+        // No CR-Space access - use mfpa register
+        rc = run_mfpa_command(mfl->mf, REG_ACCESS_METHOD_SET, mfl->curr_bank, boot_addr, NULL, NULL); CHECK_RC(rc);
     }
     return MFE_OK;
 }
index bfda06a02343028ef34262faaeb3bf5893d3d36b..a42219544ee486863a005b85b7a94d64bc607b22 100755 (executable)
@@ -28,7 +28,9 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
+
 /*
  * mflash_inband.h
  *
index 3d760945119da45d4d7cd6787af13a24ab324f87..a78ded5424e963a9e134ba1cca18fc7c47735e62 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 #ifndef MFLASH_COMMON_STRUCTS_H
index b213421dbec96fd970b983d9d68af72a10cbc701..2b2bdf604f97ca88a14398ef33792470f2a4b8bc 100755 (executable)
@@ -98,7 +98,7 @@ int common_erase_sector(mfile *mf, u_int32_t addr, u_int8_t flash_bank)
     return MError2MfError(reg_access_mfbe (mf, REG_ACCESS_METHOD_SET, &mfbe));
 }
 
-int run_mfpa_command(mfile *mf, u_int8_t access_cmd, u_int8_t flash_bank, u_int32_t boot_address, u_int32_t *jedec_p)
+int run_mfpa_command(mfile *mf, u_int8_t access_cmd, u_int8_t flash_bank, u_int32_t boot_address, u_int32_t *jedec_p, int *num_of_banks)
 {
        struct register_access_mfpa    mfpa;
     int rc;
@@ -109,8 +109,8 @@ int run_mfpa_command(mfile *mf, u_int8_t access_cmd, u_int8_t flash_bank, u_int3
     if (access_cmd == REG_ACCESS_METHOD_SET) {
         mfpa.boot_address = boot_address;
     }
-    rc = reg_access_mfpa (mf, access_cmd, &mfpa);
-    rc = MError2MfError(rc);
+    rc = MError2MfError(reg_access_mfpa (mf, access_cmd, &mfpa));
+
     if (rc && rc != MFE_REG_ACCESS_BAD_PARAM) {
         // if rc is REG_ACCESS_BAD_PARAM it means we dont have that flash bank connected (no need to fail)
         return rc;
@@ -123,12 +123,25 @@ int run_mfpa_command(mfile *mf, u_int8_t access_cmd, u_int8_t flash_bank, u_int3
             *jedec_p = 0xffffffff;
         }
     }
+    if (num_of_banks != NULL) {
+        *num_of_banks = mfpa.flash_num;
+    }
     return MFE_OK;
 }
 
+int get_num_of_banks(mfile *mf)
+{
+    int num_of_banks;
+    int rc = run_mfpa_command(mf, REG_ACCESS_METHOD_GET, 0, 0, NULL, &num_of_banks);
+    if (rc) {
+        return -1;
+    }
+    return num_of_banks;
+}
+
 int com_get_jedec(mfile *mf, u_int8_t flash_bank, u_int32_t *jedec_p)
 {
-    return run_mfpa_command(mf, REG_ACCESS_METHOD_GET, flash_bank, 0, jedec_p);
+    return run_mfpa_command(mf, REG_ACCESS_METHOD_GET, flash_bank, 0, jedec_p, NULL);
 }
 
 int set_bank(mflash* mfl, u_int32_t addr) {
index bde82c3ace26e30339126e25178820a39f899815..1355f24af233874bc5699a72bc9262abc42471f3 100755 (executable)
@@ -28,7 +28,9 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
+
 /*
  * mflash_inband.h
  *
@@ -114,6 +116,7 @@ enum AccessTypeByMfile{
     ATBM_INBAND,
     ATBM_MLNXOS_CMDIF,
     ATBM_ICMD,
+    ATBM_TOOLS_CMDIF,
 };
 
 /*
@@ -187,9 +190,10 @@ int sx_st_block_access(mfile *mf, u_int32_t flash_addr, u_int8_t bank, u_int32_t
 
 int common_erase_sector(mfile *mf, u_int32_t addr, u_int8_t flash_bank);
 
-int run_mfpa_command(mfile *mf, u_int8_t access_cmd, u_int8_t flash_bank, u_int32_t boot_address, u_int32_t *jedec_p);
+int run_mfpa_command(mfile *mf, u_int8_t access_cmd, u_int8_t flash_bank, u_int32_t boot_address, u_int32_t *jedec_p, int *num_of_banks);
 
 int com_get_jedec(mfile *mf, u_int8_t flash_bank, u_int32_t *jedec_p);
+int get_num_of_banks(mfile *mf);
 int get_info_from_jededc_id(u_int32_t jededc_id, u_int8_t *vendor, u_int8_t* type, u_int8_t* capacity);
 int get_type_index_by_vendor_and_type(u_int8_t vendor, u_int8_t type, unsigned *type_index);
 int get_log2size_by_capcity(unsigned type_index, u_int8_t capacity, int *log2size);
index 2250c446e8bd759f911cb3c05449f6c275cfd66c..b66f6ef0cb66e77e62e7fef773db67a82529d9a0 100644 (file)
@@ -96,6 +96,7 @@ typedef enum MfError {
     MFE_REG_ACCESS_MSG_RECPT_ACK,
     MFE_REG_ACCESS_UNKNOWN_ERR,
     MFE_REG_ACCESS_SIZE_EXCCEEDS_LIMIT,
+    MFE_PCICONF,
 
 
 
index 36fc293d64786b6750fb9fe24cc9d82da9c461dd..0e395a9c650bad1c0950c218df2da2bf22f83777 100755 (executable)
@@ -39,15 +39,16 @@ UTILS_DIR = $(top_srcdir)/mft_utils
 DEV_MGT_DIR = $(top_srcdir)/dev_mgt
 LAYOUTS_LIB = $(LAYOUTS_DIR)/libtools_layouts.a
 UTILS_LIB = $(USER_DIR)/mft_utils/libmftutils.a
+CMDIF_DIR = $(USER_DIR)/cmdif
 
 
 INCLUDES = -I. -I$(USER_DIR) -I$(top_srcdir)/include/mtcr_ul -I$(MTCR_DIR) -I$(COMMON_DIR) $(WIN64_INC)\
-           -I$(MFT_EXT_LIBS_INC_DIR) -I $(LAYOUTS_DIR) -I$(MFT_EXT_LIBS_INC_DIR)/zlib -I $(UTILS_DIR) -I$(DEV_MGT_DIR)
+           -I$(MFT_EXT_LIBS_INC_DIR) -I $(LAYOUTS_DIR) -I$(MFT_EXT_LIBS_INC_DIR)/zlib -I $(UTILS_DIR) -I$(DEV_MGT_DIR) -I$(CMDIF_DIR)
 
 AM_CXXFLAGS = -Wall -W -g -MP -MD -pipe
 bin_PROGRAMS = mstconfig
 
-mstconfig_LDADD =  ../reg_access/libreg_access.a $(LAYOUTS_LIB)  $(MTCR_DIR)/libmtcr_ul.a  $(MLNXOS_PPC_LIBS) $(LIBSTD_CPP) $(UTILS_LIB) $(DEV_MGT_DIR)/libdev_mgt.a -ldl
+mstconfig_LDADD = $(CMDIF_DIR)/libcmdif.a ../reg_access/libreg_access.a $(LAYOUTS_LIB) $(MTCR_DIR)/libmtcr_ul.a $(MLNXOS_PPC_LIBS) $(LIBSTD_CPP) $(UTILS_LIB) $(DEV_MGT_DIR)/libdev_mgt.a -ldl
 
 mstconfig_SOURCES = mlxcfg_ui.h mlxcfg_ui.cpp\
                         mlxcfg_parser.cpp\
index ba1220ca78d01f414e5d601a87a0eee0270159eb..b1316ba3b73329b062d24f7ab99c74c154ace4bc 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 /*
  * mlxcfg_lib.cpp
@@ -44,6 +45,9 @@
 #include <tools_layouts/tools_open_layouts.h>
 #include <reg_access/reg_access.h>
 #include <bit_slice.h>
+#include <cmdif/tools_cif.h>
+#include <mtcr.h>
+
 
 #include "mlxcfg_lib.h"
 
@@ -80,6 +84,8 @@ using namespace std;
 # define DEBUG_PRINT_RECIEVE(data_struct, struct_name)
 #endif
 
+#define CHECK_RC(rc)\
+       if (rc) return rc;
 /*
  * Enum for handling error messages
  */
@@ -112,6 +118,7 @@ typedef enum {
     MCE_INCOMPLETE_PARAMS,
     MCE_OPEN_DEVICE,
     MCE_PCICONF,
+    MCE_GET_DEFAULT_PARAMS,
     MCE_UNKNOWN_ERR
 }McStatus;
 
@@ -133,6 +140,7 @@ MlxCfgOps::CfgParams::CfgParams(mlxCfgType t, u_int32_t tlvT) {
     errmap[MCE_BAD_PARAMS] = "Bad parameters";
     errmap[MCE_BAD_PARAM_VAL] = "Bad parameter value";
     errmap[MCE_BAD_STATUS] = "General Failure";
+    errmap[MCE_GET_DEFAULT_PARAMS] = "Failed to get default params";
 
     updateErrCodes(errmap);
     type = t;
@@ -140,10 +148,50 @@ MlxCfgOps::CfgParams::CfgParams(mlxCfgType t, u_int32_t tlvT) {
     _updated = false;
 }
 
+int MlxCfgOps::CfgParams::getDefaultParams4thGen(mfile* mf, struct tools_open_query_def_params_global* global_params)
+{
+    MError rc  = tcif_query_global_def_params(mf, global_params);
+    if (rc) {
+        return errmsg(MCE_BAD_STATUS, "Failed to get default parameters: %s", tcif_err2str(rc));
+    }
+    return MCE_SUCCESS;
+}
+
+int MlxCfgOps::CfgParams::getDefaultParams4thGen(mfile* mf, int port, struct tools_open_query_def_params_per_port* port_params)
+{
+    MError rc  = tcif_query_per_port_def_params(mf, port, port_params);
+    if (rc) {
+        return errmsg(MCE_BAD_STATUS, "Failed to get default parameters: %s", tcif_err2str(rc));
+    }
+    return MCE_SUCCESS;
+}
+
+int MlxCfgOps::CfgParams::getDefaultAndFromDev(mfile* mf)
+{
+    int rc;
+    rc = getDefaultParams(mf); CHECK_RC(rc);
+    rc = getFromDev(mf); CHECK_RC(rc);
+    return MCE_SUCCESS;
+}
 /*
  * MlxCfgOps::SriovParams implementation
  */
 
+int MlxCfgOps::SriovParams::getDefaultParams(mfile* mf)
+{
+    struct tools_open_query_def_params_global global_params;
+    int rc;
+    rc = updateMaxVfs(mf); CHECK_RC(rc);
+    rc = getDefaultParams4thGen(mf, &global_params);
+    if (rc == MCE_SUCCESS) {
+        _sriovEn = global_params.sriov_en;
+        _numOfVfs = global_params.num_vfs1;
+    } else {
+        rc = MCE_GET_DEFAULT_PARAMS;
+    }
+    return rc;
+}
+
 void MlxCfgOps::SriovParams::setParam(mlxCfgParam paramType, u_int32_t val)
 {
     if (paramType == Mcp_Sriov_En) {
@@ -191,8 +239,8 @@ int MlxCfgOps::SriovParams::getFromDev(mfile* mf)
     }
     // unpack and update
     tools_open_sriov_unpack(&sriovTlv, buff);
-    _sriovEn = _sriovEn == MLXCFG_UNKNOWN ? sriovTlv.sriov_en : _sriovEn ;
-    _numOfVfs = _numOfVfs == MLXCFG_UNKNOWN ? sriovTlv.total_vfs : _numOfVfs ;
+    _sriovEn = sriovTlv.sriov_en;
+    _numOfVfs = sriovTlv.total_vfs;
     _updated = true;
 
     return MCE_SUCCESS;
@@ -200,16 +248,13 @@ int MlxCfgOps::SriovParams::getFromDev(mfile* mf)
 
 int MlxCfgOps::SriovParams::setOnDev(mfile* mf, bool ignoreCheck)
 {
-    int rc;
     if (_sriovEn == MLXCFG_UNKNOWN || _numOfVfs == MLXCFG_UNKNOWN) {
-        rc = getFromDev(mf);
-        if (rc || _sriovEn == MLXCFG_UNKNOWN || _numOfVfs == MLXCFG_UNKNOWN) { // go here if we fail to get the tlv or it doesnt exsist (one of the params == MLXCFG_UNKNOWN)
-            return errmsg("%s please specify all the parameters for SRIOV.", err() ? err(): "");
-        }
+        return errmsg("%s please specify all parameters for SRIOV.", err() ? err() : "");
     }
     if (!ignoreCheck && !isLegal(mf)) {
         return MCE_BAD_PARAMS;
     }
+
     // prep tlv
     MError ret;
     u_int8_t buff[tools_open_sriov_size()];
@@ -235,7 +280,7 @@ int MlxCfgOps::SriovParams::setOnDev(mfile* mf, bool ignoreCheck)
 int MlxCfgOps::SriovParams::updateMaxVfs(mfile* mf)
 {
     u_int64_t data = 0;
-    int rc = tools_cmdif_query_dev_cap(mf, MAX_VFS_ADDR, &data);
+    int rc = tcif_query_dev_cap(mf, MAX_VFS_ADDR, &data);
     if (rc) {
         return errmsg("failed to query device capabilities: %s", m_err2str((MError)rc));
     }
@@ -243,31 +288,46 @@ int MlxCfgOps::SriovParams::updateMaxVfs(mfile* mf)
     if (_maxVfs == 0) { // defined in CX PRM , if max_func_idx=0 then all functions(128) are operational
         _maxVfs = 128;
     }
+    _maxVfs--; // remove 1 physical function
     return MCE_SUCCESS;
 }
 
 bool MlxCfgOps::SriovParams::isLegal(mfile* mf)
 {
+    u_int32_t barSz = 0;
+    BarSzParams barParams;
+
     if (!mf) {
         return false;
     }
-    u_int64_t data = 0;
-    int rc = tools_cmdif_query_dev_cap(mf, DEFAULT_BAR_SZ_ADDR, &data);
-    if (rc) {
-        errmsg("failed to query device capabilities: %s",m_err2str((MError)rc));
+
+    if (barParams.getDefaultAndFromDev(mf)) {
+       return false;
+    }
+
+    if ((_numOfVfs > _maxVfs)) {
+        errmsg("Number of VFs exceeds limit (%d).", _maxVfs);
         return false;
     }
-    data = EXTRACT64(data,16,6) + 1; // this is the default log2 bar size , we require numOfVfs*(2^log_uar_bar) <= 512 or else the node might not boot
-    double VfsMem = _numOfVfs*(std::pow((double)2, (int)data));
-    //TODO: when bar_size tlv will be supported, we need to change this to the current bar_size (and also check with the current tlv bar size)
-    //printf("-D- num_of_vfs*2^(bar_sz+1) = %d*2^%ld = %d\n", _numOfVfs, data, (int)(_numOfVfs*(std::pow((double)2, (int)data))));
-    //printf("-D- maxVfs(default set by fw) : %d\n", _maxVfs);
+
     if (_sriovEn != 0 && _sriovEn != 1) {
         errmsg("illegal SRIOV_EN parameters value. (should be 0 or 1)");
         return false;
     }
-    if ((_numOfVfs > _maxVfs) || (VfsMem > 512)){
-        unsigned int maxAlowedVfs =static_cast<unsigned int>(512/(std::pow((double)2, (int)data)));
+    if (_sriovEn == 0) {
+       return true;
+    }
+
+    barSz = barParams.getParam(Mcp_Log_Bar_Size);
+
+    if (barSz == MLXCFG_UNKNOWN) {
+       return errmsg("Failed to get the bar size from device");
+    }
+    // this is the default log2 bar size , we require (numOfVfs+1)*(2^log_uar_bar) <= 512 or else the node might not boot
+    double TotalMem = (_numOfVfs + 1)*(1 << barSz); // 1 for physical func
+
+    if ((TotalMem > 512)){
+        unsigned int maxAlowedVfs =static_cast<unsigned int>(512/(1 << barSz)) - 1;
         errmsg("illegal SRIOV parameter value. Maximal number of VFs: %d", maxAlowedVfs < _maxVfs ? maxAlowedVfs : _maxVfs);
         return false;
     }
@@ -278,6 +338,18 @@ bool MlxCfgOps::SriovParams::isLegal(mfile* mf)
  * MlxCfgOps::WolParams implementation
  */
 
+int MlxCfgOps::WolParams::getDefaultParams(mfile* mf)
+{
+    struct tools_open_query_def_params_per_port port_params;
+    int rc = getDefaultParams4thGen(mf, _port , &port_params);
+    if (rc == MCE_SUCCESS) {
+        _wolMagicEn = port_params.en_wol_magic;
+    } else {
+        rc = MCE_GET_DEFAULT_PARAMS;
+    }
+    return rc;
+}
+
 void MlxCfgOps::WolParams::setParam(mlxCfgParam paramType, u_int32_t val)
 {
     if ((paramType == Mcp_Wol_Magic_En_P1 && _port == 1 ) || (paramType == Mcp_Wol_Magic_En_P2 && _port == 2) ) {
@@ -317,7 +389,7 @@ int MlxCfgOps::WolParams::getFromDev(mfile* mf)
     }
     // unpack and update
     tools_open_wol_unpack(&wolTlv, buff);
-    _wolMagicEn = _wolMagicEn == MLXCFG_UNKNOWN ? wolTlv.en_wol_magic : _wolMagicEn ;
+    _wolMagicEn = wolTlv.en_wol_magic;
     _updated = true;
 
     return MCE_SUCCESS;
@@ -325,12 +397,8 @@ int MlxCfgOps::WolParams::getFromDev(mfile* mf)
 
 int MlxCfgOps::WolParams::setOnDev(mfile* mf, bool ignoreCheck)
 {
-    int rc;
     if (_wolMagicEn == MLXCFG_UNKNOWN) {
-        rc = getFromDev(mf);
-        if (rc || _wolMagicEn == MLXCFG_UNKNOWN) {
-            return errmsg("%s please specify all the parameters for WOL.", err()? err() : "");
-        }
+        return errmsg("%s please specify all the parameters for WOL.", err()? err() : "");
     }
     if (!ignoreCheck && !isLegal()) {
         return MCE_BAD_PARAMS;
@@ -370,6 +438,39 @@ bool MlxCfgOps::WolParams::isLegal(mfile* mf)
  *  BarSzParams Implementation
  */
 
+int MlxCfgOps::BarSzParams::getDefaultParams(mfile* mf)
+{
+    struct tools_open_query_def_params_global global_params;
+    int rc = getDefaultParams4thGen(mf, &global_params);
+    if ((rc == MCE_SUCCESS) & 0) { //TODO: adrianc: remove the & 0 when FW displays thesee parameters correctly in QUERY_DEF_PARAMS command
+        _logBarSz = global_params.uar_bar_size1;
+        _maxLogBarSz = global_params.max_uar_bar_size1;
+    } else {
+        // attempt to take from query_dev_cap
+        rc = getDefaultBarSz(mf);
+    }
+    return rc;
+}
+
+int MlxCfgOps::BarSzParams::getDefaultBarSz(mfile* mf)
+{
+    u_int64_t data = 0;
+    MError rc = tcif_query_dev_cap(mf, MAX_BAR_SZ_ADDR, &data);
+    if (rc) {
+        return errmsg(MCE_BAD_STATUS,"Failed to query device capabilities. %s", tcif_err2str(rc));
+    }
+
+    _maxLogBarSz = EXTRACT64(data, 3, 6);
+
+    rc = tcif_query_dev_cap(mf, DEFAULT_BAR_SZ_ADDR, &data);
+    if (rc) {
+        return errmsg(MCE_BAD_STATUS,"Failed to query device capabilities. %s", tcif_err2str(rc));
+    }
+
+    _logBarSz = EXTRACT64(data, 16, 6) + 1; //adrianc: this field reports only half of the bar size (i.e without the blue flame)
+    return MCE_SUCCESS;
+}
+
 void MlxCfgOps::BarSzParams::setParam(mlxCfgParam paramType, u_int32_t val)
 {
     if ((paramType == Mcp_Log_Bar_Size) ) {
@@ -409,7 +510,7 @@ int MlxCfgOps::BarSzParams::getFromDev(mfile* mf)
     }
     // unpack and update
     tools_open_bar_size_unpack(&barSzTlv, buff);
-    _logBarSz = _logBarSz == MLXCFG_UNKNOWN ? barSzTlv.log_uar_bar_size : _logBarSz ;
+    _logBarSz = barSzTlv.log_uar_bar_size;
     _updated = true;
 
     return MCE_SUCCESS;
@@ -417,14 +518,11 @@ int MlxCfgOps::BarSzParams::getFromDev(mfile* mf)
 
 int MlxCfgOps::BarSzParams::setOnDev(mfile* mf, bool ignoreCheck)
 {
-    int rc;
     if (_logBarSz == MLXCFG_UNKNOWN) {
-        rc = getFromDev(mf);
-        if (rc || _logBarSz == MLXCFG_UNKNOWN) {
-            return errmsg("%s please specify all the parameters for BAR size.", err() ? err() : "");
-        }
+        return errmsg("%s please specify all the parameters for BAR size.", err() ? err() : "");
     }
-    if (!ignoreCheck && !isLegal()) {
+
+    if (!ignoreCheck && !isLegal(mf)) {
         return MCE_BAD_PARAMS;
     }
 
@@ -449,33 +547,64 @@ int MlxCfgOps::BarSzParams::setOnDev(mfile* mf, bool ignoreCheck)
     return MCE_SUCCESS;
 }
 
-int MlxCfgOps::BarSzParams::updateBarSzInfo(mfile* mf)
+bool MlxCfgOps::BarSzParams::isLegal(mfile* mf)
 {
-    u_int64_t data = 0;
-    int rc = tools_cmdif_query_dev_cap(mf, MAX_BAR_SZ_ADDR, &data);
-    if (rc) {
-        return errmsg("Failed to query device capabilities: %s", m_err2str((MError)rc));
+    u_int32_t numOfVfs = 0;
+    int sriovEn;
+    SriovParams sriovParams;
+
+    if (!mf) {
+        return false;
     }
-    _maxLogBarSz = (u_int32_t)(data & 0xffffffff);
-    _currLogBarSz = (u_int32_t)(data >> 32);
-    //printf("-D- vec 0x%lx  max %d  curr %d\n", data, maxBarSz, currBarSz);
-    return MCE_SUCCESS;
-}
 
-bool MlxCfgOps::BarSzParams::isLegal(mfile* mf)
-{
-    (void)mf;
-    if (_logBarSz < _maxLogBarSz ) {
-        return true;
+    if (_logBarSz >= _maxLogBarSz ) {
+        errmsg("given bar size is too large, max allowed log2 bar size: 0x%x", _maxLogBarSz);
+        return false;
     }
-    errmsg("given bar size is too large, max allowed log2 bar size: 0x%x", _maxLogBarSz);
-    return false;
+
+    if (sriovParams.getDefaultAndFromDev(mf)) {
+        errmsg("Failed to get SRIOV parameters from device: %s", sriovParams.err());
+        return false;
+    }
+
+    numOfVfs = sriovParams.getParam(Mcp_Num_Of_Vfs);
+    sriovEn = sriovParams.getParam(Mcp_Sriov_En);
+
+    if (numOfVfs== MLXCFG_UNKNOWN || numOfVfs == MLXCFG_UNKNOWN) {
+        errmsg("Illegal SRIOV parameters values");
+       return false;
+    }
+
+    if (sriovEn == 0) {
+       return true;
+    }
+    // this is the default log2 bar size , we require numOfVfs*(2^log_uar_bar) <= 512 or else the node might not boot
+    double TotalMem = (numOfVfs+1)*(1 << _logBarSz);
+    //printf("-D- num_of_vfs*2^(bar_sz+1) = %d*2^%ld = %d\n", _numOfVfs, data, (int)(_numOfVfs*(std::pow((double)2, (int)data))));
+    //printf("-D- maxVfs(default set by fw) : %d\n", _maxVfs);
+
+    if (TotalMem > 512){
+        unsigned int maxAlowedLogBarSz =static_cast<unsigned int>(log2((512/(numOfVfs + 1 ))));
+        errmsg("illegal Bar Size parameter value. Maximal allowed bar size: %d", maxAlowedLogBarSz < _maxLogBarSz ? maxAlowedLogBarSz : _maxLogBarSz);
+        return false;
+    }
+    return true;
 }
 
 /*
  *  VpiParams Implementation
  */
 
+int MlxCfgOps::VpiParams::getDefaultParams(mfile* mf)
+{
+    struct tools_open_query_def_params_per_port port_params;
+    int rc = getDefaultParams4thGen(mf, _port , &port_params);
+    if (rc) {
+        return MCE_GET_DEFAULT_PARAMS;
+    }
+    _linkType = port_params.network_link_type;
+    return MCE_SUCCESS;
+}
 
 void MlxCfgOps::VpiParams::setParam(mlxCfgParam paramType, u_int32_t val)
 {
@@ -516,7 +645,7 @@ int MlxCfgOps::VpiParams::getFromDev(mfile* mf)
     }
     // unpack and update
     tools_open_vpi_settings_unpack(&vpiTlv, buff);
-    _linkType = _linkType == MLXCFG_UNKNOWN ? vpiTlv.network_link_type : _linkType ;
+    _linkType = vpiTlv.network_link_type;
     _updated = true;
 
     return MCE_SUCCESS;
@@ -524,12 +653,8 @@ int MlxCfgOps::VpiParams::getFromDev(mfile* mf)
 
 int MlxCfgOps::VpiParams::setOnDev(mfile* mf, bool ignoreCheck)
 {
-    int rc;
     if (_linkType == MLXCFG_UNKNOWN) {
-        rc = getFromDev(mf);
-        if (rc || _linkType == MLXCFG_UNKNOWN) {
-            return errmsg("%s please specify all the parameters for VPI settings.", err() ? err() : "");
-        }
+        return errmsg("%s please specify all the parameters for VPI settings.", err() ? err() : "");
     }
     if (!ignoreCheck && !isLegal()) {
         return MCE_BAD_PARAMS;
@@ -601,6 +726,7 @@ MlxCfgOps::MlxCfgOps()
     errmap[MCE_INCOMPLETE_PARAMS] = "Failed to get missing configuration from device, please specify all the needed parameters";
     errmap[MCE_OPEN_DEVICE] = "Failed to open device";
     errmap[MCE_PCICONF] = "Access to device should be through configuration cycles only.";
+    errmap[MCE_GET_DEFAULT_PARAMS] = "Failed to get default params";
     errmap[MCE_UNKNOWN_ERR] = "General Error";
 
     updateErrCodes(errmap);
@@ -637,7 +763,10 @@ int MlxCfgOps::supportsToolsHCR()
     u_int32_t devId;
     u_int32_t type = 0;
     int rc;
-    mread4(_mf, HW_ID_ADDR, &devId);
+
+    if (mread4(_mf, HW_ID_ADDR, &devId) != 4) {
+        return MCE_CR_ERROR;
+    }
     switch (devId & 0xffff) { // check hw device id
          case CX3_HW_ID : //Cx3
          case CX3_PRO_HW_ID : // Cx3-pro
@@ -653,7 +782,7 @@ int MlxCfgOps::supportsToolsHCR()
             }
         #endif
             // check if we support tools_hcr
-             rc = tools_cmdif_query_dev_cap(_mf, TOOL_CAP_BITS_ADDR, &_suppVec);
+             rc = tcif_query_dev_cap(_mf, TOOL_CAP_BITS_ADDR, &_suppVec);
              switch (rc) {
              case ME_OK:
                  return MCE_SUCCESS;
@@ -676,47 +805,43 @@ int MlxCfgOps::supportsToolsHCR()
 int MlxCfgOps::openComChk()
 {
     bool rc;
-    // check if we support Tools HCR
-    rc = supportsToolsHCR();
-    if (rc) {
-        return rc;
-    }
-    // update cfg specific info.
-    // TODO: change all configuration specific to updateInfo() as a virtual function in the base class and call that on all Cfg classes
-    // update max Vfs
-    if (supportsCfg(Mct_Sriov)) {
-        int rc = static_cast<SriovParams*>(_cfgList[Mct_Sriov])->updateMaxVfs(_mf);
-        if (rc) {
-            return rc;
-        }
-    }
+    int ret;
+    // check if we support Tools HCR and update _suppVec
+    rc = supportsToolsHCR(); CHECK_RC(rc);
 
-    // get max/current bar size
-    if (supportsCfg(Mct_Bar_Size)) {
-        int rc = static_cast<BarSzParams*>(_cfgList[Mct_Bar_Size])->updateBarSzInfo(_mf);
-        if (rc) {
-            return rc;
+    // update cfg specific info.
+    for (int i = Mct_Sriov; i < Mct_Last; i++) {
+        ret = _cfgList[i]->getDefaultParams(_mf);
+        if (ret && ret!= MCE_GET_DEFAULT_PARAMS) {
+            return ret;
         }
     }
     return MCE_SUCCESS;
 }
 
-int MlxCfgOps::open(const char* devStr)
+int MlxCfgOps::open(const char* devStr, bool forceClearSem)
 {
     _mf = mopen(devStr);
     if (_mf == NULL) {
         return errmsg(MCE_OPEN_DEVICE);
     }
 
-    return openComChk();
+    return opend(_mf , forceClearSem);
 }
 
-int MlxCfgOps::opend(mfile* mf)
+int MlxCfgOps::opend(mfile* mf, bool forceClearSem)
 {
     if (!mf) {
         return errmsg(MCE_BAD_PARAMS);
     }
     _mf = mf;
+
+    if (forceClearSem) {
+        int rc = tools_cmdif_unlock_semaphore(_mf);
+        if (rc) {
+            return errmsg("failed to unlock semaphore, %s.", m_err2str((MError)rc));
+        }
+    }
     return openComChk();
 }
 
@@ -725,9 +850,7 @@ bool MlxCfgOps::supportsCfg(mlxCfgType cfg)
     if (!isLegal(cfg)) {
         return false;
     }
-    if (cfg == Mct_Bar_Size) { // dont enable these just yet, no FW support
-        return false;
-    }
+
     return _suppVec & cfgSuppMask[cfg];
 }
 
@@ -768,8 +891,13 @@ int MlxCfgOps::setCfg(mlxCfgParam cfgParam, u_int32_t val, bool ignoreCheck)
     if (!isLegal(cfgParam)) {
         return MCE_BAD_PARAMS;
     }
+    // get parameters from device if present
+    int rc = _cfgList[cfgParam2Type(cfgParam)]->getFromDev(_mf);
+    if (rc) {
+        return errmsgConcatMsg(rc, *_cfgList[cfgParam2Type(cfgParam)]);
+    }
     _cfgList[cfgParam2Type(cfgParam)]->setParam(cfgParam, val);
-    int rc = _cfgList[cfgParam2Type(cfgParam)]->setOnDev(_mf, ignoreCheck);
+    rc = _cfgList[cfgParam2Type(cfgParam)]->setOnDev(_mf, ignoreCheck);
     if (rc) {
         return errmsgConcatMsg(rc, *_cfgList[cfgParam2Type(cfgParam)]);
     }
@@ -780,6 +908,7 @@ int MlxCfgOps::setCfg(const std::vector<cfgInfo>& infoVec, bool ignoreCheck)
 {
     // set params
     std::set<CfgParams*> CfgToSet;
+    int rc;
 
     for (std::vector<cfgInfo>::const_iterator it = infoVec.begin() ; it != infoVec.end(); it++) {
         if (!isLegal(it->first)) {
@@ -788,12 +917,17 @@ int MlxCfgOps::setCfg(const std::vector<cfgInfo>& infoVec, bool ignoreCheck)
         if (!supportsParam(it->first)) {
             return errmsg(MCE_UNSUPPORTED_CFG);
         }
+        // get configuration from device first (if preset) in case of multiple params per type
+        rc = _cfgList[cfgParam2Type(it->first)]->getFromDev(_mf);
+        if (rc) {
+            return errmsgConcatMsg(rc, *_cfgList[cfgParam2Type(it->first)]);
+        }
         _cfgList[cfgParam2Type(it->first)]->setParam(it->first, it->second);
         CfgToSet.insert(_cfgList[cfgParam2Type(it->first)]);
     }
     //set on device exit on first failure
     for (std::set<CfgParams*>::iterator it = CfgToSet.begin() ; it != CfgToSet.end(); it++) {
-        int rc = (*it)->setOnDev(_mf, ignoreCheck);
+        rc = (*it)->setOnDev(_mf, ignoreCheck);
         if (rc) {
             return errmsgConcatMsg(rc, (**it));
         }
index 8438b5e6094e84d22525d6d36d589c9ab6214cd5..f74a185419dc2a28f87f19f76377a05049750483 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 /*
  * mlxcfg_lib.h
@@ -82,8 +83,8 @@ class MlxCfgOps : public ErrMsg {
 public:
     MlxCfgOps();
     ~MlxCfgOps();
-    int open(const char* devStr);
-    int opend(mfile* mf);
+    int open(const char* devStr, bool forceClearSem=false);
+    int opend(mfile* mf, bool forceClearSem=false);
 
     // no need to close , this is done  in destructor
 
@@ -109,13 +110,19 @@ private:
         virtual void setParam(mlxCfgParam paramType, u_int32_t val) = 0;
         virtual u_int32_t getParam(mlxCfgParam paramType) = 0;
 
+        virtual int getDefaultAndFromDev(mfile* mf);
         virtual int getFromDev(mfile* mf) = 0;
         virtual int setOnDev(mfile* mf, bool ignoreCheck=false) = 0;
+        virtual int getDefaultParams(mfile* mf) = 0;
+
 
         mlxCfgType type;
         u_int32_t tlvType;
     protected:
         virtual bool isLegal(mfile* mf=NULL) = 0;
+        int getDefaultParams4thGen(mfile* mf, struct tools_open_query_def_params_global* global_params);
+        int getDefaultParams4thGen(mfile* mf, int port, struct tools_open_query_def_params_per_port* port_params);
+
         bool _updated; // set true on get and false on set
     };
 
@@ -130,11 +137,11 @@ private:
 
         virtual int getFromDev(mfile* mf);
         virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
-
-        int updateMaxVfs(mfile* mf);
+        virtual int getDefaultParams(mfile* mf);
 
     private:
         virtual bool isLegal(mfile* mf);
+        int updateMaxVfs(mfile* mf);
 
         u_int32_t _sriovEn;
         u_int32_t _numOfVfs;
@@ -152,6 +159,7 @@ private:
 
         virtual int getFromDev(mfile* mf);
         virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
+        virtual int getDefaultParams(mfile* mf);
 
     private:
         virtual bool isLegal(mfile* mf=NULL);
@@ -171,9 +179,11 @@ private:
 
         virtual int getFromDev(mfile* mf);
         virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
+        virtual int getDefaultParams(mfile* mf);
 
     private:
         virtual bool isLegal(mfile* mf=NULL);
+
         int _port;
         u_int32_t _linkType;
     };
@@ -181,7 +191,7 @@ private:
     class BarSzParams : public CfgParams
     {
     public:
-        BarSzParams() : CfgParams(Mct_Bar_Size, BAR_SIZE_TYPE) ,_maxLogBarSz(1), _currLogBarSz(1), _logBarSz(MLXCFG_UNKNOWN) {}
+        BarSzParams() : CfgParams(Mct_Bar_Size, BAR_SIZE_TYPE) ,_maxLogBarSz(1), _logBarSz(MLXCFG_UNKNOWN) {}
         ~BarSzParams() {};
 
         virtual void setParam(mlxCfgParam paramType, u_int32_t val);
@@ -189,13 +199,12 @@ private:
 
         virtual int getFromDev(mfile* mf);
         virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
-
-        int updateBarSzInfo(mfile* mf);
+        virtual int getDefaultParams(mfile* mf);
 
     private:
         virtual bool isLegal(mfile* mf=NULL);
+        int getDefaultBarSz(mfile* mf);
         u_int32_t _maxLogBarSz;
-        u_int32_t _currLogBarSz;
         u_int32_t _logBarSz;
 
     };
index d10c241328b3267465064795d6939852fd86cf3b..deda07fe8cd027bda0fbcdab0e09b9ed0b623eb0 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 #include <stdlib.h>
@@ -82,6 +83,7 @@ void MlxCfg::printHelp()
     printf(IDENT2"%-24s : %s\n","q[uery]", "query current supported configurations.");
     printf(IDENT2"%-24s : %s\n","s[et]", "set configurations to a specific device.");
     printf(IDENT2"%-24s : %s\n","r[eset]", "reset configurations to their default value.");
+    printf(IDENT2"%-24s : %s\n","clear_semaphore", "clear the tool semaphore.");
 
     // print supported commands
     printf("\n");
@@ -91,7 +93,7 @@ void MlxCfg::printHelp()
     printf(IDENT2"%-24s : %s\n","WOL_PORT2", "WOL_MAGIC_EN_P2=<1|0>");
     printf(IDENT2"%-24s : %s\n","VPI_SETTINGS_PORT1", "LINK_TYPE_P1=<1|2|3> , 1=Infiniband 2=Ethernet 3=VPI(auto-sense).");
     printf(IDENT2"%-24s : %s\n","VPI_SETTINGS_PORT2", "LINK_TYPE_P2=<1|2|3>");
-    //printf(IDENT2"%-24s : %s\n","BAR_SIZE", "LOG_BAR_SIZE=<Base_2_log_in_mb> , example: for 8Mb bar size set LOG_BAR_SIZE=3");
+    printf(IDENT2"%-24s : %s\n","BAR_SIZE", "LOG_BAR_SIZE=<Base_2_log_in_mb> , example: for 8Mb bar size set LOG_BAR_SIZE=3");
 
     // print usage examples
     printf("\n");
@@ -138,7 +140,7 @@ mlxCfgStatus MlxCfg::processArg(string tag, u_int32_t val)
         }
     }
     // we dont support BAR_SZ atm
-    if (i == Mcp_Last || i == Mcp_Log_Bar_Size) {
+    if (i == Mcp_Last) {
         return err(true, "Unknown Parameter: %s", tag.c_str());
     }
     return MLX_CFG_OK;
@@ -228,6 +230,10 @@ mlxCfgStatus MlxCfg::parseArgs(int argc, char* argv[])
         } else if (arg == "reset" || arg == "r") {
             _mlxParams.cmd = Mc_Reset;
             break;
+
+        } else if (arg == "clear_semaphore") {
+            _mlxParams.cmd = Mc_Clr_Sem;
+            break;
         // hidden flag --force used to ignore parameter checks
         } else if (arg == "--force"){
             _mlxParams.force = true;
@@ -246,8 +252,8 @@ mlxCfgStatus MlxCfg::parseArgs(int argc, char* argv[])
     if (i != argc && (_mlxParams.cmd == Mc_Reset || _mlxParams.cmd == Mc_Query)) {
         return err(true, "%s command expects no argument but %d argument recieved", (_mlxParams.cmd == Mc_Reset) ? "reset" : "query", argc -i);
     }
-    if (_mlxParams.cmd == Mc_Set && _mlxParams.device.length() == 0) {
-        return err(true, "set command expects device to be specified.");
+    if ((_mlxParams.cmd == Mc_Set || _mlxParams.cmd == Mc_Clr_Sem) && _mlxParams.device.length() == 0) {
+        return err(true, "%s command expects device to be specified.", _mlxParams.cmd == Mc_Set ? "set" : "clear_semaphore");
     }
 
     return extractCfgArgs(argc-i, &(argv[i]));
index 48a3e4e356401cbba9f0edcb1b0c79c65cb2e477..442a4a48c03b0440270672a7a78636f30acff180 100644 (file)
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
 #include <signal.h>
+#include <iostream>
 
 #include <tools_dev_types.h>
 
@@ -165,14 +167,12 @@ if (question == NULL) {
  if (_mlxParams.yes)
      printf("y\n");
  else {
-     char ansbuff[32];
-     ansbuff[0] = '\0';
      fflush(stdout);
-     int cnt=fscanf(stdin, "%30s", ansbuff);
-     (void)cnt; // avoid warnings
+     std::string answer;
+     std::getline(std::cin, answer);
 
-     if (  strcasecmp(ansbuff, "y") &&
-           strcasecmp(ansbuff, "yes"))  {
+     if (  strcasecmp(answer.c_str(), "y") &&
+           strcasecmp(answer.c_str(), "yes"))  {
 
          err(false, "Aborted by user.");
          return false;
@@ -293,9 +293,6 @@ mlxCfgStatus MlxCfg::queryDevCfg(const char* dev,const char* pci, int devIndex,
     printf("\n");
 
     for (int p = (int)Mcp_Sriov_En ; p < (int)Mcp_Last; ++p) {
-        if (p == Mcp_Log_Bar_Size) { // we dont support bar size atm
-            continue;
-        }
         if (!ops.supportsParam((mlxCfgParam)p)) {
             continue;
         }
@@ -421,6 +418,22 @@ mlxCfgStatus MlxCfg::resetDevsCfg()
     return MLX_CFG_OK;
 }
 
+mlxCfgStatus MlxCfg::clrDevSem()
+{
+    MlxCfgOps ops;
+    bool rc;
+
+    printf("-W- Forcefully clearing device Semaphore(47)...");
+
+    rc = ops.open(_mlxParams.device.c_str(), true);
+    if (rc) {
+        printf(" Failed!\n");
+        return err(true, "Failed to open device: %s. %s", _mlxParams.device.c_str(), ops.err());
+    }
+    printf(" Done!\n");
+    return MLX_CFG_OK;
+}
+
 mlxCfgStatus MlxCfg::resetDevCfg(const char* dev)
 {
     MlxCfgOps ops;
@@ -465,6 +478,9 @@ mlxCfgStatus MlxCfg::execute(int argc, char* argv[])
     case Mc_Reset:
         ret = resetDevsCfg();
         break;
+    case Mc_Clr_Sem:
+        ret = clrDevSem();
+        break;
     default:
         // should not reach here.
         return err(true, "invalid command.");
index 7a86eaa501ffc1aba2d7f3a1c837437817b2867d..b105425dc055813e79cec63573cd1774d547cb30 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 #ifndef MLXCFG_UI_H_
@@ -44,6 +45,7 @@ typedef enum {
     Mc_Set,
     Mc_Query,
     Mc_Reset,
+    Mc_Clr_Sem,
     Mc_UnknownCmd
 } mlxCfgCmd;
 
@@ -101,6 +103,8 @@ private:
     // reset Cmd
     mlxCfgStatus resetDevsCfg();
     mlxCfgStatus resetDevCfg(const char* dev);
+
+    mlxCfgStatus clrDevSem();
     //
     mlxCfgStatus test(const char* dev);
 
index 53ec8d6cecb29c10106ace5e3a67a7309924dc5c..8a5f82eb68d7855e5dd0ed7163c4def5f080063c 100755 (executable)
@@ -218,6 +218,7 @@ namespace std {}; using namespace std;
 #define FS_DATA_OFF      0x28
 #define SWITCHX_HW_ID    581
 #define SWITCH_IB_HW_ID  583
+#define SWITCH_EN_HW_ID  585
 
 #define CX4_HW_ID                521
 #define CX3_HW_ID         501
@@ -307,13 +308,15 @@ typedef enum fs3_section {
     FS3_UPGRADE_CODE  = 0x7,
     FS3_HW_BOOT_CFG   = 0x8,
     FS3_HW_MAIN_CFG   = 0x9,
+    FS3_PHY_UC_CODE   = 0xa,
+    FS3_PHY_UC_CONSTS = 0xb,
     FS3_IMAGE_INFO    = 0x10,
     FS3_FW_BOOT_CFG   = 0x11,
     FS3_FW_MAIN_CFG   = 0x12,
     FS3_ROM_CODE      = 0x18,
     FS3_RESET_INFO    = 0x20,
-    FS3_DBG_LOG_MAP   = 0x30,
-    FS3_DBG_FW_INI    = 0x31,
+    FS3_DBG_FW_INI    = 0x30,
+    // FS3_DBG_LOG_MAP = 0x30 - in practice its unused and DBG_FW_INI is found in that section instead
     FS3_DBG_FW_PARAMS = 0x32,
     FS3_FW_ADB        = 0x33,
     FS3_MFG_INFO      = 0xe0,
index af92954c0aa645a7562c91abbb1ccfc7e4823f49..c1d72c661faff3b2e047927b2d12f5ba32697d19 100755 (executable)
@@ -223,7 +223,7 @@ bool Flash::open_com_checks(const char *device, int rc, bool force_lock)
             return errmsgAdv(_advErrors, "Flash cache replacement is active.", "\n-E- Please use the -override_cache_replacement option in order to access the flash directly.");
         }
 
-        return errmsg("%s %s", errno == 0 ? "" : strerror(errno), mf_err2str(rc));
+        return errmsg("%s%s%s", errno == 0 ? "" : strerror(errno),  errno == 0 ? "" : ". ", mf_err2str(rc));
     }
 
     rc = mf_get_attr(_mfl, &_attr);
@@ -322,8 +322,6 @@ bool Flash::read(u_int32_t addr,
 bool Flash::read(u_int32_t addr, void *data, int len, bool verbose, const char* message)
 {
     int rc;
-    u_int32_t  perc = 0xffffffff;
-
     if (addr & 0x3) {
         return errmsg("Address should be 4-bytes aligned.");
     }
@@ -354,7 +352,9 @@ bool Flash::read(u_int32_t addr, void *data, int len, bool verbose, const char*
             }
         }
 
-    } else {
+    }
+    else {
+        u_int32_t  perc = 0xffffffff;
         u_int32_t *p = (u_int32_t *)data;
         for (int i=0; i<len/4; i++) {
             if (!read(addr, p++))
@@ -374,6 +374,7 @@ bool Flash::read(u_int32_t addr, void *data, int len, bool verbose, const char*
             }
         }
     }
+
     // Report
     if (verbose) {
         printf("\r%s%%100", message);
index e0235de94e8b7e7c5508406b9cb1a6a4b76f35c2..dfb1a4ec61f9a8477cec46efe4cdcfd6c31e698b 100755 (executable)
@@ -273,7 +273,7 @@ public:
     u_int32_t get_rev_id             ()  {return _attr.rev_id; }
     u_int32_t get_port_num           ()  {return _port_num;}
     u_int8_t  get_cr_space_locked    ()  {return _cr_space_locked;}
-    bool  get_ignore_cache_replacment()  {return _cr_space_locked;}
+    bool  get_ignore_cache_replacment()  {return _ignore_cache_replacement;}
 
     bool sw_reset();
 
index 24bc702fd30130b09871946e99f91ba7f3f12761..87021d9f9508e2d0a14d14d534ebf14913ec657f 100644 (file)
@@ -1467,12 +1467,11 @@ bool Fs2Operations::FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams& burnPa
 
 bool Fs2Operations::FwBurnBlock(FwOperations *imageOps, ProgressCallBack progressFunc)
 {
-    FImage *fim = (FImage*)((Fs2Operations*)imageOps)->_ioAccess;
-
     if (imageOps == NULL) {
         return errmsg("bad parameter is given to FwBurnBlock\n");
     }
 
+    FImage *fim = (FImage*)((Fs2Operations*)imageOps)->_ioAccess;
     return writeImage(progressFunc, 0, fim->getBuf(), fim->getBufLength());
 }
 
index c103e6ea7ac01754d4726046c5e48eb2d08cdcba..c5c03f9e1c78619a6596f83067316954957a526e 100644 (file)
@@ -35,6 +35,7 @@
 #include <algorithm>
 #include <vector>
 
+#include <tools_utils.h>
 #include <mtcr.h>
 #include <reg_access/reg_access.h>
 
@@ -63,15 +64,16 @@ const Fs3Operations::SectionInfo Fs3Operations::_fs3SectionsInfoArr[] = {
     {FS3_PCIE_LINK_CODE, "PCIE_LINK_CODE"},
     {FS3_IRON_PREP_CODE, "IRON_PREP_CODE"},
     {FS3_POST_IRON_BOOT_CODE, "POST_IRON_BOOT_CODE"},
-    {FS3_UPGRADE_CODE, "FS3_UPGRADE_CODE"},
+    {FS3_UPGRADE_CODE,  "UPGRADE_CODE"},
     {FS3_HW_BOOT_CFG,   "HW_BOOT_CFG"},
     {FS3_HW_MAIN_CFG,   "HW_MAIN_CFG"},
+    {FS3_PHY_UC_CODE,   "PHY_UC_CODE"},
+    {FS3_PHY_UC_CONSTS, "PHY_UC_CONSTS"},
     {FS3_IMAGE_INFO,    "IMAGE_INFO"},
     {FS3_FW_BOOT_CFG,   "FW_BOOT_CFG"},
     {FS3_FW_MAIN_CFG,   "FW_MAIN_CFG"},
     {FS3_ROM_CODE,      "ROM_CODE"},
     {FS3_RESET_INFO,    "FS3_RESET_INFO"},
-    {FS3_DBG_LOG_MAP,   "DBG_LOG_MAP"},
     {FS3_DBG_FW_INI,    "DBG_FW_INI"},
     {FS3_DBG_FW_PARAMS, "DBG_FW_PARAMS"},
     {FS3_FW_ADB,        "FW_ADB"},
@@ -270,7 +272,6 @@ bool Fs3Operations::VerifyTOC(u_int32_t dtoc_addr, bool& bad_signature, VerifyCa
     u_int8_t buffer[TOC_HEADER_SIZE], entry_buffer[TOC_ENTRY_SIZE];
     struct cibfw_itoc_header itoc_header;
     bool ret_val = true, mfg_exists = false;
-    u_int8_t toc_type = FS3_ITOC;
     u_int32_t phys_addr;
     bad_signature = false;
 
@@ -281,14 +282,14 @@ bool Fs3Operations::VerifyTOC(u_int32_t dtoc_addr, bool& bad_signature, VerifyCa
     cibfw_itoc_header_unpack(&itoc_header, buffer);
     memcpy(_fs3ImgInfo.itocHeader, buffer, CIBFW_ITOC_HEADER_SIZE);
     // cibfw_itoc_header_dump(&itoc_header, stdout);
-    u_int32_t first_signature = (toc_type == FS3_ITOC) ? ITOC_ASCII : DTOC_ASCII;
+    u_int32_t first_signature =  ITOC_ASCII;
     if (!CheckTocSignature(&itoc_header, first_signature)) {
         bad_signature = true;
         return false;
     }
     u_int32_t toc_crc = CalcImageCRC((u_int32_t*)buffer, (TOC_HEADER_SIZE / 4) - 1);
     phys_addr = _ioAccess->get_phys_from_cont(dtoc_addr, _fwImgInfo.cntxLog2ChunkSize, _fwImgInfo.imgStart != 0);
-    if (!DumpFs3CRCCheck(toc_type, phys_addr, TOC_HEADER_SIZE, toc_crc, itoc_header.itoc_entry_crc,false,verifyCallBackFunc)) {
+    if (!DumpFs3CRCCheck(FS3_ITOC, phys_addr, TOC_HEADER_SIZE, toc_crc, itoc_header.itoc_entry_crc,false,verifyCallBackFunc)) {
         ret_val = false;
     }
     _fs3ImgInfo.itocAddr = dtoc_addr;
@@ -363,7 +364,7 @@ bool Fs3Operations::VerifyTOC(u_int32_t dtoc_addr, bool& bad_signature, VerifyCa
                                      ret_val = false;
                                      errmsg("Failed to get info from section %d", toc_entry.type);
                                  }
-                            } else if (toc_entry.type == FS3_DBG_LOG_MAP) {
+                            } else if (toc_entry.type == FS3_DBG_FW_INI) {
                                  TOCPUn(buff, toc_entry.size);
                                  GetSectData(_fwConfSect, (u_int32_t*)buff, toc_entry.size * 4);
                             }
@@ -417,7 +418,7 @@ bool Fs3Operations::Fs3Verify(VerifyCallBack verifyCallBackFunc, bool show_itoc,
         return errmsg("No valid FS3 image found");
     }
     if (cntx_image_num > 1) { // ATM we support only one valid image
-        return errmsg("More than one FS3 image found");
+        return errmsg("More than one FS3 image found on %s", this->_ioAccess->is_flash() ? "Device" : "image");
     }
     u_int32_t image_start = cntx_image_start[0];
     offset = 0;
@@ -476,12 +477,14 @@ bool Fs3Operations::Fs3IntQuery(bool readRom, bool quickQuery)
     if (!Fs3Verify((VerifyCallBack)NULL, 0, queryOptions)) {
         return false;
     }
-    // works only on device
-    _fwImgInfo.ext_info.chip_type = getChipTypeFromHwDevid(_ioAccess->get_dev_id());
-    if (_fwImgInfo.ext_info.chip_type == CT_CONNECT_IB) {
-        _fwImgInfo.ext_info.dev_type = CONNECT_IB_SW_ID;
+    // get chip type and device sw id, works only on device
+    if (_ioAccess->is_flash()) {
+        const u_int32_t* swId;
+        if (!getInfoFromHwDevid(_ioAccess->get_dev_id(), _fwImgInfo.ext_info.chip_type, &swId)) {
+            return false;
+        }
+        _fwImgInfo.ext_info.dev_type = swId[0];
     }
-
     return true;
 }
 
@@ -629,8 +632,11 @@ bool Fs3Operations::BurnFs3Image(Fs3Operations &imageOps,
         return errmsg("Failed to burn FW. Device data sections will be overridden by the operation.");
     }
 
+    if ( last_img_data_addr <= 16) {
+        return errmsg("Failed to burn FW. Internal error.");
+    }
+
     u_int32_t  zeroes     = 0;
-    int allow_nofs = 0;
     // write the image without the device data sections
     if (!writeImage(burnParams.progressFunc, 16 , data8 + 16, last_img_data_addr - 16)) {
         return false;
@@ -652,7 +658,8 @@ bool Fs3Operations::BurnFs3Image(Fs3Operations &imageOps,
 
     // if we access without cache replacement or the burn was non failsafe, update YU bootloaders.
     // if we access with cache replacement notify currently running fw of new image start address to crspace (for SW reset)
-    if (!burnParams.burnFailsafe || f->get_ignore_cache_replacment()) {
+    //TODO: add SwitchIB, SwitchEN and ConnectX4 when we have support for ISFU
+    if (_fwImgInfo.ext_info.chip_type != CT_CONNECT_IB || !burnParams.burnFailsafe || f->get_ignore_cache_replacment()) {
         boot_address_was_updated = f->update_boot_addr(new_image_start);
     } else {
         _isfuSupported = Fs3IsfuActivateImage(new_image_start);
@@ -660,7 +667,7 @@ bool Fs3Operations::BurnFs3Image(Fs3Operations &imageOps,
     }
 
     if (imageOps._fwImgInfo.ext_info.is_failsafe) {
-        if (allow_nofs) {
+        if (!burnParams.burnFailsafe) {
             // When burning in nofs, remnant of older image with different chunk size
             // may reside on the flash -
             // Invalidate all images marking on flash except the one we've just burnt
@@ -673,7 +680,7 @@ bool Fs3Operations::BurnFs3Image(Fs3Operations &imageOps,
             for (u_int32_t i = 0; i < cntx_image_num; i++) {
                 if (cntx_image_start[i] != new_image_start) {
                     if (!f->write(cntx_image_start[i], &zeroes, sizeof(zeroes), true)) {
-                        return false;
+                        return errmsg("Failed to invalidate old fw signature: %s", f->err());
                     }
                 }
             }
@@ -681,7 +688,7 @@ bool Fs3Operations::BurnFs3Image(Fs3Operations &imageOps,
             // invalidate previous signature
             f->set_address_convertor(imageOps._fwImgInfo.cntxLog2ChunkSize, is_curr_image_in_odd_chunks);
             if (!f->write(0, &zeroes, sizeof(zeroes), true)) {
-                return false;
+                return errmsg("Failed to invalidate old fw signature: %s", f->err());
             }
         }
     }
@@ -702,6 +709,9 @@ bool Fs3Operations::Fs3Burn(Fs3Operations &imageOps, ExtBurnParams& burnParams)
         return false;
     }
 
+    if (!burnParams.burnFailsafe && _ioAccess->is_flash() && !((Flash*)_ioAccess)->get_ignore_cache_replacment()) {
+        return errmsg("cache replacement is active, cannot burn in a non fail-safe manner.");
+    }
     // Check Matching device ID
 #ifndef UEFI_BUILD // NO Device ID here..
     if (!burnParams.noDevidCheck && _ioAccess->is_flash()) {
@@ -889,13 +899,12 @@ bool Fs3Operations::FwReadRom(std::vector<u_int8_t>& romSect)
 bool Fs3Operations::FwGetSection (u_int32_t sectType, std::vector<u_int8_t>& sectInfo, bool stripedImage)
 {
     (void) stripedImage; // unused for FS3
-    //we treat H_FW_CONF as FS3_DBG_LOG_MAP
-    //FwGetSection only supports retrieving FS3_DBG_LOG_MAP section atm.
-    if (sectType != H_FW_CONF && sectType != FS3_DBG_LOG_MAP) {
-        return errmsg("Hash File section not found in the given image.");
+    //FwGetSection only supports retrieving FS3_DBG_FW_INI section atm.
+    if (sectType != FS3_DBG_FW_INI) {
+        return errmsg("Unsupported section type.");
     }
     //set the sector to read (need to remove it after read)
-    _readSectList.push_back(FS3_DBG_LOG_MAP);
+    _readSectList.push_back(sectType);
     if (!Fs3IntQuery()) {
         _readSectList.pop_back();
         return false;
@@ -1026,7 +1035,9 @@ bool Fs3Operations::UpdateItocAfterInsert(fs3_section_t sectionType, u_int32_t n
         if (isReplacement) {
             struct toc_info *curr_itoc;
             u_int32_t sectSize;
-            Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, sectionType, curr_itoc);
+            if (!Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, sectionType, curr_itoc)) {
+                return false;
+            }
             sectSize = curr_itoc->toc_entry.size * 4;
             shiftSize = (removedOrNewSectSize > sectSize) ? removedOrNewSectSize - sectSize : 0;
         } else {
@@ -1284,7 +1295,8 @@ bool Fs3Operations::Fs3UpdateVsdSection(struct toc_info *curr_toc, std::vector<u
 {
     struct cibfw_device_info dev_info;
     cibfw_device_info_unpack(&dev_info, (u_int8_t*)&section_data[0]);
-    strcpy(dev_info.vsd, user_vsd);
+    memset(dev_info.vsd, 0, sizeof(dev_info.vsd));
+    strncpy(dev_info.vsd, user_vsd, TOOLS_ARR_SZ(dev_info.vsd) - 1);
     newSectionData = section_data;
     memset((u_int8_t*)&newSectionData[0], 0, curr_toc->toc_entry.size * 4);
     cibfw_device_info_pack(&dev_info, (u_int8_t*)&newSectionData[0]);
@@ -1294,7 +1306,7 @@ bool Fs3Operations::Fs3UpdateVsdSection(struct toc_info *curr_toc, std::vector<u
 bool Fs3Operations::Fs3UpdateVpdSection(struct toc_info *curr_toc, char *vpd,
                                std::vector<u_int8_t>  &newSectionData)
 {
-    int vpd_size;
+    int vpd_size = 0;
     u_int8_t *vpd_data = NULL;
 
     if (!ReadImageFile(vpd, vpd_data, vpd_size)) {
@@ -1310,9 +1322,6 @@ bool Fs3Operations::Fs3UpdateVpdSection(struct toc_info *curr_toc, char *vpd,
     return true;
 }
 
-// DEV_INFO section is failsafe
-#define DEV_INFO_ADDR_1 0x3fd000
-#define DEV_INFO_ADDR_2 0x3fe000
 // all device data section might be shifted by SHIFT_SIZE due to
 // flash with write protect sector 0f 64kb instead of 4kb
 #define SHIFT_SIZE 0xf000 // 60kb
@@ -1320,18 +1329,32 @@ bool Fs3Operations::Fs3UpdateVpdSection(struct toc_info *curr_toc, char *vpd,
 
 bool Fs3Operations::Fs3GetNewSectionAddr(struct toc_info *curr_toc, u_int32_t &NewSectionAddr, bool failsafe_section)
 {
-    // printf("-D- addr  = %#x\n", curr_toc->toc_entry.flash_addr);
-    //u_int32_t sector_size = (_ioAccess->is_flash()) ? _ioAccess->get_sector_size() : FS3_DEFAULT_SECTOR_SIZE;
-
     u_int32_t flash_addr = curr_toc->toc_entry.flash_addr << 2;
+
     // HACK: THIS IS AN UGLY HACK, SHOULD BE REMOVED ASAP
     // Possible solution : if a section is failsafe  make its size 2kb thus both section will fit in a 4kb chunk (addr & 0x800 == 0x800 then its in second place, if == 0 its in first place )
-    if (failsafe_section) {
-       if ((flash_addr == DEV_INFO_ADDR_1) || (flash_addr == DEV_INFO_ADDR_2)){
-               NewSectionAddr = (flash_addr == DEV_INFO_ADDR_1) ? DEV_INFO_ADDR_2 : DEV_INFO_ADDR_1;
-       } else {// dev sections are shifted by 60 kb
-               NewSectionAddr = (flash_addr == DEV_INFO_ADDR_1 - SHIFT_SIZE) ? DEV_INFO_ADDR_2 - SHIFT_SIZE: DEV_INFO_ADDR_1 - SHIFT_SIZE;
-       }
+
+    if (failsafe_section) {// we assume dev_info is the only FS section.
+        // get the two dev_info addresses (section is failsafe) according to the location of the mfg section
+        toc_info* toc;
+        u_int32_t devInfoAddr1 = 0;
+        u_int32_t devInfoAddr2 = 0;
+
+        if (!Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, FS3_MFG_INFO, toc)) {
+                 return errmsg("failed to locate MFG_INFO address within the FW image");
+             }
+        // calculate device info sections (fs section) address according to the MFG section
+        // (i.e we assume they are located in: mfg_addr - 4k and mfg_addr - 8k)
+        devInfoAddr1 = (toc->toc_entry.flash_addr << 2) - 0x1000;
+        devInfoAddr2 = (toc->toc_entry.flash_addr << 2) - 0x2000;
+        //printf("-D-mfg_section: 0x%x devInfoAddr1: 0x%x devInfoAddr2: 0x%x\n", toc->toc_entry.flash_addr, devInfoAddr1, devInfoAddr2);
+
+        if ((flash_addr == devInfoAddr1) || (flash_addr == devInfoAddr2)){
+            NewSectionAddr = (flash_addr == devInfoAddr1) ? devInfoAddr2 : devInfoAddr1;
+        } else {
+            // FW image is a mess
+            return errmsg("DEV_INFO section is located in an unexpected address(0x%x)", flash_addr);
+        }
     } else {
         NewSectionAddr = flash_addr;
     }
@@ -1651,6 +1674,10 @@ bool Fs3Operations::FwShiftDevData(PrintCallBack progressFunc)
     }
     POP_DEV_DATA(_readSectList);
 
+    if (_fwImgInfo.ext_info.chip_type != CT_CONNECT_IB) {
+        return errmsg("Cannot shift device data. Unsupported device.");
+    }
+
        u_int32_t lastFwDataAddr;
        u_int32_t firstDevDataAddr;
        if (!getLastFwSAddr(lastFwDataAddr) || !getFirstDevDataAddr(firstDevDataAddr)) {
index 5639db429a4a9fcc5ec903d30185f7af8f462cf9..36b811dbdbfee53398336cb5b46111148779cb47 100644 (file)
@@ -77,7 +77,7 @@ private:
     #define CRC_CHECK_OUTPUT  CRC_CHECK_OLD")"
     #define FS3_CRC_CHECK_OUT CRC_CHECK_OLD":0x%x)"
     #define PRE_CRC_OUTPUT   "    "
-    #define MAX_TOCS_NUM         128
+    #define MAX_TOCS_NUM         64
     #define FS3_DEFAULT_SECTOR_SIZE 0x1000
     #define ITOC_ASCII 0x49544f43
     #define DTOC_ASCII 0x64544f43
index 4c16f2a9f625e9e8d0c3e321bf136333e6a5c131..51d988431f852a7a27f08c1e627833ea37c8cabc 100644 (file)
@@ -469,8 +469,9 @@ u_int8_t FwOperations::CheckFwFormat(FBase& f, bool getFwFormatFromImg) {
                 ( ((Flash*)&f)->get_dev_id() == CX3_PRO_HW_ID)) {
             return FS_FS2_GEN;
         } else if ( (((Flash*)&f)->get_dev_id() == CONNECT_IB_HW_ID) ||
-                    (((Flash*)&f)->get_dev_id() == SWITCH_IB_HW_ID) ||
-                   (((Flash*)&f)->get_dev_id() == CX4_HW_ID)) {
+                    (((Flash*)&f)->get_dev_id() == SWITCH_IB_HW_ID)  ||
+                    (((Flash*)&f)->get_dev_id() == CX4_HW_ID)        ||
+                    (((Flash*)&f)->get_dev_id() == SWITCH_EN_HW_ID)) {
             return FS_FS3_GEN;
         }
     } else {
@@ -670,11 +671,13 @@ bool FwOperations::CheckMac(u_int64_t mac) {
 void FwOperations::recalcSectionCrc(u_int8_t *buf, u_int32_t data_size) {
 
     Crc16              crc;
+    u_int32_t crcRes;
     for (u_int32_t i = 0; i < data_size; i += 4) {
         crc << __be32_to_cpu(*(u_int32_t*)(buf + i));
     }
     crc.finish();
-    *((u_int32_t*)(buf + data_size)) = __cpu_to_be32(crc.get());
+    crcRes = crc.get();
+    *((u_int32_t*)(buf + data_size)) = __cpu_to_be32(crcRes);
 }
 
 chip_type_t FwOperations::getChipType() {
@@ -692,15 +695,17 @@ chip_type_t FwOperations::getChipType() {
     return CT_UNKNOWN;
 }
 
-chip_type_t FwOperations::getChipTypeFromHwDevid(u_int32_t hwDevId) {
+bool FwOperations::getInfoFromHwDevid(u_int32_t hwDevId, chip_type_t& chipT, const u_int32_t ** swIds) {
     int i = 0;
     while (hwDevData[i].name != NULL) {
         if (hwDevData[i].hwDevId == hwDevId) {
-            return hwDevData[i].chipType;
+            chipT = hwDevData[i].chipType;
+            *swIds = hwDevData[i].swDevIds;
+            return true;
         }
             i++;
-        }
-    return CT_UNKNOWN;
+    }
+    return errmsg("Failed to identify device ID(MT%d).", hwDevId);
 }
 
 // TODO:combine both databases(hwDevData and hwDev2Str) and remove old unsupporded devices i.e infinihost infinihost_iii_ex infinihost_iii_lx
@@ -725,6 +730,7 @@ const FwOperations::HwDevData FwOperations::hwDevData[] = {
     { "SwitchX",          SWITCHX_HW_ID, CT_SWITCHX, 0, {51000, 0}},
     { "Switch_IB",        SWITCH_IB_HW_ID, CT_SWITCH_IB,0, {52000, 0}},
     { "ConnectX-4",              CX4_HW_ID,     CT_CONNECTX,   0, {4115, 0}},
+    { "Switch_EN",        SWITCH_EN_HW_ID,CT_SWITCH_EN,   0, {52100, 0}},
     { (char*)NULL ,              0, CT_UNKNOWN, 0, {0}},// zero devid terminator
 };
 
@@ -746,6 +752,7 @@ const FwOperations::HwDev2Str FwOperations::hwDev2Str[] = {
         {"InfiniHost III Lx", INFINIHOST_III_LX_HW_ID,      0xA0},
         {"InfiniHost III Ex", INFINIHOST_III_EX_HW_ID,      0xA0},
         {"SwitchIB A0",       SWITCH_IB_HW_ID,  0x00},
+        {"SwitchEN A0",       SWITCH_EN_HW_ID,  0x00},
         { (char*)NULL ,       (u_int32_t)0, (u_int8_t)0x00}, // zero device ID terminator
 };
 
@@ -1277,10 +1284,13 @@ bool FwOperations::ReadImageFile(const char *fimage, u_int8_t *&file_data, int &
     }
     rewind(fh);
 
-    if (min_size > read_file_size) {
-        file_size = min_size;
-    } else {
-        file_size = read_file_size;
+    file_size = read_file_size;
+    if (min_size != -1) {// take min of min_size and read_file_size
+        if (min_size < 0) {
+            fclose(fh);
+            return errmsg("Internal error, minimal image read size cannot be negative.");
+        }
+        file_size = ( min_size > read_file_size ) ? min_size : read_file_size;
     }
 
     file_data = new u_int8_t[file_size];
@@ -1339,7 +1349,7 @@ bool FwOperations::checkMatchingExpRomDevId(const fw_info_t& info)
 }
 
 
-bool FwOperations::checkMatchingExpRomDevId(u_int16_t dev_type, roms_info_t roms_info)
+bool FwOperations::checkMatchingExpRomDevId(u_int16_t dev_type, const roms_info_t& roms_info)
 {
     if ((roms_info.num_of_exp_rom > 0) && (dev_type)
             && (roms_info.exp_rom_com_devid != EXP_ROM_GEN_DEVID) \
index a91b80855b7cd728029dbf4f16a3e8a54ce7bc31..1b7f9f98ba88f0958a47d11ebfe9b042ff65d6c7 100644 (file)
@@ -74,7 +74,7 @@ public:
     static bool CntxEthOnly(u_int32_t devid);
     static void SetDevFlags(chip_type_t chipType, u_int32_t devType, fw_img_type_t fwType, bool &ibDev, bool &ethDev);
     static bool checkMatchingExpRomDevId(const fw_info_t& info);
-    static bool checkMatchingExpRomDevId(u_int16_t dev_type, roms_info_t roms_info);
+    static bool checkMatchingExpRomDevId(u_int16_t dev_type, const roms_info_t& roms_info);
     static const char* expRomType2Str(u_int16_t type);
 
 
@@ -320,7 +320,7 @@ protected:
     bool CheckFwVersion(FwOperations &imgFwOps, u_int8_t forceVersion);
     bool CheckPSID(FwOperations &imageOps, u_int8_t allow_psid_change = false);
     chip_type_t getChipType();
-    chip_type_t getChipTypeFromHwDevid(u_int32_t hwDevId);
+    bool getInfoFromHwDevid(u_int32_t hwDevId, chip_type_t& chipT, const u_int32_t** swIds);
 
     bool ReadImageFile(const char *fimage, u_int8_t *&file_data, int &file_size, int min_size=-1); // min_size=-1 like int flint_ops needed for fs3updateSection
     bool ModifyImageFile(const char *fimage, u_int32_t addr, void *data, int cnt);
index 67c1941994a6543ae27c419bfea611a360cb7e01..494fb9f60cf863012a6b4eaee1aa9c169a92819a 100644 (file)
@@ -118,7 +118,8 @@ typedef enum chip_type {
     CT_BRIDGEX,
     CT_IS4,
     CT_CONNECT_IB,
-    CT_SWITCH_IB
+    CT_SWITCH_IB,
+    CT_SWITCH_EN
 }chip_type_t;
 
 typedef struct guid {
index de6cdea43a8cdd07ddba4f92e6b55922c0ffdcbc..9222dc27fe2e1af83445ced0e8d6ba4d90925e77 100644 (file)
@@ -37,6 +37,7 @@ lib_LIBRARIES = libmtcr_ul.a
 
 libmtcr_ul_a_SOURCES = mtcr_ul.c mtcr_ib.h  mtcr_int_defs.h\
                        mtcr_tools_cif.c mtcr_tools_cif.h\
+                       mtcr_icmd_cif.c mtcr_icmd_cif.h\
                        packets_common.c packets_common.h\
                        packets_layout.c packets_layout.h
 libmtcr_ul_a_CFLAGS = -W -Wall -g -MP -MD -fPIC -DMTCR_API="" -DMST_UL
index 2a3632791954502ba97130aa8eb392a0d0f42da8..0ead95d6d7e1e1ed22cb296d3b2987b73fba9d51 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 /*
index e99fc352a933ad56913db301c2122e851c243e73..f917772870c772c349850a5eef049e6642a8b7f4 100644 (file)
  *
  */
 
+/********************************************************
+**
+*   ibvsmad.c
+*
+*   the ibvsmad library.
+*   this library provides vendor specific mad capabilities.
+*
+*   mread64, mwrite64 - IS3 I2C bus access MAD - ExtPortAccess -> I2C compliant port #1
+*   mread4 , mwrite4  - IS3 CR-Space access MAD - ConfigSpaceAccess
+*
+*
+*   author: yoniy@mellanox.co.il , Apr. 16th 2007
+*/
+
+
+
 #if HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -244,7 +260,7 @@ static int verbose = 0;
 
 #define IB_SMP_ATTR_CR_ACCESS 0xff50
 #define IB_DATA_INDEX     8
-#define MAX_IB_SMP_DATA_SIZE    IB_SMP_DATA_SIZE - IB_DATA_INDEX
+#define MAX_IB_SMP_DATA_SIZE    (IB_SMP_DATA_SIZE - IB_DATA_INDEX)
 #define MAX_IB_SMP_DATA_DW_NUM  MAX_IB_SMP_DATA_SIZE / 4
 
 static uint64_t
@@ -298,13 +314,13 @@ ibvsmad_craccess_rw_smp(ibvs_mad *h, u_int32_t memory_address, int method, u_int
 }
 
 // TODO: Correct this value.
-#define  MAX_VS_DATA_SIZE IB_VENDOR_RANGE2_DATA_SIZE -  IB_DATA_INDEX
+#define  MAX_VS_DATA_SIZE (IB_VENDOR_RANGE1_DATA_SIZE -  IB_DATA_INDEX)
 #define  MAX_IB_VS_DATA_DW_NUM  MAX_VS_DATA_SIZE / 4
 
 static uint64_t
 ibvsmad_craccess_rw_vs(ibvs_mad *h, u_int32_t memory_address, int method, u_int8_t num_of_dwords, u_int32_t *data)
 {
-    u_int8_t vsmad_data[IB_VENDOR_RANGE2_DATA_SIZE] = {0};
+    u_int8_t vsmad_data[IB_VENDOR_RANGE1_DATA_SIZE] = {0};
     ib_vendor_call_t call;
     int i;
     u_int8_t* p;
@@ -745,7 +761,7 @@ int mib_get_chunk_size(mfile *mf)
     if (h->use_smp) {
         return MAX_IB_SMP_DATA_SIZE;
     }
-    return IB_VENDOR_RANGE2_DATA_SIZE;
+    return MAX_VS_DATA_SIZE;
 }
 
 /********************************************************
@@ -847,7 +863,7 @@ mib_swreset(mfile *mf)
     char* swreset_env;
     ibvs_mad* h = (ibvs_mad*)(mf->ctx);
     u_int8_t* p;
-    u_int8_t vsmad_data[IB_VENDOR_RANGE2_DATA_SIZE] = {0};
+    u_int8_t vsmad_data[IB_VENDOR_RANGE1_DATA_SIZE] = {0};
     ib_vendor_call_t call;
 
     swreset_env = getenv(MTCR_SWRESET_ENV);
index 0599b350f77e5cadef413a1dfd92381b682b0cb5..cdb7aa88f81cc1ce8624b8657bc9fcd3ff68340c 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 #ifndef MTCR_INT_DEFS
index 8d58ab23feb46e5299917b3fc1c2095b68ace50e..516eab8ab7bdeb0d228b1fc51afbb09b1a074b6e 100644 (file)
@@ -1,17 +1,36 @@
-
 /*
-               - Mellanox Confidential and Proprietary -
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
  *
- *  Copyright (C) Jan 2013, Mellanox Technologies Ltd.  ALL RIGHTS RESERVED.
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
  *
- *  Except as specifically permitted herein, no portion of the information,
- *  including but not limited to object code and source code, may be reproduced,
- *  modified, distributed, republished or otherwise exploited in any form or by
- *  any means for any purpose without the prior written permission of Mellanox
- *  Technologies Ltd. Use of software subject to the terms and conditions
- *  detailed in the file "LICENSE.txt".
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  *
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -27,7 +46,6 @@
 #define TOOLS_HCR_SEM          0xf03bc // sem47
 #define TOOLS_SEM_TRIES                1024     // Number of tries to obtain a TOOLS sem.
 
-#define QUERY_DEV_CAP_OP       0x3
 #define MBOX_WRITE_OP          0x70
 #define MBOX_READ_OP           0x71
 #define REG_ACCESS_OP          0x3b
@@ -83,6 +101,28 @@ typedef struct tools_cmdif_t {
     u_int8_t  status;
 } tools_cmdif;
 
+
+static int translate_status(int status) {
+    switch (status) {
+    case 0x0:
+        return ME_OK;
+    case 0x1:
+        return ME_CMDIF_BUSY;
+    case 0x2:
+        return ME_CMDIF_BAD_OP;
+    case 0x3:
+        return ME_CMDIF_UNKN_TLV;
+    case 0x4:
+        return ME_CMDIF_BAD_SYS;
+    case 0x9:
+        return ME_CMDIF_RES_STATE;
+    default:
+        //printf("-D- Unknown status: 0x%x\n", status);
+        return ME_CMDIF_UNKN_STATUS;
+    }
+}
+
+
 static void tools_cmdif_pack(tools_cmdif* cmd, u_int32_t* buf) {
     memset((char*)buf, 0, CMD_IF_SIZE);
     buf[0] = EXTRACT64(cmd->in_param, 32, 32);
@@ -130,6 +170,10 @@ static int tools_cmdif_flash_lock(mfile* mf, int lock_state) {
     return ME_OK;
 }
 
+int tools_cmdif_unlock_semaphore(mfile *mf) {
+    return tools_cmdif_flash_lock(mf, 0);
+}
+
 static int tools_cmdif_wait_go(mfile* mf, int* retries)
 {
     int i;
@@ -197,15 +241,14 @@ static int tools_cmdif_send_cmd_int(mfile* mf, tools_cmdif* cmd)
     return ME_OK;
 }
 
-int tools_cmdif_send_cmd(mfile* mf,
+int tools_cmdif_send_inline_cmd(mfile* mf,
                                         u_int64_t in_param,
                                         u_int64_t* out_param,
                                         u_int32_t input_modifier,
                                         u_int16_t opcode,
-                                        u_int8_t  opcode_modifier,
-                                        u_int8_t*  status)
+                                        u_int8_t  opcode_modifier)
 {
-       if (!mf || !out_param || !status) {
+       if (!mf || !out_param) {
                return ME_BAD_PARAMS;
        }
        tools_cmdif cmdif;
@@ -222,29 +265,14 @@ int tools_cmdif_send_cmd(mfile* mf,
        int rc = tools_cmdif_send_cmd_int(mf, &cmdif);
        // release it
        tools_cmdif_flash_lock(mf, 0);
+
        *out_param = cmdif.out_param;
-       *status = cmdif.status;
+    if (rc || cmdif.status) {
+        return (rc != ME_CMDIF_BAD_STATUS) ? rc : translate_status(cmdif.status);
+    }
        return rc;
 }
 
-static int translate_status(int status) {
-       switch (status) {
-       case 0x0:
-               return ME_OK;
-       case 0x1:
-           return ME_CMDIF_BUSY;
-       case 0x2:
-               return ME_CMDIF_BAD_OP;
-       case 0x3:
-           return ME_CMDIF_UNKN_TLV;
-       case 0x4:
-               return ME_CMDIF_BAD_SYS;
-       default:
-           //fprintf(stderr, "-D- Unknown status: 0x%x\n", status);
-               return ME_CMDIF_BAD_STATUS;
-       }
-}
-
 static int tools_cmdif_mbox_read(mfile* mf, u_int32_t offset, u_int64_t* output)
 {
        if (!mf || (offset & 0x1) != 0 || !output) {// offset should be quad word alligned (i.e only even dwords)
@@ -260,7 +288,7 @@ static int tools_cmdif_mbox_read(mfile* mf, u_int32_t offset, u_int64_t* output)
        *output = cmdif.out_param;
        //printf("-D- outparam: 0x%lx\n", cmdif.out_param);
        if (rc || cmdif.status) {
-               return rc ? rc : translate_status(cmdif.status);
+               return (rc != ME_CMDIF_BAD_STATUS) ? rc : translate_status(cmdif.status);
        }
        //printf("-D- mbox read OK\n");
        return ME_OK;
@@ -280,144 +308,174 @@ static int tools_cmdif_mbox_write(mfile* mf, u_int32_t offset, u_int64_t input)
        int rc = tools_cmdif_send_cmd_int(mf, &cmdif);
 
        if (rc || cmdif.status) {
-               return rc ? rc : translate_status(cmdif.status);
+               return (rc != ME_CMDIF_BAD_STATUS) ? rc : translate_status(cmdif.status);
        }
        return ME_OK;
 }
 
-int tools_cmdif_query_dev_cap(mfile *mf, u_int32_t offset, u_int64_t* data)
+int tools_cmdif_is_supported(mfile *mf)
 {
-       if (!mf || offset > (TOOLS_HCR_MAX_MBOX - 8)) {
-               return ME_BAD_PARAMS;
-       }
-       // take semaphore
-       if (tools_cmdif_flash_lock(mf, 1)) {
-               return ME_SEM_LOCKED;
-       }
-       // run query_dev_cap cmd
-       tools_cmdif cmdif;
-       memset(&cmdif, 0, sizeof(tools_cmdif));
-       cmdif.opcode = QUERY_DEV_CAP_OP;
-
-       int rc = tools_cmdif_send_cmd_int(mf, &cmdif);
-
-       if (rc || cmdif.status) {
-               tools_cmdif_flash_lock(mf, 0);
-               if (rc == ME_CMDIF_BAD_STATUS) {
-                       return translate_status(cmdif.status);
-               }
-               return rc;
-       }
-       // read offset from Mbox
-
-       if (!data) { // if data is null we just check capability of the Tools HCR (i.e if its capable to execute query_dev_cap op)
-               tools_cmdif_flash_lock(mf, 0);
-               return ME_OK;
-       }
-       // offset needs to be in even dwords
-       if (((offset >> 2) & 0x1) != 0) {
-               return ME_BAD_PARAMS;
-       }
-       rc = tools_cmdif_mbox_read(mf, offset>>2, data);
-       // free semaphore
-       tools_cmdif_flash_lock(mf, 0);
-       return rc;
+    if (!mf) {
+        return ME_BAD_PARAMS;
+    }
+    // take semaphore
+    if (tools_cmdif_flash_lock(mf, 1)) {
+        return ME_SEM_LOCKED;
+    }
+    // run mailbox write cmd (read command fails after driver restart or internal reset)
+    int rc = tools_cmdif_mbox_write(mf, 0x0, 0);
+    if (rc) {
+        tools_cmdif_flash_lock(mf, 0);
+        return rc;
+    }
+    tools_cmdif_flash_lock(mf, 0);
+    return ME_OK;
 }
 
 /*
 static void read_entire_mbox(mfile* mf)
 {
-       int i;
-       int rc;
-       u_int64_t val= 0;
+    int i;
+    int rc;
+    u_int64_t val= 0;
 
-       printf("-D- reading entire mailbox\n");
+    printf("-D- reading entire mailbox\n");
 
-       for(i=0; i<256 ; i+=8) {
-               rc = tools_cmdif_mbox_read(mf, i/4, &val);
-               if (rc) {
-                       printf("-D- rc:%d\n", rc);
-               }
-               printf("-D- 0x%x\n", (u_int32_t)val);
-               printf("-D- 0x%x\n", (u_int32_t)(val>>32));
-       }
+    for(i=0; i<256 ; i+=8) {
+        rc = tools_cmdif_mbox_read(mf, i/4, &val);
+        if (rc) {
+            printf("-D- rc:%d\n", rc);
+        }
+        printf("-D- 0x%x\n", (u_int32_t)val);
+        printf("-D- 0x%x\n", (u_int32_t)(val>>32));
+    }
 }
-
-
+*/
+/*
 static void print_buffer(u_int8_t buffer[TOOLS_HCR_MAX_MBOX], const char* pre)
 {
-       int i;
-       u_int32_t *ptr = (u_int32_t*)buffer;
-       printf("-I- %s\n", pre);
-       for (i=0; i< 16; i++) {
-               printf("0x%x\n", ptr[i]);
-       }
-       return;
+    int i;
+    u_int32_t *ptr = (u_int32_t*)buffer;
+    printf("-I- %s\n", pre);
+    for (i=0; i< 16; i++) {
+        printf("0x%x\n", ptr[i]);
+    }
+    return;
 }
 */
 
-int tools_cmdif_reg_access(mfile *mf, void* data, int write_data_size, int read_data_size)
+#define COMPLEMENT_TO_QUAD_ALLIGNED(byte_sz) \
+        ((byte_sz) + ((8 - ((byte_sz) & 7) == 8) ? 0 : (8 - ((byte_sz) & 7))))
+
+int tools_cmdif_send_mbox_command_int(mfile* mf,
+                                           u_int16_t opcode,
+                                           u_int8_t  opcode_modifier,
+                                           int data_offs_in_mbox,
+                                           void* data,
+                                           int write_data_size,
+                                           int read_data_size,
+                                           int skip_write)
 {
-       //printf("-D- write data sz: %d, read data sz: %d \n", write_data_size, read_data_size);
-       if (!mf || !data || write_data_size > TOOLS_HCR_MAX_MBOX || read_data_size > TOOLS_HCR_MAX_MBOX) {
-               return ME_BAD_PARAMS;
-       }
-       //take semaphore
-       if (tools_cmdif_flash_lock(mf, 1)) {
-               return ME_SEM_LOCKED;
-       }
-       int rc;
-       // place the data inside 256 bytes buffer (init with zeroes) and write the entire buffer to mbox
-       // it is required in the TOOLS_HCR HLD to write the ENTIRE MBOX
-       u_int8_t buffer[TOOLS_HCR_MAX_MBOX] = {0};
-       memcpy(buffer, data, write_data_size);
-       // switch endianess as fw expects output in big endian
-       TOCPUn(buffer, TOOLS_HCR_MAX_MBOX/4);
-       int i;
-       //print_buffer(buffer, "before sending sending");
-       for (i=0 ; i< TOOLS_HCR_MAX_MBOX; i+=8) { // it is required to write in quad word chunks (64bits each time)
-           // on big endian cpu need to swap between the dwords in the quad word
-           u_int64_t val = swap_dwords_be((&buffer[i]));
-               rc = tools_cmdif_mbox_write(mf, i/4, val);
-               if (rc) {
-                       goto cleanup;
-               }
-       }
-       // send access reg cmd
-       tools_cmdif cmdif;
-       memset(&cmdif, 0, sizeof(tools_cmdif));
-       cmdif.opcode = REG_ACCESS_OP;
-       rc = tools_cmdif_send_cmd_int(mf, &cmdif);
+    int read_data_size_quad_alligned =  COMPLEMENT_TO_QUAD_ALLIGNED(read_data_size);
+    int write_data_size_quad_alligned =  COMPLEMENT_TO_QUAD_ALLIGNED(write_data_size);
+    int rc,
+        i;
+    /*printf("-D- opcode: 0x%x, opcode mod: 0x%x, data_offs_in_mbox: 0x%x, write_data_size: 0x%x(0x%x), read_data_size 0x%x(0x%x), skip_write: %d\n",\
+               opcode, opcode_modifier, data_offs_in_mbox, write_data_size, write_data_size_quad_alligned, read_data_size, read_data_size_quad_alligned, skip_write);*/
+    // check params
+    if (!mf || !data || data_offs_in_mbox < 0 || (data_offs_in_mbox & 7) != 0 || \
+            data_offs_in_mbox + read_data_size_quad_alligned > TOOLS_HCR_MAX_MBOX || \
+            data_offs_in_mbox + write_data_size_quad_alligned > TOOLS_HCR_MAX_MBOX) {
+        return ME_BAD_PARAMS;
+    }
+    //take semaphore
+    if (tools_cmdif_flash_lock(mf, 1)) {
+        return ME_SEM_LOCKED;
+    }
 
-       if (rc || cmdif.status) {
-               if (rc == ME_CMDIF_BAD_STATUS) {
-                       rc = translate_status(cmdif.status); // means that driver is down or we dont support the extended version of tools hcr.
-               }
-               goto cleanup;
-       }
-       // read read_data_size bytes from mbox and update our data
-       for (i=0 ; i< read_data_size; i+=8) { // it is required to write in quad word chunks (64bits each time)
-               rc = tools_cmdif_mbox_read(mf, i/4, (u_int64_t*)&(buffer[i]));
-               // on big endian cpu need to swap back between the dwords in the quad word
-               u_int64_t val = swap_dwords_be((&buffer[i]));
-               memcpy(&(buffer[i]), (u_int8_t*)&val, 8*sizeof(u_int8_t));
-               if (rc) {
-                       goto cleanup;
-               }
-       }
+    // write to mailbox if needed
+    u_int8_t mailbox[TOOLS_HCR_MAX_MBOX] = {0};
+    if (!skip_write) {
+        // place the data inside 256 bytes buffer (init with zeroes) and write the entire buffer to mbox
+        // it is required in the TOOLS_HCR HLD to write the ENTIRE MBOX
+
+        memcpy(&(mailbox[data_offs_in_mbox]), data, write_data_size);
+        // switch endianess as fw expects output in big endian
+        TOCPUn(mailbox, TOOLS_HCR_MAX_MBOX/4);
+        int i;
+        //print_buffer(mailbox, "before sending sending");
+        for (i=0 ; i< TOOLS_HCR_MAX_MBOX; i+=8) { // it is required to write in quad word chunks (64bits each time)
+            // on big endian cpu need to swap between the dwords in the quad word
+            u_int64_t val = swap_dwords_be((&mailbox[i]));
+            rc = tools_cmdif_mbox_write(mf, i/4, val);
+            if (rc) {
+                goto cleanup;
+            }
+        }
+       //read_entire_mbox(mf);
+    }
+    // send cmd
+    tools_cmdif cmdif;
+    memset(&cmdif, 0, sizeof(tools_cmdif));
+    cmdif.opcode = opcode;
+    cmdif.opcode_modifier = opcode_modifier;
+    rc = tools_cmdif_send_cmd_int(mf, &cmdif);
+    //printf("-D- tools_cmdif_send_cmd_int: rc = 0x%x, cmdif.status: 0x%x\n", rc, cmdif.status);
+    //read_entire_mbox(mf);
+    if (rc || cmdif.status) {
+        if (rc == ME_CMDIF_BAD_STATUS) {
+            rc = translate_status(cmdif.status); // means that driver is down or we dont support the extended version of tools hcr.
+        }
+        goto cleanup;
+    }
+
+    // read from mbox
+
+    // read read_data_size bytes from mbox and update our data
+    for (i = data_offs_in_mbox ; i< (data_offs_in_mbox + read_data_size_quad_alligned); i+=8) { // it is required to write in quad word chunks (64bits each time)
+        rc = tools_cmdif_mbox_read(mf, i/4, (u_int64_t*)&(mailbox[i]));
+        // on big endian cpu need to swap back between the dwords in the quad word
+        u_int64_t val = swap_dwords_be((&mailbox[i]));
+        memcpy(&(mailbox[i]), (u_int8_t*)&val, 8*sizeof(u_int8_t));
+        if (rc) {
+            goto cleanup;
+        }
+    }
 
-       //print_buffer(buffer, "after sending");
-       // switch endianness back
-       TOCPUn(buffer, TOOLS_HCR_MAX_MBOX/4);
-       // copy data back to user
-       memcpy(data, buffer, read_data_size);
-       rc = ME_OK;
+    //print_buffer(mailbox, "after sending");
+    // switch endianness back
+    TOCPUn(mailbox, TOOLS_HCR_MAX_MBOX/4);
+    // copy data back to user
+    memcpy(data, &(mailbox[data_offs_in_mbox]), read_data_size);
+    rc = ME_OK;
 cleanup:
-       tools_cmdif_flash_lock(mf, 0);
-       //printf("-D- rc in cmdif: 0x%x\n", rc);
-       return rc;
+    tools_cmdif_flash_lock(mf, 0);
+    //printf("-D- rc in cmdif: 0x%x\n", rc);
+    return rc;
+}
+
+
+int tools_cmdif_reg_access(mfile *mf, void* data, int write_data_size, int read_data_size)
+{
+    return tools_cmdif_send_mbox_command_int(mf, REG_ACCESS_OP, 0, \
+            0, data, write_data_size, read_data_size, 0);
+}
+
+
+int tools_cmdif_send_mbox_command(mfile* mf,
+                                           u_int16_t opcode,
+                                           u_int8_t  opcode_modifier,
+                                           int data_offs_in_mbox,
+                                           void* data,
+                                           int data_size,
+                                           int skip_write)
+{
+    return tools_cmdif_send_mbox_command_int(mf, opcode, opcode_modifier, \
+                                             data_offs_in_mbox, data, data_size,\
+                                             data_size, skip_write);
 }
 
+
 /*
 int test_mbox(mfile* mf)
 {
index 7d3c8b54faa62764d9b0e8898e5e90571d3b22e4..35bdf7169d9cffecba715007761d2ca8c92d4f02 100644 (file)
@@ -28,6 +28,7 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 #ifndef _MTCR_TOOLS_CIF     /* guard */
@@ -39,7 +40,7 @@ extern "C" {
 
 
 #include <compatibility.h>
-#ifdef MST_UL_ICMD
+#ifdef MST_UL
 #include <mtcr_int_defs.h>
 #endif
 #include <mtcr.h>
@@ -52,20 +53,6 @@ extern "C" {
 // and released at the end of the command.
 
 
-/*
- * send a command to the tools HCR
- * limitations:
- * command should not use mailbox (not supported atm)
- */
-int tools_cmdif_send_cmd(mfile* mf,
-                                        u_int64_t in_param,
-                                        u_int64_t* out_param,
-                                        u_int32_t input_modifier,
-                                        u_int16_t opcode,
-                                        u_int8_t  opcode_modifier,
-                                        u_int8_t*  status);
-
-
 /*
  * register access tools HCR
  *
@@ -78,6 +65,14 @@ int tools_cmdif_send_cmd(mfile* mf,
 
 int tools_cmdif_reg_access(mfile *mf, void* data,int write_data_size, int read_data_size);
 
+/*
+ * tools_cmdif_is_supported tools HCR
+ *
+ * check if sending registers via tools HCR is supported
+ *
+ */
+int tools_cmdif_is_supported(mfile *mf);
+
 #ifdef __cplusplus
 }
 #endif
index 449b4afe63e25369a8727f1424f06cff674bacbf..dd26653df7a0011e236329f51642c8d89d862c06 100644 (file)
@@ -34,7 +34,6 @@
  *
  */
 
-
 //use memory mapped /dev/mem for access
 #define CONFIG_ENABLE_MMAP 1
 //mmap /dev/mem for memory access (does not work on sparc)
 #include "mtcr_ib.h"
 #include "packets_layout.h"
 #include "mtcr_tools_cif.h"
-
-#ifdef MST_UL_ICMD
 #include "mtcr_icmd_cif.h"
-#endif
 
 #ifndef __be32_to_cpu
 #define __be32_to_cpu(x) ntohl(x)
@@ -181,6 +177,7 @@ static int _create_lock(mfile* mf, unsigned domain, unsigned bus, unsigned dev,
 {
     char fname[64] = {0};
     int rc;
+    int fd = 0;
     snprintf(fname, 64,LOCK_FILE_FORMAT, domain, bus, dev, func, access == MTCR_ACCESS_CONFIG ? "config" : "mem");
     rc = mkdir ("/tmp", 0777);
     if (rc && errno != EEXIST) {
@@ -192,7 +189,7 @@ static int _create_lock(mfile* mf, unsigned domain, unsigned bus, unsigned dev,
         goto cl_clean_up;
     }
 
-    int fd = open(fname, O_RDONLY | O_CREAT, 0777);
+    fd = open(fname, O_RDONLY | O_CREAT, 0777);
     if (fd < 0) {
         goto cl_clean_up;
     }
@@ -693,8 +690,9 @@ int mtcr_pciconf_mclose(mfile *mf)
 {
     struct pciconf_context *ctx = mf->ctx;
     unsigned int word;
-
     if (ctx) {
+        //TODO: apparently this read is useless here , need to check
+        // what happens if we remove it , (maybe something to do with ConnectX WA ??)
         mread4(mf, 0xf0014, &word);
         if (ctx->fd != -1) {
             close(ctx->fd);
@@ -1030,8 +1028,9 @@ dev_info* mdevices_info(int mask, int* len)
 
     // Get list of devices
     do {
-        if (devs)
+        if (devs) {
             free(devs);
+        }
         size *= 2;
         devs = (char*)malloc(size);
         rc = mdevices(devs, size, mask);
@@ -1039,6 +1038,9 @@ dev_info* mdevices_info(int mask, int* len)
 
     if ( rc <= 0 ) {
         len = 0;
+        if (devs) {
+            free(devs);
+        }
         return NULL;
     }
     // For each device read
@@ -1056,11 +1058,17 @@ dev_info* mdevices_info(int mask, int* len)
         u_int32_t *conf_header_32p = (u_int32_t*)conf_header;
 
         // update default device name
-        strcpy(dev_info_arr[i].dev_name, dev_name);
-        strcpy(dev_info_arr[i].pci.cr_dev, dev_name);
+        strncpy(dev_info_arr[i].dev_name, dev_name, sizeof(dev_info_arr[i].dev_name) - 1);
+        strncpy(dev_info_arr[i].pci.cr_dev, dev_name, sizeof(dev_info_arr[i].pci.cr_dev) - 1);
 
         // update dbdf
-        sscanf(dev_name, "%x:%x:%x.%x", &domain, &bus, &dev, &func);
+        if (sscanf(dev_name, "%x:%x:%x.%x", &domain, &bus, &dev, &func) != 4) {
+            rc = -1;
+            len = 0;
+            free(dev_info_arr);
+            free(devs);
+            return NULL;
+        }
         dev_info_arr[i].pci.domain = domain;
         dev_info_arr[i].pci.bus = bus;
         dev_info_arr[i].pci.dev = dev;
@@ -1265,12 +1273,10 @@ int mclose(mfile *mf)
 {
     if (mf != NULL){
         if (mf->mclose != NULL && mf->ctx != NULL) {
-            #ifdef MST_UL_ICMD
             // close icmd if if needed
             if (mf->icmd.icmd_opened) {
                 icmd_close(mf);
             }
-            #endif
             mf->mclose(mf);
         }
         if (mf->dev_name) {
@@ -1462,35 +1468,6 @@ int mwrite_buffer(mfile *mf, unsigned int offset, u_int8_t* data, int byte_len)
  * Reg Access Section
  */
 
-#ifndef MST_UL_ICMD
-int icmd_send_command(mfile *mf, int opcode, void* data, int data_size, int skip_write) {
-    (void)mf;
-    (void)opcode; /* compiler warning */
-    (void)data; /* compiler warning */
-    (void)data_size; /* compiler warning */
-    (void)skip_write; /* compiler warning */
-    fprintf(stderr, "Warning: libmtcr: icmd_send_command() is not implemented and has no effect.\n");
-    return ME_NOT_IMPLEMENTED;
-}
-
-static int icmd_send_command_int(mfile *mf, int opcode, void* data, int w_data_size, int r_data_size, int skip_write) {
-    (void)mf;
-    (void)opcode; /* compiler warning */
-    (void)data; /* compiler warning */
-    (void)w_data_size; /* compiler warning */
-    (void)r_data_size; /* compiler warning */
-    (void)skip_write; /* compiler warning */
-    fprintf(stderr, "Warning: libmtcr: icmd_send_command_int() is not implemented and has no effect.\n");
-    return ME_NOT_IMPLEMENTED;
-}
-
-int icmd_clear_semaphore(mfile *mf) {
-    (void)mf; /* compiler warning */
-    fprintf(stderr, "Warning: libmtcr: icmd_clear_semaphore() is not implemented and has no effect.\n");
-    return ME_NOT_IMPLEMENTED;
-}
-#endif
-
 #define TLV_OPERATION_SIZE 4
 #define OP_TLV_SIZE        16
 #define REG_TLV_HEADER_LEN 4
@@ -1506,8 +1483,10 @@ enum {
     TLV_USER_DATA = 4,
 };
 
+#define REGISTER_HEADERS_SIZE 12
 #define INBAND_MAX_REG_SIZE 44
 #define ICMD_MAX_REG_SIZE 236
+#define TOOLS_HCR_MAX_REG_SIZE (TOOLS_HCR_MAX_MBOX - REGISTER_HEADERS_SIZE)
 
 static int supports_icmd(mfile* mf);
 static int supports_tools_cmdif_reg(mfile* mf);
@@ -1536,25 +1515,26 @@ int maccess_reg(mfile     *mf,
     }
     // check register size
     int max_size = mget_max_reg_size(mf);
-    if ( max_size != -1 && reg_size > (unsigned int)max_size) {
+    if (reg_size > (unsigned int)max_size) {
        //reg too big
        return ME_REG_ACCESS_SIZE_EXCCEEDS_LIMIT;
     }
-#ifndef MST_UL
+
     // TODO: add specific checks for each FW access method where needed
+#ifndef MST_UL
     if (mf->flags & MDEVS_MLNX_OS){
        rc = mos_reg_access_raw(mf, reg_id, reg_method, reg_data, reg_size, reg_status);
     } else if ((mf->flags & (MDEVS_IB | MDEVS_FWCTX)) || (mf->flags != MDEVS_IB && (supports_icmd(mf) || supports_tools_cmdif_reg(mf)))) {
        rc = mreg_send_raw(mf, reg_id, reg_method, reg_data, reg_size, r_size_reg, w_size_reg, reg_status);
-    }else {
+    } else {
         return ME_REG_ACCESS_NOT_SUPPORTED;
     }
 #else
-    if (mf->access_type == MTCR_ACCESS_INBAND || (supports_icmd(mf) || supports_tools_cmdif_reg(mf)) ) {
-               rc = mreg_send_raw(mf, reg_id, reg_method, reg_data, reg_size, r_size_reg, w_size_reg, reg_status);
-        }else {
-            return ME_REG_ACCESS_NOT_SUPPORTED;
-        }
+    if (mf->access_type == MTCR_ACCESS_INBAND || supports_icmd(mf) || supports_tools_cmdif_reg(mf)) {
+        rc = mreg_send_raw(mf, reg_id, reg_method, reg_data, reg_size, r_size_reg, w_size_reg, reg_status);
+    else {
+        return ME_REG_ACCESS_NOT_SUPPORTED;
+    }
 #endif
 
     if (rc ) {
@@ -1620,15 +1600,7 @@ static int mreg_send_wrapper(mfile* mf, u_int8_t *data, int r_icmd_size, int w_i
                 return ME_MAD_SEND_FAILED;
             }
     } else if (supports_icmd(mf)) {
-    #if defined(MST_UL) && !defined(MST_UL_ICMD) //ugly hack to avoid compiler warrnings
-        if (0) {
-            rc = icmd_send_command_int(mf, FLASH_REG_ACCESS, data, w_icmd_size, r_icmd_size, 0);
-        }
-        // in mstflint we send reg_access via MADS
-        rc = maccess_reg_mad(mf, data);
-    #else
         rc = icmd_send_command_int(mf, FLASH_REG_ACCESS, data, w_icmd_size, r_icmd_size, 0);
-    #endif
         if (rc) {
                return rc;
         }
@@ -1712,12 +1684,10 @@ static int mreg_send_raw(mfile *mf, u_int16_t reg_id, maccess_reg_method_t metho
 #define HW_ID_ADDR 0xf0014
 
 static int supports_icmd(mfile* mf) {
-#if !defined(MST_UL_ICMD) && !defined(MST_UL)
-       (void)mf; // avoid warnings
-       return 0;
-#endif
        u_int32_t dev_id;
-       mread4(mf,HW_ID_ADDR, &dev_id); // cr might be locked and retured 0xbad0cafe but we dont care we search for device that supports icmd
+       if (mread4(mf,HW_ID_ADDR, &dev_id) !=4) { // cr might be locked and retured 0xbad0cafe but we dont care we search for device that supports icmd
+           return 1;
+       }
        switch (dev_id & 0xffff) { // that the hw device id
                case CIB_HW_ID :
                case CX4_HW_ID :
@@ -1730,19 +1700,21 @@ static int supports_icmd(mfile* mf) {
 }
 
 static int supports_tools_cmdif_reg(mfile* mf) {
-       u_int32_t dev_id;
-       mread4(mf,HW_ID_ADDR, &dev_id); // cr might be locked and retured 0xbad0cafe but we dont care we search for device that supports tools cmdif
-       switch (dev_id & 0xffff) { // that the hw device id
-               case CX3_HW_ID_REV : //Cx3
-               case CX3_PRO_HW_ID : // Cx3-pro
-                       if (tools_cmdif_query_dev_cap(mf, 0, NULL) == ME_OK) {
-                               return 1;
-                       }
-                       break;
-               default:
-                       break;
-                }
-   return 0;
+    u_int32_t dev_id;
+    if (mread4(mf,HW_ID_ADDR, &dev_id) != 4) { // cr might be locked and retured 0xbad0cafe but we dont care we search for device that supports tools cmdif
+        return 1;
+    }
+    switch (dev_id & 0xffff) { // that the hw device id
+    case CX3_HW_ID_REV : //Cx3
+    case CX3_PRO_HW_ID : // Cx3-pro
+        if (tools_cmdif_is_supported(mf) == ME_OK) {
+            return 1;
+        }
+        break;
+    default:
+        break;
+    }
+    return 0;
 }
 
 
@@ -1751,14 +1723,10 @@ int mget_max_reg_size(mfile *mf) {
         return INBAND_MAX_REG_SIZE;
     }
     if (supports_icmd(mf)){ // we support icmd and we dont use IB interface -> we use icmd for reg access
-    #ifdef MST_UL
-        return INBAND_MAX_REG_SIZE;
-    #else
         return ICMD_MAX_REG_SIZE;
-    #endif
     }
     if (supports_tools_cmdif_reg(mf)) {
-        return TOOLS_HCR_MAX_MBOX;
+        return TOOLS_HCR_MAX_REG_SIZE;
     }
     return 0;
 }
@@ -1874,6 +1842,10 @@ const char* m_err2str(MError status)
           return "bad system status (driver may be down or Fw does not support this operation)";
    case ME_CMDIF_UNKN_TLV:
        return "Unknown TLV";
+   case ME_CMDIF_RES_STATE:
+       return "Bad reset state";
+   case ME_CMDIF_UNKN_STATUS:
+       return "Unknown status";
 
     // MAD IFC errors
    case ME_MAD_BUSY:
index f6b92c2d4bde2dcfa8c7efb3ec180c49e0963491..3cb9949a4975a0d039167b4eb8b2bc8779822c38 100644 (file)
@@ -36,6 +36,7 @@
 #define REG_ID_MFBA  0x9011
 #define REG_ID_MFBE  0x9012
 #define REG_ID_PMDIO 0x9017
+#define REG_ID_MGIR  0x9020
 #define REG_ID_PMDIC 0x9021
 #define REG_ID_MNVA  0x9024
 #define REG_ID_MNVI  0x9025
 #define REG_ID_MFRL 0x9028
 #define REG_ID_MFAI 0x9029
 
+// WA for MGIR: the reg size is too big so we limit it to INBAND_MAX_REG_SIZE
+#define INBAND_MAX_REG_SIZE 44
+#define MGIR_REG_SIZE INBAND_MAX_REG_SIZE
+// End of WA
+
 // for debug:
 //#define _ENABLE_DEBUG_
 #ifdef _ENABLE_DEBUG_
@@ -161,6 +167,16 @@ reg_access_status_t reg_access_mnvia (mfile* mf, reg_access_method_t method, str
        REG_ACCCESS(mf, method, REG_ID_MNVIA, mnvia, mnvia, tools_open);
 }
 
+/************************************
+ *  * Function: reg_access_mgir
+ *************************************/
+reg_access_status_t reg_access_mgir(mfile* mf, reg_access_method_t method, struct register_access_sib_mgir* mgir)
+{
+    REG_ACCCESS_VAR(mf, method, REG_ID_MGIR, mgir, mgir, MGIR_REG_SIZE, MGIR_REG_SIZE, MGIR_REG_SIZE, register_access_sib);
+    //REG_ACCCESS(mf, method, REG_ID_MGIR, mgir, mgir, register_access_sib);
+    //}
+}
+
 /************************************
  * Function: reg_access_err2str
  ************************************/
index c021ab9b1ea54fbd6e888e898830697b73e5a575..0e24093f24a20713f33fcdf26d2e6f9c0057339d 100644 (file)
@@ -38,6 +38,7 @@ extern "C" {
 
 #include <mtcr.h>
 #include <tools_layouts/register_access_open_layouts.h>
+#include <tools_layouts/register_access_sib_layouts.h>
 
 // Hack, we include this for the MNV registers as they are not officialy a part of register_access so we defined them in tools.adb
 #include <tools_layouts/tools_open_layouts.h>
@@ -62,6 +63,7 @@ reg_access_status_t reg_access_mfpa (mfile* mf, reg_access_method_t method, stru
 reg_access_status_t reg_access_mnva (mfile* mf, reg_access_method_t method, struct tools_open_mnva* mnva);
 reg_access_status_t reg_access_mnvi (mfile* mf, reg_access_method_t method, struct tools_open_mnvi* mnvi);
 reg_access_status_t reg_access_mnvia (mfile* mf, reg_access_method_t method, struct tools_open_mnvia* mnvia);
+reg_access_status_t reg_access_mgir (mfile* mf, reg_access_method_t method, struct register_access_sib_mgir* mgir);
 
 #ifdef __cplusplus
 }
index a760c43fcad9ffbb00bbe99948047eebad3d2adb..17bdf6cb480a60ada593d1973741fe1661ad0c9c 100644 (file)
@@ -37,4 +37,5 @@ noinst_LIBRARIES = libtools_layouts.a
 
 libtools_layouts_a_SOURCES = cibfw_layouts.c adb_to_c_utils.c adb_to_c_utils.h cibfw_layouts.h \
                                                                register_access_open_layouts.h register_access_open_layouts.c \
-                                                               tools_open_layouts.c tools_open_layouts.h
+                                                               tools_open_layouts.c tools_open_layouts.h\
+                                                               register_access_sib_layouts.h register_access_sib_layouts.c
index e25389557ae2e67fa6e06e2d1e4fe7cd1a40716d..232cc1cd9a4c5ec8c854bf9cc1515d6f23dbe07a 100644 (file)
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 /***
- *** This file was generated at "2014-03-23 17:16:25"
+ *** This file was generated at "2014-11-12 13:19:54"
  *** by:
- ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/golan/golan.adb --file-prefix golan --prefix golan_
+ ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools_open/tools_open.adb --file-prefix tools_open --prefix tools_open_
  ***/
 
+#include <assert.h>
 #include "adb_to_c_utils.h"
 
 /************************************
index a0cc9d3e50a3931ed8c1e97ae24885ce00f4cf2a..2896624fc9b3167708c7619e6fe04ccc104d0313 100644 (file)
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 /***
- *** This file was generated at "2014-03-23 17:16:25"
+ *** This file was generated at "2014-11-12 13:19:54"
  *** by:
- ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/golan/golan.adb --file-prefix golan --prefix golan_
+ ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools_open/tools_open.adb --file-prefix tools_open --prefix tools_open_
  ***/
 
 #ifndef ADABE_TO_C_UTILS
@@ -42,7 +43,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
 
 //for htonl etc...
 #if defined(_WIN32) || defined(_WIN64)
index 6eccab11cc034f463218dfbd59472cddf5cb08e3..0762404456606b534c5d812ffac7efbe026fdb38 100644 (file)
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 /***
- *** This file was generated at "2014-03-23 17:16:21"
+ *** This file was generated at "2014-11-12 13:19:17"
  *** by:
  ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/cibfw/cibfw.adb --file-prefix cibfw --prefix cibfw_
  ***/
@@ -93,6 +94,71 @@ void cibfw_uint64_dump(const struct cibfw_uint64 *ptr_struct, FILE* file) {
        cibfw_uint64_print(ptr_struct, file, 0);
 }
 
+void cibfw_module_version_pack(const struct cibfw_module_version *ptr_struct, u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=24;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->branch);
+
+       offset=12;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->minor);
+
+       offset=0;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->major);
+
+}
+
+void cibfw_module_version_unpack(struct cibfw_module_version *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=24;
+       ptr_struct->branch = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+       offset=12;
+       ptr_struct->minor = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
+
+       offset=0;
+       ptr_struct->major = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
+
+}
+
+void cibfw_module_version_print(const struct cibfw_module_version *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== module_version ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "branch               : "UH_FMT"\n", ptr_struct->branch);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "minor                : "UH_FMT"\n", ptr_struct->minor);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "major                : "UH_FMT"\n", ptr_struct->major);
+
+}
+
+int cibfw_module_version_size(){
+        return 4;
+}
+
+void cibfw_module_version_dump(const struct cibfw_module_version *ptr_struct, FILE* file) {
+       cibfw_module_version_print(ptr_struct, file, 0);
+}
+
 void cibfw_uid_entry_pack(const struct cibfw_uid_entry *ptr_struct, u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
@@ -158,6 +224,104 @@ void cibfw_uid_entry_dump(const struct cibfw_uid_entry *ptr_struct, FILE* file)
        cibfw_uid_entry_print(ptr_struct, file, 0);
 }
 
+void cibfw_module_versions_pack(const struct cibfw_module_versions *ptr_struct, u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=0;
+       cibfw_module_version_pack(&(ptr_struct->core), ptr_buff + offset/8);
+
+       offset=32;
+       cibfw_module_version_pack(&(ptr_struct->phy), ptr_buff + offset/8);
+
+       offset=64;
+       cibfw_module_version_pack(&(ptr_struct->kernel), ptr_buff + offset/8);
+
+       offset=96;
+       cibfw_module_version_pack(&(ptr_struct->iron_image), ptr_buff + offset/8);
+
+       offset=128;
+       cibfw_module_version_pack(&(ptr_struct->host_management), ptr_buff + offset/8);
+
+       offset=160;
+       cibfw_module_version_pack(&(ptr_struct->mad), ptr_buff + offset/8);
+
+}
+
+void cibfw_module_versions_unpack(struct cibfw_module_versions *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=0;
+       cibfw_module_version_unpack(&(ptr_struct->core), ptr_buff + offset/8);
+
+       offset=32;
+       cibfw_module_version_unpack(&(ptr_struct->phy), ptr_buff + offset/8);
+
+       offset=64;
+       cibfw_module_version_unpack(&(ptr_struct->kernel), ptr_buff + offset/8);
+
+       offset=96;
+       cibfw_module_version_unpack(&(ptr_struct->iron_image), ptr_buff + offset/8);
+
+       offset=128;
+       cibfw_module_version_unpack(&(ptr_struct->host_management), ptr_buff + offset/8);
+
+       offset=160;
+       cibfw_module_version_unpack(&(ptr_struct->mad), ptr_buff + offset/8);
+
+}
+
+void cibfw_module_versions_print(const struct cibfw_module_versions *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== module_versions ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "core:\n");
+       cibfw_module_version_print(&(ptr_struct->core), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "phy:\n");
+       cibfw_module_version_print(&(ptr_struct->phy), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "kernel:\n");
+       cibfw_module_version_print(&(ptr_struct->kernel), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iron_image:\n");
+       cibfw_module_version_print(&(ptr_struct->iron_image), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "host_management:\n");
+       cibfw_module_version_print(&(ptr_struct->host_management), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "mad:\n");
+       cibfw_module_version_print(&(ptr_struct->mad), file, indent_level + 1);
+
+}
+
+int cibfw_module_versions_size(){
+        return 64;
+}
+
+void cibfw_module_versions_dump(const struct cibfw_module_versions *ptr_struct, FILE* file) {
+       cibfw_module_versions_print(ptr_struct, file, 0);
+}
+
 void cibfw_TRIPPLE_VERSION_pack(const struct cibfw_TRIPPLE_VERSION *ptr_struct, u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
@@ -508,6 +672,9 @@ void cibfw_image_info_pack(const struct cibfw_image_info *ptr_struct, u_int8_t*
        adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->prod_ver[i]);
        }
 
+       offset=6144;
+       cibfw_module_versions_pack(&(ptr_struct->module_versions), ptr_buff + offset/8);
+
 }
 
 void cibfw_image_info_unpack(struct cibfw_image_info *ptr_struct, const u_int8_t* ptr_buff){
@@ -553,6 +720,9 @@ void cibfw_image_info_unpack(struct cibfw_image_info *ptr_struct, const u_int8_t
        }
 
        ptr_struct->prod_ver[16] = '\0';
+       offset=6144;
+       cibfw_module_versions_unpack(&(ptr_struct->module_versions), ptr_buff + offset/8);
+
 }
 
 void cibfw_image_info_print(const struct cibfw_image_info *ptr_struct, FILE* file, int indent_level){
@@ -585,6 +755,10 @@ void cibfw_image_info_print(const struct cibfw_image_info *ptr_struct, FILE* fil
        fprintf(file, "ini_file_num         : "U32H_FMT"\n", ptr_struct->ini_file_num);
 
        fprintf(file, "prod_ver             : \"%s\"\n", ptr_struct->prod_ver);
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "module_versions:\n");
+       cibfw_module_versions_print(&(ptr_struct->module_versions), file, indent_level + 1);
+
 }
 
 int cibfw_image_info_size(){
@@ -803,6 +977,53 @@ void cibfw_device_info_dump(const struct cibfw_device_info *ptr_struct, FILE* fi
        cibfw_device_info_print(ptr_struct, file, 0);
 }
 
+void cibfw_register_mfrl_pack(const struct cibfw_register_mfrl *ptr_struct, u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=56;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->reset_level);
+
+}
+
+void cibfw_register_mfrl_unpack(struct cibfw_register_mfrl *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=56;
+       ptr_struct->reset_level = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+}
+
+void cibfw_register_mfrl_print(const struct cibfw_register_mfrl *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== register_mfrl ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "reset_level          : "UH_FMT"\n", ptr_struct->reset_level);
+
+}
+
+int cibfw_register_mfrl_size(){
+        return 16;
+}
+
+void cibfw_register_mfrl_dump(const struct cibfw_register_mfrl *ptr_struct, FILE* file) {
+       cibfw_register_mfrl_print(ptr_struct, file, 0);
+}
+
 void cibfw_itoc_header_pack(const struct cibfw_itoc_header *ptr_struct, u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
@@ -1041,24 +1262,111 @@ void cibfw_itoc_entry_dump(const struct cibfw_itoc_entry *ptr_struct, FILE* file
        cibfw_itoc_entry_print(ptr_struct, file, 0);
 }
 
-void cibfw_Nodes_pack(const union cibfw_Nodes *ptr_struct, u_int8_t* ptr_buff)
+void cibfw_register_mfai_pack(const struct cibfw_register_mfai *ptr_struct, u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=8;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->address);
+
+       offset=2;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->permanent);
+
+       offset=1;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->use_address);
+
+       offset=0;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->use_image_id);
+
+       offset=56;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->image_id);
+
+}
+
+void cibfw_register_mfai_unpack(struct cibfw_register_mfai *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=8;
+       ptr_struct->address = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
+
+       offset=2;
+       ptr_struct->permanent = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=1;
+       ptr_struct->use_address = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=0;
+       ptr_struct->use_image_id = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=56;
+       ptr_struct->image_id = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+}
+
+void cibfw_register_mfai_print(const struct cibfw_register_mfai *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== register_mfai ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "address              : "UH_FMT"\n", ptr_struct->address);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "permanent            : "UH_FMT"\n", ptr_struct->permanent);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "use_address          : "UH_FMT"\n", ptr_struct->use_address);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "use_image_id         : "UH_FMT"\n", ptr_struct->use_image_id);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "image_id             : "UH_FMT"\n", ptr_struct->image_id);
+
+}
+
+int cibfw_register_mfai_size(){
+        return 16;
+}
+
+void cibfw_register_mfai_dump(const struct cibfw_register_mfai *ptr_struct, FILE* file) {
+       cibfw_register_mfai_print(ptr_struct, file, 0);
+}
+
+void cibfw_cibfw_Nodes_pack(const union cibfw_cibfw_Nodes *ptr_struct, u_int8_t* ptr_buff)
 {
        memcpy(ptr_buff, ptr_struct, 1024);
 }
 
-void cibfw_Nodes_unpack(union cibfw_Nodes *ptr_struct, const u_int8_t* ptr_buff)
+void cibfw_cibfw_Nodes_unpack(union cibfw_cibfw_Nodes *ptr_struct, const u_int8_t* ptr_buff)
 {
        memcpy(ptr_struct, ptr_buff, 1024);
 }
 
-void cibfw_Nodes_print(const union cibfw_Nodes *ptr_struct, FILE* file, int indent_level){
+void cibfw_cibfw_Nodes_print(const union cibfw_cibfw_Nodes *ptr_struct, FILE* file, int indent_level){
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "======== Nodes ========\n");
+       fprintf(file, "======== cibfw_Nodes ========\n");
        int i=0;
        (void)i;(void)ptr_struct;
        (void)file;
        (void)indent_level;
 
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "register_mfai:\n");
+       cibfw_register_mfai_print(&(ptr_struct->register_mfai), file, indent_level + 1);
+
        adb2c_add_indentation(file, indent_level);
        fprintf(file, "itoc_entry:\n");
        cibfw_itoc_entry_print(&(ptr_struct->itoc_entry), file, indent_level + 1);
@@ -1071,6 +1379,10 @@ void cibfw_Nodes_print(const union cibfw_Nodes *ptr_struct, FILE* file, int inde
        fprintf(file, "itoc_header:\n");
        cibfw_itoc_header_print(&(ptr_struct->itoc_header), file, indent_level + 1);
 
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "register_mfrl:\n");
+       cibfw_register_mfrl_print(&(ptr_struct->register_mfrl), file, indent_level + 1);
+
        adb2c_add_indentation(file, indent_level);
        fprintf(file, "device_info:\n");
        cibfw_device_info_print(&(ptr_struct->device_info), file, indent_level + 1);
@@ -1085,11 +1397,11 @@ void cibfw_Nodes_print(const union cibfw_Nodes *ptr_struct, FILE* file, int inde
 
 }
 
-int cibfw_Nodes_size(){
+int cibfw_cibfw_Nodes_size(){
         return 1024;
 }
 
-void cibfw_Nodes_dump(const union cibfw_Nodes *ptr_struct, FILE* file) {
-       cibfw_Nodes_print(ptr_struct, file, 0);
+void cibfw_cibfw_Nodes_dump(const union cibfw_cibfw_Nodes *ptr_struct, FILE* file) {
+       cibfw_cibfw_Nodes_print(ptr_struct, file, 0);
 }
 
index 31f710819529fe17f1a6e0057dccefde8c1f3439..d7b4ad1eb16d5be8ac22a6463c84697692c49a73 100644 (file)
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
+ *
  */
 
 /***
- *** This file was generated at "2014-03-23 17:16:21"
+ *** This file was generated at "2014-11-12 13:19:17"
  *** by:
  ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/cibfw/cibfw.adb --file-prefix cibfw --prefix cibfw_
  ***/
@@ -56,6 +57,21 @@ struct cibfw_uint64 {
         u_int32_t lo;
 };
 
+/* Description -   */
+/* Size in bytes - 4 */
+struct cibfw_module_version {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description -  */
+       /* 0.0 - 0.7 */
+        u_int8_t branch;
+       /* Description -  */
+       /* 0.8 - 0.19 */
+        u_int16_t minor;
+       /* Description -  */
+       /* 0.20 - 4.31 */
+        u_int16_t major;
+};
+
 /* Description -   */
 /* Size in bytes - 16 */
 struct cibfw_uid_entry {
@@ -73,6 +89,35 @@ See struct description */
         u_int64_t uid;
 };
 
+/* Description -   */
+/* Size in bytes - 64 */
+struct cibfw_module_versions {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description -  */
+       /* 0.0 - 4.31 */
+        struct cibfw_module_version core;
+/*---------------- DWORD[1] (Offset 0x4) ----------------*/
+       /* Description -  */
+       /* 4.0 - 8.31 */
+        struct cibfw_module_version phy;
+/*---------------- DWORD[2] (Offset 0x8) ----------------*/
+       /* Description -  */
+       /* 8.0 - 12.31 */
+        struct cibfw_module_version kernel;
+/*---------------- DWORD[3] (Offset 0xc) ----------------*/
+       /* Description -  */
+       /* 12.0 - 16.31 */
+        struct cibfw_module_version iron_image;
+/*---------------- DWORD[4] (Offset 0x10) ----------------*/
+       /* Description -  */
+       /* 16.0 - 20.31 */
+        struct cibfw_module_version host_management;
+/*---------------- DWORD[5] (Offset 0x14) ----------------*/
+       /* Description -  */
+       /* 20.0 - 24.31 */
+        struct cibfw_module_version mad;
+};
+
 /* Description -   */
 /* Size in bytes - 8 */
 struct cibfw_TRIPPLE_VERSION {
@@ -204,6 +249,10 @@ Format is defined by the packager.
 When set to a non-empty string the FW update tool burns the image as a monolythic entity and refuses to update rom only or FW only. */
        /* 448.24 - 464.23 */
         char prod_ver[17];
+/*---------------- DWORD[192] (Offset 0x300) ----------------*/
+       /* Description -  */
+       /* 768.0 - 832.31 */
+        struct cibfw_module_versions module_versions;
 };
 
 /* Description -   */
@@ -268,6 +317,21 @@ struct cibfw_device_info {
         struct cibfw_operation_key keys[4];
 };
 
+/* Description -   */
+/* Size in bytes - 16 */
+struct cibfw_register_mfrl {
+/*---------------- DWORD[1] (Offset 0x4) ----------------*/
+       /* Description - on Read, required reset level. On write, minimum requested reset level
+ 0-Full ISFU
+ 1-Driver down but link is up
+ 2-driver and link down
+ 3-driver down, link down pci disable/enable
+ 7-server warm reboot
+ 8-server cold reboot */
+       /* 4.0 - 4.7 */
+        u_int8_t reset_level;
+};
+
 /* Description -   */
 /* Size in bytes - 32 */
 struct cibfw_itoc_header {
@@ -368,11 +432,36 @@ Example for device_data section: VPD_R, GUIDs. */
         u_int16_t itoc_entry_crc;
 };
 
+/* Description -   */
+/* Size in bytes - 16 */
+struct cibfw_register_mfai {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description -  */
+       /* 0.0 - 0.23 */
+        u_int32_t address;
+       /* Description - if set make image permamnent */
+       /* 0.29 - 0.29 */
+        u_int8_t permanent;
+       /* Description - if set use address */
+       /* 0.30 - 0.30 */
+        u_int8_t use_address;
+       /* Description - if set use image id and not address */
+       /* 0.31 - 4.31 */
+        u_int8_t use_image_id;
+/*---------------- DWORD[1] (Offset 0x4) ----------------*/
+       /* Description -  */
+       /* 4.0 - 4.7 */
+        u_int8_t image_id;
+};
+
 /* Description -   */
 /* Size in bytes - 1024 */
-union cibfw_Nodes {
+union cibfw_cibfw_Nodes {
 /*---------------- DWORD[0] (Offset 0x0) ----------------*/
        /* Description -  */
+       /* 0.0 - 16.31 */
+        struct cibfw_register_mfai register_mfai;
+       /* Description -  */
        /* 0.0 - 32.31 */
         struct cibfw_itoc_entry itoc_entry;
        /* Description -  */
@@ -382,6 +471,9 @@ union cibfw_Nodes {
        /* 0.0 - 32.31 */
         struct cibfw_itoc_header itoc_header;
        /* Description -  */
+       /* 0.0 - 16.31 */
+        struct cibfw_register_mfrl register_mfrl;
+       /* Description -  */
        /* 0.0 - 512.31 */
         struct cibfw_device_info device_info;
        /* Description -  */
@@ -401,6 +493,13 @@ void cibfw_uint64_print(const struct cibfw_uint64 *ptr_struct, FILE* file, int i
 int cibfw_uint64_size();
 #define CIBFW_UINT64_SIZE    (0x8)
 void cibfw_uint64_dump(const struct cibfw_uint64 *ptr_struct, FILE* file);
+/* module_version */
+void cibfw_module_version_pack(const struct cibfw_module_version *ptr_struct, u_int8_t* ptr_buff);
+void cibfw_module_version_unpack(struct cibfw_module_version *ptr_struct, const u_int8_t* ptr_buff);
+void cibfw_module_version_print(const struct cibfw_module_version *ptr_struct, FILE* file, int indent_level);
+int cibfw_module_version_size();
+#define CIBFW_MODULE_VERSION_SIZE    (0x4)
+void cibfw_module_version_dump(const struct cibfw_module_version *ptr_struct, FILE* file);
 /* uid_entry */
 void cibfw_uid_entry_pack(const struct cibfw_uid_entry *ptr_struct, u_int8_t* ptr_buff);
 void cibfw_uid_entry_unpack(struct cibfw_uid_entry *ptr_struct, const u_int8_t* ptr_buff);
@@ -408,6 +507,13 @@ void cibfw_uid_entry_print(const struct cibfw_uid_entry *ptr_struct, FILE* file,
 int cibfw_uid_entry_size();
 #define CIBFW_UID_ENTRY_SIZE    (0x10)
 void cibfw_uid_entry_dump(const struct cibfw_uid_entry *ptr_struct, FILE* file);
+/* module_versions */
+void cibfw_module_versions_pack(const struct cibfw_module_versions *ptr_struct, u_int8_t* ptr_buff);
+void cibfw_module_versions_unpack(struct cibfw_module_versions *ptr_struct, const u_int8_t* ptr_buff);
+void cibfw_module_versions_print(const struct cibfw_module_versions *ptr_struct, FILE* file, int indent_level);
+int cibfw_module_versions_size();
+#define CIBFW_MODULE_VERSIONS_SIZE    (0x40)
+void cibfw_module_versions_dump(const struct cibfw_module_versions *ptr_struct, FILE* file);
 /* TRIPPLE_VERSION */
 void cibfw_TRIPPLE_VERSION_pack(const struct cibfw_TRIPPLE_VERSION *ptr_struct, u_int8_t* ptr_buff);
 void cibfw_TRIPPLE_VERSION_unpack(struct cibfw_TRIPPLE_VERSION *ptr_struct, const u_int8_t* ptr_buff);
@@ -457,6 +563,13 @@ void cibfw_device_info_print(const struct cibfw_device_info *ptr_struct, FILE* f
 int cibfw_device_info_size();
 #define CIBFW_DEVICE_INFO_SIZE    (0x200)
 void cibfw_device_info_dump(const struct cibfw_device_info *ptr_struct, FILE* file);
+/* register_mfrl */
+void cibfw_register_mfrl_pack(const struct cibfw_register_mfrl *ptr_struct, u_int8_t* ptr_buff);
+void cibfw_register_mfrl_unpack(struct cibfw_register_mfrl *ptr_struct, const u_int8_t* ptr_buff);
+void cibfw_register_mfrl_print(const struct cibfw_register_mfrl *ptr_struct, FILE* file, int indent_level);
+int cibfw_register_mfrl_size();
+#define CIBFW_REGISTER_MFRL_SIZE    (0x10)
+void cibfw_register_mfrl_dump(const struct cibfw_register_mfrl *ptr_struct, FILE* file);
 /* itoc_header */
 void cibfw_itoc_header_pack(const struct cibfw_itoc_header *ptr_struct, u_int8_t* ptr_buff);
 void cibfw_itoc_header_unpack(struct cibfw_itoc_header *ptr_struct, const u_int8_t* ptr_buff);
@@ -471,13 +584,20 @@ void cibfw_itoc_entry_print(const struct cibfw_itoc_entry *ptr_struct, FILE* fil
 int cibfw_itoc_entry_size();
 #define CIBFW_ITOC_ENTRY_SIZE    (0x20)
 void cibfw_itoc_entry_dump(const struct cibfw_itoc_entry *ptr_struct, FILE* file);
-/* Nodes */
-void cibfw_Nodes_pack(const union cibfw_Nodes *ptr_struct, u_int8_t* ptr_buff);
-void cibfw_Nodes_unpack(union cibfw_Nodes *ptr_struct, const u_int8_t* ptr_buff);
-void cibfw_Nodes_print(const union cibfw_Nodes *ptr_struct, FILE* file, int indent_level);
-int cibfw_Nodes_size();
-#define CIBFW_NODES_SIZE    (0x400)
-void cibfw_Nodes_dump(const union cibfw_Nodes *ptr_struct, FILE* file);
+/* register_mfai */
+void cibfw_register_mfai_pack(const struct cibfw_register_mfai *ptr_struct, u_int8_t* ptr_buff);
+void cibfw_register_mfai_unpack(struct cibfw_register_mfai *ptr_struct, const u_int8_t* ptr_buff);
+void cibfw_register_mfai_print(const struct cibfw_register_mfai *ptr_struct, FILE* file, int indent_level);
+int cibfw_register_mfai_size();
+#define CIBFW_REGISTER_MFAI_SIZE    (0x10)
+void cibfw_register_mfai_dump(const struct cibfw_register_mfai *ptr_struct, FILE* file);
+/* cibfw_Nodes */
+void cibfw_cibfw_Nodes_pack(const union cibfw_cibfw_Nodes *ptr_struct, u_int8_t* ptr_buff);
+void cibfw_cibfw_Nodes_unpack(union cibfw_cibfw_Nodes *ptr_struct, const u_int8_t* ptr_buff);
+void cibfw_cibfw_Nodes_print(const union cibfw_cibfw_Nodes *ptr_struct, FILE* file, int indent_level);
+int cibfw_cibfw_Nodes_size();
+#define CIBFW_CIBFW_NODES_SIZE    (0x400)
+void cibfw_cibfw_Nodes_dump(const union cibfw_cibfw_Nodes *ptr_struct, FILE* file);
 
 
 #ifdef __cplusplus
index 27523396be8fd022fb39859bc76c2e8779c1ea19..48d72f7b8bd83e45f33c942a62cdd8d0a0a3a37e 100644 (file)
@@ -1,20 +1,38 @@
-
-/*                  - Mellanox Confidential and Proprietary -
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
  *
- *  Copyright (C) 2010-2011, Mellanox Technologies Ltd.  ALL RIGHTS RESERVED.
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
  *
- *  Except as specifically permitted herein, no portion of the information,
- *  including but not limited to object code and source code, may be reproduced,
- *  modified, distributed, republished or otherwise exploited in any form or by
- *  any means for any purpose without the prior written permission of Mellanox
- *  Technologies Ltd. Use of software subject to the terms and conditions
- *  detailed in the file "LICENSE.txt".
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  *
  */
 
 /***
- *** This file was generated at "2014-07-08 14:00:34"
+ *** This file was generated at "2014-11-12 13:19:51"
  *** by:
  ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/register_access_open/register_access_open.adb --file-prefix register_access_open --prefix register_access_
  ***/
index 9e5962d0c81b3095d4b1e3588fad3c22f0d1ee52..47c5a59a62562befb5210dccae0b963274d33fb1 100644 (file)
@@ -1,20 +1,38 @@
-
-/*                  - Mellanox Confidential and Proprietary -
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
  *
- *  Copyright (C) 2010-2011, Mellanox Technologies Ltd.  ALL RIGHTS RESERVED.
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
  *
- *  Except as specifically permitted herein, no portion of the information,
- *  including but not limited to object code and source code, may be reproduced,
- *  modified, distributed, republished or otherwise exploited in any form or by
- *  any means for any purpose without the prior written permission of Mellanox
- *  Technologies Ltd. Use of software subject to the terms and conditions
- *  detailed in the file "LICENSE.txt".
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  *
  */
 
 /***
- *** This file was generated at "2014-07-08 14:00:34"
+ *** This file was generated at "2014-11-12 13:19:51"
  *** by:
  ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/register_access_open/register_access_open.adb --file-prefix register_access_open --prefix register_access_
  ***/
index 0e086a349add0616d54b98edcfc6c0545e796832..be2f5be4769c6354e3d4e5bd276faa29c6b48cbf 100644 (file)
@@ -1,20 +1,38 @@
-
-/*                  - Mellanox Confidential and Proprietary -
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
  *
- *  Copyright (C) 2010-2011, Mellanox Technologies Ltd.  ALL RIGHTS RESERVED.
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
  *
- *  Except as specifically permitted herein, no portion of the information,
- *  including but not limited to object code and source code, may be reproduced,
- *  modified, distributed, republished or otherwise exploited in any form or by
- *  any means for any purpose without the prior written permission of Mellanox
- *  Technologies Ltd. Use of software subject to the terms and conditions
- *  detailed in the file "LICENSE.txt".
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  *
  */
 
 /***
- *** This file was generated at "2014-07-08 14:00:09"
+ *** This file was generated at "2014-11-12 13:19:54"
  *** by:
  ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools_open/tools_open.adb --file-prefix tools_open --prefix tools_open_
  ***/
@@ -527,7 +545,7 @@ void tools_open_mnva_dump(const struct tools_open_mnva *ptr_struct, FILE* file)
        tools_open_mnva_print(ptr_struct, file, 0);
 }
 
-void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_query_def_params_per_port_pack(const struct tools_open_query_def_params_per_port *ptr_struct, u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
        (void)offset;
@@ -535,15 +553,217 @@ void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t*
        (void)ptr_struct;
        (void)ptr_buff;
 
-       offset=16;
-       adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->total_vfs);
+       offset=0;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->fw_default_config_payload_version);
+
+       offset=52;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->boot_vlan);
+
+       offset=44;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->boot_protocol);
+
+       offset=40;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->boot_retry_cnt);
+
+       offset=37;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->network_link_type);
+
+       offset=36;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_magic);
+
+       offset=35;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_vlan_en);
+
+       offset=34;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_option_rom_en);
+
+       offset=33;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pprx);
+
+       offset=32;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pptx);
+
+       offset=80;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->boot_pkey);
+
+       offset=104;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->iscsi_boot_to_target);
+
+       offset=101;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_vlan_en);
+
+       offset=100;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_tcp_timestamps_en);
+
+       offset=99;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_chap_mutual_auth_en);
+
+       offset=98;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_chap_auth_en);
+
+       offset=97;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_dhcp_params_en);
+
+       offset=96;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_ipv4_dhcp_en);
+
+       offset=152;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->iscsi_lun_busy_retry_cnt);
+
+       offset=144;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->iscsi_link_up_delay_time);
+
+}
+
+void tools_open_query_def_params_per_port_unpack(struct tools_open_query_def_params_per_port *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
 
        offset=0;
-       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
+       ptr_struct->fw_default_config_payload_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+       offset=52;
+       ptr_struct->boot_vlan = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
+
+       offset=44;
+       ptr_struct->boot_protocol = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+       offset=40;
+       ptr_struct->boot_retry_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+       offset=37;
+       ptr_struct->network_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+       offset=36;
+       ptr_struct->en_wol_magic = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=35;
+       ptr_struct->boot_vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=34;
+       ptr_struct->boot_option_rom_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=33;
+       ptr_struct->pprx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=32;
+       ptr_struct->pptx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=80;
+       ptr_struct->boot_pkey = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
+
+       offset=104;
+       ptr_struct->iscsi_boot_to_target = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+       offset=101;
+       ptr_struct->iscsi_vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=100;
+       ptr_struct->iscsi_tcp_timestamps_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=99;
+       ptr_struct->iscsi_chap_mutual_auth_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=98;
+       ptr_struct->iscsi_chap_auth_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=97;
+       ptr_struct->iscsi_dhcp_params_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=96;
+       ptr_struct->iscsi_ipv4_dhcp_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+       offset=152;
+       ptr_struct->iscsi_lun_busy_retry_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+       offset=144;
+       ptr_struct->iscsi_link_up_delay_time = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
 
 }
 
-void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_query_def_params_per_port_print(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== query_def_params_per_port ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "fw_default_config_payload_version : "UH_FMT"\n", ptr_struct->fw_default_config_payload_version);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "boot_vlan            : "UH_FMT"\n", ptr_struct->boot_vlan);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "boot_protocol        : "UH_FMT"\n", ptr_struct->boot_protocol);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "boot_retry_cnt       : "UH_FMT"\n", ptr_struct->boot_retry_cnt);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "network_link_type    : "UH_FMT"\n", ptr_struct->network_link_type);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "en_wol_magic         : "UH_FMT"\n", ptr_struct->en_wol_magic);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "boot_vlan_en         : "UH_FMT"\n", ptr_struct->boot_vlan_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "boot_option_rom_en   : "UH_FMT"\n", ptr_struct->boot_option_rom_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "pprx                 : "UH_FMT"\n", ptr_struct->pprx);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "pptx                 : "UH_FMT"\n", ptr_struct->pptx);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "boot_pkey            : "UH_FMT"\n", ptr_struct->boot_pkey);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_boot_to_target : "UH_FMT"\n", ptr_struct->iscsi_boot_to_target);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_vlan_en        : "UH_FMT"\n", ptr_struct->iscsi_vlan_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_tcp_timestamps_en : "UH_FMT"\n", ptr_struct->iscsi_tcp_timestamps_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_chap_mutual_auth_en : "UH_FMT"\n", ptr_struct->iscsi_chap_mutual_auth_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_chap_auth_en   : "UH_FMT"\n", ptr_struct->iscsi_chap_auth_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_dhcp_params_en : "UH_FMT"\n", ptr_struct->iscsi_dhcp_params_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_ipv4_dhcp_en   : "UH_FMT"\n", ptr_struct->iscsi_ipv4_dhcp_en);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_lun_busy_retry_cnt : "UH_FMT"\n", ptr_struct->iscsi_lun_busy_retry_cnt);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "iscsi_link_up_delay_time : "UH_FMT"\n", ptr_struct->iscsi_link_up_delay_time);
+
+}
+
+int tools_open_query_def_params_per_port_size(){
+        return 28;
+}
+
+void tools_open_query_def_params_per_port_dump(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file) {
+       tools_open_query_def_params_per_port_print(ptr_struct, file, 0);
+}
+
+void tools_open_query_def_params_global_pack(const struct tools_open_query_def_params_global *ptr_struct, u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
        (void)offset;
@@ -551,36 +771,202 @@ void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t
        (void)ptr_struct;
        (void)ptr_buff;
 
-       offset=16;
-       ptr_struct->total_vfs = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
+       offset=0;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->fw_default_config_payload_version);
+
+       offset=56;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_vfs1);
+
+       offset=52;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->uar_bar_size1);
+
+       offset=48;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->max_uar_bar_size1);
+
+       offset=32;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
+
+}
+
+void tools_open_query_def_params_global_unpack(struct tools_open_query_def_params_global *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
 
        offset=0;
+       ptr_struct->fw_default_config_payload_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+       offset=56;
+       ptr_struct->num_vfs1 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+       offset=52;
+       ptr_struct->uar_bar_size1 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+       offset=48;
+       ptr_struct->max_uar_bar_size1 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+       offset=32;
        ptr_struct->sriov_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
 
 }
 
-void tools_open_sriov_print(const struct tools_open_sriov *ptr_struct, FILE* file, int indent_level){
+void tools_open_query_def_params_global_print(const struct tools_open_query_def_params_global *ptr_struct, FILE* file, int indent_level){
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "======== sriov ========\n");
+       fprintf(file, "======== query_def_params_global ========\n");
        int i=0;
        (void)i;(void)ptr_struct;
        (void)file;
        (void)indent_level;
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "total_vfs            : "UH_FMT"\n", ptr_struct->total_vfs);
+       fprintf(file, "fw_default_config_payload_version : "UH_FMT"\n", ptr_struct->fw_default_config_payload_version);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "num_vfs1             : "UH_FMT"\n", ptr_struct->num_vfs1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "uar_bar_size1        : "UH_FMT"\n", ptr_struct->uar_bar_size1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "max_uar_bar_size1    : "UH_FMT"\n", ptr_struct->max_uar_bar_size1);
 
        adb2c_add_indentation(file, indent_level);
        fprintf(file, "sriov_en             : "UH_FMT"\n", ptr_struct->sriov_en);
 
 }
 
-int tools_open_sriov_size(){
+int tools_open_query_def_params_global_size(){
+        return 20;
+}
+
+void tools_open_query_def_params_global_dump(const struct tools_open_query_def_params_global *ptr_struct, FILE* file) {
+       tools_open_query_def_params_global_print(ptr_struct, file, 0);
+}
+
+void tools_open_phy_reg_pack(const union tools_open_phy_reg *ptr_struct, u_int8_t* ptr_buff)
+{
+       memcpy(ptr_buff, ptr_struct, 264);
+}
+
+void tools_open_phy_reg_unpack(union tools_open_phy_reg *ptr_struct, const u_int8_t* ptr_buff)
+{
+       memcpy(ptr_struct, ptr_buff, 264);
+}
+
+void tools_open_phy_reg_print(const union tools_open_phy_reg *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== phy_reg ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "pmdic:\n");
+       tools_open_pmdic_print(&(ptr_struct->pmdic), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "pmdio:\n");
+       tools_open_pmdio_print(&(ptr_struct->pmdio), file, indent_level + 1);
+
+}
+
+int tools_open_phy_reg_size(){
+        return 264;
+}
+
+void tools_open_phy_reg_dump(const union tools_open_phy_reg *ptr_struct, FILE* file) {
+       tools_open_phy_reg_print(ptr_struct, file, 0);
+}
+
+void tools_open_mnv_cfg_pack(const union tools_open_mnv_cfg *ptr_struct, u_int8_t* ptr_buff)
+{
+       memcpy(ptr_buff, ptr_struct, 256);
+}
+
+void tools_open_mnv_cfg_unpack(union tools_open_mnv_cfg *ptr_struct, const u_int8_t* ptr_buff)
+{
+       memcpy(ptr_struct, ptr_buff, 256);
+}
+
+void tools_open_mnv_cfg_print(const union tools_open_mnv_cfg *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== mnv_cfg ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "mnva:\n");
+       tools_open_mnva_print(&(ptr_struct->mnva), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "mnvi:\n");
+       tools_open_mnvi_print(&(ptr_struct->mnvi), file, indent_level + 1);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "mnvia:\n");
+       tools_open_mnvia_print(&(ptr_struct->mnvia), file, indent_level + 1);
+
+}
+
+int tools_open_mnv_cfg_size(){
+        return 256;
+}
+
+void tools_open_mnv_cfg_dump(const union tools_open_mnv_cfg *ptr_struct, FILE* file) {
+       tools_open_mnv_cfg_print(ptr_struct, file, 0);
+}
+
+void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_struct, u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=30;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->network_link_type);
+
+}
+
+void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct, const u_int8_t* ptr_buff){
+       u_int32_t offset;
+       int i=0;
+       (void)offset;
+       (void)i;
+       (void)ptr_struct;
+       (void)ptr_buff;
+
+       offset=30;
+       ptr_struct->network_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+}
+
+void tools_open_vpi_settings_print(const struct tools_open_vpi_settings *ptr_struct, FILE* file, int indent_level){
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "======== vpi_settings ========\n");
+       int i=0;
+       (void)i;(void)ptr_struct;
+       (void)file;
+       (void)indent_level;
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "network_link_type    : "UH_FMT"\n", ptr_struct->network_link_type);
+
+}
+
+int tools_open_vpi_settings_size(){
         return 4;
 }
 
-void tools_open_sriov_dump(const struct tools_open_sriov *ptr_struct, FILE* file) {
-       tools_open_sriov_print(ptr_struct, file, 0);
+void tools_open_vpi_settings_dump(const struct tools_open_vpi_settings *ptr_struct, FILE* file) {
+       tools_open_vpi_settings_print(ptr_struct, file, 0);
 }
 
 void tools_open_bar_size_pack(const struct tools_open_bar_size *ptr_struct, u_int8_t* ptr_buff){
@@ -630,7 +1016,7 @@ void tools_open_bar_size_dump(const struct tools_open_bar_size *ptr_struct, FILE
        tools_open_bar_size_print(ptr_struct, file, 0);
 }
 
-void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
        (void)offset;
@@ -638,12 +1024,15 @@ void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_stru
        (void)ptr_struct;
        (void)ptr_buff;
 
-       offset=30;
-       adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->network_link_type);
+       offset=16;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->total_vfs);
+
+       offset=0;
+       adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
 
 }
 
-void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t* ptr_buff){
        u_int32_t offset;
        int i=0;
        (void)offset;
@@ -651,30 +1040,36 @@ void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct,
        (void)ptr_struct;
        (void)ptr_buff;
 
-       offset=30;
-       ptr_struct->network_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+       offset=16;
+       ptr_struct->total_vfs = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
+
+       offset=0;
+       ptr_struct->sriov_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
 
 }
 
-void tools_open_vpi_settings_print(const struct tools_open_vpi_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_sriov_print(const struct tools_open_sriov *ptr_struct, FILE* file, int indent_level){
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "======== vpi_settings ========\n");
+       fprintf(file, "======== sriov ========\n");
        int i=0;
        (void)i;(void)ptr_struct;
        (void)file;
        (void)indent_level;
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "network_link_type    : "UH_FMT"\n", ptr_struct->network_link_type);
+       fprintf(file, "total_vfs            : "UH_FMT"\n", ptr_struct->total_vfs);
+
+       adb2c_add_indentation(file, indent_level);
+       fprintf(file, "sriov_en             : "UH_FMT"\n", ptr_struct->sriov_en);
 
 }
 
-int tools_open_vpi_settings_size(){
+int tools_open_sriov_size(){
         return 4;
 }
 
-void tools_open_vpi_settings_dump(const struct tools_open_vpi_settings *ptr_struct, FILE* file) {
-       tools_open_vpi_settings_print(ptr_struct, file, 0);
+void tools_open_sriov_dump(const struct tools_open_sriov *ptr_struct, FILE* file) {
+       tools_open_sriov_print(ptr_struct, file, 0);
 }
 
 void tools_open_wol_pack(const struct tools_open_wol *ptr_struct, u_int8_t* ptr_buff){
@@ -778,80 +1173,76 @@ void tools_open_wol_dump(const struct tools_open_wol *ptr_struct, FILE* file) {
        tools_open_wol_print(ptr_struct, file, 0);
 }
 
-void tools_open_phy_reg_pack(const union tools_open_phy_reg *ptr_struct, u_int8_t* ptr_buff)
+void tools_open_hcr_cmds_pack(const union tools_open_hcr_cmds *ptr_struct, u_int8_t* ptr_buff)
 {
        memcpy(ptr_buff, ptr_struct, 264);
 }
 
-void tools_open_phy_reg_unpack(union tools_open_phy_reg *ptr_struct, const u_int8_t* ptr_buff)
+void tools_open_hcr_cmds_unpack(union tools_open_hcr_cmds *ptr_struct, const u_int8_t* ptr_buff)
 {
        memcpy(ptr_struct, ptr_buff, 264);
 }
 
-void tools_open_phy_reg_print(const union tools_open_phy_reg *ptr_struct, FILE* file, int indent_level){
+void tools_open_hcr_cmds_print(const union tools_open_hcr_cmds *ptr_struct, FILE* file, int indent_level){
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "======== phy_reg ========\n");
+       fprintf(file, "======== hcr_cmds ========\n");
        int i=0;
        (void)i;(void)ptr_struct;
        (void)file;
        (void)indent_level;
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "pmdic:\n");
-       tools_open_pmdic_print(&(ptr_struct->pmdic), file, indent_level + 1);
+       fprintf(file, "query_def_params_global:\n");
+       tools_open_query_def_params_global_print(&(ptr_struct->query_def_params_global), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "pmdio:\n");
-       tools_open_pmdio_print(&(ptr_struct->pmdio), file, indent_level + 1);
+       fprintf(file, "query_def_params_per_port:\n");
+       tools_open_query_def_params_per_port_print(&(ptr_struct->query_def_params_per_port), file, indent_level + 1);
 
 }
 
-int tools_open_phy_reg_size(){
+int tools_open_hcr_cmds_size(){
         return 264;
 }
 
-void tools_open_phy_reg_dump(const union tools_open_phy_reg *ptr_struct, FILE* file) {
-       tools_open_phy_reg_print(ptr_struct, file, 0);
+void tools_open_hcr_cmds_dump(const union tools_open_hcr_cmds *ptr_struct, FILE* file) {
+       tools_open_hcr_cmds_print(ptr_struct, file, 0);
 }
 
-void tools_open_mnv_cfg_pack(const union tools_open_mnv_cfg *ptr_struct, u_int8_t* ptr_buff)
+void tools_open_access_registers_pack(const union tools_open_access_registers *ptr_struct, u_int8_t* ptr_buff)
 {
-       memcpy(ptr_buff, ptr_struct, 256);
+       memcpy(ptr_buff, ptr_struct, 512);
 }
 
-void tools_open_mnv_cfg_unpack(union tools_open_mnv_cfg *ptr_struct, const u_int8_t* ptr_buff)
+void tools_open_access_registers_unpack(union tools_open_access_registers *ptr_struct, const u_int8_t* ptr_buff)
 {
-       memcpy(ptr_struct, ptr_buff, 256);
+       memcpy(ptr_struct, ptr_buff, 512);
 }
 
-void tools_open_mnv_cfg_print(const union tools_open_mnv_cfg *ptr_struct, FILE* file, int indent_level){
+void tools_open_access_registers_print(const union tools_open_access_registers *ptr_struct, FILE* file, int indent_level){
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "======== mnv_cfg ========\n");
+       fprintf(file, "======== access_registers ========\n");
        int i=0;
        (void)i;(void)ptr_struct;
        (void)file;
        (void)indent_level;
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "mnva:\n");
-       tools_open_mnva_print(&(ptr_struct->mnva), file, indent_level + 1);
+       fprintf(file, "MNVReg:\n");
+       tools_open_mnv_cfg_print(&(ptr_struct->MNVReg), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "mnvi:\n");
-       tools_open_mnvi_print(&(ptr_struct->mnvi), file, indent_level + 1);
-
-       adb2c_add_indentation(file, indent_level);
-       fprintf(file, "mnvia:\n");
-       tools_open_mnvia_print(&(ptr_struct->mnvia), file, indent_level + 1);
+       fprintf(file, "PhyReg:\n");
+       tools_open_phy_reg_print(&(ptr_struct->PhyReg), file, indent_level + 1);
 
 }
 
-int tools_open_mnv_cfg_size(){
-        return 256;
+int tools_open_access_registers_size(){
+        return 512;
 }
 
-void tools_open_mnv_cfg_dump(const union tools_open_mnv_cfg *ptr_struct, FILE* file) {
-       tools_open_mnv_cfg_print(ptr_struct, file, 0);
+void tools_open_access_registers_dump(const union tools_open_access_registers *ptr_struct, FILE* file) {
+       tools_open_access_registers_print(ptr_struct, file, 0);
 }
 
 void tools_open_nv_cfg_pack(const union tools_open_nv_cfg *ptr_struct, u_int8_t* ptr_buff)
@@ -877,16 +1268,16 @@ void tools_open_nv_cfg_print(const union tools_open_nv_cfg *ptr_struct, FILE* fi
        tools_open_wol_print(&(ptr_struct->wol), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "vpi_settings:\n");
-       tools_open_vpi_settings_print(&(ptr_struct->vpi_settings), file, indent_level + 1);
+       fprintf(file, "sriov:\n");
+       tools_open_sriov_print(&(ptr_struct->sriov), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
        fprintf(file, "bar_size:\n");
        tools_open_bar_size_print(&(ptr_struct->bar_size), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "sriov:\n");
-       tools_open_sriov_print(&(ptr_struct->sriov), file, indent_level + 1);
+       fprintf(file, "vpi_settings:\n");
+       tools_open_vpi_settings_print(&(ptr_struct->vpi_settings), file, indent_level + 1);
 
 }
 
@@ -921,12 +1312,12 @@ void tools_open_tools_open_print(const union tools_open_tools_open *ptr_struct,
        tools_open_nv_cfg_print(&(ptr_struct->NVConfig), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "MNV_Reg:\n");
-       tools_open_mnv_cfg_print(&(ptr_struct->MNV_Reg), file, indent_level + 1);
+       fprintf(file, "AceessRegisters:\n");
+       tools_open_access_registers_print(&(ptr_struct->AceessRegisters), file, indent_level + 1);
 
        adb2c_add_indentation(file, indent_level);
-       fprintf(file, "Phy_Reg:\n");
-       tools_open_phy_reg_print(&(ptr_struct->Phy_Reg), file, indent_level + 1);
+       fprintf(file, "HcrCmds:\n");
+       tools_open_hcr_cmds_print(&(ptr_struct->HcrCmds), file, indent_level + 1);
 
 }
 
index 7cc9234e77ba2c1646077be3042bc2454ef0aeba..e91953430520f7f01d25e88cf48f4b9e4e644fbe 100644 (file)
@@ -1,20 +1,38 @@
-
-/*                  - Mellanox Confidential and Proprietary -
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
  *
- *  Copyright (C) 2010-2011, Mellanox Technologies Ltd.  ALL RIGHTS RESERVED.
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
  *
- *  Except as specifically permitted herein, no portion of the information,
- *  including but not limited to object code and source code, may be reproduced,
- *  modified, distributed, republished or otherwise exploited in any form or by
- *  any means for any purpose without the prior written permission of Mellanox
- *  Technologies Ltd. Use of software subject to the terms and conditions
- *  detailed in the file "LICENSE.txt".
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  *
  */
 
 /***
- *** This file was generated at "2014-07-08 14:00:09"
+ *** This file was generated at "2014-11-12 13:19:54"
  *** by:
  ***    > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools_open/tools_open.adb --file-prefix tools_open --prefix tools_open_
  ***/
@@ -185,24 +203,122 @@ struct tools_open_mnva {
 };
 
 /* Description -   */
-/* Size in bytes - 4 */
-struct tools_open_sriov {
+/* Size in bytes - 28 */
+struct tools_open_query_def_params_per_port {
 /*---------------- DWORD[0] (Offset 0x0) ----------------*/
-       /* Description - The total number of VFs that can be supported. */
-       /* 0.0 - 0.15 */
-        u_int16_t total_vfs;
-       /* Description - 1 when SRIOV is enabled: SRIOV capability will appear on the PCI configuration header. */
-       /* 0.31 - 4.31 */
+       /* Description -  */
+       /* 0.24 - 4.31 */
+        u_int8_t fw_default_config_payload_version;
+/*---------------- DWORD[1] (Offset 0x4) ----------------*/
+       /* Description -  */
+       /* 4.0 - 4.11 */
+        u_int16_t boot_vlan;
+       /* Description -  */
+       /* 4.16 - 4.19 */
+        u_int8_t boot_protocol;
+       /* Description -  */
+       /* 4.20 - 4.23 */
+        u_int8_t boot_retry_cnt;
+       /* Description -  */
+       /* 4.25 - 4.26 */
+        u_int8_t network_link_type;
+       /* Description -  */
+       /* 4.27 - 4.27 */
+        u_int8_t en_wol_magic;
+       /* Description -  */
+       /* 4.28 - 4.28 */
+        u_int8_t boot_vlan_en;
+       /* Description -  */
+       /* 4.29 - 4.29 */
+        u_int8_t boot_option_rom_en;
+       /* Description -  */
+       /* 4.30 - 4.30 */
+        u_int8_t pprx;
+       /* Description -  */
+       /* 4.31 - 8.31 */
+        u_int8_t pptx;
+/*---------------- DWORD[2] (Offset 0x8) ----------------*/
+       /* Description -  */
+       /* 8.0 - 8.15 */
+        u_int16_t boot_pkey;
+/*---------------- DWORD[3] (Offset 0xc) ----------------*/
+       /* Description -  */
+       /* 12.22 - 12.23 */
+        u_int8_t iscsi_boot_to_target;
+       /* Description -  */
+       /* 12.26 - 12.26 */
+        u_int8_t iscsi_vlan_en;
+       /* Description -  */
+       /* 12.27 - 12.27 */
+        u_int8_t iscsi_tcp_timestamps_en;
+       /* Description -  */
+       /* 12.28 - 12.28 */
+        u_int8_t iscsi_chap_mutual_auth_en;
+       /* Description -  */
+       /* 12.29 - 12.29 */
+        u_int8_t iscsi_chap_auth_en;
+       /* Description -  */
+       /* 12.30 - 12.30 */
+        u_int8_t iscsi_dhcp_params_en;
+       /* Description -  */
+       /* 12.31 - 16.31 */
+        u_int8_t iscsi_ipv4_dhcp_en;
+/*---------------- DWORD[4] (Offset 0x10) ----------------*/
+       /* Description -  */
+       /* 16.0 - 16.7 */
+        u_int8_t iscsi_lun_busy_retry_cnt;
+       /* Description -  */
+       /* 16.8 - 16.15 */
+        u_int8_t iscsi_link_up_delay_time;
+};
+
+/* Description -   */
+/* Size in bytes - 20 */
+struct tools_open_query_def_params_global {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description -  */
+       /* 0.24 - 4.31 */
+        u_int8_t fw_default_config_payload_version;
+/*---------------- DWORD[1] (Offset 0x4) ----------------*/
+       /* Description - default number of virtual functions */
+       /* 4.0 - 4.7 */
+        u_int8_t num_vfs1;
+       /* Description - default uar bar size (log2 format) */
+       /* 4.8 - 4.11 */
+        u_int8_t uar_bar_size1;
+       /* Description - maximum value allowed for the uar bar size (log2 base) */
+       /* 4.12 - 4.15 */
+        u_int8_t max_uar_bar_size1;
+       /* Description - default value of sriov (enabled or disabled) */
+       /* 4.31 - 8.31 */
         u_int8_t sriov_en;
 };
 
 /* Description -   */
-/* Size in bytes - 4 */
-struct tools_open_bar_size {
+/* Size in bytes - 264 */
+union tools_open_phy_reg {
 /*---------------- DWORD[0] (Offset 0x0) ----------------*/
-       /* Description - Base 2 log of the size of the physical function\92s first BAR, in MBs. E.g. for 8MB the value is 3. */
-       /* 0.0 - 4.31 */
-        u_int32_t log_uar_bar_size;
+       /* Description -  */
+       /* 0.0 - 12.31 */
+        struct tools_open_pmdic pmdic;
+       /* Description -  */
+       /* 0.0 - 264.31 */
+        struct tools_open_pmdio pmdio;
+};
+
+/* Description -   */
+/* Size in bytes - 256 */
+union tools_open_mnv_cfg {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description -  */
+       /* 0.0 - 256.31 */
+        struct tools_open_mnva mnva;
+       /* Description -  */
+       /* 0.0 - 8.31 */
+        struct tools_open_mnvi mnvi;
+       /* Description -  */
+       /* 0.0 - 8.31 */
+        struct tools_open_mnvia mnvia;
 };
 
 /* Description -   */
@@ -217,6 +333,27 @@ struct tools_open_vpi_settings {
         u_int8_t network_link_type;
 };
 
+/* Description -   */
+/* Size in bytes - 4 */
+struct tools_open_bar_size {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description - Base 2 log of the size of the physical function\92s first BAR, in MBs. E.g. for 8MB the value is 3. */
+       /* 0.0 - 4.31 */
+        u_int32_t log_uar_bar_size;
+};
+
+/* Description -   */
+/* Size in bytes - 4 */
+struct tools_open_sriov {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+       /* Description - The total number of VFs that can be supported. */
+       /* 0.0 - 0.15 */
+        u_int16_t total_vfs;
+       /* Description - 1 when SRIOV is enabled: SRIOV capability will appear on the PCI configuration header. */
+       /* 0.31 - 4.31 */
+        u_int8_t sriov_en;
+};
+
 /* Description -   */
 /* Size in bytes - 8 */
 struct tools_open_wol {
@@ -246,29 +383,26 @@ struct tools_open_wol {
 
 /* Description -   */
 /* Size in bytes - 264 */
-union tools_open_phy_reg {
+union tools_open_hcr_cmds {
 /*---------------- DWORD[0] (Offset 0x0) ----------------*/
        /* Description -  */
-       /* 0.0 - 12.31 */
-        struct tools_open_pmdic pmdic;
+       /* 0.0 - 20.31 */
+        struct tools_open_query_def_params_global query_def_params_global;
        /* Description -  */
-       /* 0.0 - 264.31 */
-        struct tools_open_pmdio pmdio;
+       /* 0.0 - 28.31 */
+        struct tools_open_query_def_params_per_port query_def_params_per_port;
 };
 
 /* Description -   */
-/* Size in bytes - 256 */
-union tools_open_mnv_cfg {
+/* Size in bytes - 512 */
+union tools_open_access_registers {
 /*---------------- DWORD[0] (Offset 0x0) ----------------*/
-       /* Description -  */
+       /* Description - Misc NV Registers, this is temporary untill we integrate with fw db */
        /* 0.0 - 256.31 */
-        struct tools_open_mnva mnva;
-       /* Description -  */
-       /* 0.0 - 8.31 */
-        struct tools_open_mnvi mnvi;
-       /* Description -  */
-       /* 0.0 - 8.31 */
-        struct tools_open_mnvia mnvia;
+        union tools_open_mnv_cfg MNVReg;
+       /* Description - Register for accessing FW managed external PHY */
+       /* 0.0 - 264.31 */
+        union tools_open_phy_reg PhyReg;
 };
 
 /* Description -   */
@@ -280,13 +414,13 @@ union tools_open_nv_cfg {
         struct tools_open_wol wol;
        /* Description -  */
        /* 0.0 - 4.31 */
-        struct tools_open_vpi_settings vpi_settings;
+        struct tools_open_sriov sriov;
        /* Description -  */
        /* 0.0 - 4.31 */
         struct tools_open_bar_size bar_size;
        /* Description -  */
        /* 0.0 - 4.31 */
-        struct tools_open_sriov sriov;
+        struct tools_open_vpi_settings vpi_settings;
 };
 
 /* Description -   */
@@ -296,12 +430,12 @@ union tools_open_tools_open {
        /* Description - Non-Volatile Cfg Tlvs */
        /* 0.0 - 256.31 */
         union tools_open_nv_cfg NVConfig;
-       /* Description - Misc NV Registers, this is temporary untill we integrate with fw db */
-       /* 0.0 - 256.31 */
-        union tools_open_mnv_cfg MNV_Reg;
-       /* Description - Register for accessing FW managed external PHY */
+       /* Description - various registers in specific use by the tools */
+       /* 0.0 - 512.31 */
+        union tools_open_access_registers AceessRegisters;
+       /* Description - Tools HCR commands structs */
        /* 0.0 - 264.31 */
-        union tools_open_phy_reg Phy_Reg;
+        union tools_open_hcr_cmds HcrCmds;
 };
 
 /* Description -   */
@@ -368,34 +502,20 @@ void tools_open_mnva_print(const struct tools_open_mnva *ptr_struct, FILE* file,
 int tools_open_mnva_size();
 #define TOOLS_OPEN_MNVA_SIZE    (0x100)
 void tools_open_mnva_dump(const struct tools_open_mnva *ptr_struct, FILE* file);
-/* sriov */
-void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_sriov_print(const struct tools_open_sriov *ptr_struct, FILE* file, int indent_level);
-int tools_open_sriov_size();
-#define TOOLS_OPEN_SRIOV_SIZE    (0x4)
-void tools_open_sriov_dump(const struct tools_open_sriov *ptr_struct, FILE* file);
-/* bar_size */
-void tools_open_bar_size_pack(const struct tools_open_bar_size *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_bar_size_unpack(struct tools_open_bar_size *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_bar_size_print(const struct tools_open_bar_size *ptr_struct, FILE* file, int indent_level);
-int tools_open_bar_size_size();
-#define TOOLS_OPEN_BAR_SIZE_SIZE    (0x4)
-void tools_open_bar_size_dump(const struct tools_open_bar_size *ptr_struct, FILE* file);
-/* vpi_settings */
-void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_vpi_settings_print(const struct tools_open_vpi_settings *ptr_struct, FILE* file, int indent_level);
-int tools_open_vpi_settings_size();
-#define TOOLS_OPEN_VPI_SETTINGS_SIZE    (0x4)
-void tools_open_vpi_settings_dump(const struct tools_open_vpi_settings *ptr_struct, FILE* file);
-/* wol */
-void tools_open_wol_pack(const struct tools_open_wol *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_wol_unpack(struct tools_open_wol *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_wol_print(const struct tools_open_wol *ptr_struct, FILE* file, int indent_level);
-int tools_open_wol_size();
-#define TOOLS_OPEN_WOL_SIZE    (0x8)
-void tools_open_wol_dump(const struct tools_open_wol *ptr_struct, FILE* file);
+/* query_def_params_per_port */
+void tools_open_query_def_params_per_port_pack(const struct tools_open_query_def_params_per_port *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_query_def_params_per_port_unpack(struct tools_open_query_def_params_per_port *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_query_def_params_per_port_print(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file, int indent_level);
+int tools_open_query_def_params_per_port_size();
+#define TOOLS_OPEN_QUERY_DEF_PARAMS_PER_PORT_SIZE    (0x1c)
+void tools_open_query_def_params_per_port_dump(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file);
+/* query_def_params_global */
+void tools_open_query_def_params_global_pack(const struct tools_open_query_def_params_global *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_query_def_params_global_unpack(struct tools_open_query_def_params_global *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_query_def_params_global_print(const struct tools_open_query_def_params_global *ptr_struct, FILE* file, int indent_level);
+int tools_open_query_def_params_global_size();
+#define TOOLS_OPEN_QUERY_DEF_PARAMS_GLOBAL_SIZE    (0x14)
+void tools_open_query_def_params_global_dump(const struct tools_open_query_def_params_global *ptr_struct, FILE* file);
 /* phy_reg */
 void tools_open_phy_reg_pack(const union tools_open_phy_reg *ptr_struct, u_int8_t* ptr_buff);
 void tools_open_phy_reg_unpack(union tools_open_phy_reg *ptr_struct, const u_int8_t* ptr_buff);
@@ -410,6 +530,48 @@ void tools_open_mnv_cfg_print(const union tools_open_mnv_cfg *ptr_struct, FILE*
 int tools_open_mnv_cfg_size();
 #define TOOLS_OPEN_MNV_CFG_SIZE    (0x100)
 void tools_open_mnv_cfg_dump(const union tools_open_mnv_cfg *ptr_struct, FILE* file);
+/* vpi_settings */
+void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_vpi_settings_print(const struct tools_open_vpi_settings *ptr_struct, FILE* file, int indent_level);
+int tools_open_vpi_settings_size();
+#define TOOLS_OPEN_VPI_SETTINGS_SIZE    (0x4)
+void tools_open_vpi_settings_dump(const struct tools_open_vpi_settings *ptr_struct, FILE* file);
+/* bar_size */
+void tools_open_bar_size_pack(const struct tools_open_bar_size *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_bar_size_unpack(struct tools_open_bar_size *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_bar_size_print(const struct tools_open_bar_size *ptr_struct, FILE* file, int indent_level);
+int tools_open_bar_size_size();
+#define TOOLS_OPEN_BAR_SIZE_SIZE    (0x4)
+void tools_open_bar_size_dump(const struct tools_open_bar_size *ptr_struct, FILE* file);
+/* sriov */
+void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_sriov_print(const struct tools_open_sriov *ptr_struct, FILE* file, int indent_level);
+int tools_open_sriov_size();
+#define TOOLS_OPEN_SRIOV_SIZE    (0x4)
+void tools_open_sriov_dump(const struct tools_open_sriov *ptr_struct, FILE* file);
+/* wol */
+void tools_open_wol_pack(const struct tools_open_wol *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_wol_unpack(struct tools_open_wol *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_wol_print(const struct tools_open_wol *ptr_struct, FILE* file, int indent_level);
+int tools_open_wol_size();
+#define TOOLS_OPEN_WOL_SIZE    (0x8)
+void tools_open_wol_dump(const struct tools_open_wol *ptr_struct, FILE* file);
+/* hcr_cmds */
+void tools_open_hcr_cmds_pack(const union tools_open_hcr_cmds *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_hcr_cmds_unpack(union tools_open_hcr_cmds *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_hcr_cmds_print(const union tools_open_hcr_cmds *ptr_struct, FILE* file, int indent_level);
+int tools_open_hcr_cmds_size();
+#define TOOLS_OPEN_HCR_CMDS_SIZE    (0x108)
+void tools_open_hcr_cmds_dump(const union tools_open_hcr_cmds *ptr_struct, FILE* file);
+/* access_registers */
+void tools_open_access_registers_pack(const union tools_open_access_registers *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_access_registers_unpack(union tools_open_access_registers *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_access_registers_print(const union tools_open_access_registers *ptr_struct, FILE* file, int indent_level);
+int tools_open_access_registers_size();
+#define TOOLS_OPEN_ACCESS_REGISTERS_SIZE    (0x200)
+void tools_open_access_registers_dump(const union tools_open_access_registers *ptr_struct, FILE* file);
 /* nv_cfg */
 void tools_open_nv_cfg_pack(const union tools_open_nv_cfg *ptr_struct, u_int8_t* ptr_buff);
 void tools_open_nv_cfg_unpack(union tools_open_nv_cfg *ptr_struct, const u_int8_t* ptr_buff);