summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/SmmCorePerformanceLib
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-06-11 23:31:58 -0700
committerMichael Kinney <michael.d.kinney@intel.com>2017-02-23 09:01:17 -0800
commitcfb0aba7934b5dc2c6495139e8e6b0b41f1d50b5 (patch)
treee068e7799bb6ede43d6b7fc6e88f9ab8c975854d /MdeModulePkg/Library/SmmCorePerformanceLib
parentc5c9e7e298ed138b9823ccfba10436d49d1dcc32 (diff)
downloadedk2-cfb0aba7934b5dc2c6495139e8e6b0b41f1d50b5.tar.gz
edk2-cfb0aba7934b5dc2c6495139e8e6b0b41f1d50b5.tar.bz2
edk2-cfb0aba7934b5dc2c6495139e8e6b0b41f1d50b5.zip
MdeModulePkg: Add performance property configuration table
Define PERFORMANCE_PROPERTY, and install performance property configuration table in DxeCorePerformanceLib and SmmCorePerformanceLib. Cc: Andrew Fish <afish@apple.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Cinnamon Shia <cinnamon.shia@hpe.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Andrew Fish <afish@apple.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/SmmCorePerformanceLib')
-rw-r--r--MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c18
-rw-r--r--MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf5
2 files changed, 22 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
index 6f8d2dd064..a03a8c8dcc 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
@@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
GetGaugeEx
};
+PERFORMANCE_PROPERTY mPerformanceProperty;
+
/**
Searches in the gauge array with keyword Handle, Token, Module and Identfier.
@@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib (
{
EFI_STATUS Status;
EFI_HANDLE Handle;
+ PERFORMANCE_PROPERTY *PerformanceProperty;
//
// Initialize spin lock
@@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib (
ASSERT_EFI_ERROR (Status);
Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx, &gSmmPerformanceExProtocolGuid, &Handle);
ASSERT_EFI_ERROR (Status);
+
+ Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);
+ if (EFI_ERROR (Status)) {
+ //
+ // Install configuration table for performance property.
+ //
+ mPerformanceProperty.Revision = PERFORMANCE_PROPERTY_REVISION;
+ mPerformanceProperty.Reserved = 0;
+ mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
+ &mPerformanceProperty.TimerStartValue,
+ &mPerformanceProperty.TimerEndValue
+ );
+ Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, &mPerformanceProperty);
+ ASSERT_EFI_ERROR (Status);
+ }
}
/**
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf
index 160a749390..1b2fbd3ea3 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 beginning of SMM phase.
#
-# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
# 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
@@ -57,6 +57,7 @@
SynchronizationLib
SmmServicesTableLib
SmmMemLib
+ UefiLib
[Protocols]
gEfiSmmBase2ProtocolGuid ## CONSUMES
@@ -68,6 +69,8 @@
## PRODUCES ## UNDEFINED # Install protocol
## CONSUMES ## UNDEFINED # SmiHandlerRegister
gSmmPerformanceExProtocolGuid
+ ## PRODUCES ## SystemTable
+ gPerformanceProtocolGuid
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES