From: YiPeng Chai <[email protected]>

Add interface to get ras eeprom table version.

Signed-off-by: YiPeng Chai <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/ras/core/core.c   |  6 ++++++
 drivers/gpu/drm/amd/ras/core/eeprom.c | 10 ++++++++++
 drivers/gpu/drm/amd/ras/core/eeprom.h |  3 +++
 drivers/gpu/drm/amd/ras/core/ras.h    |  2 ++
 4 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/ras/core/core.c 
b/drivers/gpu/drm/amd/ras/core/core.c
index 0e19cf41bc26f..3a56abce59dbb 100644
--- a/drivers/gpu/drm/amd/ras/core/core.c
+++ b/drivers/gpu/drm/amd/ras/core/core.c
@@ -714,3 +714,9 @@ int ras_core_check_address_sanity(struct ras_core_context 
*ras_core,
 
        return 0;
 }
+
+int ras_core_get_eeprom_version(struct ras_core_context *ras_core,
+       uint32_t *version)
+{
+       return ras_eeprom_get_version(ras_core, version);
+}
diff --git a/drivers/gpu/drm/amd/ras/core/eeprom.c 
b/drivers/gpu/drm/amd/ras/core/eeprom.c
index 7afaac81f37a1..1bc409048e732 100644
--- a/drivers/gpu/drm/amd/ras/core/eeprom.c
+++ b/drivers/gpu/drm/amd/ras/core/eeprom.c
@@ -1368,3 +1368,13 @@ enum ras_gpu_health_status
 
        return rai->rma_status;
 }
+
+int ras_eeprom_get_version(struct ras_core_context *ras_core, uint32_t 
*version)
+{
+       if (!ras_core || !version)
+               return -EINVAL;
+
+       *version = ras_core->ras_eeprom.tbl_hdr.version;
+
+       return 0;
+}
diff --git a/drivers/gpu/drm/amd/ras/core/eeprom.h 
b/drivers/gpu/drm/amd/ras/core/eeprom.h
index 32bd1526bc55b..c46ce23ea6ee6 100644
--- a/drivers/gpu/drm/amd/ras/core/eeprom.h
+++ b/drivers/gpu/drm/amd/ras/core/eeprom.h
@@ -187,4 +187,7 @@ void ras_eeprom_sync_info(struct ras_core_context 
*ras_core);
 int ras_eeprom_check_storage_status(struct ras_core_context *ras_core);
 enum ras_gpu_health_status
        ras_eeprom_check_gpu_status(struct ras_core_context *ras_core);
+
+int ras_eeprom_get_version(struct ras_core_context *ras_core,
+       uint32_t *version);
 #endif
diff --git a/drivers/gpu/drm/amd/ras/core/ras.h 
b/drivers/gpu/drm/amd/ras/core/ras.h
index ee1b19948830b..43e028189087b 100644
--- a/drivers/gpu/drm/amd/ras/core/ras.h
+++ b/drivers/gpu/drm/amd/ras/core/ras.h
@@ -409,4 +409,6 @@ int ras_core_check_address_sanity(struct ras_core_context 
*ras_core, uint64_t ad
 
 int ras_core_set_debug_mode(struct ras_core_context *ras_core, bool enable);
 bool ras_core_is_ce_log_disabled(struct ras_core_context *ras_core);
+int ras_core_get_eeprom_version(struct ras_core_context *ras_core,
+       uint32_t *version);
 #endif
-- 
2.55.0

Reply via email to