@@ -928,6 +928,85 @@ static void cmis_show_fw_version(const struct cmis_memory_map *map)
cmis_show_fw_inactive_version(map);
}
+static u8 cmis_cdb_instances_get(const struct cmis_memory_map *map)
+{
+ return (map->page_01h[CMIS_CDB_ADVER_OFFSET] &
+ CMIS_CDB_ADVER_INSTANCES_MASK) >> 6;
+}
+
+static bool cmis_cdb_is_supported(const struct cmis_memory_map *map)
+{
+ __u8 cdb_instances = cmis_cdb_instances_get(map);
+
+ /* Up to two CDB instances are supported. */
+ return cdb_instances == 1 || cdb_instances == 2;
+}
+
+static void cmis_show_cdb_instances(const struct cmis_memory_map *map)
+{
+ __u8 cdb_instances = cmis_cdb_instances_get(map);
+
+ printf("\t%-41s : %u\n", "CDB instances", cdb_instances);
+}
+
+static void cmis_show_cdb_mode(const struct cmis_memory_map *map)
+{
+ __u8 mode = map->page_01h[CMIS_CDB_ADVER_OFFSET] &
+ CMIS_CDB_ADVER_MODE_MASK;
+
+ printf("\t%-41s : %s\n", "CDB background mode",
+ mode ? "Supported" : "Not supported");
+}
+
+static void cmis_show_cdb_epl_pages(const struct cmis_memory_map *map)
+{
+ __u8 epl_pages = map->page_01h[CMIS_CDB_ADVER_OFFSET] &
+ CMIS_CDB_ADVER_EPL_MASK;
+
+ printf("\t%-41s : %u\n", "CDB EPL pages", epl_pages);
+}
+
+static void cmis_show_cdb_rw_len(const struct cmis_memory_map *map)
+{
+ __u16 rw_len = map->page_01h[CMIS_CDB_ADVER_RW_LEN_OFFSET];
+
+ /* Maximum read / write length for CDB EPL pages and the LPL page in
+ * units of 8 bytes, in addition to the minimum 8 bytes.
+ */
+ rw_len = (rw_len + 1) * 8;
+ printf("\t%-41s : %u\n", "CDB Maximum EPL RW length", rw_len);
+ printf("\t%-41s : %u\n", "CDB Maximum LPL RW length",
+ rw_len > CMIS_PAGE_SIZE ? CMIS_PAGE_SIZE : rw_len);
+}
+
+static void cmis_show_cdb_trigger(const struct cmis_memory_map *map)
+{
+ __u8 trigger = map->page_01h[CMIS_CDB_ADVER_TRIGGER_OFFSET] &
+ CMIS_CDB_ADVER_TRIGGER_MASK;
+
+ /* Whether a CDB command can be triggered in a single write to the LPL
+ * page, or by multiple writes ending with the writing of the CDB
+ * Command Code (CMDID).
+ */
+ printf("\t%-41s : %s\n", "CDB trigger method",
+ trigger ? "Single write" : "Multiple writes");
+}
+
+/* Print CDB messaging support advertisement. Relevant documents:
+ * [1] CMIS Rev. 5, page 133, section 8.4.11
+ */
+static void cmis_show_cdb_adver(const struct cmis_memory_map *map)
+{
+ if (!map->page_01h || !cmis_cdb_is_supported(map))
+ return;
+
+ cmis_show_cdb_instances(map);
+ cmis_show_cdb_mode(map);
+ cmis_show_cdb_epl_pages(map);
+ cmis_show_cdb_rw_len(map);
+ cmis_show_cdb_trigger(map);
+}
+
static void cmis_show_all_common(const struct cmis_memory_map *map)
{
cmis_show_identifier(map);
@@ -945,6 +1024,7 @@ static void cmis_show_all_common(const struct cmis_memory_map *map)
cmis_show_mod_lvl_controls(map);
cmis_show_dom(map);
cmis_show_fw_version(map);
+ cmis_show_cdb_adver(map);
}
static void cmis_memory_map_init_buf(struct cmis_memory_map *map,
@@ -191,6 +191,17 @@
#define CMIS_SIG_INTEG_TX_OFFSET 0xA1
#define CMIS_SIG_INTEG_RX_OFFSET 0xA2
+/* CDB Messaging Support Advertisement */
+#define CMIS_CDB_ADVER_OFFSET 0xA3
+#define CMIS_CDB_ADVER_INSTANCES_MASK 0xC0
+#define CMIS_CDB_ADVER_MODE_MASK 0x20
+#define CMIS_CDB_ADVER_EPL_MASK 0x0F
+
+#define CMIS_CDB_ADVER_RW_LEN_OFFSET 0xA4
+
+#define CMIS_CDB_ADVER_TRIGGER_OFFSET 0xA5
+#define CMIS_CDB_ADVER_TRIGGER_MASK 0x80
+
/*-----------------------------------------------------------------------
* Upper Memory Page 0x02: Optional Page that informs about module-defined
* thresholds for module-level and lane-specific threshold crossing monitors.