From 32a3a456b701d9b82742bba5371d8d828c6fe309 Mon Sep 17 00:00:00 2001
From: z00470624 <z00470624@huawei.com>
Date: Thu, 4 Jan 2024 14:54:29 +0800
Subject: [PATCH] hikptool: Supported parsing the optical module that use the
 CMIS protocol

Added support dump and parse optical modules
whose Identifier Values are 0x18, 0x1A, 0x1E, 0x1F, and 0x20.

Signed-off-by: z00470624 <z00470624@huawei.com>
---
 net/nic/nic_mac/hikp_nic_xsfp.c | 250 ++++++++++++++++++++++++++++++++
 net/nic/nic_mac/hikp_nic_xsfp.h | 159 ++++++++++++++++++++
 2 files changed, 409 insertions(+)

diff --git a/net/nic/nic_mac/hikp_nic_xsfp.c b/net/nic/nic_mac/hikp_nic_xsfp.c
index d97a506..70ed589 100644
--- a/net/nic/nic_mac/hikp_nic_xsfp.c
+++ b/net/nic/nic_mac/hikp_nic_xsfp.c
@@ -55,6 +55,108 @@ static struct sff_ext_comp g_sff_ext_spec_comp[] = {
 	{0x4A, "50GBASE-ER"},
 };
 
