Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
425 changes: 385 additions & 40 deletions cli/diag.c

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions cli/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,16 @@ void graph_init(void)

#endif /* defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES) */

int graph_draw_win_no_invert(struct range *X, struct range *Y, int *data,
int *shades, const char *title, char x_title,
char y_title, char *status, graph_anim_fn *anim,
void *opaque)
{
graph_draw_text_no_invert(X, Y, data, title, x_title, y_title);
return 0;
}


void graph_draw_text(struct range *X, struct range *Y, int *data,
const char *title, char x_title, char y_title)
{
Expand Down Expand Up @@ -428,3 +438,43 @@ void graph_draw_text(struct range *X, struct range *Y, int *data,
j--;
}
}

void graph_draw_text_no_invert(struct range *X, struct range *Y, int *data,
const char *title, char x_title, char y_title)
{
int stride = RANGE_CNT(X);
int x, y, i = RANGE_CNT(Y) - 1;
int j = Y->start;
int space_ch;

printf(" %s\n\n", title);

printf(" ");
for_range(x, X)
printf("%d ", x / 10);
printf("\n");

printf(" ");
for_range(x, X)
printf("%d ", x % 10);
printf("\n\n");

for_range(y, Y) {
printf("%5d ", y);
i = 0;
for_range(x, X) {
space_ch = ' ';
if (data[j * stride + i] == GRAPH_TEXT_HLINE ||
data[j * stride + i] == GRAPH_TEXT_PLUS)
space_ch = GRAPH_TEXT_HLINE;
else if (data[j * stride + i] == '-' ||
data[j * stride + i] == '+')
space_ch = '-';

printf("%lc%lc", data[j * stride + i], space_ch);
i++;
}
printf("\n");
j++;
}
}
7 changes: 6 additions & 1 deletion cli/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,10 @@ void graph_draw_text(struct range *X, struct range *Y, int *data,
int graph_draw_win(struct range *X, struct range *Y, int *data, int *shades,
const char *title, char x_title, char y_title, char *status,
graph_anim_fn *anim, void *opaque);

void graph_draw_text_no_invert(struct range *X, struct range *Y, int *data,
const char *title, char x_title, char y_title);
int graph_draw_win_no_invert(struct range *X, struct range *Y, int *data,
int *shades, const char *title, char x_title,
char y_title, char *status, graph_anim_fn *anim,
void *opaque);
#endif
27 changes: 27 additions & 0 deletions inc/switchtec/diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ enum switchtec_diag_loopback_type {
DIAG_LOOPBACK_TX_TO_RX = 1,
};

enum switchtec_diag_loopback_type_gen5 {
DIAG_LOOPBACK_PARALEL_DATAPATH = 5,
DIAG_LOOPBACK_EXTERNAL_DATAPATH = 6,
};

struct switchtec_diag_loopback_in {
uint8_t sub_cmd;
uint8_t port_id;
Expand Down Expand Up @@ -237,6 +242,15 @@ struct switchtec_diag_port_eye_fetch {
};
};


struct switchtec_gen5_diag_eye_run_in {
uint8_t sub_cmd;
uint8_t capture_depth;
uint8_t timeout_disable;
uint8_t resvd1;
uint32_t lane_mask[4];
};

struct switchtec_diag_cross_hair_in {
uint8_t sub_cmd;
uint8_t lane_id;
Expand Down Expand Up @@ -289,5 +303,18 @@ struct switchtec_tlp_inject_in {
uint32_t raw_tlp_data[SWITCHTEC_DIAG_MAX_TLP_DWORDS];
};

enum switchtec_aer_event_gen_result {
AER_EVENT_GEN_SUCCESS = 0,
AER_EVENT_GEN_FAIL = 1,
};

struct switchtec_aer_event_gen_in {
uint8_t sub_cmd;
uint8_t phys_port_id;
uint8_t reserved[2];
uint32_t err_mask;
uint32_t hdr_log[4];
};

#endif
/**@}*/
79 changes: 79 additions & 0 deletions inc/switchtec/inject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Microsemi Switchtec(tm) PCIe Management Library
* Copyright (c) 2025, Microsemi Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/

#include <switchtec/switchtec.h>
#include <stdint.h>

struct switchtec_lnkerr_dllp_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t resvd[2];
uint32_t data;
};

struct switchtec_lnkerr_dllp_crc_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t enable;
uint8_t resvd1;
uint16_t rate;
uint8_t resvd2[2];
};

