|
|
1f2507 |
From 6e6aed12948d2d191660252a4be9bb33dc283bed Mon Sep 17 00:00:00 2001
|
|
|
1f2507 |
From: Ido Schimmel <idosch@nvidia.com>
|
|
|
1f2507 |
Date: Tue, 12 Oct 2021 16:25:14 +0300
|
|
|
1f2507 |
Subject: [PATCH 15/35] cmis: Use memory map during parsing
|
|
|
1f2507 |
|
|
|
1f2507 |
Instead of passing one large buffer to the individual parsing functions,
|
|
|
1f2507 |
use the memory map structure from the previous patch.
|
|
|
1f2507 |
|
|
|
1f2507 |
This has the added benefit of checking which optional pages are actually
|
|
|
1f2507 |
available and it will also allow us to consolidate the IOCTL and netlink
|
|
|
1f2507 |
parsing code paths.
|
|
|
1f2507 |
|
|
|
1f2507 |
Tested by making sure that the only differences in output in both the
|
|
|
1f2507 |
IOCTL and netlink paths before and after the patch are in a few
|
|
|
1f2507 |
registers in Page 01h that were previously parsed from Page 00h.
|
|
|
1f2507 |
|
|
|
1f2507 |
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
|
1f2507 |
---
|
|
|
1f2507 |
cmis.c | 175 +++++++++++++++++++++++++++++----------------------------
|
|
|
1f2507 |
cmis.h | 1 -
|
|
|
1f2507 |
2 files changed, 88 insertions(+), 88 deletions(-)
|
|
|
1f2507 |
|
|
|
1f2507 |
diff --git a/cmis.c b/cmis.c
|
|
|
1f2507 |
index 8a6788416a00..2e01446b2315 100644
|
|
|
1f2507 |
--- a/cmis.c
|
|
|
1f2507 |
+++ b/cmis.c
|
|
|
1f2507 |
@@ -22,19 +22,19 @@ struct cmis_memory_map {
|
|
|
1f2507 |
|
|
|
1f2507 |
#define CMIS_PAGE_SIZE 0x80
|
|
|
1f2507 |
|
|
|
1f2507 |
-static void cmis_show_identifier(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_identifier(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- sff8024_show_identifier(id, CMIS_ID_OFFSET);
|
|
|
1f2507 |
+ sff8024_show_identifier(map->lower_memory, CMIS_ID_OFFSET);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
-static void cmis_show_connector(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_connector(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- sff8024_show_connector(id, CMIS_CTOR_OFFSET);
|
|
|
1f2507 |
+ sff8024_show_connector(map->page_00h, CMIS_CTOR_OFFSET);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
-static void cmis_show_oui(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_oui(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- sff8024_show_oui(id, CMIS_VENDOR_OUI_OFFSET);
|
|
|
1f2507 |
+ sff8024_show_oui(map->page_00h, CMIS_VENDOR_OUI_OFFSET);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
/**
|
|
|
1f2507 |
@@ -42,9 +42,9 @@ static void cmis_show_oui(const __u8 *id)
|
|
|
1f2507 |
* [1] CMIS Rev. 3, pag. 45, section 1.7.2.1, Table 18
|
|
|
1f2507 |
* [2] CMIS Rev. 4, pag. 81, section 8.2.1, Table 8-2
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_rev_compliance(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_rev_compliance(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- __u8 rev = id[CMIS_REV_COMPLIANCE_OFFSET];
|
|
|
1f2507 |
+ __u8 rev = map->lower_memory[CMIS_REV_COMPLIANCE_OFFSET];
|
|
|
1f2507 |
int major = (rev >> 4) & 0x0F;
|
|
|
1f2507 |
int minor = rev & 0x0F;
|
|
|
1f2507 |
|
|
|
1f2507 |
@@ -58,17 +58,17 @@ static void cmis_show_rev_compliance(const __u8 *id)
|
|
|
1f2507 |
* [2] CMIS Rev. 4, pag. 94, section 8.3.9, Table 8-18
|
|
|
1f2507 |
* [3] QSFP-DD Hardware Rev 5.0, pag. 22, section 4.2.1
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_power_info(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_power_info(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
float max_power = 0.0f;
|
|
|
1f2507 |
__u8 base_power = 0;
|
|
|
1f2507 |
__u8 power_class;
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Get the power class (first 3 most significat bytes) */
|
|
|
1f2507 |
- power_class = (id[CMIS_PWR_CLASS_OFFSET] >> 5) & 0x07;
|
|
|
1f2507 |
+ power_class = (map->page_00h[CMIS_PWR_CLASS_OFFSET] >> 5) & 0x07;
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Get the base power in multiples of 0.25W */
|
|
|
1f2507 |
- base_power = id[CMIS_PWR_MAX_POWER_OFFSET];
|
|
|
1f2507 |
+ base_power = map->page_00h[CMIS_PWR_MAX_POWER_OFFSET];
|
|
|
1f2507 |
max_power = base_power * 0.25f;
|
|
|
1f2507 |
|
|
|
1f2507 |
printf("\t%-41s : %d\n", "Power class", power_class + 1);
|
|
|
1f2507 |
@@ -83,20 +83,20 @@ static void cmis_show_power_info(const __u8 *id)
|
|
|
1f2507 |
* [1] CMIS Rev. 3, pag. 59, section 1.7.3.10, Table 31
|
|
|
1f2507 |
* [2] CMIS Rev. 4, pag. 94, section 8.3.10, Table 8-19
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_cbl_asm_len(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_cbl_asm_len(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
static const char *fn = "Cable assembly length";
|
|
|
1f2507 |
float mul = 1.0f;
|
|
|
1f2507 |
float val = 0.0f;
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Check if max length */
|
|
|
1f2507 |
- if (id[CMIS_CBL_ASM_LEN_OFFSET] == CMIS_6300M_MAX_LEN) {
|
|
|
1f2507 |
+ if (map->page_00h[CMIS_CBL_ASM_LEN_OFFSET] == CMIS_6300M_MAX_LEN) {
|
|
|
1f2507 |
printf("\t%-41s : > 6.3km\n", fn);
|
|
|
1f2507 |
return;
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Get the multiplier from the first two bits */
|
|
|
1f2507 |
- switch (id[CMIS_CBL_ASM_LEN_OFFSET] & CMIS_LEN_MUL_MASK) {
|
|
|
1f2507 |
+ switch (map->page_00h[CMIS_CBL_ASM_LEN_OFFSET] & CMIS_LEN_MUL_MASK) {
|
|
|
1f2507 |
case CMIS_MULTIPLIER_00:
|
|
|
1f2507 |
mul = 0.1f;
|
|
|
1f2507 |
break;
|
|
|
1f2507 |
@@ -114,7 +114,7 @@ static void cmis_show_cbl_asm_len(const __u8 *id)
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Get base value from first 6 bits and multiply by mul */
|
|
|
1f2507 |
- val = (id[CMIS_CBL_ASM_LEN_OFFSET] & CMIS_LEN_VAL_MASK);
|
|
|
1f2507 |
+ val = (map->page_00h[CMIS_CBL_ASM_LEN_OFFSET] & CMIS_LEN_VAL_MASK);
|
|
|
1f2507 |
val = (float)val * mul;
|
|
|
1f2507 |
printf("\t%-41s : %0.2fm\n", fn, val);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
@@ -126,14 +126,17 @@ static void cmis_show_cbl_asm_len(const __u8 *id)
|
|
|
1f2507 |
* [1] CMIS Rev. 3, pag. 63, section 1.7.4.2, Table 39
|
|
|
1f2507 |
* [2] CMIS Rev. 4, pag. 99, section 8.4.2, Table 8-27
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_print_smf_cbl_len(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_print_smf_cbl_len(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
static const char *fn = "Length (SMF)";
|
|
|
1f2507 |
float mul = 1.0f;
|
|
|
1f2507 |
float val = 0.0f;
|
|
|
1f2507 |
|
|
|
1f2507 |
+ if (!map->page_01h)
|
|
|
1f2507 |
+ return;
|
|
|
1f2507 |
+
|
|
|
1f2507 |
/* Get the multiplier from the first two bits */
|
|
|
1f2507 |
- switch (id[CMIS_SMF_LEN_OFFSET] & CMIS_LEN_MUL_MASK) {
|
|
|
1f2507 |
+ switch (map->page_01h[CMIS_SMF_LEN_OFFSET] & CMIS_LEN_MUL_MASK) {
|
|
|
1f2507 |
case CMIS_MULTIPLIER_00:
|
|
|
1f2507 |
mul = 0.1f;
|
|
|
1f2507 |
break;
|
|
|
1f2507 |
@@ -145,7 +148,7 @@ static void cmis_print_smf_cbl_len(const __u8 *id)
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Get base value from first 6 bits and multiply by mul */
|
|
|
1f2507 |
- val = (id[CMIS_SMF_LEN_OFFSET] & CMIS_LEN_VAL_MASK);
|
|
|
1f2507 |
+ val = (map->page_01h[CMIS_SMF_LEN_OFFSET] & CMIS_LEN_VAL_MASK);
|
|
|
1f2507 |
val = (float)val * mul;
|
|
|
1f2507 |
printf("\t%-41s : %0.2fkm\n", fn, val);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
@@ -155,21 +158,24 @@ static void cmis_print_smf_cbl_len(const __u8 *id)
|
|
|
1f2507 |
* [1] CMIS Rev. 3, pag. 71, section 1.7.4.10, Table 46
|
|
|
1f2507 |
* [2] CMIS Rev. 4, pag. 105, section 8.4.10, Table 8-34
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_sig_integrity(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_sig_integrity(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
+ if (!map->page_01h)
|
|
|
1f2507 |
+ return;
|
|
|
1f2507 |
+
|
|
|
1f2507 |
/* CDR Bypass control: 2nd bit from each byte */
|
|
|
1f2507 |
printf("\t%-41s : ", "Tx CDR bypass control");
|
|
|
1f2507 |
- printf("%s\n", YESNO(id[CMIS_SIG_INTEG_TX_OFFSET] & 0x02));
|
|
|
1f2507 |
+ printf("%s\n", YESNO(map->page_01h[CMIS_SIG_INTEG_TX_OFFSET] & 0x02));
|
|
|
1f2507 |
|
|
|
1f2507 |
printf("\t%-41s : ", "Rx CDR bypass control");
|
|
|
1f2507 |
- printf("%s\n", YESNO(id[CMIS_SIG_INTEG_RX_OFFSET] & 0x02));
|
|
|
1f2507 |
+ printf("%s\n", YESNO(map->page_01h[CMIS_SIG_INTEG_RX_OFFSET] & 0x02));
|
|
|
1f2507 |
|
|
|
1f2507 |
/* CDR Implementation: 1st bit from each byte */
|
|
|
1f2507 |
printf("\t%-41s : ", "Tx CDR");
|
|
|
1f2507 |
- printf("%s\n", YESNO(id[CMIS_SIG_INTEG_TX_OFFSET] & 0x01));
|
|
|
1f2507 |
+ printf("%s\n", YESNO(map->page_01h[CMIS_SIG_INTEG_TX_OFFSET] & 0x01));
|
|
|
1f2507 |
|
|
|
1f2507 |
printf("\t%-41s : ", "Rx CDR");
|
|
|
1f2507 |
- printf("%s\n", YESNO(id[CMIS_SIG_INTEG_RX_OFFSET] & 0x01));
|
|
|
1f2507 |
+ printf("%s\n", YESNO(map->page_01h[CMIS_SIG_INTEG_RX_OFFSET] & 0x01));
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
/**
|
|
|
1f2507 |
@@ -182,14 +188,14 @@ static void cmis_show_sig_integrity(const __u8 *id)
|
|
|
1f2507 |
* --> pag. 98, section 8.4, Table 8-25
|
|
|
1f2507 |
* --> page 100, section 8.4.3, 8.4.4
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_mit_compliance(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_mit_compliance(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
static const char *cc = " (Copper cable,";
|
|
|
1f2507 |
|
|
|
1f2507 |
printf("\t%-41s : 0x%02x", "Transmitter technology",
|
|
|
1f2507 |
- id[CMIS_MEDIA_INTF_TECH_OFFSET]);
|
|
|
1f2507 |
+ map->page_00h[CMIS_MEDIA_INTF_TECH_OFFSET]);
|
|
|
1f2507 |
|
|
|
1f2507 |
- switch (id[CMIS_MEDIA_INTF_TECH_OFFSET]) {
|
|
|
1f2507 |
+ switch (map->page_00h[CMIS_MEDIA_INTF_TECH_OFFSET]) {
|
|
|
1f2507 |
case CMIS_850_VCSEL:
|
|
|
1f2507 |
printf(" (850 nm VCSEL)\n");
|
|
|
1f2507 |
break;
|
|
|
1f2507 |
@@ -240,22 +246,22 @@ static void cmis_show_mit_compliance(const __u8 *id)
|
|
|
1f2507 |
break;
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
- if (id[CMIS_MEDIA_INTF_TECH_OFFSET] >= CMIS_COPPER_UNEQUAL) {
|
|
|
1f2507 |
+ if (map->page_00h[CMIS_MEDIA_INTF_TECH_OFFSET] >= CMIS_COPPER_UNEQUAL) {
|
|
|
1f2507 |
printf("\t%-41s : %udb\n", "Attenuation at 5GHz",
|
|
|
1f2507 |
- id[CMIS_COPPER_ATT_5GHZ]);
|
|
|
1f2507 |
+ map->page_00h[CMIS_COPPER_ATT_5GHZ]);
|
|
|
1f2507 |
printf("\t%-41s : %udb\n", "Attenuation at 7GHz",
|
|
|
1f2507 |
- id[CMIS_COPPER_ATT_7GHZ]);
|
|
|
1f2507 |
+ map->page_00h[CMIS_COPPER_ATT_7GHZ]);
|
|
|
1f2507 |
printf("\t%-41s : %udb\n", "Attenuation at 12.9GHz",
|
|
|
1f2507 |
- id[CMIS_COPPER_ATT_12P9GHZ]);
|
|
|
1f2507 |
+ map->page_00h[CMIS_COPPER_ATT_12P9GHZ]);
|
|
|
1f2507 |
printf("\t%-41s : %udb\n", "Attenuation at 25.8GHz",
|
|
|
1f2507 |
- id[CMIS_COPPER_ATT_25P8GHZ]);
|
|
|
1f2507 |
- } else {
|
|
|
1f2507 |
+ map->page_00h[CMIS_COPPER_ATT_25P8GHZ]);
|
|
|
1f2507 |
+ } else if (map->page_01h) {
|
|
|
1f2507 |
printf("\t%-41s : %.3lfnm\n", "Laser wavelength",
|
|
|
1f2507 |
- (((id[CMIS_NOM_WAVELENGTH_MSB] << 8) |
|
|
|
1f2507 |
- id[CMIS_NOM_WAVELENGTH_LSB]) * 0.05));
|
|
|
1f2507 |
+ (((map->page_01h[CMIS_NOM_WAVELENGTH_MSB] << 8) |
|
|
|
1f2507 |
+ map->page_01h[CMIS_NOM_WAVELENGTH_LSB]) * 0.05));
|
|
|
1f2507 |
printf("\t%-41s : %.3lfnm\n", "Laser wavelength tolerance",
|
|
|
1f2507 |
- (((id[CMIS_WAVELENGTH_TOL_MSB] << 8) |
|
|
|
1f2507 |
- id[CMIS_WAVELENGTH_TOL_LSB]) * 0.005));
|
|
|
1f2507 |
+ (((map->page_01h[CMIS_WAVELENGTH_TOL_MSB] << 8) |
|
|
|
1f2507 |
+ map->page_01h[CMIS_WAVELENGTH_TOL_LSB]) * 0.005));
|
|
|
1f2507 |
}
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
@@ -275,28 +281,16 @@ static void cmis_show_mit_compliance(const __u8 *id)
|
|
|
1f2507 |
* [2] CMIS Rev. 4:
|
|
|
1f2507 |
* --> pag. 84, section 8.2.4, Table 8-6
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_mod_lvl_monitors(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_mod_lvl_monitors(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
+ const __u8 *id = map->lower_memory;
|
|
|
1f2507 |
+
|
|
|
1f2507 |
PRINT_TEMP("Module temperature",
|
|
|
1f2507 |
OFFSET_TO_TEMP(CMIS_CURR_TEMP_OFFSET));
|
|
|
1f2507 |
PRINT_VCC("Module voltage",
|
|
|
1f2507 |
OFFSET_TO_U16(CMIS_CURR_VCC_OFFSET));
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
-static void cmis_show_link_len_from_page(const __u8 *page_one_data)
|
|
|
1f2507 |
-{
|
|
|
1f2507 |
- cmis_print_smf_cbl_len(page_one_data);
|
|
|
1f2507 |
- sff_show_value_with_unit(page_one_data, CMIS_OM5_LEN_OFFSET,
|
|
|
1f2507 |
- "Length (OM5)", 2, "m");
|
|
|
1f2507 |
- sff_show_value_with_unit(page_one_data, CMIS_OM4_LEN_OFFSET,
|
|
|
1f2507 |
- "Length (OM4)", 2, "m");
|
|
|
1f2507 |
- sff_show_value_with_unit(page_one_data, CMIS_OM3_LEN_OFFSET,
|
|
|
1f2507 |
- "Length (OM3 50/125um)", 2, "m");
|
|
|
1f2507 |
- sff_show_value_with_unit(page_one_data, CMIS_OM2_LEN_OFFSET,
|
|
|
1f2507 |
- "Length (OM2 50/125um)", 1, "m");
|
|
|
1f2507 |
-}
|
|
|
1f2507 |
-
|
|
|
1f2507 |
-
|
|
|
1f2507 |
/**
|
|
|
1f2507 |
* Print relevant info about the maximum supported fiber media length
|
|
|
1f2507 |
* for each type of fiber media at the maximum module-supported bit rate.
|
|
|
1f2507 |
@@ -304,9 +298,19 @@ static void cmis_show_link_len_from_page(const __u8 *page_one_data)
|
|
|
1f2507 |
* [1] CMIS Rev. 3, page 64, section 1.7.4.2, Table 39
|
|
|
1f2507 |
* [2] CMIS Rev. 4, page 99, section 8.4.2, Table 8-27
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_link_len(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_link_len(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- cmis_show_link_len_from_page(id);
|
|
|
1f2507 |
+ cmis_print_smf_cbl_len(map);
|
|
|
1f2507 |
+ if (!map->page_01h)
|
|
|
1f2507 |
+ return;
|
|
|
1f2507 |
+ sff_show_value_with_unit(map->page_01h, CMIS_OM5_LEN_OFFSET,
|
|
|
1f2507 |
+ "Length (OM5)", 2, "m");
|
|
|
1f2507 |
+ sff_show_value_with_unit(map->page_01h, CMIS_OM4_LEN_OFFSET,
|
|
|
1f2507 |
+ "Length (OM4)", 2, "m");
|
|
|
1f2507 |
+ sff_show_value_with_unit(map->page_01h, CMIS_OM3_LEN_OFFSET,
|
|
|
1f2507 |
+ "Length (OM3 50/125um)", 2, "m");
|
|
|
1f2507 |
+ sff_show_value_with_unit(map->page_01h, CMIS_OM2_LEN_OFFSET,
|
|
|
1f2507 |
+ "Length (OM2 50/125um)", 1, "m");
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
/**
|
|
|
1f2507 |
@@ -314,25 +318,26 @@ static void cmis_show_link_len(const __u8 *id)
|
|
|
1f2507 |
* [1] CMIS Rev. 3, page 56, section 1.7.3, Table 27
|
|
|
1f2507 |
* [2] CMIS Rev. 4, page 91, section 8.2, Table 8-15
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-static void cmis_show_vendor_info(const __u8 *id)
|
|
|
1f2507 |
+static void cmis_show_vendor_info(const struct cmis_memory_map *map)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- const char *clei = (const char *)(id + CMIS_CLEI_START_OFFSET);
|
|
|
1f2507 |
+ const char *clei;
|
|
|
1f2507 |
|
|
|
1f2507 |
- sff_show_ascii(id, CMIS_VENDOR_NAME_START_OFFSET,
|
|
|
1f2507 |
+ sff_show_ascii(map->page_00h, CMIS_VENDOR_NAME_START_OFFSET,
|
|
|
1f2507 |
CMIS_VENDOR_NAME_END_OFFSET, "Vendor name");
|
|
|
1f2507 |
- cmis_show_oui(id);
|
|
|
1f2507 |
- sff_show_ascii(id, CMIS_VENDOR_PN_START_OFFSET,
|
|
|
1f2507 |
+ cmis_show_oui(map);
|
|
|
1f2507 |
+ sff_show_ascii(map->page_00h, CMIS_VENDOR_PN_START_OFFSET,
|
|
|
1f2507 |
CMIS_VENDOR_PN_END_OFFSET, "Vendor PN");
|
|
|
1f2507 |
- sff_show_ascii(id, CMIS_VENDOR_REV_START_OFFSET,
|
|
|
1f2507 |
+ sff_show_ascii(map->page_00h, CMIS_VENDOR_REV_START_OFFSET,
|
|
|
1f2507 |
CMIS_VENDOR_REV_END_OFFSET, "Vendor rev");
|
|
|
1f2507 |
- sff_show_ascii(id, CMIS_VENDOR_SN_START_OFFSET,
|
|
|
1f2507 |
+ sff_show_ascii(map->page_00h, CMIS_VENDOR_SN_START_OFFSET,
|
|
|
1f2507 |
CMIS_VENDOR_SN_END_OFFSET, "Vendor SN");
|
|
|
1f2507 |
- sff_show_ascii(id, CMIS_DATE_YEAR_OFFSET,
|
|
|
1f2507 |
+ sff_show_ascii(map->page_00h, CMIS_DATE_YEAR_OFFSET,
|
|
|
1f2507 |
CMIS_DATE_VENDOR_LOT_OFFSET + 1, "Date code");
|
|
|
1f2507 |
|
|
|
1f2507 |
+ clei = (const char *)(map->page_00h + CMIS_CLEI_START_OFFSET);
|
|
|
1f2507 |
if (*clei && strncmp(clei, CMIS_CLEI_BLANK, CMIS_CLEI_LEN))
|
|
|
1f2507 |
- sff_show_ascii(id, CMIS_CLEI_START_OFFSET, CMIS_CLEI_END_OFFSET,
|
|
|
1f2507 |
- "CLEI code");
|
|
|
1f2507 |
+ sff_show_ascii(map->page_00h, CMIS_CLEI_START_OFFSET,
|
|
|
1f2507 |
+ CMIS_CLEI_END_OFFSET, "CLEI code");
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
static void cmis_memory_map_init_buf(struct cmis_memory_map *map,
|
|
|
1f2507 |
@@ -363,16 +368,16 @@ void cmis_show_all_ioctl(const __u8 *id)
|
|
|
1f2507 |
|
|
|
1f2507 |
cmis_memory_map_init_buf(&map, id);
|
|
|
1f2507 |
|
|
|
1f2507 |
- cmis_show_identifier(id);
|
|
|
1f2507 |
- cmis_show_power_info(id);
|
|
|
1f2507 |
- cmis_show_connector(id);
|
|
|
1f2507 |
- cmis_show_cbl_asm_len(id);
|
|
|
1f2507 |
- cmis_show_sig_integrity(id);
|
|
|
1f2507 |
- cmis_show_mit_compliance(id);
|
|
|
1f2507 |
- cmis_show_mod_lvl_monitors(id);
|
|
|
1f2507 |
- cmis_show_link_len(id);
|
|
|
1f2507 |
- cmis_show_vendor_info(id);
|
|
|
1f2507 |
- cmis_show_rev_compliance(id);
|
|
|
1f2507 |
+ cmis_show_identifier(&map);
|
|
|
1f2507 |
+ cmis_show_power_info(&map);
|
|
|
1f2507 |
+ cmis_show_connector(&map);
|
|
|
1f2507 |
+ cmis_show_cbl_asm_len(&map);
|
|
|
1f2507 |
+ cmis_show_sig_integrity(&map);
|
|
|
1f2507 |
+ cmis_show_mit_compliance(&map);
|
|
|
1f2507 |
+ cmis_show_mod_lvl_monitors(&map);
|
|
|
1f2507 |
+ cmis_show_link_len(&map);
|
|
|
1f2507 |
+ cmis_show_vendor_info(&map);
|
|
|
1f2507 |
+ cmis_show_rev_compliance(&map);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
|
|
|
1f2507 |
static void
|
|
|
1f2507 |
@@ -403,22 +408,18 @@ cmis_memory_map_init_pages(struct cmis_memory_map *map,
|
|
|
1f2507 |
void cmis_show_all_nl(const struct ethtool_module_eeprom *page_zero,
|
|
|
1f2507 |
const struct ethtool_module_eeprom *page_one)
|
|
|
1f2507 |
{
|
|
|
1f2507 |
- const __u8 *page_zero_data = page_zero->data;
|
|
|
1f2507 |
struct cmis_memory_map map = {};
|
|
|
1f2507 |
|
|
|
1f2507 |
cmis_memory_map_init_pages(&map, page_zero, page_one);
|
|
|
1f2507 |
|
|
|
1f2507 |
- cmis_show_identifier(page_zero_data);
|
|
|
1f2507 |
- cmis_show_power_info(page_zero_data);
|
|
|
1f2507 |
- cmis_show_connector(page_zero_data);
|
|
|
1f2507 |
- cmis_show_cbl_asm_len(page_zero_data);
|
|
|
1f2507 |
- cmis_show_sig_integrity(page_zero_data);
|
|
|
1f2507 |
- cmis_show_mit_compliance(page_zero_data);
|
|
|
1f2507 |
- cmis_show_mod_lvl_monitors(page_zero_data);
|
|
|
1f2507 |
-
|
|
|
1f2507 |
- if (page_one)
|
|
|
1f2507 |
- cmis_show_link_len_from_page(page_one->data - 0x80);
|
|
|
1f2507 |
-
|
|
|
1f2507 |
- cmis_show_vendor_info(page_zero_data);
|
|
|
1f2507 |
- cmis_show_rev_compliance(page_zero_data);
|
|
|
1f2507 |
+ cmis_show_identifier(&map);
|
|
|
1f2507 |
+ cmis_show_power_info(&map);
|
|
|
1f2507 |
+ cmis_show_connector(&map);
|
|
|
1f2507 |
+ cmis_show_cbl_asm_len(&map);
|
|
|
1f2507 |
+ cmis_show_sig_integrity(&map);
|
|
|
1f2507 |
+ cmis_show_mit_compliance(&map);
|
|
|
1f2507 |
+ cmis_show_mod_lvl_monitors(&map);
|
|
|
1f2507 |
+ cmis_show_link_len(&map);
|
|
|
1f2507 |
+ cmis_show_vendor_info(&map);
|
|
|
1f2507 |
+ cmis_show_rev_compliance(&map);
|
|
|
1f2507 |
}
|
|
|
1f2507 |
diff --git a/cmis.h b/cmis.h
|
|
|
1f2507 |
index 53cbb5f57127..c878e3bc5afd 100644
|
|
|
1f2507 |
--- a/cmis.h
|
|
|
1f2507 |
+++ b/cmis.h
|
|
|
1f2507 |
@@ -100,7 +100,6 @@
|
|
|
1f2507 |
* that are unique to active modules and cable assemblies.
|
|
|
1f2507 |
* GlobalOffset = 2 * 0x80 + LocalOffset
|
|
|
1f2507 |
*/
|
|
|
1f2507 |
-#define PAG01H_UPPER_OFFSET (0x02 * 0x80)
|
|
|
1f2507 |
|
|
|
1f2507 |
/* Supported Link Length (Page 1) */
|
|
|
1f2507 |
#define CMIS_SMF_LEN_OFFSET 0x84
|
|
|
1f2507 |
--
|
|
|
1f2507 |
2.35.1
|
|
|
1f2507 |
|