From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 64B4CAC1440 for ; Mon, 24 Jun 2024 12:39:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nSg7qIM0YDDhYVCViTvzSH1YMzz6rAh6RoxgYZ1/JAU=; 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=1719232759; v=1; b=fOsEE4M6fTQon/7QD1wrirveXkgIKIGi1cCZM377i4d4//1HQ21H3IgEMmrJ3qxNYbn33kBq +5Tu4DnuKpvcsAsf5ZzWZ0EFL+u9yv3Ib9P0euL3I8YPqdmbxM2oSj+hkIUTWN2TVlN+/xWtMzx Yti6P4pSRBa7qkQHPODlvjMAmfHjRVKhBjrUusiC7Mt1SodX0kKGksNmfNz0Jc0c4BW6DlZ1mcO 4vMSAff+FAVgO7VrTzghVGRK8G5/1NSMxRgmA0UQHLmNaILmr5+rkhO1cFy5pUoqdLqG6hNSR9D XXV1LVg1TWiaX8oHmVLg3G/t1HbAszM6ke9tbRskx3/Fw== X-Received: by 127.0.0.2 with SMTP id ApLIYY7687511xkRHzs2myLx; Mon, 24 Jun 2024 05:39:18 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mx.groups.io with SMTP id smtpd.web11.139484.1719232757282897668 for ; Mon, 24 Jun 2024 05:39:17 -0700 X-CSE-ConnectionGUID: rAzMr5LfRaKt3JFQdVpHCg== X-CSE-MsgGUID: akH6ib4NSRy5y2D9JJuVzg== X-IronPort-AV: E=McAfee;i="6700,10204,11112"; a="33660699" X-IronPort-AV: E=Sophos;i="6.08,262,1712646000"; d="scan'208";a="33660699" X-Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2024 05:39:17 -0700 X-CSE-ConnectionGUID: epKhyzT5Q1++UaLeJ3+HKA== X-CSE-MsgGUID: hapPuZ9lRQmcWJf9GR/YeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,262,1712646000"; d="scan'208";a="43983461" X-Received: from xieyuanh-mobl.ccr.corp.intel.com ([10.125.242.201]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2024 05:39:14 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Liming Gao , Jiaxin Wu , Ray Ni , Ard Biesheuvel , Sami Mujawar , Yuanhao Xie Subject: [edk2-devel] [Patch V2 1/3] StandaloneMmPkg: Add LockBox Dependency DXE Driver Date: Mon, 24 Jun 2024 20:38:39 +0800 Message-ID: <20240624123841.534-2-yuanhao.xie@intel.com> In-Reply-To: <20240624123841.534-1-yuanhao.xie@intel.com> References: <20240624123841.534-1-yuanhao.xie@intel.com> MIME-Version: 1.0 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, 24 Jun 2024 05:39:17 -0700 Resent-From: yuanhao.xie@intel.com Reply-To: devel@edk2.groups.io,yuanhao.xie@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: XgC3qUr0V9vbnyy2mknolHEqx7686176AA= 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=fOsEE4M6; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io The LockBox Dependency DXE Driver is designed for use with standalone mm where gBS are not accessible to indicates that LockBox API is ready for use. For DXE drivers use lockbox APIs via a communication mechanism triggering an SMI, it's must to have the corresponding SMI handler pre-installed for interrupt management. To ensure orderly operations and proper notification, besides specified the guid in the [Depex] section of the .inf file. The installation of smi handler, along with the LockBox protocol marked by gEfiLockBoxProtocolGuid, must be informed to the DXE driver. This protocol installation signifies to the DXE driver that the LockBox API is ready for use. Cc: Liming Gao Cc: Jiaxin Wu Cc: Ray Ni Cc: Ard Biesheuvel Cc: Sami Mujawar Reviewed-by: Jiaxin Wu Signed-off-by: Yuanhao Xie --- StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf | 37 +++++++++++++++++++++++++++++++++++++ StandaloneMmPkg/StandaloneMmPkg.dsc | 3 ++- 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c new file mode 100644 index 0000000000..b91659055b --- /dev/null +++ b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c @@ -0,0 +1,52 @@ +/** @file + LockBox Dependency DXE Driver. + + By installing the LockBox protocol with the gEfiLockBoxProtocolGuid, + it signals that the LockBox API is fully operational and ready for use. + Drivers that intend to utilize the LockBox functionality at their entry + point should declare this dependency explicitly. + + Copyright (c) 2024, Intel Corporation. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +/** + The constructor function of SmmLockBoxMmDependency. + + It attempts to install the gEfiLockBoxProtocolGuid protocol into the system's DXE database + with NULL as notify. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the Management mode System Table. + + @retval EFI_SUCCESS The protocol was successfully installed into the DXE database. + @retval Others An error occurred while installing the protocol. +**/ +EFI_STATUS +EFIAPI +SmmLockBoxMmDependencyConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Install NULL to DXE data base as notify + // + Status = gBS->InstallProtocolInterface ( + &ImageHandle, + &gEfiLockBoxProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + ASSERT_EFI_ERROR (Status); + return Status; +} diff --git a/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf new file mode 100644 index 0000000000..e377d398ca --- /dev/null +++ b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf @@ -0,0 +1,37 @@ +## @file +# LockBox Dependency DXE Driver. +# +# By installing the LockBox protocol with the gEfiLockBoxProtocolGuid, +# it signals that the LockBox API is fully operational and ready for use. +# Drivers that intend to utilize the LockBox functionality at their entry +# point should declare this dependency explicitly. +# +# Copyright (c) 2024, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = SmmLockBoxMmDependency + FILE_GUID = c45ce910-7f8b-4f49-88e2-2c26c5743ee2 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NULL + CONSTRUCTOR = SmmLockBoxMmDependencyConstructor + +[Sources] + SmmLockBoxMmDependency.c + +[Packages] + MdePkg/MdePkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec + MdeModulePkg/MdeModulePkg.dec + +[Protocols] + gEfiLockBoxProtocolGuid + +[LibraryClasses] + BaseLib + UefiBootServicesTableLib diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc index 8012f93b7d..8a4f9a20ec 100644 --- a/StandaloneMmPkg/StandaloneMmPkg.dsc +++ b/StandaloneMmPkg/StandaloneMmPkg.dsc @@ -1,7 +1,7 @@ ## @file # Standalone MM Platform. # -# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
# Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
# Copyright (C) Microsoft Corporation
# @@ -117,6 +117,7 @@ StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf + StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf [Components.AARCH64, Components.ARM] StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf -- 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119687): https://edk2.groups.io/g/devel/message/119687 Mute This Topic: https://groups.io/mt/106848512/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-