From nobody Wed May 8 22:13:35 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489673107645557.1567508995923; Thu, 16 Mar 2017 07:05:07 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 96EA780404; Thu, 16 Mar 2017 07:05:00 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 45FE880402 for ; Thu, 16 Mar 2017 07:04:59 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 16 Mar 2017 07:04:59 -0700 Received: from wduan1-mobl.ccr.corp.intel.com (HELO jyao1-MOBL.ccr.corp.intel.com) ([10.254.215.154]) by fmsmga002.fm.intel.com with ESMTP; 16 Mar 2017 07:04:57 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,172,1486454400"; d="scan'208";a="1143304317" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Thu, 16 Mar 2017 22:04:42 +0800 Message-Id: <1489673083-10856-2-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1489673083-10856-1-git-send-email-jiewen.yao@intel.com> References: <1489673083-10856-1-git-send-email-jiewen.yao@intel.com> Subject: [edk2] [PATCH 1/2] QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Kelly Steele Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c = | 41 +++++++++++++++++++- QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher= .inf | 3 +- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCS= mmCore.c b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmm= Core.c index c2f75f8..0a8239c 100644 --- a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c +++ b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c @@ -2,7 +2,7 @@ This driver is responsible for the registration of child drivers and the abstraction of the QNC SMI sources. =20 -Copyright (c) 2013-2016 Intel Corporation. +Copyright (c) 2013-2017 Intel Corporation. =20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License @@ -23,6 +23,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. #include "QNCSmm.h" #include "QNCSmmHelpers.h" =20 +#include + // // ///////////////////////////////////////////////////////////////////////= ////// // MODULE / GLOBAL DATA @@ -331,6 +333,7 @@ Returns: DATABASE_RECORD *Record; QNC_SMM_QUALIFIED_PROTOCOL *Qualified; INTN Index; + UINTN ContextSize; =20 // // Check for invalid parameter @@ -363,6 +366,7 @@ Returns: // Perform linked list housekeeping // Record->Signature =3D DATABASE_RECORD_SIGNATURE; + ContextSize =3D 0; =20 switch (Qualified->Type) { // @@ -383,6 +387,7 @@ Returns: =20 InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link); CopyMem (&Record->SrcDesc, &SX_SOURCE_DESC, sizeof (Record->SrcDesc)); + ContextSize =3D sizeof(Record->ChildContext.Sx); // // use default clear source function // @@ -425,6 +430,7 @@ Returns: InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link); CopyMem (&Record->SrcDesc, &SW_SOURCE_DESC, sizeof (Record->SrcDesc)); Record->BufferSize =3D sizeof (EFI_SMM_SW_REGISTER_CONTEXT); + ContextSize =3D sizeof(Record->ChildContext.Sw); // // use default clear source function // @@ -434,6 +440,7 @@ Returns: =20 InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link); CopyMem (&Record->SrcDesc, &GPI_SOURCE_DESC, sizeof (Record->SrcDesc)); + ContextSize =3D sizeof(Record->ChildContext.Gpi); // // use default clear source function // @@ -450,6 +457,7 @@ Returns: InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link); CopyMem (&Record->SrcDesc, &QNCN_SOURCE_DESCS[Record->ChildContext.QNC= n.Type], sizeof (Record->SrcDesc)); Record->ClearSource =3D QNCSmmQNCnClearSource; + ContextSize =3D sizeof(Record->ChildContext.QNCn); break; =20 case PeriodicTimerType: @@ -462,6 +470,7 @@ Returns: InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link); Record->BufferSize =3D sizeof (EFI_SMM_PERIODIC_TIMER_CONTEXT); Record->ClearSource =3D QNCSmmPeriodicTimerClearSource; + ContextSize =3D sizeof(Record->ChildContext.PeriodicTimer); break; =20 default: @@ -488,6 +497,8 @@ Returns: // *DispatchHandle =3D (EFI_HANDLE) (&Record->Link); =20 + SmiHandlerProfileRegisterHandler (Qualified->Guid, DispatchFunction, (UI= NTN)RETURN_ADDRESS (0), RegisterContext, ContextSize); + return EFI_SUCCESS; =20 Error: @@ -522,6 +533,8 @@ Returns: DATABASE_RECORD *RecordToDelete; DATABASE_RECORD *RecordInDb; LIST_ENTRY *LinkInDb; + QNC_SMM_QUALIFIED_PROTOCOL *Qualified; + UINTN ContextSize; =20 if (DispatchHandle =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -552,7 +565,31 @@ Returns: } if (SafeToDisable) { QNCSmmDisableSource( &RecordToDelete->SrcDesc ); -} + } + + Qualified =3D QUALIFIED_PROTOCOL_FROM_GENERIC (This); + switch (Qualified->Type) { + case SxType: + ContextSize =3D sizeof(RecordToDelete->ChildContext.Sx); + break; + case SwType: + ContextSize =3D sizeof(RecordToDelete->ChildContext.Sw); + break; + case GpiType: + ContextSize =3D sizeof(RecordToDelete->ChildContext.Gpi); + break; + case QNCnType: + ContextSize =3D sizeof(RecordToDelete->ChildContext.QNCn); + break; + case PeriodicTimerType: + ContextSize =3D sizeof(RecordToDelete->ChildContext.PeriodicTimer); + break; + default: + ASSERT(FALSE); + ContextSize =3D 0; + break; + } + SmiHandlerProfileUnregisterHandler (Qualified->Guid, RecordToDelete->Cal= lback, RecordToDelete->CallbackContext, ContextSize); =20 FreePool (RecordToDelete); =20 diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCS= mmDispatcher.inf b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatche= r/QNCSmmDispatcher.inf index ed94825..23b806a 100644 --- a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispa= tcher.inf +++ b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispa= tcher.inf @@ -3,7 +3,7 @@ # # This driver is responsible for the registration of child drivers # and the abstraction of the ICH SMI sources. -# Copyright (c) 2013-2015 Intel Corporation. +# Copyright (c) 2013-2017 Intel Corporation. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License @@ -66,6 +66,7 @@ DevicePathLib S3IoLib QNCAccessLib + SmiHandlerProfileLib =20 [Protocols] gEfiSmmCpuProtocolGuid # PROTOCOL ALWAYS_CONSUMED --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 8 22:13:35 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489673108003350.7970118425376; Thu, 16 Mar 2017 07:05:08 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DA49180408; Thu, 16 Mar 2017 07:05:01 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5FAA780402 for ; Thu, 16 Mar 2017 07:05:00 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 16 Mar 2017 07:05:00 -0700 Received: from wduan1-mobl.ccr.corp.intel.com (HELO jyao1-MOBL.ccr.corp.intel.com) ([10.254.215.154]) by fmsmga002.fm.intel.com with ESMTP; 16 Mar 2017 07:04:59 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,172,1486454400"; d="scan'208";a="1143304336" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Thu, 16 Mar 2017 22:04:43 +0800 Message-Id: <1489673083-10856-3-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1489673083-10856-1-git-send-email-jiewen.yao@intel.com> References: <1489673083-10856-1-git-send-email-jiewen.yao@intel.com> Subject: [edk2] [PATCH 2/2] QuarkPlatformPkg: enable SmiHandlerProfile. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Kelly Steele Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- QuarkPlatformPkg/Quark.dsc | 14 ++++++++++ QuarkPlatformPkg/Quark.fdf | 3 +- QuarkPlatformPkg/QuarkMin.dsc | 3 ++ QuarkPlatformPkg/Readme.md | 29 ++++++++++++-------- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc index 025653e..13c6538 100644 --- a/QuarkPlatformPkg/Quark.dsc +++ b/QuarkPlatformPkg/Quark.dsc @@ -41,6 +41,7 @@ DEFINE LOGGING =3D FALSE DEFINE CAPSULE_ENABLE =3D FALSE DEFINE RECOVERY_ENABLE =3D FALSE + DEFINE SMI_HANDLER_PROFILE_ENABLE =3D FALSE =20 # # Galileo board. Options are [GEN1, GEN2] @@ -163,6 +164,12 @@ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf !endif =20 +!if $(SMI_HANDLER_PROFILE_ENABLE) + SmiHandlerProfileLib|MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmi= HandlerProfileLib.inf +!else + SmiHandlerProfileLib|MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerP= rofileLibNull.inf +!endif + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf @@ -382,6 +389,10 @@ # waiting for RTC to be busy. gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|500000 =20 +!if $(SMI_HANDLER_PROFILE_ENABLE) + gEfiMdeModulePkgTokenSpaceGuid.PcdSmiHandlerProfilePropertyMask|1 +!endif + !if $(SECURE_BOOT_ENABLE) # override the default values from SecurityPkg to ensure images from all= sources are verified in secure boot gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04 @@ -796,6 +807,7 @@ # gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x801000C7 } + MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferD= xe.inf =20 UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmControlDxe/SmmControlDxe.inf @@ -939,6 +951,8 @@ } !endif =20 + MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.inf + [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] MSFT:*_*_*_DLINK_FLAGS =3D /ALIGN:4096 =20 diff --git a/QuarkPlatformPkg/Quark.fdf b/QuarkPlatformPkg/Quark.fdf index 19533b2..34f09af 100644 --- a/QuarkPlatformPkg/Quark.fdf +++ b/QuarkPlatformPkg/Quark.fdf @@ -2,7 +2,7 @@ # FDF file of Clanton Peak CRB platform with 32-bit DXE # # This package provides QuarkNcSocId platform specific modules. -# Copyright (c) 2013 - 2016 Intel Corporation. +# Copyright (c) 2013 - 2017 Intel Corporation. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License @@ -511,6 +511,7 @@ INF RuleOverride =3D ACPITABLE QuarkPlatformPkg/Acpi/A= cpiTables/AcpiTables.inf INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +INF MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBuff= erDxe.inf INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf INF QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmControlDxe/SmmControlDxe.inf INF QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispa= tcher.inf diff --git a/QuarkPlatformPkg/QuarkMin.dsc b/QuarkPlatformPkg/QuarkMin.dsc index 084f2f4..876e5df 100644 --- a/QuarkPlatformPkg/QuarkMin.dsc +++ b/QuarkPlatformPkg/QuarkMin.dsc @@ -150,6 +150,9 @@ !else PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf !endif + + SmiHandlerProfileLib|MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerP= rofileLibNull.inf + !if $(SECURE_BOOT_ENABLE) BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf PlatformSecureLib|QuarkPlatformPkg/Library/PlatformSecureLib/PlatformSec= ureLib.inf diff --git a/QuarkPlatformPkg/Readme.md b/QuarkPlatformPkg/Readme.md index f925f9e..d15e50f 100644 --- a/QuarkPlatformPkg/Readme.md +++ b/QuarkPlatformPkg/Readme.md @@ -137,17 +137,18 @@ build -a IA32 -t GCC49 -p QuarkPlatformPkg/QuarkMin.d= sc The table below contains a summary of the build flags to enable or disable features on the build command line using ```-D``` flags. =20 -| **Define Name** | **Default Value** | **Supported Values** | -| -------------------------- | ----------------- | -------------------- | -| ```GALILEO``` | GEN2 | GEN1, GEN2 | -| ```LOGGING``` | TRUE | TRUE, FALSE | -| ```SOURCE_DEBUG_ENABLE``` | FALSE | TRUE, FALSE | -| ```PERFORMANCE_ENABLE``` | FALSE | TRUE, FALSE | -| ```SECURE_BOOT_ENABLE``` | FALSE | TRUE, FALSE | -| ```MEASURED_BOOT_ENABLE``` | FALSE | TRUE, FALSE | -| ```TPM_12_HARDWARE``` | NONE | NONE, LPC, ATMEL_I2C, I= NFINEON_I2C | -| ```CAPSULE_ENABLE``` | FALSE | TRUE, FALSE | -| ```RECOVERY_ENABLE``` | FALSE | TRUE, FALSE | +| **Define Name** | **Default Value** | **Supported Value= s** | +| -------------------------- | ----------------- | -----------------= --- | +| ```GALILEO``` | GEN2 | GEN1, GEN2 = | +| ```LOGGING``` | TRUE | TRUE, FALSE = | +| ```SOURCE_DEBUG_ENABLE``` | FALSE | TRUE, FALSE = | +| ```PERFORMANCE_ENABLE``` | FALSE | TRUE, FALSE = | +| ```SECURE_BOOT_ENABLE``` | FALSE | TRUE, FALSE = | +| ```MEASURED_BOOT_ENABLE``` | FALSE | TRUE, FALSE = | +| ```TPM_12_HARDWARE``` | NONE | NONE, LPC, ATMEL_= I2C, INFINEON_I2C | +| ```CAPSULE_ENABLE``` | FALSE | TRUE, FALSE = | +| ```RECOVERY_ENABLE``` | FALSE | TRUE, FALSE = | +| ```SMI_HANDLER_PROFILE_ENABLE``` | FALSE | TRUE, FALSE = | =20 * ```GALILEO``` - Used to specify the type of Intel(R) Galileo board type.= The default is ```GEN2``` for the [Intel(R) Galileo Gen 2 Development Board]( @@ -218,6 +219,12 @@ features on the build command line using ```-D``` flag= s. In next boot, if a user runs ForceRecovery.efi in shell, or if a user pr= esses the RESET button during power on, warm reset or REBOOT, or if the FvMain is corrupted in flash, the system will boot into recove= ry mode. =20 +* ```SMI_HANDLER_PROFILE_ENABLE``` - Used to enable/disable SMI handler pr= ofile features. + The default is FALSE for disabled. Add ```-D SMI_HANDLER_PROFILE_ENABLE= ``` to the + build command line to enable SMI handler profile features. + A user may enter UEFI shell environment and run ```SmiHandlerProfileInfo= >a SmiHandlerQuark.xml``` + Then the user may enter OS environment and run ```BaseTools\Scripts\SmiH= andlerProfileSymbolGen.py -i SmiHandlerQuark.xml -o SmiHandlerQuarkFinal.xm= l -g Build\_\FV\Guid.xref```. (NOTE: Please replace= with Build/Release, and with the real toolchain = name.) + ### **Example Build Commands** =20 Default build with logging enabled: --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel