This file provide the CPU MMU configure and initialize interface, it
will consumes by CpuMmuLib to configure or initialize the MMU.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584

Cc: Ray Ni <ray...@intel.com>
Cc: Rahul Kumar <rahul1.ku...@intel.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Leif Lindholm <quic_llind...@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Sami Mujawar <sami.muja...@arm.com>
Cc: Sunil V L <suni...@ventanamicro.com>
Cc: Andrei Warkentin <andrei.warken...@intel.com>
Signed-off-by: Chao Li <lic...@loongson.cn>
---
 UefiCpuPkg/Include/Library/CpuMmuInitLib.h | 34 ++++++++++++++++++++++
 UefiCpuPkg/UefiCpuPkg.dec                  |  3 ++
 2 files changed, 37 insertions(+)
 create mode 100644 UefiCpuPkg/Include/Library/CpuMmuInitLib.h

diff --git a/UefiCpuPkg/Include/Library/CpuMmuInitLib.h 
b/UefiCpuPkg/Include/Library/CpuMmuInitLib.h
new file mode 100644
index 0000000000..848050d056
--- /dev/null
+++ b/UefiCpuPkg/Include/Library/CpuMmuInitLib.h
@@ -0,0 +1,34 @@
+/** @file
+
+  Copyright (c) 2024 Loongson Technology Corporation Limited. All rights 
reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef CPU_MMU_INIT_LIB_H_
+#define CPU_MMU_INIT_LIB_H_
+
+#include <Uefi/UefiBaseType.h>
+#include <Uefi/UefiSpec.h>
+
+/**
+  Create a page table and initialize the memory management unit(MMU).
+
+  @param[in]   MemoryTable           A pointer to a memory ragion table.
+  @param[out]  TranslationTableBase  A pointer to a translation table base 
address.
+  @param[out]  TranslationTableSize  A pointer to a translation table base 
size.
+
+  @retval  EFI_SUCCESS                Configure MMU successfully.
+           EFI_INVALID_PARAMETER      MemoryTable is NULL.
+           EFI_UNSUPPORTED            Out of memory space or size not aligned.
+**/
+EFI_STATUS
+EFIAPI
+ConfigureMemoryManagementUnit (
+  IN  EFI_MEMORY_DESCRIPTOR  *MemoryTable,
+  OUT VOID                   **TranslationTableBase OPTIONAL,
+  OUT UINTN                  *TranslationTableSize  OPTIONAL
+  );
+
+#endif // CPU_MMU_INIT_LIB_H_
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index b27cf88aee..ff5ef5bb00 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -77,6 +77,9 @@ [LibraryClasses.LoongArch64]
   ##  @libraryclass  Provides functions for the memory management unit.
   CpuMmuLib|Include/Library/CpuMmuLib.h
 
+  ##  @libraryclass  Provides functions for Initialize the memory management 
unit.
+  CpuMmuInitLib|Include/Library/CpuMmuInitLib.h
+
 [Guids]
   gUefiCpuPkgTokenSpaceGuid      = { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa, 0xb8, 
0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}
   gMsegSmramGuid                 = { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1, 0x30, 
0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}
-- 
2.27.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116594): https://edk2.groups.io/g/devel/message/116594
Mute This Topic: https://groups.io/mt/104859882/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to