1 /* 2 * SPDX-License-Identifier: BSD-3-Clause 3 * Copyright(c) 2023 Napatech A/S 4 */ 5 6 #ifndef _NTNIC_NIM_H_ 7 #define _NTNIC_NIM_H_ 8 9 #include <stdint.h> 10 11 typedef enum i2c_type { 12 I2C_HWIIC, 13 } i2c_type_e; 14 15 enum nt_port_type_e { 16 NT_PORT_TYPE_NOT_AVAILABLE = 0, /* The NIM/port type is not available (unknown) */ 17 NT_PORT_TYPE_NOT_RECOGNISED, /* The NIM/port type not recognized */ 18 NT_PORT_TYPE_QSFP_PLUS_NOT_PRESENT, /* QSFP type but slot is empty */ 19 NT_PORT_TYPE_QSFP_PLUS, /* QSFP type */ 20 NT_PORT_TYPE_QSFP28_NOT_PRESENT,/* QSFP28 type but slot is empty */ 21 NT_PORT_TYPE_QSFP28, /* QSFP28 type */ 22 NT_PORT_TYPE_QSFP28_SR4,/* QSFP28-SR4 type */ 23 NT_PORT_TYPE_QSFP28_LR4,/* QSFP28-LR4 type */ 24 NT_PORT_TYPE_QSFP28_CR_CA_L, /* QSFP28-CR-CA-L type */ 25 NT_PORT_TYPE_QSFP28_CR_CA_S, /* QSFP28-CR-CA-S type */ 26 NT_PORT_TYPE_QSFP28_CR_CA_N, /* QSFP28-CR-CA-N type */ 27 /* QSFP28-FR type. Uses PAM4 modulation on one lane only */ 28 NT_PORT_TYPE_QSFP28_FR, 29 /* QSFP28-DR type. Uses PAM4 modulation on one lane only */ 30 NT_PORT_TYPE_QSFP28_DR, 31 /* QSFP28-LR type. Uses PAM4 modulation on one lane only */ 32 NT_PORT_TYPE_QSFP28_LR, 33 }; 34 35 typedef enum nt_port_type_e nt_port_type_t, *nt_port_type_p; 36 37 typedef struct nim_i2c_ctx { 38 union { 39 nthw_iic_t hwiic; /* depends on *Fpga_t, instance number, and cycle time */ 40 struct { 41 nthw_i2cm_t *p_nt_i2cm; 42 int mux_channel; 43 } hwagx; 44 }; 45 i2c_type_e type;/* 0 = hwiic (xilinx) - 1 = hwagx (agilex) */ 46 uint8_t instance; 47 uint8_t devaddr; 48 uint8_t regaddr; 49 uint8_t nim_id; 50 nt_port_type_t port_type; 51 52 char vendor_name[17]; 53 char prod_no[17]; 54 char serial_no[17]; 55 char date[9]; 56 char rev[5]; 57 bool avg_pwr; 58 bool content_valid; 59 uint8_t pwr_level_req; 60 uint8_t pwr_level_cur; 61 uint16_t len_info[5]; 62 uint32_t speed_mask; /* Speeds supported by the NIM */ 63 int8_t lane_idx; 64 uint8_t lane_count; 65 uint32_t options; 66 bool tx_disable; 67 bool dmi_supp; 68 69 union { 70 struct { 71 bool rx_only; 72 bool qsfp28; 73 union { 74 struct { 75 uint8_t rev_compliance; 76 bool media_side_fec_ctrl; 77 bool host_side_fec_ctrl; 78 bool media_side_fec_ena; 79 bool host_side_fec_ena; 80 } qsfp28; 81 } specific_u; 82 } qsfp; 83 84 } specific_u; 85 } nim_i2c_ctx_t, *nim_i2c_ctx_p; 86 87 struct nim_sensor_group { 88 struct nim_i2c_ctx *ctx; 89 struct nim_sensor_group *next; 90 }; 91 92 #endif /* _NTNIC_NIM_H_ */ 93