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 CB96ED80144 for ; Tue, 7 May 2024 06:09:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/b8oeUGiVpJTm4Ei5oq+JSksGTO6jO4T2P9cQQ0XfFM=; 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=1715062173; v=1; b=2p8NwmUIoASVdnJiOeNIsjbtJUjCAeBj9Am3j/Ap5LG0xmbdbJCJGgNuxQGRFdB4q/FVwGwv 8Iu9pdmj+0Y75A+aVjeeeDBAceXjWuKYnr/63eV+JIBtfcNAyjjX+DHnoG2x8EfnrOdCow4wYr0 D9+KCYlAe58M2t+rTkC+Qukip4XrnFIqLzfsGe25t+7jkqTPovqhNCY+aSK/s6/arx0Q8ghpWgv eHCOm0xX60tdlL4301Zax6c3+WOwn8ZElPgchNEHxR2L2xZeDFA8iEcDhzTTztw2Zgx6ecyEjIz ujmoZB23vqOseBPEjOwUzJDAGDEvf8qJKiRcjlobr8uqg== X-Received: by 127.0.0.2 with SMTP id C5A4YY7687511x9bxvZRkEOW; Mon, 06 May 2024 23:09:33 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mx.groups.io with SMTP id smtpd.web11.5114.1715062169840197202 for ; Mon, 06 May 2024 23:09:32 -0700 X-CSE-ConnectionGUID: /bfbroHrRdmkSHCfxRYopw== X-CSE-MsgGUID: fFjdWpuaSoWhDKKKGnaeJQ== X-IronPort-AV: E=McAfee;i="6600,9927,11065"; a="28308064" X-IronPort-AV: E=Sophos;i="6.07,260,1708416000"; d="scan'208";a="28308064" X-Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 23:09:33 -0700 X-CSE-ConnectionGUID: LOapXOAvR9WcjPZz0QHIKw== X-CSE-MsgGUID: R96A1cwCQmiu1gRq12n1qA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,260,1708416000"; d="scan'208";a="32869791" X-Received: from xieyuanh-mobl.ccr.corp.intel.com ([10.124.240.43]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 23:09:31 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Liming Gao , Jiaxin Wu , Ray Ni , Yuanhao Xie Subject: [edk2-devel] [PATCH 1/3] StandaloneMmPkg: Add LockBox Dependency DXE Driver Date: Tue, 7 May 2024 14:09:08 +0800 Message-ID: <20240507060910.1687-2-yuanhao.xie@intel.com> In-Reply-To: <20240507060910.1687-1-yuanhao.xie@intel.com> References: <20240507060910.1687-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, 06 May 2024 23:09:32 -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: vX4wKwe8h3fpKC117hGAz1J1x7686176AA= 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=2p8NwmUI; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) 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 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..6445d4c569 --- /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 +#include + +/** + It attempts to install the gEfiLockBoxProtocolGuid protocol into the system's DXE database + with NULL as the protocol interface to mark the protocol as handled in the system or to + act as a trigger. + + @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..7fc7b67d21 --- /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 (#118637): https://edk2.groups.io/g/devel/message/118637 Mute This Topic: https://groups.io/mt/105955699/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-