Blame SOURCES/0029-cmis-Initialize-Page-02h-in-memory-map.patch

2a1b01
From 86853162d53b47cd0f6bcb926810aa0fd68b8898 Mon Sep 17 00:00:00 2001
2a1b01
From: Ido Schimmel <idosch@nvidia.com>
2a1b01
Date: Tue, 23 Nov 2021 19:40:57 +0200
2a1b01
Subject: [PATCH 29/35] cmis: Initialize Page 02h in memory map
2a1b01
2a1b01
Page 02h stores module and lane thresholds that are going to be parsed
2a1b01
and displayed in subsequent patches.
2a1b01
2a1b01
Request it via the 'MODULE_EEPROM_GET' netlink message and initialize it
2a1b01
in the memory map.
2a1b01
2a1b01
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
2a1b01
---
2a1b01
 cmis.c | 13 ++++++++++---
2a1b01
 1 file changed, 10 insertions(+), 3 deletions(-)
2a1b01
2a1b01
diff --git a/cmis.c b/cmis.c
2a1b01
index 4798fd4c7d68..55b9d1b959cd 100644
2a1b01
--- a/cmis.c
2a1b01
+++ b/cmis.c
2a1b01
@@ -17,9 +17,10 @@
2a1b01
 
2a1b01
 struct cmis_memory_map {
2a1b01
 	const __u8 *lower_memory;
2a1b01
-	const __u8 *upper_memory[1][2];	/* Bank, Page */
2a1b01
+	const __u8 *upper_memory[1][3];	/* Bank, Page */
2a1b01
 #define page_00h upper_memory[0x0][0x0]
2a1b01
 #define page_01h upper_memory[0x0][0x1]
2a1b01
+#define page_02h upper_memory[0x0][0x2]
2a1b01
 };
2a1b01
 
2a1b01
 #define CMIS_PAGE_SIZE		0x80
2a1b01
@@ -423,8 +424,8 @@ cmis_memory_map_init_pages(struct cmd_context *ctx,
2a1b01
 		return ret;
2a1b01
 	map->page_00h = request.data - CMIS_PAGE_SIZE;
2a1b01
 
2a1b01
-	/* Page 01h is only present when the module memory model is paged and
2a1b01
-	 * not flat.
2a1b01
+	/* Pages 01h and 02h are only present when the module memory model is
2a1b01
+	 * paged and not flat.
2a1b01
 	 */
2a1b01
 	if (map->lower_memory[CMIS_MEMORY_MODEL_OFFSET] &
2a1b01
 	    CMIS_MEMORY_MODEL_MASK)
2a1b01
@@ -436,6 +437,12 @@ cmis_memory_map_init_pages(struct cmd_context *ctx,
2a1b01
 		return ret;
2a1b01
 	map->page_01h = request.data - CMIS_PAGE_SIZE;
2a1b01
 
2a1b01
+	cmis_request_init(&request, 0, 0x2, CMIS_PAGE_SIZE);
2a1b01
+	ret = nl_get_eeprom_page(ctx, &request);
2a1b01
+	if (ret < 0)
2a1b01
+		return ret;
2a1b01
+	map->page_02h = request.data - CMIS_PAGE_SIZE;
2a1b01
+
2a1b01
 	return 0;
2a1b01
 }
2a1b01
 
2a1b01
-- 
2a1b01
2.35.1
2a1b01