Skip to content

Commit 1e91ce8

Browse files
committed
Merge missing files from master_devel to master
Description: Issue: None
1 parent c8dcb35 commit 1e91ce8

30 files changed

+2522
-12
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,5 +410,5 @@ fi
410410
AC_OUTPUT( Makefile common/Makefile mft_utils/Makefile mft_utils/hsmclient/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 \
411411
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 \
412412
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 \
413-
fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile )
413+
fw_comps_mgr/Makefile mad_ifc/Makefile tracers/Makefile tracers/fwtrace/Makefile resourcedump/Makefile resourceparse/Makefile )
414414

kernel/mst_kernel.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
#define mst_info(format, arg...) \
4949
pr_info("%s: %s %d: " format, MST_PREFIX, __func__, __LINE__, ## arg)
5050

51+
#define capability_support_info_message(dev, capability) \
52+
mst_info("Device 0x%x (%x:%x:%x.%x) doesn't support %s capability.\n", \
53+
dev->pci_dev->device,pci_domain_nr(dev->pci_dev->bus), \
54+
dev->pci_dev->bus->number, PCI_SLOT(dev->pci_dev->devfn), \
55+
PCI_FUNC(dev->pci_dev->devfn), #capability);
56+
57+
5158

5259
/****************************************************/
5360
/* new types */

kernel/mst_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static int get_space_support_status(struct mst_dev_data *dev)
426426
{
427427
int ret;
428428
// printk("[MST] Checking if the Vendor CAP %d supports the SPACES in devices\n", vend_cap);
429-
if (!dev->vendor_specific_cap)
429+
if ((!dev->vendor_specific_cap) || (!dev->pci_dev))
430430
return 0;
431431
if (dev->spaces_support_status != SS_UNINITIALIZED)
432432
return 0;
@@ -451,6 +451,7 @@ static int get_space_support_status(struct mst_dev_data *dev)
451451
} else {
452452
dev->spaces_support_status = SS_ALL_SPACES_SUPPORTED;
453453
}
454+
454455
// clear semaphore
455456
_vendor_specific_sem(dev, 0);
456457
return 0;

mlxlink/modules/mlxlink_ui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ void MlxlinkUi::paramValidate()
510510

511511
void MlxlinkUi::initCmdParser()
512512
{
513-
for (u_int32_t it = SHOW_PDDR; it < FUNCTION_LAST; it++) {
513+
for (u_int32_t it = SHOW_PDDR; it <= FUNCTION_LAST; it++) {
514514
_sendRegFuncMap.push_back(0);
515515
}
516516
AddOptions(DEVICE_FLAG, DEVICE_FLAG_SHORT, "MstDevice",

mstflint.spec.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ rm -rf $RPM_BUILD_ROOT
150150
%{_bindir}/mstprivhost
151151
%{_bindir}/mstfwtrace
152152
%{_bindir}/mstresourcedump
153+
%{_bindir}/mstresourceparse
153154
%if %{enablefwmgr}
154155
%{_bindir}/mstfwmanager
155156
%{_bindir}/mstarchive
@@ -205,6 +206,11 @@ rm -rf $RPM_BUILD_ROOT
205206
%{mstflint_python_tools}/mstresourcedump/filters/*.py
206207
%{mstflint_python_tools}/mstresourcedump/fetchers/*.py
207208
%{mstflint_python_tools}/mstresourcedump/commands/*.py
209+
%{mstflint_python_tools}/mstresourceparse/*.py
210+
%{mstflint_python_tools}/mstresourceparse/parsers/*.py
211+
%{mstflint_python_tools}/mstresourceparse/utils/*.py
212+
%{mstflint_python_tools}/mstresourceparse/segments/*.py
213+
%{mstflint_python_tools}/mstresourceparse/resource_data/*.py
208214

209215
%{_datadir}/mstflint
210216
%{_mandir}/man1/*

resourcedump/segments/SegmentCreator.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,19 @@ def _parse_segments(self, raw_data):
7171
"""
7272
splitted_segments = []
7373
try:
74-
while raw_data:
75-
raw_data_len = len(raw_data)
74+
end_index = len(raw_data) - 1
75+
current_index = 0
76+
while current_index <= end_index:
7677
# seg size specified in dwords
77-
seg_size = '{:0b}'.format(raw_data[cs.SEGMENT_SIZE_DWORD_LOCATION]).zfill(32)[cs.SEGMENT_SIZE_START: cs.
78-
SEGMENT_SIZE_END]
78+
seg_size = '{:032b}'.format(raw_data[cs.SEGMENT_SIZE_DWORD_LOCATION + current_index])[
79+
cs.SEGMENT_SIZE_START: cs.SEGMENT_SIZE_END]
7980
seg_size = int(seg_size, 2)
80-
seg_data = raw_data[:seg_size]
81-
splitted_segments.append(seg_data)
82-
raw_data = raw_data[seg_size:]
83-
if len(raw_data) == raw_data_len:
84-
raise Exception("Error in segments parsing. raw_data didn't get smaller")
81+
if seg_size == 0:
82+
raise Exception("Error in segments splitting. raw_data didn't get smaller - found segment_size = 0")
8583

84+
seg_data = raw_data[current_index:seg_size + current_index]
85+
splitted_segments.append(seg_data)
86+
current_index += seg_size
8687
except Exception as e:
8788
raise Exception("Failed to split segments with error: {0}".format(e))
8889

resourceparse/__init__.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (C) Jan 2020 Mellanox Technologies Ltd. All rights reserved.
2+
#
3+
# This software is available to you under a choice of one of two
4+
# licenses. You may choose to be licensed under the terms of the GNU
5+
# General Public License (GPL) Version 2, available from the file
6+
# COPYING in the main directory of this source tree, or the
7+
# OpenIB.org BSD license below:
8+
#
9+
# Redistribution and use in source and binary forms, with or
10+
# without modification, are permitted provided that the following
11+
# conditions are met:
12+
#
13+
# - Redistributions of source code must retain the above
14+
# copyright notice, this list of conditions and the following
15+
# disclaimer.
16+
#
17+
# - Redistributions in binary form must reproduce the above
18+
# copyright notice, this list of conditions and the following
19+
# disclaimer in the documentation and/or other materials
20+
# provided with the distribution.
21+
#
22+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29+
# SOFTWARE.
30+
# --
31+
32+
33+

resourceparse/mstresourceparse.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Copyright (C) Jan 2020 Mellanox Technologies Ltd. All rights reserved.
2+
#
3+
# This software is available to you under a choice of one of two
4+
# licenses. You may choose to be licensed under the terms of the GNU
5+
# General Public License (GPL) Version 2, available from the file
6+
# COPYING in the main directory of this source tree, or the
7+
# OpenIB.org BSD license below:
8+
#
9+
# Redistribution and use in source and binary forms, with or
10+
# without modification, are permitted provided that the following
11+
# conditions are met:
12+
#
13+
# - Redistributions of source code must retain the above
14+
# copyright notice, this list of conditions and the following
15+
# disclaimer.
16+
#
17+
# - Redistributions in binary form must reproduce the above
18+
# copyright notice, this list of conditions and the following
19+
# disclaimer in the documentation and/or other materials
20+
# provided with the distribution.
21+
#
22+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29+
# SOFTWARE.
30+
# --
31+
32+
33+
#######################################################
34+
#
35+
# resourceparse.py
36+
# Python implementation of the Class ResourceParse
37+
# Generated by Enterprise Architect
38+
# Created on: 16-Dec-2019 14:11:58 AM
39+
# Original author: talve
40+
#
41+
#######################################################
42+
import sys
43+
import os
44+
45+
if sys.version_info[0] < 3:
46+
print("Error: This tool supports python 3.x only. Exiting...")
47+
exit(1)
48+
49+
import argparse
50+
from utils import constants as cs
51+
from parsers.Parser import Parser
52+
53+
sys.path.append(os.path.join("common"))
54+
import tools_version
55+
56+
57+
class ResourceParse:
58+
"""This class is responsible for the resource dump UI by handling the user inputs and
59+
and running the right command.
60+
"""
61+
62+
@classmethod
63+
def _run_arg_parse(self):
64+
"""This method run the arg parse and return the arguments from the UI.
65+
"""
66+
# main parser
67+
tool_name = os.path.basename(__file__.split('.')[0])
68+
parser = argparse.ArgumentParser(prog=tool_name, add_help=False, formatter_class=argparse.RawTextHelpFormatter)
69+
70+
# required arguments by the parser
71+
required_named = parser.add_argument_group('required arguments')
72+
required_named.add_argument(cs.UI_DASHES + cs.UI_ARG_DUMP_FILE.replace("_", "-"),
73+
help='Location of the dump file used for parsing', required=True)
74+
required_named.add_argument(cs.UI_DASHES + cs.UI_ARG_ADB_FILE.replace("_", "-"),
75+
help='Location of the ADB file', required=True)
76+
77+
# optional arguments by the parser
78+
parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS,
79+
help='Shows this help message and exit')
80+
parser.add_argument('--version', action='version', help="Shows the tool's version and exit",
81+
version=tools_version.GetVersionString(tool_name, None))
82+
83+
parser.add_argument(cs.UI_DASHES + cs.UI_ARG_OUT, help='Location of the output file', required=False)
84+
parser.add_argument(cs.UI_DASHES + cs.UI_ARG_RAW, help='Prints the raw data in addition to the parsed data',
85+
required=False, action="store_true", default=False)
86+
parser.add_argument(cs.UI_DASHES_SHORT + cs.UI_ARG_VERBOSITY,
87+
help='Verbosity notice', dest=cs.UI_ARG_VERBOSITY_COUNT,
88+
default=0, action='count')
89+
arguments = parser.parse_args()
90+
return arguments
91+
92+
def run(self):
93+
"""This method run the parser with the needed arguments
94+
"""
95+
arguments = self._run_arg_parse()
96+
resource_parser = Parser(**vars(arguments))
97+
resource_parser.parse()
98+
99+
100+
if __name__ == '__main__':
101+
try:
102+
ResourceParse().run()
103+
except Exception as e:
104+
print("Error: {0}. Exiting...".format(e))
105+
sys.exit(1)

0 commit comments

Comments
 (0)