- 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)
# 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
--- /dev/null
+# 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
+
--- /dev/null
+/*
+ * 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);
+}
+
--- /dev/null
+/*
+ * 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 */
#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.
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
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 )
+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
-- Omer Dagan <omerd@unknown> Tue, 25 Dec 2013 16:49:33 +0200
+
mstflint (3.0) unstable; urgency=low
* Initial Debian release
/*
- * 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
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,
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);
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
}
#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
#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
// ------------------
}
// 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);
*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++) {
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.
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;
return MFE_OK;
}
-
-
-
////////////////////////////////////////
//
// InfiniHostIIILx spi access functions
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);
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;
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;
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;
}
-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;
#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) {
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;
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;
return MFE_OK;
}
-#ifndef MST_UL
+
int icmd_init(mflash *mfl)
{
// Clear semaphore when asked to by flint or any tool using mflash
}
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;
}
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;
}
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;
}
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 {
}
-
int mf_open_uefi(mflash** pmfl, uefi_Dev_t *uefi_dev, f_fw_cmd fw_cmd_func)
{
return MFE_OK;
}
-int mf_close (mflash* mfl) {
+void mf_close (mflash* mfl) {
if (!mfl) {
- return MFE_BAD_PARAMS;
+ return;
}
if (mfl->f_reset) {
}
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);
}
free(mfl);
- return MFE_OK;
+ return;
}
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";
}
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);
}
* 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
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
- * Version: $Id: $
- *
*/
+
#ifndef MFLASH_H
#define MFLASH_H
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:
* 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>
} 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;
}
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;
}
* 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
*
* 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
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;
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;
*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) {
* 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
*
ATBM_INBAND,
ATBM_MLNXOS_CMDIF,
ATBM_ICMD,
+ ATBM_TOOLS_CMDIF,
};
/*
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);
MFE_REG_ACCESS_MSG_RECPT_ACK,
MFE_REG_ACCESS_UNKNOWN_ERR,
MFE_REG_ACCESS_SIZE_EXCCEEDS_LIMIT,
+ MFE_PCICONF,
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\
* 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
#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"
# define DEBUG_PRINT_RECIEVE(data_struct, struct_name)
#endif
+#define CHECK_RC(rc)\
+ if (rc) return rc;
/*
* Enum for handling error messages
*/
MCE_INCOMPLETE_PARAMS,
MCE_OPEN_DEVICE,
MCE_PCICONF,
+ MCE_GET_DEFAULT_PARAMS,
MCE_UNKNOWN_ERR
}McStatus;
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;
_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) {
}
// 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;
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()];
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));
}
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;
}
* 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) ) {
}
// 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;
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;
* 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) ) {
}
// 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;
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;
}
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)
{
}
// 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;
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;
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);
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
}
#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;
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();
}
if (!isLegal(cfg)) {
return false;
}
- if (cfg == Mct_Bar_Size) { // dont enable these just yet, no FW support
- return false;
- }
+
return _suppVec & cfgSuppMask[cfg];
}
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)]);
}
{
// 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)) {
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));
}
* 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
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
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
};
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;
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);
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;
};
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);
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;
};
* 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>
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");
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");
}
}
// 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;
} 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;
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]));
* 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>
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;
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;
}
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;
case Mc_Reset:
ret = resetDevsCfg();
break;
+ case Mc_Clr_Sem:
+ ret = clrDevSem();
+ break;
default:
// should not reach here.
return err(true, "invalid command.");
* 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_
Mc_Set,
Mc_Query,
Mc_Reset,
+ Mc_Clr_Sem,
Mc_UnknownCmd
} mlxCfgCmd;
// reset Cmd
mlxCfgStatus resetDevsCfg();
mlxCfgStatus resetDevCfg(const char* dev);
+
+ mlxCfgStatus clrDevSem();
//
mlxCfgStatus test(const char* dev);
#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
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,
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);
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.");
}
}
}
- } 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++))
}
}
}
+
// Report
if (verbose) {
printf("\r%s%%100", message);
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();
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());
}
#include <algorithm>
#include <vector>
+#include <tools_utils.h>
#include <mtcr.h>
#include <reg_access/reg_access.h>
{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"},
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;
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;
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);
}
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;
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;
}
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;
// 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);
}
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
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());
}
}
}
// 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());
}
}
}
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()) {
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;
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 {
{
struct cibfw_device_info dev_info;
cibfw_device_info_unpack(&dev_info, (u_int8_t*)§ion_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]);
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)) {
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
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;
}
}
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)) {
#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
( ((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 {
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() {
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
{ "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
};
{"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
};
}
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];
}
-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) \
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 ðDev);
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);
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);
CT_BRIDGEX,
CT_IS4,
CT_CONNECT_IB,
- CT_SWITCH_IB
+ CT_SWITCH_IB,
+ CT_SWITCH_EN
}chip_type_t;
typedef struct guid {
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
* 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.
+ *
*/
/*
*
*/
+/********************************************************
+**
+* 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
#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
}
// 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;
if (h->use_smp) {
return MAX_IB_SMP_DATA_SIZE;
}
- return IB_VENDOR_RANGE2_DATA_SIZE;
+ return MAX_VS_DATA_SIZE;
}
/********************************************************
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);
* 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
-
/*
- - 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>
#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
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);
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;
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;
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)
*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;
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)
{
* 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 */
#include <compatibility.h>
-#ifdef MST_UL_ICMD
+#ifdef MST_UL
#include <mtcr_int_defs.h>
#endif
#include <mtcr.h>
// 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
*
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
*
*/
-
//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)
{
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) {
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;
}
{
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);
// Get list of devices
do {
- if (devs)
+ if (devs) {
free(devs);
+ }
size *= 2;
devs = (char*)malloc(size);
rc = mdevices(devs, size, mask);
if ( rc <= 0 ) {
len = 0;
+ if (devs) {
+ free(devs);
+ }
return NULL;
}
// For each device read
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;
{
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) {
* 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
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);
}
// 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 ) {
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;
}
#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 :
}
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;
}
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;
}
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:
#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_
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
************************************/
#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>
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
}
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
* 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"
/************************************
* 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
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
//for htonl etc...
#if defined(_WIN32) || defined(_WIN64)
* 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_
***/
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;
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;
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){
}
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){
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(){
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;
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);
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);
}
-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);
}
* 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_
***/
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 {
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 {
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 - */
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 {
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 - */
/* 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 - */
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);
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);
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);
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
-
-/* - 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_
***/
-
-/* - 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_
***/
-
-/* - 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_
***/
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;
(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;
(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){
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;
(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;
(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){
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)
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);
}
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);
}
-
-/* - 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_
***/
};
/* 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 - */
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 {
/* 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 - */
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 - */
/* 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 - */
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);
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);