+static struct sff_host_media_id g_sff_host_ids[] = {
+	{0x0, "Undefined", 0x0, "Undefined"},
+	{0x1, "1000BASE-CX", 0x1, "NRZ"},
+	{0xC, "100GAUI-4 C2M", 0x4, "NRZ"},
+	{0xD, "100GAUI-2 C2M", 0x2, "PAM4"},
+	{0x4B, "100GAUI-1-S C2M", 0x1, "PAM4"},
+	{0x4C, "100GAUI-1-L C2M", 0x1, "PAM4"},
+	{0xE, "200GAUI-8 C2M", 0x8, "NRZ"},
+	{0xF, "200GAUI-4 C2M", 0x4, "PAM4"},
+	{0x4D, "200GAUI-2-S C2M", 0x2, "PAM4"},
+	{0x4E, "200GAUI-2-L C2M", 0x2, "PAM4"},
+	{0x11, "400GAUI-8 C2M", 0x8, "PAM4"},
+	{0x4F, "400GAUI-4-S C2M", 0x4, "PAM4"},
+	{0x50, "400GAUI-4-L C2M", 0x4, "PAM4"},
+	{0x13, "10GBASE-CX4", 0x4, "NRZ"},
+	{0x14, "25GBASE-CR CA-25G-L", 0x1, "NRZ"},
+	{0x15, "25GBASE-CR or 25GBASE-CR-SCA-25G-S", 0x1, "NRZ"},
+	{0x16, "25GBASE-CR or 25GBASE-CR-SCA-25G-N", 0x1, "NRZ"},
+	{0x17, "40GBASE-CR4", 0x4, "NRZ"},
+	{0x43, "50GBASE-CR2 with RS(528,514)FEC", 0x2, "NRZ"},
+	{0x44, "50GBASE-CR2 with BASE-R, Fire code FEC", 0x2, "NRZ"},
+	{0x45, "50GBASE-CR2 with no FEC", 0x2, "NRZ"},
+	{0x18, "50GBASE-CR", 0x1, "PAM4"},
+	{0x1A, "100GBASE-CR4", 0x4, "NRZ"},
+	{0x1B, "100GBASE-CR2", 0x2, "PAM4"},
+	{0x46, "100GBASE-CR1", 0x1, "PAM4"},
+	{0x1C, "200GBASE-CR4", 0x4, "PAM4"},
+	{0x47, "200GBASE-CR2", 0x2, "PAM4"},
+	{0x1D, "400G CR8", 0x8, "PAM4"},
+	{0x48, "400GBASE-CR4", 0x4, "PAM4"},
+};
+
+static struct sff_host_media_id g_mmf_media_ids[] = {
+	{0x0, "Undefined", 0x0, "Undefined"},
+	{0x2, "10GBASE-SR", 0x1, "NRZ"},
+	{0x3, "25GBASE-SR", 0x1, "NRZ"},
+	{0x4, "40GBASE-SR4", 0x4, "NRZ"},
+	{0x5, "40GE SWDM4 MSA", 0x4, "NRZ"},
+	{0x7, "50GBASE-SR", 0x1, "PAM4"},
+	{0x9, "100GBASE-SR4", 0x4, "NRZ"},
+	{0xA, "100GE SWDM4 MSA", 0x4, "NRZ"},
+	{0xC, "100GBASE-SR2", 0x2, "PAM4"},
+	{0xD, "100GBASE-SR1", 0x1, "PAM4"},
+	{0x1D, "100GBASE-VR1", 0x1, "PAM4"},
+	{0xE, "200GBASE-SR4", 0x4, "PAM4"},
+	{0x1B, "200GBASE-SR2", 0x2, "PAM4"},
+	{0x1E, "200GBASE-VR2", 0x2, "PAM4"},
+	{0x10, "400GBASE-SR8", 0x8, "PAM4"},
+	{0x11, "400GBASE-SR4", 0x4, "PAM4"},
+	{0x1F, "400GBASE-VR4", 0x4, "PAM4"},
+};
+
+static struct sff_host_media_id g_smf_media_ids[] = {
+	{0x0, "Undefined", 0x0, "Undefined"},
+	{0x4, "10GBASE-LR", 0x1, "NRZ"},
+	{0x5, "10GBASE-ER", 0x1, "NRZ"},
+	{0x4E, "10GBASE-BR", 0x1, "NRZ"},
+	{0x6, "10G-ZR", 0x1, "NRZ"},
+	{0x7, "25GBASE-LR", 0x1, "NRZ"},
+	{0x8, "25GBASE-ER", 0x1, "NRZ"},
+	{0x4F, "25GBASE-BR", 0x1, "NRZ"},
+	{0x9, "40GBASE-LR4", 0x4, "NRZ"},
+	{0xB, "50GBASE-FR", 0x1, "PAM4"},
+	{0xC, "50GBASE-LR", 0x1, "PAM4"},
+	{0x40, "50GBASE-ER", 0x1, "PAM4"},
+	{0x50, "50GBASE-BR", 0x1, "PAM4"},
+	{0xD, "100GBASE-LR4", 0x4, "NRZ"},
+	{0xE, "100GBASE-ER4", 0x4, "NRZ"},
+	{0xF, "100G PSM4 MSA", 0x4, "NRZ"},
+	{0x34, "100G CWDM4-OCP", 0x4, "NRZ"},
+	{0x10, "100G CWDM4 MSA", 0x4, "NRZ"},
+	{0x11, "100G 4WDM-10 MSA", 0x4, "NRZ"},
+	{0x12, "100G 4WDM-20 MSA", 0x4, "NRZ"},
+	{0x13, "100G 4WDM-40 MSA", 0x4, "NRZ"},
+	{0x14, "100GBASE-DR", 0x1, "PAM4"},
+	{0x17, "200GBASE-DR4", 0x4, "PAM4"},
+	{0x18, "200GBASE-FR4", 0x4, "PAM4"},
+	{0x19, "200GBASE-LR4", 0x4, "PAM4"},
+	{0x41, "200GBASE-ER4", 0x4, "PAM4"},
+	{0x1A, "400GBASE-FR8", 0x8, "PAM4"},
+	{0x1B, "400GBASE-LR8", 0x8, "PAM4"},
+	{0x42, "400GBASE-ER8", 0x8, "PAM4"},
+	{0x1C, "400GBASE-DR4", 0x4, "PAM4"},
+	{0x55, "400GBASE-DR4-2", 0x4, "PAM4"},
+	{0x43, "400GBASE-LR4-6", 0x4, "PAM4"},
+};
+
+static struct sff_media_cable_id g_passive_cable_ids[] = {
+	{0x0, "Undefined"},
+	{0x1, "Copper cable"},
+	{0xBF, "Passive Loopback module"},
+};
+
+static struct sff_media_cable_id g_active_cable_ids[] = {
+	{0x0, "Undefined"},
+	{0x1, "Active Cable assembly"},
+	{0x2, "Active Cable assembly"},
+	{0x3, "Active Cable assembly"},
+	{0x4, "Active Cable assembly"},
+	{0xBF, "Active Loopback module"},
+};
+
 static int hikp_xsfp_get_cmd_data(struct hikp_cmd_ret **cmd_resp, uint32_t sub_cmd, uint32_t blk_id)
 {
 	struct hikp_xsfp_req req = {0};
@@ -320,6 +422,148 @@ static void hikp_show_qsfp_info(const uint8_t *data, uint32_t size)
 	printf("--------------------------------------------------------------\n");
 }
 
