diff options
| author | Benjamin Drung <benjamin.drung@cloud.ionos.com> | 2020-02-17 12:58:21 +0100 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2020-02-17 16:37:52 +0000 |
| commit | 5224041de03bb5f267037dfcbbc8c10453b91d64 (patch) | |
| tree | dcf55bec3e057ad0e5259c622a2c6bcbfcd11ad4 | |
| parent | e923c26736e661c278f771861b47823f470a8115 (diff) | |
4.13.3+2-1 (patches unapplied)import/4.13.3+2-1
Imported using git-ubuntu import.
Notes
Notes: * New upstream release (Closes: #951417) * Drop spelling mistake fix (accepted upstream) * Refresh remaining patches * Bump Standards-Version to 4.5.0 (no changes required)
145 files changed, 4692 insertions, 930 deletions
diff --git a/Makefile.am b/Makefile.am index f241860..0de2fe6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,11 +30,11 @@ # SOFTWARE. #-- -SUBDIRS = common mft_utils ext_libs $(TOOLS_CRYPTO) tools_layouts ${MTCR_CONF_DIR} mtcr_py $(MAD_IFC) reg_access cmdif $(XZ_UTILS_DIR) dev_mgt tools_res_mgmt mvpd mflash fw_comps_mgr libmfa pldmlib mlxconfig mlxfwops cmdparser $(FW_MGR_TOOLS) flint small_utils mstdump ${ADABE_TOOLS} tracers +SUBDIRS = common mft_utils ext_libs $(TOOLS_CRYPTO) tools_layouts ${MTCR_CONF_DIR} mtcr_py $(MAD_IFC) reg_access cmdif $(XZ_UTILS_DIR) dev_mgt tools_res_mgmt mvpd mflash fw_comps_mgr libmfa pldmlib mlxconfig mlxfwops cmdparser $(FW_MGR_TOOLS) flint small_utils mstdump ${ADABE_TOOLS} tracers resourcedump DIST_SUBDIRS = tracers -man_MANS = man/mstflint.1 man/mstconfig.1 man/mstmcra.1 man/mstmread.1 man/mstmwrite.1 man/mstmtserver.1 man/mstregdump.1 man/mstvpd.1 man/mstprivhost.1 man/mstarchive.1 man/mstreg.1 man/mstfwtrace.1 man/mstlink.1 man/mstcongestion.1 man/mstfwmanager.1 man/mstfwreset.1 +man_MANS = man/mstflint.1 man/mstconfig.1 man/mstmcra.1 man/mstmread.1 man/mstmwrite.1 man/mstmtserver.1 man/mstregdump.1 man/mstvpd.1 man/mstprivhost.1 man/mstarchive.1 man/mstreg.1 man/mstfwtrace.1 man/mstlink.1 man/mstcongestion.1 man/mstfwmanager.1 man/mstfwreset.1 man/mstresourcedump.1 EXTRA_DIST = \ mstflint.spec \ diff --git a/Makefile.in b/Makefile.in index 2de811c..dcc8dfa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -405,9 +405,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = common mft_utils ext_libs $(TOOLS_CRYPTO) tools_layouts ${MTCR_CONF_DIR} mtcr_py $(MAD_IFC) reg_access cmdif $(XZ_UTILS_DIR) dev_mgt tools_res_mgmt mvpd mflash fw_comps_mgr libmfa pldmlib mlxconfig mlxfwops cmdparser $(FW_MGR_TOOLS) flint small_utils mstdump ${ADABE_TOOLS} tracers +SUBDIRS = common mft_utils ext_libs $(TOOLS_CRYPTO) tools_layouts ${MTCR_CONF_DIR} mtcr_py $(MAD_IFC) reg_access cmdif $(XZ_UTILS_DIR) dev_mgt tools_res_mgmt mvpd mflash fw_comps_mgr libmfa pldmlib mlxconfig mlxfwops cmdparser $(FW_MGR_TOOLS) flint small_utils mstdump ${ADABE_TOOLS} tracers resourcedump DIST_SUBDIRS = tracers -man_MANS = man/mstflint.1 man/mstconfig.1 man/mstmcra.1 man/mstmread.1 man/mstmwrite.1 man/mstmtserver.1 man/mstregdump.1 man/mstvpd.1 man/mstprivhost.1 man/mstarchive.1 man/mstreg.1 man/mstfwtrace.1 man/mstlink.1 man/mstcongestion.1 man/mstfwmanager.1 man/mstfwreset.1 +man_MANS = man/mstflint.1 man/mstconfig.1 man/mstmcra.1 man/mstmread.1 man/mstmwrite.1 man/mstmtserver.1 man/mstregdump.1 man/mstvpd.1 man/mstprivhost.1 man/mstarchive.1 man/mstreg.1 man/mstfwtrace.1 man/mstlink.1 man/mstcongestion.1 man/mstfwmanager.1 man/mstfwreset.1 man/mstresourcedump.1 EXTRA_DIST = \ mstflint.spec \ small_utils/hca_self_test.ofed \ diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index 96eb49e..7f32d05 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -1,6 +1,6 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.69 for mstflint 4.13.1. +@%:@ Generated by GNU Autoconf 2.69 for mstflint 4.13.3. @%:@ @%:@ Report bugs to <eranj@mellanox.co.il>. @%:@ @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mstflint' PACKAGE_TARNAME='mstflint' -PACKAGE_VERSION='4.13.1' -PACKAGE_STRING='mstflint 4.13.1' +PACKAGE_VERSION='4.13.3' +PACKAGE_STRING='mstflint 4.13.3' PACKAGE_BUGREPORT='eranj@mellanox.co.il' PACKAGE_URL='' @@ -1380,7 +1380,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mstflint 4.13.1 to adapt to many kinds of systems. +\`configure' configures mstflint 4.13.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1450,7 +1450,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mstflint 4.13.1:";; + short | recursive ) echo "Configuration of mstflint 4.13.3:";; esac cat <<\_ACEOF @@ -1573,7 +1573,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mstflint configure 4.13.1 +mstflint configure 4.13.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2154,7 +2154,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mstflint $as_me 4.13.1, which was +It was created by mstflint $as_me 4.13.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2512,7 +2512,7 @@ _ACEOF cat >>confdefs.h <<_ACEOF -@%:@define VERSION "4.13.1" +@%:@define VERSION "4.13.3" _ACEOF @@ -3034,7 +3034,7 @@ fi # Define the identity of the package. PACKAGE='mstflint' - VERSION='4.13.1' + VERSION='4.13.3' cat >>confdefs.h <<_ACEOF @@ -16768,7 +16768,7 @@ $as_echo "$as_me: Linux MTCR" >&6;} fi -ac_config_files="$ac_config_files Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile" +ac_config_files="$ac_config_files Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17344,7 +17344,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mstflint $as_me 4.13.1, which was +This file was extended by mstflint $as_me 4.13.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17410,7 +17410,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mstflint config.status 4.13.1 +mstflint config.status 4.13.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -17971,6 +17971,7 @@ do "mad_ifc/Makefile") CONFIG_FILES="$CONFIG_FILES mad_ifc/Makefile" ;; "tracers/Makefile") CONFIG_FILES="$CONFIG_FILES tracers/Makefile" ;; "tracers/fwtrace/Makefile") CONFIG_FILES="$CONFIG_FILES tracers/fwtrace/Makefile" ;; + "resourcedump/Makefile") CONFIG_FILES="$CONFIG_FILES resourcedump/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/autom4te.cache/output.1 b/autom4te.cache/output.1 index e6c7df3..c851dfc 100644 --- a/autom4te.cache/output.1 +++ b/autom4te.cache/output.1 @@ -1,6 +1,6 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.69 for mstflint 4.13.1. +@%:@ Generated by GNU Autoconf 2.69 for mstflint 4.13.3. @%:@ @%:@ Report bugs to <eranj@mellanox.co.il>. @%:@ @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mstflint' PACKAGE_TARNAME='mstflint' -PACKAGE_VERSION='4.13.1' -PACKAGE_STRING='mstflint 4.13.1' +PACKAGE_VERSION='4.13.3' +PACKAGE_STRING='mstflint 4.13.3' PACKAGE_BUGREPORT='eranj@mellanox.co.il' PACKAGE_URL='' @@ -1380,7 +1380,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mstflint 4.13.1 to adapt to many kinds of systems. +\`configure' configures mstflint 4.13.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1450,7 +1450,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mstflint 4.13.1:";; + short | recursive ) echo "Configuration of mstflint 4.13.3:";; esac cat <<\_ACEOF @@ -1573,7 +1573,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mstflint configure 4.13.1 +mstflint configure 4.13.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2154,7 +2154,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mstflint $as_me 4.13.1, which was +It was created by mstflint $as_me 4.13.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2512,7 +2512,7 @@ _ACEOF cat >>confdefs.h <<_ACEOF -@%:@define VERSION "4.13.1" +@%:@define VERSION "4.13.3" _ACEOF @@ -3034,7 +3034,7 @@ fi # Define the identity of the package. PACKAGE='mstflint' - VERSION='4.13.1' + VERSION='4.13.3' cat >>confdefs.h <<_ACEOF @@ -16764,7 +16764,7 @@ $as_echo "$as_me: Linux MTCR" >&6;} fi -ac_config_files="$ac_config_files Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile" +ac_config_files="$ac_config_files Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17340,7 +17340,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mstflint $as_me 4.13.1, which was +This file was extended by mstflint $as_me 4.13.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17406,7 +17406,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mstflint config.status 4.13.1 +mstflint config.status 4.13.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -17967,6 +17967,7 @@ do "mad_ifc/Makefile") CONFIG_FILES="$CONFIG_FILES mad_ifc/Makefile" ;; "tracers/Makefile") CONFIG_FILES="$CONFIG_FILES tracers/Makefile" ;; "tracers/fwtrace/Makefile") CONFIG_FILES="$CONFIG_FILES tracers/fwtrace/Makefile" ;; + "resourcedump/Makefile") CONFIG_FILES="$CONFIG_FILES resourcedump/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/autom4te.cache/traces.1 b/autom4te.cache/traces.1 index ee7bd56..3e171f1 100644 --- a/autom4te.cache/traces.1 +++ b/autom4te.cache/traces.1 @@ -1,5 +1,5 @@ m4trace:aclocal.m4:9690: -1- m4_include([m4/ax_check_compile_flag.m4]) -m4trace:configure.ac:34: -1- AC_INIT([mstflint], [4.13.1], [eranj@mellanox.co.il]) +m4trace:configure.ac:34: -1- AC_INIT([mstflint], [4.13.3], [eranj@mellanox.co.il]) m4trace:configure.ac:34: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.ac:34: -1- m4_pattern_forbid([_AC_]) m4trace:configure.ac:34: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) @@ -794,7 +794,7 @@ m4trace:configure.ac:402: -1- AC_CONFIG_FILES([mtcr_ul/Makefile]) m4trace:configure.ac:406: -1- AC_CONFIG_FILES([Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile \ tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile \ flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile \ - fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile ]) + fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile ]) m4trace:configure.ac:406: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. You should run autoupdate.], []) m4trace:configure.ac:406: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) diff --git a/cmdif/tools_cif.h b/cmdif/tools_cif.h index 5d20908..b7a8e45 100644 --- a/cmdif/tools_cif.h +++ b/cmdif/tools_cif.h @@ -121,7 +121,7 @@ MError tcif_cr_mbox_supported(mfile *dev); * tcif_err2str: * @param[in] rc return code from one of the above functions - * @return string describing the error occured. + * @return string describing the error occurred. **/ const char* tcif_err2str(MError rc); diff --git a/common/gitversion.h b/common/gitversion.h index fe4a12e..b8e1865 100644 --- a/common/gitversion.h +++ b/common/gitversion.h @@ -1 +1 @@ -#define TOOLS_GIT_SHA "d873a08" +#define TOOLS_GIT_SHA "0c3327f" @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for mstflint 4.13.1. +# Generated by GNU Autoconf 2.69 for mstflint 4.13.3. # # Report bugs to <eranj@mellanox.co.il>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mstflint' PACKAGE_TARNAME='mstflint' -PACKAGE_VERSION='4.13.1' -PACKAGE_STRING='mstflint 4.13.1' +PACKAGE_VERSION='4.13.3' +PACKAGE_STRING='mstflint 4.13.3' PACKAGE_BUGREPORT='eranj@mellanox.co.il' PACKAGE_URL='' @@ -1380,7 +1380,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mstflint 4.13.1 to adapt to many kinds of systems. +\`configure' configures mstflint 4.13.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1450,7 +1450,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mstflint 4.13.1:";; + short | recursive ) echo "Configuration of mstflint 4.13.3:";; esac cat <<\_ACEOF @@ -1573,7 +1573,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mstflint configure 4.13.1 +mstflint configure 4.13.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2154,7 +2154,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mstflint $as_me 4.13.1, which was +It was created by mstflint $as_me 4.13.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2512,7 +2512,7 @@ _ACEOF cat >>confdefs.h <<_ACEOF -#define VERSION "4.13.1" +#define VERSION "4.13.3" _ACEOF @@ -3034,7 +3034,7 @@ fi # Define the identity of the package. PACKAGE='mstflint' - VERSION='4.13.1' + VERSION='4.13.3' cat >>confdefs.h <<_ACEOF @@ -16764,7 +16764,7 @@ $as_echo "$as_me: Linux MTCR" >&6;} fi -ac_config_files="$ac_config_files Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile" +ac_config_files="$ac_config_files Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17340,7 +17340,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mstflint $as_me 4.13.1, which was +This file was extended by mstflint $as_me 4.13.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17406,7 +17406,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mstflint config.status 4.13.1 +mstflint config.status 4.13.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -17967,6 +17967,7 @@ do "mad_ifc/Makefile") CONFIG_FILES="$CONFIG_FILES mad_ifc/Makefile" ;; "tracers/Makefile") CONFIG_FILES="$CONFIG_FILES tracers/Makefile" ;; "tracers/fwtrace/Makefile") CONFIG_FILES="$CONFIG_FILES tracers/fwtrace/Makefile" ;; + "resourcedump/Makefile") CONFIG_FILES="$CONFIG_FILES resourcedump/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.ac b/configure.ac index ece2050..e7c8684 100644 --- a/configure.ac +++ b/configure.ac @@ -31,12 +31,12 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(mstflint, 4.13.1, eranj@mellanox.co.il) +AC_INIT(mstflint, 4.13.3, eranj@mellanox.co.il) AC_DEFINE_UNQUOTED([PROJECT], ["mstflint"], [Define the project name.]) AC_SUBST([PROJECT]) -AC_DEFINE_UNQUOTED([VERSION], ["4.13.1"], [Define the project version.]) +AC_DEFINE_UNQUOTED([VERSION], ["4.13.3"], [Define the project version.]) AC_SUBST([VERSION]) AC_CONFIG_MACRO_DIR([m4]) @@ -406,5 +406,5 @@ fi AC_OUTPUT( Makefile common/Makefile mft_utils/Makefile mtcr_py/Makefile ext_libs/Makefile ext_libs/sqlite/Makefile ext_libs/muparser/Makefile ext_libs/json/Makefile ext_libs/minixz/Makefile dev_mgt/Makefile \ tools_layouts/Makefile reg_access/Makefile cmdif/Makefile libmfa/Makefile pldmlib/Makefile tools_res_mgmt/Makefile mlxconfig/Makefile mlxconfig/mlxconfig_dbs/Makefile mflash/Makefile mlxfwops/Makefile mlxfwops/lib/Makefile cmdparser/Makefile \ flint/Makefile small_utils/Makefile small_utils/mlxfwresetlib/Makefile mstdump/Makefile mstdump/crd_lib/Makefile mstdump/crd_main/Makefile mstdump/mstdump_dbs/Makefile mvpd/Makefile \ - fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile ) + fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile ) diff --git a/debian/changelog b/debian/changelog index 18d2305..020bda7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +mstflint (4.13.3+2-1) unstable; urgency=medium + + * New upstream release (Closes: #951417) + * Drop spelling mistake fix (accepted upstream) + * Refresh remaining patches + * Bump Standards-Version to 4.5.0 (no changes required) + + -- Benjamin Drung <benjamin.drung@cloud.ionos.com> Mon, 17 Feb 2020 12:58:21 +0100 + mstflint (4.13.1+1-1) unstable; urgency=medium * New upstream release (Closes: #939931) diff --git a/debian/control b/debian/control index f1cb3bf..78fafa4 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Build-Depends: debhelper-compat (= 12), libssl-dev, pkg-config, zlib1g-dev -Standards-Version: 4.4.1 +Standards-Version: 4.5.0 Rules-Requires-Root: no Vcs-Git: https://salsa.debian.org/hpc-team/mstflint.git Vcs-Browser: https://salsa.debian.org/hpc-team/mstflint diff --git a/debian/patches/0003-Fix-man-page-errors.patch b/debian/patches/0003-Fix-man-page-errors.patch index 75c5a6d..b18cb62 100644 --- a/debian/patches/0003-Fix-man-page-errors.patch +++ b/debian/patches/0003-Fix-man-page-errors.patch @@ -1,4 +1,4 @@ -From 5a28003db004a270450c01babeff3bfde3a80727 Mon Sep 17 00:00:00 2001 +From 488174b55a3e77557aac69f25d63f485ede960e5 Mon Sep 17 00:00:00 2001 From: Benjamin Drung <benjamin.drung@profitbricks.com> Date: Tue, 3 Jan 2017 20:01:35 +0100 Subject: Fix man page errors @@ -9,31 +9,32 @@ but do not start the needed full adjustment of the formatting. Bug: https://github.com/Mellanox/mstflint/issues/38 Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com> --- - man/mstarchive.1 | 2 +- - man/mstconfig.1 | 72 +++++++++++------------ - man/mstcongestion.1 | 2 +- - man/mstflint.1 | 138 +++++++++++++++++++++----------------------- - man/mstfwmanager.1 | 2 +- - man/mstfwreset.1 | 2 +- - man/mstfwtrace.1 | 2 +- - man/mstlink.1 | 28 ++++----- - man/mstmcra.1 | 2 +- - man/mstmread.1 | 2 +- - man/mstmtserver.1 | 2 +- - man/mstmwrite.1 | 2 +- - man/mstprivhost.1 | 2 +- - man/mstreg.1 | 2 +- - man/mstregdump.1 | 25 ++++---- - man/mstvpd.1 | 2 +- - 16 files changed, 138 insertions(+), 149 deletions(-) + man/mstarchive.1 | 2 +- + man/mstconfig.1 | 72 +++++++++++----------- + man/mstcongestion.1 | 2 +- + man/mstflint.1 | 138 ++++++++++++++++++++---------------------- + man/mstfwmanager.1 | 2 +- + man/mstfwreset.1 | 2 +- + man/mstfwtrace.1 | 2 +- + man/mstlink.1 | 30 ++++----- + man/mstmcra.1 | 2 +- + man/mstmread.1 | 2 +- + man/mstmtserver.1 | 2 +- + man/mstmwrite.1 | 2 +- + man/mstprivhost.1 | 2 +- + man/mstreg.1 | 2 +- + man/mstregdump.1 | 25 ++++---- + man/mstresourcedump.1 | 2 +- + man/mstvpd.1 | 2 +- + 17 files changed, 140 insertions(+), 151 deletions(-) diff --git a/man/mstarchive.1 b/man/mstarchive.1 -index 44698a7..b313c72 100644 +index c1a4c82..48f21a4 100644 --- a/man/mstarchive.1 +++ b/man/mstarchive.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTARCHIVE "1" "September 2019" "mstarchive NAME" "User Commands" + .TH MSTARCHIVE "1" "December 2019" "mstarchive NAME" "User Commands" .SH NAME -mstarchive \- manual page for mstarchive NAME +mstarchive \- generate MFA2 archives @@ -41,14 +42,14 @@ index 44698a7..b313c72 100644 NAME .IP diff --git a/man/mstconfig.1 b/man/mstconfig.1 -index d1d6fb0..270a4f4 100644 +index e06e2d0..c3e62b4 100644 --- a/man/mstconfig.1 +++ b/man/mstconfig.1 @@ -1,14 +1,14 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTCONFIG, "1" "September 2019" "mstconfig, mstflint 4.13.1, built on Sep 11 2019, 21:08:02. Git SHA Hash: N/A" "User Commands" + .TH MSTCONFIG, "1" "December 2019" "mstconfig, mstflint 4.13.3, built on Dec 30 2019, 11:42:10. Git SHA Hash: N/A" "User Commands" .SH NAME --mstconfig, \- manual page for mstconfig, mstflint 4.13.1, built on Sep 11 2019, 21:08:02. Git SHA Hash: N/A +-mstconfig, \- manual page for mstconfig, mstflint 4.13.3, built on Dec 30 2019, 11:42:10. Git SHA Hash: N/A +mstconfig \- set or query non-volatile configurable options for Mellanox HCAs .SH DESCRIPTION .IP @@ -206,27 +207,27 @@ index d1d6fb0..270a4f4 100644 .PP should give you access to the complete manual. diff --git a/man/mstcongestion.1 b/man/mstcongestion.1 -index 6fc8f6d..1739a9f 100644 +index f65ba68..ae63e9b 100644 --- a/man/mstcongestion.1 +++ b/man/mstcongestion.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTCONGESTION, "1" "September 2019" "mstcongestion, mstflint 4.13.1, built on Sep 12 2019, 09:06:00. Git SHA Hash: N/A" "User Commands" + .TH MSTCONGESTION, "1" "December 2019" "mstcongestion, mstflint 4.13.3, built on Dec 30 2019, 11:44:01. Git SHA Hash: N/A" "User Commands" .SH NAME --mstcongestion, \- manual page for mstcongestion, mstflint 4.13.1, built on Sep 12 2019, 09:06:00. Git SHA Hash: N/A +-mstcongestion, \- manual page for mstcongestion, mstflint 4.13.3, built on Dec 30 2019, 11:44:01. Git SHA Hash: N/A +mstcongestion \- utility for configuring Mellanox device's receive congestion handling .SH DESCRIPTION NAME .IP diff --git a/man/mstflint.1 b/man/mstflint.1 -index 8fb04aa..93cb4d9 100644 +index 535a9fc..8853682 100644 --- a/man/mstflint.1 +++ b/man/mstflint.1 @@ -1,15 +1,14 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTFLINT, "1" "September 2019" "mstflint, mstflint 4.13.1, built on Sep 11 2019, 21:08:43. Git SHA Hash: N/A" "User Commands" + .TH MSTFLINT, "1" "December 2019" "mstflint, mstflint 4.13.3, built on Dec 30 2019, 11:43:54. Git SHA Hash: N/A" "User Commands" .SH NAME --mstflint, \- manual page for mstflint, mstflint 4.13.1, built on Sep 11 2019, 21:08:43. Git SHA Hash: N/A +-mstflint, \- manual page for mstflint, mstflint 4.13.3, built on Dec 30 2019, 11:43:54. Git SHA Hash: N/A +mstflint \- Flash Interface .SH DESCRIPTION NAME @@ -240,8 +241,8 @@ index 8fb04aa..93cb4d9 100644 -MstFlint [OPTIONS] <command> [Parameters] +mstflint [OPTIONS] <command> [Parameters] .IP - [\-d|\-\-device <device>] [\-i|\-\-image <image>] [\-\-ir] [\-\-image_reactivation] [\-h|\-\-help] - [\-\-hh] [\-y|\-\-yes] [\-\-no] [\-\-guid <GUID>] [\-\-guids <GUIDS...>] [\-\-mac <MAC>] + [\-d|\-\-device <device>] [\-i|\-\-image <image>] [\-\-latest_fw] [\-\-ir] [\-h|\-\-help] [\-\-hh] + [\-y|\-\-yes] [\-\-no] [\-\-guid <GUID>] [\-\-guids <GUIDS...>] [\-\-mac <MAC>] @@ -27,17 +26,15 @@ DESCRIPTION .IP flint is a FW (firmware) burning and flash memory operations tool for Mellanox Infiniband @@ -262,7 +263,7 @@ index 8fb04aa..93cb4d9 100644 +Binary image file. Commands affected: burn, verify .TP - \fB\-\-ir\fR + \fB\-\-latest_fw\fR @@ -47,32 +44,32 @@ Commands affected: burn, verify : Commands affected: burn .TP @@ -602,10 +603,10 @@ index 8fb04aa..93cb4d9 100644 .IP timestamp|ts <set|query|reset> [timestamp] [FW version] : FW time stamping. -@@ -401,28 +398,27 @@ image_reactivate|ir - : Reactivate previous flash image. For FW +@@ -407,28 +404,27 @@ binary_compare|bc .IP - controlled devices only. + given BIN file. If there is a silent mode, + no progress is displayed. -.PP +.SH RETURN VALUES @@ -639,53 +640,53 @@ index 8fb04aa..93cb4d9 100644 .PP should give you access to the complete manual. diff --git a/man/mstfwmanager.1 b/man/mstfwmanager.1 -index e865884..7bb6845 100644 +index 28d3365..96dffd7 100644 --- a/man/mstfwmanager.1 +++ b/man/mstfwmanager.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTFWMANAGER "1" "September 2019" "mstfwmanager 1.0, mstflint 4.13.1, built on Sep 12 2019, 09:05:38. Git SHA Hash: N/A" "User Commands" + .TH MSTFWMANAGER "1" "December 2019" "mstfwmanager 1.0, mstflint 4.13.3, built on Dec 30 2019, 11:42:53. Git SHA Hash: N/A" "User Commands" .SH NAME --mstfwmanager \- manual page for mstfwmanager 1.0, mstflint 4.13.1, built on Sep 12 2019, 09:05:38. Git SHA Hash: N/A +-mstfwmanager \- manual page for mstfwmanager 1.0, mstflint 4.13.3, built on Dec 30 2019, 11:42:53. Git SHA Hash: N/A +mstfwmanager \- Mellanox Firmware Manager .SH DESCRIPTION NAME .IP diff --git a/man/mstfwreset.1 b/man/mstfwreset.1 -index e7b9fa6..56eed77 100644 +index 4f7ecb9..7d0f653 100644 --- a/man/mstfwreset.1 +++ b/man/mstfwreset.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTFWRESET "1" "September 2019" "mstfwreset 1.0.0, mstflint 4.13.1, built on Sep 12 2019, 09:04:29. Git SHA Hash: N/A" "User Commands" + .TH MSTFWRESET "1" "December 2019" "mstfwreset 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A" "User Commands" .SH NAME --mstfwreset \- manual page for mstfwreset 1.0.0, mstflint 4.13.1, built on Sep 12 2019, 09:04:29. Git SHA Hash: N/A +-mstfwreset \- manual page for mstfwreset 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A +mstfwreset \- Query and perform reset operation on the device .SH DESCRIPTION usage: mstfwreset \fB\-\-device\fR DEVICE [\-\-level {0,3,4,5}] [\-\-type {0,1}] [\-\-yes] .IP diff --git a/man/mstfwtrace.1 b/man/mstfwtrace.1 -index cac2275..6e16950 100644 +index 8ab1f39..c124b83 100644 --- a/man/mstfwtrace.1 +++ b/man/mstfwtrace.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTFWTRACE, "1" "September 2019" "mstfwtrace, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A" "User Commands" + .TH MSTFWTRACE, "1" "December 2019" "mstfwtrace, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A" "User Commands" .SH NAME --mstfwtrace, \- manual page for mstfwtrace, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A +-mstfwtrace, \- manual page for mstfwtrace, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A +mstfwtrace \- Extracts and prints trace messages generated by the firmware of 5th generation devices .SH DESCRIPTION usage: mstfwtrace \fB\-d\fR|\-\-device DEVICE [options] .SS "optional arguments:" diff --git a/man/mstlink.1 b/man/mstlink.1 -index 451bae5..f3bcd73 100644 +index 45ad236..5ade7ee 100644 --- a/man/mstlink.1 +++ b/man/mstlink.1 @@ -1,23 +1,16 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTLINK, "1" "September 2019" "mstlink, mstflint 4.13.1, built on Sep 11 2019, 21:09:35. Git SHA Hash: N/A" "User Commands" + .TH MSTLINK, "1" "December 2019" "mstlink, mstflint 4.13.3, built on Dec 30 2019, 11:45:43. Git SHA Hash: N/A" "User Commands" .SH NAME --mstlink, \- manual page for mstlink, mstflint 4.13.1, built on Sep 11 2019, 21:09:35. Git SHA Hash: N/A +-mstlink, \- manual page for mstlink, mstflint 4.13.3, built on Dec 30 2019, 11:45:43. Git SHA Hash: N/A -.SH DESCRIPTION -.IP -NAME: @@ -701,9 +702,10 @@ index 451bae5..f3bcd73 100644 -.IP -DESCRIPTION: -.IP +-The mstlink tool is used to check and debug link status and issues related to them. +.SH +DESCRIPTION - The mlxlink tool is used to check and debug link status and issues related to them. ++The mlxlink tool is used to check and debug link status and issues related to them. The tool can be used on different links and cables (passive, active, transceiver and backplane). -.IP -OPTIONS: @@ -712,7 +714,7 @@ index 451bae5..f3bcd73 100644 .TP \fB\-h\fR |\-\-help : Display help message. -@@ -133,8 +126,8 @@ COMMANDS: +@@ -136,8 +129,8 @@ COMMANDS: .TP \fB\-\-twisted_pair_force_mode\fR <twisted_pair_force_mode> : Twisted Pair Force Mode [MA(Master)/SL(Slave)] @@ -723,7 +725,7 @@ index 451bae5..f3bcd73 100644 .TP get info of <device>, <port_number> : -@@ -176,7 +169,8 @@ mstlink \fB\-d\fR <device> \fB\-p\fR <port_number> \fB\-\-test_mode\fR TU +@@ -179,7 +172,8 @@ mstlink \fB\-d\fR <device> \fB\-p\fR <port_number> \fB\-\-test_mode\fR TU .IP Configure Transmitter Parameters (on lane, to database): .IP @@ -734,12 +736,12 @@ index 451bae5..f3bcd73 100644 The full documentation for .B mstlink, diff --git a/man/mstmcra.1 b/man/mstmcra.1 -index 0babe1b..8200bc0 100644 +index fb1d362..8e5727a 100644 --- a/man/mstmcra.1 +++ b/man/mstmcra.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTMCRA "1" "September 2019" "mstmcra Mellanox Configuration Registers Access tool" "User Commands" + .TH MSTMCRA "1" "December 2019" "mstmcra Mellanox Configuration Registers Access tool" "User Commands" .SH NAME -mstmcra \- manual page for mstmcra Mellanox Configuration Registers Access tool +mstmcra \- Mellanox Configuration Registers Access tool @@ -747,12 +749,12 @@ index 0babe1b..8200bc0 100644 .IP Mellanox Configuration Registers Access tool diff --git a/man/mstmread.1 b/man/mstmread.1 -index 7e11976..f02b182 100644 +index c7cb9de..f4ed7b5 100644 --- a/man/mstmread.1 +++ b/man/mstmread.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTMREAD "1" "September 2019" "mstmread <device> <addr>" "User Commands" + .TH MSTMREAD "1" "December 2019" "mstmread <device> <addr>" "User Commands" .SH NAME -mstmread \- manual page for mstmread <device> <addr> +mstmread \- Mellanox Read Configuration Register Tool @@ -760,12 +762,12 @@ index 7e11976..f02b182 100644 mstmread <device> <addr> .SH "SEE ALSO" diff --git a/man/mstmtserver.1 b/man/mstmtserver.1 -index bd05f0d..35027fe 100644 +index 6f19636..dd9f6ce 100644 --- a/man/mstmtserver.1 +++ b/man/mstmtserver.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH INVALID "1" "September 2019" "Invalid switch "-version"." "User Commands" + .TH INVALID "1" "December 2019" "Invalid switch "-version"." "User Commands" .SH NAME -Invalid \- manual page for Invalid switch "-version". +Invalid \- Mellanox Software tools (mst) server (remote mtcr calls) @@ -773,12 +775,12 @@ index bd05f0d..35027fe 100644 Invalid switch "\-help". Usage: diff --git a/man/mstmwrite.1 b/man/mstmwrite.1 -index b0ec322..e66a181 100644 +index d62155f..771c7d8 100644 --- a/man/mstmwrite.1 +++ b/man/mstmwrite.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTMWRITE "1" "September 2019" "mstmwrite <device> <addr> <value>" "User Commands" + .TH MSTMWRITE "1" "December 2019" "mstmwrite <device> <addr> <value>" "User Commands" .SH NAME -mstmwrite \- manual page for mstmwrite <device> <addr> <value> +mstmwrite \- Mellanox Write Configuration Register Tool @@ -786,40 +788,40 @@ index b0ec322..e66a181 100644 mstmwrite <device> <addr> <value> .SH "SEE ALSO" diff --git a/man/mstprivhost.1 b/man/mstprivhost.1 -index b32a3bd..fa25065 100644 +index 705eca3..ecdc18e 100644 --- a/man/mstprivhost.1 +++ b/man/mstprivhost.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTPRIVHOST "1" "September 2019" "mstprivhost 1.0.0, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A" "User Commands" + .TH MSTPRIVHOST "1" "December 2019" "mstprivhost 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A" "User Commands" .SH NAME --mstprivhost \- manual page for mstprivhost 1.0.0, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A +-mstprivhost \- manual page for mstprivhost 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A +mstprivhost \- privilege modification tool .SH DESCRIPTION usage: mstprivhost [\-h] [\-v] \fB\-\-device\fR DEVICE [\-\-disable_rshim] .IP diff --git a/man/mstreg.1 b/man/mstreg.1 -index 636d264..bea0342 100644 +index ab7f2df..bce47c3 100644 --- a/man/mstreg.1 +++ b/man/mstreg.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTREG, "1" "September 2019" "mstreg, mstflint 4.13.1, built on Sep 11 2019, 21:09:23. Git SHA Hash: N/A" "User Commands" + .TH MSTREG, "1" "December 2019" "mstreg, mstflint 4.13.3, built on Dec 30 2019, 11:44:54. Git SHA Hash: N/A" "User Commands" .SH NAME --mstreg, \- manual page for mstreg, mstflint 4.13.1, built on Sep 11 2019, 21:09:23. Git SHA Hash: N/A +-mstreg, \- manual page for mstreg, mstflint 4.13.3, built on Dec 30 2019, 11:44:54. Git SHA Hash: N/A +mstreg \- Expose supported access registers .SH DESCRIPTION .IP NAME: diff --git a/man/mstregdump.1 b/man/mstregdump.1 -index e827086..e8f650d 100644 +index 818be82..28392ec 100644 --- a/man/mstregdump.1 +++ b/man/mstregdump.1 @@ -1,34 +1,33 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH MSTREGDUMP, "1" "September 2019" "mstregdump, mstflint 4.13.1, built on Sep 11 2019, 21:08:50. Git SHA Hash: N/A" "User Commands" + .TH MSTREGDUMP, "1" "December 2019" "mstregdump, mstflint 4.13.3, built on Dec 30 2019, 11:44:04. Git SHA Hash: N/A" "User Commands" .SH NAME --mstregdump, \- manual page for mstregdump, mstflint 4.13.1, built on Sep 11 2019, 21:08:50. Git SHA Hash: N/A +-mstregdump, \- manual page for mstregdump, mstflint 4.13.3, built on Dec 30 2019, 11:44:04. Git SHA Hash: N/A -.SH DESCRIPTION -.IP -Mellanox mstregdump utility, dumps device internal configuration data @@ -862,13 +864,26 @@ index e827086..e8f650d 100644 +.B info mstregdump .PP should give you access to the complete manual. +diff --git a/man/mstresourcedump.1 b/man/mstresourcedump.1 +index a1725d6..4e70b65 100644 +--- a/man/mstresourcedump.1 ++++ b/man/mstresourcedump.1 +@@ -1,7 +1,7 @@ + .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. + .TH RESOURCEDUMP, "1" "December 2019" "ResourceDump, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash:" "User Commands" + .SH NAME +-ResourceDump, \- manual page for ResourceDump, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: ++mstresourcedump \- dump resource information + .SH DESCRIPTION + usage: mstresourcedump.py [\-h] [\-v] {dump,query} ... + .SS "optional arguments:" diff --git a/man/mstvpd.1 b/man/mstvpd.1 -index fe93b8f..46252ab 100644 +index dd6e36f..922281a 100644 --- a/man/mstvpd.1 +++ b/man/mstvpd.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. - .TH USAGE: "1" "September 2019" "Usage: mstvpd [-m|-n|-r] [-t ##] <file> [-- keyword ...]" "User Commands" + .TH USAGE: "1" "December 2019" "Usage: mstvpd [-m|-n|-r] [-t ##] <file> [-- keyword ...]" "User Commands" .SH NAME -Usage: \- manual page for Usage: mstvpd [-m|-n|-r] [-t ##] <file> [-- keyword ...] +mstvpd \- Mellanox VPD read tool diff --git a/debian/patches/0004-Fix-spelling-mistakes.patch b/debian/patches/0004-Fix-spelling-mistakes.patch deleted file mode 100644 index 539597c..0000000 --- a/debian/patches/0004-Fix-spelling-mistakes.patch +++ /dev/null @@ -1,136 +0,0 @@ -From ed9cd6dd716205aea7344ce479e8fa7d71b0906e Mon Sep 17 00:00:00 2001 -From: Benjamin Drung <benjamin.drung@cloud.ionos.com> -Date: Mon, 21 Oct 2019 15:27:55 +0200 -Subject: Fix spelling mistakes - -lintian found some spelling mistakes. Fix them all. - -Forwarded: https://github.com/Mellanox/mstflint/pull/218 -Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com> ---- - cmdif/tools_cif.h | 2 +- - fw_comps_mgr/fw_comps_mgr.cpp | 2 +- - fw_comps_mgr/fw_comps_mgr_dma_access.cpp | 2 +- - mlxfwops/lib/fs2_ops.cpp | 2 +- - mlxfwops/lib/fsctrl_ops.cpp | 2 +- - mtcr_ul/mtcr_ib_ofed.c | 2 +- - small_utils/mstfwreset.py | 4 ++-- - tools_layouts/tools_open_layouts.h | 2 +- - 8 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/cmdif/tools_cif.h b/cmdif/tools_cif.h -index 5d20908..b7a8e45 100644 ---- a/cmdif/tools_cif.h -+++ b/cmdif/tools_cif.h -@@ -121,7 +121,7 @@ MError tcif_cr_mbox_supported(mfile *dev); - * tcif_err2str: - * @param[in] rc return code from one of the above functions - -- * @return string describing the error occured. -+ * @return string describing the error occurred. - **/ - const char* tcif_err2str(MError rc); - -diff --git a/fw_comps_mgr/fw_comps_mgr.cpp b/fw_comps_mgr/fw_comps_mgr.cpp -index 0616fee..31ee4f5 100755 ---- a/fw_comps_mgr/fw_comps_mgr.cpp -+++ b/fw_comps_mgr/fw_comps_mgr.cpp -@@ -1172,7 +1172,7 @@ void FwCompsMgr::deal_with_signal() - sig = mft_signal_is_fired(); - if (sig) { - unlock_flash_semaphore(); -- // reset recieved signal -+ // reset received signal - mft_signal_set_fired(0); - // retore prev handler - mft_signal_set_handling(0); -diff --git a/fw_comps_mgr/fw_comps_mgr_dma_access.cpp b/fw_comps_mgr/fw_comps_mgr_dma_access.cpp -index 9219c66..a3aa591 100755 ---- a/fw_comps_mgr/fw_comps_mgr_dma_access.cpp -+++ b/fw_comps_mgr/fw_comps_mgr_dma_access.cpp -@@ -297,7 +297,7 @@ bool DMAComponentAccess::accessComponent(u_int32_t updateHandle, u_int32_t offse - #ifndef UEFI_BUILD - } - catch (std::exception &e) { -- DPRINTF("DMAComponentAccess::Exception occured %s\n", e.what()); -+ DPRINTF("DMAComponentAccess::Exception occurred %s\n", e.what()); - return false; - } - #endif -diff --git a/mlxfwops/lib/fs2_ops.cpp b/mlxfwops/lib/fs2_ops.cpp -index f517dfd..3d23e41 100755 ---- a/mlxfwops/lib/fs2_ops.cpp -+++ b/mlxfwops/lib/fs2_ops.cpp -@@ -1859,7 +1859,7 @@ bool Fs2Operations::FwBurnRom(FImage *romImg, bool ignoreProdIdCheck, bool ignor - u_int32_t cntx_image_num; - FindAllImageStart(romImg, cntx_image_start, &cntx_image_num, _cntx_magic_pattern); - if (cntx_image_num != 0) { -- return errmsg("Expecting an expansion ROM image, Recieved Mellanox FW image."); -+ return errmsg("Expecting an expansion ROM image, received Mellanox FW image."); - } - - if (!Fs2IntQuery()) { -diff --git a/mlxfwops/lib/fsctrl_ops.cpp b/mlxfwops/lib/fsctrl_ops.cpp -index d36f3dd..7a380f7 100755 ---- a/mlxfwops/lib/fsctrl_ops.cpp -+++ b/mlxfwops/lib/fsctrl_ops.cpp -@@ -211,7 +211,7 @@ bool FsCtrlOperations::FwReactivateImage() - case FWCOMPS_IMAGE_REACTIVATION_FW_NOT_SUPPORTED: - return errmsg(MLXFW_ERR, "Image reactivation - FW doesn't support this operation.\n"); - default: -- return errmsg(MLXFW_IMAGE_REACTIVATION_UNKNOWN_ERROR, "Unknown error occured\n"); -+ return errmsg(MLXFW_IMAGE_REACTIVATION_UNKNOWN_ERROR, "Unknown error occurred\n"); - } - } - return true; -diff --git a/mtcr_ul/mtcr_ib_ofed.c b/mtcr_ul/mtcr_ib_ofed.c -index 0fe970c..02ab58f 100644 ---- a/mtcr_ul/mtcr_ib_ofed.c -+++ b/mtcr_ul/mtcr_ib_ofed.c -@@ -733,7 +733,7 @@ int mib_open(const char *name, mfile *mf, int mad_init) - char *ep; - u_int32_t sl = strtoul(sl_str, &ep, 0); - if (*ep) { -- fprintf(stderr, "-E- Failed to parse env var %s (%s). Ignorring\n", MTCR_IBSL_ENV, sl_str); -+ fprintf(stderr, "-E- Failed to parse env var %s (%s). Ignoring\n", MTCR_IBSL_ENV, sl_str); - } else { - ivm->portid.sl = (u_int8_t)sl; - } -diff --git a/small_utils/mstfwreset.py b/small_utils/mstfwreset.py -index f653d06..cdb629e 100755 ---- a/small_utils/mstfwreset.py -+++ b/small_utils/mstfwreset.py -@@ -239,7 +239,7 @@ def reset_fsm_register(): - def sigHndl(signal, frame): - reset_fsm_register() - -- print("\nSignal %d Recieved, Exiting..." % signal) -+ print("\nSignal %d received, exiting..." % signal) - sys.exit(1) - - def set_signal_handler(): -@@ -277,7 +277,7 @@ def printAndFlush(str, endChar='\n'): - sys.stdout.flush() - - ###################################################################### --# Description: ask user Y/N question if N/n/No/no was recieved raise -+# Description: ask user Y/N question if N/n/No/no was received raise - # RuntimeError. - # OS Support : Linux/Windows. - ###################################################################### -diff --git a/tools_layouts/tools_open_layouts.h b/tools_layouts/tools_open_layouts.h -index acd4e7b..16c12d7 100755 ---- a/tools_layouts/tools_open_layouts.h -+++ b/tools_layouts/tools_open_layouts.h -@@ -2696,7 +2696,7 @@ struct tools_open_mcdd_descriptor { - /* Description - Status of current operation that FW sends to host. */ - /* 0x20.0 - 0x20.7 */ - u_int8_t status; -- /* Description - Last error index, if occured. */ -+ /* Description - Last error index, if occurred. */ - /* 0x20.8 - 0x20.15 */ - u_int8_t error; - /* Description - Reserved. */ --- -2.20.1 - diff --git a/debian/patches/0005-Add-missing-shebang-to-Python-scripts.patch b/debian/patches/0005-Add-missing-shebang-to-Python-scripts.patch index 2eebf1a..38cfac8 100644 --- a/debian/patches/0005-Add-missing-shebang-to-Python-scripts.patch +++ b/debian/patches/0005-Add-missing-shebang-to-Python-scripts.patch @@ -1,4 +1,4 @@ -From 838b49d2d6023cc361d0ad1f30e5f60810d0b69e Mon Sep 17 00:00:00 2001 +From 70b9ca91f264eb75177e18d9624beab685f55e58 Mon Sep 17 00:00:00 2001 From: Benjamin Drung <benjamin.drung@cloud.ionos.com> Date: Mon, 21 Oct 2019 15:37:24 +0200 Subject: Add missing shebang to Python scripts @@ -9,9 +9,10 @@ scripts that are executable, but they lack a shebang. https://github.com/Mellanox/mstflint/pull/219 Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com> --- - mlxconfig/mstprivhost.py | 2 ++ - small_utils/mstfwreset.py | 2 ++ - 2 files changed, 4 insertions(+) + mlxconfig/mstprivhost.py | 2 ++ + resourcedump/mstresourcedump.py | 2 ++ + small_utils/mstfwreset.py | 2 ++ + 3 files changed, 6 insertions(+) diff --git a/mlxconfig/mstprivhost.py b/mlxconfig/mstprivhost.py index 4f143e4..9a33666 100644 @@ -23,8 +24,18 @@ index 4f143e4..9a33666 100644 from __future__ import print_function import argparse +diff --git a/resourcedump/mstresourcedump.py b/resourcedump/mstresourcedump.py +index 8b5883a..2dd7290 100755 +--- a/resourcedump/mstresourcedump.py ++++ b/resourcedump/mstresourcedump.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/python3 ++ + ####################################################### + # + # MlxResDump.py diff --git a/small_utils/mstfwreset.py b/small_utils/mstfwreset.py -index cdb629e..9040f06 100755 +index 9a07078..b25905d 100755 --- a/small_utils/mstfwreset.py +++ b/small_utils/mstfwreset.py @@ -1,3 +1,5 @@ diff --git a/debian/patches/series b/debian/patches/series index 3fba5b7..cee428f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,4 @@ 0001-Remove-date-and-time-from-version-string-to-ensure-r.patch 0002-Make-the-build-reproducible.patch 0003-Fix-man-page-errors.patch -0004-Fix-spelling-mistakes.patch 0005-Add-missing-shebang-to-Python-scripts.patch diff --git a/dev_mgt/tools_dev_types.c b/dev_mgt/tools_dev_types.c index 52d2ac8..b50d88c 100644 --- a/dev_mgt/tools_dev_types.c +++ b/dev_mgt/tools_dev_types.c @@ -72,7 +72,8 @@ struct device_info { #define SFP_DIGITAL_DIAGNOSTIC_MONITORING_IMPLEMENTED_ADDR 92 #define SFP_PAGING_IMPLEMENTED_INDICATOR_ADDR 64 -#define ARDBEG_DEVID 0x6e +#define ARDBEG_REV0_DEVID 0x6e +#define ARDBEG_REV1_DEVID 0x7e #define ARDBEG_MIRRORED_DEVID 0x70 #define BARITONE_DEVID 0x6b #define BARITONE_MIRRORED_DEVID 0x71 @@ -428,9 +429,10 @@ int dm_get_device_id(mfile *mf, #endif #ifdef CABLES_SUPP if (mf->tp == MST_LINKX_CHIP){ - + switch (mf->linkx_chip_devid){ - case ARDBEG_DEVID: + case ARDBEG_REV0_DEVID: + case ARDBEG_REV1_DEVID: case ARDBEG_MIRRORED_DEVID: *ptr_dm_dev_id = DeviceArdbeg; break; @@ -502,7 +504,7 @@ int dm_get_device_id(mfile *mf, // Special case for MLNX OS getting dev_id using REG MGIR if (dev_flags & MDEVS_MLNX_OS) { reg_access_status_t rc; - struct tools_open_mgir mgir; + struct reg_access_hca_mgir mgir; memset(&mgir, 0, sizeof(mgir)); rc = reg_access_mgir(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); diff --git a/flint/Makefile.am b/flint/Makefile.am index 1a1d542..df5bbab 100755 --- a/flint/Makefile.am +++ b/flint/Makefile.am @@ -80,12 +80,14 @@ else endif if ENABLE_OPENSSL -mstflint_LDADD += $(top_srcdir)/mlxsign_lib/libmlxsign.a -lcrypto +mstflint_LDADD += $(top_srcdir)/mlxsign_lib/libmlxsign.a -lcrypto else endif if ENABLE_FWMGR -mstflint_LDADD += $(top_srcdir)/libmfa/libmfa.a $(top_srcdir)/ext_libs/minixz/libminixz.a +mstflint_LDADD += $(top_srcdir)/libmfa/libmfa.a $(top_srcdir)/ext_libs/minixz/libminixz.a $(top_srcdir)/mlxarchive/libmstarchive.a $(top_srcdir)/xz_utils/libxz_utils.a -llzma -lm +else +mstflint_CXXFLAGS += -DNO_MSTARCHIVE endif #get mst device examples and tool name from makefile diff --git a/flint/Makefile.in b/flint/Makefile.in index 1c37dcb..c3f60af 100644 --- a/flint/Makefile.in +++ b/flint/Makefile.in @@ -115,8 +115,9 @@ bin_PROGRAMS = mstflint$(EXEEXT) @ENABLE_DC_FALSE@am__append_2 = -DNO_ZLIB @ENABLE_CS_TRUE@am__append_3 = $(top_srcdir)/tools_crypto/libtools_crypto.a -lcrypto @ENABLE_INBAND_TRUE@am__append_4 = $(MAD_IFC_DIR)/libmad_ifc.a -@ENABLE_OPENSSL_TRUE@am__append_5 = $(top_srcdir)/mlxsign_lib/libmlxsign.a -lcrypto -@ENABLE_FWMGR_TRUE@am__append_6 = $(top_srcdir)/libmfa/libmfa.a $(top_srcdir)/ext_libs/minixz/libminixz.a +@ENABLE_OPENSSL_TRUE@am__append_5 = $(top_srcdir)/mlxsign_lib/libmlxsign.a -lcrypto +@ENABLE_FWMGR_TRUE@am__append_6 = $(top_srcdir)/libmfa/libmfa.a $(top_srcdir)/ext_libs/minixz/libminixz.a $(top_srcdir)/mlxarchive/libmstarchive.a $(top_srcdir)/xz_utils/libxz_utils.a -llzma -lm +@ENABLE_FWMGR_FALSE@am__append_7 = -DNO_MSTARCHIVE subdir = flint DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp @@ -140,6 +141,10 @@ am__DEPENDENCIES_1 = @ENABLE_CS_TRUE@ $(top_srcdir)/tools_crypto/libtools_crypto.a @ENABLE_OPENSSL_TRUE@am__DEPENDENCIES_3 = \ @ENABLE_OPENSSL_TRUE@ $(top_srcdir)/mlxsign_lib/libmlxsign.a +@ENABLE_FWMGR_TRUE@am__DEPENDENCIES_4 = $(top_srcdir)/libmfa/libmfa.a \ +@ENABLE_FWMGR_TRUE@ $(top_srcdir)/ext_libs/minixz/libminixz.a \ +@ENABLE_FWMGR_TRUE@ $(top_srcdir)/mlxarchive/libmstarchive.a \ +@ENABLE_FWMGR_TRUE@ $(top_srcdir)/xz_utils/libxz_utils.a mstflint_DEPENDENCIES = ../mlxfwops/lib/libmlxfwops.a \ ../cmdparser/libcmdparser.a ../mflash/libmflash.a \ ../tools_res_mgmt/libtools_res_mgmt.a $(CMDIF_DIR)/libcmdif.a \ @@ -149,7 +154,7 @@ mstflint_DEPENDENCIES = ../mlxfwops/lib/libmlxfwops.a \ ../fw_comps_mgr/libfw_comps_mgr.a ../mft_utils/libmftutils.a \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_2) $(am__append_4) $(am__DEPENDENCIES_3) \ - $(am__append_6) + $(am__DEPENDENCIES_4) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -398,8 +403,8 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(MTCR_DIR) -I$(MFLASH_DIR) -I$(COMM #get mst device examples and tool name from makefile mstflint_CXXFLAGS = -Wall -W -g -MP -MD -pipe -DEXTERNAL \ - $(COMPILER_FPIC) $(am__append_2) -DFLINT_NAME=\"mstflint\" \ - -DFLINT_DISPLAY_NAME=\"MstFlint\" \ + $(COMPILER_FPIC) $(am__append_2) $(am__append_7) \ + -DFLINT_NAME=\"mstflint\" -DFLINT_DISPLAY_NAME=\"MstFlint\" \ -DMST_DEV_EXAMPLE1=\"03:00.0\" -DMST_DEV_EXAMPLE2=\"mlx4_0\" \ -DMST_DEV_EXAMPLE3=\"03:00.0\" -DMST_DEV_EXAMPLE4=\"04:00.0\" mstflint_SOURCES = flint.cpp flint.h subcommands.cpp subcommands.h\ diff --git a/flint/cmd_line_parser.cpp b/flint/cmd_line_parser.cpp index 76d5257..dc79861 100755 --- a/flint/cmd_line_parser.cpp +++ b/flint/cmd_line_parser.cpp @@ -204,7 +204,8 @@ FlagMetaData::FlagMetaData() _flags.push_back(new Flag("", "hmac_key", 1)); _flags.push_back(new Flag("", "key_uuid2", 1)); _flags.push_back(new Flag("", "no_fw_ctrl", 0)); - _flags.push_back(new Flag("image_reactivation", "ir", 0)); + _flags.push_back(new Flag("", "ir", 0)); + _flags.push_back(new Flag("", "latest_fw", 0)); } FlagMetaData::~FlagMetaData() @@ -417,12 +418,12 @@ void Flint::initCmdParser() "Binary image file.\n" "Commands affected: burn, verify"); - AddOptions("ir", + AddOptions("latest_fw", ' ', "", "Commands affected: burn"); - AddOptions("image_reactivation", + AddOptions("ir", ' ', "", "Commands affected: burn"); @@ -889,7 +890,7 @@ ParseStatus Flint::HandleOption(string name, string value) _flintParams.striped_image = true; } else if (name == "use_dev_img_info") { _flintParams.use_dev_img_info = true; - } else if (name == "ir" || name == "image_reactivation") { + } else if (name == "ir") { _flintParams.image_reactivation = true; } else if (name == "banks") { @@ -923,7 +924,10 @@ ParseStatus Flint::HandleOption(string name, string value) } else if (name == "key_uuid2") { _flintParams.uuid2_specified = true; _flintParams.privkey2_uuid = value; - } else { + } else if (name == "latest_fw") { + _flintParams.use_latest_fw_version = true; + } + else { cout << "Unknown Flag: " << name; cout << _cmdParser.GetSynopsis(); return PARSE_ERROR; diff --git a/flint/err_msgs.h b/flint/err_msgs.h index 1096b1d..e190b24 100755 --- a/flint/err_msgs.h +++ b/flint/err_msgs.h @@ -57,6 +57,7 @@ typedef enum { #define FLINT_CLEAR_SEM_CMD_ERROR "No command is allowed when -clear_semaphore flag is given.\n" #define FLINT_COMMAND_FLAGS_ERROR "For %s command, Please specify %s.\n" +#define FLINT_COMMAND_INCORRECT_FLAGS_ERROR "For %s command, %s.\n" #define FLINT_PARSE_MEM_ERROR "Failed to allocate memory for parsing.\n " #define FLINT_NO_OPTIONS_FOUND_ERROR "No options found. " #define FLINT_INVALID_COMMAD_ERROR "Invalid command: %s\n" diff --git a/flint/flint_params.cpp b/flint/flint_params.cpp index 0ad5fe2..aaecdd7 100755 --- a/flint/flint_params.cpp +++ b/flint/flint_params.cpp @@ -56,6 +56,7 @@ FlintParams::FlintParams() low_cpu = false; skip_rom_query = false; image_specified = false; + mfa2_specified = false; nofs = false; allow_psid_change = false; allow_rom_change = false; @@ -93,6 +94,8 @@ FlintParams::FlintParams() no_fw_ctrl = false; image_reactivation = false; num_of_args = 0; + use_latest_fw_version = false; + } FlintParams::~FlintParams() diff --git a/flint/flint_params.h b/flint/flint_params.h index cddcb53..97741bf 100755 --- a/flint/flint_params.h +++ b/flint/flint_params.h @@ -114,6 +114,7 @@ public: bool next_boot_fw_ver; bool skip_rom_query; bool image_specified; + bool mfa2_specified; string image; bool nofs; bool allow_psid_change; @@ -146,7 +147,9 @@ public: bool skip_ci_req; bool use_dev_rom; bool privkey_specified; + bool pubkey_specified; string privkey_file; + string pubkey_file; bool uuid_specified; string privkey_uuid; bool privkey2_specified; @@ -158,6 +161,7 @@ public: bool no_fw_ctrl; bool image_reactivation; int num_of_args; + bool use_latest_fw_version; }; #endif diff --git a/flint/subcommands.cpp b/flint/subcommands.cpp index e074463..0c333c6 100755 --- a/flint/subcommands.cpp +++ b/flint/subcommands.cpp @@ -35,6 +35,7 @@ #include <stdio.h> +#include <stdlib.h> #include <stdarg.h> #include <errno.h> #include <time.h> @@ -61,9 +62,11 @@ #endif // WIN #include "subcommands.h" - +#include "tools_layouts/cx4fw_layouts.h" using namespace std; - +#ifndef NO_MSTARCHIVE +using namespace mfa2; +#endif /*********************************** * Log file writing implementation ************************************/ @@ -434,7 +437,7 @@ void SubCommand::initDeviceFwParams(char *errBuff, FwOperations::fw_ops_params_t fwParams.mccUnsupported = !_mccSupported; } -FlintStatus SubCommand::openOps(bool ignoreSecurityAttributes) +FlintStatus SubCommand::openOps(bool ignoreSecurityAttributes, bool ignoreDToc) { char errBuff[ERR_BUFF_SIZE] = {0}; if (_flintParams.device_specified) { @@ -450,7 +453,7 @@ FlintStatus SubCommand::openOps(bool ignoreSecurityAttributes) imgFwParams.errBuffSize = 1024; imgFwParams.shortErrors = true; imgFwParams.fileHndl = (char*)_flintParams.image.c_str(); - if (!FwOperations::imageDevOperationsCreate(fwParams, imgFwParams, &_fwOps, &_imgOps, ignoreSecurityAttributes)) { + if (!FwOperations::imageDevOperationsCreate(fwParams, imgFwParams, &_fwOps, &_imgOps, ignoreSecurityAttributes, ignoreDToc)) { /* * Error are being handled after */ @@ -604,7 +607,7 @@ bool SubCommand::basicVerifyParams() return true; } -FlintStatus SubCommand::preFwOps(bool ignoreSecurityAttributes) +FlintStatus SubCommand::preFwOps(bool ignoreSecurityAttributes, bool ignoreDToc) { if (!basicVerifyParams()) { return FLINT_FAILED; @@ -612,7 +615,13 @@ FlintStatus SubCommand::preFwOps(bool ignoreSecurityAttributes) if (!verifyParams()) { return FLINT_FAILED; } - return openOps(ignoreSecurityAttributes); + if (_flintParams.mfa2_specified) { + _flintParams.image_specified = false; + return openOps(true); + } + else { + return openOps(ignoreSecurityAttributes, ignoreDToc); + } } FlintStatus SubCommand::preFwAccess() @@ -1366,7 +1375,7 @@ SignSubCommand::SignSubCommand() _flagLong = "sign"; _flagShort = ""; _paramExp = "None"; - _example = FLINT_NAME " -i fw_image.bin [--private_key file.pem --key_uuid uuid.bin] sign"; + _example = FLINT_NAME " -i fw_image.bin [--private_key file.pem --key_uuid uuid string] sign"; _v = Wtv_Img; _maxCmdParamNum = 0; _cmdType = SC_Sign; @@ -1464,6 +1473,11 @@ BinaryCompareSubCommand::BinaryCompareSubCommand() } BinaryCompareSubCommand:: ~BinaryCompareSubCommand() { +#ifndef NO_MSTARCHIVE + if (_mfa2Pkg != NULL) { + delete _mfa2Pkg; + } +#endif } bool BinaryCompareSubCommand::verifyParams() { @@ -1479,8 +1493,74 @@ bool BinaryCompareSubCommand::verifyParams() return false; } } +FlintStatus BinaryCompareSubCommand::compareMFA2() +{ +#ifndef NO_MSTARCHIVE + if (preFwOps() == FLINT_FAILED) { + return FLINT_FAILED; + } + if (!_fwOps->FwQuery(&_devInfo, true, false, true, false, (_flintParams.silent == false))) { + reportErr(true, FLINT_FAILED_QUERY_ERROR, "Device", _flintParams.device.c_str(), _fwOps->err()); + return FLINT_FAILED; + } + vector<u_int8_t> componentBuffer; + map_string_to_component matchingComponentsMap = _mfa2Pkg->getMatchingComponents((char*)_devInfo.fw_info.psid, _devInfo.fw_info.fw_ver[0]); + u_int32_t matchingSize = matchingComponentsMap.size(); + if (matchingSize == 0) { + printf("\33[2K\r");//clear the current line + printf("Binary comparison failed.\n"); + return FLINT_SUCCESS; + } + std::vector<u_int8_t> imgBuffInFile; + if (!_fwOps->FwExtract4MBImage(imgBuffInFile, true, (_flintParams.silent == false))) { + reportErr(true, FLINT_IMAGE_READ_ERROR, _fwOps->err()); + return FLINT_FAILED; + } + for (u_int32_t choice = 0; choice < matchingSize; choice++) { + if (_mfa2Pkg->unzipComponent(matchingComponentsMap, choice, componentBuffer) == false) { + reportErr(true, "-E- compareMFA2:Error occurred while extracting MFA2\n"); + return FLINT_FAILED; + } + + unsigned int i = 0; + for (; i < imgBuffInFile.size(); i++) { + if (componentBuffer[i] != imgBuffInFile[i]) { + break; + } + } + if (i == imgBuffInFile.size()) { + printf("\33[2K\r");//clear the current line + printf("Binary comparison success.\n"); + return FLINT_SUCCESS; + } + } + printf("\33[2K\r");//clear the current line + printf("Binary comparison failed.\n"); + return FLINT_SUCCESS; +#else + printf("MFA2 Binary comparison not supported.\n"); + return FLINT_FAILED; +#endif +} + + FlintStatus BinaryCompareSubCommand::executeCommand() { +#ifndef NO_MSTARCHIVE + string mfa2file = _flintParams.image; + _mfa2Pkg = MFA2::LoadMFA2Package(mfa2file); + if (_mfa2Pkg != NULL) { + _flintParams.mfa2_specified = true; + return compareMFA2(); + } +#endif + + vector<u_int8_t> device_critical; + vector<u_int8_t> device_non_critical; + vector<u_int8_t> image_critical; + vector<u_int8_t> image_non_critical; + + _flintParams.override_cache_replacement = true; if (preFwOps() == FLINT_FAILED) { if (_imgOps) { const char* errMessage = _imgOps->err(); @@ -1490,20 +1570,25 @@ FlintStatus BinaryCompareSubCommand::executeCommand() } return FLINT_FAILED; } + _fwType = _fwOps->FwType(); - if (!_fwOps->FwQuery(&_devInfo)) { + // query both image and device + if (!_fwOps->FwQuery(&_devInfo, true, false, true, false, (_flintParams.silent == false))) { reportErr(true, FLINT_FAILED_QUERY_ERROR, "Device", _flintParams.device.c_str(), _fwOps->err()); return FLINT_FAILED; } + if (!_imgOps->FwQuery(&_imgInfo)) { reportErr(true, FLINT_FAILED_QUERY_ERROR, "Image", _flintParams.image.c_str(), _imgOps->err()); return FLINT_FAILED; } + if (strcmp((char*)_imgInfo.fw_info.psid, (char*)_devInfo.fw_info.psid)) { printf("\33[2K\r");//clear the current line printf("Binary comparison failed - PSID mismatch.\n"); return FLINT_SUCCESS; } + for (int i = 0; i < 3; i++) { if (_imgInfo.fw_info.fw_ver[i] != _devInfo.fw_info.fw_ver[i]) { printf("\33[2K\r");//clear the current line @@ -1511,33 +1596,37 @@ FlintStatus BinaryCompareSubCommand::executeCommand() return FLINT_SUCCESS; } } - u_int32_t imgSize; + + u_int32_t imgSize = 0; + //on first call we get the image size if (!_fwOps->FwReadData(NULL, &imgSize)) { reportErr(true, FLINT_IMAGE_READ_ERROR, _fwOps->err()); return FLINT_FAILED; } - static u_int8_t* imgBuffOnDevice = NULL; - imgBuffOnDevice = new u_int8_t[imgSize]; - memset(imgBuffOnDevice, 0, imgSize); - if (!_fwOps->FwReadData((void*)imgBuffOnDevice, &imgSize, (_flintParams.silent == false))) { + std::vector<u_int8_t> imgBuffOnDevice(imgSize); + //on second call we fill it + if (!_fwOps->FwReadData((void*)(&imgBuffOnDevice[0]), &imgSize, _flintParams.silent == false)) { reportErr(true, FLINT_IMAGE_READ_ERROR, _fwOps->err()); return FLINT_FAILED; } + std::vector<u_int8_t> imgBuffInFile; - if (!_imgOps->FwExtract4MBImage(imgBuffInFile, false)) { - delete[] imgBuffOnDevice; + if (!_imgOps->FwExtract4MBImage(imgBuffInFile, false, (_flintParams.silent == false))) { reportErr(true, FLINT_IMAGE_READ_ERROR, _imgOps->err()); return FLINT_FAILED; } - for (unsigned int i = 0; i < imgBuffInFile.size(); i++) { - if (imgBuffOnDevice[i] != imgBuffInFile[i]) { - printf("\33[2K\r");//clear the current line - printf("Binary comparison failed - binary mismatch.\n"); - delete[] imgBuffOnDevice; - return FLINT_SUCCESS; - } + _imgOps->PrepItocSectionsForCompare(image_critical, image_non_critical); + _fwOps->PrepItocSectionsForCompare(device_critical, device_non_critical); + + if (image_critical != device_critical) { + printf("Binary comparison failed - binary mismatch.\n"); + return FLINT_SUCCESS; + } + if (image_non_critical != device_non_critical) { + printf("Binary comparison failed - binary mismatch.\n"); + return FLINT_SUCCESS; } - delete[] imgBuffOnDevice; + printf("\33[2K\r");//clear the current line printf("Binary comparison success.\n"); return FLINT_SUCCESS; @@ -1575,61 +1664,79 @@ BurnSubCommand:: ~BurnSubCommand() if (_burnParams.userVsd != NULL) { delete[] _burnParams.userVsd; } +#ifndef NO_MSTARCHIVE + if (_mfa2Pkg != NULL) { + delete _mfa2Pkg; + } +#endif } bool BurnSubCommand::verifyParams() { - if ((_flintParams.guid_specified || _flintParams.guids_specified) && (_flintParams.uid_specified)) { - reportErr(true, FLINT_COMMAND_FLAGS_ERROR, _name.c_str(), "either GUIDs / UID (using command line flags -guid(s) / -uid )"); - return false; - } - if ((_flintParams.mac_specified || _flintParams.macs_specified) && (_flintParams.uid_specified)) { - reportErr(true, FLINT_COMMAND_FLAGS_ERROR, _name.c_str(), "either MACs / UID (using command line flags -mac(s) / -uid )"); - return false; - } - bool GuidsFromUser = _flintParams.guid_specified || _flintParams.guids_specified || \ - _flintParams.uid_specified || \ - _flintParams.mac_specified || _flintParams.macs_specified; - if (GuidsFromUser && _flintParams.use_image_guids) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "GUIDs/UIDs/MACs", "-use_image_guids"); - return false; - } - if ((GuidsFromUser || _flintParams.use_image_guids) && _flintParams.blank_guids) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, _flintParams.use_image_guids ? \ - "-use_image_guids" : "GUIDs/UIDs/MACs", "-blank_guids"); - return false; - } - if (_flintParams.guid_specified && _flintParams.guids_specified) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-guids", "-guid"); - return false; - } - if (_flintParams.mac_specified && _flintParams.macs_specified) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-macs", "-mac"); - return false; - } - if (_flintParams.use_image_ps && _flintParams.vsd_specified) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-use_image_ps", "-vsd"); - return false; - } - if (_flintParams.ignore_dev_data && !_flintParams.nofs) { - reportErr(true, FLINT_INVALID_FLAG_WITHOUT_FLAG_ERROR, "-nofs", "-ignore_dev_data"); - return false; - } - if (_flintParams.use_dev_rom && _flintParams.use_image_rom) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "--use_dev_rom", "--use_image_rom"); - return false; - } - if (_flintParams.nofs || _flintParams.allow_psid_change || _flintParams.use_dev_rom) { - // attempt to fallback to legacy flow (direct flash access via FW) - _mccSupported = false; - } - if (_flintParams.image_reactivation && _flintParams.no_fw_ctrl) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-image_reactivation", "-no_fw_ctrl"); - return false; + if (_flintParams.mfa2_specified) { + if (_flintParams.use_latest_fw_version == true && _flintParams.num_of_args != 3) { + reportErr(true, FLINT_COMMAND_INCORRECT_FLAGS_ERROR, "Burn MFA2", "incorrect flag combination is supplied"); + return false; + } + if (_flintParams.use_latest_fw_version == false && _flintParams.num_of_args != 2) { + reportErr(true, FLINT_COMMAND_INCORRECT_FLAGS_ERROR, "Burn MFA2", "incorrect flag combination is supplied"); + return false; + } + return true; } - if (_flintParams.image_reactivation && _flintParams.override_cache_replacement) { - reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-image_reactivation", "-ocr"); - return false; + else { + if ((_flintParams.guid_specified || _flintParams.guids_specified) && (_flintParams.uid_specified)) { + reportErr(true, FLINT_COMMAND_FLAGS_ERROR, _name.c_str(), "either GUIDs / UID (using command line flags -guid(s) / -uid )"); + return false; + } + if ((_flintParams.mac_specified || _flintParams.macs_specified) && (_flintParams.uid_specified)) { + reportErr(true, FLINT_COMMAND_FLAGS_ERROR, _name.c_str(), "either MACs / UID (using command line flags -mac(s) / -uid )"); + return false; + } + bool GuidsFromUser = _flintParams.guid_specified || _flintParams.guids_specified || \ + _flintParams.uid_specified || \ + _flintParams.mac_specified || _flintParams.macs_specified; + if (GuidsFromUser && _flintParams.use_image_guids) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "GUIDs/UIDs/MACs", "-use_image_guids"); + return false; + } + if ((GuidsFromUser || _flintParams.use_image_guids) && _flintParams.blank_guids) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, _flintParams.use_image_guids ? \ + "-use_image_guids" : "GUIDs/UIDs/MACs", "-blank_guids"); + return false; + } + if (_flintParams.guid_specified && _flintParams.guids_specified) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-guids", "-guid"); + return false; + } + if (_flintParams.mac_specified && _flintParams.macs_specified) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-macs", "-mac"); + return false; + } + if (_flintParams.use_image_ps && _flintParams.vsd_specified) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-use_image_ps", "-vsd"); + return false; + } + if (_flintParams.ignore_dev_data && !_flintParams.nofs) { + reportErr(true, FLINT_INVALID_FLAG_WITHOUT_FLAG_ERROR, "-nofs", "-ignore_dev_data"); + return false; + } + if (_flintParams.use_dev_rom && _flintParams.use_image_rom) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "--use_dev_rom", "--use_image_rom"); + return false; + } + if (_flintParams.nofs || _flintParams.allow_psid_change || _flintParams.use_dev_rom) { + // attempt to fallback to legacy flow (direct flash access via FW) + _mccSupported = false; + } + if (_flintParams.image_reactivation && _flintParams.no_fw_ctrl) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-image_reactivation", "-no_fw_ctrl"); + return false; + } + if (_flintParams.image_reactivation && _flintParams.override_cache_replacement) { + reportErr(true, FLINT_INVALID_FLAG_WITH_FLAG_ERROR, "-image_reactivation", "-ocr"); + return false; + } } return true; } @@ -2114,6 +2221,13 @@ bool BurnSubCommand::checkMatchingExpRomDevId(const fw_info_t& info) FlintStatus BurnSubCommand::executeCommand() { +#ifndef NO_MSTARCHIVE + string mfa2file = _flintParams.image; + _mfa2Pkg = MFA2::LoadMFA2Package(mfa2file); + if (_mfa2Pkg != NULL) { + _flintParams.mfa2_specified = true; + } +#endif if (_flintParams.image_reactivation) { if (preFwOps(true) == FLINT_FAILED) { return FLINT_FAILED; @@ -2127,21 +2241,42 @@ FlintStatus BurnSubCommand::executeCommand() _devQueryRes = _fwOps->FwQuery(&_devInfo);//make query once more to refresh running FW version printf("\n-I- FW Image Reactivation succeeded.\n\n"); } - - if (preFwOps() == FLINT_FAILED) { - return FLINT_FAILED; + else { + if (preFwOps() == FLINT_FAILED) { + return FLINT_FAILED; + } } - //set fw type _fwType = _fwOps->FwType(); // query both image and device (deviceQuery can fail but we save rc) - _devQueryRes = _fwOps->FwQuery(&_devInfo); - if (!_imgOps->FwQuery(&_imgInfo)) { - reportErr(true, FLINT_FAILED_QUERY_ERROR, "image", _flintParams.image.c_str(), _imgOps->err()); - return FLINT_FAILED; + _devQueryRes = _fwOps->FwQuery(&_devInfo, true, false, true, false, (_flintParams.silent == false)); + if (_imgOps) { + if (!_imgOps->FwQuery(&_imgInfo)) { + reportErr(true, FLINT_FAILED_QUERY_ERROR, "image", _flintParams.image.c_str(), _imgOps->err()); + return FLINT_FAILED; + } } //updateBurnParams with input given by user updateBurnParams(); + + if (_flintParams.mfa2_specified) { + //check if the device is in LiveFish mode. If it is, this mode is unsupported + mfile *mf = _fwOps->getMfileObj(); + int is_livefish_mode = dm_is_livefish_mode(mf); + //check if the device is in FW control mode ("mcc flow"). Other flow is unsupported. + bool is_fw_ctrl = _fwOps->IsFsCtrlOperations(); + if (is_livefish_mode) { + reportErr(true, "Burning MFA2 is not supported in Livefish mode.\n"); + return FLINT_FAILED; + } + else if (!is_fw_ctrl) { + reportErr(true, "Burning MFA2 is not supported without FW control.\n"); + return FLINT_FAILED; + } + else { + return burnMFA2(); + } + } if (_fwType == FIT_FS3 || _fwType == FIT_FS4 || _fwType == FIT_FSCTRL) { return burnFs3(); } else if (_fwType == FIT_FS2) { @@ -2152,6 +2287,87 @@ FlintStatus BurnSubCommand::executeCommand() return FLINT_FAILED; } +u_int32_t SubCommand::getUserChoice(u_int32_t maximumValue) +{ + u_int32_t choice = 0xffff; + while (true) { + int res = scanf("%d", &choice); + if (res != 1) { + while (getchar() != '\n'); + printf("Invalid data entered, try again!\n"); + continue; + } + if (choice > maximumValue) { + printf("Please choose the version or 0 to exit:\n"); + continue; + } + break; + } + if (choice == 0) { + exit(0); + } + return choice; +} + +FlintStatus BurnSubCommand::burnMFA2() +{ +#ifndef NO_MSTARCHIVE + vector<u_int8_t> componentBuffer; + map_string_to_component matchingComponentsMap; + printf("-I- Fetching FW versions from MFA2 image, this operation may take a minute, please wait..\n"); + matchingComponentsMap = _mfa2Pkg->getMatchingComponents((char*)_devInfo.fw_info.psid, _devInfo.fw_info.fw_ver[0]); + u_int32_t matchingSize = matchingComponentsMap.size(); + if (matchingSize == 0) { + reportErr(true, "No matching binaries found for device %s\n", _flintParams.device.c_str()); + return FLINT_FAILED; + } + else { + //If there is only one matching FW binary, unzip it + if (matchingSize == 1) { + _mfa2Pkg->unzipComponent(matchingComponentsMap, 0, componentBuffer); + } + else { + //user wants the latest version automatically + if (_flintParams.use_latest_fw_version == true) { + if (_mfa2Pkg->unzipLatestVersionComponent(matchingComponentsMap, componentBuffer) == false) { + return FLINT_FAILED; + } + } + //otherwise, user must supply required version + else { + int i = 1; + printf("------FW Version Selection for %s------\n", _flintParams.device.c_str()); + for (map_string_to_component::iterator it = matchingComponentsMap.begin(); it != matchingComponentsMap.end(); it++) { + printf("%d. %s\n", i++, it->first.c_str()); + } + printf("-I- Please choose the version or 0 to exit:\n"); + u_int32_t choice = getUserChoice(matchingSize) - 1; + if (_mfa2Pkg->unzipComponent(matchingComponentsMap, choice, componentBuffer) == false) { + return FLINT_FAILED; + } + } + } + } + const char *imgTypeStr = fwImgTypeToStr(_devInfo.fw_type); + bool res = _fwOps->FwBurnAdvanced(componentBuffer, _burnParams); + if (!res) { + reportErr(true, FLINT_FSX_BURN_ERROR, imgTypeStr, _fwOps->err()); + return FLINT_FAILED; + } + else { + PRINT_PROGRESS(_burnParams.progressFunc, 101); + write_result_to_log(FLINT_SUCCESS, "", _flintParams.log_specified); + const char *resetRec = _fwOps->FwGetResetRecommandationStr(); + if (resetRec) { + printf("-I- %s\n", resetRec); + } + return FLINT_SUCCESS; + } +#else + return FLINT_FAILED; +#endif +} + /*********************** * Class: QuerySubCommand **********************/ diff --git a/flint/subcommands.h b/flint/subcommands.h index d05568a..ea8dbb8 100755 --- a/flint/subcommands.h +++ b/flint/subcommands.h @@ -51,6 +51,12 @@ #include "err_msgs.h" using namespace std; +#ifndef NO_MSTARCHIVE +#include "mlxarchive/mlxarchive_mfa2_package_gen.h" +#include "mlxarchive/mlxarchive_mfa2_utils.h" +using namespace mfa2; +#endif + //we might need to close the log from the main program in case of interrupt void close_log(); void print_time_to_log(); @@ -92,16 +98,18 @@ protected: sub_cmd_t _cmdType; bool _mccSupported; bool _imageReactivation; - +#ifndef NO_MSTARCHIVE + MFA2* _mfa2Pkg; +#endif //Methods that are commonly used in the various subcommands: //TODO: add middle classes and segregate as much of these common methods between these classes virtual bool verifyParams() {return true;}; bool basicVerifyParams(); void initDeviceFwParams(char *errBuff, FwOperations::fw_ops_params_t& fwParams); - FlintStatus openOps(bool ignoreSecurityAttributes = false); + FlintStatus openOps(bool ignoreSecurityAttributes = false, bool ignoreDToc = false); FlintStatus openIo(); - virtual FlintStatus preFwOps(bool ignoreSecurityAttributes = false); + virtual FlintStatus preFwOps(bool ignoreSecurityAttributes = false, bool ignoreDToc = false); virtual FlintStatus preFwAccess(); bool getRomsInfo(FBase *io, roms_info_t& romsInfo); @@ -110,7 +118,7 @@ protected: string getExpRomVerStr(const rom_info_t& info); string getRomProtocolStr(u_int8_t proto); string getRomSuppCpuStr(u_int8_t suppCpu); - + u_int32_t getUserChoice(u_int32_t maximumValue); static int verifyCbFunc(char *str); static int CbCommon(int completion, char *preStr, char *endStr = NULL); static int burnCbFs2Func(int completion); @@ -157,6 +165,9 @@ protected: public: SubCommand() : _fwOps(NULL), _imgOps(NULL), _io(NULL), _v(Wtv_Uninitilized), _maxCmdParamNum(-1), _minCmdParamNum(-1), _mccSupported(false), _imageReactivation(false) +#ifndef NO_MSTARCHIVE + , _mfa2Pkg(NULL) +#endif { _cmdType = SC_No_Cmd; memset(_errBuff, 0, sizeof(_errBuff)); @@ -173,22 +184,6 @@ public: inline string& getParamExp() {return this->_paramExp;} inline string& getExample() {return this->_example;} }; - -class BinaryCompareSubCommand : public SubCommand -{ -private: - u_int8_t _fwType; - fw_info_t _devInfo; - fw_info_t _imgInfo; - FwOperations::ExtBurnParams _burnParams; - bool _devQueryRes; - int _unknownProgress; // used to trace the progress of unknown progress. -public: - BinaryCompareSubCommand(); - ~BinaryCompareSubCommand(); - FlintStatus executeCommand(); - bool verifyParams(); -}; class BurnSubCommand : public SubCommand { private: @@ -198,8 +193,6 @@ private: FwOperations::ExtBurnParams _burnParams; bool _devQueryRes; int _unknownProgress; // used to trace the progress of unknown progress. - - FlintStatus checkFs3Fs4NeededFixes(bool& isFs3Fs4FixesNeeded); FlintStatus burnFs3(); FlintStatus burnFs2(); bool checkFwVersion(); @@ -209,6 +202,7 @@ private: bool checkMatchingExpRomDevId(const fw_info_t& info); bool dealWithGuids(); bool dealWithVSD(); + FlintStatus burnMFA2(); public: BurnSubCommand(); ~BurnSubCommand(); @@ -216,6 +210,24 @@ public: bool verifyParams(); }; +class BinaryCompareSubCommand : public SubCommand +{ +private: + u_int8_t _fwType; + fw_info_t _devInfo; + fw_info_t _imgInfo; + FwOperations::ExtBurnParams _burnParams; + bool _devQueryRes; + int _unknownProgress; // used to trace the progress of unknown progress. + FlintStatus compareMFA2(); +public: + BinaryCompareSubCommand(); + ~BinaryCompareSubCommand(); + + FlintStatus executeCommand(); + bool verifyParams(); +}; + class QuerySubCommand : public SubCommand { private: diff --git a/fw_comps_mgr/fw_comps_mgr.cpp b/fw_comps_mgr/fw_comps_mgr.cpp index 0616fee..88503d7 100755 --- a/fw_comps_mgr/fw_comps_mgr.cpp +++ b/fw_comps_mgr/fw_comps_mgr.cpp @@ -368,7 +368,7 @@ bool FwCompsMgr::queryComponentInfo(u_int32_t componentIndex, return true; } -reg_access_status_t FwCompsMgr::getGI(mfile *mf, struct tools_open_mgir *gi) +reg_access_status_t FwCompsMgr::getGI(mfile *mf, mgirReg *gi) { reg_access_status_t rc = ME_REG_ACCESS_OK; u_int32_t tp = 0; @@ -918,7 +918,7 @@ u_int8_t transRomType(u_int8_t mgirRomType) } } -void FwCompsMgr::extractRomInfo(tools_open_mgir *mgir, fwInfoT *fwQuery) +void FwCompsMgr::extractRomInfo(mgirReg *mgir, fwInfoT *fwQuery) { if (!fwQuery || !mgir) { return; @@ -977,7 +977,7 @@ bool FwCompsMgr::queryFwInfo(fwInfoT *query, bool next_boot_fw_ver) * MGIR */ reg_access_status_t rc; - struct tools_open_mgir mgir; + mgirReg mgir; memset(&mgir, 0, sizeof(mgir)); rc = getGI(_mf, &mgir); if (rc) { @@ -989,10 +989,10 @@ bool FwCompsMgr::queryFwInfo(fwInfoT *query, bool next_boot_fw_ver) query->hw_dev_id = mgir.hw_info.hw_dev_id; query->dev_id = mgir.hw_info.device_id; query->rev_id = mgir.hw_info.device_hw_revision; - query->security_type.secure_fw = mgir.fw_info.secure_fw; + query->security_type.secure_fw = mgir.fw_info.secured; query->security_type.signed_fw = mgir.fw_info.signed_fw; - query->security_type.debug_fw = mgir.fw_info.debug_fw; - query->security_type.dev_fw = mgir.fw_info.dev_fw; + query->security_type.debug_fw = mgir.fw_info.debug; + query->security_type.dev_fw = mgir.fw_info.dev; query->signed_fw = _compsQueryMap[FwComponent::COMPID_BOOT_IMG].comp_cap.signed_updates_only; query->base_mac_orig.uid = ((u_int64_t)mgir.hw_info.manufacturing_base_mac_47_32 << 32 | mgir.hw_info.manufacturing_base_mac_31_0); @@ -1172,7 +1172,7 @@ void FwCompsMgr::deal_with_signal() sig = mft_signal_is_fired(); if (sig) { unlock_flash_semaphore(); - // reset recieved signal + // reset received signal mft_signal_set_fired(0); // retore prev handler mft_signal_set_handling(0); diff --git a/fw_comps_mgr/fw_comps_mgr.h b/fw_comps_mgr/fw_comps_mgr.h index e6e389f..297d36e 100755 --- a/fw_comps_mgr/fw_comps_mgr.h +++ b/fw_comps_mgr/fw_comps_mgr.h @@ -63,6 +63,7 @@ typedef struct reg_access_hca_mcqs_reg comp_status_st; typedef struct reg_access_hca_mcqi_reg comp_info_st; typedef struct reg_access_hca_mcc_reg fsm_control_st; typedef struct reg_access_hca_mcqi_cap comp_cap_st; +typedef struct reg_access_hca_mgir mgirReg; typedef struct reg_access_hca_mcqi_version component_version_st; @@ -78,7 +79,7 @@ struct uid_entry { typedef struct { u_int8_t type; u_int8_t arch; - u_int32_t version; + reg_access_hca_rom_version version; } mgirRomInfo; typedef struct { @@ -463,9 +464,9 @@ private: void getInfoAsVersion(std::vector<u_int32_t>& infoData, component_version_st *cmpVer); - reg_access_status_t getGI(mfile *mf, struct tools_open_mgir *gi); + reg_access_status_t getGI(mfile *mf, mgirReg *gi); bool extractMacsGuids(fwInfoT *fwQuery); - void extractRomInfo(tools_open_mgir *mgir, fwInfoT *fwQuery); + void extractRomInfo(mgirReg *mgir, fwInfoT *fwQuery); bool refreshComponentsStatus(); std::vector<comp_query_st> _compsQueryMap; diff --git a/fw_comps_mgr/fw_comps_mgr_dma_access.cpp b/fw_comps_mgr/fw_comps_mgr_dma_access.cpp index 9219c66..07d8a78 100755 --- a/fw_comps_mgr/fw_comps_mgr_dma_access.cpp +++ b/fw_comps_mgr/fw_comps_mgr_dma_access.cpp @@ -179,6 +179,7 @@ bool DMAComponentAccess::accessComponent(u_int32_t updateHandle, u_int32_t offse prepareParameters(updateHandle, &accessData, offset + (data_size - leftSize), data, data_size, access, leftSize, page, mailboxPage); int nIteration = 0; while (leftSize > 0) { + memset((u_int8_t*)mailboxPage.va, 0, TOOLS_OPEN_MCDD_DESCRIPTOR_SIZE); memset(&mailboxVirtPtr_1, 0, TOOLS_OPEN_MCDD_DESCRIPTOR_SIZE);//set zero before each transaction maxDataSize = leftSize > PAGE_SIZE ? PAGE_SIZE : leftSize; mft_signal_set_handling(1); @@ -297,7 +298,7 @@ bool DMAComponentAccess::accessComponent(u_int32_t updateHandle, u_int32_t offse #ifndef UEFI_BUILD } catch (std::exception &e) { - DPRINTF("DMAComponentAccess::Exception occured %s\n", e.what()); + DPRINTF("DMAComponentAccess::Exception occurred %s\n", e.what()); return false; } #endif diff --git a/mad_ifc/mad_ifc.c b/mad_ifc/mad_ifc.c index 8bb5d51..8770b35 100644 --- a/mad_ifc/mad_ifc.c +++ b/mad_ifc/mad_ifc.c @@ -56,10 +56,10 @@ /***************************************************/ #if !defined(DISABLE_OFED) && !defined(NO_INBAND) // register access for variable size registers (like mfba) - #define MAD_IFC_ACCESS(mf, method, attr_id, attr_mod, data_struct, struct_name) \ + #define MAD_IFC_ACCESS(mf, method, attr_id, attr_mod, data_struct, struct_name, prefix) \ int status = 0; \ u_int8_t data[MAX_DATA_SIZE] = {0}; \ - tools_open_##struct_name##_pack(data_struct, data); \ + prefix##_##struct_name##_pack(data_struct, data); \ if (method != MAD_IFC_METHOD_GET && method != MAD_IFC_METHOD_SET) { \ return ME_ERROR; \ } \ @@ -69,14 +69,14 @@ } else { \ status = mib_smp_set(mf, data, attr_id, attr_mod); \ } \ - tools_open_##struct_name##_unpack(data_struct, data); \ + prefix##_##struct_name##_unpack(data_struct, data); \ DEBUG_PRINT_RECEIVE(data_struct, struct_name, method); \ if (status) { \ return (mad_ifc_status_t)status; \ } \ return ME_OK #else - #define MAD_IFC_ACCESS(mf, method, attr_id, attr_mod, data_struct, struct_name) \ + #define MAD_IFC_ACCESS(mf, method, attr_id, attr_mod, data_struct, struct_name, prefix) \ (void) mf; \ (void) method; \ (void) attr_id; \ @@ -88,9 +88,10 @@ /************************************ * Function: mad_ifc_port_info ************************************/ -mad_ifc_status_t mad_ifc_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_ib_port_info *port_info) +mad_ifc_status_t mad_ifc_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_ib_port_info *ib_port_info) { - MAD_IFC_ACCESS(mf, method, MAD_ATTR_PORT_INFO, attr_mod, port_info, ib_port_info); + MAD_IFC_ACCESS(mf, method, MAD_ATTR_PORT_INFO, attr_mod, ib_port_info, + ib_port_info, tools_open); } /************************************ @@ -98,47 +99,53 @@ mad_ifc_status_t mad_ifc_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t ************************************/ mad_ifc_status_t mad_ifc_node_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_node_info *node_info) { - MAD_IFC_ACCESS(mf, method, MAD_ATTR_NODE_INFO, attr_mod, node_info, node_info); + MAD_IFC_ACCESS(mf, method, MAD_ATTR_NODE_INFO, attr_mod, node_info, + node_info, tools_open); } /************************************ * Function: mad_ifc_extended_port_info ************************************/ -mad_ifc_status_t mad_ifc_extended_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_extended_ib_port_info *ext_port_info) +mad_ifc_status_t mad_ifc_extended_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_extended_ib_port_info *extended_ib_port_info) { - MAD_IFC_ACCESS(mf, method, MAD_ATTR_NODE_INFO, attr_mod, ext_port_info, extended_ib_port_info); + MAD_IFC_ACCESS(mf, method, MAD_ATTR_NODE_INFO, attr_mod, extended_ib_port_info, + extended_ib_port_info, tools_open); } /************************************ * Function: mad_ifc_general_info_smp ************************************/ -mad_ifc_status_t mad_ifc_general_info_smp(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, union tools_open_smp_vsp_general_info *general_info) +mad_ifc_status_t mad_ifc_general_info_smp(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, union tools_open_smp_vsp_general_info *smp_vsp_general_info) { - MAD_IFC_ACCESS(mf, method, MAD_ATTR_GENERAL_INFO_SMP, attr_mod, general_info, smp_vsp_general_info); + MAD_IFC_ACCESS(mf, method, MAD_ATTR_GENERAL_INFO_SMP, attr_mod, + smp_vsp_general_info, smp_vsp_general_info, tools_open); } /************************************ * Function: mad_ifc_general_info_hw ************************************/ -mad_ifc_status_t mad_ifc_general_info_hw(mfile *mf, struct tools_open_hw_info *hwinfo) -{ - MAD_IFC_ACCESS(mf, MAD_IFC_METHOD_GET, MAD_ATTR_GENERAL_INFO_SMP, 0, hwinfo, hw_info); +mad_ifc_status_t mad_ifc_general_info_hw(mfile *mf, + struct reg_access_hca_mgir_hardware_info *mgir_hardware_info) { + MAD_IFC_ACCESS(mf, MAD_IFC_METHOD_GET, MAD_ATTR_GENERAL_INFO_SMP, 0, mgir_hardware_info, + mgir_hardware_info, reg_access_hca); } /************************************ * Function: mad_ifc_general_info_fw ************************************/ -mad_ifc_status_t mad_ifc_general_info_fw(mfile *mf, struct tools_open_fw_info *fwinfo) -{ - MAD_IFC_ACCESS(mf, MAD_IFC_METHOD_GET, MAD_ATTR_GENERAL_INFO_SMP, 1, fwinfo, fw_info); +mad_ifc_status_t mad_ifc_general_info_fw(mfile *mf, + struct reg_access_hca_mgir_fw_info *mgir_fw_info) { + MAD_IFC_ACCESS(mf, MAD_IFC_METHOD_GET, MAD_ATTR_GENERAL_INFO_SMP, 1, mgir_fw_info, + mgir_fw_info, reg_access_hca); } /************************************ -* Function: mad_ifc_general_info_hw +* Function: mad_ifc_general_info_sw ************************************/ -mad_ifc_status_t mad_ifc_general_info_sw(mfile *mf, struct tools_open_sw_info *swinfo) -{ - MAD_IFC_ACCESS(mf, MAD_IFC_METHOD_GET, MAD_ATTR_GENERAL_INFO_SMP, 2, swinfo, sw_info); +mad_ifc_status_t mad_ifc_general_info_sw(mfile *mf, + struct reg_access_hca_mgir_sw_info *mgir_sw_info) { + MAD_IFC_ACCESS(mf, MAD_IFC_METHOD_GET, MAD_ATTR_GENERAL_INFO_SMP, 2, mgir_sw_info, + mgir_sw_info, reg_access_hca); } /************************************ * Function: mad_ifc_err2str diff --git a/mad_ifc/mad_ifc.h b/mad_ifc/mad_ifc.h index 3e21967..3a8752d 100644 --- a/mad_ifc/mad_ifc.h +++ b/mad_ifc/mad_ifc.h @@ -41,6 +41,7 @@ extern "C" { #include "mtcr_ib.h" #endif #include <tools_layouts/tools_open_layouts.h> +#include <tools_layouts/reg_access_hca_layouts.h> typedef enum { MAD_IFC_METHOD_GET = MACCESS_REG_METHOD_GET, @@ -55,9 +56,12 @@ mad_ifc_status_t mad_ifc_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t mad_ifc_status_t mad_ifc_node_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_node_info *node_info); mad_ifc_status_t mad_ifc_extended_port_info(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, struct tools_open_extended_ib_port_info *ext_port_info); mad_ifc_status_t mad_ifc_general_info_smp(mfile *mf, mad_ifc_method_t method, u_int16_t attr_mod, union tools_open_smp_vsp_general_info *general_info); -mad_ifc_status_t mad_ifc_general_info_hw(mfile *mf, struct tools_open_hw_info *hw_info); -mad_ifc_status_t mad_ifc_general_info_fw(mfile *mf, struct tools_open_fw_info *fw_info); -mad_ifc_status_t mad_ifc_general_info_sw(mfile *mf, struct tools_open_sw_info *sw_info); +mad_ifc_status_t mad_ifc_general_info_hw(mfile *mf, + struct reg_access_hca_mgir_hardware_info *hw_info); +mad_ifc_status_t mad_ifc_general_info_fw(mfile *mf, + struct reg_access_hca_mgir_fw_info *fw_info); +mad_ifc_status_t mad_ifc_general_info_sw(mfile *mf, + struct reg_access_hca_mgir_sw_info *sw_info); #ifdef __cplusplus } #endif diff --git a/man/mstarchive.1 b/man/mstarchive.1 index 44698a7..c1a4c82 100644 --- a/man/mstarchive.1 +++ b/man/mstarchive.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTARCHIVE "1" "September 2019" "mstarchive NAME" "User Commands" +.TH MSTARCHIVE "1" "December 2019" "mstarchive NAME" "User Commands" .SH NAME mstarchive \- manual page for mstarchive NAME .SH DESCRIPTION diff --git a/man/mstconfig.1 b/man/mstconfig.1 index d1d6fb0..e06e2d0 100644 --- a/man/mstconfig.1 +++ b/man/mstconfig.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTCONFIG, "1" "September 2019" "mstconfig, mstflint 4.13.1, built on Sep 11 2019, 21:08:02. Git SHA Hash: N/A" "User Commands" +.TH MSTCONFIG, "1" "December 2019" "mstconfig, mstflint 4.13.3, built on Dec 30 2019, 11:42:10. Git SHA Hash: N/A" "User Commands" .SH NAME -mstconfig, \- manual page for mstconfig, mstflint 4.13.1, built on Sep 11 2019, 21:08:02. Git SHA Hash: N/A +mstconfig, \- manual page for mstconfig, mstflint 4.13.3, built on Dec 30 2019, 11:42:10. Git SHA Hash: N/A .SH DESCRIPTION .IP NAME: diff --git a/man/mstcongestion.1 b/man/mstcongestion.1 index 6fc8f6d..f65ba68 100644 --- a/man/mstcongestion.1 +++ b/man/mstcongestion.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTCONGESTION, "1" "September 2019" "mstcongestion, mstflint 4.13.1, built on Sep 12 2019, 09:06:00. Git SHA Hash: N/A" "User Commands" +.TH MSTCONGESTION, "1" "December 2019" "mstcongestion, mstflint 4.13.3, built on Dec 30 2019, 11:44:01. Git SHA Hash: N/A" "User Commands" .SH NAME -mstcongestion, \- manual page for mstcongestion, mstflint 4.13.1, built on Sep 12 2019, 09:06:00. Git SHA Hash: N/A +mstcongestion, \- manual page for mstcongestion, mstflint 4.13.3, built on Dec 30 2019, 11:44:01. Git SHA Hash: N/A .SH DESCRIPTION NAME .IP diff --git a/man/mstflint.1 b/man/mstflint.1 index 8fb04aa..535a9fc 100644 --- a/man/mstflint.1 +++ b/man/mstflint.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTFLINT, "1" "September 2019" "mstflint, mstflint 4.13.1, built on Sep 11 2019, 21:08:43. Git SHA Hash: N/A" "User Commands" +.TH MSTFLINT, "1" "December 2019" "mstflint, mstflint 4.13.3, built on Dec 30 2019, 11:43:54. Git SHA Hash: N/A" "User Commands" .SH NAME -mstflint, \- manual page for mstflint, mstflint 4.13.1, built on Sep 11 2019, 21:08:43. Git SHA Hash: N/A +mstflint, \- manual page for mstflint, mstflint 4.13.3, built on Dec 30 2019, 11:43:54. Git SHA Hash: N/A .SH DESCRIPTION NAME .IP @@ -11,8 +11,8 @@ SYNOPSIS .IP MstFlint [OPTIONS] <command> [Parameters] .IP -[\-d|\-\-device <device>] [\-i|\-\-image <image>] [\-\-ir] [\-\-image_reactivation] [\-h|\-\-help] -[\-\-hh] [\-y|\-\-yes] [\-\-no] [\-\-guid <GUID>] [\-\-guids <GUIDS...>] [\-\-mac <MAC>] +[\-d|\-\-device <device>] [\-i|\-\-image <image>] [\-\-latest_fw] [\-\-ir] [\-h|\-\-help] [\-\-hh] +[\-y|\-\-yes] [\-\-no] [\-\-guid <GUID>] [\-\-guids <GUIDS...>] [\-\-mac <MAC>] [\-\-macs <MACs...>] [\-\-uid <UID>] [\-\-blank_guids] [\-\-clear_semaphore] [\-\-qq] [\-\-low_cpu] [\-\-flashed_version] [\-\-nofs] [\-\-allow_rom_change] [\-\-override_cache_replacement] [\-\-no_flash_verify] [\-\-use_fw] [\-s|\-\-silent] @@ -40,10 +40,10 @@ Commands affected: all : Binary image file. Commands affected: burn, verify .TP -\fB\-\-ir\fR +\fB\-\-latest_fw\fR : Commands affected: burn .TP -\fB\-\-image_reactivation\fR +\fB\-\-ir\fR : Commands affected: burn .TP \fB\-h\fR|\-\-help @@ -401,6 +401,12 @@ image_reactivate|ir : Reactivate previous flash image. For FW .IP controlled devices only. +.TP +binary_compare|bc +: Binary compare between device firmware and +.IP +given BIN file. If there is a silent mode, +no progress is displayed. .PP RETURN VALUES .TP diff --git a/man/mstfwmanager.1 b/man/mstfwmanager.1 index e865884..28d3365 100644 --- a/man/mstfwmanager.1 +++ b/man/mstfwmanager.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTFWMANAGER "1" "September 2019" "mstfwmanager 1.0, mstflint 4.13.1, built on Sep 12 2019, 09:05:38. Git SHA Hash: N/A" "User Commands" +.TH MSTFWMANAGER "1" "December 2019" "mstfwmanager 1.0, mstflint 4.13.3, built on Dec 30 2019, 11:42:53. Git SHA Hash: N/A" "User Commands" .SH NAME -mstfwmanager \- manual page for mstfwmanager 1.0, mstflint 4.13.1, built on Sep 12 2019, 09:05:38. Git SHA Hash: N/A +mstfwmanager \- manual page for mstfwmanager 1.0, mstflint 4.13.3, built on Dec 30 2019, 11:42:53. Git SHA Hash: N/A .SH DESCRIPTION NAME .IP diff --git a/man/mstfwreset.1 b/man/mstfwreset.1 index e7b9fa6..4f7ecb9 100644 --- a/man/mstfwreset.1 +++ b/man/mstfwreset.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTFWRESET "1" "September 2019" "mstfwreset 1.0.0, mstflint 4.13.1, built on Sep 12 2019, 09:04:29. Git SHA Hash: N/A" "User Commands" +.TH MSTFWRESET "1" "December 2019" "mstfwreset 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A" "User Commands" .SH NAME -mstfwreset \- manual page for mstfwreset 1.0.0, mstflint 4.13.1, built on Sep 12 2019, 09:04:29. Git SHA Hash: N/A +mstfwreset \- manual page for mstfwreset 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A .SH DESCRIPTION usage: mstfwreset \fB\-\-device\fR DEVICE [\-\-level {0,3,4,5}] [\-\-type {0,1}] [\-\-yes] .IP diff --git a/man/mstfwtrace.1 b/man/mstfwtrace.1 index cac2275..8ab1f39 100644 --- a/man/mstfwtrace.1 +++ b/man/mstfwtrace.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTFWTRACE, "1" "September 2019" "mstfwtrace, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A" "User Commands" +.TH MSTFWTRACE, "1" "December 2019" "mstfwtrace, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A" "User Commands" .SH NAME -mstfwtrace, \- manual page for mstfwtrace, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A +mstfwtrace, \- manual page for mstfwtrace, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A .SH DESCRIPTION usage: mstfwtrace \fB\-d\fR|\-\-device DEVICE [options] .SS "optional arguments:" diff --git a/man/mstlink.1 b/man/mstlink.1 index 451bae5..45ad236 100644 --- a/man/mstlink.1 +++ b/man/mstlink.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTLINK, "1" "September 2019" "mstlink, mstflint 4.13.1, built on Sep 11 2019, 21:09:35. Git SHA Hash: N/A" "User Commands" +.TH MSTLINK, "1" "December 2019" "mstlink, mstflint 4.13.3, built on Dec 30 2019, 11:45:43. Git SHA Hash: N/A" "User Commands" .SH NAME -mstlink, \- manual page for mstlink, mstflint 4.13.1, built on Sep 11 2019, 21:09:35. Git SHA Hash: N/A +mstlink, \- manual page for mstlink, mstflint 4.13.3, built on Dec 30 2019, 11:45:43. Git SHA Hash: N/A .SH DESCRIPTION .IP NAME: @@ -14,7 +14,7 @@ mstlink [OPTIONS] .IP DESCRIPTION: .IP -The mlxlink tool is used to check and debug link status and issues related to them. +The mstlink tool is used to check and debug link status and issues related to them. The tool can be used on different links and cables (passive, active, transceiver and backplane). .IP OPTIONS: @@ -42,6 +42,9 @@ OPTIONS: .TP \fB\-\-node\fR <node> : the node within each depth (PCIE only) +.TP +\fB\-\-json\fR +: Print the output in json format .IP QUERIES: .TP diff --git a/man/mstmcra.1 b/man/mstmcra.1 index 0babe1b..fb1d362 100644 --- a/man/mstmcra.1 +++ b/man/mstmcra.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTMCRA "1" "September 2019" "mstmcra Mellanox Configuration Registers Access tool" "User Commands" +.TH MSTMCRA "1" "December 2019" "mstmcra Mellanox Configuration Registers Access tool" "User Commands" .SH NAME mstmcra \- manual page for mstmcra Mellanox Configuration Registers Access tool .SH DESCRIPTION diff --git a/man/mstmread.1 b/man/mstmread.1 index 7e11976..c7cb9de 100644 --- a/man/mstmread.1 +++ b/man/mstmread.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTMREAD "1" "September 2019" "mstmread <device> <addr>" "User Commands" +.TH MSTMREAD "1" "December 2019" "mstmread <device> <addr>" "User Commands" .SH NAME mstmread \- manual page for mstmread <device> <addr> .SH DESCRIPTION diff --git a/man/mstmtserver.1 b/man/mstmtserver.1 index bd05f0d..6f19636 100644 --- a/man/mstmtserver.1 +++ b/man/mstmtserver.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH INVALID "1" "September 2019" "Invalid switch "-version"." "User Commands" +.TH INVALID "1" "December 2019" "Invalid switch "-version"." "User Commands" .SH NAME Invalid \- manual page for Invalid switch "-version". .SH DESCRIPTION diff --git a/man/mstmwrite.1 b/man/mstmwrite.1 index b0ec322..d62155f 100644 --- a/man/mstmwrite.1 +++ b/man/mstmwrite.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTMWRITE "1" "September 2019" "mstmwrite <device> <addr> <value>" "User Commands" +.TH MSTMWRITE "1" "December 2019" "mstmwrite <device> <addr> <value>" "User Commands" .SH NAME mstmwrite \- manual page for mstmwrite <device> <addr> <value> .SH DESCRIPTION diff --git a/man/mstprivhost.1 b/man/mstprivhost.1 index b32a3bd..705eca3 100644 --- a/man/mstprivhost.1 +++ b/man/mstprivhost.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTPRIVHOST "1" "September 2019" "mstprivhost 1.0.0, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A" "User Commands" +.TH MSTPRIVHOST "1" "December 2019" "mstprivhost 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A" "User Commands" .SH NAME -mstprivhost \- manual page for mstprivhost 1.0.0, mstflint 4.13.1, built on Sep 11 2019, 21:07:10. Git SHA Hash: N/A +mstprivhost \- manual page for mstprivhost 1.0.0, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: N/A .SH DESCRIPTION usage: mstprivhost [\-h] [\-v] \fB\-\-device\fR DEVICE [\-\-disable_rshim] .IP diff --git a/man/mstreg.1 b/man/mstreg.1 index 636d264..ab7f2df 100644 --- a/man/mstreg.1 +++ b/man/mstreg.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTREG, "1" "September 2019" "mstreg, mstflint 4.13.1, built on Sep 11 2019, 21:09:23. Git SHA Hash: N/A" "User Commands" +.TH MSTREG, "1" "December 2019" "mstreg, mstflint 4.13.3, built on Dec 30 2019, 11:44:54. Git SHA Hash: N/A" "User Commands" .SH NAME -mstreg, \- manual page for mstreg, mstflint 4.13.1, built on Sep 11 2019, 21:09:23. Git SHA Hash: N/A +mstreg, \- manual page for mstreg, mstflint 4.13.3, built on Dec 30 2019, 11:44:54. Git SHA Hash: N/A .SH DESCRIPTION .IP NAME: diff --git a/man/mstregdump.1 b/man/mstregdump.1 index e827086..818be82 100644 --- a/man/mstregdump.1 +++ b/man/mstregdump.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH MSTREGDUMP, "1" "September 2019" "mstregdump, mstflint 4.13.1, built on Sep 11 2019, 21:08:50. Git SHA Hash: N/A" "User Commands" +.TH MSTREGDUMP, "1" "December 2019" "mstregdump, mstflint 4.13.3, built on Dec 30 2019, 11:44:04. Git SHA Hash: N/A" "User Commands" .SH NAME -mstregdump, \- manual page for mstregdump, mstflint 4.13.1, built on Sep 11 2019, 21:08:50. Git SHA Hash: N/A +mstregdump, \- manual page for mstregdump, mstflint 4.13.3, built on Dec 30 2019, 11:44:04. Git SHA Hash: N/A .SH DESCRIPTION .IP Mellanox mstregdump utility, dumps device internal configuration data diff --git a/man/mstresourcedump.1 b/man/mstresourcedump.1 new file mode 100644 index 0000000..a1725d6 --- /dev/null +++ b/man/mstresourcedump.1 @@ -0,0 +1,32 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. +.TH RESOURCEDUMP, "1" "December 2019" "ResourceDump, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash:" "User Commands" +.SH NAME +ResourceDump, \- manual page for ResourceDump, mstflint 4.13.3, built on Dec 30 2019, 11:40:05. Git SHA Hash: +.SH DESCRIPTION +usage: mstresourcedump.py [\-h] [\-v] {dump,query} ... +.SS "optional arguments:" +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +Shows tool version +.SS "commands:" +.IP +{dump,query} +.PP +Use 'mstresourcedump <command> \fB\-h\fR' to read about a specific command. +.PP +N/A +.SH "SEE ALSO" +The full documentation for +.B ResourceDump, +is maintained as a Texinfo manual. If the +.B info +and +.B ResourceDump, +programs are properly installed at your site, the command +.IP +.B info ResourceDump, +.PP +should give you access to the complete manual. diff --git a/man/mstvpd.1 b/man/mstvpd.1 index fe93b8f..dd6e36f 100644 --- a/man/mstvpd.1 +++ b/man/mstvpd.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. -.TH USAGE: "1" "September 2019" "Usage: mstvpd [-m|-n|-r] [-t ##] <file> [-- keyword ...]" "User Commands" +.TH USAGE: "1" "December 2019" "Usage: mstvpd [-m|-n|-r] [-t ##] <file> [-- keyword ...]" "User Commands" .SH NAME Usage: \- manual page for Usage: mstvpd [-m|-n|-r] [-t ##] <file> [-- keyword ...] .SH SYNOPSIS diff --git a/mflash/mflash.c b/mflash/mflash.c index 86c59cd..589de26 100755 --- a/mflash/mflash.c +++ b/mflash/mflash.c @@ -2672,7 +2672,7 @@ int get_dev_info(mflash *mfl) if (dev_flags & MDEVS_MLNX_OS) { #ifndef UEFI_BUILD reg_access_status_t rc; - struct tools_open_mgir mgir; + struct reg_access_hca_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); diff --git a/mlxarchive/Makefile.am b/mlxarchive/Makefile.am index 193384f..47da9e8 100644..100755 --- a/mlxarchive/Makefile.am +++ b/mlxarchive/Makefile.am @@ -63,6 +63,7 @@ mstarchive_LDADD = libmstarchive.a\ $(USER_DIR)/tools_layouts/libtools_layouts.a\ $(USER_DIR)/xz_utils/libxz_utils.a\ $(USER_DIR)/ext_libs/minixz/libminixz.a\ + $(USER_DIR)/xz_utils/libxz_utils.a \ $(CURL_LIBS)\ -lboost_regex -lboost_filesystem -lboost_system \ -llzma -lm $(LIBSTD_CPP) ${LDL} diff --git a/mlxarchive/Makefile.in b/mlxarchive/Makefile.in index d40ebaa..5562aca 100644 --- a/mlxarchive/Makefile.in +++ b/mlxarchive/Makefile.in @@ -168,7 +168,8 @@ mstarchive_DEPENDENCIES = libmstarchive.a \ $(USER_DIR)/reg_access/libreg_access.a \ $(USER_DIR)/tools_layouts/libtools_layouts.a \ $(USER_DIR)/xz_utils/libxz_utils.a \ - $(USER_DIR)/ext_libs/minixz/libminixz.a $(am__DEPENDENCIES_1) \ + $(USER_DIR)/ext_libs/minixz/libminixz.a \ + $(USER_DIR)/xz_utils/libxz_utils.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_3) $(am__append_3) AM_V_P = $(am__v_P_@AM_V@) @@ -439,10 +440,10 @@ mstarchive_LDADD = libmstarchive.a \ $(USER_DIR)/reg_access/libreg_access.a \ $(USER_DIR)/tools_layouts/libtools_layouts.a \ $(USER_DIR)/xz_utils/libxz_utils.a \ - $(USER_DIR)/ext_libs/minixz/libminixz.a $(CURL_LIBS) \ - -lboost_regex -lboost_filesystem -lboost_system -llzma -lm \ - $(LIBSTD_CPP) ${LDL} $(am__append_1) $(am__append_2) \ - $(am__append_3) + $(USER_DIR)/ext_libs/minixz/libminixz.a \ + $(USER_DIR)/xz_utils/libxz_utils.a $(CURL_LIBS) -lboost_regex \ + -lboost_filesystem -lboost_system -llzma -lm $(LIBSTD_CPP) \ + ${LDL} $(am__append_1) $(am__append_2) $(am__append_3) all: all-am .SUFFIXES: diff --git a/mlxarchive/mfa2_buff.h b/mlxarchive/mfa2_buff.h index d716304..8c1dbd2 100755 --- a/mlxarchive/mfa2_buff.h +++ b/mlxarchive/mfa2_buff.h @@ -36,7 +36,13 @@ public: int seek(long offset, int whence); long tell(); void rewind(); + u_int8_t* getBuffer() const { + return m_buff; + } + long getSize() const { + return m_size; + } private: u_int8_t * m_buff; long m_pos; diff --git a/mlxarchive/mlxarchive_mfa2.cpp b/mlxarchive/mlxarchive_mfa2.cpp index 6118d3d..aca00f0 100644..100755 --- a/mlxarchive/mlxarchive_mfa2.cpp +++ b/mlxarchive/mlxarchive_mfa2.cpp @@ -176,12 +176,16 @@ MFA2 * MFA2::LoadMFA2Package(const string & file_name) { if(!mfa2pkg->unpack(mfa2buff)) { delete mfa2pkg; mfa2pkg = NULL; + return NULL; } + mfa2pkg->setBufferAndZipOffset(mfa2buff.getBuffer(), mfa2buff.getSize(), mfa2buff.tell()); return mfa2pkg; } bool MFA2::unpack(Mfa2Buffer & buff) { - _fingerPrint.unpack(buff); + if (!_fingerPrint.unpack(buff)) { + return false; + } _packageDescriptor.unpack(buff); u_int16_t devCount = _packageDescriptor.getDeviceDescriptorsCount(); u_int16_t compCount = _packageDescriptor.getComponentsCount(); @@ -226,9 +230,95 @@ void MFA2::dump() { const ComponentDescriptor & compDescr = compObj.getComponentDescriptor(); printf(" Index : %u\n", compIndex); printf(" Version : %s\n", compDescr.getVersionExtension().getVersion(true).c_str()); - printf(" Date : %s\n", compDescr.getVersionExtension().getDateAndTime().c_str()); + char buffer[32] = { 0 }; + compDescr.getVersionExtension().getDateAndTime(buffer); + printf(" Date : %s\n", buffer); } } -// printf("Components : %u\n", compCount); +} + +bool MFA2::extractComponent(Component* requiredComponent, vector<u_int8_t>& fwBinaryData) +{ + PackageDescriptor packageDescriptor = getPackageDescriptor(); + u_int64_t totalSize = packageDescriptor.getComponentsBlockSize(); + u_int32_t zipOffset = packageDescriptor.getComponentsBlockOffset(); + + vector<u_int8_t> unzippedBlockBuff; + unzippedBlockBuff.resize(totalSize); + vector<u_int8_t> zippedBuff = getBuffer(); + u_int8_t* zippedData = (u_int8_t*)zippedBuff.data() + zipOffset; + int32_t retVal = xz_decompress_crc32(zippedData, zippedBuff.size() - zipOffset, unzippedBlockBuff.data(), totalSize); + if (retVal != (int32_t)totalSize) { + printf("Decompress error occurred %s\n", xz_get_error(retVal)); + return false; + } + u_int32_t requiredOffset = requiredComponent->getBinaryComponentOffset(); + u_int32_t componentBinarySize = requiredComponent->getComponentBinarySize() - strlen(FINGERPRINT_MFA2); + fwBinaryData.resize(componentBinarySize); + for (unsigned int index = 0; index < componentBinarySize; index++) { + fwBinaryData[index] = unzippedBlockBuff[requiredOffset + index + strlen(FINGERPRINT_MFA2)];//skip 16 bytes from decompressed file ! + } + return true; +} + +bool MFA2::unzipLatestVersionComponent(map_string_to_component& matchingComponentsMap, vector<u_int8_t>& fwBinaryData) +{ + map_string_to_component::iterator itAtKey = matchingComponentsMap.find(_latestComponentKey); + if (itAtKey == matchingComponentsMap.end()) { + return false; + } + Component* requiredComponent = &itAtKey->second; + return extractComponent(requiredComponent, fwBinaryData); +} + +bool MFA2::unzipComponent(map_string_to_component& matchingComponentsMap, u_int32_t choice, vector<u_int8_t>& fwBinaryData) +{ + if (choice >= matchingComponentsMap.size()) { + return false; + } + map_string_to_component::iterator itAtOffset = matchingComponentsMap.begin(); + std::advance(itAtOffset, choice); + Component* requiredComponent = &itAtOffset->second; + return extractComponent(requiredComponent, fwBinaryData); +} + +map_string_to_component MFA2::getMatchingComponents(char* device_psid, int deviceMajorVer) +{ + map_string_to_component matchingComponentsMap; + PackageDescriptor packageDescriptor = getPackageDescriptor(); + u_int16_t devCount = packageDescriptor.getDeviceDescriptorsCount(); + Version currentLatestVersion; + + for (u_int16_t index = 0; index < devCount; index++) { + DeviceDescriptor devDescriptor = getDeviceDescriptor(index); + string psid = devDescriptor.getPSIDExtension().getString(); + if (strcmp((char*)psid.c_str(), device_psid)) { + continue; + } + u_int8_t compPtrCount = devDescriptor.getComponentPointerExtensionsCount(); + for (u_int8_t comp = 0; comp < compPtrCount; comp++) { + const ComponentPointerExtension& compPtr = devDescriptor.getComponentPointerExtension(comp); + u_int16_t compIndex = compPtr.getComponentIndex(); + Component compObj = getComponentObject(compIndex); + const ComponentDescriptor & compDescr = compObj.getComponentDescriptor(); + u_int8_t majorVer = compDescr.getVersionExtension().getMajor(); + if (deviceMajorVer != majorVer) { + continue; + } + char dateTimeBuffer[32] = { 0 }; + compDescr.getVersionExtension().getDateAndTime(dateTimeBuffer); + VersionExtension currentVersion = compDescr.getVersionExtension(); + string currentVersionString = currentVersion.getVersion(true); + string mapKey = currentVersionString + " " + dateTimeBuffer; + matchingComponentsMap.insert(std::pair<string, Component>(mapKey, compObj)); + Version version(currentVersionString); + //find the latest matching FW version + if (version > currentLatestVersion) { + currentLatestVersion = version; + _latestComponentKey = mapKey; + } + } + } + return matchingComponentsMap; } diff --git a/mlxarchive/mlxarchive_mfa2.h b/mlxarchive/mlxarchive_mfa2.h index 9a703e7..88236d7 100644..100755 --- a/mlxarchive/mlxarchive_mfa2.h +++ b/mlxarchive/mlxarchive_mfa2.h @@ -43,7 +43,7 @@ #include <string> #include <vector> - +#include <map> #include <compatibility.h> #include "mlxarchive_mfa2_utils.h" @@ -53,9 +53,9 @@ using namespace std; -#define MFA2_FINGER_PRINT "MLNX.MFA2.XZ.00!" -namespace mfa2 { +namespace mfa2 { + typedef map <string, Component> map_string_to_component; class MFA2 { private: @@ -63,11 +63,14 @@ private: PackageDescriptor _packageDescriptor; vector<DeviceDescriptor> _deviceDescriptors; vector<Component> _components; - + string _latestComponentKey; + long _zipOffset; //void updateSHA256(); + vector<u_int8_t> mfa2Buffer; void pack(vector<u_int8_t>& buff); void packDescriptors(vector<u_int8_t>& buff) const; bool unpack(Mfa2Buffer & buff); + bool extractComponent(Component* requiredComponent, vector<u_int8_t>& fwBinaryData); public: MFA2(PackageDescriptor packageDescriptor, vector<DeviceDescriptor> deviceDescriptors, @@ -75,12 +78,46 @@ public: _fingerPrint(MFA2_FINGER_PRINT), _packageDescriptor(packageDescriptor), _deviceDescriptors(deviceDescriptors), - _components(components) {}; + _components(components), _zipOffset(0){}; virtual ~MFA2() {} static MFA2 * LoadMFA2Package(const string & file_name); void generateBinary(vector<u_int8_t>& buff); void dump(); + PackageDescriptor getPackageDescriptor() const { + return _packageDescriptor; + } + + long getZipOffset() { + return _zipOffset; + } + + u_int16_t getDeviceCount() const { + return _packageDescriptor.getDeviceDescriptorsCount(); + } + DeviceDescriptor getDeviceDescriptor(int index) const { + return _deviceDescriptors[index]; + } + + Component getComponentObject(int compIndex) const { + return _components[compIndex]; + } + + void setBufferAndZipOffset(u_int8_t* buffer, long length, long zipOffset) + { + mfa2Buffer.resize(length); + for (int i = 0; i < length; i++) { + mfa2Buffer[i] = buffer[i]; + } + _zipOffset = zipOffset; + } + + vector<u_int8_t> getBuffer() { + return mfa2Buffer; + } + map_string_to_component getMatchingComponents(char* psid, int majorVer); + bool unzipComponent(map_string_to_component& matchingComponentsMap, u_int32_t choice, vector<u_int8_t>& fwBinaryData); + bool unzipLatestVersionComponent(map_string_to_component& matchingComponentsMap, vector<u_int8_t>& fwBinaryData); }; } diff --git a/mlxarchive/mlxarchive_mfa2_builder.cpp b/mlxarchive/mlxarchive_mfa2_builder.cpp index a8f0dd1..850c93d 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_builder.cpp +++ b/mlxarchive/mlxarchive_mfa2_builder.cpp @@ -252,7 +252,7 @@ FWDirectoryBuilder::FWDirectoryBuilder(const string& version, string directory) componentPointers.push_back(componentPointer); DeviceDescriptor deviceDescriptor(componentPointers, PSID); _deviceDescriptors.push_back(deviceDescriptor); - VersionExtension version(fwQueryResult.fw_info.fw_ver); + VersionExtension version(fwQueryResult.fw_info.fw_ver, fwQueryResult.fw_info.fw_rel_date); vector<u_int8_t> data; if (!ops->FwExtract4MBImage(data, true)) { printf("Can't Extract FW data from the image file %s:%s\n", diff --git a/mlxarchive/mlxarchive_mfa2_component.h b/mlxarchive/mlxarchive_mfa2_component.h index a634777..b2f630e 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_component.h +++ b/mlxarchive/mlxarchive_mfa2_component.h @@ -49,6 +49,7 @@ #include "mlxarchive_mfa2_descriptor.h" using namespace std; +#define FINGERPRINT_MFA2 "#BIN.COMPONENT!#" namespace mfa2 { @@ -61,7 +62,7 @@ private: public: explicit Component(ComponentDescriptor descriptor) : - _fingerPrint("#BIN.COMPONENT!#"), + _fingerPrint(FINGERPRINT_MFA2), _descriptor(descriptor) {}; void packDescriptor(vector<u_int8_t>& buff) const { _descriptor.pack(buff); }; @@ -69,7 +70,11 @@ public: _fingerPrint.pack(buff); _descriptor.packData(buff); }; + void unpackData(vector<u_int8_t>& buff) { + _descriptor.unpackData(buff); + }; u_int32_t getComponentBinarySize() const; + u_int64_t getBinaryComponentOffset(); void setComponentBinaryOffset(u_int64_t offset); const ComponentDescriptor & getComponentDescriptor() const { return _descriptor;} }; @@ -82,5 +87,8 @@ inline void Component::setComponentBinaryOffset(u_int64_t offset) { _descriptor.setComponentBinaryOffset(offset); } +inline u_int64_t Component::getBinaryComponentOffset() { + return _descriptor.getComponentBinaryOffset(); +} } #endif diff --git a/mlxarchive/mlxarchive_mfa2_descriptor.h b/mlxarchive/mlxarchive_mfa2_descriptor.h index 670c1e1..7804f0e 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_descriptor.h +++ b/mlxarchive/mlxarchive_mfa2_descriptor.h @@ -130,13 +130,18 @@ public: u_int16_t getDeviceDescriptorsCount() const { return _deviceDescriptorsCount;} u_int16_t getComponentsCount() const { return _componentsCount;} const VersionExtension & getVersionExtension() const {return _version;} - + u_int64_t getComponentsBlockSize (); + u_int32_t getComponentsBlockOffset (); }; inline void PackageDescriptor::setComponentsBlockOffset(u_int64_t offset) { _componentsBlockOffset = offset; } +inline u_int32_t PackageDescriptor::getComponentsBlockOffset() +{ + return _componentsBlockOffset; +} inline void PackageDescriptor::setComponentsBlockArchiveSize(u_int32_t size) { @@ -147,7 +152,10 @@ inline void PackageDescriptor::setComponentsBlockSize(u_int64_t size) { _componentsBlockSize = size; } - +inline u_int64_t PackageDescriptor::getComponentsBlockSize() +{ + return _componentsBlockSize; +} class DeviceDescriptor : public Descriptor { private: @@ -187,15 +195,20 @@ public: //string getSource () const; void setComponentBinaryOffset(u_int64_t offset); + u_int64_t getComponentBinaryOffset() const; void pack (vector<u_int8_t>& buff) const; u_int32_t getBinarySize () const; void packData (vector<u_int8_t>& buff) const; + void unpackData(vector<u_int8_t>& buff); }; /*inline string ComponentDescriptor::getSource() const { return _source; };*/ +inline u_int64_t ComponentDescriptor::getComponentBinaryOffset() const{ + return _componentBlockOffset; +} inline void ComponentDescriptor::setComponentBinaryOffset(u_int64_t offset) { @@ -207,6 +220,10 @@ inline u_int32_t ComponentDescriptor::getBinarySize() const return _binarySize; }; +inline void ComponentDescriptor::unpackData(vector<u_int8_t>& buff) +{ + unpackBytesArray(_data.data(), _data.size(), buff); +} inline void ComponentDescriptor::packData(vector<u_int8_t>& buff) const { packBytesArray(_data.data(), _data.size(), buff); diff --git a/mlxarchive/mlxarchive_mfa2_extension.cpp b/mlxarchive/mlxarchive_mfa2_extension.cpp index 7d30ebb..e6b544c 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_extension.cpp +++ b/mlxarchive/mlxarchive_mfa2_extension.cpp @@ -104,6 +104,19 @@ VersionExtension::VersionExtension(const string& version) : fillTimeAndDate(); } +VersionExtension::VersionExtension(const u_int16_t* version, const u_int16_t* fw_rel_date): + Extension(ELEMENT_VERSION, VersionExtensionType, LENGTH) +{ + _major = version[0]; + _subMinor = version[2]; + _minor = version[1]; + _seconds = 0; + _minutes = 0; + _hours = 12; + _day = fw_rel_date[0]; + _month = fw_rel_date[1]; + _year = fw_rel_date[2]; +} void VersionExtension::pack(vector<u_int8_t>& buff) const { vector<u_int8_t> tmpBuff; @@ -159,8 +172,8 @@ string VersionExtension::getVersion(bool pad_sub_minor) const { stringstream ss; string res; if (pad_sub_minor){ - char _sub_minor_str[5] = ""; - snprintf(_sub_minor_str, 5, "%04d", (int)_subMinor); + char _sub_minor_str[5] = {0}; + snprintf(_sub_minor_str, sizeof(_sub_minor_str), "%04d", (int)_subMinor); ss << (int)_major << '.' << (int)_minor << '.' << _sub_minor_str; } else { @@ -182,6 +195,9 @@ string VersionExtension::getDateAndTime() const { strftime(buffer,64,"%Y-%m-%d %H:%M:%S", &tm_obj); return string(buffer); } +void VersionExtension::getDateAndTime(char* buffer) const { + sprintf(buffer, "%x.%x.%x", _day, _month, _year); +} void ComponentPointerExtension::pack(vector<u_int8_t>& buff) const { diff --git a/mlxarchive/mlxarchive_mfa2_extension.h b/mlxarchive/mlxarchive_mfa2_extension.h index cd29a75..22d4990 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_extension.h +++ b/mlxarchive/mlxarchive_mfa2_extension.h @@ -43,7 +43,7 @@ #include <string> #include <vector> - +#include <iostream> #include <compatibility.h> #include <tools_layouts/tools_open_layouts.h> @@ -53,6 +53,60 @@ using namespace std; namespace mfa2 { +class Version +{ +public: + Version() + { + major = -1; + minor = -1; + subminor = -1; + } + Version(std::string version) + { + sscanf(version.c_str(), "%d.%d.%d", &major, &minor, &subminor); + } +private: + int major; + int minor; + int subminor; +public: + bool operator < (const Version& other) + { + if (major < other.major) + return true; + if (minor < other.minor) + return true; + if (subminor < other.subminor) + return true; + return false; + } + bool operator > (const Version& other) + { + if (major > other.major) + return true; + if (minor > other.minor) + return true; + if (subminor > other.subminor) + return true; + return false; + } + bool operator == (const Version& other) + { + return major == other.major + && minor == other.minor + && subminor == other.subminor; + } + friend std::ostream& operator << (std::ostream& stream, const Version& ver) + { + stream << ver.major; + stream << '.'; + stream << ver.minor; + stream << '.'; + stream << ver.subminor; + return stream; + } +}; class Extension : protected Element{ protected: enum ExtensionType { @@ -104,10 +158,15 @@ public: VersionExtension(const string& version); VersionExtension(const u_int16_t* version); + VersionExtension(const u_int16_t* version, const u_int16_t* fw_rel_date); void pack(vector<u_int8_t>& buff) const; bool unpack(Mfa2Buffer & buff); string getVersion(bool pad_sub_minor) const; string getDateAndTime() const; + void getDateAndTime(char* buffer) const; + u_int8_t getMajor() const { + return _major; + } }; /*class SecurityInfoExtension : Extension { diff --git a/mlxarchive/mlxarchive_mfa2_utils.cpp b/mlxarchive/mlxarchive_mfa2_utils.cpp index 798f53e..c30dfbc 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_utils.cpp +++ b/mlxarchive/mlxarchive_mfa2_utils.cpp @@ -37,13 +37,12 @@ * Created on: March 23, 2017 * Author: Ahmad Soboh */ - +#include <stdlib.h> #include <sys/stat.h> #include <fstream> #include <stdio.h> #include <dirent.h> #include <sys/types.h> -#include <boost/filesystem.hpp> #include "mlxarchive_mfa2_utils.h" @@ -61,6 +60,12 @@ void packBytesArray(const u_int8_t* arr, unsigned int len, vector<u_int8_t>& buf } } +void unpackBytesArray(u_int8_t* arr, unsigned int len, vector<u_int8_t>& buff) +{ + for (unsigned int i = 0; i < len; i++) { + arr[i] = buff[i]; + } +} void packBinFile(const string& file, vector<u_int8_t>& buff) { vector<u_int8_t> fileBuff; @@ -108,17 +113,23 @@ unsigned int getFileSize(const string& file) return 0; //TODO throw exception } -bool fexists(const std::string& filename) { +bool fexists(const std::string& filename) +{ struct stat buffer; return (stat (filename.c_str(), &buffer) == 0); } // check if filename points to regular file: -bool isFile(const std::string& filename) { +bool isFile(const std::string& filename) +{ struct stat buffer; stat(filename.c_str(), &buffer); return S_ISREG(buffer.st_mode); } +bool endsWith(const std::string& str, const std::string& suffix) +{ + return (str.size() >= suffix.size()) && (str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0); +} void listDir(const char *path, vector<string>& files) { @@ -130,8 +141,7 @@ void listDir(const char *path, vector<string>& files) } while ((entry = readdir(dir)) != NULL) { - string file_extension = boost::filesystem::extension(entry->d_name); - if(file_extension == ".bin") { + if(endsWith(entry->d_name, ".bin")) { files.push_back(entry->d_name); } else { diff --git a/mlxarchive/mlxarchive_mfa2_utils.h b/mlxarchive/mlxarchive_mfa2_utils.h index 9785245..61f7470 100644..100755 --- a/mlxarchive/mlxarchive_mfa2_utils.h +++ b/mlxarchive/mlxarchive_mfa2_utils.h @@ -40,14 +40,15 @@ #ifndef MLXARCHIVE_MFA2_UTILS_H_ #define MLXARCHIVE_MFA2_UTILS_H_ - +#include <string.h> #include <string> #include <vector> #include <compatibility.h> #include "mfa2_buff.h" -#define FINGER_PRINT_SIZE (16) +#define MFA2_FINGER_PRINT "MLNX.MFA2.XZ.00!" +#define FINGER_PRINT_SIZE (strlen(MFA2_FINGER_PRINT)) using namespace std; @@ -87,6 +88,7 @@ void packString(const string& str, vector<u_int8_t>& buff); void packBytesArray(const u_int8_t* arr, unsigned int len, vector<u_int8_t>& buff); +void unpackBytesArray(u_int8_t* arr, unsigned int len, vector<u_int8_t>& buff); void packBinFile(const string& file, vector<u_int8_t>& buff); bool readFromFile(const string& fname, string& content); @@ -105,7 +107,13 @@ public: FingerPrint(string fingerPrint) : _fingerPrint(fingerPrint) {}; void pack(vector<u_int8_t>& buff) const { packString(_fingerPrint, buff); }; inline u_int32_t getSize() const {return _fingerPrint.length();} - bool unpack(Mfa2Buffer & buff) {buff.read(_fingerPrint, FINGER_PRINT_SIZE); return true;} + bool unpack(Mfa2Buffer & buff) { + buff.read(_fingerPrint, FINGER_PRINT_SIZE); + if (_fingerPrint != MFA2_FINGER_PRINT) { + return false; + } + return true; + } string toString() const {return _fingerPrint;} }; diff --git a/mlxfwops/lib/Makefile.am b/mlxfwops/lib/Makefile.am index bbd7947..b9494e7 100755 --- a/mlxfwops/lib/Makefile.am +++ b/mlxfwops/lib/Makefile.am @@ -68,7 +68,7 @@ endif noinst_LIBRARIES = libmlxfwops.a -libmlxfwops_a_SOURCES = flint_base.cpp \ +libmlxfwops_a_SOURCES = flint_base.cpp bluefiled_signature_manager.cpp connectx6dx_signature_manager.cpp connectx6_signature_manager.cpp signature_manager.h signature_manager_factory.h \ flint_io.cpp \ fw_ops.cpp \ fs2_ops.cpp fs2_ops.h \ diff --git a/mlxfwops/lib/Makefile.in b/mlxfwops/lib/Makefile.in index da62e31..f4d3ce8 100644 --- a/mlxfwops/lib/Makefile.in +++ b/mlxfwops/lib/Makefile.in @@ -134,7 +134,10 @@ am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmlxfwops_a_AR = $(AR) $(ARFLAGS) libmlxfwops_a_LIBADD = -am_libmlxfwops_a_OBJECTS = flint_base.$(OBJEXT) flint_io.$(OBJEXT) \ +am_libmlxfwops_a_OBJECTS = flint_base.$(OBJEXT) \ + bluefiled_signature_manager.$(OBJEXT) \ + connectx6dx_signature_manager.$(OBJEXT) \ + connectx6_signature_manager.$(OBJEXT) flint_io.$(OBJEXT) \ fw_ops.$(OBJEXT) fs2_ops.$(OBJEXT) fs3_ops.$(OBJEXT) \ fs4_ops.$(OBJEXT) mlxfwops.$(OBJEXT) fsctrl_ops.$(OBJEXT) \ fs_checks.$(OBJEXT) aux_tlv_ops.$(OBJEXT) @@ -389,7 +392,7 @@ MLXFWOPS_VERSION = 1 AM_CXXFLAGS = -Wall -W -g -MP -MD -pipe $(COMPILER_FPIC) \ $(am__append_2) $(am__append_3) $(am__append_4) noinst_LIBRARIES = libmlxfwops.a -libmlxfwops_a_SOURCES = flint_base.cpp \ +libmlxfwops_a_SOURCES = flint_base.cpp bluefiled_signature_manager.cpp connectx6dx_signature_manager.cpp connectx6_signature_manager.cpp signature_manager.h signature_manager_factory.h \ flint_io.cpp \ fw_ops.cpp \ fs2_ops.cpp fs2_ops.h \ @@ -451,6 +454,9 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aux_tlv_ops.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bluefiled_signature_manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connectx6_signature_manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connectx6dx_signature_manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flint_base.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flint_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs2_ops.Po@am__quote@ diff --git a/mlxfwops/lib/bluefiled_signature_manager.cpp b/mlxfwops/lib/bluefiled_signature_manager.cpp new file mode 100755 index 0000000..1141a43 --- /dev/null +++ b/mlxfwops/lib/bluefiled_signature_manager.cpp @@ -0,0 +1,54 @@ +#include <map> + +#include "signature_manager.h" +#include "flint_io.h" +#include "flint_base.h" +#include "fw_ops.h" +#include "fs3_ops.h" +#include "tools_utils.h" + +using namespace std; + + +bool BluefieldFwOperationsSignatureManager::AddSignature(mfile* mf, Fs3Operations* imageOps, Flash *f, u_int32_t imageOffset) +{ +(void)imageOffset; +#if !defined(UEFI_BUILD) && !defined(NO_OPEN_SSL) + if (mf->tp == MST_SOFTWARE) { + const unsigned int KEYLENGTH = 64; + vector<u_int8_t> key; + vector<u_int8_t> digest; + + //read the on-chip EFUSE value of MDK, MDK 512 bits are located at 0x1c1640-0x1c167c + key.resize(KEYLENGTH); + if (mread4_block(mf, 0x1c1640, (u_int32_t*)key.data(), KEYLENGTH) != (int)KEYLENGTH) { + return errmsg("Failed to read MDK from CR"); + } + + if (!imageOps->CalcHMAC(key, digest)) { + return false; + } + + // burn the HMAC digest + u_int32_t sectionSize = 0x0; + u_int32_t sectionOffset = 0x0; + if (!imageOps->GetSectionSizeAndOffset(FS3_HMAC, sectionSize, sectionOffset)) { + return errmsg("Could not retrieve HMAC section size and offset"); + } + + size_t digestSizeInDW = digest.size() >> 2; + u_int32_t* digestDWP = (u_int32_t*)digest.data(); + for (unsigned int i = 0; i < digestSizeInDW; i++) { + digestDWP[i] = CPU_TO_BE32(digestDWP[i]); + } + if (!f->write(sectionOffset, digest.data(), sectionSize, true)) { + return errmsg(MLXFW_FLASH_WRITE_ERR, "Failed to burn HMAC digest: %s", f->err()); + } + } +#else + (void)imageOps; + (void)f; + //ignore for UEFI +#endif + return true; +}; diff --git a/mlxfwops/lib/connectx6_signature_manager.cpp b/mlxfwops/lib/connectx6_signature_manager.cpp new file mode 100755 index 0000000..b18d9c2 --- /dev/null +++ b/mlxfwops/lib/connectx6_signature_manager.cpp @@ -0,0 +1,27 @@ +#include <map> + +#include "signature_manager.h" +#include "tools_utils.h" +#include "fs4_ops.h" +#include "fs3_ops.h" +using namespace std; + + +bool ConnectX6FwOperationsSignatureManager::AddSignature(mfile* mf, Fs3Operations* imageOps, Flash *f, u_int32_t imageOffset) +{ +(void)mf; +#if !defined(UEFI_BUILD) && !defined(NO_OPEN_SSL) + int signature_size = 3 * HMAC_SIGNATURE_LENGTH; + uint8_t signature_data[3 * HMAC_SIGNATURE_LENGTH] = { 0 }; + //FOR BOOT, CRITICAL, NON-CRITICAL + imageOps->GetImageCache().get(signature_data, imageOffset, signature_size); + if (!f->write(imageOffset, signature_data, signature_size)) { + return errmsg(MLXFW_FLASH_WRITE_ERR, "Failed to burn HMAC digest: %s", f->err()); + } +#else + (void)imageOps; + (void)f; + (void)imageOffset; +#endif + return true; +}; diff --git a/mlxfwops/lib/connectx6dx_signature_manager.cpp b/mlxfwops/lib/connectx6dx_signature_manager.cpp new file mode 100755 index 0000000..5ec0255 --- /dev/null +++ b/mlxfwops/lib/connectx6dx_signature_manager.cpp @@ -0,0 +1,26 @@ +#include "signature_manager.h" +#include "flint_io.h" +#include "flint_base.h" +#include "fw_ops.h" +#include "tools_utils.h" + +using namespace std; + + +bool ConnectX6DXFwOperationsSignatureManager::AddSignature(mfile* mf, Fs3Operations* imageOps, Flash *f, u_int32_t imageOffset) +{ + (void)mf; + (void)imageOps; + (void)f; + (void)imageOffset; + return true; +} + +bool ConnectX6DXFwOperationsSignatureManager::GetSecureBootInfo() +{ +#if !defined(UEFI_BUILD) && !defined(NO_OPEN_SSL) + return true; +#else + return false; +#endif +} diff --git a/mlxfwops/lib/flint_base.h b/mlxfwops/lib/flint_base.h index 6487147..0ee1921 100644..100755 --- a/mlxfwops/lib/flint_base.h +++ b/mlxfwops/lib/flint_base.h @@ -203,6 +203,7 @@ namespace std {}; using namespace std; #define SWITCH_IB2_HW_ID 587 #define QUANTUM_HW_ID 589 #define SPECTRUM2_HW_ID 590 +#define SPECTRUM3_HW_ID 592 #define CX4_HW_ID 521 diff --git a/mlxfwops/lib/fs2_ops.cpp b/mlxfwops/lib/fs2_ops.cpp index f517dfd..f43e4e4 100755 --- a/mlxfwops/lib/fs2_ops.cpp +++ b/mlxfwops/lib/fs2_ops.cpp @@ -776,8 +776,11 @@ bool Fs2Operations::Fs2IntQuery(bool readRom, bool isStripedImage) return true; } -bool Fs2Operations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage) +bool Fs2Operations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage, bool quickQuery, bool ignoreDToc, bool verbose) { + (void)quickQuery; + (void)ignoreDToc; + (void)verbose; if (!Fs2IntQuery(readRom, isStripedImage)) { return false; } @@ -1859,7 +1862,7 @@ bool Fs2Operations::FwBurnRom(FImage *romImg, bool ignoreProdIdCheck, bool ignor u_int32_t cntx_image_num; FindAllImageStart(romImg, cntx_image_start, &cntx_image_num, _cntx_magic_pattern); if (cntx_image_num != 0) { - return errmsg("Expecting an expansion ROM image, Recieved Mellanox FW image."); + return errmsg("Expecting an expansion ROM image, received Mellanox FW image."); } if (!Fs2IntQuery()) { diff --git a/mlxfwops/lib/fs2_ops.h b/mlxfwops/lib/fs2_ops.h index dcfb2be..7de629b 100755 --- a/mlxfwops/lib/fs2_ops.h +++ b/mlxfwops/lib/fs2_ops.h @@ -45,7 +45,7 @@ public: virtual ~Fs2Operations() {}; //virtual void print_type() {}; - virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false); + virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false, bool quickQuery = true, bool ignoreDToc = false, bool verbose = false); virtual bool FwVerify(VerifyCallBack verifyCallBackFunc, bool isStripedImage = false, bool showItoc = false, bool ignoreDToc = false); virtual bool FwBurn(FwOperations *imageOps, u_int8_t forceVersion, ProgressCallBack progressFunc = (ProgressCallBack)NULL); diff --git a/mlxfwops/lib/fs3_ops.cpp b/mlxfwops/lib/fs3_ops.cpp index 51f5a16..0211c68 100755 --- a/mlxfwops/lib/fs3_ops.cpp +++ b/mlxfwops/lib/fs3_ops.cpp @@ -454,7 +454,7 @@ bool Fs3Operations::IsFs3SectionReadable(u_int8_t type, QueryOptions queryOption } bool Fs3Operations::VerifyTOC(u_int32_t dtoc_addr, bool &bad_signature, VerifyCallBack verifyCallBackFunc, bool show_itoc, - struct QueryOptions queryOptions, bool ignoreDToc) + struct QueryOptions queryOptions, bool ignoreDToc, bool verbose) { u_int8_t buffer[TOC_HEADER_SIZE], entry_buffer[TOC_ENTRY_SIZE]; struct cibfw_itoc_header itoc_header; @@ -535,7 +535,14 @@ bool Fs3Operations::VerifyTOC(u_int32_t dtoc_addr, bool &bad_signature, VerifyCa ret_val = false; } } else { + if (!verbose) { READBUF((*_ioAccess), flash_addr, buff, entry_size_in_bytes, "Section"); + } + else { + if (!(*_ioAccess).read(flash_addr, buff, entry_size_in_bytes, true, "Section")) { + return errmsg("%s - read error (%s)\n", "Section", (*_ioAccess).err()); + } + } Fs3UpdateImgCache(buff, flash_addr, entry_size_in_bytes); u_int32_t sect_crc = CalcImageCRC((u_int32_t *)buff, toc_entry.size); @@ -645,7 +652,6 @@ bool Fs3Operations::FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_ito u_int32_t offset; u_int8_t binVerMajor = 0, binVerMinor = 0; bool bad_signature; - (void)verbose; FindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num, _cntx_magic_pattern); if (cntx_image_num == 0) { return errmsg(MLXFW_NO_VALID_IMAGE_ERR, "No valid FS3 image found"); @@ -696,7 +702,7 @@ bool Fs3Operations::FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_ito offset = (offset % sector_size == 0) ? offset : (offset + sector_size - offset % 0x1000); while (offset < _ioAccess->get_size()) { - if (VerifyTOC(offset, bad_signature, verifyCallBackFunc, show_itoc, queryOptions, ignoreDToc)) { + if (VerifyTOC(offset, bad_signature, verifyCallBackFunc, show_itoc, queryOptions, ignoreDToc, verbose)) { return true; } else { if (!bad_signature) { @@ -711,13 +717,13 @@ bool Fs3Operations::FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_ito } -bool Fs3Operations::FsIntQueryAux(bool readRom, bool quickQuery) +bool Fs3Operations::FsIntQueryAux(bool readRom, bool quickQuery, bool ignoreDToc, bool verbose) { struct QueryOptions queryOptions; queryOptions.readRom = readRom; queryOptions.quickQuery = quickQuery; - if (!FsVerifyAux((VerifyCallBack)NULL, 0, queryOptions)) { + if (!FsVerifyAux((VerifyCallBack)NULL, 0, queryOptions, ignoreDToc, verbose)) { return false; } // get chip type and device sw id, from device/image @@ -745,6 +751,7 @@ bool Fs3Operations::FsIntQueryAux(bool readRom, bool quickQuery) if (_signatureExists == 0 || _publicKeysExists == 0 || _fs3ImgInfo.ext_info.mcc_en == 0) { _fs3ImgInfo.ext_info.security_mode = SM_NONE; } + _internalQueryPerformed = true; return true; } @@ -781,8 +788,8 @@ void Fs3Operations::deal_with_signal() return; } -reg_access_status_t Fs3Operations::getGI(mfile *mf, struct tools_open_mgir *gi) -{ +reg_access_status_t Fs3Operations::getGI(mfile *mf, + struct reg_access_hca_mgir *gi) { reg_access_status_t rc = ME_REG_ACCESS_OK; u_int32_t tp = 0; mget_mdevs_type(mf, &tp); @@ -808,12 +815,12 @@ reg_access_status_t Fs3Operations::getGI(mfile *mf, struct tools_open_mgir *gi) } -bool Fs3Operations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage) +bool Fs3Operations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage, bool quickQuery, bool ignoreDToc, bool verbose) { //isStripedImage flag is not needed in FS3 image format // Avoid warning - no striped image in FS3 (void)isStripedImage; - if (!FsIntQueryAux(readRom)) { + if (!FsIntQueryAux(readRom, quickQuery, ignoreDToc, verbose)) { return false; } if (_ioAccess->is_flash() && _fwParams.ignoreCacheRep == 0) { @@ -821,7 +828,7 @@ bool Fs3Operations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage * * MGIR * */ reg_access_status_t rc; - struct tools_open_mgir mgir; + struct reg_access_hca_mgir mgir; memset(&mgir, 0, sizeof(mgir)); rc = getGI(((Flash *)_ioAccess)->getMfileObj(), &mgir); if (!rc) { @@ -1347,7 +1354,6 @@ bool Fs3Operations::FwBurnBlock(FwOperations *imageOps, ProgressCallBack progres bool Fs3Operations::FwReadData(void *image, u_int32_t *imageSize, bool verbose) { struct QueryOptions queryOptions; - (void)verbose; if (!imageSize) { return errmsg("bad parameter is given to FwReadData\n"); } @@ -1360,7 +1366,7 @@ bool Fs3Operations::FwReadData(void *image, u_int32_t *imageSize, bool verbose) queryOptions.quickQuery = true; } // Avoid Warning - if (!FsVerifyAux((VerifyCallBack)NULL, 0, queryOptions)) { + if (!FsVerifyAux((VerifyCallBack)NULL, 0, queryOptions, false, verbose)) { return false; } @@ -2806,11 +2812,11 @@ u_int32_t Fs3Operations::getImageSize() return _fs3ImgInfo.sizeOfImgData - _fwImgInfo.imgStart; } -bool Fs3Operations::FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc) +bool Fs3Operations::FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc, bool verbose) { u_int32_t size = 0; - if (!FsIntQueryAux(true, false)) { + if (!FsIntQueryAux(true, false, false, verbose)) { return false; } @@ -3037,6 +3043,48 @@ bool Fs3Operations::CheckItocArray() return true; } +bool Fs3Operations::IsCriticalSection(u_int8_t sect_type) +{ + if (sect_type != FS3_PCIE_LINK_CODE && sect_type != FS3_PHY_UC_CMD && sect_type != FS3_HW_BOOT_CFG) + return false; + return true; +} + + +bool Fs3Operations::PrepItocSectionsForCompare(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical) +{ + if (_internalQueryPerformed == false) { + if (!FsIntQueryAux(true, false, false, true)) { + return false; + } + } + for (int i = 0; i < _fs3ImgInfo.numOfItocs; i++) { + struct toc_info* itoc_info_p = &(_fs3ImgInfo.tocArr[i]); + //struct fs4_toc_info *itoc_info_p = &this->_fs3ImgInfo.itocArr.tocArr[i]; + struct cibfw_itoc_entry *toc_entry = &(itoc_info_p->toc_entry); + if (IsCriticalSection(toc_entry->type)) + { + critical.reserve(critical.size() + itoc_info_p->section_data.size()); + critical.insert(critical.end(), itoc_info_p->section_data.begin(), itoc_info_p->section_data.end()); + //printf("-D- addr 0x%.8x toc type : 0x%.8x size 0x%.8x name %s\n", itoc_info_p->entry_addr, itoc_info_p->toc_entry.type, + //(unsigned int)(itoc_info_p->section_data.size() + padding_size), GetSectionNameByType(itoc_info_p->toc_entry.type)); + } + else + { + if (itoc_info_p->toc_entry.type == FS3_VPD_R0 || itoc_info_p->toc_entry.type == FS3_MFG_INFO || itoc_info_p->toc_entry.type == FS3_DEV_INFO || + itoc_info_p->toc_entry.type == FS3_NV_DATA1 || itoc_info_p->toc_entry.type == FS3_NV_DATA2 || itoc_info_p->toc_entry.type == FS3_FW_NV_LOG || + itoc_info_p->toc_entry.type == FS3_NV_DATA0) { + continue; + } + //printf("-D- addr 0x%.8x flash addr 0x%.8x toc type : 0x%.8x size 0x%.8x name %s\n", itoc_info_p->entry_addr, toc_entry->flash_addr << 2, itoc_info_p->toc_entry.type, + // (unsigned int)itoc_info_p->section_data.size(), GetSectionNameByType(itoc_info_p->toc_entry.type)); + non_critical.reserve(non_critical.size() + itoc_info_p->section_data.size()); + non_critical.insert(non_critical.end(), itoc_info_p->section_data.begin(), itoc_info_p->section_data.end()); + //currentItoc++; + } + } + return true; +} const char* Fs3Operations::FwGetResetRecommandationStr() { diff --git a/mlxfwops/lib/fs3_ops.h b/mlxfwops/lib/fs3_ops.h index cd72775..d789fad 100755 --- a/mlxfwops/lib/fs3_ops.h +++ b/mlxfwops/lib/fs3_ops.h @@ -79,7 +79,7 @@ public: virtual ~Fs3Operations() {}; //virtual void print_type() {printf("-D- FS3 type!\n");}; virtual bool FwVerify(VerifyCallBack verifyCallBackFunc, bool isStripedImage = false, bool showItoc = false, bool ignoreDToc = false); - virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false); + virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false, bool quickQuery = true, bool ignoreDToc = false, bool verbose = false); virtual u_int8_t FwType(); virtual bool FwInit(); virtual bool FwReadData(void *image, u_int32_t *image_size, bool verbose = false); @@ -113,7 +113,7 @@ public: bool FwInsertEncSHA(SHATYPE shaType, const char *privPemFile, const char *uuid, PrintCallBack printFunc = (PrintCallBack)NULL); - virtual bool FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc); + virtual bool FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc, bool verbose = false); virtual bool FwSetPublicKeys(char *fname, PrintCallBack callBackFunc = (PrintCallBack)NULL); virtual bool FwSetForbiddenVersions(char *fname, PrintCallBack callBackFunc = (PrintCallBack)NULL); virtual bool FwCalcMD5(u_int8_t md5sum[16]); @@ -124,7 +124,12 @@ public: bool FwCheckIfWeCanBurnWithFwControl(FwOperations *imageOps); bool FwCheckIf8MBShiftingNeeded(FwOperations *imageOps, const ExtBurnParams& burnParams); - + bool CalcHMAC(const vector<u_int8_t>& key, vector<u_int8_t>& digest); + virtual bool GetSectionSizeAndOffset(fs3_section_t sectType, u_int32_t& size, u_int32_t& offset); + MlargeBuffer GetImageCache() { return _imageCache; } + virtual bool Fs3UpdateSection(void *new_info, fs3_section_t sect_type = FS3_DEV_INFO, bool is_sect_failsafe = true, CommandType cmd_type = CMD_UNKNOWN, PrintCallBack callBackFunc = (PrintCallBack)NULL); + virtual bool PrepItocSectionsForCompare(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical); + bool IsCriticalSection(u_int8_t sect_type); protected: #define ITOC_ASCII 0x49544f43 #define TOC_RAND1 0x04081516 @@ -145,7 +150,7 @@ protected: bool Fs3UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size); virtual bool UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size); virtual bool FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_itoc, struct QueryOptions queryOptions, bool ignoreDToc = false, bool verbose = false); - bool FsIntQueryAux(bool readRom = true, bool quickQuery = true); + bool FsIntQueryAux(bool readRom = true, bool quickQuery = true, bool ignoreDToc = false, bool verbose = false); const char* GetSectionNameByType(u_int8_t section_type); bool GetImageInfoFromSection(u_int8_t *buff, u_int8_t sect_type, u_int32_t sect_size, u_int8_t check_support_only = 0); bool IsGetInfoSupported(u_int8_t sect_type); @@ -155,7 +160,6 @@ protected: bool GetImageInfo(u_int8_t *buff); bool GetRomInfo(u_int8_t *buff, u_int32_t size); bool GetImgSigInfo(u_int8_t *buff); - bool CalcHMAC(const vector<u_int8_t>& key, vector<u_int8_t>& digest); bool DoAfterBurnJobs(const u_int32_t magic_patter[], Fs3Operations &imageOps, ExtBurnParams& burnParams, Flash *f, u_int32_t new_image_start, u_int8_t is_curr_image_in_odd_chunks); @@ -182,7 +186,7 @@ protected: bool isOld4MBImage(FwOperations *imageOps); - virtual bool GetSectionSizeAndOffset(fs3_section_t sectType, u_int32_t& size, u_int32_t& offset); + bool AddHMACIfNeeded(Fs3Operations* imageOps, Flash *f); struct toc_info { @@ -222,16 +226,16 @@ private: #define FS3_DEFAULT_SECTOR_SIZE 0x1000 #define FS3_LOG2_CHUNK_SIZE_DW_OFFSET 0x9 - reg_access_status_t getGI(mfile *mf, struct tools_open_mgir *gi); + reg_access_status_t getGI(mfile *mf, struct reg_access_hca_mgir *gi); bool VerifyTOC(u_int32_t dtoc_addr, bool& bad_signature, VerifyCallBack verifyCallBackFunc, bool show_itoc, - struct QueryOptions queryOptions, bool ignoreDToc = false); + struct QueryOptions queryOptions, bool ignoreDToc = false, bool verbose = false); bool checkPreboot(u_int32_t *prebootBuff, u_int32_t size, VerifyCallBack verifyCallBackFunc); bool CheckTocSignature(struct cibfw_itoc_header *itoc_header, u_int32_t first_signature); bool BurnFs3Image(Fs3Operations &imageOps, ExtBurnParams& burnParams); bool UpdateDevDataITOC(Fs3Operations &imageOps, struct toc_info *image_toc_info_entry, struct toc_info *flash_toc_arr, int flash_toc_size); bool AddDevDataITOC(struct toc_info *flash_toc_entry, u_int8_t *image_data, struct toc_info *image_toc_arr, int& image_toc_size); - virtual bool Fs3UpdateSection(void *new_info, fs3_section_t sect_type = FS3_DEV_INFO, bool is_sect_failsafe = true, CommandType cmd_type = CMD_UNKNOWN, PrintCallBack callBackFunc = (PrintCallBack)NULL ); + bool Fs3GetItocInfo(struct toc_info *tocArr, int num_of_itocs, fs3_section_t sect_type, struct toc_info*&curr_toc); bool Fs3UpdateMfgUidsSection(struct toc_info *curr_toc, std::vector<u_int8_t> section_data, fs3_uid_t base_uid, std::vector<u_int8_t> &newSectionData); diff --git a/mlxfwops/lib/fs4_ops.cpp b/mlxfwops/lib/fs4_ops.cpp index a700e0f..c65bc7c 100755 --- a/mlxfwops/lib/fs4_ops.cpp +++ b/mlxfwops/lib/fs4_ops.cpp @@ -183,7 +183,7 @@ bool Fs4Operations::getHWPtrs(VerifyCallBack verifyCallBackFunc) return true; } -bool Fs4Operations::getExtendedHWPtrs(VerifyCallBack verifyCallBackFunc) +bool Fs4Operations::getExtendedHWPtrs(VerifyCallBack verifyCallBackFunc, FBase* ioAccess, bool IsBurningProcess) { //TODO @@ -195,9 +195,12 @@ bool Fs4Operations::getExtendedHWPtrs(VerifyCallBack verifyCallBackFunc) const unsigned int s = CX6FW_HW_POINTERS_SIZE / 4; u_int32_t buff[s]; struct cx6fw_hw_pointers hw_pointers; - u_int32_t physAddr = _fwImgInfo.imgStart + FS4_HW_PTR_START; + u_int32_t physAddr = FS4_HW_PTR_START; + if (!IsBurningProcess) { + physAddr += _fwImgInfo.imgStart; + } - READBUF((*_ioAccess), + READBUF((*ioAccess), physAddr, buff, CX6FW_HW_POINTERS_SIZE, @@ -575,6 +578,21 @@ bool Fs4Operations::FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_ito } } } + if (_ioAccess->is_flash() == false && _signatureDataSet == false) { + int signature_size = 3 * HMAC_SIGNATURE_LENGTH; + uint8_t signature_data[3 * HMAC_SIGNATURE_LENGTH] = { 0 }; + int signature_offset = _digest_mdk_ptr; + if (signature_offset == 0) { + signature_offset = _digest_recovery_key_ptr; + } + READBUF((*_ioAccess), + signature_offset, + signature_data, + signature_size, + "Reading data pointed by HW MDK Pointer"); + Fs3UpdateImgCache(signature_data, signature_offset, signature_size); + _signatureDataSet = true; + } if (!verifyTocEntries(_itoc_ptr, show_itoc, false, queryOptions, verifyCallBackFunc, verbose)) { return false; @@ -1363,11 +1381,26 @@ bool Fs4Operations::BurnFs4Image(Fs4Operations &imageOps, if (!f->is_flash()) { return true; } - - if (!AddHMACIfNeeded(&imageOps, f)) { + bool IsUpdateSignatures = true; + switch (this->_fwImgInfo.ext_info.chip_type) { + case CT_CONNECTX6: + getExtendedHWPtrs((VerifyCallBack)NULL, imageOps._ioAccess, true); + break; + default: + IsUpdateSignatures = false; + break; + } + if (IsUpdateSignatures) { + u_int32_t imageOffset = _digest_mdk_ptr; + if (imageOffset == 0) { + imageOffset = _digest_recovery_key_ptr; + } + if (imageOffset != 0) { + if (!_signatureMngr->AddSignature(_ioAccess->getMfileObj(), &imageOps, f, imageOffset)) { return false; } - + } + } // Write new signature data8 = new u_int8_t[FS3_FW_SIGNATURE_SIZE]; imageOps._imageCache.get(data8, 0, FS3_FW_SIGNATURE_SIZE); @@ -1709,7 +1742,7 @@ bool Fs4Operations::Fs4UpdateVpdSection(struct fs4_toc_info *curr_toc, char *vpd } if (vpd_size % 4) { delete[] vpd_data; - return errmsg("Size of VPD file: %d is not 4-byte aligned!", vpd_size); + return errmsg("Size of VPD file: %d is not 4-byte alligned!", vpd_size); } //check if vpd exceeds the dtoc array @@ -2301,7 +2334,7 @@ bool Fs4Operations::FwSignWithHmac(const char *keyFile) if (_ioAccess->is_flash()) { return errmsg( "Adding HMAC not allowed for devices"); } - if (!getExtendedHWPtrs((VerifyCallBack)NULL)) { + if (!getExtendedHWPtrs((VerifyCallBack)NULL, _ioAccess)) { return false; } const unsigned int s = _authentication_end_ptr - _authentication_start_ptr + 1; @@ -2393,6 +2426,31 @@ bool Fs4Operations::PrepItocSectionsForHmac(vector<u_int8_t>& critical, vector<u } return true; } +bool Fs4Operations::PrepItocSectionsForCompare(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical) +{ + for (int i = 0; i < this->_fs4ImgInfo.itocArr.numOfTocs; i++) { + struct fs4_toc_info *itoc_info_p = &this->_fs4ImgInfo.itocArr.tocArr[i]; + struct cx5fw_itoc_entry *toc_entry = &(itoc_info_p->toc_entry); + if (IsCriticalSection(toc_entry->type)) + { + critical.reserve(critical.size() + itoc_info_p->section_data.size()); + critical.insert(critical.end(), itoc_info_p->section_data.begin(), itoc_info_p->section_data.end()); + //printf("-D- addr 0x%.8x toc type : 0x%.8x size 0x%.8x name %s\n", itoc_info_p->entry_addr, itoc_info_p->toc_entry.type, + //(unsigned int)(itoc_info_p->section_data.size() + padding_size), GetSectionNameByType(itoc_info_p->toc_entry.type)); + } + else + { + if (itoc_info_p->toc_entry.type == FS3_IMAGE_SIGNATURE_512 || itoc_info_p->toc_entry.type == FS3_IMAGE_SIGNATURE_256) { + continue; + } + //printf("-D- addr 0x%.8x toc type : 0x%.8x size 0x%.8x name %s\n", itoc_info_p->entry_addr, itoc_info_p->toc_entry.type, (unsigned int)itoc_info_p->section_data.size(), GetSectionNameByType(itoc_info_p->toc_entry.type)); + non_critical.reserve(non_critical.size() + itoc_info_p->section_data.size()); + non_critical.insert(non_critical.end(), itoc_info_p->section_data.begin(), itoc_info_p->section_data.end()); + //currentItoc++; + } + } + return true; +} bool Fs4Operations::IsCriticalSection(u_int8_t sect_type) { diff --git a/mlxfwops/lib/fs4_ops.h b/mlxfwops/lib/fs4_ops.h index 2cfa4e4..7ebdaae 100755 --- a/mlxfwops/lib/fs4_ops.h +++ b/mlxfwops/lib/fs4_ops.h @@ -45,13 +45,14 @@ #define FS4_MAX_BIN_VER_MAJOR 1 #define FS4_MIN_BIN_VER_MAJOR 1 #define FS4_MIN_BIN_VER_MINOR 0 +#define HMAC_SIGNATURE_LENGTH 64 class Fs4Operations : public Fs3Operations { public: Fs4Operations(FBase *ioAccess) : - Fs3Operations(ioAccess), _boot2_ptr(0), _itoc_ptr(0), _tools_ptr(0) + Fs3Operations(ioAccess), _boot2_ptr(0), _itoc_ptr(0), _tools_ptr(0), _digest_mdk_ptr(0), _digest_recovery_key_ptr(0), _public_key_ptr(0), _signatureDataSet(false) { _minBinMinorVer = FS4_MIN_BIN_VER_MINOR; _minBinMajorVer = FS4_MIN_BIN_VER_MAJOR; @@ -78,7 +79,7 @@ public: bool IsCriticalSection(u_int8_t sect_type); bool CalcHMAC(const vector<u_int8_t>& key, const vector<u_int8_t>& data, vector<u_int8_t>& digest); bool CheckIfAlignmentIsNeeded(FwOperations *imgops); - + virtual bool PrepItocSectionsForCompare(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical); protected: struct fs4_toc_info { @@ -181,7 +182,7 @@ public: u_int32_t getAbsAddr(fs4_toc_info *toc, u_int32_t imgStart); bool getImgStart(); bool getHWPtrs(VerifyCallBack verifyCallBackFunc); - bool getExtendedHWPtrs(VerifyCallBack verifyCallBackFunc); + bool getExtendedHWPtrs(VerifyCallBack verifyCallBackFunc, FBase* ioAccess, bool IsBurningProcess = false); bool verifyToolsArea(VerifyCallBack verifyCallBackFunc); bool verifyTocHeader(u_int32_t tocAddr, bool isDtoc, VerifyCallBack verifyCallBackFunc); bool verifyTocEntries(u_int32_t tocAddr, bool show_itoc, bool isDtoc, @@ -212,6 +213,8 @@ public: u_int32_t _authentication_end_ptr; u_int32_t _digest_mdk_ptr; u_int32_t _digest_recovery_key_ptr; + u_int32_t _public_key_ptr; + bool _signatureDataSet; //This class is for sorting the itoc array by ascending absolute flash_addr used in FwShiftDevData class TocComp { diff --git a/mlxfwops/lib/fsctrl_ops.cpp b/mlxfwops/lib/fsctrl_ops.cpp index d36f3dd..88bd968 100755 --- a/mlxfwops/lib/fsctrl_ops.cpp +++ b/mlxfwops/lib/fsctrl_ops.cpp @@ -84,6 +84,16 @@ static void extractFwVersion(u_int16_t *fwVerArr, u_int32_t fwVersion) fwVerArr[2] = EXTRACT(fwVersion, 0, 16); } +static void extractFwVersion(u_int16_t *fwVerArr, + const reg_access_hca_rom_version fwVersion) { + if (!fwVerArr) { + return; + } + fwVerArr[0] = fwVersion.major; + fwVerArr[1] = fwVersion.minor; + fwVerArr[2] = fwVersion.build; +} + static void extractFwBuildTime(u_int16_t *fwRelDate, u_int32_t buildTime) { if (!fwRelDate) { @@ -96,52 +106,52 @@ static void extractFwBuildTime(u_int16_t *fwRelDate, u_int32_t buildTime) bool FsCtrlOperations::FsIntQuery() { - fwInfoT fwQery; - if (!_fwCompsAccess->queryFwInfo(&fwQery, nextBootFwVer)) { + fwInfoT fwQuery; + if (!_fwCompsAccess->queryFwInfo(&fwQuery, nextBootFwVer)) { return errmsg(FwCompsErrToFwOpsErr(_fwCompsAccess->getLastError()), "Failed to query the FW - Err[%d] - %s", _fwCompsAccess->getLastError(), _fwCompsAccess->getLastErrMsg()); } - if (fwQery.pending_fw_valid) { - extractFwVersion(_fwImgInfo.ext_info.fw_ver, fwQery.pending_fw_version.version); - extractFwBuildTime(_fwImgInfo.ext_info.fw_rel_date, fwQery.pending_fw_version.build_time); + if (fwQuery.pending_fw_valid) { + extractFwVersion(_fwImgInfo.ext_info.fw_ver, fwQuery.pending_fw_version.version); + extractFwBuildTime(_fwImgInfo.ext_info.fw_rel_date, fwQuery.pending_fw_version.build_time); } else { - extractFwVersion(_fwImgInfo.ext_info.fw_ver, fwQery.running_fw_version.version); - extractFwBuildTime(_fwImgInfo.ext_info.fw_rel_date, fwQery.running_fw_version.build_time); + extractFwVersion(_fwImgInfo.ext_info.fw_ver, fwQuery.running_fw_version.version); + extractFwBuildTime(_fwImgInfo.ext_info.fw_rel_date, fwQuery.running_fw_version.build_time); } - extractFwVersion(_fwImgInfo.ext_info.running_fw_ver, fwQery.running_fw_version.version); - if (fwQery.running_fw_version.version_string_length) { - strcpy(_fwImgInfo.ext_info.product_ver, fwQery.product_ver); + extractFwVersion(_fwImgInfo.ext_info.running_fw_ver, fwQuery.running_fw_version.version); + if (fwQuery.running_fw_version.version_string_length) { + strcpy(_fwImgInfo.ext_info.product_ver, fwQuery.product_ver); } // if nextBootFwVer, only fw version is needed, return. if (nextBootFwVer) { return true; } - _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_mac.uid = fwQery.base_mac.uid; - _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_mac.num_allocated = fwQery.base_mac.num_allocated; - _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_mac.uid = fwQery.base_mac_orig.uid; - _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_mac.num_allocated = fwQery.base_mac_orig.num_allocated; + _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_mac.uid = fwQuery.base_mac.uid; + _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_mac.num_allocated = fwQuery.base_mac.num_allocated; + _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_mac.uid = fwQuery.base_mac_orig.uid; + _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_mac.num_allocated = fwQuery.base_mac_orig.num_allocated; - _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_guid.uid = fwQery.base_guid.uid; - _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_guid.num_allocated = fwQery.base_guid.num_allocated; - _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_guid.uid = fwQery.base_guid_orig.uid; - _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_guid.num_allocated = fwQery.base_guid_orig.num_allocated; + _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_guid.uid = fwQuery.base_guid.uid; + _fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_guid.num_allocated = fwQuery.base_guid.num_allocated; + _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_guid.uid = fwQuery.base_guid_orig.uid; + _fsCtrlImgInfo.orig_fs3_uids_info.cx4_uids.base_guid.num_allocated = fwQuery.base_guid_orig.num_allocated; - _fwImgInfo.ext_info.pci_device_id = fwQery.dev_id; - _fwImgInfo.ext_info.dev_type = fwQery.dev_id; - _hwDevId = fwQery.hw_dev_id; - _fwImgInfo.ext_info.dev_rev = fwQery.rev_id; + _fwImgInfo.ext_info.pci_device_id = fwQuery.dev_id; + _fwImgInfo.ext_info.dev_type = fwQuery.dev_id; + _hwDevId = fwQuery.hw_dev_id; + _fwImgInfo.ext_info.dev_rev = fwQuery.rev_id; _fwImgInfo.ext_info.is_failsafe = true; // get chip type and device sw id, from device/image const u_int32_t *swId = (u_int32_t*) NULL; - if (!getInfoFromHwDevid(fwQery.hw_dev_id, _fwImgInfo.ext_info.chip_type, &swId)) { + if (!getInfoFromHwDevid(fwQuery.hw_dev_id, _fwImgInfo.ext_info.chip_type, &swId)) { return false; } _fsCtrlImgInfo.security_mode = (security_mode_t) (SMM_MCC_EN | - ((fwQery.security_type.debug_fw == 1) ? SMM_DEBUG_FW : 0) | - ((fwQery.security_type.signed_fw == 1) ? SMM_SIGNED_FW : 0) | - ((fwQery.security_type.secure_fw == 1) ? SMM_SECURE_FW : 0) | - ((fwQery.security_type.dev_fw == 1) ? SMM_DEV_FW : 0)); + ((fwQuery.security_type.debug_fw == 1) ? SMM_DEBUG_FW : 0) | + ((fwQuery.security_type.signed_fw == 1) ? SMM_SIGNED_FW : 0) | + ((fwQuery.security_type.secure_fw == 1) ? SMM_SECURE_FW : 0) | + ((fwQuery.security_type.dev_fw == 1) ? SMM_DEV_FW : 0)); std::vector<FwComponent> compsMap; if (!_fwCompsAccess->getFwComponents(compsMap, false)) { @@ -158,27 +168,27 @@ bool FsCtrlOperations::FsIntQuery() } } - strcpy(_fwImgInfo.ext_info.psid, fwQery.psid); - strcpy(_fsCtrlImgInfo.orig_psid, fwQery.psid); + strcpy(_fwImgInfo.ext_info.psid, fwQuery.psid); + strcpy(_fsCtrlImgInfo.orig_psid, fwQuery.psid); /* * Fill ROM info */ - _fwImgInfo.ext_info.roms_info.num_of_exp_rom = fwQery.nRoms; - _fwImgInfo.ext_info.roms_info.exp_rom_found = fwQery.nRoms > 0; - for (int i = 0; i < fwQery.nRoms; i++) { - _fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_product_id = fwQery.roms[i].type; + _fwImgInfo.ext_info.roms_info.num_of_exp_rom = fwQuery.nRoms; + _fwImgInfo.ext_info.roms_info.exp_rom_found = fwQuery.nRoms > 0; + for (int i = 0; i < fwQuery.nRoms; i++) { + _fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_product_id = fwQuery.roms[i].type; _fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_proto = 0xff; // NA - _fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_supp_cpu_arch = fwQery.roms[i].arch; + _fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_supp_cpu_arch = fwQuery.roms[i].arch; _fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_num_ver_fields = FwOperations::RomInfo::getNumVerFromProdId(_fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_product_id); - extractFwVersion(_fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_ver, fwQery.roms[i].version); + extractFwVersion(_fwImgInfo.ext_info.roms_info.rom_info[i].exp_rom_ver, fwQuery.roms[i].version); } - strncpy(_fsCtrlImgInfo.name, fwQery.name, NAME_LEN); - strncpy(_fsCtrlImgInfo.description, fwQery.description, DESCRIPTION_LEN); - strncpy(_fsCtrlImgInfo.deviceVsd, fwQery.deviceVsd, VSD_LEN); - strncpy(_fsCtrlImgInfo.image_vsd, fwQery.imageVsd, VSD_LEN); + strncpy(_fsCtrlImgInfo.name, fwQuery.name, NAME_LEN); + strncpy(_fsCtrlImgInfo.description, fwQuery.description, DESCRIPTION_LEN); + strncpy(_fsCtrlImgInfo.deviceVsd, fwQuery.deviceVsd, VSD_LEN); + strncpy(_fsCtrlImgInfo.image_vsd, fwQuery.imageVsd, VSD_LEN); return true; } @@ -211,16 +221,19 @@ bool FsCtrlOperations::FwReactivateImage() case FWCOMPS_IMAGE_REACTIVATION_FW_NOT_SUPPORTED: return errmsg(MLXFW_ERR, "Image reactivation - FW doesn't support this operation.\n"); default: - return errmsg(MLXFW_IMAGE_REACTIVATION_UNKNOWN_ERROR, "Unknown error occured\n"); + return errmsg(MLXFW_IMAGE_REACTIVATION_UNKNOWN_ERROR, "Unknown error occurred\n"); } } return true; } -bool FsCtrlOperations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage) +bool FsCtrlOperations::FwQuery(fw_info_t *fwInfo, bool readRom, bool isStripedImage, bool quickQuery, bool ignoreDToc, bool verbose) { (void) isStripedImage; (void) readRom; + (void) quickQuery; + (void) ignoreDToc; + (void) verbose; memcpy(&(fwInfo->fw_info), &(_fwImgInfo.ext_info), sizeof(fw_info_com_t)); memcpy(&(fwInfo->fs3_info), &(_fsCtrlImgInfo), sizeof(fs3_info_t)); fwInfo->fs3_info.fs3_uids_info.valid_field = 1; @@ -376,6 +389,10 @@ bool FsCtrlOperations::VerifyAllowedParams(ExtBurnParams &burnParams, bool isSec return true; } +bool FsCtrlOperations::FwBurnAdvanced(std::vector <u_int8_t> imageOps4MData, ExtBurnParams& burnParams) +{ + return _Burn(imageOps4MData, burnParams); +} bool FsCtrlOperations::FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams &burnParams) { if (imageOps == NULL) { @@ -385,8 +402,6 @@ bool FsCtrlOperations::FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams &bur return false; } fw_info_t fw_query; - std::vector<FwComponent> compsToBurn; - FwComponent bootImageComponent; memset(&fw_query, 0, sizeof(fw_info_t)); if (!imageOps->FwQuery(&fw_query, true)) { @@ -412,16 +427,22 @@ bool FsCtrlOperations::FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams &bur if (!TestAndSetTimeStamp(imageOps)) { return false; } - std::vector < u_int8_t > imageOps4MData; + std::vector <u_int8_t> imageOps4MData; if (!imageOps->FwExtract4MBImage(imageOps4MData, true)) { return errmsg(imageOps->getErrorCode(), "Failed to Extract 4MB from the image"); } + return _Burn(imageOps4MData, burnParams); +} +bool FsCtrlOperations::_Burn(std::vector <u_int8_t> imageOps4MData, ExtBurnParams& burnParams) +{ #ifdef UEFI_BUILD burnParams.ProgressFuncAdv.uefi_func = burnParams.progressFunc; #else burnParams.progressFunc = (ProgressCallBack) NULL; #endif + FwComponent bootImageComponent; + std::vector<FwComponent> compsToBurn; bootImageComponent.init(imageOps4MData, imageOps4MData.size(), FwComponent::COMPID_BOOT_IMG); compsToBurn.push_back(bootImageComponent); diff --git a/mlxfwops/lib/fsctrl_ops.h b/mlxfwops/lib/fsctrl_ops.h index 8f736b0..03c2f5f 100755 --- a/mlxfwops/lib/fsctrl_ops.h +++ b/mlxfwops/lib/fsctrl_ops.h @@ -42,13 +42,12 @@ public: { memset(&_fsCtrlImgInfo, 0, sizeof(_fsCtrlImgInfo)); } - ; virtual ~FsCtrlOperations(); virtual u_int8_t FwType(); - virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false); + virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false, bool quickQuery = true, bool ignoreDToc = false, bool verbose = false); virtual bool FwVerify(VerifyCallBack verifyCallBackFunc, bool isStripedImage = false, bool showItoc = false, bool ignoreDToc = false); // Add callback print virtual bool FwVerifyAdv(ExtVerifyParams &verifyParams); @@ -64,6 +63,7 @@ public: virtual bool FwBurn(FwOperations *imageOps, u_int8_t forceVersion, ProgressCallBack progressFunc = (ProgressCallBack) NULL); virtual bool FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams &burnParams); + virtual bool FwBurnAdvanced(std::vector <u_int8_t> imageOps4MData, ExtBurnParams& burnParams); virtual bool FwBurnBlock(FwOperations *imageOps, ProgressCallBack progressFunc); //Add: callback progress, question arr, callback question, configurations bool FwWriteBlock(u_int32_t addr, std::vector<u_int8_t> dataVec, ProgressCallBack progressFunc = (ProgressCallBack) NULL); @@ -88,13 +88,17 @@ public: virtual bool FwSetTimeStamp(struct tools_open_ts_entry& timestamp, struct tools_open_fw_version& fwVer); virtual bool FwQueryTimeStamp(struct tools_open_ts_entry& timestamp, struct tools_open_fw_version& fwVer, bool queryRunning = false); virtual bool FwResetTimeStamp(); + virtual u_int32_t GetHwDevId() { return _hwDevId; } bool FwReactivateImage(); Tlv_Status_t GetTsObj(TimeStampIFC **tsObj); - bool IsFsCtrlOperations() + virtual bool IsFsCtrlOperations() { return true; } + virtual mfile* getMfileObj() { + return _fwCompsAccess->getMfileObj(); + } protected: bool FsIntQuery(); @@ -106,7 +110,7 @@ protected: int FwCompsErrToFwOpsErr(fw_comps_error_t err); virtual bool VerifyAllowedParams(ExtBurnParams &burnParams, bool isSecure); bool BadParamErrMsg(const char *unSupportedOperation, bool isSecure); - + bool _Burn(std::vector <u_int8_t> imageOps4MData, ExtBurnParams& burnParams); fs3_info_t _fsCtrlImgInfo; FwCompsMgr *_fwCompsAccess; bool _isSecured; diff --git a/mlxfwops/lib/fw_ops.cpp b/mlxfwops/lib/fw_ops.cpp index ce34161..d21d007 100755 --- a/mlxfwops/lib/fw_ops.cpp +++ b/mlxfwops/lib/fw_ops.cpp @@ -50,7 +50,6 @@ #ifndef NO_MFA_SUPPORT #include <mfa.h> #endif -#include "tools_dev_types.h" #define BAD_CRC_MSG "Bad CRC." extern const char *g_sectNames[]; @@ -135,9 +134,6 @@ int FwOperations::getMfaImgInner(char *fileName, u_int8_t *mfa_buf, int size, if (res) { res = res < 0 ? res : -1 * res; WriteToErrBuff(errBuf, "Failed to open mfa file", errBufSize); - if (mfa_d) { - mfa_close(mfa_d); - } return res; } @@ -731,7 +727,7 @@ FwOperations* FwOperations::FwOperationsCreate(void *fwHndl, void *info, char *p return FwOperationsCreate(fwParams); } -bool FwOperations::imageDevOperationsCreate(fw_ops_params_t& devParams, fw_ops_params_t& imgParams, FwOperations **devFwOps, FwOperations **imgFwOps, bool ignoreSecurityAttributes) +bool FwOperations::imageDevOperationsCreate(fw_ops_params_t& devParams, fw_ops_params_t& imgParams, FwOperations **devFwOps, FwOperations **imgFwOps, bool ignoreSecurityAttributes, bool ignoreDToc) { *imgFwOps = FwOperationsCreate(imgParams); if (!(*imgFwOps)) { @@ -748,7 +744,7 @@ bool FwOperations::imageDevOperationsCreate(fw_ops_params_t& devParams, fw_ops_p fw_info_t imgQuery; memset(&imgQuery, 0, sizeof(fw_info_t)); - if (!(*imgFwOps)->FwQuery(&imgQuery)) { + if (!(*imgFwOps)->FwQuery(&imgQuery, true, false, true, ignoreDToc)) { return false; } if (imgQuery.fs3_info.security_mode == SM_NONE && ignoreSecurityAttributes == false) { @@ -906,6 +902,7 @@ init_fwops: if (fwParams.hndlType == FHT_MST_DEV) { fwops->_devName = strcpy(new char[strlen(fwParams.mstHndl) + 1], fwParams.mstHndl); } + fwops->CreateSignatureManager(); } return fwops; } @@ -1097,6 +1094,7 @@ const FwOperations::HwDevData FwOperations::hwDevData[] = { { "Switch_IB2", SWITCH_IB2_HW_ID, CT_SWITCH_IB2, CFT_SWITCH, 0, {53000, 0}, {{UNKNOWN_BIN, {0}}}}, { "Quantum", QUANTUM_HW_ID, CT_QUANTUM, CFT_SWITCH, 0, {54000, 0}, {{UNKNOWN_BIN, {0}}}}, { "Spectrum2", SPECTRUM2_HW_ID, CT_SPECTRUM2, CFT_SWITCH, 0, {53100, 0}, {{UNKNOWN_BIN, {0}}}}, + { "Spectrum3", SPECTRUM3_HW_ID, CT_SPECTRUM3, CFT_SWITCH, 0, {53104, 0}, {{UNKNOWN_BIN, {0}}}}, { (char*)NULL, 0, CT_UNKNOWN, CFT_UNKNOWN, 0, {0}, {{UNKNOWN_BIN, {0}}}},// zero devid terminator }; @@ -1122,6 +1120,7 @@ const FwOperations::HwDev2Str FwOperations::hwDev2Str[] = { {"Quantum A0", QUANTUM_HW_ID, 0x00}, {"Spectrum A1", SPECTRUM_HW_ID, 0x01}, {"Spectrum2 A0", SPECTRUM2_HW_ID, 0x00}, + {"Spectrum3 A0", SPECTRUM3_HW_ID, 0x00}, { (char*)NULL, (u_int32_t)0, (u_int8_t)0x00}, // zero device ID terminator }; @@ -1903,6 +1902,31 @@ bool FwOperations::FwResetTimeStamp() return errmsg("Operation not supported."); } +bool FwOperations::FwBurnAdvanced(std::vector <u_int8_t> imageOps4MData, ExtBurnParams& burnParams) +{ + (void)imageOps4MData; + (void)burnParams; + return errmsg("Operation not supported."); +} + +bool FwOperations::PrepItocSectionsForCompare(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical) +{ + (void) critical; + (void) non_critical; + return errmsg("Operation not supported."); +} + +bool FwOperations::Fs3UpdateSection(void *new_info, fs3_section_t sect_type, bool is_sect_failsafe, + CommandType cmd_type, PrintCallBack callBackFunc) +{ + (void)new_info; + (void)sect_type; + (void)is_sect_failsafe; + (void)cmd_type; + (void)callBackFunc; + return errmsg("Operation not supported."); +} + bool FwOperations::FwQueryTimeStamp(struct tools_open_ts_entry& timestamp, struct tools_open_fw_version& fwVer, bool queryRunning) { (void)timestamp; @@ -1960,10 +1984,11 @@ bool FwOperations::CalcHMAC(const vector<u_int8_t>& key, const vector<u_int8_t>& return errmsg("CalcHMAC not supported"); } -bool FwOperations::FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc) +bool FwOperations::FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc, bool verbose) { (void)img; (void)maskMagicPatternAndDevToc; + (void)verbose; return errmsg("Operation not supported"); } @@ -2014,7 +2039,8 @@ u_int8_t FwOperations::GetFwFormatFromHwDevID(u_int32_t hwDevId) hwDevId == CX6DX_HW_ID || hwDevId == BF_HW_ID || hwDevId == QUANTUM_HW_ID || - hwDevId == SPECTRUM2_HW_ID) { + hwDevId == SPECTRUM2_HW_ID || + hwDevId == SPECTRUM3_HW_ID) { return FS_FS4_GEN; } return FS_UNKNOWN_IMG; diff --git a/mlxfwops/lib/fw_ops.h b/mlxfwops/lib/fw_ops.h index 7fb8764..c4cbf78 100755 --- a/mlxfwops/lib/fw_ops.h +++ b/mlxfwops/lib/fw_ops.h @@ -38,6 +38,7 @@ #include "flint_io.h" #include "aux_tlv_ops.h" #include "mlxfwops_com.h" +#include "signature_manager_factory.h" #ifdef CABLES_SUPP #include <cable_access/cable_access.h> @@ -53,7 +54,7 @@ typedef fw_ver_info_t FwVerInfo; typedef int (*PrintCallBackAdv) (int completion, char *str); extern bool nextBootFwVer; - +#define GLOBAL_ALIGNMENT 0x80 class MLXFWOP_API FwOperations : public FlintErrMsg { @@ -72,7 +73,7 @@ public: _ioAccess(ioAccess), _isCached(false), _wasVerified(false), _quickQuery(false), _printFunc((PrintCallBack)NULL), _fname((const char*)NULL), \ _devName((const char*)NULL), _advErrors(true), _minBinMinorVer(0), _minBinMajorVer(0), - _maxBinMajorVer(0) + _maxBinMajorVer(0), _signatureMngr((ISignatureManager*)NULL), _internalQueryPerformed(false) { memset(_sectionsToRead, 0, sizeof(_sectionsToRead)); memset(&_fwImgInfo, 0, sizeof(_fwImgInfo)); @@ -80,13 +81,27 @@ public: }; + void CreateSignatureManager() { + if (_ioAccess != NULL && _ioAccess->is_flash() == false) {//NOT RELEVANT FOR IMAGE OBJECT + return; + } + u_int32_t hwDevId = GetHwDevId(); + _signatureMngr = SignatureManagerFactory::GetInstance()->CreateSignatureManager(hwDevId, _fwImgInfo.ext_info.dev_rev); + } virtual ~FwOperations() { if (_ioAccess) { delete _ioAccess; } + if (_signatureMngr) { + delete _signatureMngr; + } }; //virtual void print_type() {}; + virtual mfile* getMfileObj() { + mfile *mf = _ioAccess->is_flash() ? ((Flash *)_ioAccess)->getMfileObj() : (mfile *)NULL; + return mf; + } virtual u_int8_t FwType() = 0; static FwVerInfo FwVerLessThan(u_int16_t r1[3], u_int16_t r2[3]); static bool IsFwSupportingRomModify(u_int16_t fw_ver[3]); @@ -97,7 +112,7 @@ public: static const char* expRomType2Str(u_int16_t type); bool readBufAux(FBase& f, u_int32_t o, void *d, int l, const char *p); - virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false) = 0; + virtual bool FwQuery(fw_info_t *fwInfo, bool readRom = true, bool isStripedImage = false, bool quickQuery = true, bool ignoreDToc = false, bool verbose = false) = 0; virtual bool FwVerify(VerifyCallBack verifyCallBackFunc, bool isStripedImage = false, bool showItoc = false, bool ignoreDToc = false) = 0; // Add callback print virtual bool FwVerifyAdv(ExtVerifyParams& verifyParams); //on call of FwReadData with Null image we get image_size @@ -114,17 +129,18 @@ public: virtual bool FwSignWithHmac(const char *key_file); virtual bool PrepItocSectionsForHmac(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical); virtual bool IsCriticalSection(u_int8_t sect_type); - virtual bool CalcHMAC(const vector<u_int8_t>& key, const vector<u_int8_t>& data, vector<u_int8_t>& digest); - virtual bool FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc); + + virtual bool FwExtract4MBImage(vector<u_int8_t>& img, bool maskMagicPatternAndDevToc, bool verbose = false); virtual bool FwSetPublicKeys(char *fname, PrintCallBack callBackFunc = (PrintCallBack)NULL); virtual bool FwSetForbiddenVersions(char *fname, PrintCallBack callBackFunc = (PrintCallBack)NULL); - + virtual bool CalcHMAC(const vector<u_int8_t>& key, const vector<u_int8_t>& data, vector<u_int8_t>& digest); virtual bool FwReadRom(std::vector<u_int8_t>& romSect) = 0; virtual bool FwBurnRom(FImage *romImg, bool ignoreProdIdCheck = false, bool ignoreDevidCheck = false, ProgressCallBack progressFunc = (ProgressCallBack)NULL) = 0; // can also read the rom from flint and give a vector of u_int8_t virtual bool FwDeleteRom(bool ignoreProdIdCheck, ProgressCallBack progressFunc = (ProgressCallBack)NULL) = 0; virtual bool FwBurn(FwOperations *imageOps, u_int8_t forceVersion, ProgressCallBack progressFunc = (ProgressCallBack)NULL) = 0; virtual bool FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams& burnParams) = 0; + virtual bool FwBurnAdvanced(std::vector <u_int8_t> imageOps4MData, ExtBurnParams& burnParams); virtual bool FwBurnBlock(FwOperations *imageOps, ProgressCallBack progressFunc) = 0; //Add: callback progress, question arr, callback question, configurations virtual bool FwWriteBlock(u_int32_t addr, std::vector<u_int8_t> dataVec, ProgressCallBack progressFunc = (ProgressCallBack)NULL); @@ -159,20 +175,30 @@ public: virtual bool FsIntQuery() { return true; } bool FwSetPrint(PrintCallBack PrintFunc); + virtual bool Fs3UpdateSection(void *new_info, fs3_section_t sect_type = FS3_DEV_INFO, bool is_sect_failsafe = true, CommandType cmd_type = CMD_UNKNOWN, PrintCallBack callBackFunc = (PrintCallBack)NULL); //needed for flint low level operations bool FwSwReset(); virtual bool CheckCX4Device() {return true; /* deprecated always return true*/ } virtual bool FwCalcMD5(u_int8_t md5sum[16]) = 0; - - + virtual u_int32_t GetHwDevId() + { + mfile* mf = _ioAccess->getMfileObj(); + dm_dev_id_t deviceId = DeviceUnknown; + u_int32_t hwDevId = 0x0, hwRevId = 0x0; + if (dm_get_device_id(mf, &deviceId, &hwDevId, &hwRevId)) { + return 0xffff; + } + return hwDevId; + } //virtual bool FwBurnBlock(FwOperations &FwImageAccess); // Add call back static FwOperations* FwOperationsCreate(void *fwHndl, void *info, char *psid, fw_hndl_type_t hndlType, char *errBuff = (char*)NULL, int buffSize = 0); static FwOperations* FwOperationsCreate(fw_ops_params_t& fwParams); static bool imageDevOperationsCreate(fw_ops_params_t& devParams, fw_ops_params_t& imgParams, - FwOperations **devFwOps, FwOperations **imgFwOps, bool ignoreSecurityAttributes = false); + FwOperations **devFwOps, FwOperations **imgFwOps, bool ignoreSecurityAttributes = false, bool ignoreDToc = false); virtual bool IsFsCtrlOperations(); + virtual bool PrepItocSectionsForCompare(vector<u_int8_t>& critical, vector<u_int8_t>& non_critical); void GetFwParams(fw_ops_params_t&); @@ -483,6 +509,8 @@ public: u_int8_t _minBinMinorVer; u_int8_t _minBinMajorVer; u_int8_t _maxBinMajorVer; + ISignatureManager* _signatureMngr; + bool _internalQueryPerformed; private: diff --git a/mlxfwops/lib/mlxfwops_com.h b/mlxfwops/lib/mlxfwops_com.h index 491d35b..4b8beb3 100755 --- a/mlxfwops/lib/mlxfwops_com.h +++ b/mlxfwops/lib/mlxfwops_com.h @@ -240,7 +240,8 @@ typedef enum chip_type { CT_BLUEFIELD, CT_QUANTUM, CT_SPECTRUM2, - CT_CONNECTX6DX + CT_CONNECTX6DX, + CT_SPECTRUM3 } chip_type_t; typedef enum chip_family_type { diff --git a/mlxfwops/lib/signature_manager.h b/mlxfwops/lib/signature_manager.h new file mode 100755 index 0000000..cd50d0e --- /dev/null +++ b/mlxfwops/lib/signature_manager.h @@ -0,0 +1,73 @@ +#pragma once +#include <stdio.h> +#include "flint_base.h" +#include "mtcr.h" + +class Fs3Operations; +class Flash; + + +class ISignatureManager : public FlintErrMsg +{ +public: + virtual bool AddSignature(mfile* mf, Fs3Operations* imageOps, Flash *f, u_int32_t imageOffset) = 0; + virtual bool GetSecureBootInfo() = 0; + virtual ~ISignatureManager() {} +}; + +class AbstractSignatureManager : public ISignatureManager { +public: + AbstractSignatureManager() {} + virtual ~AbstractSignatureManager() {} +}; + +class FwOperationsSignatureManager : public AbstractSignatureManager +{ +public: + FwOperationsSignatureManager() : AbstractSignatureManager() {} + virtual ~FwOperationsSignatureManager() {} + virtual bool AddSignature(mfile*, Fs3Operations*, Flash*, u_int32_t) + { + return true;//not relevant here + } + virtual bool GetSecureBootInfo() + { + return false; + } +}; + + +class BluefieldFwOperationsSignatureManager : public AbstractSignatureManager +{ +public: + BluefieldFwOperationsSignatureManager() : AbstractSignatureManager() {} + virtual ~BluefieldFwOperationsSignatureManager() {} + virtual bool AddSignature(mfile* mf, Fs3Operations*, Flash*, u_int32_t); + virtual bool GetSecureBootInfo() + { + return false; + } +}; + + +class ConnectX6FwOperationsSignatureManager : public AbstractSignatureManager +{ +public: + ConnectX6FwOperationsSignatureManager() : AbstractSignatureManager() {} + virtual ~ConnectX6FwOperationsSignatureManager() {} + virtual bool AddSignature(mfile* mf, Fs3Operations*, Flash*, u_int32_t); + virtual bool GetSecureBootInfo() + { + return false; + } +}; + + +class ConnectX6DXFwOperationsSignatureManager : public AbstractSignatureManager +{ +public: + ConnectX6DXFwOperationsSignatureManager() : AbstractSignatureManager() {} + virtual ~ConnectX6DXFwOperationsSignatureManager() {} + virtual bool AddSignature(mfile* mf, Fs3Operations*, Flash*, u_int32_t); + virtual bool GetSecureBootInfo(); +}; diff --git a/mlxfwops/lib/signature_manager_factory.h b/mlxfwops/lib/signature_manager_factory.h new file mode 100755 index 0000000..5960dda --- /dev/null +++ b/mlxfwops/lib/signature_manager_factory.h @@ -0,0 +1,35 @@ +#pragma once + +#include "signature_manager.h" +#include "dev_mgt/tools_dev_types.h" + +class SignatureManagerFactory +{ +public: + static SignatureManagerFactory* GetInstance() { + static SignatureManagerFactory obj; + return &obj; + } + + ISignatureManager* CreateSignatureManager(u_int32_t hwDevId, u_int32_t hwRevId) { + dm_dev_id_t deviceId = DeviceUnknown; + if (dm_get_device_id_offline(hwDevId, hwRevId, &deviceId)) { + printf("Failed to identify the device - Can not create SignatureManager!\n"); + return (ISignatureManager*)NULL; + } + + if (deviceId == DeviceBlueField) { + return new BluefieldFwOperationsSignatureManager(); + } + else if (deviceId == DeviceConnectX6) { + return new ConnectX6FwOperationsSignatureManager(); + } + else if (deviceId == DeviceConnectX6DX) { + return new ConnectX6DXFwOperationsSignatureManager(); + } + else { + return new FwOperationsSignatureManager(); + } + + } +}; diff --git a/mlxlink/Makefile.am b/mlxlink/Makefile.am index a45c051..350f81d 100644 --- a/mlxlink/Makefile.am +++ b/mlxlink/Makefile.am @@ -44,8 +44,9 @@ UTILS_DIR = $(top_srcdir)/mft_utils MLXREG_DIR = $(top_srcdir)/mlxreg LAYOUTS_DIR = $(top_srcdir)/tools_layouts MLXLINK_MODULES_DIR = $(top_srcdir)/mlxlink +JSON_DIR = $(top_srcdir)/ext_libs/json -INCLUDES = -I. -I$(top_srcdir) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) +INCLUDES = -I. -I$(top_srcdir) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) -I$(JSON_DIR) AM_CXXFLAGS = -Wall -W -DMST_UL -g -MP -MD -pipe -Werror @@ -68,7 +69,8 @@ mstlink_DEPENDENCIES = modules/libmodules_lib.a \ $(USER_DIR)/xz_utils/libxz_utils.a \ $(USER_DIR)/ext_libs/minixz/libminixz.a \ -lboost_regex -lboost_filesystem -lboost_system \ - -llzma $(LIBSTD_CPP) ${LDL} -lexpat + -llzma $(LIBSTD_CPP) ${LDL} -lexpat \ + $(JSON_DIR)/libjson.a mstlink_LDADD = $(mstlink_DEPENDENCIES) diff --git a/mlxlink/Makefile.in b/mlxlink/Makefile.in index ec7e5b5..ab6bee0 100644 --- a/mlxlink/Makefile.in +++ b/mlxlink/Makefile.in @@ -142,7 +142,8 @@ am__DEPENDENCIES_2 = modules/libmodules_lib.a \ $(USER_DIR)/reg_access/libreg_access.a \ $(LAYOUTS_DIR)/libtools_layouts.a \ $(USER_DIR)/xz_utils/libxz_utils.a \ - $(USER_DIR)/ext_libs/minixz/libminixz.a $(am__DEPENDENCIES_1) + $(USER_DIR)/ext_libs/minixz/libminixz.a $(am__DEPENDENCIES_1) \ + $(JSON_DIR)/libjson.a AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -408,7 +409,8 @@ UTILS_DIR = $(top_srcdir)/mft_utils MLXREG_DIR = $(top_srcdir)/mlxreg LAYOUTS_DIR = $(top_srcdir)/tools_layouts MLXLINK_MODULES_DIR = $(top_srcdir)/mlxlink -INCLUDES = -I. -I$(top_srcdir) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) +JSON_DIR = $(top_srcdir)/ext_libs/json +INCLUDES = -I. -I$(top_srcdir) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) -I$(JSON_DIR) AM_CXXFLAGS = -Wall -W -DMST_UL -g -MP -MD -pipe -Werror mstlink_CXXFLAGS = -DEXTERNAL mstlink_SOURCES = mlxlink_main.cpp @@ -426,7 +428,8 @@ mstlink_DEPENDENCIES = modules/libmodules_lib.a \ $(USER_DIR)/xz_utils/libxz_utils.a \ $(USER_DIR)/ext_libs/minixz/libminixz.a \ -lboost_regex -lboost_filesystem -lboost_system \ - -llzma $(LIBSTD_CPP) ${LDL} -lexpat + -llzma $(LIBSTD_CPP) ${LDL} -lexpat \ + $(JSON_DIR)/libjson.a mstlink_LDADD = $(mstlink_DEPENDENCIES) all: all-recursive diff --git a/mlxlink/modules/Makefile.am b/mlxlink/modules/Makefile.am index fb45637..ae6caaa 100644 --- a/mlxlink/modules/Makefile.am +++ b/mlxlink/modules/Makefile.am @@ -41,8 +41,9 @@ MTCR_INC_DIR = $(top_srcdir)/include/mtcr_ul UTILS_DIR = $(top_srcdir)/mft_utils MLXREG_DIR = $(top_srcdir)/mlxreg MLXLINK_MODULES_DIR = $(top_srcdir)/mlxlink +JSON_DIR = $(top_srcdir)/ext_libs/json -INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) +INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) -I$(JSON_DIR) AM_CFLAGS = -Wall -W -g -MP -MD -pipe -Werror $(COMPILER_FPIC) -DDATA_PATH=\"$(pkgdatadir)\" AM_CXXFLAGS = -Wall -W -g -MP -MD -pipe -Werror #$(COMPILER_FPIC) @@ -62,5 +63,5 @@ libmodules_lib_a_SOURCES = mlxlink_commander.h \ mlxlink_ui.h \ mlxlink_ui.cpp -libmodules_lib_a_LIBADD= printutil/libprint_util_lib.a -libmodules_lib_a_CFLAGS = $(AM_CFLAGS) +libmodules_lib_a_LIBADD = printutil/libprint_util_lib.a $(JSON_DIR)/libjson.a +libmodules_lib_a_CFLAGS = $(AM_CFLAGS) diff --git a/mlxlink/modules/Makefile.in b/mlxlink/modules/Makefile.in index 109f993..4d9a81c 100644 --- a/mlxlink/modules/Makefile.in +++ b/mlxlink/modules/Makefile.in @@ -154,7 +154,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libmodules_lib_a_DEPENDENCIES = printutil/libprint_util_lib.a +libmodules_lib_a_DEPENDENCIES = printutil/libprint_util_lib.a \ + $(JSON_DIR)/libjson.a am_libmodules_lib_a_OBJECTS = mlxlink_commander.lo \ mlxlink_user_input.lo mlxlink_maps.lo mlxlink_utils.lo \ mlxlink_logger.lo mlxlink_ui.lo @@ -438,7 +439,8 @@ MTCR_INC_DIR = $(top_srcdir)/include/mtcr_ul UTILS_DIR = $(top_srcdir)/mft_utils MLXREG_DIR = $(top_srcdir)/mlxreg MLXLINK_MODULES_DIR = $(top_srcdir)/mlxlink -INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) +JSON_DIR = $(top_srcdir)/ext_libs/json +INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MLXLINK_MODULES_DIR) -I$(MTCR_INC_DIR) -I$(JSON_DIR) AM_CFLAGS = -Wall -W -g -MP -MD -pipe -Werror $(COMPILER_FPIC) -DDATA_PATH=\"$(pkgdatadir)\" AM_CXXFLAGS = -Wall -W -g -MP -MD -pipe -Werror #$(COMPILER_FPIC) lib_LTLIBRARIES = libmodules_lib.a @@ -455,7 +457,7 @@ libmodules_lib_a_SOURCES = mlxlink_commander.h \ mlxlink_ui.h \ mlxlink_ui.cpp -libmodules_lib_a_LIBADD = printutil/libprint_util_lib.a +libmodules_lib_a_LIBADD = printutil/libprint_util_lib.a $(JSON_DIR)/libjson.a libmodules_lib_a_CFLAGS = $(AM_CFLAGS) all: all-recursive diff --git a/mlxlink/modules/mlxlink_commander.cpp b/mlxlink/modules/mlxlink_commander.cpp index fa3b35e..baf23db 100644 --- a/mlxlink/modules/mlxlink_commander.cpp +++ b/mlxlink/modules/mlxlink_commander.cpp @@ -176,9 +176,10 @@ void MlxlinkCommander::checkValidFW() struct connectib_icmd_get_fw_info fw_info; memset(&fw_info, 0, sizeof(fw_info)); gcif_get_fw_info(_mf, &fw_info); - _fwVersion = to_string(fw_info.fw_version.MAJOR) + "." - + to_string(fw_info.fw_version.MINOR) + "." - + to_string(fw_info.fw_version.SUBMINOR); + char fwVersion [32]; + sprintf(fwVersion, "%02d.%02d.%04d", fw_info.fw_version.MAJOR, + fw_info.fw_version.MINOR, fw_info.fw_version.SUBMINOR); + _fwVersion = string(fwVersion); if(_userInput._pcie){ //PDDR is not relevant to pcie return; } @@ -417,7 +418,15 @@ void MlxlinkCommander::labelToHCALocalPort() void MlxlinkCommander::labelToSpectLocalPort() { - string regName = "PMLP"; + string regName; + u_int32_t spect2WithGearBox = 0; + if (_devID == DeviceSpectrum2) { + regName = "MGPIR"; + resetParser(regName); + genBuffSendRegister(regName, MACCESS_REG_METHOD_GET); + spect2WithGearBox = getFieldValue("num_of_devices", _buffer); + } + regName = "PMLP"; string splitStr = to_string( (_userInput._splitPort > 0) ? _userInput._splitPort - 1 : _userInput._splitPort); @@ -434,7 +443,7 @@ void MlxlinkCommander::labelToSpectLocalPort() checkWidthSplit(localPort); _localPort = (_splitted) ? - (_numOfLanes == 2 && _devID == DeviceSpectrum2) ? + (_numOfLanes == 2 && !spect2WithGearBox) ? localPort + _userInput._splitPort : localPort + _userInput._splitPort -1 : localPort; @@ -779,13 +788,15 @@ std::vector<string> MlxlinkCommander::parseParamsFromLine(const string & ParamsL return paramVector; } -void MlxlinkCommander::setPrintVal(MlxlinkCmdPrint &mlxlinkCmdPrint, int index, string key, - string value, string color, bool print, bool valid) +void MlxlinkCommander::setPrintVal(MlxlinkCmdPrint &mlxlinkCmdPrint, + int index, string key, string value, string color, bool print, + bool valid, bool arrayValue) { mlxlinkCmdPrint.mlxlinkRecords[index].key = key; mlxlinkCmdPrint.mlxlinkRecords[index].val = valid? value: "N/A"; mlxlinkCmdPrint.mlxlinkRecords[index].color = color; mlxlinkCmdPrint.mlxlinkRecords[index].visible = print; + mlxlinkCmdPrint.mlxlinkRecords[index].arrayValue = arrayValue; } void MlxlinkCommander::setPrintTitle(MlxlinkCmdPrint &mlxlinkCmdPrint, string title @@ -955,7 +966,7 @@ void MlxlinkCommander::showModuleInfo() cout << _moduleInfoCmd; if (oper_status != 1) { - MlxlinkRecord::printWar("Warning: Cannot get module EEPROM information, module operation status is not 'plugged and enabled'"); + MlxlinkRecord::printWar("Warning: Cannot get module EEPROM information, module operation status is not 'plugged and enabled'", _jsonRoot); } } catch (const std::exception &exc) { _allUnhandledErrors += string("Showing Module Info via PDDR raised the following exception: ") + string(exc.what()) + string("\n"); @@ -1142,26 +1153,28 @@ void MlxlinkCommander::operatingInfoPage() void MlxlinkCommander::supportedInfoPage() { try { - setPrintTitle(_supportedInfoCmd,"Supported Info", + setPrintTitle(_supportedInfoCmd, HEADER_SUPPORTED_INFO, PDDR_SUPPORTED_INFO_LAST, !_prbsTestMode); u_int32_t speeds_mask = _protoAdminEx ? _protoAdminEx: _protoAdmin; string supported_speeds = SupportedSpeeds2Str(_protoActive, speeds_mask, (bool)_protoAdminEx); string color = MlxlinkRecord::supported2Color(supported_speeds); + if (dm_dev_is_200g_speed_supported_hca(_devID) || + dm_dev_is_200g_speed_supported_switch(_devID)) { + _protoCapabilityEx = true; + } stringstream value; value << "0x" << std::hex << setfill('0') << setw(8) << speeds_mask \ << " (" << supported_speeds << ")" << setfill(' '); - string title = "Enabled Link Speed"; - if(_protoAdminEx) { - title += " (Ext.)"; + string extStr = ""; + if (_protoCapabilityEx && _protoActive == ETH) { + extStr = " (Ext.)"; } + string title = "Enabled Link Speed" + extStr; + setPrintVal(_supportedInfoCmd,PDDR_ENABLED_LINK_SPEED, title, - value.str(),color, true, !_prbsTestMode); + value.str(),color, true, !_prbsTestMode, true); // Supported cable speed - if (dm_dev_is_200g_speed_supported_hca(_devID) || - dm_dev_is_200g_speed_supported_switch(_devID)) { - _protoCapabilityEx = true; - } supported_speeds = SupportedSpeeds2Str(_protoActive, _protoCapability, _protoCapabilityEx); color = MlxlinkRecord::supported2Color(supported_speeds); @@ -1169,12 +1182,9 @@ void MlxlinkCommander::supportedInfoPage() value.clear(); value << "0x" << std::hex << setfill('0') << setw(8) << _protoCapability \ << " (" << supported_speeds << ")" << setfill(' '); - title = "Supported Cable Speed"; - if(_protoCapabilityEx && _protoActive == ETH) { - title += " (Ext.)"; - } + title = "Supported Cable Speed" + extStr; setPrintVal(_supportedInfoCmd,PDDR_SUPPORTED_LINK_SPEED, title, - value.str(),color, true, !_prbsTestMode); + value.str(),color, true, !_prbsTestMode, true); } catch (const std::exception &exc) { throw MlxRegException(string(exc.what())); } @@ -1583,11 +1593,11 @@ void MlxlinkCommander::showEye() setPrintTitle(_eyeOpeningInfoCmd, showEyeTitle, EYE_OPENING_INFO_LAST); setPrintVal(_eyeOpeningInfoCmd, EYE_PHYSICAL_GRADE, - "Physical Grade", getStringFromVector(physicalGrades)); + "Physical Grade", getStringFromVector(physicalGrades), ANSI_COLOR_RESET, true,true, true); setPrintVal(_eyeOpeningInfoCmd, EYE_HEIGHT_EYE_OPENING, - "Height Eye Opening [mV]", getStringFromVector(heightLengths)); + "Height Eye Opening [mV]", getStringFromVector(heightLengths), ANSI_COLOR_RESET, true,true, true); setPrintVal(_eyeOpeningInfoCmd, EYE_PHASE_EYE_OPENING, - "Phase Eye Opening [psec]", getStringFromVector(phaseWidths)); + "Phase Eye Opening [psec]", getStringFromVector(phaseWidths), ANSI_COLOR_RESET, true, true, true); cout << _eyeOpeningInfoCmd; @@ -1621,7 +1631,6 @@ void MlxlinkCommander::showFEC() showFecValues.push_back("0x" + convertIntToHexString(_fecModeRequest) + " (" + FECReq2Str(_fecModeRequest, _linkUP) + ")"); printCmdOutput(_showFecTitle, _showFecLines, showFecValues);*/ string fecCap100,fecCap50,fecCap40,fecCap25,fecCap10; - std::vector<string> showFecValues; if (_protoActive == IB || _prbsTestMode) { fecCap100 = "0x0 (N/A)"; fecCap50 = "0x0 (N/A)"; @@ -1637,7 +1646,7 @@ void MlxlinkCommander::showFEC() fecCap100 = "0x5 (No-FEC,RS-FEC(528,514))"; } } else { - showFecValues.push_back("0x0 (N/A)"); + fecCap100 = "0x0 (N/A)"; } if (supportedSpeeds.find("50G") != string::npos) { fecCap50 = "0x7 (No-FEC,FireCode FEC,RS-FEC(528,514))"; @@ -1661,12 +1670,17 @@ void MlxlinkCommander::showFEC() } } - setPrintTitle(_fecCapInfoCmd, "FEC Capability Info", FEC_CAP_INFO_LASE); - setPrintVal(_fecCapInfoCmd, FEC_CAP_100G, "FEC Capability 100GbE",fecCap100); - setPrintVal(_fecCapInfoCmd, FEC_CAP_50G, "FEC Capability 50GbE", fecCap50); - setPrintVal(_fecCapInfoCmd, FEC_CAP_40G, "FEC Capability 40GbE", fecCap40); - setPrintVal(_fecCapInfoCmd, FEC_CAP_25G, "FEC Capability 25GbE", fecCap25); - setPrintVal(_fecCapInfoCmd, FEC_CAP_10G, "FEC Capability 10GbE", fecCap10); + setPrintTitle(_fecCapInfoCmd, HEADER_FEC_INFO, FEC_CAP_INFO_LASE); + setPrintVal(_fecCapInfoCmd, FEC_CAP_100G, "FEC Capability 100GbE", + fecCap100, ANSI_COLOR_RESET, true, true, true); + setPrintVal(_fecCapInfoCmd, FEC_CAP_50G, "FEC Capability 50GbE", + fecCap50, ANSI_COLOR_RESET, true, true, true); + setPrintVal(_fecCapInfoCmd, FEC_CAP_40G, "FEC Capability 40GbE", + fecCap40, ANSI_COLOR_RESET, true, true, true); + setPrintVal(_fecCapInfoCmd, FEC_CAP_25G, "FEC Capability 25GbE", + fecCap25, ANSI_COLOR_RESET, true, true, true); + setPrintVal(_fecCapInfoCmd, FEC_CAP_10G, "FEC Capability 10GbE", + fecCap10, ANSI_COLOR_RESET, true, true, true); cout << _fecCapInfoCmd; @@ -1698,7 +1712,7 @@ void MlxlinkCommander::showSltp() !_userInput._advancedMode) { throw MlxRegException( "Showing SLTP for 16nm technology is supported only " - "in advanced mode"); + "in advanced mode (--" SLTP_SET_ADVANCED_FLAG " flag)"); } if (_productTechnology == PRODUCT_16NM) { _mlxlinkMaps->_sltpHeader = "pre2Tap,preTap,mainTap,postTap,m2lp,amp,alevOut"; @@ -1709,10 +1723,11 @@ void MlxlinkCommander::showSltp() } } if (!_linkUP && !_userInput._pcie && !_prbsTestMode) { - setPrintVal(_sltpInfoCmd,0, " ", _mlxlinkMaps->_sltpHeader,ANSI_COLOR_RESET, true,false); + setPrintVal(_sltpInfoCmd,0, "Serdes TX parameters", _mlxlinkMaps->_sltpHeader,ANSI_COLOR_RESET, true, false, true); + cout << _sltpInfoCmd; return; } - setPrintVal(_sltpInfoCmd,0, " ", _mlxlinkMaps->_sltpHeader); + setPrintVal(_sltpInfoCmd,0, "Serdes TX parameters", _mlxlinkMaps->_sltpHeader, ANSI_COLOR_RESET, true,true, true); for (u_int32_t i = 0; i < numOfLanesToUse; i++) { updateField("local_port", _localPort); updateField("pnat", (_userInput._pcie) ? PNAT_PCIE : PNAT_LOCAL); @@ -1729,7 +1744,7 @@ void MlxlinkCommander::showSltp() } resetParser(regName); setPrintVal(_sltpInfoCmd,(int)i + 1, - "Lane " + to_string(i),getStringFromVector(sltpLanes[i]),ANSI_COLOR_RESET, true,valid); + "Lane " + to_string(i),getStringFromVector(sltpLanes[i]),ANSI_COLOR_RESET, true, valid, true); } cout << _sltpInfoCmd; } catch (const std::exception &exc) { @@ -1758,7 +1773,7 @@ void MlxlinkCommander::showDeviceData() cout << _showDeviceInfoCmd; if (_isHCA) { - MlxlinkRecord::printWar("Note: P/N, Product Name, S/N and Revision are supported only in switches"); + MlxlinkRecord::printWar("Note: P/N, Product Name, S/N and Revision are supported only in switches", _jsonRoot); } } catch (const std::exception &exc) { @@ -1833,10 +1848,11 @@ void MlxlinkCommander::showBerMonitorInfo() void MlxlinkCommander::showExternalPhy() { - if (_isHCA) { - throw MlxRegException("\"--" PEPC_SHOW_FLAG "\" option is not supported for HCA"); - } try { + if (_isHCA || _devID == DeviceSwitchIB || _devID == DeviceSwitchIB2 + || _devID == DeviceQuantum) { + throw MlxRegException("\"--" PEPC_SHOW_FLAG "\" option is not supported for HCA and InfiniBand switches"); + } string regName = "PEPC"; string twisted_pair_an = "N/A"; string twisted_pair_force_mode = "N/A"; @@ -1922,14 +1938,15 @@ void MlxlinkCommander::showPcieLinks() throw MlxRegException("No valid DPN's detected!"); } setPrintTitle(_validPcieLinks,"Valid PCIe Links", _validDpns.size()+1); - setPrintVal(_validPcieLinks, 0," ", "depth, pcie_index, node, port"); + setPrintVal(_validPcieLinks, 0, "Legend", + "depth, pcie_index, node, port", ANSI_COLOR_RESET, true, true, true); for(u_int32_t i = 0; i < _validDpns.size(); i++) { char dpnStr [20]; int localPort = getLocalPortFromMPIR(_validDpns[i]); sprintf(dpnStr,"%d, %d, %d, %d", _validDpns[i].depth, _validDpns[i].pcieIndex, _validDpns[i].node, localPort); setPrintVal(_validPcieLinks, i+1, "Link " + to_string(i+1), dpnStr, - ANSI_COLOR_RESET, localPort >= 0 ); + ANSI_COLOR_RESET, localPort >= 0, true, true); } cout << _validPcieLinks; } catch (const std::exception &exc) { @@ -2373,7 +2390,7 @@ string MlxlinkCommander::getVendorRev(const string & name) void MlxlinkCommander::clearCounters() { try { - MlxlinkRecord::printCmdLine("Clearing Counters"); + MlxlinkRecord::printCmdLine("Clearing Counters", _jsonRoot); string regName = "PPCNT"; resetParser(regName); @@ -2381,7 +2398,7 @@ void MlxlinkCommander::clearCounters() updateField("local_port", _localPort); updateField("swid", SWID); updateField("pnat", PNAT_LOCAL); - updateField("grp", PPCNT_STATISTICAL_GROUP); + updateField("grp", PPCNT_ALL_GROUPS); updateField("prio_tc", 0); updateField("clr", 1); @@ -2432,7 +2449,7 @@ void MlxlinkCommander::sendPaos() void MlxlinkCommander::sendPaosDown() { - MlxlinkRecord::printCmdLine("Configuring Port State (Down)"); + MlxlinkRecord::printCmdLine("Configuring Port State (Down)", _jsonRoot); sendPaosCmd(PAOS_DOWN); if (!checkPaosDown()) { if (_isHCA) { @@ -2446,7 +2463,7 @@ void MlxlinkCommander::sendPaosDown() void MlxlinkCommander::sendPaosUP() { - MlxlinkRecord::printCmdLine("Configuring Port State (Up)"); + MlxlinkRecord::printCmdLine("Configuring Port State (Up)", _jsonRoot); sendPaosCmd(PAOS_UP); } @@ -2472,16 +2489,16 @@ void MlxlinkCommander::handlePrbs() sendPprt(); sendPptt(); sendPrbsPpaos(true); - MlxlinkRecord::printCmdLine("Configuring Port to Physical Test Mode"); + MlxlinkRecord::printCmdLine("Configuring Port to Physical Test Mode", _jsonRoot); } else if (_userInput._prbsMode == "DS") { - MlxlinkRecord::printCmdLine("Configuring Port to Regular Operation"); + MlxlinkRecord::printCmdLine("Configuring Port to Regular Operation", _jsonRoot); if (_prbsTestMode) { sendPrbsPpaos(false); } sendPaosToggle(); } else if (_userInput._prbsMode == "TU") { if (_prbsTestMode) { - MlxlinkRecord::printCmdLine("Performing Tuning"); + MlxlinkRecord::printCmdLine("Performing Tuning", _jsonRoot); startTuning(); } else { throw MlxRegException( @@ -2588,7 +2605,7 @@ void MlxlinkCommander::sendPtys() if (_prbsTestMode) { throw MlxRegException("Cannot Configure Port Speeds in Physical Test Mode. Please Disable First"); } - MlxlinkRecord::printCmdLine("Configuring Port Speeds"); + MlxlinkRecord::printCmdLine("Configuring Port Speeds", _jsonRoot); u_int32_t protoCap = getPtysCap(); string regName = "PTYS"; resetParser(regName); @@ -2683,7 +2700,7 @@ void MlxlinkCommander::sendPplm() if (_prbsTestMode) { throw MlxRegException("Cannot Configure FEC in Physical Test Mode. Please Disable First."); } - MlxlinkRecord::printCmdLine("Configuring Port FEC"); + MlxlinkRecord::printCmdLine("Configuring Port FEC", _jsonRoot); if (_protoActive == IB) { throw MlxRegException("FEC Configuration is Valid for ETHERNET only!"); } @@ -2697,7 +2714,8 @@ void MlxlinkCommander::sendPplm() resetParser(regName); updateField("local_port", _localPort); - string speedStrG = (_linkUP && _userInput._speedFec == "") ? speedToStr(_speedStrG) : _userInput._speedFec + "g"; + string speedStrG = (_linkUP && _userInput._speedFec == "") ? speedToStr(_speedStrG) : + (_userInput._pplmFec == "AU" ? deleteLastComma(_userInput._speedFec) : _userInput._speedFec) + "g"; if (speedStrG != "100g") { updateField("fec_override_admin_100g", 0); } @@ -2806,7 +2824,7 @@ void MlxlinkCommander::updateSltp16nmFields() void MlxlinkCommander::sendSltp() { - MlxlinkRecord::printCmdLine("Configuring Port Transmitter Parameters"); + MlxlinkRecord::printCmdLine("Configuring Port Transmitter Parameters", _jsonRoot); checkSltpParamsSize(); string regName = "SLTP"; if (_userInput._sltpLane && _userInput._lane >= _numOfLanes) { @@ -2851,7 +2869,7 @@ void MlxlinkCommander::sendSltp() void MlxlinkCommander::sendPplr() { try { - MlxlinkRecord::printCmdLine("Configuring Port Loopback"); + MlxlinkRecord::printCmdLine("Configuring Port Loopback", _jsonRoot); string regName = "PPLR"; resetParser(regName); @@ -2882,11 +2900,12 @@ u_int32_t MlxlinkCommander::getLoopbackMode(const string &lb) void MlxlinkCommander::sendPepc() { - if (_isHCA) { - throw MlxRegException("\"--" PEPC_SET_FLAG "\" option is not supported for HCA"); - } try { - MlxlinkRecord::printCmdLine("Configuring External PHY"); + if (_isHCA || _devID == DeviceSwitchIB || _devID == DeviceSwitchIB2 + || _devID == DeviceQuantum) { + throw MlxRegException("\"--" PEPC_SET_FLAG "\" option is not supported for HCA and InfiniBand switches"); + } + MlxlinkRecord::printCmdLine("Configuring External PHY", _jsonRoot); string regName = "PEPC"; // Get old values of PEPC fields @@ -2910,3 +2929,34 @@ void MlxlinkCommander::sendPepc() _allUnhandledErrors += string("Sending PEPC (Configuring External PHY parameters) raised the following exception: ") + string(exc.what()) + string("\n"); } } + +void MlxlinkCommander::prepareJsonOut() +{ + _operatingInfoCmd.toJsonFormat(_jsonRoot); + _supportedInfoCmd.toJsonFormat(_jsonRoot); + _troubInfoCmd.toJsonFormat(_jsonRoot); + _testModeInfoCmd.toJsonFormat(_jsonRoot); + _pcieInfoCmd.toJsonFormat(_jsonRoot); + _moduleInfoCmd.toJsonFormat(_jsonRoot); + _berInfoCmd.toJsonFormat(_jsonRoot); + _testModeBerInfoCmd.toJsonFormat(_jsonRoot); + _mpcntPerfInfCmd.toJsonFormat(_jsonRoot); + _mpcntTimerInfCmd.toJsonFormat(_jsonRoot); + _eyeOpeningInfoCmd.toJsonFormat(_jsonRoot); + _fecCapInfoCmd.toJsonFormat(_jsonRoot); + _sltpInfoCmd.toJsonFormat(_jsonRoot); + _showDeviceInfoCmd.toJsonFormat(_jsonRoot); + _showBerMonitorInfo.toJsonFormat(_jsonRoot); + _extPhyInfoCmd.toJsonFormat(_jsonRoot); + _linkBlameInfoCmd.toJsonFormat(_jsonRoot); + _validPcieLinks.toJsonFormat(_jsonRoot); + + bool errorExist = _allUnhandledErrors != ""; + _jsonRoot[JSON_STATUS_SECTION][JSON_STATUS_CODE] = errorExist? 1 : 0; + _jsonRoot[JSON_STATUS_SECTION][JSON_MSG] = errorExist? + _allUnhandledErrors : "success"; + + if (!_jsonRoot[JSON_RESULT_SECTION][JSON_OUTPUT_SECTION]) { + _jsonRoot[JSON_RESULT_SECTION][JSON_OUTPUT_SECTION] = "N/A"; + } +} diff --git a/mlxlink/modules/mlxlink_commander.h b/mlxlink/modules/mlxlink_commander.h index c64d311..783e28a 100644 --- a/mlxlink/modules/mlxlink_commander.h +++ b/mlxlink/modules/mlxlink_commander.h @@ -72,6 +72,8 @@ #define PCIE_INDEX_FLAG_SHORT ' ' #define NODE_FLAG "node" #define NODE_FLAG_SHORT ' ' +#define PRINT_JSON_OUTPUT_FLAG "json" +#define PRINT_JSON_OUTPUT_FLAG_SHORT ' ' //------------------------------------------------------------ // Mlxlink QUERIES Flags @@ -370,8 +372,8 @@ public: void setPrintTitle(MlxlinkCmdPrint &mlxlinkCmdPrint, string title, u_int32_t size, bool print = true); void setPrintVal(MlxlinkCmdPrint &mlxlinkCmdPrint, int index, string key, - string value, string color = ANSI_COLOR_RESET, - bool print = true, bool valid = true); + string value, string color = ANSI_COLOR_RESET, bool print = true, + bool valid = true, bool arrayValue = false); void writeGvmi(u_int32_t data); //Mlxlink query functions @@ -432,6 +434,8 @@ public: string getDeviceFW(); string getVendorRev(const string & name); + void prepareJsonOut(); + MlxlinkCmdPrint _operatingInfoCmd; MlxlinkCmdPrint _supportedInfoCmd; MlxlinkCmdPrint _troubInfoCmd; @@ -527,7 +531,7 @@ public: std::vector<std::string> _ptysSpeeds; std::vector<DPN> _validDpns; string _allUnhandledErrors; - + Json::Value _jsonRoot; MlxlinkMaps* _mlxlinkMaps; }; diff --git a/mlxlink/modules/mlxlink_maps.cpp b/mlxlink/modules/mlxlink_maps.cpp index 67d11e7..11e8755 100755 --- a/mlxlink/modules/mlxlink_maps.cpp +++ b/mlxlink/modules/mlxlink_maps.cpp @@ -396,6 +396,7 @@ MlxlinkMaps::MlxlinkMaps() { _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_XLAUI_4] = 4; _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_25GAUI_1] = 1; _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_50GAUI_2] = 2; + _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_50GAUI_1] = 1; _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_CAUI_4] = 4; _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_100GAUI_2] = 2; _ExtETHSpeed2Lanes[ETH_LINK_SPEED_EXT_200GAUI_4] = 4; diff --git a/mlxlink/modules/mlxlink_maps.h b/mlxlink/modules/mlxlink_maps.h index b8f6b7d..2ffe430 100755 --- a/mlxlink/modules/mlxlink_maps.h +++ b/mlxlink/modules/mlxlink_maps.h @@ -41,6 +41,8 @@ #include <stdexcept> #include <fstream> #include <sstream> +#include <iterator> +#include <vector> #include <mlxreg/mlxreg_lib.h> #include <mlxreg/mlxreg_parser.h> #include "mlxlink_user_input.h" diff --git a/mlxlink/modules/mlxlink_ui.cpp b/mlxlink/modules/mlxlink_ui.cpp index d93a6ae..404fc6d 100644 --- a/mlxlink/modules/mlxlink_ui.cpp +++ b/mlxlink/modules/mlxlink_ui.cpp @@ -60,7 +60,7 @@ void MlxlinkUi::printSynopsisHeader() IDENT "SYNOPSIS:\n" IDENT2 MLXLINK_EXEC " [OPTIONS]\n\n" IDENT "DESCRIPTION:\n" - IDENT2 "The mlxlink tool is used to check and debug link status and issues related to them.\n" + IDENT2 "The mstlink tool is used to check and debug link status and issues related to them.\n" IDENT2 "The tool can be used on different links and cables (passive, active, transceiver and backplane).\n"); printf("\n"); printf(IDENT "OPTIONS:\n"); @@ -75,6 +75,7 @@ void MlxlinkUi::printSynopsisHeader() MlxlinkRecord::printFlagLine(DEPTH_FLAG_SHORT, DEPTH_FLAG, "depth", "depth level of the DUT of some hierarchy (PCIE only)"); MlxlinkRecord::printFlagLine(PCIE_INDEX_FLAG_SHORT, PCIE_INDEX_FLAG, "pcie_index", "PCIe index number (Internal domain index) (PCIE only)"); MlxlinkRecord::printFlagLine(NODE_FLAG_SHORT, NODE_FLAG, "node", "the node within each depth (PCIE only)"); + MlxlinkRecord::printFlagLine(PRINT_JSON_OUTPUT_FLAG_SHORT, PRINT_JSON_OUTPUT_FLAG, "", "Print the output in json format"); } void MlxlinkUi::printSynopsisQueries() @@ -94,6 +95,7 @@ void MlxlinkUi::printSynopsisQueries() MlxlinkRecord::printFlagLine(DEVICE_DATA_FLAG_SHORT, DEVICE_DATA_FLAG, "", "General Device Info"); MlxlinkRecord::printFlagLine(BER_MONITOR_INFO_FLAG_SHORT, BER_MONITOR_INFO_FLAG, "", "Show BER Monitor Info (not supported for HCA)"); MlxlinkRecord::printFlagLine(PEPC_SHOW_FLAG_SHORT, PEPC_SHOW_FLAG, "", "Show External PHY Info"); + } void MlxlinkUi::printSynopsisCommands() @@ -387,6 +389,7 @@ void MlxlinkUi::initCmdParser() AddOptions(DEVICE_DATA_FLAG, DEVICE_DATA_FLAG_SHORT, "", "Device Info"); AddOptions(BER_MONITOR_INFO_FLAG, BER_MONITOR_INFO_FLAG_SHORT, "", "Show BER Monitor Info"); AddOptions(PEPC_SHOW_FLAG, PEPC_SHOW_FLAG_SHORT, "", "Show External PHY Info"); + AddOptions(PRINT_JSON_OUTPUT_FLAG, PRINT_JSON_OUTPUT_FLAG_SHORT, "", "Print the output in json format"); AddOptions(FEC_DATA_FLAG, FEC_DATA_FLAG_SHORT, "", "FEC Data"); AddOptions(PAOS_FLAG, PAOS_FLAG_SHORT, "PAOS", "Send PAOS"); @@ -515,7 +518,10 @@ void MlxlinkUi::commandsCaller() ParseStatus MlxlinkUi::HandleOption(string name, string value) { _sendRegFuncMap[SHOW_PDDR] = SHOW_PDDR; - if (name == HELP_FLAG) { + if (name == PRINT_JSON_OUTPUT_FLAG) { + MlxlinkRecord::jsonFormat = true; + return PARSE_OK; + } else if (name == HELP_FLAG) { printHelp(); return PARSE_OK_WITH_EXIT; } else if (name == VERSION_FLAG) { @@ -684,14 +690,13 @@ ParseStatus MlxlinkUi::HandleOption(string name, string value) int MlxlinkUi::run(int argc, char **argv) { + int exit_code = 0; createMlxlinkCommander(); initCmdParser(); ParseStatus rc = _cmdParser.ParseOptions(argc, argv); - int exit_code = 0; if (rc == PARSE_OK_WITH_EXIT) { return exit_code; } else if ((rc == PARSE_ERROR) || (rc == PARSE_ERROR_SHOW_USAGE)) { - printSynopsis(); throw MlxRegException( "failed to parse arguments. " + string(_cmdParser.GetErrDesc())); @@ -715,7 +720,7 @@ int MlxlinkUi::run(int argc, char **argv) !_mlxlinkCommander->_mlxLinkLib->isAccessRegisterGMPSupported( MACCESS_REG_METHOD_GET)) { MlxlinkRecord::printWar("Warning: AccessRegisterGMP Get() method is not supported.\n" - " mlxlink has limited functionality"); + " mlxlink has limited functionality", _mlxlinkCommander->_jsonRoot); } _mlxlinkCommander->_devID = _mlxlinkCommander->_mlxLinkLib->getDevId(); _mlxlinkCommander->_isHCA = dm_dev_is_hca(_mlxlinkCommander->_devID); @@ -737,10 +742,19 @@ int MlxlinkUi::run(int argc, char **argv) } commandsCaller(); if (_mlxlinkCommander->_allUnhandledErrors != "") { - MlxlinkRecord::printErrorsSection(_mlxlinkCommander->_mlxlinkMaps->_showErrorsTitle, - _mlxlinkCommander->_allUnhandledErrors); exit_code = 1; + if (!MlxlinkRecord::jsonFormat) { + MlxlinkRecord::printErrorsSection( + _mlxlinkCommander->_mlxlinkMaps->_showErrorsTitle, + _mlxlinkCommander->_allUnhandledErrors); + } + } + + if (MlxlinkRecord::jsonFormat) { + _mlxlinkCommander->prepareJsonOut(); + cout << _mlxlinkCommander->_jsonRoot.toStyledString(); } + cout << endl; return exit_code; } diff --git a/mlxlink/modules/mlxlink_utils.cpp b/mlxlink/modules/mlxlink_utils.cpp index 2791ad0..075ecc9 100755 --- a/mlxlink/modules/mlxlink_utils.cpp +++ b/mlxlink/modules/mlxlink_utils.cpp @@ -780,7 +780,7 @@ string prbsMaskToLockStatus(u_int32_t mask, u_int32_t numOfLanesToUse) res += "Not Locked"; } if (i < numOfLanesToUse - 1) { - res += ", "; + res += MlxlinkRecord::jsonFormat? "," : ", "; } } return res; @@ -898,22 +898,22 @@ int fecToBit(const string &fec) string speedToStr(const string &speed) { - if (speed == "200GbE" || speed == "IB-HDR") { + if (speed == "200GbE" || speed == "200G" || speed == "IB-HDR") { return "200g"; } - if (speed == "100GbE" || speed == "IB-EDR") { + if (speed == "100GbE" || speed == "100G" || speed == "IB-EDR") { return "100g"; } - if (speed == "50GbE") { + if (speed == "50GbE" || speed == "50G") { return "50g"; } - if (speed == "25GbE") { + if (speed == "25GbE" || speed == "25G") { return "25g"; } - if (speed == "40GbE" || speed == "IB-FDR10") { + if (speed == "40GbE" || speed == "40G" || speed == "IB-FDR10") { return "10g_40g"; } - if (speed == "10GbE" || speed == "IB-QDR") { + if (speed == "10GbE" || speed == "10G" || speed == "IB-QDR") { return "10g_40g"; } if (speed == "IB-FDR") { diff --git a/mlxlink/modules/printutil/Makefile.am b/mlxlink/modules/printutil/Makefile.am index 9f6a0c3..3f4d178 100644 --- a/mlxlink/modules/printutil/Makefile.am +++ b/mlxlink/modules/printutil/Makefile.am @@ -39,8 +39,9 @@ MTCR_DIR = $(top_srcdir)/${MTCR_CONF_DIR} MTCR_INC_DIR = $(top_srcdir)/include/mtcr_ul UTILS_DIR = $(top_srcdir)/mft_utils MLXREG_DIR = $(top_srcdir)/mlxreg +JSON_DIR = $(top_srcdir)/ext_libs/json -INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MTCR_INC_DIR) +INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MTCR_INC_DIR) -I$(JSON_DIR) AM_CFLAGS = -Wall -W -g -MP -MD -pipe -Werror $(COMPILER_FPIC) -DDATA_PATH=\"$(pkgdatadir)\" @@ -50,5 +51,5 @@ libprint_util_lib_a_SOURCES = mlxlink_cmd_print.h \ mlxlink_cmd_print.cpp \ mlxlink_record.h \ mlxlink_record.cpp - -libprint_util_lib_a_CFLAGS = $(AM_CFLAGS) +libprint_util_lib_a_LIBDADD = $(JSON_DIR)/libjson.a +libprint_util_lib_a_CFLAGS = $(AM_CFLAGS) diff --git a/mlxlink/modules/printutil/Makefile.in b/mlxlink/modules/printutil/Makefile.in index 1412e5a..2079ffd 100644 --- a/mlxlink/modules/printutil/Makefile.in +++ b/mlxlink/modules/printutil/Makefile.in @@ -393,7 +393,8 @@ MTCR_DIR = $(top_srcdir)/${MTCR_CONF_DIR} MTCR_INC_DIR = $(top_srcdir)/include/mtcr_ul UTILS_DIR = $(top_srcdir)/mft_utils MLXREG_DIR = $(top_srcdir)/mlxreg -INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MTCR_INC_DIR) +JSON_DIR = $(top_srcdir)/ext_libs/json +INCLUDES = -I. -I$(USER_DIR) -I$(MTCR_DIR) -I$(MFT_EXT_LIBS_INC_DIR) -I$(UTILS_DIR) -I$(MLXREG_DIR) -I$(MTCR_INC_DIR) -I$(JSON_DIR) AM_CFLAGS = -Wall -W -g -MP -MD -pipe -Werror $(COMPILER_FPIC) -DDATA_PATH=\"$(pkgdatadir)\" lib_LTLIBRARIES = libprint_util_lib.a libprint_util_lib_a_SOURCES = mlxlink_cmd_print.h \ @@ -401,6 +402,7 @@ libprint_util_lib_a_SOURCES = mlxlink_cmd_print.h \ mlxlink_record.h \ mlxlink_record.cpp +libprint_util_lib_a_LIBDADD = $(JSON_DIR)/libjson.a libprint_util_lib_a_CFLAGS = $(AM_CFLAGS) all: all-am diff --git a/mlxlink/modules/printutil/mlxlink_cmd_print.cpp b/mlxlink/modules/printutil/mlxlink_cmd_print.cpp index 358bd32..dc7649f 100644 --- a/mlxlink/modules/printutil/mlxlink_cmd_print.cpp +++ b/mlxlink/modules/printutil/mlxlink_cmd_print.cpp @@ -47,15 +47,55 @@ void MlxlinkCmdPrint::initRecords(int size) mlxlinkRecords.insert(mlxlinkRecords.begin(), size, MlxlinkRecord()); } -std::ostream & operator << (std::ostream &out, const MlxlinkCmdPrint &cmdPrint) +void MlxlinkCmdPrint::toJsonFormat(Json::Value& jsonRoot) { - if (!cmdPrint.visible) { - return out; + if (!visible) { + return; + } + Json::Value outputGroup; + MlxlinkRecord record; + for (u_int32_t i = 0; i < mlxlinkRecords.size(); i++) { + record = mlxlinkRecords[i]; + if (record.visible && record.key != "") { + if (record.arrayValue) { + Json::Value subObject; + subObject[JSON_VALUES_TITLE] = Json::Value(Json::arrayValue); + std::string val = record.val; + if (title == HEADER_SUPPORTED_INFO || + title == HEADER_FEC_INFO) { + std::string mask = val.substr(0, val.find("(")-1); + val = val.substr( + val.find("(")+1, val.find_last_of(")")-mask.length()-2); + subObject[JSON_MASK_TITLE] = mask; + } + if (!val.empty()) { + std::vector<std::string> vals = + MlxlinkRecord::split(val, ','); + for (std::vector<std::string>::iterator it = vals.begin() ; + it != vals.end(); ++it) { + subObject[JSON_VALUES_TITLE].append(*it); + } + } + outputGroup[record.key] = subObject; + } else { + outputGroup[record.key] = record.val; + } + } } - out << std::endl << cmdPrint.title << std::endl; - out << std::string(cmdPrint.title.length(), '-') << std::endl; - for (u_int32_t i = 0; i < cmdPrint.mlxlinkRecords.size(); i++) { - out << cmdPrint.mlxlinkRecords[i]; + jsonRoot[JSON_RESULT_SECTION][JSON_OUTPUT_SECTION][title] = outputGroup; +} + +std::ostream & operator << (std::ostream &out, const MlxlinkCmdPrint &cmdPrint) +{ + if (!MlxlinkRecord::jsonFormat) { + if (!cmdPrint.visible) { + return out; + } + out << std::endl << cmdPrint.title << std::endl; + out << std::string(cmdPrint.title.length(), '-') << std::endl; + for (u_int32_t i = 0; i < cmdPrint.mlxlinkRecords.size(); i++) { + out << cmdPrint.mlxlinkRecords[i]; + } } return out; } diff --git a/mlxlink/modules/printutil/mlxlink_cmd_print.h b/mlxlink/modules/printutil/mlxlink_cmd_print.h index a8c5162..023e3cf 100644 --- a/mlxlink/modules/printutil/mlxlink_cmd_print.h +++ b/mlxlink/modules/printutil/mlxlink_cmd_print.h @@ -37,13 +37,17 @@ #include <vector> #include "mlxlink_record.h" +#include <json/json.h> class MlxlinkCmdPrint{ + public: MlxlinkCmdPrint(); virtual ~MlxlinkCmdPrint(); friend std::ostream & operator << (std::ostream &out, const MlxlinkCmdPrint &cmdPrint); void initRecords(int size); + void toJsonFormat(Json::Value& jsonRoot); + std::string title; std::vector<MlxlinkRecord> mlxlinkRecords; bool visible; diff --git a/mlxlink/modules/printutil/mlxlink_record.cpp b/mlxlink/modules/printutil/mlxlink_record.cpp index b32cc10..f147e7c 100644 --- a/mlxlink/modules/printutil/mlxlink_record.cpp +++ b/mlxlink/modules/printutil/mlxlink_record.cpp @@ -36,16 +36,37 @@ #define MAX_LEN_OF_GRADE 6 +bool MlxlinkRecord::jsonFormat = false; + MlxlinkRecord::MlxlinkRecord() { key = ""; val = "N/A"; color = ANSI_COLOR_RESET; visible = true; + arrayValue = false; } MlxlinkRecord::~MlxlinkRecord() { } +std::vector<std::string> MlxlinkRecord::split(const std::string& str, char delim) +{ + std::vector<std::string> list; + std::stringstream ss(str); + std::string token; + while (std::getline(ss, token, delim)) { + MlxlinkRecord::trim(token); + list.push_back(token); + } + return list; +} + +void MlxlinkRecord::trim(std::string& str, const std::string& chars) +{ + str.erase(0, str.find_first_not_of(chars)); + str.erase(str.find_last_not_of(chars) + 1); +} + std::string MlxlinkRecord::state2Color(u_int32_t state) { std::string color; @@ -141,6 +162,9 @@ void MlxlinkRecord::printFlagLine(const char flag_s, const std::string &flag_l, std::string MlxlinkRecord::addSpaceForSlrg(const std::string &str) { + if (MlxlinkRecord::jsonFormat) { + return str; + } u_int32_t strSize = (MAX_LEN_OF_GRADE > str.length()) ? MAX_LEN_OF_GRADE - str.length() : 0; @@ -156,8 +180,12 @@ void MlxlinkRecord::printErrorsSection(const std::string &title, const std::stri changeColorOS(ANSI_COLOR_RESET, false); } -void MlxlinkRecord::printCmdLine(const std::string &line) +void MlxlinkRecord::printCmdLine(const std::string &line, Json::Value &jsonRoot) { + if (MlxlinkRecord::jsonFormat) { + jsonRoot[JSON_RESULT_SECTION][JSON_CONFIG_SECTION].append(line); + return; + } std::cout << std::endl << line << "..." << std::endl; } @@ -168,8 +196,12 @@ void MlxlinkRecord::printErr(const std::string &err) changeColorOS(ANSI_COLOR_RESET, true); } -void MlxlinkRecord::printWar(const std::string &war) +void MlxlinkRecord::printWar(const std::string &war, Json::Value &jsonRoot) { + if (MlxlinkRecord::jsonFormat) { + jsonRoot[JSON_RESULT_SECTION][JSON_WARN_SECTION][JSON_MSG] = war; + return; + } changeColorOS(ANSI_COLOR_YELLOW, true); std::cerr << war << std::endl; changeColorOS(ANSI_COLOR_RESET, false); @@ -185,4 +217,5 @@ std::ostream & operator << (std::ostream &out, const MlxlinkRecord &mlxlinkRecor out << mlxlinkRecord.val << std::endl; MlxlinkRecord::changeColorOS(ANSI_COLOR_RESET); return out; + } diff --git a/mlxlink/modules/printutil/mlxlink_record.h b/mlxlink/modules/printutil/mlxlink_record.h index f0acd6f..3438cfd 100644 --- a/mlxlink/modules/printutil/mlxlink_record.h +++ b/mlxlink/modules/printutil/mlxlink_record.h @@ -37,12 +37,33 @@ #include <string> #include <iostream> +#include <sstream> #include <iomanip> #include <stdlib.h> #include <common/compatibility.h> +#include <json/json.h> #define PDDR_LINE_LEN 34 +/* + * Json output objects name + */ +#define JSON_WARN_SECTION "warning" +#define JSON_MSG "message" +#define JSON_STATUS_SECTION "status" +#define JSON_STATUS_CODE "code" +#define JSON_RESULT_SECTION "result" +#define JSON_CONFIG_SECTION "configurations" +#define JSON_OUTPUT_SECTION "output" +#define JSON_MASK_TITLE "mask" +#define JSON_VALUES_TITLE "values" + +/* + * Output headers name + */ +#define HEADER_SUPPORTED_INFO "Supported Info" +#define HEADER_FEC_INFO "FEC Capability Info" + #define PRINT_UNDER_TITLE(len) \ for (int i = 0; i < len; i++) { \ printf("-"); \ @@ -250,6 +271,8 @@ public: std::string val; std::string color; bool visible; + bool arrayValue; + static bool jsonFormat; static std::string state2Color(u_int32_t state); static std::string supported2Color(const std::string &supported); @@ -259,9 +282,11 @@ public: const std::string ¶m, const std::string &desc); static std::string addSpaceForSlrg(const std::string &str); static void printErrorsSection(const std::string &title, const std::string &lines); - static void printCmdLine(const std::string &line); + static void printCmdLine(const std::string &line, Json::Value &jsonRoot); static void printErr(const std::string &err); - static void printWar(const std::string &war); + static void printWar(const std::string &war, Json::Value &jsonRoot); + static std::vector<std::string> split(const std::string& str, char delim = ' '); + static void trim(std::string& str, const std::string& chars = "\t\n\v\f\r "); }; std::ostream & operator << (std::ostream &out, const MlxlinkRecord &mlxlinkRecord); diff --git a/mlxreg/mlxreg_lib.cpp b/mlxreg/mlxreg_lib.cpp index fd5c242..248edc3 100644 --- a/mlxreg/mlxreg_lib.cpp +++ b/mlxreg/mlxreg_lib.cpp @@ -78,6 +78,7 @@ const u_int64_t MlxRegLib::_gSupportedRegisters[] = { 0xb019, //SBDCR 0x2802, //CWTP 0x2803, //CWTPM + 0xc001, //NCFG 0x0 //Termination - DO NOT DELETE! }; diff --git a/mstflint.spec b/mstflint.spec index 0b0a933..b33aba2 100644 --- a/mstflint.spec +++ b/mstflint.spec @@ -1,7 +1,7 @@ %{!?ibmadlib: %define ibmadlib libibmad-devel} %{!?name: %define name mstflint} -%{!?version: %define version 4.13.0} -%{!?release: %define release 1} +%{!?version: %define version 4.13.3} +%{!?release: %define release 2} %{!?buildtype: %define buildtype "native"} %{!?noinband: %define noinband 0} %{!?nodc: %define nodc 0} @@ -20,13 +20,13 @@ Summary: Mellanox firmware burning application Name: %{name} -Version: 4.13.1 -Release: 1 +Version: 4.13.3 +Release: 2 License: GPL/BSD Url: http://openfabrics.org Group: System Environment/Base BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} -Source: http://www.openfabrics.org/downloads/mstflint-4.13.1-1.tar.gz +Source: http://www.openfabrics.org/downloads/mstflint-4.13.3-2.tar.gz ExclusiveArch: i386 i486 i586 i686 x86_64 ia64 ppc ppc64 ppc64le arm64 aarch64 %if 0%{?suse_version} @@ -149,6 +149,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/mstcongestion %{_bindir}/mstprivhost %{_bindir}/mstfwtrace +%{_bindir}/mstresourcedump %if %{enablefwmgr} %{_bindir}/mstfwmanager %{_bindir}/mstarchive @@ -182,10 +183,26 @@ rm -rf $RPM_BUILD_ROOT %{mstflint_python_tools}/c_dev_mgt.so %{mstflint_python_tools}/mstprivhost/mstprivhost.py +# Usually, python2 is the default python on a machine, +# so we want to ignore python2 erros caused by incompatiblity with python3 syntax +%define _python_bytecompile_errors_terminate_build 0 + +%{mstflint_python_tools}/mstresourcedump/*.py +%{mstflint_python_tools}/mstresourcedump/validation/*.py +%{mstflint_python_tools}/mstresourcedump/utils/*.py +%{mstflint_python_tools}/mstresourcedump/segments/*.py +%{mstflint_python_tools}/mstresourcedump/resource_data/*.py +%{mstflint_python_tools}/mstresourcedump/filters/*.py +%{mstflint_python_tools}/mstresourcedump/fetchers/*.py +%{mstflint_python_tools}/mstresourcedump/commands/*.py + %{_datadir}/mstflint %{_mandir}/man1/* %changelog +* Tue Dec 31 2019 Eran Jakoby <eranj@dev.mellanox.co.il> + MFT 4.13.3 Updates. Added new tools: mstresourcedump. + * Mon Sep 23 2019 Dan Goldberg <dang@dev.mellanox.co.il> Added conditional lib name of the dependencies to support both RH and SLES naming conventions. diff --git a/mstflint.spec.in b/mstflint.spec.in index 09b8db6..78bd5f6 100644 --- a/mstflint.spec.in +++ b/mstflint.spec.in @@ -1,7 +1,7 @@ %{!?ibmadlib: %define ibmadlib libibmad-devel} %{!?name: %define name mstflint} -%{!?version: %define version 4.13.0} -%{!?release: %define release 1} +%{!?version: %define version 4.13.3} +%{!?release: %define release 2} %{!?buildtype: %define buildtype "native"} %{!?noinband: %define noinband 0} %{!?nodc: %define nodc 0} @@ -149,6 +149,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/mstcongestion %{_bindir}/mstprivhost %{_bindir}/mstfwtrace +%{_bindir}/mstresourcedump %if %{enablefwmgr} %{_bindir}/mstfwmanager %{_bindir}/mstarchive @@ -182,10 +183,26 @@ rm -rf $RPM_BUILD_ROOT %{mstflint_python_tools}/c_dev_mgt.so %{mstflint_python_tools}/mstprivhost/mstprivhost.py +# Usually, python2 is the default python on a machine, +# so we want to ignore python2 erros caused by incompatiblity with python3 syntax +%define _python_bytecompile_errors_terminate_build 0 + +%{mstflint_python_tools}/mstresourcedump/*.py +%{mstflint_python_tools}/mstresourcedump/validation/*.py +%{mstflint_python_tools}/mstresourcedump/utils/*.py +%{mstflint_python_tools}/mstresourcedump/segments/*.py +%{mstflint_python_tools}/mstresourcedump/resource_data/*.py +%{mstflint_python_tools}/mstresourcedump/filters/*.py +%{mstflint_python_tools}/mstresourcedump/fetchers/*.py +%{mstflint_python_tools}/mstresourcedump/commands/*.py + %{_datadir}/mstflint %{_mandir}/man1/* %changelog +* Tue Dec 31 2019 Eran Jakoby <eranj@dev.mellanox.co.il> + MFT 4.13.3 Updates. Added new tools: mstresourcedump. + * Mon Sep 23 2019 Dan Goldberg <dang@dev.mellanox.co.il> Added conditional lib name of the dependencies to support both RH and SLES naming conventions. diff --git a/mtcr_ul/mtcr_ib_ofed.c b/mtcr_ul/mtcr_ib_ofed.c index 0fe970c..02ab58f 100644 --- a/mtcr_ul/mtcr_ib_ofed.c +++ b/mtcr_ul/mtcr_ib_ofed.c @@ -733,7 +733,7 @@ int mib_open(const char *name, mfile *mf, int mad_init) char *ep; u_int32_t sl = strtoul(sl_str, &ep, 0); if (*ep) { - fprintf(stderr, "-E- Failed to parse env var %s (%s). Ignorring\n", MTCR_IBSL_ENV, sl_str); + fprintf(stderr, "-E- Failed to parse env var %s (%s). Ignoring\n", MTCR_IBSL_ENV, sl_str); } else { ivm->portid.sl = (u_int8_t)sl; } diff --git a/reg_access/reg_access.c b/reg_access/reg_access.c index c61e733..859a49f 100755 --- a/reg_access/reg_access.c +++ b/reg_access/reg_access.c @@ -77,6 +77,12 @@ #define REG_ID_MPCIR 0x905a +//================================== +//RESOURCE DUMP FEATURE +#define REG_ID_RES_DUMP 0xC000 +#define REG_ID_DEBUG_CAP 0x8400 +//================================== + //WA for MGIR: the reg size is too big so we limit it to INBAND_MAX_REG_SIZE #define INBAND_MAX_REG_SIZE 44 @@ -184,6 +190,24 @@ REG_ACCCESS_VAR(mf, method, reg_id, data_struct, struct_name, data_size, data_size, data_size, prefix) + +//================================================================================================================================= +/************************************ + * * Function: reg_access_resource_dump + * ************************************/ +reg_access_status_t reg_access_res_dump(mfile *mf, reg_access_method_t method, struct reg_access_hca_resource_dump *resource_dump) +{ + REG_ACCCESS(mf, method, REG_ID_RES_DUMP, resource_dump, resource_dump, reg_access_hca); +} + +reg_access_status_t reg_access_debug_cap(mfile *mf, reg_access_method_t method, struct reg_access_hca_debug_cap *debug_cap) +{ + REG_ACCCESS(mf, method, REG_ID_DEBUG_CAP, debug_cap, debug_cap, reg_access_hca); +} + +//================================================================================================================================= + + /************************************ * Function: reg_access_pcnr ************************************/ @@ -385,12 +409,13 @@ reg_access_status_t reg_access_nvda(mfile *mf, reg_access_method_t method, struc /************************************ * Function: reg_access_mgir ************************************/ -reg_access_status_t reg_access_mgir(mfile *mf, reg_access_method_t method, struct tools_open_mgir *mgir) -{ +reg_access_status_t reg_access_mgir(mfile *mf, reg_access_method_t method, + struct reg_access_hca_mgir *mgir) { if (mf->tp == MST_IB || mf->tp == MST_MLNXOS) { - REG_ACCCESS_VAR(mf, method, REG_ID_MGIR, mgir, mgir, MGIR_REG_SIZE, MGIR_REG_SIZE, MGIR_REG_SIZE, tools_open); + REG_ACCCESS_VAR(mf, method, REG_ID_MGIR, mgir, mgir, MGIR_REG_SIZE, + MGIR_REG_SIZE, MGIR_REG_SIZE, reg_access_hca); } else { - REG_ACCCESS(mf, method, REG_ID_MGIR, mgir, mgir, tools_open); + REG_ACCCESS(mf, method, REG_ID_MGIR, mgir, mgir, reg_access_hca); } } diff --git a/reg_access/reg_access.h b/reg_access/reg_access.h index fcbd4e6..6d463be 100755 --- a/reg_access/reg_access.h +++ b/reg_access/reg_access.h @@ -86,6 +86,8 @@ reg_access_status_t reg_access_mpegc(mfile *mf, reg_access_method_t method, stru reg_access_status_t reg_access_mfpa_new(mfile *mf, reg_access_method_t method, struct tools_open_mfpa *mfpa); reg_access_status_t reg_access_mcam(mfile *mf, reg_access_method_t method, struct tools_open_mcam *mcam); reg_access_status_t reg_access_secure_host(mfile *mf, reg_access_method_t method, struct tools_open_mlock *mlock); +reg_access_status_t reg_access_res_dump(mfile *mf, reg_access_method_t method, struct reg_access_hca_resource_dump *res_dump); +reg_access_status_t reg_access_debug_cap(mfile *mf, reg_access_method_t method, struct reg_access_hca_debug_cap *debug_cap); /* * MCXX new burn commands */ @@ -94,7 +96,8 @@ reg_access_status_t reg_access_mqis(mfile *mf, reg_access_method_t method, struc reg_access_status_t reg_access_mcc(mfile *mf, reg_access_method_t method, struct reg_access_hca_mcc_reg *mcc ); reg_access_status_t reg_access_mcqs(mfile *mf, reg_access_method_t method, struct reg_access_hca_mcqs_reg *mcqs); reg_access_status_t reg_access_mcqi(mfile *mf, reg_access_method_t method, struct reg_access_hca_mcqi_reg *mcqi); -reg_access_status_t reg_access_mgir(mfile *mf, reg_access_method_t method, struct tools_open_mgir *mgir); +reg_access_status_t reg_access_mgir(mfile *mf, reg_access_method_t method, + struct reg_access_hca_mgir *mgir); reg_access_status_t reg_access_mtrc_cap(mfile *mf, reg_access_method_t method, struct reg_access_hca_mtrc_cap_reg *mtrc_cap); reg_access_status_t reg_access_mcdd(mfile *mf, reg_access_method_t method, struct tools_open_mcdd_reg *mcdd); const char* reg_access_err2str(reg_access_status_t status); diff --git a/reg_access/regaccess.py b/reg_access/regaccess.py index 92af93d..08a9720 100755 --- a/reg_access/regaccess.py +++ b/reg_access/regaccess.py @@ -74,6 +74,55 @@ if REG_ACCESS: REG_ACCESS_FAILED_TO_AQUIRE_OWNERSHIP = 1 REG_ACCESS_NO_OWNERSHIP_REQUIRED = 2 + + class RES_DUMP_ST(Structure): + _fields_ = [ + ("segment_type",c_uint16), + ("seq_num",c_uint8), + ("inline_dump",c_uint8), + ("more_dump",c_uint8), + ("vhca_id",c_uint16), + ("index_1",c_uint32), + ("index_2",c_uint32), + ("num_of_obj_2",c_uint16), + ("num_of_obj_1",c_uint16), + ("device_opaque",c_uint64), + ("mkey",c_uint32), + ("size",c_uint32), + ("address",c_uint64), + ("inline_data",c_uint32 * 52) + ] + + + class DIAGNOSTIC_CNTR_ST(Structure): + _fields_ = [ + ("counter_id",c_uint16), + ("sync",c_uint8) + ] + + + class DIAGNOSTIC_CNTR_ST_ARR(Array): + _type_ = DIAGNOSTIC_CNTR_ST + _length_ = 10 + + + class DEBUG_CUP_ST(Structure): + _fields_ = [ + ("log_max_samples",c_uint8), + ("resource_dump",c_uint8), + ("log_cr_dump_to_mem_size",c_uint8), + ("core_dump_qp",c_uint8), + ("core_dump_general",c_uint8), + ("log_min_sample_period",c_uint8), + ("diag_counter_tracer_dump",c_uint8), + ("health_mon_rx_activity",c_uint8), + ("repetitive",c_uint8), + ("single",c_uint8), + #("diagnostic_counter",POINTER(DIAGNOSTIC_CNTR_ST)) + ("diagnostic_counter",POINTER(DIAGNOSTIC_CNTR_ST_ARR)) + ] + + class PCNR_ST(Structure): _fields_ = [ ("tuning_override",c_uint8), @@ -119,6 +168,7 @@ if REG_ACCESS: _fields_ = [("device_id", c_uint16), ("device_hw_revision", c_uint16), ("pvs", c_uint8), + ("num_ports",c_uint8), ("hw_dev_id", c_uint16), ("manufacturing_base_mac_47_32", c_uint16), ("manufacturing_base_mac_31_0", c_uint32), @@ -130,15 +180,13 @@ if REG_ACCESS: ("signed_fw", c_uint8), ("debug_fw", c_uint8), ("dev_fw", c_uint8), + ("string_tlv", c_uint8), ("build_id", c_uint32), ("year", c_uint16), ("day", c_uint8), ("month", c_uint8), ("hour", c_uint16), - ("psid1", c_uint32), - ("psid2", c_uint32), - ("psid3", c_uint32), - ("psid4", c_uint32), + ("psid", c_uint8 * 16), ("ini_file_version", c_uint32), ("extended_major", c_uint32), ("extended_minor", c_uint32), @@ -158,7 +206,8 @@ if REG_ACCESS: ("rom0_version", c_uint32), ("rom1_version", c_uint32), ("rom2_version", c_uint32), - ("rom3_version", c_uint32)] + ("rom3_version", c_uint32), + ("dev_branch_tag", c_uint8 * 28)] class RegAccess: @@ -178,6 +227,8 @@ if REG_ACCESS: self._reg_access_mfrl = REG_ACCESS.reg_access_mfrl self._reg_access_pcnr = REG_ACCESS.reg_access_pcnr self._reg_access_mpcir = REG_ACCESS.reg_access_mpcir + self._reg_access_res_dump = REG_ACCESS.reg_access_res_dump + self._reg_access_debug_cap = REG_ACCESS.reg_access_debug_cap ########################## @@ -218,6 +269,64 @@ if REG_ACCESS: return 0 iter += 1 + + def sendResDump(self, segment_type, seq_num, inline_mode, more_dump, vhca_id, index1, index2, num_of_obj2, num_of_obj1, device_opaque, mkey, size, address): + resDumpRegP = pointer(RES_DUMP_ST()) + resDumpRegP.contents.segment_type = c_uint16(segment_type) + resDumpRegP.contents.seq_num = c_uint8(seq_num) + resDumpRegP.contents.inline_dump = c_uint8(inline_mode) + resDumpRegP.contents.more_dump = c_uint8(more_dump) + resDumpRegP.contents.vhca_id = c_uint16(vhca_id) + resDumpRegP.contents.index_1 = c_uint32(index1) + resDumpRegP.contents.index_2 = c_uint32(index2) + resDumpRegP.contents.num_of_obj_2 = c_uint16(num_of_obj2) + resDumpRegP.contents.num_of_obj_1 = c_uint16(num_of_obj1) + resDumpRegP.contents.device_opaque = c_uint64(device_opaque) + resDumpRegP.contents.mkey = c_uint32(mkey) + resDumpRegP.contents.size = c_uint32(size) + resDumpRegP.contents.address = c_uint64(address) + rc = self._reg_access_res_dump(self._mstDev.mf, c_uint(REG_ACCESS_METHOD_GET), resDumpRegP) + if rc: + raise RegAccException("Failed to send Register RESOURCE DUMP with rc: %d" % rc) + #return (resDumpRegP.contents.segment_type, resDumpRegP.contents.seq_num, resDumpRegP.contents.inline_data[0]) + return ({"segment_type": resDumpRegP.contents.segment_type, + "seq_num": resDumpRegP.contents.seq_num, + "inline_dump": resDumpRegP.contents.inline_dump, + "more_dump": resDumpRegP.contents.more_dump, + "vhca_id": resDumpRegP.contents.vhca_id, + "index_1": resDumpRegP.contents.index_1, + "index_2": resDumpRegP.contents.index_2, + "num_of_obj_2": resDumpRegP.contents.num_of_obj_2, + "num_of_obj_1": resDumpRegP.contents.num_of_obj_1, + "device_opaque": resDumpRegP.contents.device_opaque, + "mkey": resDumpRegP.contents.mkey, + "size": resDumpRegP.contents.size, + "address": resDumpRegP.contents.address, + "inline_data": resDumpRegP.contents.inline_data}) + + + def sendDebugCap(self): + debugCapRegP = pointer(DEBUG_CUP_ST()) + debugCapRegP.contents.log_max_samples = c_uint8(0) + debugCapRegP.contents.resource_dump = c_uint8(0) + debugCapRegP.contents.log_cr_dump_to_mem_size = c_uint8(0) + debugCapRegP.contents.core_dump_qp = c_uint8(0) + debugCapRegP.contents.core_dump_general = c_uint8(0) + debugCapRegP.contents.log_min_sample_period = c_uint8(0) + debugCapRegP.contents.diag_counter_tracer_dump = c_uint8(0) + debugCapRegP.contents.health_mon_rx_activity = c_uint8(0) + debugCapRegP.contents.repetitive = c_uint8(0) + debugCapRegP.contents.single = c_uint8(0) + tmp = pointer(DIAGNOSTIC_CNTR_ST()) + tmp.contents.counter_id = c_uint16(0) + tmp.contents.sync = c_uint8(0) + debugCapRegP.contents.diagnostic_counter = pointer(DIAGNOSTIC_CNTR_ST_ARR()) + rc = self._reg_access_debug_cap(self._mstDev.mf, c_uint(REG_ACCESS_METHOD_GET), debugCapRegP) + if rc: + raise RegAccException("Failed to send Register DEBUG CAP with rc: %d" % rc) + return debugCapRegP.contents.resource_dump + + def sendPcnr(self, tuning_override, local_port): # Requirments : new FW version + burn with allow_pcnr pcnrRegisterP = pointer(PCNR_ST()) @@ -245,7 +354,7 @@ if REG_ACCESS: raise ValueError("command {0} is illegal".format(command)) mpcirRegisterP = pointer(MPCIR_ST(ports=command)) - rc = self._reg_access_mpcir(self._mstDev.mf, c_uint(REG_ACCESS_METHOD_SET), mpcirRegisterP) + rc = self._reg_access_mpcir(self._mstDev.mf, c_uint(REG_ACCESS_METHOD_GET), mpcirRegisterP) if rc != 0: raise RegAccException("Failed to send Command Register MPCIR") if command == CMD_GET_STATUS: diff --git a/resourcedump/Makefile.am b/resourcedump/Makefile.am new file mode 100755 index 0000000..ec86e69 --- /dev/null +++ b/resourcedump/Makefile.am @@ -0,0 +1,41 @@ +#-- +# - Mellanox Confidential and Proprietary - +# +# Copyright (C) Jan 2019, Mellanox Technologies Ltd. ALL RIGHTS RESERVED. +# +# 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". +#-- + +# Makefile.am -- Process this file with automake to produce Makefile.in + +USER_DIR = $(top_srcdir) +bin_SCRIPTS=mstresourcedump + +PYTHON_WRAPPER=mstresourcedump +PYTHON_WRAPPER_SCRIPT=$(USER_DIR)/common/python_wrapper +${PYTHON_WRAPPER}: $(PYTHON_WRAPPER_SCRIPT) + cp $(PYTHON_WRAPPER_SCRIPT) $@ +pythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump +dist_pythonlib_SCRIPTS = mstresourcedump.py +dist_pythonlib_DATA = __init__.py +validationpythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/validation +dist_validationpythonlib_DATA = validation/*.py +utilspythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/utils +dist_utilspythonlib_DATA = utils/*.py +segmentspythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/segments +dist_segmentspythonlib_DATA = segments/*.py +resourcepythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/resource_data +dist_resourcepythonlib_DATA = resource_data/*.py +filterspythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/filters +dist_filterspythonlib_DATA = filters/*.py +fetcherspythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/fetchers +dist_fetcherspythonlib_DATA = fetchers/*.py +commandspythonlibdir=$(libdir)/mstflint/python_tools/mstresourcedump/commands +dist_commandspythonlib_DATA = commands/*.py + +CLEANFILES=${PYTHON_WRAPPER} diff --git a/resourcedump/Makefile.in b/resourcedump/Makefile.in new file mode 100644 index 0000000..6fab05d --- /dev/null +++ b/resourcedump/Makefile.in @@ -0,0 +1,810 @@ +# Makefile.in generated by automake 1.13.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +#-- +# - Mellanox Confidential and Proprietary - +# +# Copyright (C) Jan 2019, Mellanox Technologies Ltd. ALL RIGHTS RESERVED. +# +# 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". +#-- + +# Makefile.am -- Process this file with automake to produce Makefile.in + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = resourcedump +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(dist_pythonlib_SCRIPTS) $(dist_commandspythonlib_DATA) \ + $(dist_fetcherspythonlib_DATA) $(dist_filterspythonlib_DATA) \ + $(dist_pythonlib_DATA) $(dist_resourcepythonlib_DATA) \ + $(dist_segmentspythonlib_DATA) $(dist_utilspythonlib_DATA) \ + $(dist_validationpythonlib_DATA) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pythonlibdir)" \ + "$(DESTDIR)$(commandspythonlibdir)" \ + "$(DESTDIR)$(fetcherspythonlibdir)" \ + "$(DESTDIR)$(filterspythonlibdir)" "$(DESTDIR)$(pythonlibdir)" \ + "$(DESTDIR)$(resourcepythonlibdir)" \ + "$(DESTDIR)$(segmentspythonlibdir)" \ + "$(DESTDIR)$(utilspythonlibdir)" \ + "$(DESTDIR)$(validationpythonlibdir)" +SCRIPTS = $(bin_SCRIPTS) $(dist_pythonlib_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(dist_commandspythonlib_DATA) $(dist_fetcherspythonlib_DATA) \ + $(dist_filterspythonlib_DATA) $(dist_pythonlib_DATA) \ + $(dist_resourcepythonlib_DATA) $(dist_segmentspythonlib_DATA) \ + $(dist_utilspythonlib_DATA) $(dist_validationpythonlib_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADABE_DBS = @ADABE_DBS@ +ADABE_DBS_EXTRA_DIST = @ADABE_DBS_EXTRA_DIST@ +ADABE_TOOLS = @ADABE_TOOLS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILER_FPIC = @COMPILER_FPIC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_INC_DIR = @CURL_INC_DIR@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISABLE_XML2 = @DISABLE_XML2@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_DC = @ENABLE_DC@ +ENABLE_FWMGR = @ENABLE_FWMGR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FW_MGR_TOOLS = @FW_MGR_TOOLS@ +GREP = @GREP@ +INIPARSER_CFLAGS = @INIPARSER_CFLAGS@ +INIPARSER_LIBS = @INIPARSER_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JSON_CFLAGS = @JSON_CFLAGS@ +JSON_LIBS = @JSON_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LDL = @LDL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_IFC = @MAD_IFC@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSTFLINT_VERSION_STR = @MSTFLINT_VERSION_STR@ +MTCR_CONF_DIR = @MTCR_CONF_DIR@ +MUPARSER_CFLAGS = @MUPARSER_CFLAGS@ +MUPARSER_LIBS = @MUPARSER_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PROJECT = @PROJECT@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SQLITE_CFLAGS = @SQLITE_CFLAGS@ +SQLITE_LIBS = @SQLITE_LIBS@ +STRIP = @STRIP@ +TOOLS_BUILD_TIME = @TOOLS_BUILD_TIME@ +TOOLS_CRYPTO = @TOOLS_CRYPTO@ +TOOLS_GIT_SHA = @TOOLS_GIT_SHA@ +VERSION = @VERSION@ +XZ_UTILS_DIR = @XZ_UTILS_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +default_en_inband = @default_en_inband@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +USER_DIR = $(top_srcdir) +bin_SCRIPTS = mstresourcedump +PYTHON_WRAPPER = mstresourcedump +PYTHON_WRAPPER_SCRIPT = $(USER_DIR)/common/python_wrapper +pythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump +dist_pythonlib_SCRIPTS = mstresourcedump.py +dist_pythonlib_DATA = __init__.py +validationpythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/validation +dist_validationpythonlib_DATA = validation/*.py +utilspythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/utils +dist_utilspythonlib_DATA = utils/*.py +segmentspythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/segments +dist_segmentspythonlib_DATA = segments/*.py +resourcepythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/resource_data +dist_resourcepythonlib_DATA = resource_data/*.py +filterspythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/filters +dist_filterspythonlib_DATA = filters/*.py +fetcherspythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/fetchers +dist_fetcherspythonlib_DATA = fetchers/*.py +commandspythonlibdir = $(libdir)/mstflint/python_tools/mstresourcedump/commands +dist_commandspythonlib_DATA = commands/*.py +CLEANFILES = ${PYTHON_WRAPPER} +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign resourcedump/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign resourcedump/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) +install-dist_pythonlibSCRIPTS: $(dist_pythonlib_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(dist_pythonlib_SCRIPTS)'; test -n "$(pythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pythonlibdir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pythonlibdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-dist_pythonlibSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(dist_pythonlib_SCRIPTS)'; test -n "$(pythonlibdir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(pythonlibdir)'; $(am__uninstall_files_from_dir) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-dist_commandspythonlibDATA: $(dist_commandspythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_commandspythonlib_DATA)'; test -n "$(commandspythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(commandspythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(commandspythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(commandspythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(commandspythonlibdir)" || exit $$?; \ + done + +uninstall-dist_commandspythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_commandspythonlib_DATA)'; test -n "$(commandspythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(commandspythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_fetcherspythonlibDATA: $(dist_fetcherspythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_fetcherspythonlib_DATA)'; test -n "$(fetcherspythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(fetcherspythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(fetcherspythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(fetcherspythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(fetcherspythonlibdir)" || exit $$?; \ + done + +uninstall-dist_fetcherspythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_fetcherspythonlib_DATA)'; test -n "$(fetcherspythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(fetcherspythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_filterspythonlibDATA: $(dist_filterspythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_filterspythonlib_DATA)'; test -n "$(filterspythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterspythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterspythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filterspythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(filterspythonlibdir)" || exit $$?; \ + done + +uninstall-dist_filterspythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_filterspythonlib_DATA)'; test -n "$(filterspythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(filterspythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_pythonlibDATA: $(dist_pythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_pythonlib_DATA)'; test -n "$(pythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pythonlibdir)" || exit $$?; \ + done + +uninstall-dist_pythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_pythonlib_DATA)'; test -n "$(pythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_resourcepythonlibDATA: $(dist_resourcepythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_resourcepythonlib_DATA)'; test -n "$(resourcepythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(resourcepythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(resourcepythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(resourcepythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(resourcepythonlibdir)" || exit $$?; \ + done + +uninstall-dist_resourcepythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_resourcepythonlib_DATA)'; test -n "$(resourcepythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(resourcepythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_segmentspythonlibDATA: $(dist_segmentspythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_segmentspythonlib_DATA)'; test -n "$(segmentspythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(segmentspythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(segmentspythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(segmentspythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(segmentspythonlibdir)" || exit $$?; \ + done + +uninstall-dist_segmentspythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_segmentspythonlib_DATA)'; test -n "$(segmentspythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(segmentspythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_utilspythonlibDATA: $(dist_utilspythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_utilspythonlib_DATA)'; test -n "$(utilspythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(utilspythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(utilspythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(utilspythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(utilspythonlibdir)" || exit $$?; \ + done + +uninstall-dist_utilspythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_utilspythonlib_DATA)'; test -n "$(utilspythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(utilspythonlibdir)'; $(am__uninstall_files_from_dir) +install-dist_validationpythonlibDATA: $(dist_validationpythonlib_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_validationpythonlib_DATA)'; test -n "$(validationpythonlibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(validationpythonlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(validationpythonlibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(validationpythonlibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(validationpythonlibdir)" || exit $$?; \ + done + +uninstall-dist_validationpythonlibDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_validationpythonlib_DATA)'; test -n "$(validationpythonlibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(validationpythonlibdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pythonlibdir)" "$(DESTDIR)$(commandspythonlibdir)" "$(DESTDIR)$(fetcherspythonlibdir)" "$(DESTDIR)$(filterspythonlibdir)" "$(DESTDIR)$(pythonlibdir)" "$(DESTDIR)$(resourcepythonlibdir)" "$(DESTDIR)$(segmentspythonlibdir)" "$(DESTDIR)$(utilspythonlibdir)" "$(DESTDIR)$(validationpythonlibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_commandspythonlibDATA \ + install-dist_fetcherspythonlibDATA \ + install-dist_filterspythonlibDATA install-dist_pythonlibDATA \ + install-dist_pythonlibSCRIPTS \ + install-dist_resourcepythonlibDATA \ + install-dist_segmentspythonlibDATA \ + install-dist_utilspythonlibDATA \ + install-dist_validationpythonlibDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binSCRIPTS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binSCRIPTS \ + uninstall-dist_commandspythonlibDATA \ + uninstall-dist_fetcherspythonlibDATA \ + uninstall-dist_filterspythonlibDATA \ + uninstall-dist_pythonlibDATA uninstall-dist_pythonlibSCRIPTS \ + uninstall-dist_resourcepythonlibDATA \ + uninstall-dist_segmentspythonlibDATA \ + uninstall-dist_utilspythonlibDATA \ + uninstall-dist_validationpythonlibDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-dist_commandspythonlibDATA \ + install-dist_fetcherspythonlibDATA \ + install-dist_filterspythonlibDATA install-dist_pythonlibDATA \ + install-dist_pythonlibSCRIPTS \ + install-dist_resourcepythonlibDATA \ + install-dist_segmentspythonlibDATA \ + install-dist_utilspythonlibDATA \ + install-dist_validationpythonlibDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-dist_commandspythonlibDATA \ + uninstall-dist_fetcherspythonlibDATA \ + uninstall-dist_filterspythonlibDATA \ + uninstall-dist_pythonlibDATA uninstall-dist_pythonlibSCRIPTS \ + uninstall-dist_resourcepythonlibDATA \ + uninstall-dist_segmentspythonlibDATA \ + uninstall-dist_utilspythonlibDATA \ + uninstall-dist_validationpythonlibDATA + +${PYTHON_WRAPPER}: $(PYTHON_WRAPPER_SCRIPT) + cp $(PYTHON_WRAPPER_SCRIPT) $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/resourcedump/__init__.py b/resourcedump/__init__.py new file mode 100755 index 0000000..d3f5a12 --- /dev/null +++ b/resourcedump/__init__.py @@ -0,0 +1 @@ + diff --git a/resourcedump/commands/CommandFactory.py b/resourcedump/commands/CommandFactory.py new file mode 100755 index 0000000..1ba9555 --- /dev/null +++ b/resourcedump/commands/CommandFactory.py @@ -0,0 +1,30 @@ +####################################################### +# +# CommandFactory.py +# Python implementation of the Class CommandFactory +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:00 AM +# Original author: talve +# +####################################################### + + +class CommandFactory: + commands = {} + """This class is responsible for creating and registering the commands. + """ + @classmethod + def register(cls, command_type, obj): + """This method should be use from the specific command in order to perform the + command registration. + """ + cls.commands.update({command_type: obj}) + + @classmethod + def create(cls, command_type, **kwargs): + """create the command and return the command obj. + """ + if command_type not in cls.commands: + raise Exception("command type:{0} is not supported".format(command_type)) + return cls.commands[command_type](**kwargs) + diff --git a/resourcedump/commands/DumpCommand.py b/resourcedump/commands/DumpCommand.py new file mode 100755 index 0000000..36a3bf8 --- /dev/null +++ b/resourcedump/commands/DumpCommand.py @@ -0,0 +1,68 @@ +####################################################### +# +# DumpCommand.py +# Python implementation of the Class DumpCommand +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:00 AM +# Original author: talve +# +####################################################### +from commands.ResDumpCommand import ResDumpCommand +from commands.CommandFactory import CommandFactory +from utils import constants as cs +from validation.CapabilityValidator import CapabilityValidator +from resource_data.DumpData import DumpData +from resource_data.DataPrinter import DataPrinter + + +class DumpCommand(ResDumpCommand): + """This class is responsible for performing the dump command flow by validate, + getting the data and print it. + """ + def __init__(self, **kwargs): + """DumpCommand initialization. + """ + self.device_name = kwargs[cs.UI_ARG_DEVICE] + self.segment = kwargs[cs.UI_ARG_SEGMENT] + self.vHCAid = kwargs[cs.UI_ARG_VHCAID] + self.index1 = kwargs[cs.UI_ARG_INDEX1] + self.index2 = kwargs[cs.UI_ARG_INDEX2] + self.numOfObj1 = kwargs[cs.UI_ARG_NUMOFOBJ1] + self.numOfObj2 = kwargs[cs.UI_ARG_NUMOFOBJ2] + self.depth = kwargs[cs.UI_ARG_DEPTH] + self.bin = kwargs[cs.UI_ARG_BIN] + self.data = None + + def get_data(self): + """call the QueryData for getting the dump data. + """ + self.data = DumpData.get_dump(device_name=self.device_name, + segment=self.segment, + vHCAid=self.vHCAid, + index1=self.index1, + index2=self.index2, + numOfObj1=self.numOfObj1, + numOfObj2=self.numOfObj2, + depth=self.depth, + bin=self.bin) + + def print_data(self): + """call the data printer with the right configuration for print the dump data to + screen or in a binary format (choosed by the user). + """ + DataPrinter.print_dump_data(self.data, self.bin) + + def validate(self): + """call the capability validator and check if the core dump supported by the FW. + """ + validation_status = False + + if CapabilityValidator.validate(): + validation_status = True + else: + print("resource dump register is not supported by FW") + + return validation_status + + +CommandFactory.register(cs.RESOURCE_DUMP_COMMAND_TYPE_DUMP, DumpCommand) diff --git a/resourcedump/commands/QueryCommand.py b/resourcedump/commands/QueryCommand.py new file mode 100755 index 0000000..1b7459e --- /dev/null +++ b/resourcedump/commands/QueryCommand.py @@ -0,0 +1,54 @@ +####################################################### +# +# QueryCommand.py +# Python implementation of the Class QueryCommand +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:00 AM +# Original author: talve +# +####################################################### +from commands.ResDumpCommand import ResDumpCommand +from commands.CommandFactory import CommandFactory +from utils import constants +from validation.CapabilityValidator import CapabilityValidator +from resource_data.QueryData import QueryData +from resource_data.DataPrinter import DataPrinter +from utils import constants as cs + + +class QueryCommand(ResDumpCommand): + """This class is responsible for performing the query command flow by validate, + getting the data and print it. + """ + + def __init__(self, **kwargs): + """QueryCommand initialization. + """ + self.device_name = kwargs[cs.UI_ARG_DEVICE] + self.vHCAid = kwargs[cs.UI_ARG_VHCAID] + self.data = None + + if not self.vHCAid: + self.vHCAid = 0 + + def get_data(self): + """call the QueryData for getting the menu data. + """ + self.data = QueryData.get_query(self.device_name, self.vHCAid) + + def print_data(self): + """call the data printer with the right configuration for print the menu to screen. + """ + DataPrinter.print_query_data(self.data) + + def validate(self): + """call the capability validator and check if the core dump supported by the FW. + """ + + if CapabilityValidator.validate(): + return True + else: + raise Exception("Resource Dump register is not supported by the FW") + + +CommandFactory.register(constants.RESOURCE_DUMP_COMMAND_TYPE_QUERY, QueryCommand) diff --git a/resourcedump/commands/ResDumpCommand.py b/resourcedump/commands/ResDumpCommand.py new file mode 100755 index 0000000..6aa4340 --- /dev/null +++ b/resourcedump/commands/ResDumpCommand.py @@ -0,0 +1,44 @@ +####################################################### +# +# ResDumpCommand.py +# Python implementation of the Class ResDumpCommand +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:58 AM +# Original author: talve +# +####################################################### +from abc import ABC, abstractmethod + + +class ResDumpCommand(ABC): + """This class is an interface for the resource dump commands and perform a + strategy pattern of the execution by calling the internal methods. + validate, get_data and print_data that will be implemented by each command. + """ + def execute(self): + """Command execution call: + 1. validate. + 2. get_data. + 3. print_data. + """ + self.validate() + self.get_data() + self.print_data() + + @abstractmethod + def get_data(self): + """get the needed data. + """ + pass + + @abstractmethod + def print_data(self, data): + """Print the collected data. + """ + pass + + @abstractmethod + def validate(self): + """validate. + """ + pass diff --git a/resourcedump/commands/__init__.py b/resourcedump/commands/__init__.py new file mode 100755 index 0000000..ae283f7 --- /dev/null +++ b/resourcedump/commands/__init__.py @@ -0,0 +1 @@ +from commands import QueryCommand, DumpCommand diff --git a/resourcedump/fetchers/CapabilityFetcher.py b/resourcedump/fetchers/CapabilityFetcher.py new file mode 100755 index 0000000..a0c5687 --- /dev/null +++ b/resourcedump/fetchers/CapabilityFetcher.py @@ -0,0 +1,21 @@ +####################################################### +# +# CapabilityFetcher.py +# Python implementation of the Class CapabilityFetcher +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:01 AM +# Original author: talve +# +####################################################### + + +class CapabilityFetcher: + """this class responsible for fetching the core dump capability. + """ + @classmethod + def fetch(cls): + """this method responsible for fetching the core dump capability + and return it to the caller. + """ + # return value from regaccess, implementation is missing due to a fw bug + return 2097152 diff --git a/resourcedump/fetchers/ResourceDumpFetcher.py b/resourcedump/fetchers/ResourceDumpFetcher.py new file mode 100755 index 0000000..5042c3a --- /dev/null +++ b/resourcedump/fetchers/ResourceDumpFetcher.py @@ -0,0 +1,152 @@ +####################################################### +# +# ResourceDumpFetcher.py +# Python implementation of the Class CoreDumpFetcher +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:01 AM +# Original author: talve +# +####################################################### + +from segments.SegmentCreator import SegmentCreator +from utils import constants +from utils import constants as cs +import sys +import os +import math + +sys.path.append(os.path.join("mtcr_py")) +sys.path.append(os.path.join("reg_access")) + +import mtcr # noqa +import regaccess # noqa + + +class ResourceDumpFetcher: + """this class is responsible for getting all the segments of a the required dump. + """ + # very big number that represent the inf number 2^32 - 1 (we will not reach that number) + INF_DEPTH = 4294967295 + + def __init__(self, device_name): + self._sequence_number = ResourceDumpFetcher._sequence_incrementor() + self._device_name = device_name + self._start_seq_number = 0 + try: + mst_device = mtcr.MstDevice(self._device_name) + self.reg_access_obj = regaccess.RegAccess(mst_device) + except Exception as e: + raise Exception("failed with exception: {0}".format(e)) + + @staticmethod + def _create_segments(segments_data): + """convert the data into a list of segments by calling the SegmentCreator. + """ + return SegmentCreator().create(segments_data) + + def fetch_data(self, **kwargs): + """this method fetch the segments of the required dump by: + 1. read the core dump register from the reg access while more dump bit is + equal to "1" and the sequence number is valid. + 2. use SegmentsCreator for converting it to a list of segments. + 3. iterate stage 1 and 2 according the depth parameter and in case reference + segments found. + """ + # read the inline data from the resource dump register and split it to segments list + self._start_seq_number = 0 + inline_data = self._retrieve_resource_dump_inline_data(kwargs[cs.UI_ARG_SEGMENT], **kwargs) + segments_list = self._create_segments(inline_data) + segments_list_last_position = 0 + + # go over oll the segments from the last position till the and of the segments list + # and repeat it according the depth parameter + if kwargs[cs.UI_ARG_DEPTH] == "inf": + depth = ResourceDumpFetcher.INF_DEPTH + else: + depth = int(kwargs[cs.UI_ARG_DEPTH]) if kwargs[cs.UI_ARG_DEPTH] else 0 + + for i in range(depth): + inner_inline_data = [] + for seg in segments_list[segments_list_last_position:]: + if seg.get_type() == constants.RESOURCE_DUMP_SEGMENT_TYPE_REFERENCE: + inner_inline_data.extend( + self._retrieve_resource_dump_inline_data(seg.reference_type, index1=seg.index1, + index2=seg.index2, numOfObj1=seg.num_of_obj1, + numOfObj2=seg.num_of_obj2, vHCAid=kwargs["vHCAid"])) + + segments_list_last_position = len(segments_list) + segments_list.extend(self._create_segments(inner_inline_data)) + + # relevant for inf mode, nothing to show, we can stop search for ref segments + # because if refs found we expect that the segments list extend to do something + if segments_list_last_position == len(segments_list): + break + + return segments_list + + def _validate_sequence_number(self, current_seq_number): + """validate that the sequence number was incremented. + """ + return current_seq_number == next(self._sequence_number) + + @staticmethod + def _sequence_incrementor(): + cnt = 0 + while True: + yield cnt % 16 + cnt += 1 + + def _retrieve_resource_dump_inline_data(self, segment_type, **kwargs): + """call the resource dump access register and retrieve the inline data + till more dump is '0' + """ + + segment = int(segment_type, 16) + seg_number = self._start_seq_number + more_dump = 0 + vhca_id = int(kwargs["vHCAid"]) if kwargs["vHCAid"] else 0 + index1 = int(kwargs["index1"]) if kwargs["index1"] else 0 + index2 = int(kwargs["index2"]) if kwargs["index2"] else 0 + num_of_obj_1 = int(kwargs["numOfObj1"]) if kwargs["numOfObj1"] else 0 + num_of_obj_2 = int(kwargs["numOfObj2"]) if kwargs["numOfObj2"] else 0 + device_opaque = 0 + inline_data = [] + call_res_dump = True + + while call_res_dump: + results = self.reg_access_obj.sendResDump(segment, # "segment_type" + seg_number, # "seq_num" * need check + 1, # "inline_dump" + more_dump, # "more_dump" * + vhca_id, # "vHCAid" + index1, # "index_1" * + index2, # "index_2" * + num_of_obj_2, # "num_of_obj_2" * + num_of_obj_1, # "num_of_obj_1" * + device_opaque, # "device_opaque" * + 0, # "mkey" 0 + 0, # "size" 0 + 0) # "address" 0 + + more_dump = results["more_dump"] + vhca_id = results["vhca_id"] + index1 = results["index_1"] + index2 = results["index_2"] + num_of_obj_1 = results["num_of_obj_1"] + num_of_obj_2 = results["num_of_obj_2"] + device_opaque = results["device_opaque"] + size = int(math.ceil(results["size"] / 4)) + + inline_data.extend(results["inline_data"][:size]) + if not self._validate_sequence_number(seg_number): + raise Exception("E - wrong sequence number while calling resource dump register with seq num = {0}" + .format(seg_number)) + call_res_dump = False + + seg_number = results["seq_num"] + self._start_seq_number = seg_number + + if more_dump == 0: + call_res_dump = False + + return inline_data diff --git a/resourcedump/fetchers/__init__.py b/resourcedump/fetchers/__init__.py new file mode 100755 index 0000000..d3f5a12 --- /dev/null +++ b/resourcedump/fetchers/__init__.py @@ -0,0 +1 @@ + diff --git a/resourcedump/filters/SegmentsFilter.py b/resourcedump/filters/SegmentsFilter.py new file mode 100755 index 0000000..354afce --- /dev/null +++ b/resourcedump/filters/SegmentsFilter.py @@ -0,0 +1,21 @@ +####################################################### +# +# SegmentsFilter.py +# Python implementation of the Class SegmentsFilter +# Original author: romany +# +####################################################### + + +class SegmentsFilter: + """this class is responsible for filtering the segments. + """ + @staticmethod + def get_segments(segments_lst, seg_type): + """this method responsible for filtering the segments + by returning only the relevant segments according + the given type. + """ + filter_func = (lambda x: x.get_type() == seg_type) + filtered = filter(filter_func, segments_lst) + return [el for el in filtered] diff --git a/resourcedump/filters/__init__.py b/resourcedump/filters/__init__.py new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/resourcedump/filters/__init__.py diff --git a/resourcedump/mstresourcedump.py b/resourcedump/mstresourcedump.py new file mode 100755 index 0000000..8b5883a --- /dev/null +++ b/resourcedump/mstresourcedump.py @@ -0,0 +1,174 @@ +####################################################### +# +# MlxResDump.py +# Python implementation of the Class MlxResDump +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:58 AM +# Original author: talve +# +####################################################### +import sys +import os + +if sys.version_info[0] < 3: + print("Error: This tool supports python 3.x only. Exiting...") + exit(1) + +import argparse +from commands.CommandFactory import CommandFactory +from utils import constants as cs +sys.path.append(os.path.join("common")) +import tools_version + + +class MlxResDump: + """This class is responsible for the resource dump UI by handling the user inputs and + and running the right command. + """ + @staticmethod + def _decimal_hex_check(inp): + """This method check if the string input is hex or decimal. + if the input is hex the method convert it to decimal number + otherwise convert it to decimal number. + """ + try: + if inp.startswith("0x"): + inp = int(inp, 16) + else: + inp = int(inp) + return inp + except Exception as _: + msg = "wrong value: {0} is not decimal or hex".format(inp) + raise argparse.ArgumentTypeError(msg) + + @staticmethod + def _decimal_hex_to_str_hex(inp): + """This method check if the string input is hex or decimal. + and convert it to hex number. + in case that the input is not a number, the method will + return the input as is (str). + """ + try: + if inp.startswith("0x"): + inp = hex(int(inp, 16)) + else: + inp = hex(int(inp)) + return str(inp) + except Exception as _: + return inp + + @staticmethod + def _num_of_objs_check(inp): + """This method check if the num of objects parameter is valid + """ + if inp in (['all', 'active']): + if inp == 'all': + inp = cs.NUM_OF_OBJ_ALL + else: + inp = cs.NUM_OF_OBJ_ACTIVE + return inp + else: + try: + if inp.startswith("0x"): + inp = int(inp, 16) + else: + inp = int(inp) + return inp + except Exception as _: + msg = "numOfObj accepts the following values: ['all', 'active', number]" + raise argparse.ArgumentTypeError(msg) + + @staticmethod + def _depth_check(inp): + """This method check if the num depth parameter is valid + """ + if inp == "inf": + return inp + else: + try: + inp = int(inp) + return inp + except Exception as _: + msg = "depth accepts the following values: ['inf', number]" + raise argparse.ArgumentTypeError(msg) + + def run(self): + # main parser + tool_name = os.path.basename(__file__.split('.')[0]) + parser = argparse.ArgumentParser(epilog="Use '{0} <command> -h' to read about a specific command.".format(tool_name)) + parser.add_argument('-v', '--version', action='version', help='Shows tool version', + version=tools_version.GetVersionString(cs.TOOL_NAME, None)) + + # commands sub parser + commands = parser.add_subparsers(title='commands') + + # dump sub parser + dump_parser = commands.add_parser(cs.RESOURCE_DUMP_COMMAND_TYPE_DUMP) + dump_parser.set_defaults(parser=cs.RESOURCE_DUMP_COMMAND_TYPE_DUMP) + + # required arguments by dump sub parser + dump_required_args = dump_parser.add_argument_group('required arguments') + dump_required_args.add_argument(cs.UI_DASHES + cs.UI_ARG_DEVICE, cs.UI_DASHES_SHORT + cs.UI_ARG_DEVICE_SHORT, + help='The device name', required=True) + dump_required_args.add_argument(cs.UI_DASHES + cs.UI_ARG_SEGMENT, help='The segment to dump', required=True, + type=self._decimal_hex_to_str_hex) + + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_VHCAID.replace("_", "-"), + help=argparse.SUPPRESS) # help='The virtual HCA (host channel adapter, NIC) ID') + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_INDEX1, + help='The first context index to dump (if supported for this segment)', + type=self._decimal_hex_check) + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_INDEX2, + help='The second context index to dump (if supported for this segment)', + type=self._decimal_hex_check) + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_NUMOFOBJ1.replace("_", "-"), + help='The number of objects to be dumped (if supported for this segment). accepts: ["all", "active", number, depends on the capabilities]', + type=self._num_of_objs_check) + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_NUMOFOBJ2.replace("_", "-"), + help='The number of objects to be dumped (if supported for this segment). accepts: ["all", "active", number, depends on the capabilities]', + type=self._num_of_objs_check) + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_DEPTH, + help='The depth of walking through reference segments. 0 stands for flat, ' + '1 allows crawling of a single layer down the struct, etc. "inf" for all', + type=self._depth_check) + dump_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_BIN, + help='The output to a binary file that replaces the default print in hexadecimal,' + ' a readable format') + + # query sub parser + query_parser = commands.add_parser(cs.RESOURCE_DUMP_COMMAND_TYPE_QUERY) + query_parser.set_defaults(parser=cs.RESOURCE_DUMP_COMMAND_TYPE_QUERY) + query_parser.add_argument(cs.UI_DASHES + cs.UI_ARG_VHCAID.replace("_", "-"), + help=argparse.SUPPRESS) # help='The virtual HCA (host channel adapter, NIC) ID') + + # required arguments by query sub parser + query_required_args = query_parser.add_argument_group('required arguments') + query_required_args.add_argument(cs.UI_DASHES + cs.UI_ARG_DEVICE, cs.UI_DASHES_SHORT + cs.UI_ARG_DEVICE_SHORT, + help='The device name', required=True) + + # args = parser.parse_args( + # 'dump -d test --source test2 --vHCAid 15 --index 1 --index2 2 --numOfObj1 10 --numOfObj2 20 + # --depth inf --bin tt.txt'.split()) + arguments = parser.parse_args() + return arguments + + +def create_command(arguments): + """This method creates the right command. + """ + try: + command_type = arguments.parser + created_command = CommandFactory.create(command_type, **vars(arguments)) + return created_command + except Exception as exp: + raise Exception("failed to create command of type: {0} with exception: {1}".format(command_type, exp)) + + +if __name__ == '__main__': + try: + args = MlxResDump().run() + command = create_command(args) + command.execute() + except Exception as e: + print("Error: {0}. Exiting...".format(e)) + sys.exit(1) diff --git a/resourcedump/resource_data/DataPrinter.py b/resourcedump/resource_data/DataPrinter.py new file mode 100755 index 0000000..0161997 --- /dev/null +++ b/resourcedump/resource_data/DataPrinter.py @@ -0,0 +1,62 @@ +####################################################### +# +# DataPrinter.py +# Python implementation of the Class DataPrinter +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:04 AM +# Original author: talve +# +####################################################### + + +class DataPrinter: + """this class is responsible for print the given segments to the right output. + """ + NUM_OF_DW_IN_ROW = 4 + + @classmethod + def print_query_data(cls, data): + """this method print the user menu from the menu segment data + """ + if data: + for record in data.get_printable_records(): + for el in record: + print(el) + + @classmethod + def print_dump_data(cls, data, file): + """the method gets a list of segments and arguments if print to bin file or output + to screen. + """ + if data: + if file: + DataPrinter._write_to_file(data, file) + else: + print("Found {0} segments:".format(len(data))) + for seg in data: + rows = 0 + print("-" * 43) + print("Segment Type: {}".format(seg.get_type())) + print("Segment Size: {} Bytes".format(len(seg.get_data())*4)) + print("Segment Data:") + for dw in seg.get_data(): + print('0x{0:0{1}X} '.format(dw, 8), end="") + rows += 1 + if rows == DataPrinter.NUM_OF_DW_IN_ROW: + print("") + rows = 0 + if 0 < rows < DataPrinter.NUM_OF_DW_IN_ROW: + print("") + print("-" * 43) + + @classmethod + def _write_to_file(cls, data, path): + with open(path, "wb") as binary_file: + for seg in data: + for dw in seg.get_data(): + four_bytes = dw.to_bytes(4, byteorder='big', signed=False) + binary_file.write(four_bytes) + + print("write to file: ", path) + + diff --git a/resourcedump/resource_data/DumpData.py b/resourcedump/resource_data/DumpData.py new file mode 100755 index 0000000..0940e46 --- /dev/null +++ b/resourcedump/resource_data/DumpData.py @@ -0,0 +1,43 @@ +####################################################### +# +# DumpData.py +# Python implementation of the Class DumpData +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:02 AM +# Original author: talve +# +####################################################### +from fetchers.ResourceDumpFetcher import ResourceDumpFetcher +from resource_data.QueryData import QueryData +from validation.ArgToMenuVerifier import ArgToMenuVerifier +from utils import constants as cs + + +class DumpData: + """this class is responsible for getting the dump segment. + """ + + @classmethod + def get_dump(cls, **kwargs): + """this method is getting the menu segment by using QueryData and verify it with + the user inputs using the ArgToMenuVerifier, if the verification pass, its uses + the core dump fetcher to fetch the core dump segments. + """ + dump_segments = None + + # get the query data + # need to call query data + res = QueryData.get_query(kwargs["device_name"], kwargs["vHCAid"]) + + # validate that the dump supported by calling ArgToMenuVerifier + rc = ArgToMenuVerifier.verify(res, **kwargs) + + # if args passes the verify + if rc: + # segment type can be name, this method will convert the name (if needed) to seg number in hex (str) + kwargs[cs.UI_ARG_SEGMENT] = res.get_segment_type_by_segment_name(kwargs[cs.UI_ARG_SEGMENT]) + dump_segments = ResourceDumpFetcher(kwargs["device_name"]).fetch_data(**kwargs) + else: + raise Exception("not supported or missing argument") + + return dump_segments diff --git a/resourcedump/resource_data/QueryData.py b/resourcedump/resource_data/QueryData.py new file mode 100755 index 0000000..9b7a083 --- /dev/null +++ b/resourcedump/resource_data/QueryData.py @@ -0,0 +1,35 @@ +####################################################### +# +# QueryData.py +# Python implementation of the Class QueryData +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:02 AM +# Original author: talve +# +####################################################### +from fetchers.ResourceDumpFetcher import ResourceDumpFetcher +from filters.SegmentsFilter import SegmentsFilter +from utils import constants + + +class QueryData: + """this class is responsible for getting the menu segment. + """ + + @classmethod + def get_query(cls, device_name, vhca_id): + """this method is getting the query segments by using the CoreDumpFetcher and + filter it by removing the none menu segments. + """ + try: + query_kwargs = {'segment': constants.RESOURCE_DUMP_SEGMENT_TYPE_MENU, + 'vHCAid': vhca_id, 'index1': 0, 'index2': 0, 'numOfObj1': 0, 'numOfObj2': 0, 'depth': 0} + query_segments = ResourceDumpFetcher(device_name).fetch_data(**query_kwargs) + res = SegmentsFilter.get_segments(query_segments, constants.RESOURCE_DUMP_SEGMENT_TYPE_MENU) + try: + menu = res[0] + except Exception as _: + raise Exception("Menu segment wasn't found after filtering by menu type") + return menu + except Exception as e: + raise Exception("Failed to fetch query data with exception: {0}".format(e)) diff --git a/resourcedump/resource_data/__init__.py b/resourcedump/resource_data/__init__.py new file mode 100755 index 0000000..d3f5a12 --- /dev/null +++ b/resourcedump/resource_data/__init__.py @@ -0,0 +1 @@ + diff --git a/resourcedump/segments/CommandSegment.py b/resourcedump/segments/CommandSegment.py new file mode 100755 index 0000000..c19f7c9 --- /dev/null +++ b/resourcedump/segments/CommandSegment.py @@ -0,0 +1,35 @@ +####################################################### +# +# CommandSegment.py +# Python implementation of the Class CommandSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants + + +class CommandSegment(Segment): + """this class is responsible for holding command segment data. + """ + + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + + def get_data(self): + """get the general segment data. + """ + return self.raw_data + + def get_type(self): + """get the general segment type. + """ + return constants.RESOURCE_DUMP_SEGMENT_TYPE_COMMAND + + +SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_COMMAND, CommandSegment) diff --git a/resourcedump/segments/ErrorSegment.py b/resourcedump/segments/ErrorSegment.py new file mode 100755 index 0000000..51c5585 --- /dev/null +++ b/resourcedump/segments/ErrorSegment.py @@ -0,0 +1,34 @@ +####################################################### +# +# ErrorSegment.py +# Python implementation of the Class ErrorSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants + + +class ErrorSegment(Segment): + """this class is responsible for holding error segment data. + """ + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + + def get_data(self): + """get the general segment data. + """ + return self.raw_data + + def get_type(self): + """get the general segment type. + """ + return constants.RESOURCE_DUMP_SEGMENT_TYPE_ERROR + + +SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_ERROR, ErrorSegment) diff --git a/resourcedump/segments/InfoSegment.py b/resourcedump/segments/InfoSegment.py new file mode 100755 index 0000000..29a6f29 --- /dev/null +++ b/resourcedump/segments/InfoSegment.py @@ -0,0 +1,35 @@ +####################################################### +# +# InfoSegment.py +# Python implementation of the Class InfoSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants + + +class InfoSegment(Segment): + """this class is responsible for holding info segment data. + """ + + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + + def get_data(self): + """get the general segment data. + """ + return self.raw_data + + def get_type(self): + """get the general segment type. + """ + return constants.RESOURCE_DUMP_SEGMENT_TYPE_INFO + + +SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_INFO, InfoSegment) diff --git a/resourcedump/segments/MenuRecord.py b/resourcedump/segments/MenuRecord.py new file mode 100755 index 0000000..354fe44 --- /dev/null +++ b/resourcedump/segments/MenuRecord.py @@ -0,0 +1,193 @@ +####################################################### +# +# MenuRecord.py +# Python implementation of the Class MenuRecord +# Original author: romany +# +####################################################### +import math +from utils import constants as cs + + +class MenuRecord: + """This class responsible for managing the records of the menu segment and adjust it for printing + a table for the user. + """ + def __init__(self, rec_data): + """initialize the class by set and parse the record data. + """ + self.segment_type = hex(int('{:0b}'.format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[16:32], 2)) + self.supports_index1 = int('{:0b}'.format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[15:16], 2) + self.must_have_index1 = int('{:0b}'.format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[14:15], 2) + self.supports_index2 = int('{:0b}'.format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[13:14], 2) + self.must_have_index2 = int('{:0b}'.format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[12:13], 2) + self.supports_num_of_obj1 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[11:12], 2) + self.must_have_num_of_obj1 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[10:11], 2) + self.supports_all_num_of_obj1 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[9:10], 2) + self.supports_active_num_of_obj1 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[8:9], 2) + self.supports_num_of_obj2 = int('{:0b}'.format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[7:8], 2) + self.must_have_num_of_obj2 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[6:7], 2) + self.supports_all_num_of_obj2 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[5:6], 2) + self.supports_active_num_of_obj2 = int('{:0b}'. + format(rec_data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[4:5], 2) + self.segment_name = rec_data[cs.MENU_SEGMENT_SEGMENT_NAME_DWORD_LOCATION_START:cs. + MENU_SEGMENT_SEGMENT_NAME_DWORD_LOCATION_END] + self.segment_index1_name = rec_data[cs.MENU_SEGMENT_INDEX_NAME_1_DWORD_LOCATION_START:cs. + MENU_SEGMENT_INDEX_NAME_1_DWORD_LOCATION_END] + self.segment_index2_name = rec_data[cs.MENU_SEGMENT_INDEX_NAME_2_DWORD_LOCATION_START:cs. + MENU_SEGMENT_INDEX_NAME_2_DWORD_LOCATION_END] + + # Down goes the code that represents the Menu Record in a pretty table format: + # EXAMPLE + # __________________________________________________________________ + # + # Segment Type - 0x1002 (RCV_BUFF) + # + # Dump Params Applicability Special Values + # -------------------------------- -------------- -------------- + # index1 (QPN) Mandatory N/A + # numOfObj1 N/A N/A + # index2 (DS) Optional N/A + # numOfObj2 Optional All + # __________________________________________________________________ + + @staticmethod + def _make_separating_line(new_line=False): + """This method creates a string that the separation line ('____')""" + line = cs.MENU_SEGMENT_TABLE_LINE_LEN * cs.MENU_SEGMENT_TABLE_WRAP + if new_line: + line += "\n" + return line + + def _make_segment_type_line(self): + """This method creates a string that represent segment type line to be printed""" + line = cs.MENU_SEGMENT_TABLE_SEGMENT_TYPE + self.segment_type + " ({0})".format(self.bin_list_to_ascii + (self.segment_name)) + "\n" + padding = 0 + if len(line) < cs.MENU_SEGMENT_TABLE_LINE_LEN: + padding = cs.MENU_SEGMENT_TABLE_LINE_LEN - len(line) + line = " " * math.ceil((padding / 2)) + line + " " * round((padding / 2)) + return line + + @staticmethod + def _make_table_header_line(): + """This method creates a string that represent the header in the table""" + padding = cs.MENU_SEGMENT_TABLE_DUMP_PARAMS_LEN - len( + cs.MENU_SEGMENT_TABLE_DUMP_PARAMS) + cs.MENU_SEGMENT_TABLE_GAP + line = cs.MENU_SEGMENT_TABLE_DUMP_PARAMS + " " * padding + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len( + cs.MENU_SEGMENT_TABLE_APPLICABILITY) + cs.MENU_SEGMENT_TABLE_GAP + line += cs.MENU_SEGMENT_TABLE_APPLICABILITY + " " * padding + padding = cs.MENU_SEGMENT_TABLE_SPECIAL_VALUES_LEN - len(cs.MENU_SEGMENT_TABLE_SPECIAL_VALUES) + line += cs.MENU_SEGMENT_TABLE_SPECIAL_VALUES + " " * padding + return line + + @staticmethod + def _make_dashes_line(): + """This method creates a string that represent split line ('------') for the table""" + line = cs.MENU_SEGMENT_TABLE_DASH * cs.MENU_SEGMENT_TABLE_DUMP_PARAMS_LEN + padding = cs.MENU_SEGMENT_TABLE_GAP + line += " " * padding + line += cs.MENU_SEGMENT_TABLE_DASH * cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN + line += " " * padding + line += cs.MENU_SEGMENT_TABLE_DASH * cs.MENU_SEGMENT_TABLE_SPECIAL_VALUES_LEN + return line + + def _make_index_line(self, index_name, supports, must, table_index_line): + """This method creates a string that represent indexX line to be printed""" + line = table_index_line + " ({0})".format(self.bin_list_to_ascii(index_name)) + padding = cs.MENU_SEGMENT_TABLE_DUMP_PARAMS_LEN - len(line) + cs.MENU_SEGMENT_TABLE_GAP + line += " " * padding + + if not supports: + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len(cs.MENU_SEGMENT_TABLE_NA) + applicability = cs.MENU_SEGMENT_TABLE_NA + else: + if must: + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len(cs.MENU_SEGMENT_TABLE_MANDATORY) + applicability = cs.MENU_SEGMENT_TABLE_MANDATORY + else: + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len(cs.MENU_SEGMENT_TABLE_OPTIONAL) + applicability = cs.MENU_SEGMENT_TABLE_OPTIONAL + + applicability = applicability + " " * math.ceil(padding) + line += applicability + + padding = cs.MENU_SEGMENT_TABLE_SPECIAL_VALUES_LEN - len(cs.MENU_SEGMENT_TABLE_NA) + special_values = cs.MENU_SEGMENT_TABLE_NA + " " * math.ceil(padding / 2) + line += " " * cs.MENU_SEGMENT_TABLE_GAP + line += special_values + return line + + @staticmethod + def _make_num_of_objs_line(supports, must, table_objs_line, al, active): + """This method creates a string that represent numOfObjsX line to be printed""" + line = table_objs_line + padding = cs.MENU_SEGMENT_TABLE_DUMP_PARAMS_LEN - len(line) + cs.MENU_SEGMENT_TABLE_GAP + line += " " * padding + + if not supports: + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len(cs.MENU_SEGMENT_TABLE_NA) + applicability = cs.MENU_SEGMENT_TABLE_NA + else: + if must: + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len(cs.MENU_SEGMENT_TABLE_MANDATORY) + applicability = cs.MENU_SEGMENT_TABLE_MANDATORY + else: + padding = cs.MENU_SEGMENT_TABLE_APPLICABILITY_LEN - len(cs.MENU_SEGMENT_TABLE_OPTIONAL) + applicability = cs.MENU_SEGMENT_TABLE_OPTIONAL + + applicability = applicability + " " * math.ceil(padding) + line += applicability + + special_values = "" + if al: + special_values = cs.MENU_SEGMENT_TABLE_ALL + if active: + if special_values: + special_values += cs.MENU_SEGMENT_TABLE_AND + special_values += cs.MENU_SEGMENT_TABLE_ACTIVE + if not special_values: + special_values = cs.MENU_SEGMENT_TABLE_NA + padding = cs.MENU_SEGMENT_TABLE_SPECIAL_VALUES_LEN - len(special_values) + + special_values = special_values + " " * math.ceil(padding / 2) + line += " " * cs.MENU_SEGMENT_TABLE_GAP + line += special_values + return line + + def convert_record_obj_to_printable_list(self): + """This method creates a list of formatted strings that represents the record object """ + printable = [] + printable.append(self._make_separating_line(new_line=True)) + printable.append(self._make_segment_type_line()) + printable.append(self._make_table_header_line()) + printable.append(self._make_dashes_line()) + printable.append(self._make_index_line(self.segment_index1_name, self.supports_index1, self.must_have_index1, + cs.MENU_SEGMENT_TABLE_INDEX1)) + printable.append(self._make_num_of_objs_line(self.supports_num_of_obj1, self.must_have_num_of_obj1, + cs.MENU_SEGMENT_TABLE_NUM_OF_OBJS1, self.supports_all_num_of_obj1, + self.supports_active_num_of_obj1)) + printable.append(self._make_index_line(self.segment_index2_name, self.supports_index2, + self.must_have_index2, cs.MENU_SEGMENT_TABLE_INDEX2)) + printable.append(self._make_num_of_objs_line(self.supports_num_of_obj2, self.must_have_num_of_obj2, + cs.MENU_SEGMENT_TABLE_NUM_OF_OBJS2, self.supports_all_num_of_obj2, + self.supports_active_num_of_obj2)) + printable.append(self._make_separating_line()) + return printable + + @staticmethod + def bin_list_to_ascii(lst): + """This method converts list of values to ASCII characters (human readable)""" + res = "" + for el in lst: + bin_data = '{:0b}'.format(el).zfill(32).rstrip('\x00') + for i in range(4): + res += str(chr(int(bin_data[i * 8: (i + 1) * 8], 2))).rstrip('\x00') + return res diff --git a/resourcedump/segments/MenuSegment.py b/resourcedump/segments/MenuSegment.py new file mode 100755 index 0000000..d1202de --- /dev/null +++ b/resourcedump/segments/MenuSegment.py @@ -0,0 +1,147 @@ +####################################################### +# +# MenuSegment.py +# Python implementation of the Class MenuSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.MenuRecord import MenuRecord +from segments.SegmentFactory import SegmentFactory +from utils import constants as cs +from utils.Exceptions import DumpNotSupported + + +class MenuSegment(Segment): + """This class is responsible for holding menu segment data. + """ + RECORD_BITS_SIZE = 416 + RECORD_DWORDS_SIZE = 13 + + def __init__(self, data): + """Initialize the class by setting the class data. + """ + self.raw_data = data + self.type = cs.RESOURCE_DUMP_SEGMENT_TYPE_MENU + self.size = '{:0b}'.format(data[cs.SEGMENT_SIZE_DWORD_LOCATION]).zfill(32)[cs.SEGMENT_SIZE_START: cs. + SEGMENT_SIZE_END] + self.num_of_records = int('{:0b}'.format(data[cs.MENU_SEGMENT_NUM_OF_RECORDS_DWORD_LOCATION] + ).zfill(32)[cs.MENU_SEGMENT_NUM_OF_RECORDS_START: cs. + MENU_SEGMENT_NUM_OF_RECORDS_END], 2) + self.records = [] + for i in range(self.num_of_records): + rec = MenuRecord(data[(2 + i * self.RECORD_DWORDS_SIZE): (2 + (i + 1) * self.RECORD_DWORDS_SIZE)]) + self.records.append(rec) + + def get_records(self): + """get all the menu segment records. + """ + return self.records + + def get_printable_records(self): + """get all the menu segment records in a printable format. + """ + recs = [] + for rec in self.records: + recs.append(rec.convert_record_obj_to_printable_list()) + return recs + + def get_data(self): + """get the menu segment data. + """ + return self.raw_data + + def get_type(self): + """get the menu segment type. + """ + return cs.RESOURCE_DUMP_SEGMENT_TYPE_MENU + + def get_segment_type_by_segment_name(self, segment_type): + """get the menu segment type by a given segment name. + if not found, method will return the given segment type + """ + for rec in self.records: + if MenuRecord.bin_list_to_ascii(rec.segment_name) == segment_type: + segment_type = str(hex(int(rec.segment_type, 16))) + break + return segment_type + + def is_supported(self, **kwargs): + """check if the arguments matches with the menu data. + """ + dump_type = kwargs["segment"] + index1 = kwargs["index1"] + index2 = kwargs["index2"] + num_of_objs_1 = kwargs["numOfObj1"] + num_of_objs_2 = kwargs["numOfObj2"] + match_rec = None + + # Check whether dump type supported + try: + for rec in self.records: + if rec.segment_type == dump_type or MenuRecord.bin_list_to_ascii(rec.segment_name) == dump_type: + match_rec = rec + break + + if not match_rec: + raise DumpNotSupported("Dump type: {0} is not supported".format(dump_type)) + + # Check index1 attribute + if not index1 and index1 is not 0 and match_rec.must_have_index1: + raise DumpNotSupported( + "Dump type: {0} must have index1 attribute, and it wasn't provided".format(dump_type)) + + if not index2 and index2 is not 0 and match_rec.must_have_index2: + raise DumpNotSupported( + "Dump type: {0} must have index2 attribute, and it wasn't provided".format(dump_type)) + + if index1 and not match_rec.supports_index1: + raise DumpNotSupported( + "Dump type: {0} does not support index1 attribute, and it was provided".format(dump_type)) + + if index2 and not match_rec.supports_index2: + raise DumpNotSupported( + "Dump type: {0} does not support index2 attribute, and it was provided".format(dump_type)) + + if not num_of_objs_1 and match_rec.must_have_num_of_obj1: + raise DumpNotSupported( + "Dump type: {0} must have numOfObj1 attribute, and it wasn't provided".format(dump_type)) + + if not num_of_objs_2 and match_rec.must_have_num_of_obj2: + raise DumpNotSupported( + "Dump type: {0} must have numOfObj2 attribute, and it wasn't provided".format(dump_type)) + + if num_of_objs_1 is not None and not match_rec.supports_num_of_obj1: + raise DumpNotSupported( + "Dump type: {0} does not support numOfObj1 attribute, and it was provided".format(dump_type)) + + if num_of_objs_2 is not None and not match_rec.supports_num_of_obj2: + raise DumpNotSupported( + "Dump type: {0} does not support numOfObj2 attribute, and it was provided".format(dump_type)) + + if num_of_objs_1 == "all" and not match_rec.supports_all_num_of_obj1: + raise DumpNotSupported( + "Dump type: {0} does not support 'all' as numOfObj1 attribute".format(dump_type)) + + if num_of_objs_2 == "all" and not match_rec.supports_all_num_of_obj2: + raise DumpNotSupported( + "Dump type: {0} does not support 'all' as numOfObj2 attribute".format(dump_type)) + + if num_of_objs_1 == "active" and not match_rec.supports_active_num_of_obj1: + raise DumpNotSupported( + "Dump type: {0} does not support 'active' as numOfObj1 attribute".format(dump_type)) + + if num_of_objs_2 == "active" and not match_rec.supports_active_num_of_obj2: + raise DumpNotSupported( + "Dump type: {0} does not support 'active' as numOfObj2 attribute".format(dump_type)) + + except DumpNotSupported as e: + print(e) + return False + + return True + + +SegmentFactory.register(cs.RESOURCE_DUMP_SEGMENT_TYPE_MENU, MenuSegment) diff --git a/resourcedump/segments/NoticeSegment.py b/resourcedump/segments/NoticeSegment.py new file mode 100755 index 0000000..1544330 --- /dev/null +++ b/resourcedump/segments/NoticeSegment.py @@ -0,0 +1,34 @@ +####################################################### +# +# NoticeSegment.py +# Python implementation of the Class NoticeSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants + + +class NoticeSegment(Segment): + """this class is responsible for holding Notice segment data. + """ + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + + def get_data(self): + """get the general segment data. + """ + return self.raw_data + + def get_type(self): + """get the general segment type. + """ + return constants.RESOURCE_DUMP_SEGMENT_TYPE_NOTICE + + +SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_NOTICE, NoticeSegment) diff --git a/resourcedump/segments/RefSegment.py b/resourcedump/segments/RefSegment.py new file mode 100755 index 0000000..ce488f9 --- /dev/null +++ b/resourcedump/segments/RefSegment.py @@ -0,0 +1,41 @@ +####################################################### +# +# RefSegment.py +# Python implementation of the Class RefSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:58 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants as cs + + +class RefSegment(Segment): + """this class is responsible for holding reference segment data. + """ + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + self.type = hex(int('{:0b}'.format(data[cs.MENU_SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[16:32], 2)) + self.size = int('{:0b}'.format(data[0]).zfill(32)[0:16], 2) + self.reference_type = hex(int('{:0b}'.format(data[1]).zfill(32)[16:32], 2)) + self.index1 = int('{:0b}'.format(data[2]).zfill(32)[0:32], 2) + self.index2 = int('{:0b}'.format(data[3]).zfill(32)[0:32], 2) + self.num_of_obj1 = int('{:0b}'.format(data[4]).zfill(32)[0:16], 2) + self.num_of_obj2 = int('{:0b}'.format(data[4]).zfill(32)[16:32], 2) + + def get_data(self): + """get the reference segment data. + """ + return self.raw_data + + def get_type(self): + """get the reference segment type. + """ + return cs.RESOURCE_DUMP_SEGMENT_TYPE_REFERENCE + + +SegmentFactory.register(cs.RESOURCE_DUMP_SEGMENT_TYPE_REFERENCE, RefSegment) diff --git a/resourcedump/segments/ResourceSegment.py b/resourcedump/segments/ResourceSegment.py new file mode 100755 index 0000000..def2bb5 --- /dev/null +++ b/resourcedump/segments/ResourceSegment.py @@ -0,0 +1,35 @@ +####################################################### +# +# ResourceSegment.py +# Python implementation of the Class ResourceSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants + + +class ResourceSegment(Segment): + """this class is responsible for holding Resource segment data. + """ + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + self.resource_type = constants.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE + + def get_data(self): + """get the general segment data. + """ + return self.raw_data + + def get_type(self): + """get the general segment type. + """ + return self.resource_type + + +SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE, ResourceSegment) diff --git a/resourcedump/segments/Segment.py b/resourcedump/segments/Segment.py new file mode 100755 index 0000000..57ef6c7 --- /dev/null +++ b/resourcedump/segments/Segment.py @@ -0,0 +1,34 @@ +####################################################### +# +# Segment.py +# Python implementation of the Class Segment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from abc import ABC, abstractmethod + + +class Segment(ABC): + """this class is responsible for holding segment data according to its type. + """ + def __init__(self): + """initialize the class by setting the class data. + """ + self.size = 0 + + def get_size(self): + return self.size + + @abstractmethod + def get_data(self): + """get the segment data. + """ + pass + + @abstractmethod + def get_type(self): + """get the segment type. + """ + pass diff --git a/resourcedump/segments/SegmentCreator.py b/resourcedump/segments/SegmentCreator.py new file mode 100755 index 0000000..ca293c8 --- /dev/null +++ b/resourcedump/segments/SegmentCreator.py @@ -0,0 +1,72 @@ +####################################################### +# +# SegmentCreator.py +# Python implementation of the Class SegmentCreator +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:03 AM +# Original author: talve +# +####################################################### +from segments.SegmentFactory import SegmentFactory +from utils import constants as cs + + +class SegmentCreator: + """this class is responsible for splitting the raw data to segments and creating + segments objects. + """ + def create(self, raw_data): + """convert segments data into a segments objects by using SegmentFactory. + """ + try: + segments = [] + raw_data_segments_lst = self._parse_segments(raw_data) + for raw_seg in raw_data_segments_lst: + seg_type = '{:0b}'.format(raw_seg[cs.SEGMENT_TYPE_DWORD_LOCATION]).zfill(32)[cs.SEGMENT_TYPE_START: cs. + SEGMENT_TYPE_END] + seg_type = hex(int(seg_type, 2)) + seg_type_for_create = SegmentCreator.get_seg_type_for_register_segments(seg_type) + seg = SegmentFactory.create(seg_type_for_create, raw_seg) + seg.resource_type = seg_type + segments.append(seg) + except Exception as e: + raise Exception("Failed to create segments with error: {0}".format(e)) + return segments + + def _parse_segments(self, raw_data): + """splitting the raw data into segments + raw data is represented as a list of dword's + """ + splitted_segments = [] + try: + while raw_data: + raw_data_len = len(raw_data) + # seg size specified in dwords + seg_size = '{:0b}'.format(raw_data[cs.SEGMENT_SIZE_DWORD_LOCATION]).zfill(32)[cs.SEGMENT_SIZE_START: cs. + SEGMENT_SIZE_END] + seg_size = int(seg_size, 2) + seg_data = raw_data[:seg_size] + splitted_segments.append(seg_data) + raw_data = raw_data[seg_size:] + if len(raw_data) == raw_data_len: + raise Exception("Error in segments parsing. raw_data didn't get smaller") + + except Exception as e: + raise Exception("Failed to split segments with error: {0}".format(e)) + + return splitted_segments + + @classmethod + def is_resource_segment(cls, seg_type): + """This method check if the segment type is a inside the interval of a resource segment + """ + return cs.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE_MAX >= seg_type >= cs.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE_MIN + + @classmethod + def get_seg_type_for_register_segments(cls, seg_type): + """This method check if the segment type is a reference segment + and return the right type of that segment. + """ + if cls.is_resource_segment(seg_type): + return cs.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE + return seg_type diff --git a/resourcedump/segments/SegmentFactory.py b/resourcedump/segments/SegmentFactory.py new file mode 100755 index 0000000..e9725cc --- /dev/null +++ b/resourcedump/segments/SegmentFactory.py @@ -0,0 +1,30 @@ +####################################################### +# +# SegmentFactory.py +# Python implementation of the Class SegmentFactory +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:59 AM +# Original author: talve +# +####################################################### + + +class SegmentFactory: + """This class is responsible for creating and registering the segments. + """ + segments = {} + + @classmethod + def register(cls, segment_type, obj): + """This method should be use from the specific segment in order to perform the + segment registration. + """ + cls.segments.update({segment_type: obj}) + + @classmethod + def create(cls, segment_type, *args): + """create the segment and return the segment obj. + """ + if segment_type not in cls.segments: + raise Exception("segment type:{0} is not supported".format(segment_type)) + return cls.segments[segment_type](*args) diff --git a/resourcedump/segments/TerminateSegment.py b/resourcedump/segments/TerminateSegment.py new file mode 100755 index 0000000..d726496 --- /dev/null +++ b/resourcedump/segments/TerminateSegment.py @@ -0,0 +1,34 @@ +####################################################### +# +# TerminateSegment.py +# Python implementation of the Class TerminateSegment +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:11:57 AM +# Original author: talve +# +####################################################### +from segments.Segment import Segment +from segments.SegmentFactory import SegmentFactory +from utils import constants + + +class TerminateSegment(Segment): + """this class is responsible for holding Terminate segment data. + """ + def __init__(self, data): + """initialize the class by setting the class data. + """ + self.raw_data = data + + def get_data(self): + """get the general segment data. + """ + return self.raw_data + + def get_type(self): + """get the general segment type. + """ + return constants.RESOURCE_DUMP_SEGMENT_TYPE_TERMINATE + + +SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_TERMINATE, TerminateSegment) diff --git a/resourcedump/segments/__init__.py b/resourcedump/segments/__init__.py new file mode 100755 index 0000000..ed87b58 --- /dev/null +++ b/resourcedump/segments/__init__.py @@ -0,0 +1 @@ +from segments import MenuSegment, RefSegment, NoticeSegment, ResourceSegment, TerminateSegment, ErrorSegment, InfoSegment, CommandSegment diff --git a/resourcedump/utils/Exceptions.py b/resourcedump/utils/Exceptions.py new file mode 100755 index 0000000..9cf5e25 --- /dev/null +++ b/resourcedump/utils/Exceptions.py @@ -0,0 +1,13 @@ +####################################################### +# +# Exceptions.py +# Python implementation of the Class Exceptions +# Created on: 14-Aug-2019 10:12:03 AM +# Original author: romany +# +####################################################### + + +class DumpNotSupported(Exception): + """Base class for other exceptions""" + pass diff --git a/resourcedump/utils/constants.py b/resourcedump/utils/constants.py new file mode 100755 index 0000000..4a22ad4 --- /dev/null +++ b/resourcedump/utils/constants.py @@ -0,0 +1,84 @@ +####################################################### +# +# constants.py +# Python implementation of resource dump constants +# This file will supply all the constants needed +# for the resource dump tool +# Original author: romany +# +####################################################### + +TOOL_NAME = "ResourceDump" +RESOURCE_DUMP_COMMAND_TYPE_QUERY = "query" +RESOURCE_DUMP_COMMAND_TYPE_DUMP = "dump" + +RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE = "0xffffffff" +RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE_MIN = "0x0000" +RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE_MAX = "0xfeff" +RESOURCE_DUMP_SEGMENT_TYPE_NOTICE = "0xfff9" +RESOURCE_DUMP_SEGMENT_TYPE_COMMAND = "0xfffa" +RESOURCE_DUMP_SEGMENT_TYPE_TERMINATE = "0xfffb" +RESOURCE_DUMP_SEGMENT_TYPE_ERROR = "0xfffc" +RESOURCE_DUMP_SEGMENT_TYPE_INFO = "0xfffe" +RESOURCE_DUMP_SEGMENT_TYPE_MENU = "0xffff" +RESOURCE_DUMP_SEGMENT_TYPE_REFERENCE = "0xfffd" + + +UI_DASHES = "--" +UI_DASHES_SHORT = "-" +UI_ARG_DEVICE = "device" +UI_ARG_DEVICE_SHORT = "d" +UI_ARG_SEGMENT = "segment" +UI_ARG_VHCAID = "virtual_hca_id" +UI_ARG_INDEX1 = "index1" +UI_ARG_INDEX2 = "index2" +UI_ARG_NUMOFOBJ1 = "num_of_obj1" +UI_ARG_NUMOFOBJ2 = "num_of_obj2" +UI_ARG_DEPTH = "depth" +UI_ARG_BIN = "bin" + +# segment start/end specify where the 'type' attr starts and ends in the raw_data of each segment. +# should be 0-16 bits +SEGMENT_TYPE_DWORD_LOCATION = 0 +SEGMENT_SIZE_DWORD_LOCATION = 0 +SEGMENT_TYPE_START = 16 +SEGMENT_TYPE_END = 32 +SEGMENT_SIZE_START = 0 +SEGMENT_SIZE_END = 16 +MENU_SEGMENT_NUM_OF_RECORDS_DWORD_LOCATION = 1 +MENU_SEGMENT_NUM_OF_RECORDS_START = 16 +MENU_SEGMENT_NUM_OF_RECORDS_END = 32 + +MENU_SEGMENT_TYPE_DWORD_LOCATION = 0 +MENU_SEGMENT_DWORD_SUPPORT_ATTRS_LOCATION = 0 +MENU_SEGMENT_SEGMENT_NAME_DWORD_LOCATION_START = 1 +MENU_SEGMENT_SEGMENT_NAME_DWORD_LOCATION_END = 5 +MENU_SEGMENT_INDEX_NAME_1_DWORD_LOCATION_START = 5 +MENU_SEGMENT_INDEX_NAME_1_DWORD_LOCATION_END = 9 +MENU_SEGMENT_INDEX_NAME_2_DWORD_LOCATION_START = 9 +MENU_SEGMENT_INDEX_NAME_2_DWORD_LOCATION_END = 13 + +NUM_OF_OBJ_ALL = 65535 +NUM_OF_OBJ_ACTIVE = 65534 + +MENU_SEGMENT_TABLE_SEGMENT_TYPE = "Segment Type - " +MENU_SEGMENT_TABLE_DUMP_PARAMS = "Dump Params" +MENU_SEGMENT_TABLE_APPLICABILITY = "Applicability" +MENU_SEGMENT_TABLE_SPECIAL_VALUES = "Special Values" +MENU_SEGMENT_TABLE_MANDATORY = "Mandatory" +MENU_SEGMENT_TABLE_OPTIONAL = "Optional" +MENU_SEGMENT_TABLE_INDEX1 = UI_ARG_INDEX1 +MENU_SEGMENT_TABLE_INDEX2 = UI_ARG_INDEX2 +MENU_SEGMENT_TABLE_NUM_OF_OBJS1 = UI_ARG_NUMOFOBJ1 +MENU_SEGMENT_TABLE_NUM_OF_OBJS2 = UI_ARG_NUMOFOBJ2 +MENU_SEGMENT_TABLE_ALL = "All" +MENU_SEGMENT_TABLE_ACTIVE = "Active" +MENU_SEGMENT_TABLE_LINE_LEN = 66 +MENU_SEGMENT_TABLE_DUMP_PARAMS_LEN = 32 +MENU_SEGMENT_TABLE_APPLICABILITY_LEN = 14 +MENU_SEGMENT_TABLE_SPECIAL_VALUES_LEN = 14 +MENU_SEGMENT_TABLE_GAP = 3 +MENU_SEGMENT_TABLE_NA = "N/A" +MENU_SEGMENT_TABLE_DASH = "-" +MENU_SEGMENT_TABLE_AND = "," +MENU_SEGMENT_TABLE_WRAP = "_" diff --git a/resourcedump/validation/ArgToMenuVerifier.py b/resourcedump/validation/ArgToMenuVerifier.py new file mode 100755 index 0000000..3a760e5 --- /dev/null +++ b/resourcedump/validation/ArgToMenuVerifier.py @@ -0,0 +1,21 @@ +####################################################### +# +# ArgToMenuVerifier.py +# Python implementation of the Class ArgToMenuVerifier +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:03 AM +# Original author: talve +# +####################################################### + + +class ArgToMenuVerifier: + """this class is responsible for verify that user input is legit by matching it + with the menu segment. + """ + @classmethod + def verify(cls, menu_segment, **kwargs): + """the method verifies that the user input is legit by matching it with the menu + segment by calling MenuSegment.is_supported(...). + """ + return menu_segment.is_supported(**kwargs) diff --git a/resourcedump/validation/CapabilityValidator.py b/resourcedump/validation/CapabilityValidator.py new file mode 100755 index 0000000..706518a --- /dev/null +++ b/resourcedump/validation/CapabilityValidator.py @@ -0,0 +1,34 @@ +####################################################### +# +# CapabilityValidator.py +# Python implementation of the Class CapabilityValidator +# Generated by Enterprise Architect +# Created on: 14-Aug-2019 10:12:01 AM +# Original author: talve +# +####################################################### +from fetchers.CapabilityFetcher import CapabilityFetcher + + +class CapabilityValidator: + """this class is responsible for validating the capability of the core dump + register. + """ + CAP_BIT_VALUE = 0x0200000 + + @classmethod + def _fetch_cap(cls): + """fetch the core dump capability bit by calling the CapabilityFetcher. + """ + return CapabilityFetcher.fetch() + + @classmethod + def validate(cls): + """validate if core dump register is supported by checking the capability. + """ + capability_value = cls._fetch_cap() + + if (capability_value & cls.CAP_BIT_VALUE) > 0: + return True + + return False diff --git a/resourcedump/validation/__init__.py b/resourcedump/validation/__init__.py new file mode 100755 index 0000000..d3f5a12 --- /dev/null +++ b/resourcedump/validation/__init__.py @@ -0,0 +1 @@ + diff --git a/small_utils/mstfwreset.py b/small_utils/mstfwreset.py index f653d06..9a07078 100755 --- a/small_utils/mstfwreset.py +++ b/small_utils/mstfwreset.py @@ -239,7 +239,7 @@ def reset_fsm_register(): def sigHndl(signal, frame): reset_fsm_register() - print("\nSignal %d Recieved, Exiting..." % signal) + print("\nSignal %d received, exiting..." % signal) sys.exit(1) def set_signal_handler(): @@ -277,7 +277,7 @@ def printAndFlush(str, endChar='\n'): sys.stdout.flush() ###################################################################### -# Description: ask user Y/N question if N/n/No/no was recieved raise +# Description: ask user Y/N question if N/n/No/no was received raise # RuntimeError. # OS Support : Linux/Windows. ###################################################################### @@ -704,7 +704,7 @@ class MlnxPciOpLinux(MlnxPciOp): def waitForDevice(self,devAddr): logger.info('waitForDevice() called. Input is {0}'.format(devAddr)) path = '/sys/bus/pci/devices/{0}/config'.format(devAddr) - TIMEOUT = 10 + TIMEOUT = 100 for _ in range(TIMEOUT): if os.path.exists(path): return diff --git a/tools_layouts/adb/prm/hca/ext/register_access_table.adb b/tools_layouts/adb/prm/hca/ext/register_access_table.adb index 3baa7b0..3db028d 100644 --- a/tools_layouts/adb/prm/hca/ext/register_access_table.adb +++ b/tools_layouts/adb/prm/hca/ext/register_access_table.adb @@ -35,7 +35,7 @@ <config field_attr="capability" type="ascii" /> <config field_attr="target" type="ascii" /> <config field_attr="version" type="ascii" /> -<info source_doc_name="Mellanox <Doc Name>" source_doc_version="Rev 0.50" /> +<info source_doc_name="Mellanox <Doc Name>" source_doc_version="Rev 0.51" /> <node name="IB_portcntrs_attribute_grp_data_ext" descr="" size="0xf8.0" > <field name="link_downed_counter" descr="For counter description please refer to the InfiniBand specification" access="RO" offset="0x0.0" size="0x0.8" /> <field name="link_error_recovery_counter" descr="For counter description please refer to the InfiniBand specification" access="RO" offset="0x0.8" size="0x0.8" /> @@ -57,7 +57,7 @@ </node> <node name="access_reg_summary_ctrl_ext" descr="" attr_is_union="1" size="0x4.0" > - <field name="id" descr="" subnode="enum_entry" enum="DCBX_PARAM=0x4020,DCBX_APPLICATION=0x4021,QCAP=0x4001,QPTS=0x4002,QDPM=0x4003,QPDPM=0x4013,QEPM=0x4014,QPCR=0x4004,QPBR=0x400c,QETCR=0x4005,QEGCS=0x4006,QEEC=0x400d,QPDP=0x4007,QPDPC=0x4017,QPRT=0x4008,QSPTC=0x4009,QTCT=0x400a,QTCTM=0x401a,QSTCT=0x400b,QSPIP=0x400e,QSPCP=0x401e,QRWE=0x400f,QPEM=0x4010,QPDSM=0x4011,QPPM=0x4012,QSLL=0x4015,QHLL=0x4016,QCAM=0x4019,ROCE_ACCL=0x402c,PCAM=0x507f,PCAP=0x5001,PMLP=0x5002,PMTU=0x5003,PTYS=0x5004,PPAD=0x5005,PAOS=0x5006,PPAOS=0x5040,PMAOS=0x5012,PFCC=0x5007,PPCNT=0x5008,PMMP=0x5044,PMCR=0x5045,PPTB=0x500b,PBMC=0x500c,PVLC=0x500f,PPLR=0x5018,PPLM=0x5023,SLTP=0x5027,SLRG=0x5028,PPTT=0x5036,PPRT=0x5037,PCMR=0x5041,PDDR=0x5031,PTER=0x5055,SET_NODE=0x6001,POWER_SETTINGS=0x7001,HOST_ENDIANNESS=0x7004,MFCR=0x9001,MFSC=0x9002,MFSM=0x9003,MFSL=0x9004,FORE=0x9007,MFNR=0x903b,MTCAP=0x9009,MTECR=0x9109,MTMP=0x900a,MTWE=0x900b,MTEWE=0x910b,MVCAP=0x902e,MVCR=0x900c,MSPS=0x900d,MCPP=0x900e,MTBR=0x900f,MFPA=0x9010,MFBA=0x9011,MFBE=0x9012,MFMC=0x9013,MCIA=0x9014,MCION=0x9052,MMIA=0x9016,MPGR=0x9019,MFM=0x901d,MHSR=0x901e,MJTAG=0x901f,MSGI=0x9021,MSCI=0x902a,MPCIR=0x905a,MRTC=0x902d,MGIR=0x9020,MGPIR=0x9100,MHMPR=0x905d,MPFM=0x9022,MRSR=0x9023,MPGO=0x9052,MNVDA=0x9024,MNVDI=0x9025,MNVQC=0x9030,MNVIA=0x9033,MNVGC=0x9034,MNVGN=0x9035,MGNLE=0x9036,MTRC_CAP=0x9040,MTRC_CONF=0x9041,MTRC_STDB=0x9042,MTRC_CTRL=0x9043,MLCR=0x902b,MGCR=0x903a,MERR=0x903c,MPEIN=0x9050,MPCNT=0x9051,MPIR=0x9059,MPECS=0x905b,MCQS=0x9060,MCQI=0x9061,MCC=0x9062,MCDA=0x9063,MQIS=0x9064,MIRC=0x9162,MCDD=0x905c,MDFCR=0x9101,MDRCR=0x9102,MFRL=0x9028,CWGCR=0x2801,CWTP=0x2802,CWPP=0x2804,CWTPM=0x2803,CPQE=0x2806,CHLTR=0x2810,CHLTM=0x2811,CHLMM=0x2812,CNCT=0x2030,CPCS=0x2031,CPID=0x2032,CNMC=0x2033,CWCAM=0x281f,SBGCR=0xb000,SBPR=0xb001,SBCM=0xb002,SBPM=0xb003,SBMM=0xb004,SBME=0xb00e,SBSR=0xb005,SBIB=0xb006,SBDCC=0xb007,SBDCM=0xb008,SBDCR=0xb019,SBHBR=0xb00a,SBHRR=0xb00b,SBHBR_V2=0xb011,SBHRR_V2=0xb012,SBCTC=0xb00c,SBCTR=0xb00d,SBCTS=0xb00f,SBSNT=0xb020,SBSNS=0xb021,SBSNTE=0xb022,SBCAM=0xb01f" offset="0x0.0" size="0x4.0" /> + <field name="id" descr="" subnode="enum_entry" enum="DCBX_PARAM=0x4020,DCBX_APPLICATION=0x4021,QCAP=0x4001,QPTS=0x4002,QDPM=0x4003,QPDPM=0x4013,QEPM=0x4014,QPCR=0x4004,QPBR=0x400c,QETCR=0x4005,QEGCS=0x4006,QEEC=0x400d,QPDP=0x4007,QPDPC=0x4017,QPRT=0x4008,QSPTC=0x4009,QTCT=0x400a,QTCTM=0x401a,QSTCT=0x400b,QSPIP=0x400e,QSPCP=0x401e,QRWE=0x400f,QPEM=0x4010,QPDSM=0x4011,QPPM=0x4012,QSLL=0x4015,QHLL=0x4016,QCAM=0x4019,ROCE_ACCL=0x402c,PCAM=0x507f,PCAP=0x5001,PMLP=0x5002,PMTU=0x5003,PTYS=0x5004,PPAD=0x5005,PAOS=0x5006,PPAOS=0x5040,PMAOS=0x5012,PFCC=0x5007,PPCNT=0x5008,PMMP=0x5044,PMCR=0x5045,PPTB=0x500b,PBMC=0x500c,PVLC=0x500f,PPLR=0x5018,PPLM=0x5023,SLTP=0x5027,SLRG=0x5028,PPTT=0x5036,PPRT=0x5037,PCMR=0x5041,PDDR=0x5031,PTER=0x5055,SET_NODE=0x6001,POWER_SETTINGS=0x7001,HOST_ENDIANNESS=0x7004,MFCR=0x9001,MFSC=0x9002,MFSM=0x9003,MFSL=0x9004,FORE=0x9007,MFNR=0x903b,MTCAP=0x9009,MTECR=0x9109,MTMP=0x900a,MTWE=0x900b,MTEWE=0x910b,MVCAP=0x902e,MVCR=0x900c,MSPS=0x900d,MCPP=0x900e,MTBR=0x900f,MFPA=0x9010,MFBA=0x9011,MFBE=0x9012,MFMC=0x9013,MCIA=0x9014,MCION=0x9052,MMIA=0x9016,MPGR=0x9019,MFM=0x901d,MHSR=0x901e,MJTAG=0x901f,MSGI=0x9021,MSCI=0x902a,MPCIR=0x905a,MRTC=0x902d,MGIR=0x9020,MGPIR=0x9100,MHMPR=0x905d,MPFM=0x9022,MRSR=0x9023,MPGO=0x9052,MNVDA=0x9024,MNVDI=0x9025,MNVQC=0x9030,MNVIA=0x9033,MNVGC=0x9034,MNVGN=0x9035,MGNLE=0x9036,MTRC_CAP=0x9040,MTRC_CONF=0x9041,MTRC_STDB=0x9042,MTRC_CTRL=0x9043,MLCR=0x902b,MGCR=0x903a,MERR=0x903c,MPEIN=0x9050,MPCNT=0x9051,MPIR=0x9059,MPECS=0x905b,MCQS=0x9060,MCQI=0x9061,MCC=0x9062,MCDA=0x9063,MQIS=0x9064,MIRC=0x9162,MCDD=0x905c,MDFCR=0x9101,MDRCR=0x9102,MFRL=0x9028,CWGCR=0x2801,CWTP=0x2802,CWPP=0x2804,CWTPM=0x2803,CPQE=0x2806,CHLTR=0x2810,CHLTM=0x2811,CHLMM=0x2812,CNCT=0x2030,CPCS=0x2031,CPID=0x2032,CNMC=0x2033,CWCAM=0x281f,SBGCR=0xb000,SBPR=0xb001,SBCM=0xb002,SBPM=0xb003,SBMM=0xb004,SBME=0xb00e,SBSR=0xb005,SBIB=0xb006,SBDCC=0xb007,SBDCM=0xb008,SBDCR=0xb019,SBHBR=0xb00a,SBHRR=0xb00b,SBHBR_V2=0xb011,SBHRR_V2=0xb012,SBCTC=0xb00c,SBCTR=0xb00d,SBCTS=0xb00f,SBSNT=0xb020,SBSNS=0xb021,SBSNTE=0xb022,SBCAM=0xb01f,NCFG=0xc001" offset="0x0.0" size="0x4.0" /> </node> <node name="access_reg_summary_ext" descr="" attr_is_union="1" size="0x210" > @@ -138,7 +138,7 @@ <field name="mfba_reg" descr="" subnode="mfba_reg_ext" capability="0" offset="0x0.0" selected_by="MFBA" size="0x10c" /> <field name="mfbe_reg" descr="" subnode="mfbe_reg_ext" capability="0" offset="0x0.0" selected_by="MFBE" size="0xc" /> <field name="mfmc_reg" descr="" subnode="mfmc_reg_ext" capability="0" offset="0x0.0" selected_by="MFMC" size="0x1c" /> - <field name="mcia" descr="" subnode="mcia_ext" capability="0" offset="0x0.0" selected_by="MCIA" size="0x40" /> + <field name="mcia" descr="" subnode="mcia_ext" capability="0" offset="0x0.0" selected_by="MCIA" size="0x90" /> <field name="mcion" descr="" subnode="mcion_ext" capability="0" offset="0x0.0" selected_by="MCION" size="0xc" /> <field name="mmia" descr="" subnode="mmia_ext" capability="0" offset="0x0.0" selected_by="MMIA" size="0xc" /> <field name="mpgr" descr="" subnode="mpgr_ext" capability="0" offset="0x0.0" selected_by="MPGR" size="0x20" /> @@ -218,6 +218,7 @@ <field name="sbsns" descr="" subnode="sbsns_ext" capability="0" offset="0x0.0" selected_by="SBSNS" size="0x18" /> <field name="sbsnte" descr="" subnode="sbsnte_ext" capability="0" offset="0x0.0" selected_by="SBSNTE" size="0x10" /> <field name="sbcam" descr="" subnode="sbcam_ext" capability="0" offset="0x0.0" selected_by="SBCAM" size="0x4c" /> + <field name="ncfg_reg" descr="" subnode="ncfg_reg_ext" capability="0" offset="0x0.0" selected_by="NCFG" size="0x40" /> </node> <node name="access_reg_summary_selector_ext" descr="" attr_is_union="1" size="0x210" > @@ -228,13 +229,13 @@ <node name="application_prio_entry" descr="" size="0x4.0" > <field name="protocol_id" descr="According to 802.1Q application priority TLV" access="RO" offset="0x0.0" size="0x0.16" /> <field name="sel" descr="According to 802.1Q application priority TLV" access="RO" offset="0x0.16" size="0x0.3" /> - <field name="priority" descr="This field is reserved when HCA_CAP.num_ports ==1. \; See \;Table 1398, "QUERY_HCA_CAP Input Structure Layout," on page 1486\;. \;According to 802.1Q application priority TLV" access="RO" offset="0x0.21" size="0x0.3" /> + <field name="priority" descr="This field is reserved when HCA_CAP.num_ports ==1. \; See \;Table 1435, "\;QUERY_HCA_CAP Input Structure Layout\;," on page 1630\;. \;According to 802.1Q application priority TLV" access="RO" offset="0x0.21" size="0x0.3" /> </node> <node name="bufferx_reg" descr="" size="0x8.0" > <field name="size" descr="The part of the packet buffer array is allocated for the specific buffer.\;Units are represented in cells." access="RW" offset="0x0.0" size="0x0.16" /> <field name="epsb" descr="Eligible for Port Shared buffer.\;If \;epsb\; is set, packets assigned to bufferX are allowed to insert the port \;shared buffer.\;For \;port_shared_buffer\;, this field is reserved.\;When \;lossy==1\; this field is reserved.\;The field is reserved for Switch-X/-2." access="RW" offset="0x0.24" size="0x0.1" /> - <field name="lossy" descr="The field indicates if the buffer is lossy.\;0 - Lossless\;1 - Lossy\;The field is reserved for Switch-X/-2.\;For \;port_shared_buffer\;, this field is reserved.\;NOTE: This field does NOT affect the pause control. Pause control is con\;figured using PFCC register." access="RW" offset="0x0.25" size="0x0.1" /> + <field name="lossy" descr="The field indicates if the buffer is lossy.\;0: Lossless\;1: Lossy\;The field is reserved for Switch-X/-2.\;For \;port_shared_buffer\;, this field is reserved.\;NOTE: This field does NOT affect the pause control. Pause control is con\;figured using PFCC register." access="RW" offset="0x0.25" size="0x0.1" /> <field name="xon_threshold" descr="When the amount of data in the buffer goes below this value, device stops \;sending pause frames for the Prios associated with the buffer. Units are \;represented in cells.\;In Spectrum\; \;xon_threshold\; is reserved for buffer[9].\;For Spectrum, if \;lossy\; is set on, this field is reserved." access="RW" offset="0x4.0" size="0x0.16" /> <field name="xoff_threshold" descr="Once the amount of data in the buffer goes above this value, device starts \;sending Pause frames for all Prios associated with the buffer. Units are \;represented in cells.\;In Spectrum\; \;xoff_threshold\; is reserved for buffer[9].\;For Spectrum, if \;lossy\; is set on, this field is reserved." access="RW" offset="0x4.16" size="0x0.16" /> </node> @@ -276,7 +277,7 @@ <field name="access_mode" descr="Defines which value of the Configuration Item will be \;accessed.\;0x0: NEXT - Next value to be applied \;0x1: CURRENT - Currently set values (only valid for Query \;operation) Supported only if NVGC.nvda_read_current_set\;tings==1.\;0x2: FACTORY - Default factory values (only valid for \;Query operation). Supported only if NVGC.nvda_read_fac\;tory_settings==1." access="INDEX" enum="NEXT=0x0,CURRENT=0x1,FACTORY=0x2" offset="0x0.22" size="0x0.2" /> <field name="header_type" descr="[internal] Encodes the storage element Header Format\;0x0: header_only - Only Header is protected by CRC\;0x1: header_and_date - Header & Data are protected by \;CRC\;other values are reserved" access="RW" enum="header_only=0x0,header_and_date=0x1" offset="0x0.26" size="0x0.2" /> <field name="valid" descr="[Internal] Encodes the data element validity\;0x0: invalid_data- should be skipped\;0x1: illegal- treated as Invalidated data element\;0x2: valid_data\;0x3: free- (no data exists)" access="RW" enum="invalid_data=0x0,illegal=0x1,valid_data=0x2,free=0x3" offset="0x0.30" size="0x0.2" /> - <field name="type_index" descr="Configuration item index according to its type_class. \;Table 1283, "Configuration Item Type Class Global Lay\;out," on page 1398\;Table 1285, "Configuration Item Type Class Physical Port \;Layout," on page 1398\;Table 1287, "Configuration Item Type Class Per Host-PF \;Layout," on page 1399\;Table 1289, "Configuration Item Type Class Log Layout," \;on page 1399" access="INDEX" offset="0x4.0" size="0x0.24" /> + <field name="type_index" descr="Configuration item index according to its type_class. \;Table 1311, "\;Configuration Item Type Class Global Lay\;out\;," on page 1532\;Table 1313, "\;Configuration Item Type Class Physical Port \;Layout\;," on page 1532\;Table 1315, "\;Configuration Item Type Class Per Host-PF \;Layout\;," on page 1533\;Table 1317, "\;Configuration Item Type Class Log Layout\;," \;on page 1533" access="INDEX" offset="0x4.0" size="0x0.24" /> <field name="type_class" descr="Type Class.\;0x0: Global\;0x1: Port\;0x3: Host_PF\;0x5 Log" access="INDEX" enum="Global=0x0,Port=0x1,Host_PF=0x3" offset="0x4.24" size="0x0.8" /> <field name="crc16" descr="[Internal] Encodes the data integrity check of the data ele\;ment. \;Note: In some elements, only encodes the header into the \;CRC16, as defined in the header type field." access="RW" offset="0x8.0" size="0x0.16" /> </node> @@ -302,7 +303,7 @@ <node name="cpqe_ext" descr="" size="0xc.0" > <field name="local_port" descr="Egress Local Port" access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="marking_percent" descr="ECN Marking percentage when the \;local_port\; rate is above the \;phantom queue rate as configured by \;phantom_queue_rate\; in \;QEEC, see \;Section 19.3.10, "QEEC - QoS ETS Element Config\;uration," on page 842\;Range is 0..100, units of integer percentage" access="RW" offset="0x8.16" size="0x0.7" /> + <field name="marking_percent" descr="ECN Marking percentage when the \;local_port\; rate is above the \;phantom queue rate as configured by \;phantom_queue_rate\; in \;QEEC, see \;Section 19.3.10, "\;QEEC - QoS ETS Element Config\;uration\;," on page 973\;Range is 0..100, units of integer percentage" access="RW" offset="0x8.16" size="0x0.7" /> </node> <node name="cwcam_ext" descr="" size="0x50.0" > @@ -314,9 +315,9 @@ <node name="cwgcr_ext" descr="" size="0x14.0" > <field name="aqs_time" descr="Average queue size time\;Time from current_queue_size to previous_aqs\;The time is 2^\;aqs_time\; * 64nSec\;Valid range is 0..24" access="RW" offset="0x0.0" size="0x0.8" /> - <field name="aqs_weight" descr="Average queue size weight.\;The average queue size (aqs) is calculated by:\;aqs = ((current_queue_size)*2^-w) + ((previous_aqs)*(1-2^-w)) \;where w is \;aqs_weight\;The time between current_queue_size and previous_aqs is configured \;by \;aqs_time\;Note: when \;mode\;=percentage then there is no moving average (the \;aqs_weight is effectively 0). See \;Section 28.11.2, "CWTP - Congestion \;WRED ECN TClass Profile Register," on page 1254" access="RW" offset="0x0.8" size="0x0.4" /> + <field name="aqs_weight" descr="Average queue size weight.\;The average queue size (aqs) is calculated by:\;aqs = ((current_queue_size)*2^-w) + ((previous_aqs)*(1-2^-w)) \;where w is \;aqs_weight\;The time between current_queue_size and previous_aqs is configured \;by \;aqs_time\;Note: when \;mode\;=percentage then there is no moving average (the \;aqs_weight is effectively 0). See \;Section 28.12.2, "\;CWTP - Congestion \;WRED ECN TClass Profile Register\;," on page 1394" access="RW" offset="0x0.8" size="0x0.4" /> <field name="scd" descr="Enable ECN Source Congestion Detection only. Don't mark victim \;packets." access="RW" offset="0x0.16" size="0x0.1" /> - <field name="en" descr="enable bits:\;bit2: WRED drop enable\;For Spectrum, ingress mirror of WRED can utilize this configuration, \;see \;Section 4.12.2, "\;MPAR - Monitoring Port Analyzer Register\;," on \;page 671" access="RW" offset="0x0.24" size="0x0.4" /> + <field name="en" descr="enable bits:\;bit2: WRED drop enable\;For Spectrum, ingress mirror of WRED can utilize this configuration, \;see \;Section 4.12.2, "MPAR - Monitoring Port Analyzer Register," on \;page 674" access="RW" offset="0x0.24" size="0x0.4" /> <field name="cece" descr="Count ECN for Congestion Experienced\;0: do not count "ECN mark" for a packet which has Congestion Experi\;enced (ECN=11 at ingress) \;1: do count ECN mark for a packet which has Congestion Experienced \;(ECN=11 at ingress) and experiences congestion in the switch (default)\;In any case, a packet coming with ECN=00 is not counted as ECN." access="RW" offset="0x4.0" size="0x0.1" /> <field name="mece" descr="Mirror ECN for Congestion Experienced\;0: do not ecn-mirror a packet which has Congestion Experienced \;(ECN=11 at ingress)\;1: do ecn-mirror for a packet which has Congestion Experienced \;(ECN=11 at ingress) and experiences congestion in the switch (default)\;In any case, a packet coming with ECN=00 is not ecn-mirrored\;Reserved when Spectrum-1\;Reserved when Quantum which always does ecn-mirror regardless of \;fecn in the packet" access="RW" offset="0x4.1" size="0x0.1" /> </node> @@ -335,12 +336,12 @@ </node> <node name="cwtp_ext" descr="" size="0x40.0" > - <field name="pnat" descr="Port number access type. Determines the way local_port is \;interpreted:\;0: Local_port_number\;2: host_port_number" access="RW" enum="Local_port_number=0x0,host_port_number=0x2" offset="0x0.14" size="0x0.2" /> + <field name="pnat" descr="Port number access type. Determines the way local_port is \;interpreted:\;2: host_port_number" access="INDEX" enum="host_port_number=0x2" offset="0x0.14" size="0x0.2" /> <field name="local_port" descr="Local port number\;CPU port is not supported" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="traffic_class" descr="Traffic Class\;Range is 0..\;cap_max_tclass_\;sb\;-1" access="INDEX" offset="0x20.0" size="0x0.8" /> <field name="mode" descr="Mode of thresholds for WRED and ECN:\;0: Fixed\;1: Percentage" access="RW" enum="Fixed=0x0,Percentage=0x1" offset="0x24.24" size="0x0.1" /> - <field name="profile1_min" descr="Minimum Average Queue Size of the profile number <i>\;When \;mode\; is Fixed:\;Cells. Valid inputs are 0..\;cap_total_buffer_size/cap_cell_size\;.\;For Spectrum: must be a multiple of 64\;Note: for Spectrum, must be larger than 2^\;aqs_weight\; cells, \;see \;Section 28.11.1, "CWGCR - Congestion WRED ECN Gen\;eral Configuration Register," on page 1252\;When \;mode\; is Percentage:\;Percentage of the quota of \;local_port,traffic_class\;. Range is \;0..100, units of integer percentage. When ECN Source Conges\;tion Detection is enabled then congestion occurs when there \;are at least 256 cells in the buffer" access="RW" offset="0x28.0" size="0x0.20" /> - <field name="profile1_max" descr="Maximum Average Queue Size of the profile number <i>\;When \;mode\; is Fixed:\;Cells. Valid inputs are 0..\;cap_total_buffer_size/cap_cell_size\;For Spectrum: must be a multiple of 64\;When \;mode\; is Percentage:\;Percentage of the quota of \;local_port,traffic_class\;. Range is \;0..100, units of integer percentage.\;profile<i>_max\; must always be equal or greater than \;pro\;file<i>_min" access="RW" offset="0x2C.0" size="0x0.20" /> + <field name="profile1_min" descr="Minimum Average Queue Size of the profile number <i>\;When \;mode\; is Fixed:\;Cells. Valid inputs are 1..\;cap_total_buffer_size/cap_cell_size\;.\;For Spectrum: must be a multiple of 64\;Note: for Spectrum, must be larger than 2^\;aqs_weight\; cells, \;see \;Section 28.12.1, "\;CWGCR - Congestion WRED ECN \;General Configuration Register\;," on page 1392\;When \;mode\; is Percentage:\;Percentage of the quota of \;local_port,traffic_class\;. Range is \;0..100, units of integer percentage. When ECN Source Conges\;tion Detection is enabled then congestion occurs when there \;are at least 256 cells in the buffer" access="RW" offset="0x28.0" size="0x0.20" /> + <field name="profile1_max" descr="Maximum Average Queue Size of the profile number <i>\;When \;mode\; is Fixed:\;Cells. Valid inputs are 1..\;cap_total_buffer_size/cap_cell_size\;For Spectrum: must be a multiple of 64\;When \;mode\; is Percentage:\;Percentage of the quota of \;local_port,traffic_class\;. Range is \;0..100, units of integer percentage.\;profile<i>_max\; must always be equal or greater than \;pro\;file<i>_min" access="RW" offset="0x2C.0" size="0x0.20" /> <field name="profile1_percent" descr="Percentage of WRED and ECN marking for Maximum Aver\;age Queue Size of the profile number <i>\;Range is 0..100, units of integer percentage\;Default is 0" access="RW" offset="0x2C.24" size="0x0.7" /> <field name="profile2_min" descr="Same as above." access="RW" offset="0x30.0" size="0x0.20" /> <field name="profile2_max" descr="Same as above." access="RW" offset="0x34.0" size="0x0.20" /> @@ -351,28 +352,22 @@ </node> <node name="cwtpm_ext" descr="" size="0x44.0" > - <field name="pnat" descr="Port number access type. Determines the way local_port is \;interpreted:\;0: Local_port_number\;2: host_port_number" access="RW" enum="Local_port_number=0x0,host_port_number=0x2" offset="0x0.14" size="0x0.2" /> + <field name="pnat" descr="Port number access type. Determines the way local_port is \;interpreted:\;2: host_port_number" access="INDEX" enum="host_port_number=0x2" offset="0x0.14" size="0x0.2" /> <field name="local_port" descr="Local port number\;CPU port is not supported" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="traffic_class" descr="Traffic Class\;Range is 0..\;cap_max_tclass_\;sb\;-1" access="INDEX" offset="0x20.0" size="0x0.8" /> <field name="ee" descr="Enable ECN on traffic class\;0: Disable\;1: Enable\;Default is 0\;Reserved when Quantum" access="RW" enum="Disable=0x0,Enable=0x1" offset="0x24.0" size="0x0.1" /> <field name="ew" descr="Enable WRED on traffic class:\;0: Disable\;1: Enable\;Default is 0\;Reserved when Quantum" access="RW" enum="Disable=0x0,Enable=0x1" offset="0x24.1" size="0x0.1" /> - <field name="tcp_g" descr="TCP Green Profile Number\;0 for disabling both WRED and ECN for this type of traffic.\;Default is 0\;Reserved when Quantum" access="RW" offset="0x34.0" size="0x0.2" /> - <field name="tcp_r" descr="TCP Red Profile Number\;0 for disabling both WRED and ECN for this type of traffic.\;Default is 0\;Reserved when Quantum" access="RW" offset="0x38.0" size="0x0.2" /> - <field name="tcp_y" descr="TCP Yellow Profile Number\;0 for disabling both WRED and ECN for this type of traffic.\;Default is 0\;Reserved when Quantum" access="RW" offset="0x38.16" size="0x0.2" /> - <field name="ntcp_g" descr="Non-TCP Green Profile Number\;0 for disabling both WRED and ECN for this type of traffic.\;Default is 0\;Reserved when Quantum" access="RW" offset="0x3C.0" size="0x0.2" /> - <field name="ntcp_r" descr="Non-TCP Red Profile Number\;0 for disabling both WRED and ECN for this type of traffic.\;Default is 0\;Reserved when Quantum" access="RW" offset="0x40.0" size="0x0.2" /> - <field name="ntcp_y" descr="Non-TCP Yellow Profile Number\;0 for disabling both WRED and ECN for this type of traffic.\;Default is 0\;Reserved when Quantum" access="RW" offset="0x40.16" size="0x0.2" /> </node> <node name="dcbx_app_reg_ext" descr="" size="0x14.0" > - <field name="port_number" descr="Physical port number.\;This field is reserved when HCA_CAP.num_ports ==1. \; See \;Table 1398, "QUERY_HCA_CAP Input Structure Layout," on page 1486" access="INDEX" offset="0x0.16" size="0x0.8" /> + <field name="port_number" descr="Physical port number.\;This field is reserved when HCA_CAP.num_ports ==1. \; See \;Table 1435, "\;QUERY_HCA_CAP Input Structure Layout\;," on page 1630" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="num_app_prio" descr="" access="RO" offset="0x4.0" size="0x0.6" /> <field name="app_prio" descr="Application priority entry." subnode="application_prio_entry" access="RO" high_bound="VARIABLE" low_bound="0" offset="0x10.0" size="0x4.0" /> </node> <node name="dcbx_param_reg_ext" descr="" size="0x40.0" > <field name="max_application_table_size" descr="The maximum size of DCBX application table." access="RO" offset="0x0.0" size="0x0.6" /> - <field name="port_number" descr="Physical port number.\;This field is reserved when HCA_CAP.num_ports ==1. \; See \;Table 1398, "QUERY_HCA_CAP Input Structure Layout," on page 1486" access="INDEX" offset="0x0.16" size="0x0.8" /> + <field name="port_number" descr="Physical port number.\;This field is reserved when HCA_CAP.num_ports ==1. \; See \;Table 1435, "\;QUERY_HCA_CAP Input Structure Layout\;," on page 1630" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="dcbx_standby_cap" descr="If set, device supports DCBX on standby mode (aux power)." access="RO" offset="0x0.29" size="0x0.1" /> <field name="dcbx_ieee_cap" descr="If set, DCBX IEEE version is supported." access="RO" offset="0x0.30" size="0x0.1" /> <field name="dcbx_cee_cap" descr="If set, DCBX CEE version is supported." access="RO" offset="0x0.31" size="0x0.1" /> @@ -390,9 +385,9 @@ </node> <node name="ecn" descr="" size="0x4.0" > - <field name="color2" descr="The EXP mapping for color \;k\;, where k=0..2, see \;Table 679, \;"color<k>Layout," on page 859" access="RW" offset="0x0.8" size="0x0.8" /> - <field name="color1" descr="The EXP mapping for color \;k\;, where k=0..2, see \;Table 679, \;"color<k>Layout," on page 859" access="RW" offset="0x0.16" size="0x0.8" /> - <field name="color0" descr="The EXP mapping for color \;k\;, where k=0..2, see \;Table 679, \;"color<k>Layout," on page 859" access="RW" offset="0x0.24" size="0x0.8" /> + <field name="color2" descr="The EXP mapping for color \;k\;, where k=0..2, see \;Table 702, \;"\;color<k>Layout\;," on page 989" access="RW" offset="0x0.8" size="0x0.8" /> + <field name="color1" descr="The EXP mapping for color \;k\;, where k=0..2, see \;Table 702, \;"\;color<k>Layout\;," on page 989" access="RW" offset="0x0.16" size="0x0.8" /> + <field name="color0" descr="The EXP mapping for color \;k\;, where k=0..2, see \;Table 702, \;"\;color<k>Layout\;," on page 989" access="RW" offset="0x0.24" size="0x0.8" /> </node> <node name="enum_entry" descr="" size="0x4.0" > @@ -739,19 +734,19 @@ <field name="time_elapsed_since_last_cmd" descr="The number of seconds elapsed since the update_handle \;owner last issued a command. The time saturates at 0xFFF." access="RO" offset="0x0.16" size="0x0.12" /> <field name="component_index" descr="Index of the accessed component. Valid for \;UPDATE_COMPONENT, ACTIVATE_COMPONENET, \;READ_COMPONENT and READ_PENDING_COMPO\;NENT instructions. Otherwise, this field is reserved." access="INDEX" offset="0x4.0" size="0x0.16" /> <field name="update_handle" descr="Token representing the current flow executed by the FSM.\;See \;"Update Handle" on page 544\;." access="RW" offset="0x8.0" size="0x0.24" /> - <field name="control_state" descr="Current Update FSM state\;, See \;"FSM States" on page 547\;0x0: IDLE\;0x1: LOCKED\;0x2: INITIALIZE\;0x3: DOWNLOAD\;0x4: VERIFY\;0x5: APPLY\;0x6: ACTIVATE\;0x7: UPLOAD\;0x8: UPLOAD_PENDING\;Other values are reserved" access="RO" offset="0xC.0" size="0x0.4" /> + <field name="control_state" descr="Current Update FSM state\;, See \;"FSM States" on page 547\;0x0: IDLE\;0x1: LOCKED\;0x2: INITIALIZE\;0x3: DOWNLOAD\;0x4: VERIFY\;0x5: APPLY\;0x6: ACTIVATE\;0x7: UPLOAD\;0x8: UPLOAD_PENDING\;Other values are reserved" access="RO" enum="IDLE=0x0,LOCKED=0x1,INITIALIZE=0x2,DOWNLOAD=0x3,VERIFY=0x4,APPLY=0x5,ACTIVATE=0x6,UPLOAD=0x7,UPLOAD_PENDING=0x8" offset="0xC.0" size="0x0.4" /> <field name="error_code" descr="Indicates the successful completion of the \;instruction\;, or \;the reason it failed. \;See \;"Error Handling" on page 546\;0x0: OK\;0x1: ERROR\;0x2: REJECTED_DIGEST_ERR\;0x3: REJECTED_NOT_APPLICABLE\;0x4: REJECTED_UNKNOWN_KEY\;0x5: REJECTED_AUTH_FAILED\;0x6: REJECTED_UNSIGNED\;0x7: REJECTED_KEY_NOT_APPLICABLE\;0x8: REJECTED_BAD_FORMAT\;0x9: BLOCKED_PENDING_RESET\;0xA: REJECTED_NOT_A_SECURED_FW\;0xB: REJECTED_MFG_BASE_MAC_NOT_LISTED\;0xC: REJECTED_NO_DEBUG_TOKEN\;0xD: REJECTED_VERSION_NUM_MISMATCH\;0xE: REJECTED_USER_TIMESTAMP_MISMATCH\;0xF: REJECTED_FORBIDDEN_VERSION\;0x10: FLASH_ERASE_ERROR\;0x11: REJECTED_REBURN_RUNNING_AND_RETRY\;Other values should be treated as an unknown error." access="RO" offset="0xC.8" size="0x0.8" /> <field name="control_progress" descr="Indicates the estimated progress status of the current opera\;tion executed by the FSM. Valid values are 0..100.\;101 indicates that progress reporting is not supported for \;this update state." access="RO" offset="0xC.16" size="0x0.7" /> <field name="handle_owner_host_id" descr="For \;handle_owner_type\; BMC, command-interface and \;ICMD, indicates the identifier of the host of the handle \;owner.\;Otherwise reserved" access="RO" offset="0xC.24" size="0x0.4" /> <field name="handle_owner_type" descr="Type of entity holding the update handle:\;0x0: unspecified\;0x1: Chassis BMC\;0x2: MAD\;0x3: BMC\;0x4: command interface\;0x5: ICMD \;Other values are reserved." access="RO" offset="0xC.28" size="0x0.4" /> - <field name="component_size" descr="Component size in bytes. \;Valid for UPDATE_COMPONENT instruction. Specifying \;the size may shorten the update time.\;Value 0x0 means that size is unspecified." access="WO" offset="0x10.0" size="0x4.0" /> + <field name="component_size" descr="Component size in bytes. \;Valid for UPDATE_COMPONENT instruction. Specify\;ing the size may shorten the update time.\;Value 0x0 means that size is unspecified." access="WO" offset="0x10.0" size="0x4.0" /> <field name="device_type" descr="Peripheral device type:\;0: Switch / NIC\;1: Gearbox" access="INDEX" offset="0x14.0" size="0x0.8" /> <field name="device_index" descr="Device number.\;For gearboxes, the index represents the gearbox die." access="INDEX" offset="0x14.16" size="0x0.12" /> </node> <node name="mcda_reg_ext" descr="" size="0x90.0" > <field name="update_handle" descr="Update handle registered when the FSM was activated." access="RW" offset="0x0.0" size="0x0.24" /> - <field name="offset" descr="Offset of accessed address relative to component start. \;Accesses must be in accordance to \;log_mcda_word_size\; in \;Table 1355, "MCQI CAPABILITIES Info Layout," on \;page 1446" access="RW" offset="0x4.0" size="0x4.0" /> + <field name="offset" descr="Offset of accessed address relative to component start. \;Accesses must be in accordance to \;log_mcda_word_size\; in \;Table 1376, "\;MCQI CAPABILITIES Info Layout\;," on \;page 1576" access="RW" offset="0x4.0" size="0x4.0" /> <field name="size" descr="Size of the data accessed, given in bytes" access="RW" offset="0x8.0" size="0x0.16" /> <field name="data" descr="Data block accessed" access="RW" high_bound="31" low_bound="0" offset="0x10.0" size="0x80.0" /> </node> @@ -766,15 +761,16 @@ <field name="mailbox_page_phys_addr_lsb" descr="Physical address of the mailbox page." access="RW" offset="0x1C.0" size="0x4.0" /> </node> -<node name="mcia_ext" descr="" size="0x40.0" > +<node name="mcia_ext" descr="" size="0x90.0" > <field name="status" descr="Module Status\;0h - GOOD\;1h - NO_EEPROM_MODULE. No response from module's \;EPROM.\;2h - MODULE_NOT_SUPPORTED. Module type not supported \;by the device. \;3h - MODULE_NOT_CONNECTED. No module present indica\;tion. \;9h - I\;2\;C_ERROR. Error occurred while trying to access the mod\;ule's EPROM using I\;2\;C.\;10h - MODULE_DISABLED - module is disabled \;[Internal] 11h - Page Access Failed - page not supported or trying \;to access a protected page with bad password." access="RO" offset="0x0.0" size="0x0.8" /> <field name="module" descr="Module number" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="l" descr="Lock bit. Setting this bit will lock the access to the specific cable.\;Used for updating a full page in a cable EPROM. Any access \;other then subsequence writes will fail while the port is locked." access="RW" offset="0x0.31" size="0x0.1" /> <field name="device_address" descr="Device address" access="RW" offset="0x4.0" size="0x0.16" /> <field name="page_number" descr="Page number" access="RW" offset="0x4.16" size="0x0.8" /> <field name="i2c_device_address" descr="I\;2\;C device address" access="RW" offset="0x4.24" size="0x0.8" /> - <field name="size" descr="Number of bytes to read/write (up to 48 bytes)" access="RW" offset="0x8.0" size="0x0.16" /> - <field name="dword" descr="Bytes to read/write" access="RW" high_bound="11" low_bound="0" offset="0x10.0" size="0x30.0" /> + <field name="size" descr="Number of bytes to read/write (up to \;128\; bytes)" access="RW" offset="0x8.0" size="0x0.16" /> + <field name="bank_number" descr="Bank number" access="RW" offset="0x8.16" size="0x0.8" /> + <field name="dword" descr="Bytes to read/write" access="RW" high_bound="31" low_bound="0" offset="0x10.0" size="0x80.0" /> </node> <node name="mcion_ext" descr="" size="0xc.0" > @@ -789,12 +785,12 @@ <field name="warning_temperature" descr="Above this temperature the Temperature Event is set\;. \;Units are \;Celsius\;Default 105\;Reserved when \;ent\; = 0" access="RW" offset="0x4.16" size="0x0.8" /> <field name="wsoc" descr="Warning State due to Over Current Event:\;0 - Yellow_State\;1 - Red_State (default)" access="RW" offset="0x8.30" size="0x0.1" /> <field name="wst" descr="Warning State due to Temperature Event:\;0 - Yellow_State (default)\;1 - Red_State" access="RW" offset="0x8.31" size="0x0.1" /> - <field name="yellow_state_rate" descr="Port rate at Yellow_State. Units are percentage from Green_State \;port rate\;Default 50" access="RW" offset="0xC.0" size="0x0.8" /> + <field name="yellow_state_rate" descr="Port rate at Yellow_State. Units are percentage from \;Green_State port rate\;Default 50" access="RW" offset="0xC.0" size="0x0.8" /> <field name="red_state_rate" descr="Port rate at Red_State. Units are percentage from Green_State \;port rate\;red_state_rate\; must be lower or equal to \;yellow_state_rate\;Default 0" access="RW" offset="0xC.16" size="0x0.8" /> </node> <node name="mcqi_reg_ext" descr="" size="0x1c.0" > - <field name="component_index" descr="Component index gathered by \;"MCQS - Management \;Component Query Status"" access="INDEX" offset="0x0.0" size="0x0.16" /> + <field name="component_index" descr="Component index gathered by \;"\;MCQS - Management \;Component Query Status\;"" access="INDEX" offset="0x0.0" size="0x0.16" /> <field name="device_index" descr="Device number.\;For gearboxes, the index represents the gearbox die." access="INDEX" offset="0x0.16" size="0x0.12" /> <field name="read_pending_component" descr="When set, the register will return information about the \;pending component (if available)" access="INDEX" offset="0x0.31" size="0x0.1" /> <field name="device_type" descr="Peripheral device type:\;0: Switch / NIC\;1: Gearbox" access="INDEX" offset="0x4.0" size="0x0.8" /> @@ -810,7 +806,7 @@ <field name="device_index" descr="Device number.\;For gearboxes, the index represents the gearbox die." access="INDEX" offset="0x0.16" size="0x0.12" /> <field name="last_index_flag" descr="When set, this component is the last component (highest \;component_index\;)." access="RO" offset="0x0.31" size="0x0.1" /> <field name="identifier" descr="This field uniquely identifies a specific component type. \;0x1: BOOT_IMG\;0x4: OEM_NVCONFIG\;0x5: MLNX_NVCONFIG\;0x6: CS_TOKEN\;0x7: DBG_TOKEN\;0xA Gearbox\;Other values are reserved" access="RO" offset="0x4.0" size="0x0.16" /> - <field name="component_update_state" descr="Component statue in update flow, \;see \;"Component Update \;State\;" on page 543\;:\;0x0: IDLE\;0x1: IN_PROGRESS\;0x2: APPLIED\;0x3: ACTIVE \;0x4: ACTIVE_PENDING_RESET\;0x5: FAILED\;0x6: CANCELED\;0x7: BUSY\;Other values are reserved" access="RO" offset="0x8.0" size="0x0.4" /> + <field name="component_update_state" descr="Component statue in update flow\;, see \;"Component Update \;State" on page 543\;:\;0x0: IDLE\;0x1: IN_PROGRESS\;0x2: APPLIED\;0x3: ACTIVE \;0x4: ACTIVE_PENDING_RESET\;0x5: FAILED\;0x6: CANCELED\;0x7: BUSY\;Other values are reserved" access="RO" offset="0x8.0" size="0x0.4" /> <field name="component_status" descr="The status of the component:\;0x0: NOT_PRESENT - The component is supported by the \;device but, currently not present\;0x1: PRESENT - This component is present.\;0x2: IN_USE - The component is present and currently in \;use.\;Other values are reserved" access="RO" offset="0x8.4" size="0x0.5" /> <field name="device_type" descr="Peripheral device type:\;0: Switch / NIC\;1: Gearbox" access="INDEX" offset="0xC.0" size="0x0.8" /> <field name="last_update_state_changer_host_id" descr="For \;last_update_state_changer_type\; BMC, command-\;interface and ICMD, indicates the identifier of the host of \;the handle owner. Otherwise reserved." access="RO" offset="0xC.24" size="0x0.4" /> @@ -818,17 +814,17 @@ </node> <node name="mdfcr_ext" descr="" size="0x60.0" > - <field name="device_type" descr="Peripheral device type\;1: Vega Gearbox" access="INDEX" offset="0x0.0" size="0x0.8" /> + <field name="device_type" descr="Peripheral device type\;1: Vega Gearbox\;2: Tile" access="INDEX" offset="0x0.0" size="0x0.8" /> <field name="device_index" descr="Device number \;For gearboxes, the index represents the gearbox die." access="INDEX" offset="0x4.0" size="0x0.12" /> <field name="all" descr="All devices are selected and \;device_index\; is ignored\;When set to '1', the \;fw_status\; should represent the worst case of \;any of the devices. \;fw_version\;, \;build_id\;, \;major\; and \;minor\; should \;be of device number 0." access="INDEX" offset="0x4.31" size="0x0.1" /> <field name="first_fw_status_device" descr="The first device representing the \;fw_status" access="RO" offset="0xC.0" size="0x0.12" /> - <field name="fw_status" descr="FW load status.\;0: No errors, FW has loaded successfully. \;1: Flash error. \;2: FW load error. \;15: Not ready yet for displaying the status." access="RO" offset="0xC.20" size="0x0.4" /> + <field name="fw_status" descr="FW load status.\;0: No errors, FW has loaded successfully. \;1: Flash error. \;2: FW load error. \;15: Not ready yet for displaying the status.\; Loading the FW." access="RO" offset="0xC.20" size="0x0.4" /> <field name="expected_fw_version" descr="Expected FW version" access="RO" offset="0x10.0" size="0x4.0" /> <field name="fw_version" descr="FW version" access="RO" offset="0x14.0" size="0x4.0" /> <field name="build_id" descr="FW build ID" access="RO" offset="0x18.0" size="0x0.16" /> <field name="major" descr="FW major version" access="RO" offset="0x1C.0" size="0x0.8" /> <field name="minor" descr="FW minor version" access="RO" offset="0x20.0" size="0x0.8" /> - <field name="error_id" descr="FW burning status error.\;1: no errors\;2: error in total size\;3: error in iRAM size read\;4: error in DRAM size read\;5: SPI read from EEPROM time-out\;6: CRC on downloaded EEPROM content\;7: Download process is on-going\;8: SPI reset time-out\;9: memory protection\;10: unknown parameter was received by bootloader \;11: invalid message was received by bootloader\;12: message was aborted by host\;13-32: Reserved" access="RO" offset="0x24.11" size="0x0.5" /> + <field name="error_id" descr="FW burning status error.\;1: no errors\;2: error in total size\;3: error in iRAM size read\;4: error in DRAM size read\;5: SPI read from EEPROM time-out\;6: CRC on downloaded EEPROM content\;7: Download process is on-going\;8: SPI reset time-out\;9: memory protection\;10: unknown parameter was received by bootloader \;11: invalid message was received by bootloader\;12: message was aborted by host" access="RO" offset="0x24.11" size="0x0.5" /> </node> <node name="mdrcr_ext" descr="" size="0x30.0" > @@ -910,7 +906,7 @@ </node> <node name="mfrl_reg_ext" descr="" size="0x8.0" > - <field name="reset_level" descr="The firmware reset level. See \;"MFRL - Management Firmware \;Reset Level" on page 1465\;Only a single bit may be set.\;Bit 3: LEVEL3\;Bit 6: LEVEL6\;Other bits are reserved." access="RW" enum="LEVEL3=0x8,LEVEL6=0x40" offset="0x4.0" size="0x0.8" /> + <field name="reset_level" descr="The firmware reset level. See \;"\;MFRL - Management Firmware \;Reset Level\;" on page 1593\;Only a single bit may be set.\;Bit 0: LEVEL0\;Bit 3: LEVEL3\;Bit 6: LEVEL6\;Other bits are reserved." access="RW" enum="LEVEL0=0x1,LEVEL3=0x8,LEVEL6=0x40" offset="0x4.0" size="0x0.8" /> <field name="reset_type" descr="Each bit represents a chip reset type.\;If set to '1', the reset is supported. \;Bit 0: Full chip reset\;Bit 1: Port alive" access="RO" offset="0x4.8" size="0x0.8" /> <field name="rst_type_sel" descr="The requested reset." access="RW" offset="0x4.24" size="0x0.3" /> </node> @@ -922,7 +918,7 @@ <node name="mfsl_ext" descr="" size="0xc.0" > <field name="ie" descr="Interrupt Enable. If the ie bit is set and the Tachometer reading is out \;of range as defined by tach_min and tach_max, the FERR# will be \;asserted." access="RW" offset="0x0.0" size="0x0.1" /> - <field name="ee" descr="Event Enable.\;0 - Do not generate event\;1 - Generate Event \;2 - Generate single event\;For Fan Error Evet details refer to \;Section 28.14.5, "FORE - Fan Out \;of Range Event"\;." access="RW" offset="0x0.2" size="0x0.2" /> + <field name="ee" descr="Event Enable.\;0 - Do not generate event\;1 - Generate Event \;2 - Generate single event\;For Fan Error Evet details refer to \;Section 28.15.5, "\;FORE - Fan Out \;of Range Event\;"\;." access="RW" offset="0x0.2" size="0x0.2" /> <field name="tacho" descr="Fan tachometer index" access="INDEX" offset="0x0.24" size="0x0.4" /> <field name="tach_min" descr="Tachometer minimum value (minimum RPM)." access="RW" offset="0x4.0" size="0x0.16" /> <field name="tach_max" descr="Tachometer maximum value (maximum RPM)." access="RW" offset="0x8.0" size="0x0.16" /> @@ -947,9 +943,9 @@ </node> <node name="mgir_ext" descr="" size="0xa0.0" > - <field name="hw_info" descr="Hardware Information, see \;Table 1244, "Hardware Info Layout," \;on page 1373" subnode="mgir_hardware_info" access="RW" offset="0x0.0" size="0x20.0" /> - <field name="fw_info" descr="Firmware Information, see \;Table 1246, "Firmware Info Layout," \;on page 1375" subnode="mgir_fw_info" access="RW" offset="0x20.0" size="0x40.0" /> - <field name="sw_info" descr="Software Information, see \;Table 1248, "Software Info Layout," \;on page 1377\;This field indicates \;the oldest software version compatible \;with the current firmware" subnode="mgir_sw_info" access="RW" offset="0x60.0" size="0x20.0" /> + <field name="hw_info" descr="Hardware Information, see \;Table 1275, "\;Hardware Info Layout\;," \;on page 1509" subnode="mgir_hardware_info" access="RW" offset="0x0.0" size="0x20.0" /> + <field name="fw_info" descr="Firmware Information, see \;Table 1277, "\;Firmware Info Layout\;," \;on page 1510" subnode="mgir_fw_info" access="RW" offset="0x20.0" size="0x40.0" /> + <field name="sw_info" descr="Software Information, see \;Table 1279, "\;Software Info Layout\;," \;on page 1513\;This field indicates \;the oldest software version compatible \;with the current firmware" subnode="mgir_sw_info" access="RW" offset="0x60.0" size="0x20.0" /> </node> <node name="mgir_fw_info" descr="" size="0x40.0" > @@ -960,13 +956,13 @@ <field name="signed_fw" descr="When set the device is running a signed FW binaries." access="RO" offset="0x0.25" size="0x0.1" /> <field name="debug" descr="When set, the device is running a debug firmware. \;'debug' binary can only be installed on specific devices \;(identified by their 'Factory base MAC'), which currently \;run a specific firmware version. These restrictions are \;expressed by a signed 'debug' token that must be loaded \;to the device before installing the debug binary." access="RO" offset="0x0.26" size="0x0.1" /> <field name="dev" descr="When set, the device is running a development firmware \;version." access="RO" offset="0x0.27" size="0x0.1" /> - <field name="string_tlv" descr="When set, string-TLV are supported." access="RO" offset="0x0.28" size="0x0.1" /> + <field name="string_tlv" descr="When set, string-TLV is supported." access="RO" offset="0x0.28" size="0x0.1" /> <field name="build_id" descr="Firmware Build ID. Optional. \;." access="RO" offset="0x4.0" size="0x4.0" /> <field name="year" descr="Firmware installation date. \;For example: 3 May 2004 will be coded as Month= 0x05, \;Day= 0x03, and Year= 0x04" access="RO" offset="0x8.0" size="0x0.16" /> <field name="day" descr="Firmware installation date. \;For example: 3 May 2004 will be coded as Month= 0x05, \;Day= 0x03, and Year= 0x04" access="RO" offset="0x8.16" size="0x0.8" /> <field name="month" descr="Firmware installation date. \;For example: 3 May 2004 will be coded as Month= 0x05, \;Day= 0x03, and Year= 0x04" access="RO" offset="0x8.24" size="0x0.8" /> <field name="hour" descr="Firmware installation hour.\;For example 17:43 will be coded as 0x1743" access="RO" offset="0xC.0" size="0x0.16" /> - <field name="psid" descr="To be defined later." access="RO" high_bound="3" low_bound="0" offset="0x10.0" size="0x10.0" /> + <field name="psid" descr="To be defined later." access="RO" high_bound="15" low_bound="0" offset="0x10.24" size="0x10.0" /> <field name="ini_file_version" descr="User-configured version number of the current INI file." access="RO" offset="0x20.0" size="0x4.0" /> <field name="extended_major" descr="FW version's Major field in extended (32b) format." access="RO" offset="0x24.0" size="0x4.0" /> <field name="extended_minor" descr="FW version's Minor field in extended (32b) format." access="RO" offset="0x28.0" size="0x4.0" /> @@ -1014,13 +1010,13 @@ </node> <node name="mgpir_ext" descr="" size="0xa0.0" > - <field name="hw_info" descr="Hardware Information, see \;Table 1256, "Hardware Info Layout," \;on page 1381" subnode="mgpir_hw_info" access="RW" offset="0x0.0" size="0x20.0" /> + <field name="hw_info" descr="Hardware Information, see \;Table 1287, "\;Hardware Info Layout\;," \;on page 1517" subnode="mgpir_hw_info" access="RW" offset="0x0.0" size="0x20.0" /> </node> <node name="mgpir_hw_info" descr="" size="0x20.0" > <field name="num_of_devices" descr="Number of devices of \;device_type\;." access="RO" offset="0x0.0" size="0x0.8" /> <field name="devices_per_flash" descr="Number of devices of \;device_type\; per flash." access="RO" offset="0x0.16" size="0x0.8" /> - <field name="device_type" descr="Device type.\;0: No devices on system of that type.\;1: Vega gearbox dice" access="RO" offset="0x0.24" size="0x0.4" /> + <field name="device_type" descr="Device type.\;0: No devices on system of that type.\;1: Vega gearbox dice\;2: Tiles" access="RO" offset="0x0.24" size="0x0.4" /> <field name="num_of_modules" descr="Number of modules." access="RO" offset="0x4.0" size="0x0.8" /> </node> @@ -1040,7 +1036,7 @@ <field name="size" descr="Size of operation - relevant for JTAG interface access com\;mands only, indicating the number of transaction bytes to exe\;cute. Maximum size supported is 40.\;Note:\; when size=0, no operation is performed (clock is not tog\;gled). The \;tdo\; is sampled and provided in the response at \;jtag_transaction_set_0\;." access="WO" offset="0x0.0" size="0x0.8" /> <field name="sequence_number" descr="Command sequence number - to prevent re-execution of the \;same command due to command retransmission, this command \;includes a sequence number.\;The enable and disable commands MUST be issues with \;sequence_number\; = 0 while any JTAG access command must \;increase the \;sequence_number\; by 1 (the first JTAG access com\;mand should start at \;sequence_number\; = 1)." access="WO" offset="0x0.24" size="0x0.4" /> <field name="cmd" descr="Command\;0 - JTAG interface disable - JTAG interface is disabled\;1 - JTAG interface enable - enabling JTAG interface\;2 - JTAG interface access" access="RW" offset="0x0.30" size="0x0.2" /> - <field name="jtag_transaction_set" descr="See \;Table 1234, "JTAG Transaction Set Byte Layout," on \;page 1367" access="RW" high_bound="43" low_bound="0" offset="0x4.24" size="0x2c.0" /> + <field name="jtag_transaction_set" descr="See \;Table 1265, "\;JTAG Transaction Set Byte Layout\;," on \;page 1503" access="RW" high_bound="43" low_bound="0" offset="0x4.24" size="0x2c.0" /> </node> <node name="mlcr_ext" descr="" size="0xc.0" > @@ -1081,11 +1077,11 @@ <node name="mnvia_reg_ext" descr="" size="0x8.0" > <field name="target" descr="Information targeted for invalidation\;0: ALL - all NVRAM parameters.\; \;All other values are reserved." access="WO" offset="0x0.0" size="0x0.3" /> - <field name="writer_id" descr="The entity which perform the invalidate.\;The encoding same as writer_id in Configuration Item reg\;ister (See \;Table 1281, "Configuration Item Layout," on \;page 1395\;)." access="RW" offset="0x0.4" size="0x0.5" /> + <field name="writer_id" descr="The entity which perform the invalidate.\;The encoding same as writer_id in Configuration Item reg\;ister (See \;Table 1309, "\;Configuration Item Layout\;," on \;page 1529\;)." access="RW" offset="0x0.4" size="0x0.5" /> </node> <node name="mnvqc_reg_ext" descr="" size="0x8.0" > - <field name="type" descr="Configuration item type. \;Table 1283, "Configuration Item Type Class Global Lay\;out," on page 1398\;Table 1285, "Configuration Item Type Class Physical \;Port Layout," on page 1398\;Table 1287, "Configuration Item Type Class Per Host-PF \;Layout," on page 1399" access="INDEX" offset="0x0.0" size="0x4.0" /> + <field name="type" descr="Configuration item type. \;Table 1311, "\;Configuration Item Type Class Global Lay\;out\;," on page 1532\;Table 1313, "\;Configuration Item Type Class Physical \;Port Layout\;," on page 1532\;Table 1315, "\;Configuration Item Type Class Per Host-\;PF Layout\;," on page 1533" access="INDEX" offset="0x0.0" size="0x4.0" /> <field name="support_rd" descr="The configuration item is supported and can be read" access="RO" offset="0x4.0" size="0x0.1" /> <field name="support_wr" descr="The configuration item is supported and can be updated" access="RO" offset="0x4.1" size="0x0.1" /> <field name="version" descr="The maximal version of the configuration item supported \;by the device" access="RO" offset="0x4.4" size="0x0.4" /> @@ -1109,7 +1105,7 @@ <field name="pcie_index" descr="PCIe index number (Internal domain index)\;Reserved when access is from the host" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="depth" descr="depth level of the DUT of some hierarchy" access="INDEX" offset="0x0.24" size="0x0.6" /> <field name="clr" descr="Clear counters. Setting the \;clr\; bit will reset the counter value for all \;counters in the counter group. This bit can be set for both Set() and \;Get() operation." access="WO" offset="0x4.31" size="0x0.1" /> - <field name="counter_set" descr="Counter set as described in\;Table 1329, "PCIe Performance Counters Data Layout," on \;page 1421\;[Internal] \;Table 1333, "PCIE lanes counters Data Layout," on \;page 1425\;[Internal] \;Table 1331, "PCIE timers and states Data Layout," on \;page 1423" subnode="mpcnt_reg_counter_set_auto_ext" access="RO" offset="0x8.0" size="0xf8.0" /> + <field name="counter_set" descr="Counter set as described in\;Table 1352, "\;PCIe Performance Counters Data Layout\;," on \;page 1552\;[Internal] \;Table 1356, "\;PCIE lanes counters Data Layout\;," on \;page 1556\;[Internal] \;Table 1354, "\;PCIE timers and states Data Layout\;," on \;page 1554" subnode="mpcnt_reg_counter_set_auto_ext" access="RO" offset="0x8.0" size="0xf8.0" /> </node> <node name="mpecs_reg_ext" descr="" size="0x20.0" > @@ -1180,7 +1176,7 @@ </node> <node name="mqis_reg_ext" descr="" size="0x18.0" > - <field name="info_type" descr="Type of information string to be queried:\;0x0: VPD - Read the PCI Vital Product Data capability con\;tent.\;0x1: MODEL_NAME\;0x2: MODEL_DESCRIPTION\;0x3: IMAGE_VSD\;0x4: DEVICE_VSD\;0x5: ROM_INFO\;other values are reserved." access="INDEX" offset="0x0.0" size="0x0.8" /> + <field name="info_type" descr="Type of information string to be queried:\;0x0: VPD - Read the PCI Vital Product Data capability \;content.\;0x1: MODEL_NAME\;0x2: MODEL_DESCRIPTION\;0x3: IMAGE_VSD\;0x4: DEVICE_VSD\;0x5: ROM_INFO\;other values are reserved." access="INDEX" enum="MODEL_NAME=0x1,MODEL_DESCRIPTION=0x2,IMAGE_VSD=0x3,DEVICE_VSD=0x4,ROM_INFO=0x5" offset="0x0.0" size="0x0.8" /> <field name="info_length" descr="Total size of the information string, according to \;info_type\;. \;Value given in bytes." access="RO" offset="0x4.0" size="0x0.16" /> <field name="read_length" descr="Number of bytes requested. The device returns the number \;of bytes actually read." access="RW" offset="0x8.0" size="0x0.16" /> <field name="read_offset" descr="Offset in bytes of the first byte requested to read." access="INDEX" offset="0x8.16" size="0x0.16" /> @@ -1217,7 +1213,7 @@ <node name="mtbr_reg_ext" descr="" size="0x18.0" > <field name="base_sensor_index" descr="Base sensor index\;Sensors are read starting from \;base_sensor_index\;Sensor 0 is the ASIC sensor, sensors 1-63 are ambient sensors and \;sensors 64-127 are mapped to the SFP+/QSFP modules sequen\;tially (module 0 is mapped to sensor 64, module 1 to sensor 65 \;and so on). Gearbox sensors starts from 256 index." access="INDEX" offset="0x0.0" size="0x0.12" /> <field name="num_rec" descr="Number of records to read\;Range 1..255" access="OP" offset="0x4.0" size="0x0.8" /> - <field name="temperature_record" descr="Temperature record\;See \;Table 1194, "MTBR - Temperature Record Layout," on \;page 1342" subnode="mtbr_temp_record" access="RO" high_bound="1" low_bound="0" offset="0x10.0" size="0x8.0" /> + <field name="temperature_record" descr="Temperature record\;See \;Table 1229, "\;MTBR - Temperature Record Layout\;," on \;page 1481" subnode="mtbr_temp_record" access="RO" high_bound="1" low_bound="0" offset="0x10.0" size="0x8.0" /> </node> <node name="mtbr_temp_record" descr="" size="0x4.0" > @@ -1302,12 +1298,17 @@ <field name="sensor_name" descr="Sensor Name\;8 character long sensor name" subnode="uint64" access="RO" offset="0x10.0" size="0x8.0" /> </node> +<node name="ncfg_reg_ext" descr="" size="0x40.0" > + <field name="field_select" descr="In Query, indicates which fields are supported.\;In Write, indicates which field to modify.\;Bit 0x0: \;roce_offload_disable" subnode="uint64" access="RW" offset="0x0.0" size="0x8.0" /> + <field name="roce_offload_disable" descr="If set, then ROCE is disabled for PF and VFs/SFs belong \;to it." access="RW" offset="0x8.0" size="0x0.1" /> +</node> + <node name="paos_reg_ext" descr="" size="0x10.0" > <field name="oper_status" descr="Port operational state:\;1: up\;2: down\;4: down_by_port_failure - (transitioned by the hardware)" access="RO" offset="0x0.0" size="0x0.4" /> <field name="admin_status" descr="Port administrative state (the desired state of the interface):\;1: up\;2: down_by_configuration\;3: up_once - if the port goes up and then down, the operational \;status should go to "down by port failure" and can only go back \;up upon explicit command\;4: disabled_by_system - this mode cannot be set by the software, \;only by the hardware." access="RW" enum="up=0x1,down_by_configuration=0x2,up_once=0x3,disabled_by_system=0x4" offset="0x0.8" size="0x0.4" /> <field name="local_port" descr="Local port number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="swid" descr="For HCA: must always be 0.\;Switch partition ID with which to associate the port.\;Switch partitions are numbered from 0 to 7 inclusively.\;The \;swid\; field is only valid when the \;local_port\; is the router port. \;In this case, the \;swid\; indicates which of the router ports to config\;ure/query." access="INDEX" offset="0x0.24" size="0x0.8" /> - <field name="e" descr="Event generation on operational state change:\;0: Do_not_generate_event\;1: Generate_Event \;2: Generate_Single_Event\;Not Supported for HCA." access="RW" offset="0x4.0" size="0x0.2" /> + <field name="e" descr="Event generation on operational state change:\;0: Do_not_generate_event\;1: Generate_Event \;2: Generate_Single_Event\;Not Supported for HCA." access="RW" enum="Do_not_generate_event=0x0,Generate_Event=0x1,Generate_Single_Event=0x2" offset="0x4.0" size="0x0.2" /> <field name="ee" descr="Event update enable. If this bit is set, event generation will be \;updated based on the \;e\; field. Only relevant on Set operations.\;Not Supported for HCA." access="WO" offset="0x4.30" size="0x0.1" /> <field name="ase" descr="Admin state update enable. If this bit is set, admin state will be \;updated based on \;admin_state\; field. Only relevant on Set() opera\;tions." access="WO" offset="0x4.31" size="0x0.1" /> </node> @@ -1316,10 +1317,10 @@ <field name="local_port" descr="Local port number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="xoff_refresh" descr="The time before a new pause frame should be sent to refresh the pause \;state. Using the same units as xoff_timer_value above." access="RW" offset="0x4.0" size="0x0.16" /> <field name="xoff_timer_value" descr="When device generates a pause frame, it uses this value as the pause \;timer.\;The pause timer is measured in units of pause "quanta", where each unit \;is equal to 512 bit times." access="RW" offset="0x4.16" size="0x0.16" /> - <field name="port_buffer_size" descr="Total packet buffer array available for the port. The sum of buffer array \;allocated to bufferX must not exceed port_buffer_size.\;In Spectrum this field is reserved.\;Units are represented in cells" access="RO" offset="0x8.0" size="0x0.16" /> + <field name="port_buffer_size" descr="Total packet buffer array available for the port. The sum of buffer array \;allocated to bufferX must not exceed port_buffer_size.\;In Spectrum and above- Max supported Headroom buffer for port." access="RO" offset="0x8.0" size="0x0.16" /> <field name="fullness_threshold" descr="Almost full threshold configuration.\;Percentage of buffer fullness which indicates "almost full" occurrence\;Range: 0-100%\;Reserved for Switches." access="RW" offset="0x8.16" size="0x0.7" /> <field name="buffer" descr="Configuring per-buffer parameters. i=0..9" subnode="bufferx_reg" access="RW" high_bound="9" low_bound="0" offset="0xC.0" size="0x50.0" /> - <field name="port_shared_buffer" descr="Configuring port shared buffer parameters. Using the same layout as in \;BufferX, for details see \;Table 921, "bufferX Register Layout," on \;page 1102\;.\;Not supported in SwitchX and SwitchX-2\;Valid for HCA when pbmc_port_shared_buffer is set in PCAM." subnode="uint64" access="RW" offset="0x64.0" size="0x8.0" /> + <field name="port_shared_buffer" descr="Configuring port shared buffer parameters. Using the same layout as in \;BufferX, for details see \;Table 944, "\;bufferX Register Layout\;," on \;page 1225\;.\;Not supported in SwitchX and SwitchX-2\;Valid for HCA when pbmc_port_shared_buffer is set in PCAM." subnode="uint64" access="RW" offset="0x64.0" size="0x8.0" /> </node> <node name="pcam_reg_ext" descr="" size="0x50.0" > @@ -1410,7 +1411,7 @@ </node> <node name="pddr_advanced_opcode_ext" descr="" size="0x4.0" > - <field name="advanced_opcode" descr="Status opcode: \;PHY FW indication (0 - 1023):\;0 - No issue observed\;1 - Port is close by command (see PAOS).\;2 - AN no partner detected.\;3 - AN ack not received. \;4 - AN next-page exchange failed. \;5 - KR frame lock not acquired.\;6 - KR link inhibit timeout \;7 - KR Link partner didn't set receiver ready\;8 - KR tuning didn't completed \;9 - PCS didn't acquire block lock. \;10 - PCS didn't acquire AM lock (NO FEC) \;11 - PCS didn't get align_status.\;12 - FC FEC isn't locked\;13 - RS FEC isn't locked\;14 - Remote fault received\;15 - Bad Signal integrity \;16 - Compliance code mismatch (protocol mismatch between cable and port)\;17 - Large number of physical errors (high BER). \;18 - Port is disabled by Ekey\;19- Phase EO failure\;20- stamping of Non Mellanox Cables/Modules\;21 - Down by PortInfo MAD\;22 - Disabled by Verification\;23 - Calibration failure\;24 - EDR speed is not allowed due to cable stamping: EDR stamping\;25 - FDR10 speed is not allowed due to cable stamping: FDR10 stamping\;26 - Port is closed due to cable stamping: Ethernet_compliace_code_zero\;27 - Port is closed due to cable stamping: 56GE stamping\;28 - Port is closed due to cable stamping: non-Mellanox QSFP28\;29 - Port is closed due to cable stamping: non-Mellanox SFP28\;30 - Port is closed, no backplane enabled speed over backplane channel\;31 - Port is closed, no passive protocol enabled over passive copper channel\;32 - Port is closed, no active protocol enabled over active channel\;33 - Port width is doesn't match the port speed enabled\;34 - Local speed degradation\;35 - Remote speed degradation\;36 - No Partner detected during force mode. \;37 - Partial link indication during force mode. \;38 - AN Failure - FEC mismatch during override \;39 - AN Failure - No HCD\;40 - VPI protocol don't match\;41 - Port is closed, module can't be set to the enabled rate\;42 - Bad SI, cable is configured to non optimal rate \;1023- Info not available\;MNG FW issues (1024 - 2047):\;1024 - Cable is unplugged/powered off\;1025 - \;Long Range for non MLNX cable/module .\;1026 - \;Bus stuck (I2C Data or clock shorted) \;1027 - \;bad/unsupported EEPROM \;1028 - \;part number list\;1029 - \;unsupported cable.\;1030 - module temperature shutdown\;1031 - Shorted cable\;1032 - \;Power Budget Exceeded\;1033 - Management force down the port\;1034 - Module is disabled by command\;1035 - System Power is Exceeded therefore the module is powered off. \;Core/Driver (2048 - 3072):" access="RW" offset="0x0.0" size="0x0.16" /> + <field name="advanced_opcode" descr="Status opcode: \;PHY FW indication (0 - 1023):\;0 - No issue observed\;1 - Port is close by command (see PAOS).\;2 - AN no partner detected.\;3 - AN ack not received. \;4 - AN next-page exchange failed. \;5 - KR frame lock not acquired.\;6 - KR link inhibit timeout \;7 - KR Link partner didn't set receiver ready\;8 - KR tuning didn't completed \;9 - PCS didn't acquire block lock. \;10 - PCS didn't acquire AM lock (NO FEC) \;11 - PCS didn't get align_status.\;12 - FC FEC isn't locked\;13 - RS FEC isn't locked\;14 - Remote fault received\;15 - Bad Signal integrity \;16 - Compliance code mismatch (protocol mismatch between cable and port)\;17 - Large number of physical errors (high BER). \;18 - Port is disabled by Ekey\;19- Phase EO failure\;20- stamping of Non Mellanox Cables/Modules\;21 - Down by PortInfo MAD\;22 - Disabled by Verification\;23 - Calibration failure\;24 - EDR speed is not allowed due to cable stamping: EDR stamping\;25 - FDR10 speed is not allowed due to cable stamping: FDR10 stamping\;26 - Port is closed due to cable stamping: Ethernet_compliace_code_zero\;27 - Port is closed due to cable stamping: 56GE stamping\;28 - Port is closed due to cable stamping: non-Mellanox QSFP28\;29 - Port is closed due to cable stamping: non-Mellanox SFP28\;30 - Port is closed, no backplane enabled speed over backplane channel\;31 - Port is closed, no passive protocol enabled over passive copper channel\;32 - Port is closed, no active protocol enabled over active channel\;33 - Port width is doesn't match the port speed enabled\;34 - Local speed degradation\;35 - Remote speed degradation\;36 - No Partner detected during force mode. \;37 - Partial link indication during force mode. \;38 - AN Failure - FEC mismatch during override \;39 - AN Failure - No HCD\;40 - VPI protocol don't match\;41 - Port is closed, module can't be set to the enabled rate\;42 - Bad SI, cable is configured to non optimal rate \;128 - Troubleshooting in process\;1023- Info not available\;MNG FW issues (1024 - 2047):\;1024 - Cable is unplugged/powered off\;1025 - \;Long Range for non MLNX cable/module .\;1026 - \;Bus stuck (I2C Data or clock shorted) \;1027 - \;bad/unsupported EEPROM \;1028 - \;part number list\;1029 - \;unsupported cable.\;1030 - module temperature shutdown\;1031 - Shorted cable\;1032 - \;Power Budget Exceeded\;1033 - Management force down the port\;1034 - Module is disabled by command\;1035 - System Power is Exceeded therefore the module is powered off. \;1036 - Module's PMD type is not enabled (see PMTPS).\;Core/Driver (2048 - 3072):" access="RW" offset="0x0.0" size="0x0.16" /> </node> <node name="pddr_device_events_page_ext" descr="" size="0xf8.0" > @@ -1525,7 +1526,7 @@ </node> <node name="pddr_monitor_opcode_ext" descr="" size="0x4.0" > - <field name="monitor_opcode" descr="Status opcode: \;PHY FW indication (0 - 1023):\;0 - No issue observed\;1 - Port is close by command (see PAOS).\;2,3,4,38,39 - AN failure \;5,6,7,8 - Link training failure. \;9,10,11,12,13 - Logical mismatch between link partners\;14 - Remote fault received\;15,42 - Bad signal integrity \;16,24-32 - Cable compliance code mismatch (protocol mismatch \;between cable and port) \;23,22,19,18,17- Internal error\;34,35 - Speed degradation\;1023- Info not available\;MNG FW issues (1024 - 2047):\;1024 - Cable is unplugged\;1025 - \;Long Range for non Mellanox cable/module .\;1026 - \;Bus stuck (I2C Data or clock shorted) \;1027 - \;Bad/unsupported EEPROM \;1028 - \;Part number list\;1029 - \;Unsupported cable.\;1030 - Module temperature shutdown\;1031 - Shorted cable\;1032 - \;Power budget exceeded\;1033 - Management forced down the port\;1034 - Module is disabled by command\;Core/Driver (2048 - 3071):" access="RW" offset="0x0.0" size="0x0.16" /> + <field name="monitor_opcode" descr="Status opcode: \;PHY FW indication (0 - 1023):\;0 - No issue observed\;1 - Port is close by command (see PAOS).\;2,3,4,38,39 - AN failure \;5,6,7,8 - Link training failure. \;9,10,11,12,13 - Logical mismatch between link partners\;14 - Remote fault received\;15,42\;,17\; - Bad signal integrity \;16,24-32 - Cable compliance code mismatch (protocol mismatch \;between cable and port) \;23,22,19,18\;- Internal error\;34,35 - Speed degradation\;128 - Troubleshooting in process\;1023- Info not available\;MNG FW issues (1024 - 2047):\;1024 - Cable is unplugged\;1025 - \;Long Range for non Mellanox cable/module .\;1026 - \;Bus stuck (I2C Data or clock shorted) \;1027 - \;Bad/unsupported EEPROM \;1028 - \;Part number list\;1029 - \;Unsupported cable.\;1030 - Module temperature shutdown\;1031 - Shorted cable\;1032 - \;Power budget exceeded\;1033 - Management forced down the port\;1034 - Module is disabled by command\;1036 - Module's \;PMD type is not enabled (see PMTPS).\;Core/Driver (2048 - 3071):" access="RW" offset="0x0.0" size="0x0.16" /> </node> <node name="pddr_operation_info_page_ext" descr="" size="0xf8.0" > @@ -1609,7 +1610,7 @@ <field name="pnat" descr="Port number access type. determines the way \;local_port\; \;is inter\;preted:\;0: Local_port_number\;1: IB_or_label_port_number" access="INDEX" offset="0x0.14" size="0x0.2" /> <field name="local_port" descr="Local port number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="page_select" descr="page select index:\;0: Operational_info_page\;1: Troubleshooting_info_page\;2: Phy_info_page - [Internal]\;3: Module_info_page\;4: port_events_page - [internal]\;5: device_events_page - [internal]\;6: link_down_info - [EMC only]\;7: link_down-events - [internal]\;8: Link_up_info - [Internal]" access="INDEX" offset="0x4.0" size="0x0.8" /> - <field name="page_data" descr="See Table 1034, "Operation Info Page Layout," on page 1203\;See Table 1036, "Phy info page layout," on page 1208\;See Table 1044, "Troubleshooting info Page layout," on page 1223\;See Table 1042, "Module Info Page Layout," on page 1217\;See Table 1052, \;"Device events Page Layout," on page 1230\;See Table 1050, "Port events Page Layout," on page 1227\;See Table 1038, "Link down info page layout," on page 1214\;See Table 1040, "Link down events page layout," on page 1216\;See Table 1054, "Link Up Info Page Layout," on page 1233" subnode="pddr_reg_page_data_auto_ext" access="RO" offset="0x8.0" size="0xf8.0" /> + <field name="page_data" descr="See Table 1053, "\;Operation Info Page Layout\;," on page 1316\;See Table 1055, "\;Phy info page layout\;," on page 1320\;See Table 1063, "\;Troubleshooting info Page layout\;," on page 1336\;See Table 1061, "Module Info Page Layout," on page 1330\;See \;Table 1071, "Device events Page Layout," on page 1343\;See Table 1069, "\;Port events Page Layout\;," on page 1340\;See Table 1057, "\;Link down info page layout\;," on page 1327\;See Table 1059, "\;Link down events page layout\;," on page 1329\;See Table 1073, "\;Link Up Info Page Layout\;," on page 1346" subnode="pddr_reg_page_data_auto_ext" access="RO" offset="0x8.0" size="0xf8.0" /> </node> <node name="pddr_reg_page_data_auto_ext" descr="" attr_is_union="1" size="0xf8.0" > @@ -1626,7 +1627,7 @@ <node name="pddr_troubleshooting_page_ext" descr="" size="0xf8.0" > <field name="group_opcode" descr="0 - Monitor opcodes\;[Internal] 1 - Advanced debug opcodes" access="INDEX" offset="0x0.0" size="0x0.16" /> - <field name="status_opcode" descr="Status opcode described in:\;See Table 1046, "PDDR - Monitor opcodes layout," on page 1224\;[Internal] \;See Table 1048, "PDDR - Advanced opcodes layout," on \;page 1225" subnode="pddr_troubleshooting_page_status_opcode_auto_ext" access="RO" offset="0x4.0" size="0x4.0" /> + <field name="status_opcode" descr="Status opcode described in:\;See Table 1065, "\;PDDR - Monitor opcodes layout\;," on page 1337\;[Internal] \;See Table 1067, "\;PDDR - Advanced opcodes layout\;," on \;page 1338" subnode="pddr_troubleshooting_page_status_opcode_auto_ext" access="RO" offset="0x4.0" size="0x4.0" /> <field name="status_message" descr="ASCII code message\;All Messages are terminated by a Null character '\0'" access="RO" high_bound="58" low_bound="0" offset="0xC.0" size="0xec.0" /> </node> @@ -1742,7 +1743,7 @@ <field name="module" descr="Module number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="rst" descr="Module Reset toggle\;NOTE: setting reset while module is plugged-in will result in tran\;sition of \;oper_status\; to initialization." access="OP" offset="0x0.31" size="0x0.1" /> <field name="e" descr="Event Generation on operational state change:\;00 - Do not generate event\;01 - Generate Event \;10 - Generate Single Event" access="RW" offset="0x4.0" size="0x0.2" /> - <field name="error_type" descr="Module error details:\;0x0 - Power Budget Exceeded\;0x1 - Long Range for non MLNX cable/module\;0x2 - Bus stuck (I2C Data or clock shorted)\;0x3 - bad/ unsupported EEPROM\;0x4 - Enforce part number list. \;0x5 - unsupported cable\;0x6 - High Temperature\;0x7 - bad cable (Module/Cable is shorted)\;Valid only when \;oper_status \;= 4'b0011." access="RO" offset="0x4.8" size="0x0.4" /> + <field name="error_type" descr="Module error details:\;0x0\;:\; Power\;_\;Budget\;_\;Exceeded\;0x1\;: \;Long\;_\;Range\;_\;for\;_\;non\;_\;MLNX\;_\;cable\;_or_\;module\;0x2\;: \;Bus\;_\;stuck\; - \;(I2C Data or clock shorted)\;0x3\;: \;bad\;_or_\;unsupported\;_\;EEPROM\;0x4\;: \;Enforce\;_\;part\;_\;number\;_\;list\;0x5\;: \;unsupported\;_\;cable\;0x6\;: \;High\;_\;Temperature\;0x7\;: \;bad\;_\;cable\; - \;(Module/Cable is shorted)\;0x8: PMD_type_is_not_enabled - (see PMTPS).\;Valid only when \;oper_status \;= 4'b0011." access="RO" enum="Power_Budget_Exceeded=0x0,Long_Range_for_non_MLNX_cable_or_module=0x1,Bus_stuck=0x2,bad_or_unsupported_EEPROM=0x3,Enforce_part_number_list=0x4,unsupported_cable=0x5,High_Temperature=0x6,bad_cable=0x7,PMD_type_is_not_enabled=0x8" offset="0x4.8" size="0x0.4" /> <field name="ee" descr="Event update enable. If this bit is set, event generation will be \;updated based on the \;e\; field. Only relevant on Set operations." access="WO" offset="0x4.30" size="0x0.1" /> <field name="ase" descr="Admin state update enable. If this bit is set, admin state will be \;updated based on \;admin_state\; field. Only relevant on Set() opera\;tions." access="WO" offset="0x4.31" size="0x0.1" /> </node> @@ -1782,8 +1783,8 @@ <field name="module" descr="Module number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="eeprom_override" descr="Override/ignore EEPROM advertisement properties bitmask: \;Bit 0 - Override cable protocols and technology for QSFP\;Bit 1 - Override cable protocols and technology for SFP\;Bit 2- Ignore Power Class (set high power)\;Bit 3- Override Cable Length \;Bit 4- Override Attenuation\;Bit 8 - Set Module to Low Power" access="RW" offset="0x4.0" size="0x0.16" /> <field name="eeprom_override_mask" descr="Write Mask bit (negative polarity):\;0 - allow write\;1 - ignore write\;On write commands, indicates which of the bits from \;eeprom_override\; \;field are updated.\;Reserved on read operations." access="WO" offset="0x4.16" size="0x0.16" /> - <field name="qsfp_cable_protocol_technology" descr="Valid only when the protocols and technology is overridden as indicated by \;eeprom_override\;See Table 903, "PMMP - QSFP Protocol Bytes Override Layout," on \;page 1085" subnode="pmmp_reg_qsfp_cable_protocol_technology_auto_ext" access="RW" offset="0x8.0" size="0xc.0" /> - <field name="sfp_cable_protocol_technology" descr="Valid only when the protocols and technology is overridden as indicated by \;eeprom_override\;See Table 905, "PMMP - SFP Protocol Bytes Override Layout," on \;page 1087" subnode="pmmp_reg_sfp_cable_protocol_technology_auto_ext" access="RW" offset="0x14.0" size="0xc.0" /> + <field name="qsfp_cable_protocol_technology" descr="Valid only when the protocols and technology is overridden as indicated by \;eeprom_override\;See Table 928, "\;PMMP - QSFP Protocol Bytes Override Layout\;," on \;page 1209" subnode="pmmp_reg_qsfp_cable_protocol_technology_auto_ext" access="RW" offset="0x8.0" size="0xc.0" /> + <field name="sfp_cable_protocol_technology" descr="Valid only when the protocols and technology is overridden as indicated by \;eeprom_override\;See Table 930, "\;PMMP - SFP Protocol Bytes Override Layout\;," on \;page 1211" subnode="pmmp_reg_sfp_cable_protocol_technology_auto_ext" access="RW" offset="0x14.0" size="0xc.0" /> <field name="cable_length" descr="Length of cable assembly, units of 1 m.\;Valid only when the cable length is overridden as indicated by \;eeprom_override." access="RW" offset="0x20.0" size="0x0.8" /> <field name="attenuation_5g" descr="Valid only when the attenuation is overridden as indicated by \;eeprom_override.\;Attenuation - total channel attenuation @ 5GHz in db." access="RW" offset="0x24.0" size="0x0.8" /> <field name="attenuation_7g" descr="Valid only when the attenuation is overridden as indicated by \;eeprom_override.\;Attenuation - total channel attenuation @ 7GHz in db." access="RW" offset="0x24.8" size="0x0.8" /> @@ -1814,15 +1815,15 @@ </node> <node name="ppad_reg_ext" descr="" size="0x10.0" > - <field name="mac_47_32" descr="If \;single_base_mac\; = 0 - base MAC address, mac[7:0] is \;reserved.\;If \;single_base_mac\; = 1 - the per port MAC address" access="RW" offset="0x0.0" size="0x0.16" /> + <field name="mac_47_32" descr="If \;single_base_mac\; = 0 - base MAC address, \;For Spectrum \;mac[\;5\;:0] is reserved.\;For Spectrum-2 mac[6:0] is reserved.\;If \;single_base_mac\; = 1 - the per port MAC address" access="RW" offset="0x0.0" size="0x0.16" /> <field name="local_port" descr="Port number\;Reserved when \;single_base_mac\; = 0" access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="single_base_mac" descr="0 - base_mac, \;local_port \;should be 0 and mac[7:0] is \;reserved.HW will set incremental \;1 - single_mac - mac of the \;local_port\;Reserved for \;SwitchX/-2." access="OP" offset="0x0.28" size="0x0.1" /> - <field name="mac_31_0" descr="If \;single_base_mac\; = 0 - base MAC address, mac[7:0] is \;reserved.\;If \;single_base_mac\; = 1 - the per port MAC address" access="RW" offset="0x4.0" size="0x4.0" /> + <field name="single_base_mac" descr="0 - base_mac, \;local_port \;should be 0 and mac[\;6\;:0]\;and mac \;[5:0]\; \;are \;reserved\; in Spectrum-2 and Spectrum-1 accor\;dantly\;.HW will set incremental \;1 - single_mac - mac of the \;local_port\;Reserved for \;SwitchX/-2." access="OP" offset="0x0.28" size="0x0.1" /> + <field name="mac_31_0" descr="If \;single_base_mac\; = 0 - base MAC address, \;For Spectrum \;mac[\;5\;:0] is reserved.\;For Spectrum-2 mac[6:0] is reserved.\;If \;single_base_mac\; = 1 - the per port MAC address" access="RW" offset="0x4.0" size="0x4.0" /> </node> <node name="ppaos_reg_ext" descr="" size="0x10.0" > - <field name="phy_test_mode_status" descr="Port extended down status:\;0 - regular operation (port down/up according to PAOS) \;1 - phy test mode\;phy test mode\; can be valid only when \;PAOS.admin_status\;=2 and \;PAOS.oper_status\;=2 (i.e port is down)." access="RO" offset="0x0.0" size="0x0.4" /> - <field name="phy_test_mode_admin" descr="Port extended administrative down status:\;0 - regular operation (port down/up according to PAOS) \;1 - phy test mode \;The phy test mode (1) can be set only when \;PAOS.admin_sta\;tus\;=2 (i.e port configuration is down)." access="RW" offset="0x0.8" size="0x0.4" /> + <field name="phy_test_mode_status" descr="Port extended down status:\;0\;:\; regular\;_\;operation\; - \;(port down/up according to PAOS) \;1\;: \;phy\;_\;test\;_\;mode\;phy test mode\; can be valid only when \;PAOS.admin_status\;=2 and \;PAOS.oper_status\;=2 (i.e port is down)." access="RO" enum="regular_operation=0x0,phy_test_mode=0x1" offset="0x0.0" size="0x0.4" /> + <field name="phy_test_mode_admin" descr="Port extended administrative down status:\;0\;: \;regular\;_\;operation (port down/up according to PAOS) \;1\;:\; phy\;_\;test\;_\;mode \;The phy test mode (1) can be set only when \;PAOS.admin_sta\;tus\;=2 (i.e port configuration is down)." access="RW" offset="0x0.8" size="0x0.4" /> <field name="local_port" descr="Local port number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="swid" descr="For HCA: must always be 0.\;Switch partition ID with which to associate the port.\;Switch partitions are numbered from 0 to 7 inclusively.\;The \;swid\; field is only valid when the \;local_port\; is the router port. \;In this case, the \;swid\; indicates which of the router ports to config\;ure/query." access="INDEX" offset="0x0.24" size="0x0.8" /> </node> @@ -1866,13 +1867,13 @@ </node> <node name="ppcnt_reg_ext" descr="" size="0x100.0" > - <field name="grp" descr="Performance counter group.\;Group 63 indicates all groups (include all per priority/TC/Receive Buffer \;counters). Only valid on Set() operation with \;clr\; bit set.\;0x0: IEEE 802.3 Counters\;0x1: RFC 2863 Counters\;0x2: RFC 2819 Counters\;0x3: RFC 3635 Counters\;0x5: Ethernet Extended Counters\;0x6: Ethernet Discard Counters \;[Internal] 0x8: Link Level Retransmission Counters\;0x10: Per Priority Counters \;0x11: Per Traffic Class Counters. \;0x12: Physical Layer Counters\;0x13: Per Traffic Class Congestion Counters\;[Internal] 0x15: Per Receive Buffer counter\;0x16: Physical Layer Statistical Counters\;[Internal]: 0x19: Out of Band PortCounters. Note: This group is valid only \;for OOB ports.\;0x20: InfiniBand PortCounters\;0x21: InfiniBand Extended PortCounters\;[Internal] 0x22: PLR counters group\;[Internal] 0x23: RS-FEC Histogram group" access="INDEX" offset="0x0.0" size="0x0.6" /> + <field name="grp" descr="Performance counter group.\;Group 63 indicates all groups (include all per priority/TC/Receive Buffer \;counters). Only valid on Set() operation with \;clr\; bit set.\;0x0: IEEE 802.3 Counters\;0x1: RFC 2863 Counters\;0x2: RFC 2819 Counters\;0x3: RFC 3635 Counters\;0x5: Ethernet Extended Counters\;0x6: Ethernet Discard Counters \;[Internal] 0x8: Link Level Retransmission Counters\;0x10: Per Priority Counters \;0x11: Per Traffic Class Counters. \;0x12: Physical Layer Counters\;0x13: Per Traffic Class Congestion Counters\;[Internal] 0x15: Per Receive Buffer counter\;0x16: Physical Layer Statistical Counters\;[Internal]: 0x19: Out of Band PortCounters. Note: This group is valid only \;for OOB ports.\;0x20: InfiniBand PortCounters\;0x21: InfiniBand Extended PortCounters\;0x22: PLR counters group\;[Internal] 0x23: RS-FEC Histogram group" access="INDEX" offset="0x0.0" size="0x0.6" /> <field name="pnat" descr="Port number access type:\;0: Local_port_number\;1: IB_port_number\;2: host_port_number\;3: OOB_port_number - Internal\;Note - \;pnat=2 is supported for "Per Traffic Class Congestion Counters" and \;"Per Traffic Class Counters" groups." access="INDEX" enum="Local_port_number=0x0,IB_port_number=0x1,host_port_number=0x2,OOB_port_number=0x3" offset="0x0.14" size="0x0.2" /> <field name="local_port" descr="Local port number. \;255 indicates all ports on the device, and is only allowed for Set() operation." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="swid" descr="For HCA: must be always 0.\;Switch partition ID to associate port with.\;Switch partitions are numbered from 0 to 7 inclusively.\;Switch partition 254 indicates stacking ports.\;Switch partition 255 indicates all switch partitions.\;Only valid on Set() operation with local_port=255." access="INDEX" offset="0x0.24" size="0x0.8" /> <field name="prio_tc" descr="Priority index for per priority counter sets, valid values: 0-7\;For Spectrum-2 and on at tx side range can be 0 .. \;cap_max_tclass_data\;-1, \;see QGCR.\;tx_cnt_tclass\;Traffic class index for per traffic class counter set, valid values: \;For Switches, valid values: 0 .. \;cap_max_tclass_data\;-1 \;For HCA, valid values: 0.. \;HCA_CAP.max_tc\;Otherwise must be 0." access="INDEX" offset="0x4.0" size="0x0.5" /> <field name="clr" descr="Clear counters. Setting the \;clr\; bit will reset the counter value for all counters \;in the counter group. This bit can be set for both Set() and Get() operation." access="OP" offset="0x4.31" size="0x0.1" /> - <field name="counter_set" descr="Counter set as described in\;See Table 853, "Ethernet IEEE 802.3 Counters Group Data Layout," on \;page 1030\;See Table 855, "Ethernet RFC 2863 Counter Group Data Layout," on \;page 1034\;See Table 857, "Ethernet RFC 2819 Counter Group Data Layout," on \;page 1037\;See Table 859, "Ethernet RFC 3635 Counter Group Data Layout," on \;page 1041\;See Table 861, "Ethernet Extended Counter Group Data Layout," on \;page 1045\;See Table 864, "Ethernet Discard Counter Group Fields," on page 1050\;See Table 865, "Ethernet Per Priority Group Data Layout," on page 1051\;See Table 869, "Ethernet Per Traffic Class Group data layout," on \;page 1058\;See Table 871, "Ethernet Per Traffic Class Congestion Group data layout," \;on page 1059\;See Table 875, "Link Level Retransmission Counter Group Data Layout," \;on page 1060\;See Table 877, "InfiniBand PortCounters Attribute Group Data Layout," on \;page 1061\;See Table 881, "Physical Layer Counters Data Layout," on page 1067\;See Table 883, "Physical Layer Statistical Counters Data Layout," on \;page 1071\; \;[Internal] \;See Table 885, "PLR Counters Data Layout," on page 1074\;[Internal] \;See Table 887, "RS-Histograms Data Layout," on page 1075\;[Internal] \;See Table 867, "Ethernet OOB Port Counters Data Layout," on \;page 1055" subnode="ppcnt_reg_counter_set_auto_ext" access="RO" offset="0x8.0" size="0xf8.0" /> + <field name="counter_set" descr="Counter set as described in\;See Table 882, "\;Ethernet IEEE 802.3 Counters Group Data Layout\;," on \;page 1160\;See Table 884, "\;Ethernet RFC 2863 Counter Group Data Layout\;," on \;page 1164\;See Table 886, "\;Ethernet RFC 2819 Counter Group Data Layout\;," on \;page 1166\;See Table 888, "\;Ethernet RFC 3635 Counter Group Data Layout\;," on \;page 1170\;See Table 890, "\;Ethernet Extended Counter Group Data Layout\;," on \;page 1173\;See Table 893, "\;Ethernet Discard Counter Group Fields\;," on page 1178\;See Table 894, "\;Ethernet Per Priority Group Data Layout\;," on page 1179\;See Table 898, "\;Ethernet Per Traffic Class Group data layout\;," on \;page 1186\;See Table 900, "\;Ethernet Per Traffic Class \;Congestion \;Group data layout\;," \;on page 1186\;See Table 902, "\;Link Level Retransmission Counter Group Data Layout\;," \;on page 1187\;See Table 904, "\;InfiniBand PortCounters Attribute Group Data Layout\;," on \;page 1188\;See Table 908, "\;Physical Layer Counters Data Layout\;," on page 1193\;See Table 910, "Physical Layer Statistical Counters Data Layout," on \;page 1197\; \;[Internal] \;See Table 912, "PLR Counters Data Layout," on page 1199\;[Internal] \;See Table 914, "\;RS-Histograms Data Layout\;," on page 1201\;[Internal] \;See Table 896, "\;Ethernet OOB Port Counters Data Layout\;," on \;page 1183" subnode="ppcnt_reg_counter_set_auto_ext" access="RO" offset="0x8.0" size="0xf8.0" /> </node> <node name="ppcnt_rs_fec_histograms_counters_ext" descr="" size="0xf8.0" > @@ -1881,19 +1882,19 @@ <node name="pplm_reg_ext" descr="" size="0x40.0" > <field name="local_port" descr="Local port number" access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="fec_mode_active" descr="Active FEC (bitmask)\;0\;: \;No\;_\;FEC\;1\;: \;Firecode\;_\;FEC\;2\;: \;Standard\;_\;RS\;_\;FEC\; - \;RS(528,514)\;3\;:\; Standard\;_\;LL\;_\;RS-FEC - RS(271,257)\;4\;:\; Mellan\;o\;x\;_\;Strong\;_\;RS-FEC - RS(277,257)\; \;[Internal]\;5\;: \;Mellanox\;_\;LL\;_\;RS-FEC - RS(163,155)\; \;[Internal] \;6\;:\; Reserved\; - \;[Internal]\;7\;:\; Standard\;_\;RS-FEC \;- \;(544,514)\;8\;:\; Zero\;_\;Latency\;_\;FEC\; - [\;Internal] \;9\;:\; Ethernet\;_\;Consortium\;_\;LL\;_50G_\;RS-FEC\; - \;(272,257+1)\;12\;:\; RS-FEC\; \;-\; \;(544,514) + PLR\; \;[Internal] \;13\;:\; LL-FEC \;- \;(271,257) + PLR\; [Internal]" access="RO" enum="No_FEC=0x0,Firecode_FEC=0x1,Standard_RS_FEC=0x2,Standard_LL_RS=0x3,Mellanox_Strong_RS=0x4,Mellanox_LL_RS=0x5,Reserved=0x6,Standard_RS=0x7,Zero_Latency_FEC=0x8,Ethernet_Consortium_LL_50G_RS=0x9,RS=0xc,LL=0xd" offset="0xC.0" size="0x0.24" /> + <field name="fec_mode_active" descr="Active FEC (bitmask)\;0\;: \;No\;_\;FEC\;1\;: \;Firecode\;_\;FEC\;2\;: \;Standard\;_\;RS\;_\;FEC\; - \;RS(528,514)\;3\;:\; Standard\;_\;LL\;_\;RS-FEC - RS(271,257)\;4\;:\; Mellan\;o\;x\;_\;Strong\;_\;RS-FEC - RS(277,257)\; \;[Internal]\;5\;: \;Mellanox\;_\;LL\;_\;RS-FEC - RS(163,155)\; \;[Internal] \;6\;:\; Reserved\; - \;[Internal]\;7\;:\; Standard\;_\;RS-FEC \;- \;(544,514)\;8\;:\; Zero\;_\;Latency\;_\;FEC\; - [\;Internal] \;9\;:\; Ethernet\;_\;Consortium\;_\;LL\;_50G_\;RS-FEC\; - \;(272,257+1)\;12: RS-FEC\; \;-\; \;(544,514) + PLR [Internal] \;13: LL-FEC - (271,257) + PLR [Internal]" access="RO" enum="No_FEC=0x0,Firecode_FEC=0x1,Standard_RS_FEC=0x2,Standard_LL_RS=0x3,Mellanox_Strong_RS=0x4,Mellanox_LL_RS=0x5,Reserved=0x6,Standard_RS=0x7,Zero_Latency_FEC=0x8,Ethernet_Consortium_LL_50G_RS=0x9,RS=0xc,LL=0xd" offset="0xC.0" size="0x0.24" /> <field name="fec_override_cap_10g_40g" descr="10GE/40GE Ethernet FEC override capability bitmask:\;0\;:\; No-FEC\;1\;:\; Firecode\;_\;FEC\;2\;:\; Reserved\;2\;3\;:\; Reserved\;3" access="RO" enum="No=0x0,Firecode_FEC=0x1,Reserved2=0x2,Reserved3=0x3" offset="0x10.0" size="0x0.4" /> <field name="fec_override_cap_25g" descr="25GE Ethernet FEC override capability bitmask:\;0\;:\; No-FEC\;1\;:\; Firecode\;_\;FEC\;2\;:\; RS-FEC\;3\;:\; Reserved" access="RO" enum="No=0x0,Firecode_FEC=0x1,RS=0x2,Reserved=0x3" offset="0x10.4" size="0x0.4" /> <field name="fec_override_cap_50g" descr="50GE (2 lanes) Ethernet FEC override capability bitmask:\;0\;:\; No-FEC\;1\;:\; Firecode\;_\;FEC\;2\;:\; RS-FEC\;3\;:\; Reserved" access="RO" enum="No=0x0,Firecode_FEC=0x1,RS=0x2,Reserved=0x3" offset="0x10.8" size="0x0.4" /> <field name="fec_override_cap_100g" descr="100GE (4 lanes) Ethernet FEC override capability bitmask:\;0: No-FEC\;1: Reserved1\;2: RS-FEC - (528,514)\;3: Reserved3" access="RO" enum="No=0x0,Reserved1=0x1,RS=0x2,Reserved3=0x3" offset="0x10.12" size="0x0.4" /> <field name="fec_override_cap_56g" descr="56GE Ethernet FEC override capability bitmask:\;0\;:\; No-FEC\;1: Firecode_FEC\;2: Reserved2\;3: Reserved3" access="RO" enum="No=0x0,Firecode_FEC=0x1,Reserved2=0x2,Reserved3=0x3" offset="0x10.16" size="0x0.4" /> <field name="rs_fec_correction_bypass_cap" descr="RS-FEC correction bypass override capability:\;0\;: \;NO\;_\;correction\;_\;bypass\;1\;: \;RS-FEC\;_\;correction\;_\;bypass" access="RO" enum="NO_correction_bypass=0x0,RS=0x1" offset="0x10.28" size="0x0.4" /> - <field name="fec_override_admin_10g_40g" descr="10GE/40GE Ethernet FEC override admin, see 10g_40g_fec_override_cap.\;0\;: a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC" access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2" offset="0x14.0" size="0x0.4" /> - <field name="fec_override_admin_25g" descr="25GE Ethernet FEC override admin, see 25g_fec_override_cap.\;0\;: a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC\;4\;: \;RS-FEC\;Note - \;25g_fec_override_admin\; and \;50g_fec_override_admin\; must be set \;with the same value." access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2,RS=0x4" offset="0x14.4" size="0x0.4" /> - <field name="fec_override_admin_50g" descr="50GE Ethernet FEC override admin, see 50g_fec_override_cap.\;0\;: a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC\;4\;: \;RS-FEC\;Note - \;25g_fec_override_admin\; and \;50g_fec_override_admin\; must be set \;with the same value." access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2,RS=0x4" offset="0x14.8" size="0x0.4" /> - <field name="fec_override_admin_100g" descr="100GE Ethernet FEC override admin, see 100g_fec_override_cap.\;0\;:\; \;a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;4\;:\; RS-FEC" access="RW" enum="auto_mode=0x0,No_FEC=0x1,RS=0x4" offset="0x14.12" size="0x0.4" /> - <field name="fec_override_admin_56g" descr="56GE Ethernet FEC override admin, see 56g_fec_override_cap.\;0\;: a\;uto\;_mode - \;no override\;1\;:\; No\;_\;FEC\;2\;: \;Firecode\;_\;FEC" access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2" offset="0x14.16" size="0x0.4" /> - <field name="rs_fec_correction_bypass_admin" descr="RS-FEC correction bypass override admin:\;0\;:\; \;a\;uto\;_mode - \;no override \;1\;:\; NO\;_\;correction\;_\;bypass\;2\;: \;RS-FEC\;_\;correction\;_\;bypass" access="RW" enum="auto_mode=0x0,NO_correction_bypass=0x1,RS=0x2" offset="0x14.28" size="0x0.4" /> + <field name="fec_override_admin_10g_40g" descr="10GE/40GE Ethernet FEC override admin, see 10g_40g_fec_override_cap.\;(one-hot setting): \;0\;: a\;uto\;_mode - \;no override\;1: No_FEC\;2\;: \;Firecode\;_\;FEC" access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2" offset="0x14.0" size="0x0.4" /> + <field name="fec_override_admin_25g" descr="25GE Ethernet FEC override admin, see 25g_fec_override_cap.\; (one-hot \;setting): \;0\;: a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC\;4\;: \;RS-FEC\;Note - \;25g_fec_override_admin\; and \;50g_fec_override_admin\; must be set \;with the same value." access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2,RS=0x4" offset="0x14.4" size="0x0.4" /> + <field name="fec_override_admin_50g" descr="50GE Ethernet FEC override admin, see 50g_fec_override_cap.\; (one-hot \;setting): \;0\;: a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC\;4\;: \;RS-FEC\;Note - \;25g_fec_override_admin\; and \;50g_fec_override_admin\; must be set \;with the same value." access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2,RS=0x4" offset="0x14.8" size="0x0.4" /> + <field name="fec_override_admin_100g" descr="100GE Ethernet FEC override admin, see 100g_fec_override_cap.\; (one-hot \;setting): \;0\;:\; \;a\;uto\;_mode - \;no override\;1\;: \;No\;_\;FEC\;4\;:\; RS-FEC" access="RW" enum="auto_mode=0x0,No_FEC=0x1,RS=0x4" offset="0x14.12" size="0x0.4" /> + <field name="fec_override_admin_56g" descr="56GE Ethernet FEC override admin, see 56g_fec_override_cap.\; (one-hot \;setting): \;0\;: a\;uto\;_mode - \;no override\;1\;:\; No\;_\;FEC\;2\;: \;Firecode\;_\;FEC" access="RW" enum="auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2" offset="0x14.16" size="0x0.4" /> + <field name="rs_fec_correction_bypass_admin" descr="RS-FEC correction bypass override admin:\; (one-hot setting): \;0\;:\; \;a\;uto\;_mode - \;no override \;1\;:\; NO\;_\;correction\;_\;bypass\;2\;: \;RS-FEC\;_\;correction\;_\;bypass" access="RW" enum="auto_mode=0x0,NO_correction_bypass=0x1,RS=0x2" offset="0x14.28" size="0x0.4" /> <field name="fec_override_cap_200g_4x" descr="200GE FEC override capability bitmask:\;Bit 0 - Reserved \;Bit 1- Reserved \;Bit 2- Reserved \;Bit 3- Reserved \;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;Bit 9- 50G Ethernet Consortium LL RS-FEC (272,257+1)\;[Internal] Bit 12 - RS-FEC (544,514) + PLR\;[Internal] Bit 13 - LL-FEC (271,257) + PLR\;[Internal] Bit 14 - ELL (272,257+1) + PLR" access="RO" offset="0x18.0" size="0x0.16" /> <field name="fec_override_cap_400g_8x" descr="400GE FEC override capability bitmask:\;Bit 0 - Reserved \;Bit 1- Reserved \;Bit 2- Reserved \;Bit 3- Reserved\;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;Bit 9- 50G Ethernet Consortium LL RS-FEC (272,257+1)\;[Internal] Bit 12 - RS-FEC (544,514) + PLR\;[Internal] Bit 13 - LL-FEC (271,257) + PLR\;[Internal] Bit 14 - ELL (272,257+1) + PLR" access="RO" offset="0x18.16" size="0x0.16" /> <field name="fec_override_cap_50g_1x" descr="50GE single lane override capability bitmask:\;Bit 0 - Reserved \;Bit 1- Reserved \;Bit 2- Reserved \;Bit 3- Reserved \;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;Bit 9- 50G Ethernet Consortium LL RS-FEC (272,257+1)\;[Internal] Bit 12 - RS-FEC \;- \;(544,514) + PLR\;[Internal] Bit 13 - LL-FEC \;- \;(271,257) + PLR\;[Internal] Bit 14 - ELL \;- \;(272,257+1) + PLR" access="RO" offset="0x1C.0" size="0x0.16" /> @@ -1902,12 +1903,12 @@ <field name="fec_override_admin_400g_8x" descr="400GE FEC override admin bitmast (one-hot setting): \;0\;: \;Auto\;_\;mode\;7: RS-FEC_(544,514)\;8: Zero_Latency_FEC \;9: RS-FEC_(272,257+1)\;12: RS-FEC_(544,514)\; \;-\; \;+ PLR \;[Internal]\;13:\; \;LL-FEC_(271,257) - + PLR \;[Internal]\;14: LL-FEC_(272,257+1) - + PLR \;[Internal]" access="RW" offset="0x20.16" size="0x0.16" /> <field name="fec_override_admin_50g_1x" descr="50GE, 1lanes FEC override admin bitmask (one-hot setting)\;0 - Auto mode\;Bit 0 is set - NO-FEC \;Bit 1 is set - FC-FEC\;Bit 2 is set - RS-FEC (528,514)\;Bit 7 is set- RS-FEC (544,514)\;[Internal] Bit 8 is set - Zero Latency FEC \;Bit 9 is set - RS-FEC (272,257+1)\;[Internal] Bit 12 is set - RS-FEC (544,514) + PLR\;[Internal] Bit 13 is set -\; \;LL-FEC (271,257) + PLR \;[Internal] Bit 14 is set -\; \;LL-FEC (272,257+1) + PLR" access="RW" offset="0x24.0" size="0x0.16" /> <field name="fec_override_admin_100g_2x" descr="100GE, 2 lanes FEC override admin bitmask (one-hot setting):\;0: Auto_mode\;Bit 0 is set - Reserved\;Bit 2 is set - Reserved \;Bit 7 is set- RS-FEC (544,514)\;[Internal] Bit 8 is set - Zero Latency FEC \;Bit 9 is set - RS-FEC (272,257+1)\;[Internal] Bit 12 is set - RS-FEC (544,514) + PLR\;[Internal] Bit 13 is set -\; \;LL-FEC (271,257) + PLR \;[Internal] Bit 14 is set -\; \;LL-FEC (272,257+1) + PLR" access="RW" offset="0x24.16" size="0x0.16" /> - <field name="ib_fec_override_cap_edr" descr="EDR FEC override capability bitmask:\;Bit 0 - No-FEC \;Bit 1- Reserved\;Bit 2- RS-FEC (528,514)\;Bit 3- LL-FEC (271,257)\;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;[Internal] Bit 12 - RS-FEC (544,514) + PLR\;[Internal] Bit 13 - LL-FEC (271,257) + PLR" access="RO" offset="0x30.0" size="0x0.16" /> - <field name="ib_fec_override_cap_hdr" descr="HDR FEC override capability bitmask:\;Bit 0 - No-FEC \;Bit 1- Reserved \;Bit 2- Reserved \;Bit 3- LL-FEC (271,257)\;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;[Internal] Bit 12 - RS-FEC (544,514) + PLR\;[Internal] Bit 13 - LL-FEC (271,257) + PLR" access="RO" offset="0x30.16" size="0x0.16" /> + <field name="ib_fec_override_cap_edr" descr="EDR FEC override capability bitmask:\;Bit 0 - No-FEC \;Bit 1- Reserved\;Bit 2- RS-FEC (528,514)\;Bit 3- LL-FEC (271,257)\;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;[Internal]\;Bit 12 - RS-FEC (544,514) + PLR\;[Internal]\; Bit 13 - LL-FEC (271,257) + PLR" access="RO" offset="0x30.0" size="0x0.16" /> + <field name="ib_fec_override_cap_hdr" descr="HDR FEC override capability bitmask:\;Bit 0 - No-FEC \;Bit 1- Reserved \;Bit 2- Reserved \;Bit 3- LL-FEC (271,257)\;Bit 4- Reserved\;Bit 5- Reserved\;Bit 6- Reserved\;Bit 7 - RS-FEC (544,514)\;[Internal] Bit 8 - Zero Latency FEC\;Bit 12 - RS-FEC (544,514) + PLR\;Bit 13 - LL-FEC (271,257) + PLR" access="RO" offset="0x30.16" size="0x0.16" /> <field name="ib_fec_override_cap_fdr10" descr="FDR FEC10 override capability bitmask:\;Bit 0\;: \;No\;_\;FEC\;Bit 1\;: \;Firecode\;_\;FEC\;Bit 2-15: Reserved" access="RO" offset="0x34.0" size="0x0.16" /> <field name="ib_fec_override_cap_fdr" descr="FDR FEC override capability bitmask:\;Bit 0\;:\; No\;_\;FEC\;Bit 1\;:\; Firecode\;_\;FEC\;Bit 2-15: Reserved" access="RO" offset="0x34.16" size="0x0.16" /> <field name="ib_fec_override_admin_edr" descr="EDR FEC override admin bitmask:\;0 - Auto mode\;Bit 0 is set - No FEC\;Bit 4 is set- LL-FEC (271,257)\;Bit 7 is set- RS-FEC (544,514)\;[Internal] Bit 8 is set - Zero Latency FEC \;[Internal] Bit 12 is set - RS-FEC (544,514) + PLR\;[Internal] Bit 13 is set -\; \;LL-FEC (271,257) + PLR" access="RW" offset="0x38.0" size="0x0.16" /> - <field name="ib_fec_override_admin_hdr" descr="HDR FEC override admin bitmask:\;0 - Auto mode\;Bit 0 is set - No FEC\;Bit 4 is set- LL-FEC (271,257)\;Bit 7 is set- RS-FEC (544,514)\;[Internal] Bit 8 is set - Zero Latency FEC \;[Internal] Bit 12 is set - RS-FEC (544,514) + PLR\;[Internal] Bit 13 is set -\; \;LL-FEC (271,257) + PLR" access="RW" offset="0x38.16" size="0x0.16" /> + <field name="ib_fec_override_admin_hdr" descr="HDR FEC override admin bitmask:\;0 - Auto mode\;Bit 0 is set - No FEC\;Bit 4 is set- LL-FEC (271,257)\;Bit 7 is set- RS-FEC (544,514)\;[Internal] Bit 8 is set - Zero Latency FEC \;Bit 12 is set - RS-FEC (544,514) + PLR\;Bit 13 is set -\; \;LL-FEC (271,257) + PLR" access="RW" offset="0x38.16" size="0x0.16" /> <field name="ib_fec_override_admin_fdr10" descr="FDR FEC override admin bitmask:\;0\;:\;Auto\;_\;mode\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC" access="RW" enum="Auto_mode=0x0,No_FEC=0x1,Firecode_FEC=0x2" offset="0x3C.0" size="0x0.16" /> <field name="ib_fec_override_admin_fdr" descr="FDR FEC override admin bitmask:\;0\;: \;Auto\;_\;mode\;1\;: \;No\;_\;FEC\;2\;: \;Firecode\;_\;FEC" access="RW" offset="0x3C.16" size="0x0.16" /> </node> @@ -1970,9 +1971,9 @@ </node> <node name="prio_j" descr="" size="0x4.0" > - <field name="color2" descr="The DSCP mapping for color \;k\;, where k=0..2, see \;Table 685, \;"color<k>Layout"" access="RW" offset="0x0.8" size="0x0.8" /> - <field name="color1" descr="The DSCP mapping for color \;k\;, where k=0..2, see \;Table 685, \;"color<k>Layout"" access="RW" offset="0x0.16" size="0x0.8" /> - <field name="color0" descr="The DSCP mapping for color \;k\;, where k=0..2, see \;Table 685, \;"color<k>Layout"" access="RW" offset="0x0.24" size="0x0.8" /> + <field name="color2" descr="The DSCP mapping for color \;k\;, where k=0..2, see \;Table 708, \;"\;color<k>Layout\;"" access="RW" offset="0x0.8" size="0x0.8" /> + <field name="color1" descr="The DSCP mapping for color \;k\;, where k=0..2, see \;Table 708, \;"\;color<k>Layout\;"" access="RW" offset="0x0.16" size="0x0.8" /> + <field name="color0" descr="The DSCP mapping for color \;k\;, where k=0..2, see \;Table 708, \;"\;color<k>Layout\;"" access="RW" offset="0x0.24" size="0x0.8" /> </node> <node name="pter_phy_page_reg_ext" descr="" size="0x1c.0" > @@ -1987,7 +1988,7 @@ <node name="pter_port_page_reg_ext" descr="" size="0x1c.0" > <field name="error_type_admin" descr="Error Type to generate\;0 - No Error\;---- Port Errors ----\;1 - Corrupt data packet ICRC\;2 - Corrupt data packet VCRC\;4- Corrupt credit packet LPCRC" access="RW" offset="0x0.0" size="0x0.8" /> <field name="error_type_cap" descr="Error injection capabilities \;Bit 0- Corrupt data packet ICRC\;Bit 1- Corrupt data packet VCRC\;Bit 2- Corrupt credit packet LPCRC" access="RO" offset="0x0.8" size="0x0.8" /> - <field name="error_count" descr="Error Count\;Number of times the port will generate the configured error.\;0 indicates not to generate error.\;Reading \;error_count\; will return the number of left errors to inject. When \;0, all requested errors has been injected." access="RW" offset="0x4.12" size="0x0.16" /> + <field name="error_count" descr="Error Count\;Number of times the port will generate the configured error.\;0 indicates not to generate error.\;Reading \;error_count\; will return the number of left errors to inject. When \;0, all requested errors has been injected." access="RW" offset="0x4.12" size="0x0.5" /> </node> <node name="pter_reg_ext" descr="" size="0x20.0" > @@ -1995,7 +1996,7 @@ <field name="pnat" descr="Port number access type. determines the way \;local_port\; \;is interpreted:\;0 - Local port number\;1 - IB / label port number" access="INDEX" offset="0x0.14" size="0x0.2" /> <field name="local_port" descr="Local port number" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="error_page" descr="Error_page selection: \;0 - Injection of Phy Errors\;1 - Injection of Port Errors" access="INDEX" offset="0x0.24" size="0x0.4" /> - <field name="page_data" descr="error injection page data: \;See Table 951, "PTER- Port Transmit Errors Register Phy Level Layout," \;on page 1123\;See Table 953, "PTER- Port Transmit Errors Register Port Level Fields," \;on page 1124" subnode="pter_reg_page_data_auto_ext" access="RW" offset="0x4.0" size="0x1c.0" /> + <field name="page_data" descr="error injection page data: \;See Table 974, "\;PTER- Port Transmit Errors Register Phy Level Layout\;," \;on page 1244\;See Table 976, "\;PTER- Port Transmit Errors Register Port Level Fields\;," \;on page 1246" subnode="pter_reg_page_data_auto_ext" access="RW" offset="0x4.0" size="0x1c.0" /> </node> <node name="pter_reg_page_data_auto_ext" descr="" attr_is_union="1" size="0x1c.0" > @@ -2010,6 +2011,7 @@ <field name="an_disable_admin" descr="Auto Negotiation disable:\;0 - Normal operation \;1 - Disable AN.\;Note: In Ethernet port, when Disabling AN, the "\;eth_proto_admin\;" bit \;mask must comply to single speed rate set.\;In IB port, when Disabling AN, the "\;ib_proto_admin\;" bit mask must \;comply to single speed rate set.\;It's recommended to validate the FEC override bits in PPLM when operat\;ing with AN. \;" access="RW" offset="0x0.30" size="0x0.1" /> <field name="reserved_high" descr="THIS BIT MUST BE TIED TO \;1\;!\;This is old capability bit that address AN_DISABLE capability with only \;one enabled protocol." access="RO" offset="0x0.31" size="0x0.1" /> <field name="data_rate_oper" descr="Port data rate in resolution of 100 Mb/s (\;data_rate\;_oper * 100 Mb/s)\;Value 0x0 indicates this field is not supported." access="RO" offset="0x4.0" size="0x0.16" /> + <field name="max_port_rate" descr="Port maxium data rate in resolution of 1 Gb/s (\;data_rate\;_oper * 1 Gb/s)\;Value 0x0 indicates this field is not supported." access="RO" offset="0x4.16" size="0x0.12" /> <field name="an_status" descr="Auto Negotiation status: \;0 - Status is unavailable\;1 - AN completed successfully \;2 - AN performed but failed\;3 - AN was not performed, link is up \;4 - AN was not performed, link is down" access="RO" offset="0x4.28" size="0x0.4" /> <field name="ext_eth_proto_capability" descr="For HCA: See also \;PCAM.feature_cap_mask\; bit 13 for Extended Ether\;net protocol support.\;Extended Ethernet port speed/protocols supported (bitmask):\;Bit 0 - SGMII_100M\;Bit 1 - 1000BASE-X / SGMII\;Bit 3 - 5GBASE-R\;Bit 4 - XFI / XAUI-1 // 10G\;Bit 5 - XLAUI-4/XLPPI-4 // 40G \;Bit 6 - 25GAUI-1/ 25GBASE-CR / KR \;Bit 7 - 50GAUI-2 / LAUI-2/ 50GBASE-CR2/KR2 \;Bit 8 - 50GAUI-1 / LAUI-1/ 50GBASE-CR / KR\;Bit 9 - CAUI-4 / 100GBASE-CR4 / KR4\;Bit 10 - 100GAUI-2 / 100GBASE-CR2 / KR2 \;Bit 11 - Reserved \;Bit 12 - 200GAUI-4 / 200GBASE-CR4/KR4\;Bit 13 - Reserved \;Bit 14 - Reserved\;Bit 15 - 400GAUI-8\;Other - Reserved" access="RO" offset="0x8.0" size="0x4.0" /> <field name="eth_proto_capability" descr="Ethernet port speed/protocols supported (bitmask)\;Bit 31 - 50GBase-KR2\;Bit 30 - 50GBase-CR2\;Bit 29 - 25GBase-SR\;Bit 28 - 25GBase-KR\;Bit 27 - 25GBase-CR\;[Internal] Bit 26 - 10GBase-T \;[Internal] Bit 25 - 1000Base-T\;[Internal] Bit 24 - 100Base-TX\;[Internal] Bit 23 - 100GBase LR4/ER4\;Bit 22 - 100GBase KR4\;Bit 21 - 100GBase SR4\;Bit 20 - 100GBase CR4\;Bit 19 - 50GBase-KR4\;Bit 18 - 50GBase-SR2\;Bit 16 - 40GBase LR4/ER4\;Bit 15 - 40GBase SR4\;Bit 14 - 10GBase ER/LR\;Bit 13 - 10GBase SR\;Bit 12 - 10GBase CR\;Bit 9 - SGMII_100Base\;[Internal] Bit 8 - 56GBase *R4\;Bit 7 - 40GBase KR4\;Bit 6 - 40GBase CR4\;[internal] Bit 5 - 20GBase-KR2\;Bit 4 - 10GBase KR\;Bit 3 - 10GBase KX4\;Bit 2 - 10GBase-CX4\;Bit 1 - 1000Base KX\;Bit 0 - SGMII" access="RO" offset="0xC.0" size="0x4.0" /> @@ -2048,7 +2050,7 @@ </node> <node name="qdpm_ext" descr="" size="0x40.0" > - <field name="dscp" descr="DSCP entry is the DSCP to Switch Priority mapping. For more \;details refer to \;Table 629\;." access="RW" high_bound="63" low_bound="0" offset="0x0.24" size="0x40.0" /> + <field name="dscp" descr="DSCP entry is the DSCP to Switch Priority mapping. For more \;details refer to \;Table 652\;." access="RW" high_bound="63" low_bound="0" offset="0x0.24" size="0x40.0" /> </node> <node name="qeec_ext" descr="" size="0x20.0" > @@ -2080,7 +2082,7 @@ <node name="qepm_ext" descr="" size="0x14.0" > <field name="local_port" descr="Local port.\;Supported for data packets from CPU port." access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="exp" descr="EXP entry is the EXP to Switch Priority mapping. For more \;details refer to \;Table 637, "exp<i> Layout," on page 827" access="RW" high_bound="7" low_bound="0" offset="0x4.16" size="0x10.0" /> + <field name="exp" descr="EXP entry is the EXP to Switch Priority mapping. For more \;details refer to \;Table 660, "\;exp<i> Layout\;," on page 959" access="RW" high_bound="7" low_bound="0" offset="0x4.16" size="0x10.0" /> </node> <node name="qetcr_ext" descr="" size="0x50.0" > @@ -2088,8 +2090,8 @@ <field name="cap_remote_admin" descr="Indicates if \;operation_type\;==remote_admin_parameters is \;supported\;NIC only, Reserved for Switches" access="RO" offset="0x0.28" size="0x0.1" /> <field name="cap_local_admin" descr="Indicates if \;operation_type\;==local_admin_parameters is sup\;ported\;NIC only, Reserved for Switches" access="RO" offset="0x0.29" size="0x0.1" /> <field name="operation_type" descr="Operation type.\;0x0: local_operative_parameters\;0x1: local_admin_parameters - supported only when \;cap_lo\;cal_admin\;==1.\;0x2: remote_admin_parameters - supported only when \;cap_re\;mote_admin\;==1. \;NIC only, Reserved for Switches" access="INDEX" enum="local_operative_parameters=0x0,local_admin_parameters=0x1,remote_admin_parameters=0x2" offset="0x0.30" size="0x0.2" /> - <field name="tc_configuration" descr="Per-tclass configuration. For details, refer to \;Table 645, "ETS \;tcN Configuration Register Layout"\;." subnode="ets" access="RW" high_bound="7" low_bound="0" offset="0x8.0" size="0x40.0" /> - <field name="global_configuration" descr="Global configuration. For details, refer to \;Table 647, "ETS \;Global Configuration Register Layout"\;.\;Reserved for NICs" subnode="ets_global" access="RW" offset="0x48.0" size="0x8.0" /> + <field name="tc_configuration" descr="Per-tclass configuration. For details, refer to \;Table 668, "\;ETS \;tcN Configuration Register Layout\;"\;." subnode="ets" access="RW" high_bound="7" low_bound="0" offset="0x8.0" size="0x40.0" /> + <field name="global_configuration" descr="Global configuration. For details, refer to \;Table 670, "\;ETS \;Global Configuration Register Layout\;"\;.\;Reserved for NICs" subnode="ets_global" access="RW" offset="0x48.0" size="0x8.0" /> </node> <node name="qhll_ext" descr="" size="0xc.0" > @@ -2146,22 +2148,22 @@ <node name="qpdpm_ext" descr="" size="0x84.0" > <field name="local_port" descr="Local Port.\;Supported for data packets from CPU port." access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="dscp" descr="DSCP entry is the DSCP to Switch Priority mapping. For more \;details refer to \;Table 633, "dscp<i> Layout," on page 825" access="RW" high_bound="63" low_bound="0" offset="0x4.16" size="0x80.0" /> + <field name="dscp" descr="DSCP entry is the DSCP to Switch Priority mapping. For more \;details refer to \;Table 656, "\;dscp<i> Layout\;," on page 957" access="RW" high_bound="63" low_bound="0" offset="0x4.16" size="0x80.0" /> </node> <node name="qpdsm_ext" descr="" size="0x44.0" > <field name="local_port" descr="Local port.\;No support for CPU port." access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="switch_prio" descr="The DSCP mapping for Switch Priority \;i, \;See \;Table 683, \;"switch_prio<j> Layout"\;Switch Prio range is from 0 to \;cap_max_switch_priorities\;-\;1" subnode="prio_j" access="RW" high_bound="15" low_bound="0" offset="0x4.0" size="0x40.0" /> + <field name="switch_prio" descr="The DSCP mapping for Switch Priority \;i, \;See \;Table 706, \;"\;switch_prio<j> Layout\;"\;Switch Prio range is from 0 to \;cap_max_switch_priorities\;-\;1" subnode="prio_j" access="RW" high_bound="15" low_bound="0" offset="0x4.0" size="0x40.0" /> </node> <node name="qpem_ext" descr="" size="0x104.0" > <field name="local_port" descr="Local port.\;No support for CPU port.\;No support for router port." access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="switch_prio" descr="The EXP mapping for Switch Priority \;i, \;See \;Table 675, \;"switch_prio<i> Layout"\;Switch Prio range is from 0 to \;cap_max_switch_priori\;ties\;-1" subnode="switch_prio" access="RW" high_bound="15" low_bound="0" offset="0x4.0" size="0x100.0" /> + <field name="switch_prio" descr="The EXP mapping for Switch Priority \;i, \;See \;Table 698, \;"\;switch_prio<i> Layout\;"\;Switch Prio range is from 0 to \;cap_max_switch_priori\;ties\;-1" subnode="switch_prio" access="RW" high_bound="15" low_bound="0" offset="0x4.0" size="0x100.0" /> </node> <node name="qppm_ext" descr="" size="0x44.0" > <field name="local_port" descr="Local port.\;No support for CPU port." access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="switch_prio" descr="The PCP mapping for Switch Priority \;i, \;See \;Table 689, \;"switch_prio<j> Layout"\;Switch Prio range is from 0 to \;cap_max_switch_priorities\;-\;1" subnode="switch_prio_j" access="RW" high_bound="15" low_bound="0" offset="0x4.0" size="0x40.0" /> + <field name="switch_prio" descr="The PCP mapping for Switch Priority \;i, \;See \;Table 712, \;"\;switch_prio<j> Layout\;"\;Switch Prio range is from 0 to \;cap_max_switch_priorities\;-\;1" subnode="switch_prio_j" access="RW" high_bound="15" low_bound="0" offset="0x4.0" size="0x40.0" /> </node> <node name="qprt_ext" descr="" size="0x8.0" > @@ -2241,8 +2243,8 @@ <field name="roce_tx_window_field_select" descr="In Query, indicates whether roce_tx_window mode is sup\;ported.\;If set, indicates \;roce_tx_window_enfield is valid." access="RW" offset="0x0.1" size="0x0.1" /> <field name="roce_slow_restart_field_select" descr="In Query, indicates whether \;roce_slow_restart\; mode is \;supported.\;If set, indicates \;roce_slow_restart_en field is valid." access="RW" offset="0x0.2" size="0x0.1" /> <field name="roce_adp_retrans_en" descr="If set, the adaptive retransmission window functionality is \;enabled.\;Valid only when \;roce_adp_retrans_field_select\; == 1." access="RW" offset="0x4.0" size="0x0.1" /> - <field name="roce_tx_window_en" descr="If set, the \;Transmission window\; functionality is enabled. \;Valid only when \;roce_tx_window_\;field_select\; == 1." access="RW" offset="0x4.1" size="0x0.1" /> - <field name="roce_slow_restart_en" descr="If set, the \;Slow restart\; functionality is enabled. \;Valid only when \;roce_slow_restart_\;field_select\; == 1." access="RW" offset="0x4.2" size="0x0.1" /> + <field name="roce_tx_window_en" descr="If set, the \;Transmission window\; functionality is enabled. \;Valid only when \;roce_tx_window_field_select\; == 1." access="RW" offset="0x4.1" size="0x0.1" /> + <field name="roce_slow_restart_en" descr="If set, the \;Slow restart\; functionality is enabled. \;Valid only when \;roce_slow_restart_field_select\; == 1." access="RW" offset="0x4.2" size="0x0.1" /> </node> <node name="rom_version" descr="" size="0x4.0" > @@ -2261,7 +2263,7 @@ <field name="cap_max_pg_buffers" descr="Maximum number of port group buffers" access="RO" offset="0x44.8" size="0x0.8" /> <field name="cap_cell_size" descr="Buffer cell size (Bytes)" access="RO" offset="0x44.16" size="0x0.16" /> <field name="cap_max_cpu_ingress_tclass_sb" descr="Maximum number of tclasses for bmc port" access="RO" offset="0x48.0" size="0x0.8" /> - <field name="cap_max_tclass_sb" descr="Maximum number of tclasses" access="RO" offset="0x48.8" size="0x0.8" /> + <field name="cap_max_tclass_data" descr="Maximum number of tclasses" access="RO" offset="0x48.8" size="0x0.8" /> <field name="cap_sbsr_stat_size" descr="SBSR register number of responses" access="RO" offset="0x48.16" size="0x0.8" /> </node> @@ -2309,17 +2311,17 @@ <node name="sbdcc_ext" descr="" size="0x210.0" > <field name="clr" descr="Clear counters" access="OP" offset="0x0.31" size="0x0.1" /> - <field name="no_buffer_discard_cpu_tclass" descr="Count the number of unicast packets to CPU dropped due to \;lack of shared buffer resources\;For tclass i\;Range is 0.. \;cap_max_cpu_ingress_tclass\;-1\;See \;Table 1134, "SBDCC - counter Layout," on page 1297" subnode="uint64" access="RO" high_bound="63" low_bound="0" offset="0x10.0" size="0x200.0" /> + <field name="no_buffer_discard_cpu_tclass" descr="Count the number of unicast packets to CPU dropped due to \;lack of shared buffer resources\;For tclass i\;Range is 0.. \;cap_max_cpu_ingress_tclass\;-1\;See \;Table 1169, "\;SBDCC - counter Layout\;," on page 1437" subnode="uint64" access="RO" high_bound="63" low_bound="0" offset="0x10.0" size="0x200.0" /> </node> <node name="sbdcm_ext" descr="" size="0x14.0" > - <field name="counter_index" descr="Counter Index for flow counters, counting no buffer discard per \;switch priority.\;For Spectrum-2: reserves counter range at size of \;cap_max\;_switch_priorities\;+1 \;Each entry is per switch priority from 0 to \;cap_max\;_switch_priorities\;-1\;For Spectrum: See \;Section 4.1, "\;Performance and Monitoring \;Counters\;," on page 586\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.0" size="0x0.24" /> - <field name="counter_set_type" descr="Counter Set Type for flow counters.\;For Spectrum-2: See \;Section 4.2.2, "\;Counter Set Type\;," on \;page 588\;default: type=0 (disabled)\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.24" size="0x0.8" /> + <field name="counter_index" descr="Counter Index for flow counters, counting no buffer discard per \;switch priority.\;For Spectrum-2: reserves counter range at size of \;cap_max\;_switch_priorities\;+1 \;Each entry is per switch priority from 0 to \;cap_max\;_switch_priorities\;-1\;For Spectrum: See \;Section 4.1, "Performance and Monitoring \;Counters," on page 588\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.0" size="0x0.24" /> + <field name="counter_set_type" descr="Counter Set Type for flow counters.\;For Spectrum-2: See \;Section 4.2.2, "Counter Set Type," on \;page 590\;default: type=0 (disabled)\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.24" size="0x0.8" /> </node> <node name="sbdcr_ext" descr="" size="0x14.0" > - <field name="counter_index" descr="Counter Index for flow counters, counting no buffer discard per \;switch priority.\;Reserves a counter range of num_ports*num_PGs:\;PG 0..7 - PGs\;PG 8 - Control PG\;PG 9 - Mirror PG\;PG 10 - egress-traps, reserved when Spectrum-2 \;For Spectrum: See \;Section 4.1, "\;Performance and Monitoring \;Counters\;," on page 586\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.0" size="0x0.24" /> - <field name="counter_set_type" descr="Counter Set Type for flow counters.\;For Spectrum-2: See \;Section 4.2.2, "\;Counter Set Type\;," on \;page 588\;default: type=0 (disabled)\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.24" size="0x0.8" /> + <field name="counter_index" descr="Counter Index for flow counters, counting no buffer discard per \;switch priority.\;Reserves a counter range of num_ports*num_PGs:\;PG 0..7 - PGs\;PG 8 - Control PG\;PG 9 - Mirror PG\;PG 10 - egress-traps, reserved when Spectrum-2 \;For Spectrum: See \;Section 4.1, "Performance and Monitoring \;Counters," on page 588\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.0" size="0x0.24" /> + <field name="counter_set_type" descr="Counter Set Type for flow counters.\;For Spectrum-2: See \;Section 4.2.2, "Counter Set Type," on \;page 590\;default: type=0 (disabled)\;Not supported by SwitchX/-2 and Spectrum-1" access="RW" offset="0x10.24" size="0x0.8" /> </node> <node name="sbgcr_ext" descr="" size="0x4.0" > @@ -2331,8 +2333,8 @@ <field name="local_port" descr="Local port number\;Not supported for CPU port" access="RW" offset="0x0.16" size="0x0.8" /> <field name="opcode" descr="Opcode:\;0: Bind a \;hist_id\;1: Unbind a \;hist_id \;(default)" access="RW" offset="0x0.28" size="0x0.4" /> <field name="hist_id" descr="Histogram id to bind\;from 0 to \;cap_max_queue_hist_id\; - 1" access="INDEX" offset="0x4.0" size="0x0.8" /> - <field name="hist_type" descr="0x1000: Queue_Depth_Traffic_Class\;See \;Table 1142, "SBHBR - Histograms Hist-type for queue histo\;grams," on page 1302" access="RW" offset="0x8.0" size="0x0.16" /> - <field name="hist_parameters" descr="According to \;hist_type\;See \;Table 1142, "SBHBR - Histograms Hist-type for queue histo\;grams," on page 1302" access="RW" offset="0xC.0" size="0x4.0" /> + <field name="hist_type" descr="0x1000: Queue_Depth_Traffic_Class\;See \;Table 1177, "\;SBHBR - Histograms Hist-type for queue histo\;grams\;," on page 1442" access="RW" offset="0x8.0" size="0x0.16" /> + <field name="hist_parameters" descr="According to \;hist_type\;See \;Table 1177, "\;SBHBR - Histograms Hist-type for queue histo\;grams\;," on page 1442" access="RW" offset="0xC.0" size="0x4.0" /> <field name="hist_min_value" descr="Min value for histogram main range\;Units according to the units of the \;hist_type" access="RW" offset="0x10.0" size="0x4.0" /> <field name="hist_max_value" descr="Max value for histogram main range\;Note: for Spectrum device, \;hist_group\;=1 this rule must be meet:\;hist_max_value\; = \;hist_min_value\; + 2^n, n >= 3\;Units according to the units of the \;hist_type" access="RW" offset="0x14.0" size="0x4.0" /> <field name="sample_time" descr="Sample time interval. \;Allowed range:\;time = 2^\;sample_time\; * 128nSec\;sample_time\; range is 0..\;cap_max_sample_time\;-1\;Note: for Spectrum the \;sample_time\; is global for all ports and all \;tclass \;For Spectrum-2 the sample_time is per port.tclass.\;" access="RW" offset="0x18.0" size="0x0.6" /> @@ -2340,10 +2342,10 @@ <node name="sbhbr_v2_ext" descr="" size="0x1c.0" > <field name="dir" descr="Direction\;0: Ingress port quota\;1: Egress port quota\;Reserved when \;hist_type\; = Queue_Latency and this field is \;treated as '1' Egress port quota" access="INDEX" offset="0x0.0" size="0x0.2" /> - <field name="pg_buff" descr="PG buffer - Port PG (\;dir\;=ingress) / traffic class (\;dir\;=egress)\;For PG buffer: range is 0..\;cap_max_pg_buffers\; - 1\;For traffic class: range is 0..\;cap_max_tclass\; - 1\;For traffic class to CPU port: range is 0..\;cap_max_cpu_in\;gress_tclass\;- 1\;For Spectrum: no admission on Tx.Tclass, so when traffic class is \;in MC aware mode then the traffic classes which are MC aware \;must not be configured, but can be read. \;Spectrum-2 has admis\;sion on Tx.Tclass so all traffic classes can be configured also for \;MC aware mode. \;see \;Section 11.5, "\;Ethernet Switch Packet Priority and TClass \;Mapping," on page 1712" access="INDEX" offset="0x0.8" size="0x0.6" /> + <field name="pg_buff" descr="PG buffer - Port PG (\;dir\;=ingress) / traffic class (\;dir\;=egress)\;For PG buffer: range is 0..\;cap_max_pg_buffers\; - 1\;For traffic class: range is 0..\;cap_max_tclass\; - 1\;For traffic class to CPU port: range is 0..\;cap_max_cpu_in\;gress_tclass\;- 1\;For Spectrum: no admission on Tx.Tclass, so when traffic class is \;in MC aware mode then the traffic classes which are MC aware \;must not be configured, but can be read. \;Spectrum-2 has admis\;sion on Tx.Tclass so all traffic classes can be configured also for \;MC aware mode. \;see \;Section 11.5, "Ethernet Switch Packet Priority and TClass \;Mapping," on page 1664" access="INDEX" offset="0x0.8" size="0x0.6" /> <field name="local_port" descr="Local port number.\;For Ingress: excludes CPU port and Router port\;For Egress: excludes IP Router" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="en" descr="Enable the histogram" access="RW" offset="0x4.0" size="0x0.1" /> - <field name="hist_type" descr="0x1000: Queue_Depth_Traffic_Class\;0x1002: Queue_Latency\;See \;Table 1142, "SBHBR - Histograms Hist-type for queue histo\;grams," on page 1302" access="INDEX" offset="0x8.0" size="0x0.16" /> + <field name="hist_type" descr="0x1000: Queue_Depth_Traffic_Class\;0x1002: Queue_Latency\;See \;Table 1177, "\;SBHBR - Histograms Hist-type for queue histo\;grams\;," on page 1442" access="INDEX" offset="0x8.0" size="0x0.16" /> <field name="mode" descr="mode\;0: Linear histogram\;1: Exponential histogram" access="RW" offset="0x8.28" size="0x0.3" /> <field name="hist_min_value" descr="Min value for histogram main range\;Units according to the units of the \;hist_type" access="RW" offset="0x10.0" size="0x4.0" /> <field name="hist_max_value" descr="Max value for histogram main range\;When \;mode\;=0 (linear), then\; \;this rule must be meet:\;hist_max_value\; = \;hist_min_value\; + 2^n, n >= 3\;When \;mode\;=1 (exponential), then this rule must be meet:\;hist_max_value\; = \;hist_min_value\; + 255*2^n, n >= 0\;Units according to the units of the \;hist_type" access="RW" offset="0x14.0" size="0x4.0" /> @@ -2353,22 +2355,22 @@ <node name="sbhrr_ext" descr="" size="0x60.0" > <field name="clr" descr="Clear:\;0: Read the data in the histogram agent\;1: Read and clear the data in the histogram agent" access="OP" offset="0x0.31" size="0x0.1" /> <field name="hist_id" descr="see SBHBR" access="INDEX" offset="0x4.0" size="0x0.8" /> - <field name="bin" descr="Value of bin \;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Max bins is according to \;cap_hist_num_bins\;Bin is saturated at (2^\;cap_hist_bin_size_type1\;-1). When any bin \;is saturated all bins stop incrementing.\;See \;Table 1147, "SBHRR - Bin Layout," on page 1303" subnode="uint64" access="RO" high_bound="9" low_bound="0" offset="0x10.0" size="0x50.0" /> + <field name="bin" descr="Value of bin \;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Max bins is according to \;cap_hist_num_bins\;Bin is saturated at (2^\;cap_hist_bin_size_type1\;-1). When any bin \;is saturated all bins stop incrementing.\;See \;Table 1182, "\;SBHRR - Bin Layout\;," on page 1443" subnode="uint64" access="RO" high_bound="9" low_bound="0" offset="0x10.0" size="0x50.0" /> </node> <node name="sbhrr_v2_ext" descr="" size="0x90.0" > <field name="dir" descr="Direction\;0: Ingress port quota\;1: Egress port quota\;Reserved when \;hist_type\; = Queue_Latency and this field is \;treated as '1' Egress port quota" access="INDEX" offset="0x0.0" size="0x0.2" /> - <field name="pg_buff" descr="PG buffer - Port PG (\;dir\;=ingress) / traffic class (\;dir\;=egress)\;For PG buffer: range is 0..\;cap_max_pg_buffers\; - 1\;For traffic class: range is 0..\;cap_max_tclass\; - 1\;For traffic class to CPU port: range is 0..\;cap_max_cpu_ingress_t\;class\;- 1\;see \;Section 11.5, "Ethernet Switch Packet Priority and \;TClass Mapping\;," on page 1712" access="INDEX" offset="0x0.8" size="0x0.6" /> + <field name="pg_buff" descr="PG buffer - Port PG (\;dir\;=ingress) / traffic class (\;dir\;=egress)\;For PG buffer: range is 0..\;cap_max_pg_buffers\; - 1\;For traffic class: range is 0..\;cap_max_tclass\; - 1\;For traffic class to CPU port: range is 0..\;cap_max_cpu_ingress_t\;class\;- 1\;see \;Section 11.5, "Ethernet Switch Packet Priority and \;TClass Mapping," on page 1664" access="INDEX" offset="0x0.8" size="0x0.6" /> <field name="local_port" descr="Local port number.\;For Ingress: excludes CPU port\;For Egress: includes CPU port" access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="clr" descr="Clear:\;0: Read the data in the histogram agent\;1: Read and clear the data in the histogram agent" access="OP" offset="0x0.31" size="0x0.1" /> - <field name="hist_type" descr="0x1000: Queue_Depth_Traffic_Class\;0x1002: Queue_Latency\;See \;Table 1142, "SBHBR - Histograms Hist-type for queue histo\;grams," on page 1302" access="INDEX" offset="0x8.0" size="0x0.16" /> + <field name="hist_type" descr="0x1000: Queue_Depth_Traffic_Class\;0x1002: Queue_Latency\;See \;Table 1177, "\;SBHBR - Histograms Hist-type for queue histo\;grams\;," on page 1442" access="INDEX" offset="0x8.0" size="0x0.16" /> <field name="min_sampled_high" descr="min_sampled\;Cleared when \;clr\; = 1, cleared to 0xffff_ffff_ffff_ffff\;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Reserved when \;hist_type\; = Queue_Depth_Traffic_Class" access="RO" offset="0x10.0" size="0x4.0" /> <field name="min_sampled_low" descr="min_sampled\;Cleared when \;clr\; = 1, cleared to 0xffff_ffff_ffff_ffff\;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Reserved when \;hist_type\; = Queue_Depth_Traffic_Class" access="RO" offset="0x14.0" size="0x4.0" /> <field name="max_sampled_high" descr="max_sampled\;Cleared when \;clr\; = 1, cleared to 0\;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Reserved when \;hist_type\; = Queue_Depth_Traffic_Class" access="RO" offset="0x18.0" size="0x4.0" /> <field name="max_sampled_low" descr="max_sampled\;Cleared when \;clr\; = 1, cleared to 0\;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Reserved when \;hist_type\; = Queue_Depth_Traffic_Class" access="RO" offset="0x1C.0" size="0x4.0" /> <field name="avg_sampled_high" descr="Average sample\;Average from last clear\;When \;hist_type\; = Queue_Latency then units are 1nSec\;Reserved when \;hist_type\; = Queue_Depth_Traffic_Class" access="RO" offset="0x20.0" size="0x4.0" /> <field name="avg_sampled_low" descr="Average sample\;Average from last clear\;When \;hist_type\; = Queue_Latency then units are 1nSec\;Reserved when \;hist_type\; = Queue_Depth_Traffic_Class" access="RO" offset="0x24.0" size="0x4.0" /> - <field name="bin" descr="Value of bin \;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Max bins is according to \;cap_hist_num_bins\;.\;Bin is saturated at (2^\;cap_hist_bin_size_type1\;-1). When any bin \;is saturated all bins stop incrementing.\;See \;Table 1153, "SBHRR_V2 - Bin Layout," on page 1310" subnode="uint64" access="RO" high_bound="9" low_bound="0" offset="0x40.0" size="0x50.0" /> + <field name="bin" descr="Value of bin \;Units according to the units of the \;hist_type\; which is used for the \;hist_id\;Max bins is according to \;cap_hist_num_bins\;.\;Bin is saturated at (2^\;cap_hist_bin_size_type1\;-1). When any bin \;is saturated all bins stop incrementing.\;See \;Table 1188, "\;SBHRR_V2 - Bin Layout\;," on page 1449" subnode="uint64" access="RO" high_bound="9" low_bound="0" offset="0x40.0" size="0x50.0" /> </node> <node name="sbib_ext" descr="" size="0x10.0" > @@ -2424,19 +2426,19 @@ <node name="sbsns_ext" descr="" size="0x18.0" > <field name="status" descr="Snapshot status:\;0: RELEASED - snapshot is non-active\;1: LOCKED - snapshot is active" access="RO" offset="0x0.0" size="0x0.1" /> - <field name="trigger_id" descr="Tells which trigger id has trigger the snapshot.\;See encoding of \;type\; in \;Table 1071, "\;Shared Buffer Snapshot \;triggers\;," on page 1196" access="RO" offset="0x4.0" size="0x0.4" /> - <field name="trigger_parameters" descr="Trigger parameters.\;See encoding according to \;Table 1071, "\;Shared Buffer Snapshot \;triggers\;," on page 1196" access="RO" offset="0x8.0" size="0x0.16" /> + <field name="trigger_id" descr="Tells which trigger id has trigger the snapshot.\;See encoding of \;type\; in \;Table 1080, "Shared Buffer Snapshot \;triggers," on page 1204" access="RO" offset="0x4.0" size="0x0.4" /> + <field name="trigger_parameters" descr="Trigger parameters.\;See encoding according to \;Table 1080, "Shared Buffer Snap\;shot triggers," on page 1204" access="RO" offset="0x8.0" size="0x0.16" /> <field name="time_high" descr="Snapshot time:\;The time when the last snapshot was taken as free_running_\;clock" access="RO" offset="0x10.0" size="0x0.6" /> <field name="time_low" descr="Snapshot time:\;The time when the last snapshot was taken as free_running_\;clock" access="RO" offset="0x14.0" size="0x4.0" /> </node> <node name="sbsnt_ext" descr="" size="0x4.0" > - <field name="take" descr="Take snapshot:\;0: RELEASE - release snapshot\;1: TAKE_AND_TRAP - take snapshot of the guages and invoke \;trap SB_SNAPSHOT \;2: TAKE_NO_TRAP - take snapshot of the guages without \;invoking a trap\;When snapshot status is LOCKED then the TAKE will be \;ignored\;When snapshot status is RELEASED then the RELEASE will \;be ignored\;See SBSNS.\;status" access="OP" offset="0x0.0" size="0x0.2" /> + <field name="take" descr="Take snapshot:\;0: RELEASE - release snapshot\;1: TAKE_AND_TRAP - take snapshot of the guages and \;invoke trap SB_SNAPSHOT \;2: TAKE_NO_TRAP - take snapshot of the guages without \;invoking a trap\;When snapshot status is LOCKED then the TAKE will be \;ignored\;When snapshot status is RELEASED then the RELEASE will \;be ignored\;See SBSNS.\;status" access="OP" offset="0x0.0" size="0x0.2" /> </node> <node name="sbsnte_ext" descr="" size="0x10.0" > <field name="local_port" descr="Local Port" access="INDEX" offset="0x0.16" size="0x0.8" /> - <field name="type" descr="Type:\;0x20: WRED, egress, no CPU port\;0x31: Shared-buffer-per-Tclass, egress\;0x40: ING-CONG, ingress\;0x50: EGR-CONG, egress\;See \;Table 1071, "\;Shared Buffer Snapshot triggers\;," on page 1196" access="INDEX" offset="0x4.0" size="0x0.4" /> + <field name="type" descr="Type:\;0x20: WRED, egress, no CPU port\;0x31: Shared-buffer-per-Tclass, egress\;0x40: ING-CONG, ingress\;0x50: EGR-CONG, egress\;See \;Table 1080, "Shared Buffer Snapshot triggers," on page 1204" access="INDEX" offset="0x4.0" size="0x0.4" /> <field name="tclass_en_high" descr="TClass/PG snapshot trigger enable (for IB switches this is VL enable)\;Each bit represents corresponding tclass\;0: disable (default)\;1: enable\;Valid bits for Ethernet devices: 0.. \;cap_max_tclass_data\; - 1" access="RW" offset="0x8.0" size="0x4.0" /> <field name="tclass_en_low" descr="TClass/PG snapshot trigger enable (for IB switches this is VL enable)\;Each bit represents corresponding tclass\;0: disable (default)\;1: enable\;Valid bits for Ethernet devices: 0.. \;cap_max_tclass_data\; - 1" access="RW" offset="0xC.0" size="0x4.0" /> </node> @@ -2496,7 +2498,7 @@ <field name="local_port" descr="Local port number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="version" descr="0 - 40nm products\;1 - 28nm products\;3 - 16nm products" access="RO" offset="0x0.24" size="0x0.4" /> <field name="status" descr="0 - Invalid\;1 - Valid" access="RO" offset="0x0.28" size="0x0.4" /> - <field name="page_data" descr="See Table 987, "SLRG - Serdes Lane Receive Grade Register Layout for \;40nm and 28nm," on page 1160\;See Table 989, "SLRG - Serdes Lane Receive Grade Register Layout for \;16nm," on page 1162" subnode="slrg_reg_page_data_auto_ext" access="RO" offset="0x4.0" size="0x24.0" /> + <field name="page_data" descr="See Table 1010, "\;SLRG - Serdes Lane Receive Grade Register Layout for \;40nm and 28nm\;," on page 1278\;See Table 1012, "\;SLRG - Serdes Lane Receive Grade Register Layout for \;16nm\;," on page 1280" subnode="slrg_reg_page_data_auto_ext" access="RO" offset="0x4.0" size="0x24.0" /> </node> <node name="slrg_reg_page_data_auto_ext" descr="" attr_is_union="1" size="0x24.0" > @@ -2545,7 +2547,7 @@ <field name="local_port" descr="Local port number." access="INDEX" offset="0x0.16" size="0x0.8" /> <field name="version" descr="0 - 40nm products\;1 - 28nm products\;3 - 16nm products" access="RO" offset="0x0.24" size="0x0.4" /> <field name="status" descr="0 - Invalid\;1 - Valid" access="RO" offset="0x0.28" size="0x0.4" /> - <field name="page_data" descr="See Table 977, "SLTP - Serdes Lane Transmit Parameters Register Layout \;for 28nm and 40nm," on page 1154\;See Table 979, "SLTP - Serdes Lane Transmit Parameters Register Layout \;for 16nm," on page 1155\;See Table 981, "[Internal] Serdes Lane Transmit Parameters Register Lay\;out For Gearbox," on page 1156" subnode="sltp_reg_page_data_auto_ext" access="RO" offset="0x4.0" size="0x18.0" /> + <field name="page_data" descr="See Table 1000, "\;SLTP - Serdes Lane Transmit Parameters Register Lay\;out for 28nm and 40nm\;," on page 1274\;See Table 1002, "\;SLTP - Serdes Lane Transmit Parameters Register Lay\;out for 16nm\;," on page 1275\;See Table 1004, "\;[Internal] Serdes Lane Transmit Parameters Register \;Layout For Gearbox\;," on page 1275" subnode="sltp_reg_page_data_auto_ext" access="RO" offset="0x4.0" size="0x18.0" /> </node> <node name="sltp_reg_page_data_auto_ext" descr="" attr_is_union="1" size="0x18.0" > @@ -2560,13 +2562,13 @@ </node> <node name="switch_prio" descr="" size="0x10.0" > - <field name="ecn" descr="The EXP mapping for ECN \;j\;, see \;Table 677, "ecn<j> Layout"" subnode="ecn" access="RW" high_bound="3" low_bound="0" offset="0x0.0" size="0x10.0" /> + <field name="ecn" descr="The EXP mapping for ECN \;j\;, see \;Table 700, "\;ecn<j> Layout\;"" subnode="ecn" access="RW" high_bound="3" low_bound="0" offset="0x0.0" size="0x10.0" /> </node> <node name="switch_prio_j" descr="" size="0x4.0" > - <field name="color2" descr="The PCP and DEI mapping for color \;k\;, where k=0..2, see \;Table 691, "color<k>Layout"" access="RW" offset="0x0.8" size="0x0.8" /> - <field name="color1" descr="The PCP and DEI mapping for color \;k\;, where k=0..2, see \;Table 691, "color<k>Layout"" access="RW" offset="0x0.16" size="0x0.8" /> - <field name="color0" descr="The PCP and DEI mapping for color \;k\;, where k=0..2, see \;Table 691, "color<k>Layout"" access="RW" offset="0x0.24" size="0x0.8" /> + <field name="color2" descr="The PCP and DEI mapping for color \;k\;, where k=0..2, see \;Table 714, "\;color<k>Layout\;"" access="RW" offset="0x0.8" size="0x0.8" /> + <field name="color1" descr="The PCP and DEI mapping for color \;k\;, where k=0..2, see \;Table 714, "\;color<k>Layout\;"" access="RW" offset="0x0.16" size="0x0.8" /> + <field name="color0" descr="The PCP and DEI mapping for color \;k\;, where k=0..2, see \;Table 714, "\;color<k>Layout\;"" access="RW" offset="0x0.24" size="0x0.8" /> </node> <node name="uint64" descr="" size="0x8.0" > diff --git a/tools_layouts/reg_access_hca_layouts.c b/tools_layouts/reg_access_hca_layouts.c index ba01871..54131c9 100644 --- a/tools_layouts/reg_access_hca_layouts.c +++ b/tools_layouts/reg_access_hca_layouts.c @@ -687,9 +687,9 @@ void reg_access_hca_mgir_fw_info_pack(const struct reg_access_hca_mgir_fw_info * adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->month); offset = 112; adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->hour); - for (i = 0; i < 4; ++i) { - offset = adb2c_calc_array_field_address(128, 32, i, 512, 1); - adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->psid[i]); + for (i = 0; i < 16; ++i) { + offset = adb2c_calc_array_field_address(152, 8, i, 512, 1); + adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->psid[i]); } offset = 256; adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->ini_file_version); @@ -734,9 +734,9 @@ void reg_access_hca_mgir_fw_info_unpack(struct reg_access_hca_mgir_fw_info *ptr_ ptr_struct->month = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8); offset = 112; ptr_struct->hour = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); - for (i = 0; i < 4; ++i) { - offset = adb2c_calc_array_field_address(128, 32, i, 512, 1); - ptr_struct->psid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); + for (i = 0; i < 16; ++i) { + offset = adb2c_calc_array_field_address(152, 8, i, 512, 1); + ptr_struct->psid[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8); } offset = 256; ptr_struct->ini_file_version = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); @@ -783,9 +783,9 @@ void reg_access_hca_mgir_fw_info_print(const struct reg_access_hca_mgir_fw_info fprintf(fd, "month : " UH_FMT "\n", ptr_struct->month); adb2c_add_indentation(fd, indent_level); fprintf(fd, "hour : " UH_FMT "\n", ptr_struct->hour); - for (i = 0; i < 4; ++i) { + for (i = 0; i < 16; ++i) { adb2c_add_indentation(fd, indent_level); - fprintf(fd, "psid_%03d : " U32H_FMT "\n", i, ptr_struct->psid[i]); + fprintf(fd, "psid_%03d : " UH_FMT "\n", i, ptr_struct->psid[i]); } adb2c_add_indentation(fd, indent_level); fprintf(fd, "ini_file_version : " U32H_FMT "\n", ptr_struct->ini_file_version); @@ -1581,7 +1581,7 @@ void reg_access_hca_mcc_reg_print(const struct reg_access_hca_mcc_reg *ptr_struc adb2c_add_indentation(fd, indent_level); fprintf(fd, "update_handle : " UH_FMT "\n", ptr_struct->update_handle); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "control_state : " UH_FMT "\n", ptr_struct->control_state); + fprintf(fd, "control_state : %s (" UH_FMT ")\n", (ptr_struct->control_state == 0 ? ("IDLE") : ((ptr_struct->control_state == 1 ? ("LOCKED") : ((ptr_struct->control_state == 2 ? ("INITIALIZE") : ((ptr_struct->control_state == 3 ? ("DOWNLOAD") : ((ptr_struct->control_state == 4 ? ("VERIFY") : ((ptr_struct->control_state == 5 ? ("APPLY") : ((ptr_struct->control_state == 6 ? ("ACTIVATE") : ((ptr_struct->control_state == 7 ? ("UPLOAD") : ((ptr_struct->control_state == 8 ? ("UPLOAD_PENDING") : ("unknown")))))))))))))))))), ptr_struct->control_state); adb2c_add_indentation(fd, indent_level); fprintf(fd, "error_code : " UH_FMT "\n", ptr_struct->error_code); adb2c_add_indentation(fd, indent_level); @@ -2116,7 +2116,7 @@ void reg_access_hca_mfrl_reg_ext_print(const struct reg_access_hca_mfrl_reg_ext fprintf(fd, "======== reg_access_hca_mfrl_reg_ext ========\n"); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "reset_level : %s (" UH_FMT ")\n", (ptr_struct->reset_level == 8 ? ("LEVEL3") : ((ptr_struct->reset_level == 64 ? ("LEVEL6") : ("unknown")))), ptr_struct->reset_level); + fprintf(fd, "reset_level : %s (" UH_FMT ")\n", (ptr_struct->reset_level == 1 ? ("LEVEL0") : ((ptr_struct->reset_level == 8 ? ("LEVEL3") : ((ptr_struct->reset_level == 64 ? ("LEVEL6") : ("unknown")))))), ptr_struct->reset_level); adb2c_add_indentation(fd, indent_level); fprintf(fd, "reset_type : " UH_FMT "\n", ptr_struct->reset_type); adb2c_add_indentation(fd, indent_level); @@ -2372,7 +2372,7 @@ void reg_access_hca_mqis_reg_print(const struct reg_access_hca_mqis_reg *ptr_str fprintf(fd, "======== reg_access_hca_mqis_reg ========\n"); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "info_type : " UH_FMT "\n", ptr_struct->info_type); + fprintf(fd, "info_type : %s (" UH_FMT ")\n", (ptr_struct->info_type == 1 ? ("MODEL_NAME") : ((ptr_struct->info_type == 2 ? ("MODEL_DESCRIPTION") : ((ptr_struct->info_type == 3 ? ("IMAGE_VSD") : ((ptr_struct->info_type == 4 ? ("DEVICE_VSD") : ((ptr_struct->info_type == 5 ? ("ROM_INFO") : ("unknown")))))))))), ptr_struct->info_type); adb2c_add_indentation(fd, indent_level); fprintf(fd, "info_length : " UH_FMT "\n", ptr_struct->info_length); adb2c_add_indentation(fd, indent_level); @@ -2533,7 +2533,8 @@ void reg_access_hca_pcnr_reg_dump(const struct reg_access_hca_pcnr_reg *ptr_stru void reg_access_hca_resource_dump_pack(const struct reg_access_hca_resource_dump *ptr_struct, u_int8_t *ptr_buff) { u_int32_t offset; - + int i; + offset = 16; adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->segment_type); offset = 12; @@ -2545,13 +2546,13 @@ void reg_access_hca_resource_dump_pack(const struct reg_access_hca_resource_dump offset = 48; adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->vhca_id); offset = 64; - adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->index_1); + adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->index1); offset = 96; - adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->index_2); + adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->index2); offset = 144; - adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->num_of_obj_2); + adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->num_of_obj2); offset = 128; - adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->num_of_obj_1); + adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->num_of_obj1); offset = 192; adb2c_push_integer_to_buff(ptr_buff, offset, 8, ptr_struct->device_opaque); offset = 256; @@ -2560,11 +2561,16 @@ void reg_access_hca_resource_dump_pack(const struct reg_access_hca_resource_dump adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->size); offset = 320; adb2c_push_integer_to_buff(ptr_buff, offset, 8, ptr_struct->address); + for (i = 0; i < 52; ++i) { + offset = adb2c_calc_array_field_address(384, 32, i, 2048, 1); + adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->inline_data[i]); + } } void reg_access_hca_resource_dump_unpack(struct reg_access_hca_resource_dump *ptr_struct, const u_int8_t *ptr_buff) { u_int32_t offset; + int i; offset = 16; ptr_struct->segment_type = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); @@ -2577,13 +2583,13 @@ void reg_access_hca_resource_dump_unpack(struct reg_access_hca_resource_dump *pt offset = 48; ptr_struct->vhca_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); offset = 64; - ptr_struct->index_1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); + ptr_struct->index1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); offset = 96; - ptr_struct->index_2 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); + ptr_struct->index2 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); offset = 144; - ptr_struct->num_of_obj_2 = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); + ptr_struct->num_of_obj2 = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); offset = 128; - ptr_struct->num_of_obj_1 = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); + ptr_struct->num_of_obj1 = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16); offset = 192; ptr_struct->device_opaque = adb2c_pop_integer_from_buff(ptr_buff, offset, 8); offset = 256; @@ -2592,10 +2598,16 @@ void reg_access_hca_resource_dump_unpack(struct reg_access_hca_resource_dump *pt ptr_struct->size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); offset = 320; ptr_struct->address = adb2c_pop_integer_from_buff(ptr_buff, offset, 8); + for (i = 0; i < 52; ++i) { + offset = adb2c_calc_array_field_address(384, 32, i, 2048, 1); + ptr_struct->inline_data[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4); + } } void reg_access_hca_resource_dump_print(const struct reg_access_hca_resource_dump *ptr_struct, FILE *fd, int indent_level) { + int i; + adb2c_add_indentation(fd, indent_level); fprintf(fd, "======== reg_access_hca_resource_dump ========\n"); @@ -2610,13 +2622,13 @@ void reg_access_hca_resource_dump_print(const struct reg_access_hca_resource_dum adb2c_add_indentation(fd, indent_level); fprintf(fd, "vhca_id : " UH_FMT "\n", ptr_struct->vhca_id); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "index_1 : " U32H_FMT "\n", ptr_struct->index_1); + fprintf(fd, "index1 : " U32H_FMT "\n", ptr_struct->index1); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "index_2 : " U32H_FMT "\n", ptr_struct->index_2); + fprintf(fd, "index2 : " U32H_FMT "\n", ptr_struct->index2); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "num_of_obj_2 : " UH_FMT "\n", ptr_struct->num_of_obj_2); + fprintf(fd, "num_of_obj2 : " UH_FMT "\n", ptr_struct->num_of_obj2); adb2c_add_indentation(fd, indent_level); - fprintf(fd, "num_of_obj_1 : " UH_FMT "\n", ptr_struct->num_of_obj_1); + fprintf(fd, "num_of_obj1 : " UH_FMT "\n", ptr_struct->num_of_obj1); adb2c_add_indentation(fd, indent_level); fprintf(fd, "device_opaque : " U64H_FMT "\n", ptr_struct->device_opaque); adb2c_add_indentation(fd, indent_level); @@ -2625,8 +2637,10 @@ void reg_access_hca_resource_dump_print(const struct reg_access_hca_resource_dum fprintf(fd, "size : " U32H_FMT "\n", ptr_struct->size); adb2c_add_indentation(fd, indent_level); fprintf(fd, "address : " U64H_FMT "\n", ptr_struct->address); - adb2c_add_indentation(fd, indent_level); - fprintf(fd, "unlimited array: (inline_data)\n"); + for (i = 0; i < 52; ++i) { + adb2c_add_indentation(fd, indent_level); + fprintf(fd, "inline_data_%03d : " U32H_FMT "\n", i, ptr_struct->inline_data[i]); + } } unsigned int reg_access_hca_resource_dump_size(void) diff --git a/tools_layouts/reg_access_hca_layouts.h b/tools_layouts/reg_access_hca_layouts.h index 5f7c20b..d7fc221 100644..100755 --- a/tools_layouts/reg_access_hca_layouts.h +++ b/tools_layouts/reg_access_hca_layouts.h @@ -171,14 +171,20 @@ Other values are reserved */ category field For GENERAL_SEMAPHORE - See Table 800, "GENERAL_SEMA -PHORE Category Layout," on page 983 + See Table 827, " +GENERAL_SEMA +PHORE Category Layout +," on page 1117 For ICM_RESOURCE - See Table 802, "ICM_RESOURCE Category -Layout," on page 983 + See Table 829, " +ICM_RESOURCE Category +Layout +," on page 1118 For UAPP_RESOURCE - See Table 804, "UAPP_RESOURCE Category -Layout," on page 984 */ + See Table 831, " +UAPP_RESOURCE Category +Layout +," on page 1118 */ /* 0x4.0 - 0x1c.31 */ union reg_access_hca_lock_source_stop_toggle_modifier_category_modifier_auto category_modifier; }; @@ -359,7 +365,7 @@ to the device before installing the debug binary. */ version. */ /* 0x0.27 - 0x0.27 */ u_int8_t dev; - /* Description - When set, string-TLV are supported. */ + /* Description - When set, string-TLV is supported. */ /* 0x0.28 - 0x0.28 */ u_int8_t string_tlv; /*---------------- DWORD[1] (Offset 0x4) ----------------*/ @@ -390,8 +396,8 @@ For example 17:43 will be coded as 0x1743 */ u_int16_t hour; /*---------------- DWORD[4] (Offset 0x10) ----------------*/ /* Description - To be defined later. */ - /* 0x10.0 - 0x1c.31 */ - u_int32_t psid[4]; + /* 0x10.24 - 0x20.23 */ + u_int8_t psid[16]; /*---------------- DWORD[8] (Offset 0x20) ----------------*/ /* Description - User-configured version number of the current INI file. */ /* 0x20.0 - 0x20.31 */ @@ -640,23 +646,20 @@ single counter, 50 samples of 2 counters, etc). */ u_int8_t log_max_samples; /* Description - If set, Resource_dump register is supported. See - See Table 822, " -RESOURCE_ -DUMP Re -g -ister Layout + See Table 845, " +RESOURCE_DUMP Register Layout ," on -page 993 */ +page 1126 */ /* 0x0.22 - 0x0.22 */ u_int8_t resource_dump; /* Description - Log(base 2) of the size in granularity of 4KB to be allocated by host in order to accommodate cr_dump. 0 means feature is not supported. See -Table 820, " +Table 843, " CORE_DUMP Register Layout ," on -page 991 */ +page 1124 */ /* 0x0.23 - 0x0.27 */ u_int8_t log_cr_dump_to_mem_size; /* Description - If set, Core dump of type of specific QP is supported. */ @@ -740,8 +743,10 @@ FPGA_CTRL are supported. */ /* 0x8.30 - 0x8.30 */ u_int8_t flash_gw_lock; /* Description - If set, SW is allowed to modify FPGA_CTRL register. See - Table 784, -"FPGA_CTRL Register Layout," on page 973 */ + Table 809, +" +FPGA_CTRL Register Layout +," on page 1106 */ /* 0x8.31 - 0x8.31 */ u_int8_t fpga_ctrl_modify; /*---------------- DWORD[4] (Offset 0x10) ----------------*/ @@ -790,8 +795,10 @@ For Mellanox sandbox products /*---------------- DWORD[30] (Offset 0x78) ----------------*/ /* Description - Sandbox basic capabilities per sandbox product ID. For Mellanox sandbox products, see - Table 707, "IPsec_Basic_Capabili -ties Structure Layout," on page 893 + Table 732, " +IPsec_Basic_Capabili +ties Structure Layout +," on page 1026 . */ /* 0x78.0 - 0x78.31 */ u_int32_t sandbox_basic_caps; @@ -803,8 +810,10 @@ when such capability is not present). */ /*---------------- DWORD[32] (Offset 0x80) ----------------*/ /* Description - Extended capabilities address. For Mellanox sandbox products, see - Table 709, "IPsec_Extended_Capa -bilities Structure Layout," on page 893 + Table 734, " +IPsec_Extended_Ca +pabilities Structure Layout +," on page 1026 . */ /* 0x80.0 - 0x84.31 */ u_int64_t sandbox_extended_caps_addr; @@ -841,8 +850,10 @@ Valid only for query operation. */ u_int8_t status; /* Description - Indicates the control operation to be performed. Allowed only when FPGA_CAP.fpga_ctrl_modify==1. - See Table 780, "FPGA_CAP Regis -ter Layout," on page 969 + See Table 805, " +FPGA_CAP Reg +ister Layout +," on page 1102 . 0x1: LOAD - when set, the FPGA will be forced to reload the image from flash according to @@ -1014,8 +1025,8 @@ Other values are reserved. */ u_int8_t handle_owner_type; /*---------------- DWORD[4] (Offset 0x10) ----------------*/ /* Description - Component size in bytes. -Valid for UPDATE_COMPONENT instruction. Specifying -the size may shorten the update time. +Valid for UPDATE_COMPONENT instruction. Specify +ing the size may shorten the update time. Value 0x0 means that size is unspecified. */ /* 0x10.0 - 0x10.31 */ u_int32_t component_size; @@ -1043,8 +1054,10 @@ struct reg_access_hca_mcda_reg { Accesses must be in accordance to log_mcda_word_size in -Table 1355, "MCQI CAPABILITIES Info Layout," on -page 1446 */ +Table 1376, " +MCQI CAPABILITIES Info Layout +," on +page 1576 */ /* 0x4.0 - 0x4.31 */ u_int32_t offset; /*---------------- DWORD[2] (Offset 0x8) ----------------*/ @@ -1167,8 +1180,10 @@ on page 546 struct reg_access_hca_mcqi_reg { /*---------------- DWORD[0] (Offset 0x0) ----------------*/ /* Description - Component index gathered by -"MCQS - Management -Component Query Status" */ +" +MCQS - Management +Component Query Status +" */ /* 0x0.0 - 0x0.15 */ u_int16_t component_index; /* Description - Device number. @@ -1250,10 +1265,13 @@ build_time */ u_int32_t version; /*---------------- DWORD[2] (Offset 0x8) ----------------*/ /* Description - Time of component creation. Valid only if -build_time_valid - -is set. See -Table 1359, "Date-Time Layout," on page 1449 */ +build_ +time_valid + is set. See +Table 1380, " +Date-Time Layout +," on +page 1579 */ /* 0x8.0 - 0xc.31 */ u_int64_t build_time; /*---------------- DWORD[4] (Offset 0x10) ----------------*/ @@ -1261,8 +1279,10 @@ Table 1359, "Date-Time Layout," on page 1449 */ only if user_defined_time_valid is set. See -Table 1359, -"Date-Time Layout," on page 1449 */ +Table 1380, +" +Date-Time Layout +," on page 1579 */ /* 0x10.0 - 0x14.31 */ u_int64_t user_defined_time; /*---------------- DWORD[6] (Offset 0x18) ----------------*/ @@ -1307,11 +1327,10 @@ Other values are reserved */ /* 0x4.0 - 0x4.15 */ u_int16_t identifier; /*---------------- DWORD[2] (Offset 0x8) ----------------*/ - /* Description - Component statue in update flow, -see + /* Description - Component statue in update flow +, see "Component Update -State -" on page 543 +State" on page 543 : 0x0: IDLE 0x1: IN_PROGRESS @@ -1366,9 +1385,12 @@ Other values are reserved */ struct reg_access_hca_mfrl_reg_ext { /*---------------- DWORD[1] (Offset 0x4) ----------------*/ /* Description - The firmware reset level. See -"MFRL - Management Firmware -Reset Level" on page 1465 +" +MFRL - Management Firmware +Reset Level +" on page 1593 Only a single bit may be set. +Bit 0: LEVEL0 Bit 3: LEVEL3 Bit 6: LEVEL6 Other bits are reserved. */ @@ -1390,20 +1412,26 @@ Bit 1: Port alive */ struct reg_access_hca_mgir { /*---------------- DWORD[0] (Offset 0x0) ----------------*/ /* Description - Hardware Information, see -Table 1244, "Hardware Info Layout," -on page 1373 */ +Table 1275, " +Hardware Info Layout +," +on page 1509 */ /* 0x0.0 - 0x1c.31 */ struct reg_access_hca_mgir_hardware_info hw_info; /*---------------- DWORD[8] (Offset 0x20) ----------------*/ /* Description - Firmware Information, see -Table 1246, "Firmware Info Layout," -on page 1375 */ +Table 1277, " +Firmware Info Layout +," +on page 1510 */ /* 0x20.0 - 0x5c.31 */ struct reg_access_hca_mgir_fw_info fw_info; /*---------------- DWORD[24] (Offset 0x60) ----------------*/ /* Description - Software Information, see -Table 1248, "Software Info Layout," -on page 1377 +Table 1279, " +Software Info Layout +," +on page 1513 This field indicates the oldest software version compatible with the current firmware */ @@ -1528,8 +1556,8 @@ bound_stalled_reads_events - range 0 100. */ struct reg_access_hca_mqis_reg { /*---------------- DWORD[0] (Offset 0x0) ----------------*/ /* Description - Type of information string to be queried: -0x0: VPD - Read the PCI Vital Product Data capability con -tent. +0x0: VPD - Read the PCI Vital Product Data capability +content. 0x1: MODEL_NAME 0x2: MODEL_DESCRIPTION 0x3: IMAGE_VSD @@ -1644,11 +1672,13 @@ established or will be established with high BER */ }; /* Description - */ -/* Size in bytes - 48 */ +/* Size in bytes - 256 */ struct reg_access_hca_resource_dump { /*---------------- DWORD[0] (Offset 0x0) ----------------*/ /* Description - See -Section 27.8, "Resource Dump," on page 940 +Section 27.8, " +Resource Dump +," on page 1073 . */ /* 0x0.0 - 0x0.15 */ u_int16_t segment_type; @@ -1676,25 +1706,31 @@ object. SW shall read this field upon command done and shall provide it on the next call in case dump_more==1. */ /* 0x8.0 - 0x8.31 */ - u_int32_t index_1; + u_int32_t index1; /*---------------- DWORD[3] (Offset 0xc) ----------------*/ /* Description - Second object index to be dumped when supported by the object. SW shall read this field upon command done and shall provide it on the next call in case dump_more==1. */ /* 0xc.0 - 0xc.31 */ - u_int32_t index_2; + u_int32_t index2; /*---------------- DWORD[4] (Offset 0x10) ----------------*/ /* Description - The amount to objects to dump starting for index 2. SW shall read this field upon command done and shall -provide it on the next call in case dump_more==1. */ +provide it on the next call in case dump_more==1. +Range is 0..0xfff0. The special value of 0xffff represents +"all". The special value of 0xfffe represents "active". The +special value of 0x0 represents 0x1. */ /* 0x10.0 - 0x10.15 */ - u_int16_t num_of_obj_2; + u_int16_t num_of_obj2; /* Description - The amount to objects to dump starting for index 1 SW shall read this field upon command done and shall -provide it on the next call in case dump_more==1. */ +provide it on the next call in case dump_more==1. +Range is 0..0xfff0. The special value of 0xffff represents +"all". The special value of 0xfffe represents "active". The +special value of 0x0 represents 0x1. */ /* 0x10.16 - 0x10.31 */ - u_int16_t num_of_obj_1; + u_int16_t num_of_obj1; /*---------------- DWORD[6] (Offset 0x18) ----------------*/ /* Description - An opaque provided by the device. SW shall read the @@ -1725,8 +1761,8 @@ Valid when inline_dump==0. */ /*---------------- DWORD[12] (Offset 0x30) ----------------*/ /* Description - Data that is dumped in case of inline mode. Valid when inline_dump==1. */ - /* 0x30.0 - 0x30.31 */ - u_int32_t *inline_data; + /* 0x30.0 - 0xfc.31 */ + u_int32_t inline_data[52]; }; /* Description - */ @@ -1798,8 +1834,10 @@ num_repeat type field. For SMBUS_FAILED, - See Table 808, "SMBUS_FAILED Fault Inject -Modifier Layout," on page 987 */ + See Table 835, " +SMBUS_FAILED Fault Inject +Modifier Layout +," on page 1121 */ /* 0x10.0 - 0x2c.31 */ struct reg_access_hca_smbus_failed_fault_inject_modifier per_type_modifier; }; @@ -1868,11 +1906,15 @@ freq type field. For IRISC_HANG - See Table 812, "IRISC_HANG Mini-Flow Modifier -Layout," on page 988 + See Table 839, " +IRISC_HANG Mini-Flow Modifier +Layout +," on page 1122 For PACKET_DROP - See Table 814, "PACKET_DROP Mini-Flow -Modifier Layout," on page 989 */ + See Table 841, " +PACKET_DROP Mini-Flow +Modifier Layout +," on page 1123 */ /* 0x10.0 - 0x2c.31 */ union reg_access_hca_strs_mini_flow_reg_per_type_modifier_auto per_type_modifier; }; @@ -1954,7 +1996,11 @@ requests 0x12: SX_INT_DB - stop HW processing of internal doorbells (responder ack / read response requests) 0x13: QPC_SLICE - stop HW QP context read requests -Other values are reserved */ +Other values are reserved +0x14 RXB_HOST_HANG - +S +top HW which loads RX buffers - per +host / VL configuration. When supported deprecates RXB_HANG */ /* 0x4.0 - 0x4.7 */ u_int8_t type; /*---------------- DWORD[2] (Offset 0x8) ----------------*/ @@ -1978,14 +2024,20 @@ The Stressor will have the opposite behavior when it is not active. */ type field. For RXB_HANG - See Table 794, "RXB_HANG Stop Toggle Modifier -Layout," on page 981 + See Table 819, " +RXB_HANG Stop Toggle Modifier +Layout +," on page 1114 For LOCK_RESOURCE - See Table 798, "LOCK_RESOURCE Stop -Toggle Modifier Layout," on page 982 + See Table 825, " +LOCK_RESOURCE Stop +Toggle Modifier Layout +," on page 1116 For SXP_HANG - See Table 796, "SXP_HANG Stop Toggle Modifier -Layout," on page 982 */ + See Table 821, " +SXP_HANG Stop Toggle Modifier +Layout +," on page 1115 */ /* 0x10.0 - 0x2c.31 */ union reg_access_hca_strs_stop_toggle_reg_per_type_modifier_auto per_type_modifier; }; @@ -2004,7 +2056,7 @@ union reg_access_hca_reg_access_hca_Nodes { /* 0x0.0 - 0x3c.31 */ struct reg_access_hca_strs_fault_inject_reg strs_fault_inject_reg; /* Description - */ - /* 0x0.0 - 0x30.31 */ + /* 0x0.0 - 0xfc.31 */ struct reg_access_hca_resource_dump resource_dump; /* Description - */ /* 0x0.0 - 0x8.31 */ @@ -2335,7 +2387,7 @@ void reg_access_hca_resource_dump_pack(const struct reg_access_hca_resource_dump void reg_access_hca_resource_dump_unpack(struct reg_access_hca_resource_dump *ptr_struct, const u_int8_t *ptr_buff); void reg_access_hca_resource_dump_print(const struct reg_access_hca_resource_dump *ptr_struct, FILE *fd, int indent_level); unsigned int reg_access_hca_resource_dump_size(void); -#define REG_ACCESS_HCA_RESOURCE_DUMP_SIZE (0x30) +#define REG_ACCESS_HCA_RESOURCE_DUMP_SIZE (0x100) void reg_access_hca_resource_dump_dump(const struct reg_access_hca_resource_dump *ptr_struct, FILE *fd); /* strs_fault_inject_reg */ void reg_access_hca_strs_fault_inject_reg_pack(const struct reg_access_hca_strs_fault_inject_reg *ptr_struct, u_int8_t *ptr_buff); diff --git a/tools_layouts/tools_open_layouts.h b/tools_layouts/tools_open_layouts.h index acd4e7b..16c12d7 100755 --- a/tools_layouts/tools_open_layouts.h +++ b/tools_layouts/tools_open_layouts.h @@ -2696,7 +2696,7 @@ struct tools_open_mcdd_descriptor { /* Description - Status of current operation that FW sends to host. */ /* 0x20.0 - 0x20.7 */ u_int8_t status; - /* Description - Last error index, if occured. */ + /* Description - Last error index, if occurred. */ /* 0x20.8 - 0x20.15 */ u_int8_t error; /* Description - Reserved. */ diff --git a/tracers/fwtrace/fw_trace_utilities.py b/tracers/fwtrace/fw_trace_utilities.py index 065c750..39fb767 100644..100755 --- a/tracers/fwtrace/fw_trace_utilities.py +++ b/tracers/fwtrace/fw_trace_utilities.py @@ -180,18 +180,18 @@ class FwTraceUtilities(object): if freq <= 0: raise RuntimeError("device frequency is not above Zero - can't calc real time stamp") - nano_seconds = (1000 / freq) * ts + nano_seconds = int(1000 / freq) * ts # calc hours - time_in_seconds = nano_seconds / 1000000000 - hours = time_in_seconds / 3600 + time_in_seconds = int(nano_seconds / 1000000000) + hours = int(time_in_seconds / 3600) # calc minutes time_in_seconds = time_in_seconds - (hours * 3600) - minutes = time_in_seconds / 60 + minutes = int(time_in_seconds / 60) # calc seconds time_in_seconds = time_in_seconds - (minutes * 60) seconds = time_in_seconds # calc the reminder in nano seconds - nsecs = nano_seconds - (nano_seconds / 1000000000) * 1000000000 + nsecs = nano_seconds - int(nano_seconds / 1000000000) * 1000000000 return "{:02d}:{:02d}:{:02d}:{:09d}".format(hours, minutes, seconds, nsecs) diff --git a/xz_utils/xz_utils.c b/xz_utils/xz_utils.c index 9cd7f2c..99b774e 100644..100755 --- a/xz_utils/xz_utils.c +++ b/xz_utils/xz_utils.c @@ -269,3 +269,28 @@ int32_t xz_decompress(u_int8_t *inbuf, u_int32_t insz, u_int8_t *outbuf, u_int32 return xpress(1, 0, inbuf, insz, outbuf, outsz, LZMA_CHECK_CRC64); } +int32_t xz_decompress_crc32(u_int8_t *inbuf, u_int32_t insz, u_int8_t *outbuf, u_int32_t outsz) +{ + return xpress(1, 0, inbuf, insz, outbuf, outsz, LZMA_CHECK_CRC32); +} +const char* xz_get_error(int32_t error) +{ + if (error == XZ_ERR_MEM_EXCEEDED) { + return "XZ_ERR_MEM_EXCEEDED"; + } + else if (error == XZ_ERR_INTERNAL_MEM) { + return "XZ_ERR_INTERNAL_MEM"; + } + else if (error == XZ_ERR_PRESET_NO_SUPP) { + return "XZ_ERR_PRESET_NO_SUPP"; + } + else if (error == XZ_ERR_INTEGRITY_NOT_SUPP) { + return "XZ_ERR_INTEGRITY_NOT_SUPP"; + } + else if (error == XZ_ERR_ENCODE_FAULT) { + return "XZ_ERR_ENCODE_FAULT"; + } + else { + return "UNKNOWN ERROR"; + } +} diff --git a/xz_utils/xz_utils.h b/xz_utils/xz_utils.h index d3ad106..4b3c870 100644..100755 --- a/xz_utils/xz_utils.h +++ b/xz_utils/xz_utils.h @@ -53,7 +53,8 @@ enum int32_t xz_compress(u_int32_t preset, u_int8_t *inbuf, u_int32_t insz, u_int8_t *outbuf, u_int32_t outsz); int32_t xz_decompress(u_int8_t *inbuf, u_int32_t insz, u_int8_t *outbuf, u_int32_t outsz); int32_t xz_compress_crc32(u_int32_t preset, u_int8_t* inbuf, u_int32_t insz, u_int8_t* outbuf, u_int32_t outsz); - +int32_t xz_decompress_crc32(u_int8_t *inbuf, u_int32_t insz, u_int8_t *outbuf, u_int32_t outsz); +const char* xz_get_error(int32_t error); #ifdef __cplusplus } #endif |
