Switchtec Userspace PROJECT_NUMBER = 4.2
Loading...
Searching...
No Matches
diag.h
Go to the documentation of this file.
1/*
2 * Microsemi Switchtec(tm) PCIe Management Library
3 * Copyright (c) 2021, Microsemi Corporation
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 */
24
25#ifndef LIBSWITCHTEC_DIAG_H
26#define LIBSWITCHTEC_DIAG_H
27
28#include "switchtec.h"
29
30#include <stdint.h>
31
36
38 uint8_t port_id;
39 uint8_t lane_id;
40 uint16_t resvd;
41};
42
44 uint8_t port_id;
45 uint8_t lane_id;
46 uint8_t ctle;
47 uint8_t target_amplitude;
48 uint8_t speculative_dfe;
49 int8_t dynamic_dfe[7];
50};
51
52enum {
53 DIAG_PORT_EQ_STATUS_OP_PER_PORT = 0,
54 DIAG_PORT_EQ_STATUS_OP_PER_LANE = 1,
55};
56
58 uint8_t sub_cmd;
59 uint8_t op_type;
60 uint8_t port_id;
61 uint8_t lane_id;
62};
63
65 uint8_t sub_cmd;
66 uint8_t port_id;
67 uint8_t lane_id;
68 uint8_t resvd;
69};
70
72 uint8_t sub_cmd;
73 uint8_t op_type;
74 uint8_t port_id;
75 uint8_t lane_id;
76
77 struct {
78 uint8_t pre;
79 uint8_t post;
80 } cursors[16];
81};
82
84 uint8_t sub_cmd;
85 uint8_t port_id;
86 uint8_t lane_id;
87 uint8_t step_cnt;
88 struct {
89 uint8_t pre_cursor;
90 uint8_t post_cursor;
91 uint8_t fom;
92 uint8_t pre_cursor_up;
93 uint8_t post_cursor_up;
94 uint8_t error_status;
95 uint8_t active_status;
96 uint8_t speed;
97 } steps[126];
98};
99
101 uint8_t sub_cmd;
102 uint8_t port_id;
103 uint8_t lane_id;
104 uint8_t fs;
105 uint8_t lf;
106 uint8_t resvd[3];
107};
108
110 uint8_t sub_cmd;
111 uint8_t port_id;
112 uint8_t lane_id;
113 uint8_t resvd;
114};
115
117 uint8_t sub_cmd;
118 uint8_t op_type;
119 uint8_t port_id;
120 uint8_t lane_id;
121};
122
124 uint8_t port_id;
125 uint8_t lane_id;
126 uint16_t ctle2_rx_mode;
127 uint8_t dtclk_9;
128 uint8_t dtclk_8_6;
129 uint8_t dtclk_5;
130};
131
133 uint8_t sub_cmd;
134 uint8_t stack_id;
135};
136
137enum switchtec_diag_loopback_type {
138 DIAG_LOOPBACK_RX_TO_TX = 0,
139 DIAG_LOOPBACK_TX_TO_RX = 1,
140};
141
142enum switchtec_diag_loopback_type_gen5 {
143 DIAG_LOOPBACK_PARALEL_DATAPATH = 5,
144 DIAG_LOOPBACK_EXTERNAL_DATAPATH = 6,
145};
146
148 uint8_t sub_cmd;
149 uint8_t port_id;
150 uint8_t enable;
151 uint8_t type;
152};
153
155 uint8_t port_id;
156 uint8_t enabled;
157 uint8_t type;
158 uint8_t resvdd;
159};
160
162 uint8_t sub_cmd;
163 uint8_t port_id;
164 uint8_t enable;
165 uint8_t speed;
166};
167
169 uint8_t port_id;
170 uint8_t enabled;
171 uint8_t speed;
172 uint8_t resvd;
173};
174
176 uint8_t sub_cmd;
177 uint8_t port_id;
178 uint8_t pattern_type;
179 uint8_t lane_id;
180};
181
183 uint8_t sub_cmd;
184 uint8_t port_id;
185 uint16_t resvd;
186 uint32_t err_cnt;
187};
188
190 uint8_t port_id;
191 uint8_t pattern_type;
192 uint16_t resvd;
193 uint32_t err_cnt_lo;
194 uint32_t err_cnt_hi;
195};
196
198 uint8_t sub_cmd;
199 uint8_t resvd1[3];
200 uint32_t resvd2;
201 uint32_t lane_mask[4];
202 int16_t x_start;
203 int16_t y_start;
204 int16_t x_end;
205 int16_t y_end;
206 uint16_t x_step;
207 uint16_t y_step;
208 uint32_t step_interval;
209};
210
212 uint8_t sub_cmd;
213 uint8_t data_mode;
214 uint8_t resvd;
215 uint8_t status;
216};
217
219 uint8_t sub_cmd;
220 uint8_t data_mode;
221 uint8_t resvd1;
222 uint8_t status;
223 uint32_t time_remaining;
224 uint32_t lane_mask[4];
225 uint8_t x_start;
226 uint8_t resvd2;
227 int16_t y_start;
228 uint8_t data_count_lo;
229 uint8_t frame_status;
230 uint8_t resvd3;
231 uint8_t data_count_hi;
232 union {
233 struct {
234 uint32_t error_cnt_lo;
235 uint32_t error_cnt_hi;
236 uint32_t sample_cnt_lo;
237 uint32_t sample_cnt_hi;
238 } raw[62];
239 struct {
240 uint16_t ratio;
241 } ratio[496];
242 };
243};
244
245
247 uint8_t sub_cmd;
248 uint8_t capture_depth;
249 uint8_t timeout_disable;
250 uint8_t resvd1;
251 uint32_t lane_mask[4];
252};
253
255 uint8_t sub_cmd;
256 uint8_t lane_id;
257 uint8_t all_lanes;
258 uint8_t num_lanes;
259};
260
262 uint8_t lane_id;
263 uint8_t state;
264
265 union {
266 struct {
267 int8_t byte0;
268 int8_t byte1;
269 int16_t word0;
270 int16_t word1;
271 int16_t word2;
272 int16_t word3;
273 };
274 struct {
275 uint8_t prev_state;
276 uint8_t _byte1;
277 int16_t x_pos;
278 int16_t y_pos;
279 };
280 struct {
281 int8_t eye_left_lim;
282 int8_t eye_right_lim;
283 int16_t eye_bot_left_lim;
284 int16_t eye_bot_right_lim;
285 int16_t eye_top_left_lim;
286 int16_t eye_top_right_lim;
287 };
288 };
289};
290
292 uint32_t dw0;
293 uint32_t ram_timestamp;
294 uint32_t unused;
295 uint32_t arc;
296};
297
299 uint32_t dest_port;
300 uint32_t tlp_type;
301 uint32_t tlp_length;
302 uint32_t ecrc;
303 uint32_t raw_tlp_data[SWITCHTEC_DIAG_MAX_TLP_DWORDS];
304};
305
306enum switchtec_aer_event_gen_result {
307 AER_EVENT_GEN_SUCCESS = 0,
308 AER_EVENT_GEN_FAIL = 1,
309};
310
312 uint8_t sub_cmd;
313 uint8_t phys_port_id;
314 uint8_t reserved[2];
315 uint32_t err_mask;
316 uint32_t hdr_log[4];
317};
318
320 uint8_t sub_cmd;
321 uint8_t stack_id;
322 uint16_t reserved;
323 uint16_t lane_mask;
324 uint8_t direction;
325 uint8_t link_rate;
326 uint8_t os_types;
327 uint8_t reserved2;
328 uint16_t reserved3;
329};
330
332 uint8_t sub_cmd;
333 uint8_t stack_id;
334 uint16_t reserved;
335 uint16_t lane_mask;
336 uint8_t direction;
337 uint8_t link_rate;
338 uint32_t pat_val_dword0;
339 uint32_t pat_val_dword1;
340 uint32_t pat_val_dword2;
341 uint32_t pat_val_dword3;
342 uint32_t pat_mask_dword0;
343 uint32_t pat_mask_dword1;
344 uint32_t pat_mask_dword2;
345 uint32_t pat_mask_dword3;
346};
347
349 uint8_t sub_cmd;
350 uint8_t stack_id;
351 uint16_t reserved;
352 uint16_t lane_mask;
353 uint8_t direction;
354 uint8_t drop_single_os;
355 uint8_t stop_mode;
356 uint8_t snapshot_mode;
357 uint16_t post_trig_entries;
358 uint8_t os_types;
359 uint8_t reserved2;
360 uint16_t reserved3;
361};
362
363#endif
Main Switchtec header.