struct switchtec_lnkerr_tlp_lcrc_gen5_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t enable;
uint8_t resvd1;
uint8_t rate;
uint8_t resvd[3];
};

struct switchtec_lnkerr_tlp_lcrc_gen4_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t enable;
uint8_t rate;
};

struct switchtec_lnkerr_tlp_seqn_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t resvd[2];
};

struct switchtec_lnkerr_ack_nack_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t resvd1[2];
uint16_t seq_num;
uint8_t count;
uint8_t resvd2;
};

struct switchtec_lnkerr_cto_in {
uint8_t subcmd;
uint8_t phys_port_id;
uint8_t resvd[2];
};
20 changes: 19 additions & 1 deletion inc/switchtec/mrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ enum mrpc_cmd {
MRPC_SN_VER_GET_GEN5 = 0x119,
MRPC_DBG_UNLOCK_GEN5 = 0x11A,
MRPC_BOOTUP_RESUME_GEN5 = 0x11B,
MRPC_GEN5_EYE_CAPTURE = 0x142,
MRPC_FTDC_LOG_DUMP = 0x147,

MRPC_MAX_ID = 0x148,
};

Expand Down Expand Up @@ -245,6 +245,12 @@ enum mrpc_sub_cmd {
MRPC_PORT_EQ_LOCAL_TX_FSLF_DUMP = 3,
MRPC_PORT_EQ_FAR_END_TX_FSLF_DUMP = 4,

MRPC_GEN5_PORT_EQ_LOCAL_TX_COEFF_DUMP = 9,
MRPC_GEN5_PORT_EQ_FAR_END_TX_COEFF_DUMP = 10,
MRPC_GEN5_PORT_EQ_LOCAL_TX_FSLF_DUMP = 11,
MRPC_GEN5_PORT_EQ_FAR_END_TX_FSLF_DUMP = 12,
MRPC_GEN5_PORT_EQ_FAR_END_TX_EQ_TABLE_DUMP = 15,

MRPC_EXT_RCVR_OBJ_DUMP_RCVR_EXT = 0,
MRPC_EXT_RCVR_OBJ_DUMP_RCVR_EXT_PREV = 1,
MRPC_EXT_RCVR_OBJ_DUMP_PREV = 2,
Expand All @@ -267,13 +273,18 @@ enum mrpc_sub_cmd {
MRPC_PAT_GEN_GET_MON = 7,
MRPC_PAT_GEN_SET_MON = 8,
MRPC_PAT_GEN_INJ_ERR = 9,
MRPC_PAT_GEN_SET_GEN_GEN5 = 10,

MRPC_EYE_OBSERVE_START = 0,
MRPC_EYE_OBSERVE_FETCH = 1,
MRPC_EYE_OBSERVE_CANCEL = 2,
MRPC_EYE_OBSERVE_SET_DATA_MODE = 3,
MRPC_EYE_OBSERVE_GET_DATA_MODE = 4,

MRPC_EYE_CAP_RUN_GEN5 = 0,
MRPC_EYE_CAP_STATUS_GEN5 = 1,
MRPC_EYE_CAP_READ_GEN5 = 2,

MRPC_CROSS_HAIR_ENABLE = 0,
MRPC_CROSS_HAIR_DISABLE = 1,
MRPC_CROSS_HAIR_GET = 2,
Expand All @@ -283,6 +294,13 @@ enum mrpc_sub_cmd {
MRPC_LTMON_LOG_DUMP_GEN4 = 15,
MRPC_LTMON_GET_STATUS_GEN5 = 20,
MRPC_LTMON_LOG_DUMP_GEN5 = 21,

MRPC_ERR_INJ_DLLP = 0,
MRPC_ERR_INJ_DLLP_CRC = 1,
MRPC_ERR_INJ_TLP_LCRC = 2,
MRPC_ERR_INJ_TLP_SEQ = 3,
MRPC_ERR_INJ_ACK_NACK = 4,
MRPC_ERR_INJ_CTO = 5,
};

#endif
Loading