gpustack-runtime 0.1.40.post1__py3-none-any.whl → 0.1.41__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gpustack_runtime/__init__.py +1 -1
- gpustack_runtime/__main__.py +5 -3
- gpustack_runtime/_version.py +2 -2
- gpustack_runtime/_version_appendix.py +1 -1
- gpustack_runtime/cmds/__init__.py +5 -3
- gpustack_runtime/cmds/__types__.py +1 -1
- gpustack_runtime/cmds/deployer.py +140 -18
- gpustack_runtime/cmds/detector.py +1 -1
- gpustack_runtime/cmds/images.py +1 -1
- gpustack_runtime/deployer/__init__.py +28 -2
- gpustack_runtime/deployer/__patches__.py +1 -1
- gpustack_runtime/deployer/__types__.py +2 -1
- gpustack_runtime/deployer/__utils__.py +2 -2
- gpustack_runtime/deployer/cdi/__init__.py +85 -5
- gpustack_runtime/deployer/cdi/__types__.py +92 -29
- gpustack_runtime/deployer/cdi/__utils__.py +178 -0
- gpustack_runtime/deployer/cdi/amd.py +146 -0
- gpustack_runtime/deployer/cdi/ascend.py +164 -0
- gpustack_runtime/deployer/cdi/hygon.py +147 -0
- gpustack_runtime/deployer/cdi/iluvatar.py +136 -0
- gpustack_runtime/deployer/cdi/metax.py +148 -0
- gpustack_runtime/deployer/cdi/thead.py +57 -23
- gpustack_runtime/deployer/docker.py +9 -8
- gpustack_runtime/deployer/k8s/deviceplugin/__init__.py +240 -0
- gpustack_runtime/deployer/k8s/deviceplugin/__types__.py +131 -0
- gpustack_runtime/deployer/k8s/deviceplugin/plugin.py +586 -0
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/__init__.py +3 -0
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api.proto +212 -0
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2.py +86 -0
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2.pyi +168 -0
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2_grpc.py +358 -0
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/constants.py +34 -0
- gpustack_runtime/deployer/kuberentes.py +37 -4
- gpustack_runtime/deployer/podman.py +9 -8
- gpustack_runtime/detector/__init__.py +42 -5
- gpustack_runtime/detector/__types__.py +8 -24
- gpustack_runtime/detector/__utils__.py +46 -39
- gpustack_runtime/detector/amd.py +55 -66
- gpustack_runtime/detector/ascend.py +29 -41
- gpustack_runtime/detector/cambricon.py +3 -3
- gpustack_runtime/detector/hygon.py +21 -49
- gpustack_runtime/detector/iluvatar.py +44 -60
- gpustack_runtime/detector/metax.py +54 -37
- gpustack_runtime/detector/mthreads.py +74 -36
- gpustack_runtime/detector/nvidia.py +130 -93
- gpustack_runtime/detector/pyacl/__init__.py +1 -1
- gpustack_runtime/detector/pyamdgpu/__init__.py +1 -1
- gpustack_runtime/detector/pyamdsmi/__init__.py +1 -1
- gpustack_runtime/detector/pycuda/__init__.py +1 -1
- gpustack_runtime/detector/pydcmi/__init__.py +1 -1
- gpustack_runtime/detector/pyhsa/__init__.py +1 -1
- gpustack_runtime/detector/pymxsml/__init__.py +1553 -1
- gpustack_runtime/detector/pyrocmcore/__init__.py +1 -1
- gpustack_runtime/detector/pyrocmsmi/__init__.py +1 -1
- gpustack_runtime/detector/thead.py +41 -60
- gpustack_runtime/envs.py +104 -12
- gpustack_runtime/logging.py +6 -2
- {gpustack_runtime-0.1.40.post1.dist-info → gpustack_runtime-0.1.41.dist-info}/METADATA +6 -1
- gpustack_runtime-0.1.41.dist-info/RECORD +67 -0
- gpustack_runtime/detector/pymxsml/mxsml.py +0 -1580
- gpustack_runtime/detector/pymxsml/mxsml_extension.py +0 -816
- gpustack_runtime/detector/pymxsml/mxsml_mcm.py +0 -476
- gpustack_runtime-0.1.40.post1.dist-info/RECORD +0 -55
- {gpustack_runtime-0.1.40.post1.dist-info → gpustack_runtime-0.1.41.dist-info}/WHEEL +0 -0
- {gpustack_runtime-0.1.40.post1.dist-info → gpustack_runtime-0.1.41.dist-info}/entry_points.txt +0 -0
- {gpustack_runtime-0.1.40.post1.dist-info → gpustack_runtime-0.1.41.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,1580 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Copyright © 2024 MetaX Integrated Circuits (Shanghai) Co., Ltd. All Rights Reserved.
|
|
3
|
-
|
|
4
|
-
This software and associated documentation files (hereinafter collectively referred to as
|
|
5
|
-
"Software") is a proprietary commercial software developed by MetaX Integrated Circuits
|
|
6
|
-
(Shanghai) Co., Ltd. and/or its affiliates (hereinafter collectively referred to as “MetaX”).
|
|
7
|
-
The information presented in the Software belongs to MetaX. Without prior written permission
|
|
8
|
-
from MetaX, no entity or individual has the right to obtain a copy of the Software to deal in
|
|
9
|
-
the Software, including but not limited to use, copy, modify, merge, disclose, publish,
|
|
10
|
-
distribute, sublicense, and/or sell copies of the Software or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
The Software is provided for reference only, without warranty of any kind, either express or
|
|
13
|
-
implied, including but not limited to the warranty of merchantability, fitness for any purpose
|
|
14
|
-
and/or noninfringement. In no case shall MetaX be liable for any claim, damage or other liability
|
|
15
|
-
arising from, out of or in connection with the Software.
|
|
16
|
-
|
|
17
|
-
If the Software need to be used in conjunction with any third-party software or open source
|
|
18
|
-
software, the rights to the third-party software or open source software still belong to the
|
|
19
|
-
copyright owners. For details, please refer to the respective notices or licenses. Please comply
|
|
20
|
-
with the provisions of the relevant notices or licenses. If the open source software licenses
|
|
21
|
-
additionally require the disposal of rights related to this Software, please contact MetaX
|
|
22
|
-
immediately and obtain MetaX 's written consent.
|
|
23
|
-
|
|
24
|
-
MetaX reserves the right, at its sole discretion, to change, modify, add or remove portions of the
|
|
25
|
-
Software, at any time. MetaX reserves all the right for the final explanation.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
from ctypes import *
|
|
29
|
-
from functools import wraps
|
|
30
|
-
import sys
|
|
31
|
-
import os
|
|
32
|
-
import string
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## enums ##
|
|
36
|
-
_mxSmlDeviceBrand_t = c_uint
|
|
37
|
-
MXSML_BRAND_UNKNOWN = 0
|
|
38
|
-
MXSML_BRAND_N = 1
|
|
39
|
-
MXSML_BRAND_C = 2
|
|
40
|
-
MXSML_BRAND_G = 3
|
|
41
|
-
|
|
42
|
-
_mxSmlDeviceVirtualizationMode_t = c_uint
|
|
43
|
-
MXSML_VIRTUALIZATION_MODE_NONE = 0 # Represents bare metal
|
|
44
|
-
MXSML_VIRTUALIZATION_MODE_PF = 1 # Physical function after virtualization
|
|
45
|
-
MXSML_VIRTUALIZATION_MODE_VF = 2 # Virtualized device
|
|
46
|
-
|
|
47
|
-
_mxSmlVersionUnit_t = c_uint
|
|
48
|
-
MXSML_VERSION_BIOS = 0
|
|
49
|
-
MXSML_VERSION_DRIVER = 1
|
|
50
|
-
MXSML_VERSION_SMP0 = 2
|
|
51
|
-
MXSML_VERSION_SMP1 = 3
|
|
52
|
-
MXSML_VERSION_CCX0 = 4
|
|
53
|
-
MXSML_VERSION_CCX1 = 5
|
|
54
|
-
MXSML_VERSION_CCX2 = 6
|
|
55
|
-
MXSML_VERSION_CCX3 = 7 # Only valid for N-class device
|
|
56
|
-
|
|
57
|
-
_mxSmlPmbusUnit_t = c_uint
|
|
58
|
-
MXSML_PMBUS_SOC = 0
|
|
59
|
-
MXSML_PMBUS_CORE = 1
|
|
60
|
-
MXSML_PMBUS_HBM = 2
|
|
61
|
-
MXSML_PMBUS_PCIE = 3
|
|
62
|
-
MXSML_PMBUS_HBM2 = 4
|
|
63
|
-
|
|
64
|
-
_mxSmlTemperatureSensors_t = c_uint
|
|
65
|
-
MXSML_TEMPERATURE_HOTSPOT = 0 # Chip max temperature
|
|
66
|
-
MXSML_TEMPERATURE_HOTLIMIT = 1 # Chip temperature limit
|
|
67
|
-
MXSML_TEMPERATURE_SOC = 2 # Power DrMOS soc
|
|
68
|
-
MXSML_TEMPERATURE_CORE = 3 # Power DrMOS core
|
|
69
|
-
MXSML_TEMPERATURE_CCX_DNOC = 4 # Deprecated. Do not use
|
|
70
|
-
MXSML_TEMPERATURE_CSC_FUSE = 5 # Deprecated. Do not use
|
|
71
|
-
MXSML_TEMPERATURE_CCX_DLA_VPUE1_ATH = 6 # Deprecated. Do not use
|
|
72
|
-
MXSML_TEMPERATURE_VPUE1 = 7 # Deprecated. Do not use
|
|
73
|
-
MXSML_TEMPERATURE_VPUE0 = 8 # Deprecated. Do not use
|
|
74
|
-
MXSML_TEMPERATURE_ATUL2 = 9 # Deprecated. Do not use
|
|
75
|
-
MXSML_TEMPERATURE_DLA1 = 10 # Chip, Valid for N-class device
|
|
76
|
-
MXSML_TEMPERATURE_DLA0 = 11 # Chip, Valid for N-class device
|
|
77
|
-
MXSML_TEMPERATURE_EMC0 = 12 # Air inlet, Valid for C-class device
|
|
78
|
-
MXSML_TEMPERATURE_EMC1 = 13 # Tdiode, Valid for C-class device
|
|
79
|
-
MXSML_TEMPERATURE_SGM = 14 # Air outlet, Valid for C-class device
|
|
80
|
-
|
|
81
|
-
_mxSmlRasIp_t = c_uint
|
|
82
|
-
MXSML_RAS_MC = 0
|
|
83
|
-
MXSML_RAS_PCIE = 1
|
|
84
|
-
MXSML_RAS_FUSE = 2
|
|
85
|
-
MXSML_RAS_G2D = 3
|
|
86
|
-
MXSML_RAS_INT = 4
|
|
87
|
-
MXSML_RAS_HAG = 5
|
|
88
|
-
MXSML_RAS_METALK = 6
|
|
89
|
-
MXSML_RAS_SMP0 = 7
|
|
90
|
-
MXSML_RAS_SMP1 = 8
|
|
91
|
-
MXSML_RAS_CCX0 = 9
|
|
92
|
-
MXSML_RAS_CCX1 = 10
|
|
93
|
-
MXSML_RAS_CCX2 = 11
|
|
94
|
-
MXSML_RAS_CCX3 = 12
|
|
95
|
-
MXSML_RAS_DLA0 = 13
|
|
96
|
-
MXSML_RAS_DLA1 = 14
|
|
97
|
-
MXSML_RAS_VPUE0 = 15
|
|
98
|
-
MXSML_RAS_VPUE1 = 16
|
|
99
|
-
MXSML_RAS_VPUD0 = 17
|
|
100
|
-
MXSML_RAS_VPUD1 = 18
|
|
101
|
-
MXSML_RAS_VPUD2 = 19
|
|
102
|
-
MXSML_RAS_VPUD3 = 20
|
|
103
|
-
MXSML_RAS_VPUD4 = 21
|
|
104
|
-
MXSML_RAS_VPUD5 = 22
|
|
105
|
-
MXSML_RAS_VPUD6 = 23
|
|
106
|
-
MXSML_RAS_VPUD7 = 24
|
|
107
|
-
MXSML_RAS_DMA0 = 25
|
|
108
|
-
MXSML_RAS_DMA2 = 26
|
|
109
|
-
MXSML_RAS_DMA2 = 27
|
|
110
|
-
MXSML_RAS_DMA3 = 28
|
|
111
|
-
MXSML_RAS_DMA4 = 29
|
|
112
|
-
MXSML_RAS_MCCTL0 = 30
|
|
113
|
-
MXSML_RAS_MCCTL1 = 31
|
|
114
|
-
MXSML_RAS_MCCTL2 = 32
|
|
115
|
-
MXSML_RAS_MCCTL3 = 33
|
|
116
|
-
MXSML_RAS_DHUB1 = 34
|
|
117
|
-
MXSML_RAS_DHUB2 = 35
|
|
118
|
-
MXSML_RAS_DHUB3 = 36
|
|
119
|
-
MXSML_RAS_DHUB4 = 37
|
|
120
|
-
MXSML_RAS_DHUB5 = 38
|
|
121
|
-
MXSML_RAS_DHUB6 = 39
|
|
122
|
-
MXSML_RAS_DHUB7 = 40
|
|
123
|
-
MXSML_RAS_ATH = 41
|
|
124
|
-
MXSML_RAS_ATUL20 = 42
|
|
125
|
-
MXSML_RAS_ATUL21 = 43
|
|
126
|
-
MXSML_RAS_XSC = 44
|
|
127
|
-
MXSML_RAS_CE = 45
|
|
128
|
-
|
|
129
|
-
_mxSmlDpmIp_t = c_uint
|
|
130
|
-
MXSML_DPM_DLA = 0 # Valid for N-class device
|
|
131
|
-
MXSML_DPM_XCORE = 1 # Valid for C-class device
|
|
132
|
-
MXSML_DPM_MC = 2
|
|
133
|
-
MXSML_DPM_SOC = 3
|
|
134
|
-
MXSML_DPM_DNOC = 4
|
|
135
|
-
MXSML_DPM_VPUE = 5
|
|
136
|
-
MXSML_DPM_VPUD = 6
|
|
137
|
-
MXSML_DPM_HBM = 7
|
|
138
|
-
MXSML_DPM_G2D = 8 # Valid for N-class device
|
|
139
|
-
MXSML_DPM_HBM_POWER = 9
|
|
140
|
-
MXSML_DPM_CCX = 10
|
|
141
|
-
MXSML_DPM_IP_GROUP = (
|
|
142
|
-
11 # Valid for N-class device, group of soc, dnoc, vpue, vpud, ccx, g2d
|
|
143
|
-
)
|
|
144
|
-
MXSML_DPM_DMA = 12
|
|
145
|
-
MXSML_DPM_CSC = 13
|
|
146
|
-
MXSML_DPM_ETH = 14
|
|
147
|
-
MXSML_DPM_RESERVED = 15
|
|
148
|
-
|
|
149
|
-
_mxSmlPciPowerState_t = c_uint
|
|
150
|
-
MXSML_POWER_PCI_STATE_D0 = 0
|
|
151
|
-
MXSML_POWER_PCI_STATE_D3HOT = 1
|
|
152
|
-
MXSML_POWER_PCI_STATE_D3COLD = 2
|
|
153
|
-
|
|
154
|
-
_mxSmlClockIp_t = c_uint
|
|
155
|
-
MXSML_CLOCK_CSC = 0
|
|
156
|
-
MXSML_CLOCK_DLA = 1 # Valid for N-class device
|
|
157
|
-
MXSML_CLOCK_MC = 2 # Valid for N-class device
|
|
158
|
-
MXSML_CLOCK_MC0 = 3 # Valid for C-class device
|
|
159
|
-
MXSML_CLOCK_MC1 = 4 # Valid for C-class device
|
|
160
|
-
MXSML_CLOCK_VPUE = 5
|
|
161
|
-
MXSML_CLOCK_VPUD = 6
|
|
162
|
-
MXSML_CLOCK_SOC = 7
|
|
163
|
-
MXSML_CLOCK_DNOC = 8
|
|
164
|
-
MXSML_CLOCK_G2D = 9 # Valid for N-class device
|
|
165
|
-
MXSML_CLOCK_CCX = 10
|
|
166
|
-
MXSML_CLOCK_XCORE = 11 # Valid for C-class device
|
|
167
|
-
|
|
168
|
-
_mxSmlMetaXLinkType_t = c_uint
|
|
169
|
-
MXSML_METAXLINK_INPUT = 0
|
|
170
|
-
MXSML_METAXLINK_TARGET = 1
|
|
171
|
-
|
|
172
|
-
_mxSmlGpuTopologyLevel_t = c_uint
|
|
173
|
-
MXSML_TOPOLOGY_INTERNAL = 0
|
|
174
|
-
MXSML_TOPOLOGY_SINGLE = 1 # All devices that only need traverse a single PCIe switch
|
|
175
|
-
MXSML_TOPOLOGY_MULTIPLE = 2 # All devices that need not traverse a host bridge
|
|
176
|
-
MXSML_TOPOLOGY_HOSTBRIDGE = 3 # All devices that are connected to the same host bridge
|
|
177
|
-
MXSML_TOPOLOGY_NODE = 4 # All devices that are connected to the same NUMA node but possibly multiple host bridges
|
|
178
|
-
MXSML_TOPOLOGY_METAXLINK = 5 # All devices that are connected to the same MetaXLink
|
|
179
|
-
MXSML_TOPOLOGY_SYSTEM = 6 # All devices in the system
|
|
180
|
-
MXSML_TOPOLOGY_UNDEFINED = 7
|
|
181
|
-
|
|
182
|
-
_mxSmlUsageIp_t = c_uint
|
|
183
|
-
MXSML_USAGE_DLA = 0 # Only valid for N-class device
|
|
184
|
-
MXSML_USAGE_VPUE = 1
|
|
185
|
-
MXSML_USAGE_VPUD = 2
|
|
186
|
-
MXSML_USAGE_G2D = 3 # Only valid for N-class device
|
|
187
|
-
MXSML_USAGE_XCORE = 4 # Only valid for C-class device
|
|
188
|
-
|
|
189
|
-
_mxSmlFwIpName_t = c_uint
|
|
190
|
-
MXSML_FW_IPNAME_SMP0 = 0
|
|
191
|
-
MXSML_FW_IPNAME_SMP1 = 1
|
|
192
|
-
MXSML_FW_IPNAME_CCX0 = 2
|
|
193
|
-
MXSML_FW_IPNAME_CCX1 = 3
|
|
194
|
-
MXSML_FW_IPNAME_CCX2 = 4
|
|
195
|
-
MXSML_FW_IPNAME_CCX3 = 5
|
|
196
|
-
MXSML_FW_IPNAME_ALL = 6
|
|
197
|
-
|
|
198
|
-
_mxSmlLoglevel_t = c_uint
|
|
199
|
-
MXSML_LOGLEVEL_NONE = 0
|
|
200
|
-
MXSML_LOGLEVEL_FATAL = 1
|
|
201
|
-
MXSML_LOGLEVEL_ERROR = 2
|
|
202
|
-
MXSML_LOGLEVEL_WARN = 3
|
|
203
|
-
MXSML_LOGLEVEL_INFO = 4
|
|
204
|
-
MXSML_LOGLEVEL_DEBUG = 5
|
|
205
|
-
MXSML_LOGLEVEL_VERBOSE = 6
|
|
206
|
-
MXSML_LOGLEVEL_UNKNOWN = 7
|
|
207
|
-
|
|
208
|
-
_mxSmlPciGen_t = c_uint
|
|
209
|
-
MXSML_PCI_GEN_1 = 1
|
|
210
|
-
MXSML_PCI_GEN_2 = 2
|
|
211
|
-
MXSML_PCI_GEN_3 = 3
|
|
212
|
-
MXSML_PCI_GEN_4 = 4
|
|
213
|
-
MXSML_PCI_GEN_5 = 5
|
|
214
|
-
|
|
215
|
-
_mxsmlReturn_t = c_uint
|
|
216
|
-
MXSML_SUCCESS = 0
|
|
217
|
-
MXSML_ERROR_FAILURE = 1
|
|
218
|
-
MXSML_ERROR_NO_DEVICE = 2
|
|
219
|
-
MXSML_ERROR_OPERATION_NOT_SUPPORT = 3
|
|
220
|
-
MXSML_ERROR_SYSFS_ERROR = 4
|
|
221
|
-
MXSML_ERROR_SYSFS_WRITE_ERROR = 5
|
|
222
|
-
MXSML_ERROR_INVALID_DEVICE_ID = 6
|
|
223
|
-
MXSML_ERROR_INVALID_DID_ID = 7
|
|
224
|
-
MXSML_ERROR_PERMISSION_DENIED = 8
|
|
225
|
-
MXSML_ERROR_INVALID_INPUT = 9
|
|
226
|
-
MXSML_ERROR_INSUFFICIENT_SIZE = 10
|
|
227
|
-
MXSML_ERROR_RESERVED3 = 11
|
|
228
|
-
MXSML_ERROR_IO_CONTROL_FAILURE = 12
|
|
229
|
-
MXSML_ERROR_MMAP_FAILURE = 13
|
|
230
|
-
MXSML_ERROR_UN_MMAP_FAILURE = 14
|
|
231
|
-
MXSML_ERROR_INVALID_INPUT_FOR_MMAP = 15
|
|
232
|
-
MXSML_ERROR_RESERVED1 = 16
|
|
233
|
-
MXSML_ERROR_RESERVED2 = 17
|
|
234
|
-
MXSML_ERROR_TARGET_VF_NOT_FOUND = 18
|
|
235
|
-
MXSML_ERROR_INVALID_FREQUENCY = 19
|
|
236
|
-
MXSML_ERROR_FLR_NOT_READY = 20
|
|
237
|
-
MXSML_ERROR_OPEN_DEVICE_FILE_FAILURE = 21
|
|
238
|
-
MXSML_ERROR_CLOSE_DEVICE_FILE_FAILURE = 22
|
|
239
|
-
MXSML_ERROR_BUSY_DEVICE = 23
|
|
240
|
-
MXSML_ERROR_MMIO_NOT_ENOUGH = 24
|
|
241
|
-
MXSML_ERROR_GET_PCI_BRIDGE_FAILURE = 25
|
|
242
|
-
MXSML_ERROR_LOAD_DLL_FAILURE = 26
|
|
243
|
-
|
|
244
|
-
_mxSmlMetaXLinkState_t = c_uint
|
|
245
|
-
MXSML_MetaXLink_State_Enabled = 0
|
|
246
|
-
MXSML_MetaXLink_State_Smi_Disabled = 1
|
|
247
|
-
MXSML_MetaXLink_State_Vf_Disabled = 2
|
|
248
|
-
MXSML_MetaXLink_State_GpuNum_Disabled = 3
|
|
249
|
-
MXSML_MetaXLink_State_Training_Disabled = 4
|
|
250
|
-
|
|
251
|
-
_mxSmlMxlkPortState_t = c_uint
|
|
252
|
-
MXSML_Mxlk_Port_State_NoTraining = 0
|
|
253
|
-
MXSML_Mxlk_Port_State_Up = 1
|
|
254
|
-
MXSML_Mxlk_Port_State_Down_Optical_InPlace = 2
|
|
255
|
-
MXSML_Mxlk_Port_State_Down_Optical_OutPlace = 3
|
|
256
|
-
MXSML_Mxlk_Port_State_Down_Optical_NoUse = 4
|
|
257
|
-
MXSML_Mxlk_Port_State_NoUse = 5
|
|
258
|
-
|
|
259
|
-
_mxSmlPciEventType_t = c_uint
|
|
260
|
-
MXSML_Pci_Event_AER_UE = 0
|
|
261
|
-
MXSML_Pci_Event_AER_CE = 1
|
|
262
|
-
MXSML_Pci_Event_SYNFLD = 2
|
|
263
|
-
MXSML_Pci_Event_DBE = 3
|
|
264
|
-
MXSML_Pci_Event_MMIO = 4
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
# buffer size
|
|
268
|
-
MXSML_DEVICE_BDF_ID_SIZE = 32 # Guaranteed maximum possible size for BDF ID
|
|
269
|
-
MXSML_EEPROM_INFO_SIZE = 1024 # Guaranteed maximum possible size for Eeprom info
|
|
270
|
-
MXSML_VERSION_INFO_SIZE = 64 # Guaranteed maximum possible size for Version info
|
|
271
|
-
MXSML_VIRTUAL_DEVICE_SIZE = (
|
|
272
|
-
128 # Guaranteed maximum possible size for virtual device ids
|
|
273
|
-
)
|
|
274
|
-
MXSML_DEVICE_UUID_SIZE = 96 # Guaranteed maximum possible size for UUID
|
|
275
|
-
MXSML_DEVICE_NAME_SIZE = 32 # Guaranteed maximum possible size for Device name
|
|
276
|
-
MXSML_CHIP_SERIAL_SIZE = 32 # Guaranteed maximum possible size for chip serial
|
|
277
|
-
MXSML_BOARD_SERIAL_SIZE = 32 # Guaranteed maximum possible size for board serial
|
|
278
|
-
MXSML_OPTICAL_MODULE_INFO_SIZE = (
|
|
279
|
-
32 # Guaranteed maximum possible size for optical module info
|
|
280
|
-
)
|
|
281
|
-
MXSML_DEVICE_REAL_PATH_SIZE = (
|
|
282
|
-
1024 # Guaranteed maximum possible size for device real path
|
|
283
|
-
)
|
|
284
|
-
MXSML_VBIOS_BIN_PATH_SIZE = 150 # Guaranteed maximum possible size for file path
|
|
285
|
-
DEVICE_UNAVAILABLE_REASON_SIZE = (
|
|
286
|
-
64 # Guaranteed maximum possible size for device unavailable reason
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
MXSML_RAS_ERROR_REG_NUM = 128 # Number of RAS error counter register
|
|
290
|
-
MXSML_RAS_STATUS_REG_NUM = 128 # Number of RAS status register
|
|
291
|
-
|
|
292
|
-
MXSML_METAX_LINK_NUM = 7 # Number of C-class device MetaXLink
|
|
293
|
-
|
|
294
|
-
MXSML_PROCESS_NAME_SIZE = 64 # Maximum length showed process name
|
|
295
|
-
MXSML_MAX_GPU_NUM_USED_BY_PROCESS = (
|
|
296
|
-
64 # Maximum stored GPU information used by a process
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
MXSML_MAX_SMP_NUM = 2 # The max num of smp
|
|
300
|
-
MXSML_MAX_CCX_NUM = 4 # The max num of ccx
|
|
301
|
-
|
|
302
|
-
MXSML_MIN_PCI_DELAY = 1 # Minimum pci delay, unit: ms
|
|
303
|
-
MXSML_MAX_PCI_DELAY = 10000 # Maximum pci delay, unit: ms
|
|
304
|
-
|
|
305
|
-
# Used for mxSmlInitWithFlags
|
|
306
|
-
MXSML_INIT_FLAG_NORMAL = 0 # the behavior is the same as mxsmlInit
|
|
307
|
-
MXSML_INIT_FLAG_REINIT = 1 # repeated initialization will reinit resources
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
## MXSML Structure ##
|
|
311
|
-
class mxsmlFriendlyObject(object):
|
|
312
|
-
def __init__(self, dictionary):
|
|
313
|
-
for x in dictionary:
|
|
314
|
-
setattr(self, x, dictionary[x])
|
|
315
|
-
|
|
316
|
-
def __str__(self):
|
|
317
|
-
return self.__dict__.__str__()
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
def mxsmlStructToFriendlyObject(struct):
|
|
321
|
-
dictionary = {}
|
|
322
|
-
for field in struct._fields_:
|
|
323
|
-
key = field[0]
|
|
324
|
-
value = getattr(struct, key)
|
|
325
|
-
dictionary[key] = value.decode() if isinstance(value, bytes) else value
|
|
326
|
-
return mxsmlFriendlyObject(dictionary)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
# pack the object so it can be passed to the MXSML library
|
|
330
|
-
def mxsmlFriendlyObjectToStruct(obj, model):
|
|
331
|
-
for field in model._fields_:
|
|
332
|
-
key = field[0]
|
|
333
|
-
value = obj.__dict__[key]
|
|
334
|
-
setattr(model, key, value.encode())
|
|
335
|
-
return model
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
class _MxsmlBaseStructure(Structure):
|
|
339
|
-
_format_ = {}
|
|
340
|
-
_default_format_ = "%s"
|
|
341
|
-
|
|
342
|
-
def __str__(self):
|
|
343
|
-
attrs = []
|
|
344
|
-
for field in self._fields_:
|
|
345
|
-
attr_name = field[0]
|
|
346
|
-
attr_value = getattr(self, attr_name)
|
|
347
|
-
fmt = self._default_format_
|
|
348
|
-
if attr_name in self._format_:
|
|
349
|
-
fmt = self._format_[attr_name]
|
|
350
|
-
attrs.append(("%s: " + fmt) % (attr_name, attr_value))
|
|
351
|
-
return self.__class__.__name__ + "(" + ", ".join(attrs) + ")"
|
|
352
|
-
|
|
353
|
-
def __getattribute__(self, name):
|
|
354
|
-
res = super().__getattribute__(name)
|
|
355
|
-
if isinstance(res, bytes):
|
|
356
|
-
return res.decode()
|
|
357
|
-
return res
|
|
358
|
-
|
|
359
|
-
def __setattr__(self, name, value):
|
|
360
|
-
if isinstance(value, str):
|
|
361
|
-
value = value.encode()
|
|
362
|
-
super().__setattr__(name, value)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
class c_mxsmlDeviceInfo_t(_MxsmlBaseStructure):
|
|
366
|
-
_fields_ = [
|
|
367
|
-
("deviceId", c_uint),
|
|
368
|
-
("type", c_uint), # Do not use
|
|
369
|
-
("bdfId", c_char * MXSML_DEVICE_BDF_ID_SIZE),
|
|
370
|
-
("gpuId", c_uint),
|
|
371
|
-
("nodeId", c_uint),
|
|
372
|
-
("uuid", c_char * MXSML_DEVICE_UUID_SIZE),
|
|
373
|
-
("brand", _mxSmlDeviceBrand_t),
|
|
374
|
-
("mode", _mxSmlDeviceVirtualizationMode_t),
|
|
375
|
-
("deviceName", c_char * MXSML_DEVICE_NAME_SIZE),
|
|
376
|
-
]
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
class c_mxSmlVirtualDeviceIds_t(_MxsmlBaseStructure):
|
|
380
|
-
_fields_ = [
|
|
381
|
-
("number", c_int),
|
|
382
|
-
("deviceId", c_int * MXSML_VIRTUAL_DEVICE_SIZE),
|
|
383
|
-
]
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
class c_mxSmlLimitedDeviceIds_t(c_mxSmlVirtualDeviceIds_t):
|
|
387
|
-
pass
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
class c_mxsmlMemoryInfo_t(_MxsmlBaseStructure):
|
|
391
|
-
_fields_ = [
|
|
392
|
-
("visVramTotal", c_long),
|
|
393
|
-
("visVramUse", c_long),
|
|
394
|
-
("vramTotal", c_long),
|
|
395
|
-
("vramUse", c_long),
|
|
396
|
-
("xttTotal", c_long),
|
|
397
|
-
("xttUse", c_long),
|
|
398
|
-
]
|
|
399
|
-
_default_format_ = "%d KB"
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
class c_mxSmlPmbusInfo_t(_MxsmlBaseStructure):
|
|
403
|
-
_fields_ = [
|
|
404
|
-
("voltage", c_uint),
|
|
405
|
-
("current", c_uint),
|
|
406
|
-
("power", c_uint),
|
|
407
|
-
]
|
|
408
|
-
_format_ = {"voltage": "%d mV", "current": "%d mA", "power": "%d mW"}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
class c_mxSmlBoardWayElectricInfo_t(_MxsmlBaseStructure):
|
|
412
|
-
_fields_ = [
|
|
413
|
-
("voltage", c_uint),
|
|
414
|
-
("current", c_uint),
|
|
415
|
-
("power", c_uint),
|
|
416
|
-
]
|
|
417
|
-
_format_ = {"voltage": "%d mV", "current": "%d mA", "power": "%d mW"}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
class c_mxSmlMxcDpmPerfLevel_t(_MxsmlBaseStructure):
|
|
421
|
-
_fields_ = [
|
|
422
|
-
("xcore", c_uint),
|
|
423
|
-
("mc", c_uint),
|
|
424
|
-
("soc", c_uint),
|
|
425
|
-
("dnoc", c_uint),
|
|
426
|
-
("vpue", c_uint),
|
|
427
|
-
("vpud", c_uint),
|
|
428
|
-
("ccx", c_uint),
|
|
429
|
-
]
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
class c_mxSmlEepromInfo_t(_MxsmlBaseStructure):
|
|
433
|
-
_fields_ = [
|
|
434
|
-
("content", c_char * MXSML_EEPROM_INFO_SIZE),
|
|
435
|
-
]
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
class c_mxSmlRasErrorRegister_t(_MxsmlBaseStructure):
|
|
439
|
-
_fields_ = [
|
|
440
|
-
("rasIp", _mxSmlRasIp_t),
|
|
441
|
-
("registerIndex", c_uint),
|
|
442
|
-
("rasErrorUe", c_int),
|
|
443
|
-
("rasErrorCe", c_int),
|
|
444
|
-
]
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
class c_mxSmlRasErrorData_t(_MxsmlBaseStructure):
|
|
448
|
-
_fields_ = [
|
|
449
|
-
("rasErrorRegister", c_mxSmlRasErrorRegister_t * MXSML_RAS_ERROR_REG_NUM),
|
|
450
|
-
("showRasErrorSize", c_uint),
|
|
451
|
-
]
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
class c_mxSmlRasRegister_t(_MxsmlBaseStructure):
|
|
455
|
-
_fields_ = [
|
|
456
|
-
("rasIp", _mxSmlRasIp_t),
|
|
457
|
-
("registerIndex", c_uint),
|
|
458
|
-
("registerData", c_int),
|
|
459
|
-
]
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
class c_mxSmlRasStatusData_t(_MxsmlBaseStructure):
|
|
463
|
-
_fields_ = [
|
|
464
|
-
("rasStatusRegister", c_mxSmlRasRegister_t * MXSML_RAS_STATUS_REG_NUM),
|
|
465
|
-
("showRasStatusSize", c_uint),
|
|
466
|
-
]
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
class c_mxSmlPcieInfo_t(_MxsmlBaseStructure):
|
|
470
|
-
_fields_ = [
|
|
471
|
-
("speed", c_float),
|
|
472
|
-
("width", c_uint),
|
|
473
|
-
]
|
|
474
|
-
_format_ = {"speed": "%.1f GT/s", "width": "x%d"}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
class c_mxSmlCodecStatus_t(_MxsmlBaseStructure):
|
|
478
|
-
_fields_ = [
|
|
479
|
-
("encoder", c_int),
|
|
480
|
-
("decoder", c_int),
|
|
481
|
-
]
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
class c_mxSmlHbmBandWidth_t(_MxsmlBaseStructure):
|
|
485
|
-
_fields_ = [
|
|
486
|
-
("hbmBandwidthReqTotal", c_int),
|
|
487
|
-
("hbmBandwidthRespTotal", c_int),
|
|
488
|
-
]
|
|
489
|
-
_default_format_ = "%d MBytes/s"
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
class c_mxSmlPcieThroughput_t(_MxsmlBaseStructure):
|
|
493
|
-
_fields_ = [
|
|
494
|
-
("rx", c_int),
|
|
495
|
-
("tx", c_int),
|
|
496
|
-
]
|
|
497
|
-
_default_format_ = "%d MBytes/s"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
class c_mxSmlDmaEngineBandwidth_t(_MxsmlBaseStructure):
|
|
501
|
-
_fields_ = [
|
|
502
|
-
("readReqBandwidth", c_int),
|
|
503
|
-
("readRespBandwidth", c_int),
|
|
504
|
-
("writeReqBandwidth", c_int),
|
|
505
|
-
("writeRespBandwidth", c_int),
|
|
506
|
-
]
|
|
507
|
-
_default_format_ = "%d MBytes/s"
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
class c_mxSmlMetaXLinkBandwidth_t(_MxsmlBaseStructure):
|
|
511
|
-
_fields_ = [
|
|
512
|
-
("requestBandwidth", c_int),
|
|
513
|
-
("responseBandwidth", c_int),
|
|
514
|
-
]
|
|
515
|
-
_default_format_ = "%d MBytes/s"
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
class c_mxSmlMetaXLinkRemoteInfo_t(_MxsmlBaseStructure):
|
|
519
|
-
_fields_ = [
|
|
520
|
-
("deviceId", c_int),
|
|
521
|
-
("bdfId", c_char * MXSML_DEVICE_BDF_ID_SIZE),
|
|
522
|
-
]
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
class c_mxSmlMcmMetaXLinkRemoteInfo_t(_MxsmlBaseStructure):
|
|
526
|
-
_fields_ = [
|
|
527
|
-
("deviceId", c_int),
|
|
528
|
-
("bdfId", c_char * MXSML_DEVICE_BDF_ID_SIZE),
|
|
529
|
-
("dieId", c_uint),
|
|
530
|
-
]
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
class c_mxSmlProcessGpuInfo_t(_MxsmlBaseStructure):
|
|
534
|
-
_fields_ = [
|
|
535
|
-
("bdfId", c_char * MXSML_DEVICE_BDF_ID_SIZE),
|
|
536
|
-
("gpuId", c_uint),
|
|
537
|
-
("gpuMemoryUsage", c_ulong),
|
|
538
|
-
]
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
class c_mxSmlProcessInfo_t(_MxsmlBaseStructure):
|
|
542
|
-
_fields_ = [
|
|
543
|
-
("processId", c_uint),
|
|
544
|
-
("processName", c_char * MXSML_PROCESS_NAME_SIZE),
|
|
545
|
-
("gpuNumber", c_uint),
|
|
546
|
-
("processGpuInfo", c_mxSmlProcessGpuInfo_t * MXSML_MAX_GPU_NUM_USED_BY_PROCESS),
|
|
547
|
-
]
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
class c_mxSmlProcessGpuInfo_v2_t(_MxsmlBaseStructure):
|
|
551
|
-
_fields_ = [
|
|
552
|
-
("bdfId", c_char * MXSML_DEVICE_BDF_ID_SIZE),
|
|
553
|
-
("gpuId", c_uint),
|
|
554
|
-
("gpuMemoryUsage", c_ulong),
|
|
555
|
-
("dieId", c_uint),
|
|
556
|
-
]
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
class c_mxSmlProcessInfo_v2_t(_MxsmlBaseStructure):
|
|
560
|
-
_fields_ = [
|
|
561
|
-
("processId", c_uint),
|
|
562
|
-
("processName", c_char * MXSML_PROCESS_NAME_SIZE),
|
|
563
|
-
("gpuNumber", c_uint),
|
|
564
|
-
(
|
|
565
|
-
"processGpuInfo",
|
|
566
|
-
c_mxSmlProcessGpuInfo_v2_t * MXSML_MAX_GPU_NUM_USED_BY_PROCESS,
|
|
567
|
-
),
|
|
568
|
-
]
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
class c_mxSmlFwLoglevel_t(_MxsmlBaseStructure):
|
|
572
|
-
_fields_ = [
|
|
573
|
-
("smpCount", c_uint),
|
|
574
|
-
("smp", _mxSmlLoglevel_t * MXSML_MAX_SMP_NUM),
|
|
575
|
-
("ccxCount", c_uint),
|
|
576
|
-
("ccx", _mxSmlLoglevel_t * MXSML_MAX_CCX_NUM),
|
|
577
|
-
]
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
class c_mxSmlMetaXLinkInfo_t(_MxsmlBaseStructure):
|
|
581
|
-
_fields_ = [
|
|
582
|
-
("speed", c_float * MXSML_METAX_LINK_NUM),
|
|
583
|
-
("width", c_uint * MXSML_METAX_LINK_NUM),
|
|
584
|
-
]
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
class c_mxSmlSingleMxlkInfo_t(_MxsmlBaseStructure):
|
|
588
|
-
_fields_ = [
|
|
589
|
-
("speed", c_float),
|
|
590
|
-
("width", c_uint),
|
|
591
|
-
]
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
class c_mxSmlOpticalModuleStatus_t(_MxsmlBaseStructure):
|
|
595
|
-
_fields_ = [
|
|
596
|
-
("temperature", c_int), # unit: degress 0.01C
|
|
597
|
-
("voltage", c_uint), # unit: mV
|
|
598
|
-
("moduleState", c_uint),
|
|
599
|
-
("dataPathState", c_uint),
|
|
600
|
-
("rxState", c_uint * 2), # 6 bytes total
|
|
601
|
-
("version", c_uint * 2), # version[0]: major, version[1]: minor
|
|
602
|
-
]
|
|
603
|
-
_format_ = {"voltage": "%d mV", "dataPathState": "0x%x"}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
class c_mxSmlOpticalModuleInfo_t(_MxsmlBaseStructure):
|
|
607
|
-
_fields_ = [
|
|
608
|
-
("name", c_char * MXSML_OPTICAL_MODULE_INFO_SIZE),
|
|
609
|
-
("oui", c_uint * 3),
|
|
610
|
-
("pn", c_char * MXSML_OPTICAL_MODULE_INFO_SIZE),
|
|
611
|
-
("rev", c_char * MXSML_OPTICAL_MODULE_INFO_SIZE),
|
|
612
|
-
("sn", c_char * MXSML_OPTICAL_MODULE_INFO_SIZE),
|
|
613
|
-
]
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
class c_mxSmlVbiosUpgradeArg_t(_MxsmlBaseStructure):
|
|
617
|
-
_fields_ = [
|
|
618
|
-
("timeLimit", c_uint),
|
|
619
|
-
("vbiosBinPath", c_char * (MXSML_VBIOS_BIN_PATH_SIZE + 1)),
|
|
620
|
-
("forceUpgrade", c_int),
|
|
621
|
-
("ret", c_uint),
|
|
622
|
-
("pfBar0Size", c_int),
|
|
623
|
-
("vfBar0Size", c_int),
|
|
624
|
-
]
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
class c_mxSmlPciEventInfo_t(_MxsmlBaseStructure):
|
|
628
|
-
_fields_ = [
|
|
629
|
-
("bitNumber", c_int),
|
|
630
|
-
("count", c_int),
|
|
631
|
-
("firstTime", c_char * 20),
|
|
632
|
-
("name", c_char * 64),
|
|
633
|
-
]
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
class c_mxSmlDeviceUnavailableReasonInfo_t(_MxsmlBaseStructure):
|
|
637
|
-
_fields_ = [
|
|
638
|
-
("unavailableCode", c_int),
|
|
639
|
-
("unavailableReason", c_char * DEVICE_UNAVAILABLE_REASON_SIZE),
|
|
640
|
-
]
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
class c_mxSmlEccErrorCount_t(_MxsmlBaseStructure):
|
|
644
|
-
_fields_ = [
|
|
645
|
-
("sramCE", c_uint),
|
|
646
|
-
("sramUE", c_uint),
|
|
647
|
-
("dramCE", c_uint),
|
|
648
|
-
("dramUE", c_uint),
|
|
649
|
-
("retiredPage", c_uint),
|
|
650
|
-
]
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
class c_mxSmlMetaXLinkTopo_t(_MxsmlBaseStructure):
|
|
654
|
-
_fields_ = [
|
|
655
|
-
("topologyId", c_uint),
|
|
656
|
-
("socketId", c_uint),
|
|
657
|
-
("dieId", c_uint),
|
|
658
|
-
]
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
## MXSML Error ##
|
|
662
|
-
class MXSMLError(Exception):
|
|
663
|
-
_valClassMapping = dict()
|
|
664
|
-
|
|
665
|
-
def __new__(typ, value):
|
|
666
|
-
"""
|
|
667
|
-
Maps value to a proper subclass of MXSMLError.
|
|
668
|
-
See _generateErrorSubclass function for more details
|
|
669
|
-
"""
|
|
670
|
-
if typ == MXSMLError:
|
|
671
|
-
typ = MXSMLError._valClassMapping.get(value, typ)
|
|
672
|
-
obj = Exception.__new__(typ)
|
|
673
|
-
obj.value = value
|
|
674
|
-
return obj
|
|
675
|
-
|
|
676
|
-
def __str__(self):
|
|
677
|
-
try:
|
|
678
|
-
return str(mxSmlGetErrorString(self.value))
|
|
679
|
-
except MXSMLError:
|
|
680
|
-
return "MXSML Error with code: " + str(self.value)
|
|
681
|
-
|
|
682
|
-
def __eq__(self, other):
|
|
683
|
-
return self.value == other.value
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
def _generateErrorSubclass():
|
|
687
|
-
# Create execption subclass for each MXSML Error
|
|
688
|
-
def generate_new_func(val):
|
|
689
|
-
def new(typ):
|
|
690
|
-
obj = MXSMLError.__new__(typ, val)
|
|
691
|
-
return obj
|
|
692
|
-
|
|
693
|
-
return new
|
|
694
|
-
|
|
695
|
-
this_module = sys.modules[__name__]
|
|
696
|
-
mxsmlErrorsNames = [x for x in dir(this_module) if x.startswith("MXSML_ERROR_")]
|
|
697
|
-
for err_name in mxsmlErrorsNames:
|
|
698
|
-
class_name = "MXSMLError_" + string.capwords(
|
|
699
|
-
err_name.replace("MXSML_ERROR_", ""), "_"
|
|
700
|
-
).replace("_", "")
|
|
701
|
-
err_val = getattr(this_module, err_name)
|
|
702
|
-
new_error_class = type(
|
|
703
|
-
class_name, (MXSMLError,), {"__new__": generate_new_func(err_val)}
|
|
704
|
-
)
|
|
705
|
-
new_error_class.__module__ = __name__
|
|
706
|
-
setattr(this_module, class_name, new_error_class)
|
|
707
|
-
MXSMLError._valClassMapping[err_val] = new_error_class
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
_generateErrorSubclass()
|
|
711
|
-
|
|
712
|
-
## Lib loading ##
|
|
713
|
-
mxSmlLib = None
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
def get_mxSmlLib():
|
|
717
|
-
return mxSmlLib
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
def _mxsmlCheckReturn(ret):
|
|
721
|
-
if ret != MXSML_SUCCESS:
|
|
722
|
-
raise MXSMLError(ret)
|
|
723
|
-
return ret
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
## Function access ##
|
|
727
|
-
_mxsmlFunctionPointerCache = {}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
def _mxsmlGetFunctionPointer(name):
|
|
731
|
-
if name in _mxsmlFunctionPointerCache:
|
|
732
|
-
return _mxsmlFunctionPointerCache[name]
|
|
733
|
-
|
|
734
|
-
global mxSmlLib
|
|
735
|
-
if mxSmlLib == None:
|
|
736
|
-
raise MXSMLError(MXSML_ERROR_FAILURE)
|
|
737
|
-
|
|
738
|
-
_mxsmlFunctionPointerCache[name] = getattr(mxSmlLib, name)
|
|
739
|
-
return _mxsmlFunctionPointerCache[name]
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
## string/bytes conversion for ease of use
|
|
743
|
-
def convertStrBytes(func):
|
|
744
|
-
@wraps(func)
|
|
745
|
-
def wrapper(*args, **kwargs):
|
|
746
|
-
# encoding a str returns bytes
|
|
747
|
-
args = [arg.encode() if isinstance(arg, str) else arg for arg in args]
|
|
748
|
-
res = func(*args, **kwargs)
|
|
749
|
-
if isinstance(res, bytes):
|
|
750
|
-
return res.decode()
|
|
751
|
-
return res
|
|
752
|
-
|
|
753
|
-
return wrapper
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
def _searchMxsmlLibrary():
|
|
757
|
-
for lib in [
|
|
758
|
-
"/opt/mxdriver/lib/libmxsml.so",
|
|
759
|
-
"/opt/maca/lib/libmxsml.so",
|
|
760
|
-
"/opt/mxn100/lib/libmxsml.so",
|
|
761
|
-
]:
|
|
762
|
-
if os.path.isfile(lib):
|
|
763
|
-
return lib
|
|
764
|
-
|
|
765
|
-
libmxsml = "libmxsml.so"
|
|
766
|
-
for root, __, files in os.walk("/opt", followlinks=True):
|
|
767
|
-
if libmxsml in files:
|
|
768
|
-
return os.path.join(os.path.realpath(root), libmxsml)
|
|
769
|
-
return None
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
def _loadMxsmlLibrary():
|
|
773
|
-
"Load the library if it isn't loaded already"
|
|
774
|
-
global mxSmlLib
|
|
775
|
-
if mxSmlLib != None:
|
|
776
|
-
return
|
|
777
|
-
|
|
778
|
-
try:
|
|
779
|
-
path_libmxsml = _searchMxsmlLibrary()
|
|
780
|
-
if not path_libmxsml:
|
|
781
|
-
_mxsmlCheckReturn(MXSML_ERROR_LOAD_DLL_FAILURE)
|
|
782
|
-
else:
|
|
783
|
-
mxSmlLib = CDLL(path_libmxsml)
|
|
784
|
-
except OSError as ose:
|
|
785
|
-
_mxsmlCheckReturn(MXSML_ERROR_LOAD_DLL_FAILURE)
|
|
786
|
-
if mxSmlLib == None:
|
|
787
|
-
_mxsmlCheckReturn(MXSML_ERROR_LOAD_DLL_FAILURE)
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
## function wrappers ##
|
|
791
|
-
def mxSmlInit():
|
|
792
|
-
_loadMxsmlLibrary()
|
|
793
|
-
fn = _mxsmlGetFunctionPointer("mxSmlInit")
|
|
794
|
-
ret = fn()
|
|
795
|
-
_mxsmlCheckReturn(ret)
|
|
796
|
-
return None
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
def mxSmlInitWithFlags(flags):
|
|
800
|
-
_loadMxsmlLibrary()
|
|
801
|
-
fn = _mxsmlGetFunctionPointer("mxSmlInitWithFlags")
|
|
802
|
-
ret = fn(flags)
|
|
803
|
-
_mxsmlCheckReturn(ret)
|
|
804
|
-
return None
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
@convertStrBytes
|
|
808
|
-
def mxSmlGetMacaVersion():
|
|
809
|
-
version = create_string_buffer(MXSML_VERSION_INFO_SIZE)
|
|
810
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMacaVersion")
|
|
811
|
-
ret = fn(byref(version), byref(c_uint(MXSML_VERSION_INFO_SIZE)))
|
|
812
|
-
_mxsmlCheckReturn(ret)
|
|
813
|
-
return version.value
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
def mxSmlGetDeviceCount():
|
|
817
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceCount")
|
|
818
|
-
return fn()
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
def mxSmlGetPfDeviceCount():
|
|
822
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPfDeviceCount")
|
|
823
|
-
return fn()
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
def mxSmlGetDeviceInfo(device_id):
|
|
827
|
-
device_info = c_mxsmlDeviceInfo_t()
|
|
828
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceInfo")
|
|
829
|
-
ret = fn(c_uint(device_id), byref(device_info))
|
|
830
|
-
_mxsmlCheckReturn(ret)
|
|
831
|
-
return device_info
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
def mxSmlGetVirtualDevicesByPhysicalId(device_id):
|
|
835
|
-
devices = c_mxSmlVirtualDeviceIds_t()
|
|
836
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetVirtualDevicesByPhysicalId")
|
|
837
|
-
ret = fn(c_uint(device_id), byref(devices))
|
|
838
|
-
_mxsmlCheckReturn(ret)
|
|
839
|
-
return devices
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
def mxSmlGetAllLimitedDevices():
|
|
843
|
-
devices = c_mxSmlLimitedDeviceIds_t()
|
|
844
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetAllLimitedDevices")
|
|
845
|
-
ret = fn(byref(devices))
|
|
846
|
-
_mxsmlCheckReturn(ret)
|
|
847
|
-
return devices
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
def mxSmlGetLimitedDeviceInfo(device_id):
|
|
851
|
-
device_info = c_mxsmlDeviceInfo_t()
|
|
852
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetLimitedDeviceInfo")
|
|
853
|
-
ret = fn(c_uint(device_id), byref(device_info))
|
|
854
|
-
_mxsmlCheckReturn(ret)
|
|
855
|
-
return device_info
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
@convertStrBytes
|
|
859
|
-
def mxSmlGetDeviceVersion(device_id, version_unit):
|
|
860
|
-
version = create_string_buffer(MXSML_VERSION_INFO_SIZE)
|
|
861
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceVersion")
|
|
862
|
-
ret = fn(
|
|
863
|
-
c_uint(device_id),
|
|
864
|
-
_mxSmlVersionUnit_t(version_unit),
|
|
865
|
-
byref(version),
|
|
866
|
-
byref(c_uint(MXSML_VERSION_INFO_SIZE)),
|
|
867
|
-
)
|
|
868
|
-
_mxsmlCheckReturn(ret)
|
|
869
|
-
return version.value
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
@convertStrBytes
|
|
873
|
-
def mxSmlGetChipSerial(device_id):
|
|
874
|
-
serial = create_string_buffer(MXSML_CHIP_SERIAL_SIZE)
|
|
875
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetChipSerial")
|
|
876
|
-
ret = fn(c_uint(device_id), byref(serial), byref(c_uint(MXSML_CHIP_SERIAL_SIZE)))
|
|
877
|
-
_mxsmlCheckReturn(ret)
|
|
878
|
-
return serial.value
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
def mxSmlGetMemoryInfo(device_id):
|
|
882
|
-
memory_info = c_mxsmlMemoryInfo_t()
|
|
883
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMemoryInfo")
|
|
884
|
-
ret = fn(c_uint(device_id), byref(memory_info))
|
|
885
|
-
_mxsmlCheckReturn(ret)
|
|
886
|
-
return memory_info
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
def mxSmlGetPmbusInfo(device_id, pmbus_unit):
|
|
890
|
-
pmbus_info = c_mxSmlPmbusInfo_t()
|
|
891
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPmbusInfo")
|
|
892
|
-
ret = fn(c_uint(device_id), _mxSmlPmbusUnit_t(pmbus_unit), byref(pmbus_info))
|
|
893
|
-
_mxsmlCheckReturn(ret)
|
|
894
|
-
return pmbus_info
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
def mxSmlGetTemperatureInfo(device_id, temperature_type):
|
|
898
|
-
temperature = c_int()
|
|
899
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetTemperatureInfo")
|
|
900
|
-
ret = fn(
|
|
901
|
-
c_uint(device_id),
|
|
902
|
-
_mxSmlTemperatureSensors_t(temperature_type),
|
|
903
|
-
byref(temperature),
|
|
904
|
-
)
|
|
905
|
-
_mxsmlCheckReturn(ret)
|
|
906
|
-
return temperature.value
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
def mxSmlGetBoardPowerInfo(device_id):
|
|
910
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetBoardPowerInfo")
|
|
911
|
-
size = c_uint(0)
|
|
912
|
-
ret = fn(c_uint(device_id), byref(size), (c_mxSmlBoardWayElectricInfo_t * 0)())
|
|
913
|
-
|
|
914
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
915
|
-
power_infos = (c_mxSmlBoardWayElectricInfo_t * size.value)()
|
|
916
|
-
ret = fn(c_uint(device_id), byref(size), byref(power_infos))
|
|
917
|
-
_mxsmlCheckReturn(ret)
|
|
918
|
-
return [info for info in power_infos]
|
|
919
|
-
else:
|
|
920
|
-
raise MXSMLError(ret)
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
def mxSmlGetDpmMaxPerfLevel(device_id):
|
|
924
|
-
dpm_level = c_mxSmlMxcDpmPerfLevel_t()
|
|
925
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDpmMaxPerfLevel")
|
|
926
|
-
ret = fn(c_uint(device_id), byref(dpm_level))
|
|
927
|
-
_mxsmlCheckReturn(ret)
|
|
928
|
-
return dpm_level
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
def mxSmlGetDpmIpMaxPerfLevel(device_id, dpm_ip):
|
|
932
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDpmIpMaxPerfLevel")
|
|
933
|
-
level = c_uint(0)
|
|
934
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), byref(level))
|
|
935
|
-
_mxsmlCheckReturn(ret)
|
|
936
|
-
return level.value
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
def mxSmlGetEepromInfo(device_id):
|
|
940
|
-
eeprom_info = c_mxSmlEepromInfo_t()
|
|
941
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetEepromInfo")
|
|
942
|
-
ret = fn(c_uint(device_id), byref(eeprom_info))
|
|
943
|
-
_mxsmlCheckReturn(ret)
|
|
944
|
-
return eeprom_info
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
@convertStrBytes
|
|
948
|
-
def mxSmlGetBoardSerial(device_id):
|
|
949
|
-
serial = create_string_buffer(MXSML_BOARD_SERIAL_SIZE)
|
|
950
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetBoardSerial")
|
|
951
|
-
ret = fn(c_uint(device_id), byref(serial), byref(c_uint(MXSML_BOARD_SERIAL_SIZE)))
|
|
952
|
-
_mxsmlCheckReturn(ret)
|
|
953
|
-
return serial.value
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
@convertStrBytes
|
|
957
|
-
def mxSmlGetPptableVersion(device_id):
|
|
958
|
-
version = create_string_buffer(MXSML_VERSION_INFO_SIZE)
|
|
959
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPptableVersion")
|
|
960
|
-
ret = fn(c_uint(device_id), c_uint(5), byref(version))
|
|
961
|
-
_mxsmlCheckReturn(ret)
|
|
962
|
-
return version.value
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
def mxSmlGetRasErrorData(device_id):
|
|
966
|
-
ras = c_mxSmlRasErrorData_t()
|
|
967
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetRasErrorData")
|
|
968
|
-
ret = fn(c_uint(device_id), byref(ras))
|
|
969
|
-
_mxsmlCheckReturn(ret)
|
|
970
|
-
return ras
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
def mxSmlGetRasStatusData(device_id):
|
|
974
|
-
ras = c_mxSmlRasStatusData_t()
|
|
975
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetRasStatusData")
|
|
976
|
-
ret = fn(c_uint(device_id), byref(ras))
|
|
977
|
-
_mxsmlCheckReturn(ret)
|
|
978
|
-
return ras
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
def mxSmlGetPcieInfo(device_id):
|
|
982
|
-
pcie_info = c_mxSmlPcieInfo_t()
|
|
983
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPcieInfo")
|
|
984
|
-
ret = fn(c_uint(device_id), byref(pcie_info))
|
|
985
|
-
_mxsmlCheckReturn(ret)
|
|
986
|
-
return pcie_info
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
def mxSmlGetPcieMaxLinkInfo(device_id):
|
|
990
|
-
pcie_info = c_mxSmlPcieInfo_t()
|
|
991
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPcieMaxLinkInfo")
|
|
992
|
-
ret = fn(c_uint(device_id), byref(pcie_info))
|
|
993
|
-
_mxsmlCheckReturn(ret)
|
|
994
|
-
return pcie_info
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
def mxSmlGetPowerStateInfo(device_id, dpm_ip):
|
|
998
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPowerStateInfo")
|
|
999
|
-
size = c_uint(0)
|
|
1000
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), (c_int * 0)(), byref(size))
|
|
1001
|
-
|
|
1002
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1003
|
-
power_states = (c_int * size.value)()
|
|
1004
|
-
ret = fn(
|
|
1005
|
-
c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), byref(power_states), byref(size)
|
|
1006
|
-
)
|
|
1007
|
-
_mxsmlCheckReturn(ret)
|
|
1008
|
-
return [state for state in power_states]
|
|
1009
|
-
else:
|
|
1010
|
-
raise MXSMLError(ret)
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
def mxSmlGetPciPowerState(device_id):
|
|
1014
|
-
state = _mxSmlPciPowerState_t()
|
|
1015
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPciPowerState")
|
|
1016
|
-
ret = fn(c_uint(device_id), byref(state))
|
|
1017
|
-
_mxsmlCheckReturn(ret)
|
|
1018
|
-
return state.value
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
def mxSmlGetCodecStatus(device_id):
|
|
1022
|
-
status = c_mxSmlCodecStatus_t()
|
|
1023
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetCodecStatus")
|
|
1024
|
-
ret = fn(c_uint(device_id), byref(status))
|
|
1025
|
-
_mxsmlCheckReturn(ret)
|
|
1026
|
-
return status
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
def mxSmlGetClocks(device_id, clock_ip):
|
|
1030
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetClocks")
|
|
1031
|
-
size = c_uint(1)
|
|
1032
|
-
clocks = (c_uint * 1)()
|
|
1033
|
-
ret = fn(c_uint(device_id), _mxSmlClockIp_t(clock_ip), byref(size), byref(clocks))
|
|
1034
|
-
|
|
1035
|
-
if ret == MXSML_SUCCESS:
|
|
1036
|
-
return [clock for clock in clocks]
|
|
1037
|
-
|
|
1038
|
-
elif ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1039
|
-
clocks = (c_uint * size.value)()
|
|
1040
|
-
ret = fn(
|
|
1041
|
-
c_uint(device_id), _mxSmlClockIp_t(clock_ip), byref(size), byref(clocks)
|
|
1042
|
-
)
|
|
1043
|
-
_mxsmlCheckReturn(ret)
|
|
1044
|
-
return [clock for clock in clocks]
|
|
1045
|
-
|
|
1046
|
-
else:
|
|
1047
|
-
raise MXSMLError(ret)
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
def mxSmlGetHbmBandWidth(device_id):
|
|
1051
|
-
bw = c_mxSmlHbmBandWidth_t()
|
|
1052
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetHbmBandWidth")
|
|
1053
|
-
ret = fn(c_uint(device_id), byref(bw))
|
|
1054
|
-
_mxsmlCheckReturn(ret)
|
|
1055
|
-
return bw
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
def mxSmlGetPcieThroughput(device_id):
|
|
1059
|
-
through_put = c_mxSmlPcieThroughput_t()
|
|
1060
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPcieThroughput")
|
|
1061
|
-
ret = fn(c_uint(device_id), byref(through_put))
|
|
1062
|
-
_mxsmlCheckReturn(ret)
|
|
1063
|
-
return through_put
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
def mxSmlGetDmaBandwidth(device_id):
|
|
1067
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDmaBandwidth")
|
|
1068
|
-
size = c_uint(10)
|
|
1069
|
-
ret = fn(c_uint(device_id), (c_mxSmlDmaEngineBandwidth_t * 10)(), byref(size))
|
|
1070
|
-
|
|
1071
|
-
if ret == MXSML_SUCCESS:
|
|
1072
|
-
bandwidths = (c_mxSmlDmaEngineBandwidth_t * size.value)()
|
|
1073
|
-
ret = fn(c_uint(device_id), byref(bandwidths), byref(size))
|
|
1074
|
-
_mxsmlCheckReturn(ret)
|
|
1075
|
-
return [bw for bw in bandwidths]
|
|
1076
|
-
else:
|
|
1077
|
-
raise MXSMLError(ret)
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
def mxSmlGetMetaXLinkBandwidth(device_id, mxlk_type):
|
|
1081
|
-
size = c_uint(MXSML_METAX_LINK_NUM)
|
|
1082
|
-
entry = []
|
|
1083
|
-
bw = (c_mxSmlMetaXLinkBandwidth_t * MXSML_METAX_LINK_NUM)(*entry)
|
|
1084
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMetaXLinkBandwidth")
|
|
1085
|
-
ret = fn(
|
|
1086
|
-
c_uint(device_id), _mxSmlMetaXLinkType_t(mxlk_type), byref(size), byref(bw)
|
|
1087
|
-
)
|
|
1088
|
-
_mxsmlCheckReturn(ret)
|
|
1089
|
-
return bw
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
def mxSmlGetMetaXLinkRemoteInfo(device_id, link_id):
|
|
1093
|
-
remote = c_mxSmlMetaXLinkRemoteInfo_t()
|
|
1094
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMetaXLinkRemoteInfo")
|
|
1095
|
-
ret = fn(c_uint(device_id), c_uint(link_id), byref(remote))
|
|
1096
|
-
_mxsmlCheckReturn(ret)
|
|
1097
|
-
return remote
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
def mxSmlGetNumberOfProcess():
|
|
1101
|
-
proc_number = c_uint()
|
|
1102
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetNumberOfProcess")
|
|
1103
|
-
ret = fn(byref(proc_number))
|
|
1104
|
-
_mxsmlCheckReturn(ret)
|
|
1105
|
-
return proc_number.value
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
def mxSmlGetProcessInfo(process_number):
|
|
1109
|
-
entry = []
|
|
1110
|
-
processes = (c_mxSmlProcessInfo_t * process_number)(*entry)
|
|
1111
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetProcessInfo")
|
|
1112
|
-
ret = fn(process_number, byref(processes))
|
|
1113
|
-
_mxsmlCheckReturn(ret)
|
|
1114
|
-
return processes
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
def mxSmlGetProcessInfo_v2(process_number):
|
|
1118
|
-
entry = []
|
|
1119
|
-
processes = (c_mxSmlProcessInfo_v2_t * process_number)(*entry)
|
|
1120
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetProcessInfo_v2")
|
|
1121
|
-
ret = fn(process_number, byref(processes))
|
|
1122
|
-
_mxsmlCheckReturn(ret)
|
|
1123
|
-
return processes
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
def mxSmlGetSingleGpuProcess(device_id):
|
|
1127
|
-
number = c_uint(0)
|
|
1128
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetSingleGpuProcess")
|
|
1129
|
-
ret = fn(c_uint(device_id), byref(number), (c_mxSmlProcessInfo_t * 1)())
|
|
1130
|
-
|
|
1131
|
-
if ret == MXSML_SUCCESS:
|
|
1132
|
-
# oversize the array incase more processes are created
|
|
1133
|
-
number.value = number.value * 2 + 5
|
|
1134
|
-
processes = (c_mxSmlProcessInfo_t * number.value)()
|
|
1135
|
-
ret = fn(c_uint(device_id), byref(number), byref(processes))
|
|
1136
|
-
_mxsmlCheckReturn(ret)
|
|
1137
|
-
|
|
1138
|
-
process_array = []
|
|
1139
|
-
for i in range(number.value):
|
|
1140
|
-
process_array.append(mxsmlStructToFriendlyObject(processes[i]))
|
|
1141
|
-
return process_array
|
|
1142
|
-
else:
|
|
1143
|
-
# error case
|
|
1144
|
-
raise MXSMLError(ret)
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
def mxSmlGetSingleGpuProcess_v2(device_id):
|
|
1148
|
-
number = c_uint(0)
|
|
1149
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetSingleGpuProcess_v2")
|
|
1150
|
-
ret = fn(c_uint(device_id), byref(number), (c_mxSmlProcessInfo_v2_t * 1)())
|
|
1151
|
-
|
|
1152
|
-
if ret == MXSML_SUCCESS:
|
|
1153
|
-
# oversize the array incase more processes are created
|
|
1154
|
-
number.value = number.value * 2 + 5
|
|
1155
|
-
processes = (c_mxSmlProcessInfo_v2_t * number.value)()
|
|
1156
|
-
ret = fn(c_uint(device_id), byref(number), byref(processes))
|
|
1157
|
-
_mxsmlCheckReturn(ret)
|
|
1158
|
-
|
|
1159
|
-
process_array = []
|
|
1160
|
-
for i in range(number.value):
|
|
1161
|
-
process_array.append(mxsmlStructToFriendlyObject(processes[i]))
|
|
1162
|
-
return process_array
|
|
1163
|
-
else:
|
|
1164
|
-
# error case
|
|
1165
|
-
raise MXSMLError(ret)
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
def mxSmlGetDeviceTopology(device_src, device_dst):
|
|
1169
|
-
topo = _mxSmlGpuTopologyLevel_t()
|
|
1170
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceTopology")
|
|
1171
|
-
ret = fn(c_uint(device_src), c_uint(device_dst), byref(topo))
|
|
1172
|
-
_mxsmlCheckReturn(ret)
|
|
1173
|
-
return topo.value
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
def mxSmlGetDeviceDistance(device_src, device_dst):
|
|
1177
|
-
distance = c_uint()
|
|
1178
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceDistance")
|
|
1179
|
-
ret = fn(c_uint(device_src), c_uint(device_dst), byref(distance))
|
|
1180
|
-
_mxsmlCheckReturn(ret)
|
|
1181
|
-
return distance.value
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
def mxSmlGetCpuAffinity(device_id, cpu_set_size):
|
|
1185
|
-
entry = []
|
|
1186
|
-
cpu_set = (c_uint * cpu_set_size)(*entry)
|
|
1187
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetCpuAffinity")
|
|
1188
|
-
ret = fn(c_uint(device_id), c_uint(cpu_set_size), byref(cpu_set))
|
|
1189
|
-
_mxsmlCheckReturn(ret)
|
|
1190
|
-
return cpu_set
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
def mxSmlGetNodeAffinity(device_id, node_set_size):
|
|
1194
|
-
entry = []
|
|
1195
|
-
node_set = (c_uint * node_set_size)(*entry)
|
|
1196
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetNodeAffinity")
|
|
1197
|
-
ret = fn(c_uint(device_id), c_uint(node_set_size), byref(node_set))
|
|
1198
|
-
_mxsmlCheckReturn(ret)
|
|
1199
|
-
return node_set
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
def mxSmlGetPciDelay(device_id):
|
|
1203
|
-
delay = c_uint()
|
|
1204
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPciDelay")
|
|
1205
|
-
ret = fn(c_uint(device_id), byref(delay))
|
|
1206
|
-
_mxsmlCheckReturn(ret)
|
|
1207
|
-
return delay.value
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
def mxSmlGetDpmIpClockInfo(device_id, dpm_ip):
|
|
1211
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDpmIpClockInfo")
|
|
1212
|
-
size = c_uint(0)
|
|
1213
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), (c_uint * 1)(), byref(size))
|
|
1214
|
-
|
|
1215
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1216
|
-
clocks = (c_uint * size.value)()
|
|
1217
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), byref(clocks), byref(size))
|
|
1218
|
-
_mxsmlCheckReturn(ret)
|
|
1219
|
-
return [clk for clk in clocks]
|
|
1220
|
-
else:
|
|
1221
|
-
raise MXSMLError(ret)
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
def mxSmlGetDpmIpVddInfo(device_id, dpm_ip):
|
|
1225
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDpmIpVddInfo")
|
|
1226
|
-
size = c_uint(0)
|
|
1227
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), (c_uint * 1)(), byref(size))
|
|
1228
|
-
|
|
1229
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1230
|
-
vdds = (c_uint * size.value)()
|
|
1231
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), byref(vdds), byref(size))
|
|
1232
|
-
_mxsmlCheckReturn(ret)
|
|
1233
|
-
return [vdd for vdd in vdds]
|
|
1234
|
-
else:
|
|
1235
|
-
raise MXSMLError(ret)
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
def mxSmlGetCurrentDpmIpPerfLevel(device_id, dpm_ip):
|
|
1239
|
-
level = c_uint()
|
|
1240
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetCurrentDpmIpPerfLevel")
|
|
1241
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), byref(level))
|
|
1242
|
-
_mxsmlCheckReturn(ret)
|
|
1243
|
-
return level.value
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
def mxSmlGetDeviceIpUsage(device_id, usage_ip):
|
|
1247
|
-
usage = c_int()
|
|
1248
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceIpUsage")
|
|
1249
|
-
ret = fn(c_uint(device_id), _mxSmlUsageIp_t(usage_ip), byref(usage))
|
|
1250
|
-
_mxsmlCheckReturn(ret)
|
|
1251
|
-
return usage.value
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
def mxSmlGetXcoreApUsage(device_id):
|
|
1255
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetXcoreApUsage")
|
|
1256
|
-
size = c_uint(0)
|
|
1257
|
-
dpc_num = c_uint(0)
|
|
1258
|
-
ret = fn(c_uint(device_id), (c_uint * 0)(), byref(size), byref(dpc_num))
|
|
1259
|
-
|
|
1260
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1261
|
-
usage_array = (c_uint * size.value)()
|
|
1262
|
-
ret = fn(c_uint(device_id), byref(usage_array), byref(size), byref(dpc_num))
|
|
1263
|
-
_mxsmlCheckReturn(ret)
|
|
1264
|
-
idx_num = (size.value + dpc_num.value - 1) // dpc_num.value
|
|
1265
|
-
return [usage_array[i : i + idx_num] for i in range(0, size.value, idx_num)]
|
|
1266
|
-
else:
|
|
1267
|
-
raise MXSMLError(ret)
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
def mxSmlGetApUsageToggle(device_id):
|
|
1271
|
-
toggle = c_uint()
|
|
1272
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetApUsageToggle")
|
|
1273
|
-
ret = fn(c_uint(device_id), byref(toggle))
|
|
1274
|
-
_mxsmlCheckReturn(ret)
|
|
1275
|
-
return toggle.value
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
def mxSmlGetFwIpLoglevel(device_id, fw_ip):
|
|
1279
|
-
level = _mxSmlLoglevel_t()
|
|
1280
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetFwIpLoglevel")
|
|
1281
|
-
ret = fn(c_uint(device_id), _mxSmlFwIpName_t(fw_ip), byref(level))
|
|
1282
|
-
_mxsmlCheckReturn(ret)
|
|
1283
|
-
return level.value
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
def mxSmlGetFwLoglevel(device_id):
|
|
1287
|
-
log_level = c_mxSmlFwLoglevel_t()
|
|
1288
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetFwLoglevel")
|
|
1289
|
-
ret = fn(c_uint(device_id), byref(log_level))
|
|
1290
|
-
_mxsmlCheckReturn(ret)
|
|
1291
|
-
return log_level
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
def mxSmlGetEccState(device_id):
|
|
1295
|
-
state = c_uint()
|
|
1296
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetEccState")
|
|
1297
|
-
ret = fn(c_uint(device_id), byref(state))
|
|
1298
|
-
_mxsmlCheckReturn(ret)
|
|
1299
|
-
return state.value
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
def mxSmlGetMetaXLinkInfo(device_id):
|
|
1303
|
-
mxlk_info = c_mxSmlMetaXLinkInfo_t()
|
|
1304
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMetaXLinkInfo")
|
|
1305
|
-
ret = fn(c_uint(device_id), byref(mxlk_info))
|
|
1306
|
-
_mxsmlCheckReturn(ret)
|
|
1307
|
-
return mxlk_info
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
def mxSmlGetSriovState(device_id):
|
|
1311
|
-
state = c_uint()
|
|
1312
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetSriovState")
|
|
1313
|
-
ret = fn(c_uint(device_id), byref(state))
|
|
1314
|
-
_mxsmlCheckReturn(ret)
|
|
1315
|
-
return state.value
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
def mxSmlGetDeviceSlot(device_id):
|
|
1319
|
-
slot = c_uint()
|
|
1320
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceSlot")
|
|
1321
|
-
ret = fn(c_uint(device_id), byref(slot))
|
|
1322
|
-
_mxsmlCheckReturn(ret)
|
|
1323
|
-
return slot.value
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
def mxSmlGetOpticalModuleStatus(device_id):
|
|
1327
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetOpticalModuleStatus")
|
|
1328
|
-
size = c_uint(0)
|
|
1329
|
-
ret = fn(c_uint(device_id), (c_mxSmlOpticalModuleStatus_t * 0)(), byref(size))
|
|
1330
|
-
|
|
1331
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1332
|
-
status_array = (c_mxSmlOpticalModuleStatus_t * size.value)()
|
|
1333
|
-
ret = fn(c_uint(device_id), byref(status_array), byref(size))
|
|
1334
|
-
_mxsmlCheckReturn(ret)
|
|
1335
|
-
return [status for status in status_array]
|
|
1336
|
-
else:
|
|
1337
|
-
raise MXSMLError(ret)
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
def mxSmlGetOpticalModuleInfo(device_id):
|
|
1341
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetOpticalModuleInfo")
|
|
1342
|
-
size = c_uint(0)
|
|
1343
|
-
ret = fn(c_uint(device_id), (c_mxSmlOpticalModuleInfo_t * 0)(), byref(size))
|
|
1344
|
-
|
|
1345
|
-
if ret == MXSML_ERROR_INSUFFICIENT_SIZE:
|
|
1346
|
-
infos = (c_mxSmlOpticalModuleInfo_t * size.value)()
|
|
1347
|
-
ret = fn(c_uint(device_id), byref(infos), byref(size))
|
|
1348
|
-
_mxsmlCheckReturn(ret)
|
|
1349
|
-
return [info for info in infos]
|
|
1350
|
-
else:
|
|
1351
|
-
raise MXSMLError(ret)
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
@convertStrBytes
|
|
1355
|
-
def mxSmlGetDeviceRealPath(device_id):
|
|
1356
|
-
real_path = create_string_buffer(MXSML_DEVICE_REAL_PATH_SIZE)
|
|
1357
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceRealPath")
|
|
1358
|
-
ret = fn(
|
|
1359
|
-
c_uint(device_id), byref(real_path), byref(c_uint(MXSML_DEVICE_REAL_PATH_SIZE))
|
|
1360
|
-
)
|
|
1361
|
-
_mxsmlCheckReturn(ret)
|
|
1362
|
-
return real_path.value
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
def mxSmlGetCurrentClocksThrottleReason(device_id):
|
|
1366
|
-
reason = c_ulonglong()
|
|
1367
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetCurrentClocksThrottleReason")
|
|
1368
|
-
ret = fn(c_uint(device_id), byref(reason))
|
|
1369
|
-
_mxsmlCheckReturn(ret)
|
|
1370
|
-
return reason.value
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
def mxSmlGetBoardPowerLimit(device_id):
|
|
1374
|
-
limit = c_uint()
|
|
1375
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetBoardPowerLimit")
|
|
1376
|
-
ret = fn(c_uint(device_id), byref(limit))
|
|
1377
|
-
_mxsmlCheckReturn(ret)
|
|
1378
|
-
return limit.value
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
def mxSmlSetDpmIpMaxPerfLevel(device_id, dpm_ip, level):
|
|
1382
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetDpmIpMaxPerfLevel")
|
|
1383
|
-
ret = fn(c_uint(device_id), _mxSmlDpmIp_t(dpm_ip), c_uint(level))
|
|
1384
|
-
_mxsmlCheckReturn(ret)
|
|
1385
|
-
return ret
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
@convertStrBytes
|
|
1389
|
-
def mxSmlDumpVbios(device_id, time_limit, bin_path):
|
|
1390
|
-
fn = _mxsmlGetFunctionPointer("mxSmlDumpVbios")
|
|
1391
|
-
fw_ret = c_uint()
|
|
1392
|
-
b_bin_path = c_char_p(bin_path)
|
|
1393
|
-
ret = fn(c_uint(device_id), c_uint(time_limit), b_bin_path, byref(fw_ret))
|
|
1394
|
-
_mxsmlCheckReturn(ret)
|
|
1395
|
-
return ret
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
@convertStrBytes
|
|
1399
|
-
def mxSmlVbiosUpgrade(device_id, time_limit, bin_path):
|
|
1400
|
-
# Will take effect after reboot
|
|
1401
|
-
upgrade_arg = c_mxSmlVbiosUpgradeArg_t()
|
|
1402
|
-
upgrade_arg.timeLimit = c_uint(time_limit)
|
|
1403
|
-
upgrade_arg.vbiosBinPath = bin_path
|
|
1404
|
-
upgrade_arg.forceUpgrade = c_int(0)
|
|
1405
|
-
fn = _mxsmlGetFunctionPointer("mxSmlVbiosUpgrade")
|
|
1406
|
-
ret = fn(c_uint(device_id), byref(upgrade_arg))
|
|
1407
|
-
_mxsmlCheckReturn(ret)
|
|
1408
|
-
return ret
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
def mxSmlFunctionLevelReset(device_id):
|
|
1412
|
-
fn = _mxsmlGetFunctionPointer("mxSmlFunctionLevelReset")
|
|
1413
|
-
ret = fn(c_uint(device_id))
|
|
1414
|
-
_mxsmlCheckReturn(ret)
|
|
1415
|
-
return ret
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
def mxSmlFunctionLevelResetVfFromPf(device_id):
|
|
1419
|
-
fn = _mxsmlGetFunctionPointer("mxSmlFunctionLevelResetVfFromPf")
|
|
1420
|
-
ret = fn(c_uint(device_id))
|
|
1421
|
-
_mxsmlCheckReturn(ret)
|
|
1422
|
-
return ret
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
def mxSmlSetUnlockKey(device_id, key):
|
|
1426
|
-
b_key = c_char_p(key.encode("utf-8"))
|
|
1427
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetUnlockKey")
|
|
1428
|
-
ret = fn(c_uint(device_id), b_key)
|
|
1429
|
-
_mxsmlCheckReturn(ret)
|
|
1430
|
-
return ret
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
def mxSmlSetCpuAffinity(device_id):
|
|
1434
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetCpuAffinity")
|
|
1435
|
-
ret = fn(c_uint(device_id))
|
|
1436
|
-
_mxsmlCheckReturn(ret)
|
|
1437
|
-
return ret
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
def mxSmlClearCpuAffinity(device_id):
|
|
1441
|
-
fn = _mxsmlGetFunctionPointer("mxSmlClearCpuAffinity")
|
|
1442
|
-
ret = fn(c_uint(device_id))
|
|
1443
|
-
_mxsmlCheckReturn(ret)
|
|
1444
|
-
return ret
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
def mxSmlReset(device_id):
|
|
1448
|
-
fn = _mxsmlGetFunctionPointer("mxSmlReset")
|
|
1449
|
-
ret = fn(c_uint(device_id))
|
|
1450
|
-
_mxsmlCheckReturn(ret)
|
|
1451
|
-
return ret
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
def mxSmlSetPciSpeed(device_id, pci_gen):
|
|
1455
|
-
# Will take effect after reboot
|
|
1456
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetPciSpeed")
|
|
1457
|
-
ret = fn(c_uint(device_id), _mxSmlPciGen_t(pci_gen))
|
|
1458
|
-
_mxsmlCheckReturn(ret)
|
|
1459
|
-
return ret
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
def mxSmlSetPciDelay(device_id, delay):
|
|
1463
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetPciDelay")
|
|
1464
|
-
ret = fn(c_uint(device_id), c_uint(delay))
|
|
1465
|
-
_mxsmlCheckReturn(ret)
|
|
1466
|
-
return ret
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
def mxSmlSetFwLoglevel(device_id, fw_ip, level):
|
|
1470
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetFwLoglevel")
|
|
1471
|
-
ret = fn(c_uint(device_id), _mxSmlFwIpName_t(fw_ip), _mxSmlLoglevel_t(level))
|
|
1472
|
-
_mxsmlCheckReturn(ret)
|
|
1473
|
-
return ret
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
def mxSmlSetApUsageToggle(device_id, toggle):
|
|
1477
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetApUsageToggle")
|
|
1478
|
-
ret = fn(c_uint(device_id), c_uint(toggle))
|
|
1479
|
-
_mxsmlCheckReturn(ret)
|
|
1480
|
-
return ret
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
def mxSmlSetEccState(device_id, state):
|
|
1484
|
-
# Will take effect after reboot
|
|
1485
|
-
fn = _mxsmlGetFunctionPointer("mxSmlSetEccState")
|
|
1486
|
-
ret = fn(c_uint(device_id), c_uint(state))
|
|
1487
|
-
_mxsmlCheckReturn(ret)
|
|
1488
|
-
return ret
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
def mxSmlGetMetaXLinkState(device_id):
|
|
1492
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMetaXLinkState")
|
|
1493
|
-
mxlkStateCode = _mxSmlMetaXLinkState_t()
|
|
1494
|
-
entry = []
|
|
1495
|
-
mxlk_state = (c_char * 128)(*entry)
|
|
1496
|
-
size = c_uint(128)
|
|
1497
|
-
ret = fn(c_uint(device_id), byref(mxlkStateCode), byref(mxlk_state), byref(size))
|
|
1498
|
-
_mxsmlCheckReturn(ret)
|
|
1499
|
-
return ret
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
def mxSmlGetMetaXLinkPortState(device_id):
|
|
1503
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMetaXLinkPortState")
|
|
1504
|
-
entry = []
|
|
1505
|
-
mxlk_port_state = (_mxSmlMxlkPortState_t * 7)(*entry)
|
|
1506
|
-
size = c_uint(7)
|
|
1507
|
-
ret = fn(c_uint(device_id), byref(mxlk_port_state), byref(size))
|
|
1508
|
-
_mxsmlCheckReturn(ret)
|
|
1509
|
-
return mxlk_port_state
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
def mxSmlGetPciMmioState(device_id):
|
|
1513
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPciMmioState")
|
|
1514
|
-
state = c_uint()
|
|
1515
|
-
ret = fn(c_uint(device_id), byref(state))
|
|
1516
|
-
_mxsmlCheckReturn(ret)
|
|
1517
|
-
return state.value
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
def mxSmlGetPciEventInfo(device_id, event_type):
|
|
1521
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetPciEventInfo")
|
|
1522
|
-
entry = []
|
|
1523
|
-
event_infos = (c_mxSmlPciEventInfo_t * 2)(*entry)
|
|
1524
|
-
size = c_uint(2)
|
|
1525
|
-
ret = fn(
|
|
1526
|
-
c_uint(device_id),
|
|
1527
|
-
_mxSmlPciEventType_t(event_type),
|
|
1528
|
-
byref(event_infos),
|
|
1529
|
-
byref(size),
|
|
1530
|
-
)
|
|
1531
|
-
_mxsmlCheckReturn(ret)
|
|
1532
|
-
return event_infos
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
def mxSmlGetDeviceIsaVersion(device_id):
|
|
1536
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceIsaVersion")
|
|
1537
|
-
isaVersion = c_int(0)
|
|
1538
|
-
ret = fn(c_uint(device_id), byref(isaVersion))
|
|
1539
|
-
_mxsmlCheckReturn(ret)
|
|
1540
|
-
return isaVersion.value
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
def mxSmlGetDeviceUnavailableReason(device_id):
|
|
1544
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceUnavailableReason")
|
|
1545
|
-
reason = c_mxSmlDeviceUnavailableReasonInfo_t()
|
|
1546
|
-
ret = fn(c_uint(device_id), byref(reason))
|
|
1547
|
-
_mxsmlCheckReturn(ret)
|
|
1548
|
-
return reason
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
def mxSmlGetTotalEccErrors(device_id):
|
|
1552
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetTotalEccErrors")
|
|
1553
|
-
eccCounts = c_mxSmlEccErrorCount_t()
|
|
1554
|
-
ret = fn(c_uint(device_id), byref(eccCounts))
|
|
1555
|
-
_mxsmlCheckReturn(ret)
|
|
1556
|
-
return mxsmlStructToFriendlyObject(eccCounts)
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
def mxSmlGetMetaXLinkTopo(device_id):
|
|
1560
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetMetaXLinkTopo")
|
|
1561
|
-
topoInfo = c_mxSmlMetaXLinkTopo_t()
|
|
1562
|
-
ret = fn(c_uint(device_id), byref(topoInfo))
|
|
1563
|
-
_mxsmlCheckReturn(ret)
|
|
1564
|
-
return mxsmlStructToFriendlyObject(topoInfo)
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
@convertStrBytes
|
|
1568
|
-
def mxSmlGetErrorString(result):
|
|
1569
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetErrorString")
|
|
1570
|
-
fn.restype = c_char_p # otherwise return is an int
|
|
1571
|
-
ret = fn(_mxsmlReturn_t(result))
|
|
1572
|
-
return ret
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
def mxSmlGetDeviceDieId(device_id):
|
|
1576
|
-
fn = _mxsmlGetFunctionPointer("mxSmlGetDeviceDieId")
|
|
1577
|
-
die_id = c_uint()
|
|
1578
|
-
ret = fn(c_uint(device_id), byref(die_id))
|
|
1579
|
-
_mxsmlCheckReturn(ret)
|
|
1580
|
-
return die_id.value
|