From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1A67BD807AB for ; Wed, 20 Mar 2024 08:43:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QrZYNOYGp1kgEcZwbYRFKcfeAZb8S3KsoxfRbsJGHYc=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1710924222; v=1; b=FftGncLlgJqt0QHljWlY93SX9vGSePoPy/pdZV9HOT1KubxJ4gAnjL1IvOXD6bNII5iOuePh c07Pg04LkJ7BHK88VfN53drKdTvdefE07KivuBU+ZlEaW4D0XTqERU6Eswqdbj308rxaUOLcqkL CbN6SI0jNrZT7nlMKsNuqim89nB1DLzlJ552QQ9VN5eRMdqCpMoNBKJVHSlWB3+hcgjV2cFutne wO4CfuFWP2xy6tFW/1GcGr0r+jTwl2k4EjEU8hALDit0Y33s7vRzGcQKZqNNaoZbrbXwAbM4gWZ GPd72OxaN5VaH/zW8Tgj/pDtOjStFmOB4uEhZgZFyO+wg== X-Received: by 127.0.0.2 with SMTP id 0869YY7687511xs1gLJ09kZY; Wed, 20 Mar 2024 01:43:42 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.38929.1710924221776127138 for ; Wed, 20 Mar 2024 01:43:42 -0700 X-Received: from loongson.cn (unknown [10.2.9.245]) by gateway (Coremail) with SMTP id _____8Dxfeu8ofplPi0bAA--.64745S3; Wed, 20 Mar 2024 16:43:40 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx8OS7ofplL0BeAA--.51780S2; Wed, 20 Mar 2024 16:43:39 +0800 (CST) From: "Chao Li" To: devel@edk2.groups.io Cc: Ray Ni , Rahul Kumar , Gerd Hoffmann , Leif Lindholm , Ard Biesheuvel , Sami Mujawar , Sunil V L , Andrei Warkentin Subject: [edk2-devel] [PATCH v2 10/13] UefiCpuPkg: Add CpuMmuInitLib.h to UefiCpuPkg Date: Wed, 20 Mar 2024 16:43:38 +0800 Message-Id: <20240320084338.279571-1-lichao@loongson.cn> In-Reply-To: <20240320084152.268323-1-lichao@loongson.cn> References: <20240320084152.268323-1-lichao@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx8OS7ofplL0BeAA--.51780S2 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQACCGX5TOgKgAAXsu X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 20 Mar 2024 01:43:42 -0700 Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: k4wB3h5te9JiirS93oEoS4Mux7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=FftGncLl; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none 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=4734 Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Sunil V L Cc: Andrei Warkentin Signed-off-by: Chao Li --- 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.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CPU_MMU_INIT_LIB_H_ +#define CPU_MMU_INIT_LIB_H_ + +#include +#include + +/** + 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 a23a90ec99..72613d85d7 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 (#116925): https://edk2.groups.io/g/devel/message/116925 Mute This Topic: https://groups.io/mt/105041097/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-