+static void cmis_print_media_optical(const struct cmis_app_desc *desc,
+				     struct sff_host_media_id *ids, size_t len)
+{
+	for (uint8_t i = 0; i < len; i++) {
+		if (desc->media_id == ids[i].id) {
+			printf("%s(%s)\n", ids[i].int_spec, ids[i].modulation);
+			return;
+		}
+	}
+	printf("0x%x\n", desc->media_id);
+}
+
+static void cmis_print_media_cable(const struct cmis_app_desc *desc,
+				   struct sff_media_cable_id *ids, size_t len)
+{
+	for (uint8_t i = 0; i < len; i++) {
+		if (desc->media_id == ids[i].id) {
+			printf("%s\n", ids[i].app_name);
+			return;
+		}
+	}
+	printf("0x%x\n", desc->media_id);
+}
+
+static void cmis_print_host_int_spec(const struct cmis_app_desc *desc)
+{
+	size_t size = HIKP_ARRAY_SIZE(g_sff_host_ids);
+
+	for (uint8_t i = 0; i < size; i++) {
+		if (desc->host_id == g_sff_host_ids[i].id) {
+			printf("%s(%s) | ",
+			       g_sff_host_ids[i].int_spec, g_sff_host_ids[i].modulation);
+			return;
+		}
+	}
+
+	printf("0x%x | ", desc->host_id);
+}
+
+static void cmis_print_host_and_media_int(const struct cmis_page_info *info, uint8_t app_id)
+{
+	const struct cmis_app_desc *desc = &info->page0_lower.apps[app_id];
+	uint8_t media_type = info->page0_lower.media_type;
+
+	printf("%s %-9u: %s", "app_descriptor", app_id, "host and media int: ");
+	cmis_print_host_int_spec(desc);
+
+	switch (media_type) {
+	case OPT_MMF:
+		cmis_print_media_optical(desc, g_mmf_media_ids, HIKP_ARRAY_SIZE(g_mmf_media_ids));
+		break;
+	case OPT_SMF:
+		cmis_print_media_optical(desc, g_smf_media_ids, HIKP_ARRAY_SIZE(g_smf_media_ids));
+		break;
+	case PASSIVE_COPPER:
+		cmis_print_media_cable(desc, g_passive_cable_ids,
+				       HIKP_ARRAY_SIZE(g_passive_cable_ids));
+		break;
+	case ACTIVE_CABLE:
+		cmis_print_media_cable(desc, g_active_cable_ids,
+				       HIKP_ARRAY_SIZE(g_active_cable_ids));
+		break;
+	default:
+		printf("0x%x\n", desc->media_id);
+		break;
+	}
+}
+
+static void cmis_print_application_desc(const struct cmis_page_info *info)
+{
+	for (uint8_t i = 0; i < CMIS_LOW_MEM_APP_DESC_NUM; i++) {
+		/* Undefined or unused, not print */
+		if ((info->page0_lower.apps[i].host_id == 0xFF) ||
+		    (!info->page0_lower.apps[i].host_id && !info->page0_lower.apps[i].media_id))
+			continue;
+
+		cmis_print_host_and_media_int(info, i);
+	}
+}
+
+static void cmis_print_base_id_info(const struct cmis_page_info *info)
+{
+	/* page00h reg 202: bit6-7 */
+	float cab_len_mul[] = {0.1f, 1.0f, 10.0f, 100.0f};
+	/* page01h reg 132: bit6-7 */
+	float smf_len_mul[] = {0.1f, 1.0f, 10.0f, 1.0f};
+	const char *type[MEDIA_TYPE_RSVD] = {
+		"Undefined", "MMF Optical Interfaces", "SMF Optical Interfaces",
+		"Passive Copper Cables", "Active Cables", "BASE-T"
+	};
+
+	printf("%-24s: 0x%02x\n", "identifier", info->page0_lower.identifier);
+	printf("%-24s: 0x%02x\n", "connector", info->page0_upper.connector_type);
+
+	if (info->page0_lower.media_type >= MEDIA_TYPE_RSVD)
+		printf("%-24s: 0x%02x\n", "media_type", info->page0_lower.media_type);
+	else
+		printf("%-24s: %s\n", "media_type", type[info->page0_lower.media_type]);
+
+	printf("%-24s: %0.2f (m)\n", "cable_len", (float)info->page0_upper.cab_base_len *
+	       cab_len_mul[info->page0_upper.len_multiplier]);
+	printf("%-24s: %0.2f (km)\n", "smf_len_km",
+	       (float)info->page1.smf_len * smf_len_mul[info->page1.smf_len_multip]);
+	printf("%-24s: %u (m)\n", "om5_len", info->page1.om5_len * 0x2);
+	printf("%-24s: %u (m)\n", "om4_len", info->page1.om4_len * 0x2);
+	printf("%-24s: %u (m)\n", "om3_len", info->page1.om3_len * 0x2);
+	printf("%-24s: %u (m)\n", "om2_len", info->page1.om2_len);
+	printf("%-24s: %u (nm)\n", "wavelength",
+	       (((uint16_t)info->page1.nominal_wave_len[0] << 8U) |
+	       (uint16_t)info->page1.nominal_wave_len[1]) / CMIS_WAVE_LEN_DIV);
+	printf("%-24s: %u (nm)\n", "wavelength_tolerance",
+	       (((uint16_t)info->page1.wave_len_tolerance[0] << 8U) |
+	       (uint16_t)info->page1.wave_len_tolerance[1]) / CMIS_TOL_WAVE_LEN_DIV);
+	printf("%-24s: 0x%02x\n", "media_technology", info->page0_upper.media_int_tech);
+	xsfp_print_data("vendor_name", VEND_NAME_LEN, info->page0_upper.vend_name, PRINT_ASCII);
+	xsfp_print_data("vendor_oui", VEND_OUI_LEN, info->page0_upper.vend_oui, PRINT_HEX);
+	xsfp_print_data("vendor_pn", VEND_PN_LEN, info->page0_upper.vend_pn, PRINT_ASCII);
+	xsfp_print_data("vendor_rev", CMIS_VEND_REV_LEN, info->page0_upper.vend_rev, PRINT_ASCII);
+	xsfp_print_data("vendor_sn", VEND_SN_LEN, info->page0_upper.vend_sn, PRINT_ASCII);
+	xsfp_print_data("vendor_date_code", VEND_DATE_CODE_LEN,
+			info->page0_upper.date_code, PRINT_ASCII);
+
+	cmis_print_application_desc(info);
+}
+
+static void cmis_print_dom_info(const struct cmis_page_info *info)
+{
+	if (!info->page0_lower.mem_model && info->page1.temp_mon_supp)
+		printf("%-24s: %d.%02u\n", "temperature", (int8_t)info->page0_lower.module_temp[0],
+		       info->page0_lower.module_temp[1]);
+}
+
+static void hikp_show_cmis_info(const uint8_t *data, uint32_t size)
+{
+	struct cmis_page_info *cmis_data = (struct cmis_page_info *)data;
+
+	printf("------------------------show cmis info------------------------\n");
+	cmis_print_base_id_info(cmis_data);
+	cmis_print_dom_info(cmis_data);
+	printf("--------------------------------------------------------------\n");
+}
+
 static void hikp_xsfp_parse_info(const uint8_t *data, uint32_t size)
 {
 	if (data[SFF_ID_OFFSET] == ID_SFP) {
@@ -328,6 +572,12 @@ static void hikp_xsfp_parse_info(const uint8_t *data, uint32_t size)
 		   data[SFF_ID_OFFSET] == ID_QSFP_PLUS ||
 		   data[SFF_ID_OFFSET] == ID_QSFP28) {
 		hikp_show_qsfp_info(data, size);
+	} else if (data[SFF_ID_OFFSET] == ID_QSFP_DD ||
+		   data[SFF_ID_OFFSET] == ID_SFP_DD ||
+		   data[SFF_ID_OFFSET] == ID_QSFP_P_CMIS ||
+		   data[SFF_ID_OFFSET] == ID_SFP_DD_CMIS ||
+		   data[SFF_ID_OFFSET] == ID_SFP_P_CMIS) {
+		hikp_show_cmis_info(data, size);
 	} else {
 		/* unknown type just dump hex data */
 		hikp_xsfp_dump_hex(data, size);
diff --git a/net/nic/nic_mac/hikp_nic_xsfp.h b/net/nic/nic_mac/hikp_nic_xsfp.h
index a378197..6f5e38f 100644
--- a/net/nic/nic_mac/hikp_nic_xsfp.h
+++ b/net/nic/nic_mac/hikp_nic_xsfp.h
@@ -75,6 +75,11 @@
 #define QSFP_10GBASE_LR_MASK        HI_BIT(5)
 #define QSFP_10GBASE_LRM_MASK       HI_BIT(6)
 
+#define CMIS_WAVE_LEN_DIV           20
+#define CMIS_TOL_WAVE_LEN_DIV       200
+
+#define CMIS_VEND_REV_LEN           2
+
 enum print_type {
 	PRINT_ASCII = 0,
 	PRINT_HEX,
@@ -87,6 +92,11 @@ enum sff_id_val {
 	ID_QSFP = 0x0C,
 	ID_QSFP_PLUS = 0x0D,
 	ID_QSFP28 = 0x11,
+	ID_QSFP_DD = 0x18,
+	ID_SFP_DD = 0x1A,
+	ID_QSFP_P_CMIS = 0x1E,
+	ID_SFP_DD_CMIS = 0x1F,
+	ID_SFP_P_CMIS = 0x20,
 };
 
 struct sff_comp_info {
@@ -99,6 +109,18 @@ struct sff_ext_comp {
 	const char *module_cap;
 };
 
+struct sff_host_media_id {
+	uint8_t id;
+	const char *int_spec;
+	uint8_t lane_cnt;
+	const char *modulation;
+};
+
+struct sff_media_cable_id {
+	uint8_t id;
+	const char *app_name;
+};
+
 struct sfp_a0_page {
 	uint8_t identifier;                     /* reg 0: Identifier */
 	uint8_t ext_identifier;                 /* reg 1: Ext. Identifier */
@@ -358,6 +380,143 @@ struct qsfp_page0_info {
 	struct qsfp_page0_upper page_upper;
 };
 
+enum cmis_media_type {
+	UNDEFINED = 0,
+	OPT_MMF,
+	OPT_SMF,
+	PASSIVE_COPPER,
+	ACTIVE_CABLE,
+	BASE_T,
+	MEDIA_TYPE_RSVD,
+};
+
+#define CMIS_LOW_MEM_APP_DESC_NUM	8
+struct cmis_app_desc {
+	uint8_t host_id;                 /* host electrical interface id */
+	uint8_t media_id;                /* module media electrical interface id */
+	uint8_t media_lane_cnt : 4,
+		host_lane_cnt : 4;       /* host and media lane counts */
+	uint8_t host_assign;             /*  Host Lane Assignment Options */
+};
+
+struct cmis_page0_lower {
+	uint8_t identifier;              /* reg 0: Identifier */
+	uint8_t rev_compliance;          /* reg 1: CMIS revision */
+	/* reg 2: Module Management Characteristics */
+	uint8_t rsv0 : 2,
+		mci_max_speed : 2,
+		rsv1 : 2,
+		step_cfg_only : 1,
+		mem_model : 1;
+	/* reg 3: Global Status Information */
+	uint8_t intr_deasserted : 1,
+		module_state : 3,
+		rsv2 : 4;
+	uint8_t flags_sum[4];            /* reg 4-7: Lane-Level Flags Summary */
+	uint8_t module_flags[6];         /* reg 8-13: Module-Level Flags */
+	uint8_t module_temp[2];          /* reg 14-15: TempMonValue */
+	uint8_t module_vcc[2];           /* reg 16-17: VccMonVoltage */
+	uint8_t module_mon_val[8];       /* reg 18-25: Module-Level Mon Value */
+	/* reg 26: Module Global Controls */
+	uint8_t rsv3 : 3,
+		sw_reset : 1,
+		lowpwr_req_sw : 1,
+		squ_method_sel : 1,
+		lowpwr_allow_req_hw : 1,
+		bank_bc_enable : 1;
+	uint8_t rsv4[14];                /* reg 27-40:  */
+	uint8_t module_fault;            /* reg 41: Module Fault Information */
+	uint8_t rsv5[22];                /* reg 42-63: Reserved */
+	uint8_t custom[21];              /* reg 64-84: Custom */
+	uint8_t media_type;              /* reg 85: Media Type Encodings */
+	/* reg 86-117: Application Descriptor */
+	struct cmis_app_desc apps[CMIS_LOW_MEM_APP_DESC_NUM];
+	uint8_t pwd_area[8];             /* reg 118-125: Password Facilities */
+	uint8_t bank_sel;                /* reg 126: Bank Index of Page mapped to Upper Memory */
+	uint8_t page_sel;                /* reg 127: Page Index of Page mapped to Upper Memory */
+};
+
+struct cmis_page0_upper {
+	uint8_t identifier_cp;           /* reg 128: The Same Byte 00h:0 */
+	uint8_t vend_name[16];           /* reg 129-144: Vendor name (ASCII) */
+	uint8_t vend_oui[3];             /* reg 145-147: Vendor IEEE company ID */
+	uint8_t vend_pn[16];             /* reg 148-163: Part number provided by vendor (ASCII) */
+	/* reg 164-165: Revision level for part number provided by vendor (ASCII) */
+	uint8_t vend_rev[2];
+	uint8_t vend_sn[16];             /* reg 166-181: Vendor Serial Number (ASCII) */
+	uint8_t date_code[8];            /* reg 182-189: Manufacturing Date Code (ASCII) */
+	/* reg 190-199: Common Language Equipment Identification Code (ASCII) */
+	uint8_t clei_code[10];
+	uint8_t module_pwr_class;        /* reg 200: Module Power Class */
+	/* reg 201: Maximum power consumption in multiples of 0.25 W
+	 * rounded up to the next whole multiple of 0.25 W
+	 */
+	uint8_t max_power;
+	/* reg 202: Cable Assembly Link Length */
+	uint8_t cab_base_len : 6,
+		len_multiplier : 2;
+	uint8_t connector_type;          /* reg 203: Media Connector Type */
+	uint8_t copp_attenuation[6];     /* reg 204-209: Copper Cable Attenuation */
+	uint8_t media_lanes;             /* reg 210: Media Lane Information */
+	uint8_t cable_assembly_lane;     /* reg 211: Cable Assembly Lane Information */
+	uint8_t media_int_tech;          /* reg 212: Media Interface Technology */
+	uint8_t rsv0[8];                 /* reg 213-220: Reserved */
+	uint8_t rsv1;                    /* reg 221: Custom1 */
+	uint8_t page_check_sum;          /* reg 222: Page Checksum over bytes 128-221 */
+	uint8_t rsv[33];                 /* reg 223-255: Custom Info (non-volatile) */
+};
+
+struct cmis_page1_info {
+	uint8_t inac_fw_hw_ver[4];       /* reg 128-131: Inactive FW revision and HW revision */
+	uint8_t smf_len : 6,             /* reg 132: Base link length for SMF fiber in km */
+		smf_len_multip : 2;      /* Link length multiplier for SMF fiber */
+	uint8_t om5_len;                 /* reg 133: Link length supported for OM5 fiber */
+	uint8_t om4_len;                 /* reg 134: Link length supported for OM4 fiber */
+	uint8_t om3_len;         /* reg 135: Link length supported for EBW 50/125 µm fiber (OM3) */
+	uint8_t om2_len;         /* reg 136: Link length supported for 50/125 µm fiber (OM2) */
+	uint8_t rsv0;                    /* reg 137: Reserved */
+	uint8_t nominal_wave_len[2];     /* reg 138-139: NominalWavelength */
+	uint8_t wave_len_tolerance[2];   /* reg 140-141: WavelengthTolerance */
+	uint8_t pages_support;           /* reg 142: Supported Pages Advertising */
+	uint8_t duration_adv[2];         /* reg 143-144: Durations Advertising */
+	uint8_t module_char[10];         /* reg 145-154: Module Characteristics Advertising */
+	uint8_t contrl_support[2];       /* reg 155-156: Supported Controls Advertisement */
+	uint8_t flags_support[2];        /* reg 157-158: Supported Flags Advertisement */
+	/* reg 159: Supported Mon Advertisement */
+	uint8_t temp_mon_supp : 1,
+		vcc_mon_supp : 1,
+		aux1_mon_supp : 1,
+		aux2_mon_supp : 1,
+		aux3_mon_supp : 1,
+		custom_mon_supp : 1,
+		rsv1 : 2;
+	/* reg 160: Supported Power Mon Advertisement */
+	uint8_t txbias_mon_supp : 1,
+		tx_pwr_mon_supp : 1,
+		rx_pwr_mon_supp : 1,
+		txbias_curr_scal : 2,
+		rsv2 : 3;
+	/* reg 161-162: Supported Configuration and Signal Integrity Controls Advertisement */
+	uint8_t sig_intr_support[2];
+	uint8_t cdb_func_support[4];     /* reg 163-166: CDB Messaging Support Advertisement */
+	uint8_t add_dura_adv[3];         /* reg 167-169: Additional Durations Advertising */
+	uint8_t rsv3[7];                 /* reg 170-175: Reserved */
+	uint8_t media_lane_adv[15];      /* reg 176-190: Media Lane Assignment Advertising */
+	uint8_t custom[32];              /* reg 191-222: Custom */
+	uint8_t add_app_desc[28];    /* reg 223-250: Additional Application Descriptor Registers */
+	uint8_t rsv4[4];                 /* reg 251-254: Reserved */
+	uint8_t page_check_sum;          /* reg 255: Page Checksum */
+};
+
+/* Current support max 640 bytes data */
+struct cmis_page_info {
+	struct cmis_page0_lower page0_lower;
+	struct cmis_page0_upper page0_upper;
+	struct cmis_page1_info page1;
+	uint8_t page2_data[128];
+	uint8_t page3_data[128];
+};
+
 #define XSFP_TARGET_BIT     HI_BIT(0)
 #define XSFP_RAW_DATA_BIT   HI_BIT(1)
 
-- 
2.33.0

