From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail03.groups.io (mail03.groups.io [45.79.227.220]) by spool.mail.gandi.net (Postfix) with ESMTPS id A42BDAC0D7A for ; Fri, 12 Apr 2024 07:34:30 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=eJpUS6Zh6yWcv0JW2BI9JqflVs7T0BfVXTrJdU2KQOc=; 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=1712907269; v=1; b=x4IxdFMG/FMLZA9+NHpZ7jLjGHFxBaZ+mH/qFpzhs3AsbJME8D8ktnDLC51fpf8wOttpM3Yd 6pZIDj+G77JCpL3W+R1k3H5mUBC3n7whK240b6+rkp+j4PhqtYXPaxOKgmhVPxMi8LmpFiB7N7T h18D20JBadcshAe+DF1bzaD6KTTmC4Ddn1HDU17E8x+ryrtxXYnJKsSCvnfO4meYM47k++SqeNq Wa52kMWFZ3ior7KabJnghinfBJDGUkzhDnfKBl3V16CIxMwpNneUU21ZYsoFCUhvh2Je5bgOio6 pAGqbV2yXO50A07yG8sKS+Nbqy4PIeHLR8YBtJImMhMMw== X-Received: by 127.0.0.2 with SMTP id pbYlYY7687511x2mBwMCNhDn; Fri, 12 Apr 2024 00:34:29 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.41424.1712907267992391498 for ; Fri, 12 Apr 2024 00:34:28 -0700 X-Received: from loongson.cn (unknown [10.2.9.245]) by gateway (Coremail) with SMTP id _____8CxprkB5BhmHkcmAA--.6320S3; Fri, 12 Apr 2024 15:34:25 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxmhIB5BhmgpB4AA--.24724S2; Fri, 12 Apr 2024 15:34:25 +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 v3 07/13] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Date: Fri, 12 Apr 2024 15:34:24 +0800 Message-Id: <20240412073424.3487475-1-lichao@loongson.cn> In-Reply-To: <20240412073254.3486364-1-lichao@loongson.cn> References: <20240412073254.3486364-1-lichao@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxmhIB5BhmgpB4AA--.24724S2 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAFCGYXn2oMjAAKsC 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: Fri, 12 Apr 2024 00:34:28 -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: 0COtMLZYdHOIvptRoHOIM1hOx7686176AA= 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=x4IxdFMG; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.227.220 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 --- 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 (#117654): https://edk2.groups.io/g/devel/message/117654 Mute This Topic: https://groups.io/mt/105478496/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-