[edk2-devel] [PATCH v4 1/7] MdePkg/BaseLib: RISC-V: Support getting satp register value

Tuan Phan tphan at ventanamicro.com
Fri Jun 23 18:39:28 UTC 2023


Add an API to retrieve satp register value.

Signed-off-by: Tuan Phan <tphan at ventanamicro.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin at intel.com>
Reviewed-by: Sunil V L <sunilvl at ventanamicro.com>
---
 MdePkg/Include/Library/BaseLib.h          | 5 +++++
 MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 8f2df76c29a3..5d7067ee854e 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -181,6 +181,11 @@ RiscVSetSupervisorAddressTranslationRegister (
   IN UINT64
   );
 
+UINT64
+RiscVGetSupervisorAddressTranslationRegister (
+  VOID
+  );
+
 UINT64
 RiscVReadTimer (
   VOID
diff --git a/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S b/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S
index ac8f92f38aed..c9cf60c1664b 100644
--- a/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S
+++ b/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S
@@ -21,3 +21,11 @@
 ASM_FUNC (RiscVSetSupervisorAddressTranslationRegister)
     csrw  CSR_SATP, a0
     ret
+
+//
+// Get the value of Supervisor Address Translation and
+// Protection Register.
+//
+ASM_FUNC (RiscVGetSupervisorAddressTranslationRegister)
+    csrr  a0, CSR_SATP
+    ret
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106303): https://edk2.groups.io/g/devel/message/106303
Mute This Topic: https://groups.io/mt/99724469/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list