From nobody Sat Nov 2 16:20:36 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 1486097751457642.8568480482774; Thu, 2 Feb 2017 20:55:51 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AC2E28208E; Thu, 2 Feb 2017 20:55:49 -0800 (PST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 4CFAD8207E for ; Thu, 2 Feb 2017 20:55:48 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP; 02 Feb 2017 20:55:47 -0800 Received: from mdkinney-mobl.amr.corp.intel.com ([10.252.133.81]) by orsmga004.jf.intel.com with ESMTP; 02 Feb 2017 20:55:47 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,327,1477983600"; d="scan'208";a="54961011" From: Michael Kinney To: edk2-devel@lists.01.org Date: Thu, 2 Feb 2017 20:55:35 -0800 Message-Id: <1486097737-12816-2-git-send-email-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.6.3.windows.1 In-Reply-To: <1486097737-12816-1-git-send-email-michael.d.kinney@intel.com> References: <1486097737-12816-1-git-send-email-michael.d.kinney@intel.com> Subject: [edk2] [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Fish , Liming Gao , Jiewen Yao , Jaben Carsey , Star Zeng 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" From: Star Zeng Define PERFORMANCE_PROPERTY, and install performance property configuration table in DxeCorePerformanceLib and SmmCorePerformanceLib. Cc: Andrew Fish Cc: Michael Kinney Cc: Liming Gao Cc: Jiewen Yao Cc: Cinnamon Shia Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- MdeModulePkg/Include/Guid/Performance.h | 12 ++++++++++- .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 23 ++++++++++++++++++= ++-- .../DxeCorePerformanceLib.inf | 2 ++ .../DxeCorePerformanceLibInternal.h | 3 ++- .../SmmCorePerformanceLib/SmmCorePerformanceLib.c | 18 +++++++++++++++++ .../SmmCorePerformanceLib.inf | 5 ++++- 6 files changed, 58 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Include/Guid/Performance.h b/MdeModulePkg/Include= /Guid/Performance.h index c40046c..df40c6c 100644 --- a/MdeModulePkg/Include/Guid/Performance.h +++ b/MdeModulePkg/Include/Guid/Performance.h @@ -4,7 +4,7 @@ * performance protocol interfaces. * performance variables. =20 =20 -Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availabl= e under=20 the terms and conditions of the BSD License that accompanies this distribu= tion. =20 The full text of the license may be found at @@ -18,6 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHE= R EXPRESS OR IMPLIED. #ifndef __PERFORMANCE_DATA_H__ #define __PERFORMANCE_DATA_H__ =20 +#define PERFORMANCE_PROPERTY_REVISION 0x1 + +typedef struct { + UINT32 Revision; + UINT32 Reserved; + UINT64 Frequency; + UINT64 TimerStartValue; + UINT64 TimerEndValue; +} PERFORMANCE_PROPERTY; + // // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8. // diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 4739bb8..1564514 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -10,7 +10,7 @@ This library is mainly used by DxeCore to start performance logging to e= nsure that Performance Protocol is installed at the very beginning of DXE phase. =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License @@ -61,6 +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface =3D { GetGaugeEx }; =20 +PERFORMANCE_PROPERTY mPerformanceProperty; + /** Searches in the gauge array with keyword Handle, Token, Module and Ident= ifier. =20 @@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor ( ) { EFI_STATUS Status; + PERFORMANCE_PROPERTY *PerformanceProperty; + =20 if (!PerformanceMeasurementEnabled ()) { // @@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor ( =20 InternalGetPeiPerformance (); =20 - return Status; + Status =3D EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &P= erformanceProperty); + if (EFI_ERROR (Status)) { + // + // Install configuration table for performance property. + // + mPerformanceProperty.Revision =3D PERFORMANCE_PROPERTY_REVISION; + mPerformanceProperty.Reserved =3D 0; + mPerformanceProperty.Frequency =3D GetPerformanceCounterProperties ( + &mPerformanceProperty.TimerStartVal= ue, + &mPerformanceProperty.TimerEndValue + ); + Status =3D gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, = &mPerformanceProperty); + ASSERT_EFI_ERROR (Status); + } + + return EFI_SUCCESS; } =20 /** diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.i= nf index e091c62..5b89ce2 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf @@ -56,11 +56,13 @@ BaseLib HobLib DebugLib + UefiLib =20 =20 [Guids] ## SOMETIMES_CONSUMES ## HOB ## PRODUCES ## UNDEFINED # Install protocol + ## PRODUCES ## SystemTable gPerformanceProtocolGuid ## SOMETIMES_CONSUMES ## HOB ## PRODUCES ## UNDEFINED # Install protocol diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ibInternal.h b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanc= eLibInternal.h index 2b9ccd2..f1540d8 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInter= nal.h +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInter= nal.h @@ -4,7 +4,7 @@ This header file holds the prototypes of the Performance and Performance= Ex Protocol published by this library instance at its constructor. =20 -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. #include #include #include +#include =20 // // Interface declarations for PerformanceEx Protocol. diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL= ib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c index 6f8d2dd..a03a8c8 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c @@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface =3D { GetGaugeEx }; =20 +PERFORMANCE_PROPERTY mPerformanceProperty; + /** Searches in the gauge array with keyword Handle, Token, Module and Ident= fier. =20 @@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib ( { EFI_STATUS Status; EFI_HANDLE Handle; + PERFORMANCE_PROPERTY *PerformanceProperty; =20 // // Initialize spin lock @@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib ( ASSERT_EFI_ERROR (Status); Status =3D gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx, &gSmmPerf= ormanceExProtocolGuid, &Handle); ASSERT_EFI_ERROR (Status); + + Status =3D EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &P= erformanceProperty); + if (EFI_ERROR (Status)) { + // + // Install configuration table for performance property. + // + mPerformanceProperty.Revision =3D PERFORMANCE_PROPERTY_REVISION; + mPerformanceProperty.Reserved =3D 0; + mPerformanceProperty.Frequency =3D GetPerformanceCounterProperties ( + &mPerformanceProperty.TimerStartVal= ue, + &mPerformanceProperty.TimerEndValue + ); + Status =3D gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, = &mPerformanceProperty); + ASSERT_EFI_ERROR (Status); + } } =20 /** diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL= ib.inf b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i= nf index 160a749..1b2fbd3 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf @@ -8,7 +8,7 @@ # This library is mainly used by SMM Core to start performance logging to= ensure that # SMM Performance and PerformanceEx Protocol are installed at the very be= ginning of SMM phase. # =20 -# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License # which accompanies this distribution. The full text of the license may = be found at @@ -57,6 +57,7 @@ SynchronizationLib SmmServicesTableLib SmmMemLib + UefiLib =20 [Protocols] gEfiSmmBase2ProtocolGuid ## CONSUMES @@ -68,6 +69,8 @@ ## PRODUCES ## UNDEFINED # Install protocol ## CONSUMES ## UNDEFINED # SmiHandlerRegister gSmmPerformanceExProtocolGuid + ## PRODUCES ## SystemTable + gPerformanceProtocolGuid =20 [Pcd] gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES --=20 2.6.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel