From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id C31A7941043 for ; Tue, 16 Apr 2024 02:44:22 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=pr5uMqg9+Nr830uivTr5n4P5rTHvXdZ6JPofdTPZHvM=; 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:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1713235461; v=1; b=o4xWvO1YW9oGxMq04JkH3Bk5hm3urPWKq4nodQT1/pvBdEGTLaMVvEnOLyZ026sVs8LpePhP 6jh1iTcl+g43wJQ4HAeHCrxaHquRWfOPjlfRJsQriZOCK5B0dvk3LDeU8rHC/OrQUHFDygUG6w6 B4CTePzkOG8E712uDpZO8l7+ccamL4m1kujvigbFf2nxOpgHveT2iPqE2Zuh5XCZVEMZieOHVY9 DwFnk6P+IgL9dMaj3C3+NWtK2bVoCfcyPy14tUAs58p/z8Wn4Vkdb8S+GqMKVsPO+3Tu81aTpuN Zi8UkIeD5jJA+ocqp3aZUzJyO4AB+tvvdTJkFy8cPUAqw== X-Received: by 127.0.0.2 with SMTP id FP3DYY7687511xe0BiUJzWoG; Mon, 15 Apr 2024 19:44:21 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.10929.1713235460165354147 for ; Mon, 15 Apr 2024 19:44:20 -0700 X-Received: from loongson.cn (unknown [10.2.9.245]) by gateway (Coremail) with SMTP id _____8AxSboC5h1m_xMoAA--.9830S3; Tue, 16 Apr 2024 10:44:18 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxxxEA5h1mfl58AA--.30265S2; Tue, 16 Apr 2024 10:44:16 +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 v4 07/13] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Date: Tue, 16 Apr 2024 10:44:15 +0800 Message-Id: <20240416024415.3174307-1-lichao@loongson.cn> In-Reply-To: <20240416024251.3173738-1-lichao@loongson.cn> References: <20240416024251.3173738-1-lichao@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxxxEA5h1mfl58AA--.30265S2 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAJCGYc5WsGFwASs3 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: Mon, 15 Apr 2024 19:44:20 -0700 Resent-From: lichao@loongson.cn Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JAEOSJBpSMr2IdFvywbwAKrMx7686176AA= 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=o4xWvO1Y; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.9 as permitted sender) smtp.mailfrom=bounce@groups.io Add a new header file CpuMmuLib.h, whitch is referenced from ArmPkg/Include/Library/ArmMmuLib.h. Currently, only support for LoongArch64 is added, and more architectures can be accommodated in the future. 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 Acked-by: Gerd Hoffmann Reviewed-by: Ray Ni --- UefiCpuPkg/Include/Library/CpuMmuLib.h | 41 ++++++++++++++++++++++++++ UefiCpuPkg/UefiCpuPkg.dec | 4 +++ 2 files changed, 45 insertions(+) create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h diff --git a/UefiCpuPkg/Include/Library/CpuMmuLib.h b/UefiCpuPkg/Include/Library/CpuMmuLib.h new file mode 100644 index 0000000000..e6cfbd5168 --- /dev/null +++ b/UefiCpuPkg/Include/Library/CpuMmuLib.h @@ -0,0 +1,41 @@ +/** @file + + Copyright (c) 2024 Loongson Technology Corporation Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CPU_MMU_LIB_H_ +#define CPU_MMU_LIB_H_ + +#include + +/** + Maps the memory region in the page table to the specified attributes. + + @param[in, out] PageTable The pointer to the page table to update, or pointer to NULL + if a new page table is to be created. + @param[in] PageWalkCfg The page walk controller configure. + @param[in] BaseAddress The base address of the memory region to set the Attributes. + @param[in] Length The length of the memory region to set the Attributes. + @param[in] Attributes The bitmask of attributes to set, which refer to UEFI SPEC + 7.2.3(EFI_BOOT_SERVICES.GetMemoryMap()). + @param[in] AttributeMask Mask of memory attributes to take into account. + + @retval EFI_SUCCESS The Attributes was set successfully or Length is 0. + @retval EFI_INVALID_PARAMETER PageTable is NULL. + @retval EFI_UNSUPPORTED *PageTable is NULL. +**/ +EFI_STATUS +EFIAPI +MemoryRegionMap ( + IN OUT UINTN *PageTable OPTIONAL, + IN UINT64 PageWalkCfg, + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT64 Attributes, + IN UINT64 AttributeMask + ); + +#endif // CPU_MMU_LIB_H_ diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 571b59b36f..ca744fab55 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -72,6 +72,10 @@ [LibraryClasses.RISCV64] ## RiscVMmuLib|Include/Library/BaseRiscVMmuLib.h +[LibraryClasses.LoongArch64] + ## @libraryclass Provides functions for the memory management unit. + CpuMmuLib|Include/Library/CpuMmuLib.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 (#117831): https://edk2.groups.io/g/devel/message/117831 Mute This Topic: https://groups.io/mt/105550157/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-