From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.92.22.50]) by mx.groups.io with SMTP id smtpd.web09.1449.1612920315066407278 for ; Tue, 09 Feb 2021 17:25:15 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=Ze8O3mO7; spf=pass (domain: outlook.com, ip: 40.92.22.50, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xk6uKJQmbleLWvYRVbxAvoQd6L7tUYIeiXI55s9eWMhUgNcjZL94ltrUAaoM2rxsO6o6a01q8D91ZTxAxrGH8ptGY66XnZNaRQchihyOSuTIBhBp3CVQeK6rulDJ0MLMAvlOCwFz7qi+c7/yAJhjwG+qJ46l6y1qvQIPvvjrLNEioHv8ik4pmkul+xnnZYkoPhRgXUFmaVDeOrCutIj2d7b4+bl3AyVq3MStnpNNtWu5ShuV1NlUiSKTh6mqFTQryPOXqLW6s1RAbhQJVqw+B/VEdZgQ3RvTebeyg75AxqXqgIJ3g2X5U1hPIY+IUJ8qXZ986+hghS4pQv4V9XfVqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bRzxfAyGi8L75dUobQQRxjKTvBApyJdPUB7sr5uQ9wQ=; b=O/S77zg8EXhyNh0/fcMFD18E9qZCbNe3QGKKRZsW/V1QOr/aGdC0Fvm9Dy9000mEqTZrkYS5rz+UIuye8aY7+45n9VPVCcz56xqgjrSmHh29OdUWqO8mHU0lY+rdM0p/Snyc3kg7MEP3VkJ/ww66kq3cOqC206jUauP7Q99cMhDSuTzxUlQe3y4c6nQ2MNIbGNCisjYkCKHo+SZU2bpvgxIYkjNo0r3UHUqmf2ZrZpAZdVHzL74lJxPQPH3R9gz3j26poVnGz9rXtncAHlf/dVS19wiTnjp8pz/L7795b/ycDz/GXC2/BiyTmuq9DzflQrUxHswh0WNVWWTTYeABUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bRzxfAyGi8L75dUobQQRxjKTvBApyJdPUB7sr5uQ9wQ=; b=Ze8O3mO7GPBNZ90BhkcGWcQn385M1kjHDRxtc8RKFEb9bKIS2fnCJbOPihLpYBYz98BwLBcU/eBrjTfjj8vjXYFrzYMYRkj0sh8I7TpFFkculuP86DUh0H8xYV98PjO7OBgoJoPAyh5Rsow0ooybcCINesomS7GiQy1ZfXK6IfS7KxME2OdgzosR2ZzhBQ7xENzzw/tCxO+pfgROGoA71mlvSO0pI75Yd02+OSYKiyzgqXq8UXU3CKryVuPfOWoqvOhcu+aS1BiGFeBT8tV4XOa+71XnyCNXPeBfrFPl+3jgtmr7l1MccTalTzuxS+5r3a289itluzJHfQqJ0uNAyw== Received: from MW2NAM12FT030.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::43) by MW2NAM12HT110.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.11; Wed, 10 Feb 2021 01:25:13 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:fc65::4b) by MW2NAM12FT030.mail.protection.outlook.com (2a01:111:e400:fc65::278) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Wed, 10 Feb 2021 01:25:13 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:3AADF1F912188A44C94A9CD13DED061943AC2B2200780856DFA6F557B143CE25;UpperCasedChecksum:659516AADBFE93177F5E5836D1C449DC64FFAFE9714E02D59706F1DFB9D53806;SizeAsReceived:7538;Count:47 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b%7]) with mapi id 15.20.3825.024; Wed, 10 Feb 2021 01:25:13 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Jian J Wang , Hao A Wu , Eric Dong , Ray Ni , Jiewen Yao Subject: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Date: Tue, 9 Feb 2021 17:24:52 -0800 Message-ID: X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20210210012457.315-1-kun.q@outlook.com> References: <20210210012457.315-1-kun.q@outlook.com> X-TMN: [XnKOo25vVkS7S2lO2TzHPrJa9eVuRGbO] X-ClientProxiedBy: MW4PR04CA0051.namprd04.prod.outlook.com (2603:10b6:303:6a::26) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20210210012457.315-2-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by MW4PR04CA0051.namprd04.prod.outlook.com (2603:10b6:303:6a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20 via Frontend Transport; Wed, 10 Feb 2021 01:25:13 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 030f517a-a0f7-4261-fcfd-08d8cd62b6f1 X-MS-TrafficTypeDiagnostic: MW2NAM12HT110: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b+4pfizTmVVClIxd95hEnGdWvhbhoquG5WrZwlvouwCsWP85XltBgwtltj5RVgyuY1fqGf8SYOoN0ij9FFfYlvd/e+onl1BwTA+3C4g8JDYHaJeK7xLk2SS79xSEbQStHvLIB8WswbdDKTvbsjEO0QjQF+hoG48xWefBOkIbhlVtgV3lBNzSjbseq7/lqaorJlAxLLMgRiy+n6UWfHoiYttbtfhulGB6LXtxsW7TsKWItDS4AaSsSo0lb2zUVgUbzHd4Jy09lw3QeaBNGUa8RH3xEw/31ks57BQ2OP/ogG1d5hiGha/KwtMqyfu6BueD9I6dXAa9+Uhk+SJupX0k7pE8BB9OA1xyWSZpqa4RYr6i8Kg6at16rgsUNITUoJL4wTZh+qciuU0TsWLd1go0A3byXmSHBARpsZrxeMZJNOaB9vR9kMxlFYaU/FgPiz4u X-MS-Exchange-AntiSpam-MessageData: BF9UyBtfvZVMilUqvc3nnfGc6ewZ1hoBTODAIuI4ZAdaLXSPZE/6nDaIAbHPe4WX4P6oHJe2X5WJx4bGYC+GZG78TwKtzGnv/bBrddpRApcpPKGXqEEP8V3LgmXqgNvnKVxnjsE60mCd9idPnYJUtw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 030f517a-a0f7-4261-fcfd-08d8cd62b6f1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2021 01:25:13.6419 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT030.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM12HT110 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3168 This interface definition provides an abstraction layer for DXE drivers to request certain memory blocks to be mapped/unblocked for accessibility inside MM environment. Cc: Jian J Wang Cc: Hao A Wu Cc: Eric Dong Cc: Ray Ni Cc: Jiewen Yao Signed-off-by: Kun Qin --- Notes: v2: - Resend with practical usage. No change [Hao] MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.c |= 40 ++++++++++++++++++++ MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h |= 40 ++++++++++++++++++++ MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf |= 29 ++++++++++++++ MdeModulePkg/MdeModulePkg.dec |= 5 +++ MdeModulePkg/MdeModulePkg.dsc |= 2 + 5 files changed, 116 insertions(+) diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLib= Null.c new file mode 100644 index 000000000000..774a7e41cfb0 --- /dev/null +++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.= c @@ -0,0 +1,40 @@ +/** @file + Null instance of MM Unblock Page Library. + + This library provides an abstraction layer of requesting certain page ac= cess to be unblocked + by MM environment if applicable. + + Copyright (c), Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + This API provides a way to unblock certain data pages to be accessible i= nside MM environment. + + @param UnblockAddress The address of buffer caller requests to= unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unbl= ocked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not produ= ced yet. + @return EFI_UNSUPPORTED The requested functionality is not suppo= rted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass sec= urity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or not= page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system ha= s passed certain boot + phase. + +**/ +EFI_STATUS +EFIAPI +DxeMmUnblockMemoryRequest ( + IN EFI_PHYSICAL_ADDRESS UnblockAddress, + IN UINT64 NumberOfPages + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h b/MdeModu= lePkg/Include/Library/DxeMmUnblockMemoryLib.h new file mode 100644 index 000000000000..8b63eb74a078 --- /dev/null +++ b/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h @@ -0,0 +1,40 @@ +/** @file + MM Unblock Memory Library Interface. + + This library provides an abstraction layer of requesting certain page ac= cess to be unblocked + by MM environment if applicable. + + Copyright (c), Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _DXE_MM_UNBLOCK_MEMORY_LIB_H_ +#define _DXE_MM_UNBLOCK_MEMORY_LIB_H_ + +/** + This API provides a way to unblock certain data pages to be accessible i= nside MM environment. + + @param UnblockAddress The address of buffer caller requests to= unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unbl= ocked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not produ= ced yet. + @return EFI_UNSUPPORTED The requested functionality is not suppo= rted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass sec= urity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or not= page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system ha= s passed certain boot + phase. + +**/ +EFI_STATUS +EFIAPI +DxeMmUnblockMemoryRequest ( + IN EFI_PHYSICAL_ADDRESS UnblockAddress, + IN UINT64 NumberOfPages +); + +#endif // _DXE_MM_UNBLOCK_MEMORY_LIB_H_ diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.inf new file mode 100644 index 000000000000..e40462e5ab81 --- /dev/null +++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.= inf @@ -0,0 +1,29 @@ +## @file +# Null instance of MM Unblock Page Library. +# +# This library provides an abstraction layer of requesting certain page a= ccess to be unblocked +# by MM environment if applicable. +# +# Copyright (c), Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DxeMmUnblockMemoryLibNull + FILE_GUID =3D 9E890F68-5C95-4C31-95DD-59E6286F85EA + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DxeMmUnblockMemoryLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + DxeMmUnblockMemoryLibNull.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 148395511034..1bb5017da2c5 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -154,6 +154,11 @@ [LibraryClasses] # VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h =20 + ## @libraryclass This library provides an interface for DXE drivers to= request MM environment + # to map/unblock a memory region for accessibility inside MM. + # + DxeMmUnblockMemoryLib|Include/Library/DxeMmUnblockMemoryLib.h + [Guids] ## MdeModule package token space guid # Include/Guid/MdeModulePkgTokenSpace.h diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 7ca4a1bb3080..2bc6b8730b8b 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -100,6 +100,7 @@ [LibraryClasses] SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGr= aphics/DisplayUpdateProgressLibGraphics.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUn= blockMemoryLibNull.inf =20 [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf @@ -332,6 +333,7 @@ [Components] MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgr= essLibGraphics.inf MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressL= ibText.inf + MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf =20 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf --=20 2.30.0.windows.1