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>
This commit is contained in:
Star Zeng 2016-06-11 23:31:58 -07:00 committed by Michael Kinney
parent c5c9e7e298
commit cfb0aba793
6 changed files with 58 additions and 5 deletions

View File

@ -4,7 +4,7 @@
* performance protocol interfaces. * performance protocol interfaces.
* performance variables. * performance variables.
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution. the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at The full text of the license may be found at
@ -18,6 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PERFORMANCE_DATA_H__ #ifndef __PERFORMANCE_DATA_H__
#define __PERFORMANCE_DATA_H__ #define __PERFORMANCE_DATA_H__
#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. // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
// //

View File

@ -10,7 +10,7 @@
This library is mainly used by DxeCore to start performance logging to ensure that This library is mainly used by DxeCore to start performance logging to ensure that
Performance Protocol is installed at the very beginning of DXE phase. Performance Protocol is installed at the very beginning of DXE phase.
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -61,6 +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
GetGaugeEx GetGaugeEx
}; };
PERFORMANCE_PROPERTY mPerformanceProperty;
/** /**
Searches in the gauge array with keyword Handle, Token, Module and Identifier. Searches in the gauge array with keyword Handle, Token, Module and Identifier.
@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PERFORMANCE_PROPERTY *PerformanceProperty;
if (!PerformanceMeasurementEnabled ()) { if (!PerformanceMeasurementEnabled ()) {
// //
@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor (
InternalGetPeiPerformance (); InternalGetPeiPerformance ();
return 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);
}
return EFI_SUCCESS;
} }
/** /**

View File

@ -56,11 +56,13 @@
BaseLib BaseLib
HobLib HobLib
DebugLib DebugLib
UefiLib
[Guids] [Guids]
## SOMETIMES_CONSUMES ## HOB ## SOMETIMES_CONSUMES ## HOB
## PRODUCES ## UNDEFINED # Install protocol ## PRODUCES ## UNDEFINED # Install protocol
## PRODUCES ## SystemTable
gPerformanceProtocolGuid gPerformanceProtocolGuid
## SOMETIMES_CONSUMES ## HOB ## SOMETIMES_CONSUMES ## HOB
## PRODUCES ## UNDEFINED # Install protocol ## PRODUCES ## UNDEFINED # Install protocol

View File

@ -4,7 +4,7 @@
This header file holds the prototypes of the Performance and PerformanceEx Protocol published by this This header file holds the prototypes of the Performance and PerformanceEx Protocol published by this
library instance at its constructor. library instance at its constructor.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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 <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
// //
// Interface declarations for PerformanceEx Protocol. // Interface declarations for PerformanceEx Protocol.

View File

@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
GetGaugeEx GetGaugeEx
}; };
PERFORMANCE_PROPERTY mPerformanceProperty;
/** /**
Searches in the gauge array with keyword Handle, Token, Module and Identfier. Searches in the gauge array with keyword Handle, Token, Module and Identfier.
@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib (
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HANDLE Handle; EFI_HANDLE Handle;
PERFORMANCE_PROPERTY *PerformanceProperty;
// //
// Initialize spin lock // Initialize spin lock
@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib (
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx, &gSmmPerformanceExProtocolGuid, &Handle); Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx, &gSmmPerformanceExProtocolGuid, &Handle);
ASSERT_EFI_ERROR (Status); 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);
}
} }
/** /**

View File

@ -8,7 +8,7 @@
# This library is mainly used by SMM Core to start performance logging to ensure that # 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. # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
@ -57,6 +57,7 @@
SynchronizationLib SynchronizationLib
SmmServicesTableLib SmmServicesTableLib
SmmMemLib SmmMemLib
UefiLib
[Protocols] [Protocols]
gEfiSmmBase2ProtocolGuid ## CONSUMES gEfiSmmBase2ProtocolGuid ## CONSUMES
@ -68,6 +69,8 @@
## PRODUCES ## UNDEFINED # Install protocol ## PRODUCES ## UNDEFINED # Install protocol
## CONSUMES ## UNDEFINED # SmiHandlerRegister ## CONSUMES ## UNDEFINED # SmiHandlerRegister
gSmmPerformanceExProtocolGuid gSmmPerformanceExProtocolGuid
## PRODUCES ## SystemTable
gPerformanceProtocolGuid
[Pcd] [Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES