2008-04-09 07:44:04 +02:00
|
|
|
/** @file
|
2009-06-11 16:17:23 +02:00
|
|
|
This file defines performance-related definitions, including the format of:
|
2010-03-17 21:48:52 +01:00
|
|
|
* performance GUID HOB.
|
|
|
|
* performance protocol interfaces.
|
2009-06-11 16:17:23 +02:00
|
|
|
* performance variables.
|
2007-06-26 10:03:14 +02:00
|
|
|
|
2013-05-23 04:56:41 +02:00
|
|
|
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
2010-03-17 21:48:52 +01:00
|
|
|
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 full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
2007-06-26 10:03:14 +02:00
|
|
|
|
2010-03-17 21:48:52 +01:00
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
2007-06-26 10:03:14 +02:00
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
2008-04-09 07:44:04 +02:00
|
|
|
**/
|
2007-06-26 10:03:14 +02:00
|
|
|
|
2009-02-23 03:57:46 +01:00
|
|
|
#ifndef __PERFORMANCE_DATA_H__
|
|
|
|
#define __PERFORMANCE_DATA_H__
|
|
|
|
|
|
|
|
//
|
|
|
|
// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
|
|
|
|
//
|
|
|
|
#define PEI_PERFORMANCE_STRING_SIZE 8
|
|
|
|
#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_PHYSICAL_ADDRESS Handle;
|
2010-03-17 21:48:52 +01:00
|
|
|
CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.
|
|
|
|
CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE]; ///< Module string name.
|
|
|
|
UINT64 StartTimeStamp; ///< Start time point.
|
|
|
|
UINT64 EndTimeStamp; ///< End time point.
|
2009-02-23 03:57:46 +01:00
|
|
|
} PEI_PERFORMANCE_LOG_ENTRY;
|
|
|
|
|
|
|
|
//
|
|
|
|
// The header must be aligned at 8 bytes.
|
|
|
|
//
|
|
|
|
typedef struct {
|
2010-03-17 21:48:52 +01:00
|
|
|
UINT32 NumberOfEntries; ///< The number of all performance log entries.
|
2009-02-23 03:57:46 +01:00
|
|
|
UINT32 Reserved;
|
|
|
|
} PEI_PERFORMANCE_LOG_HEADER;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// The data structure for performance data in ACPI memory.
|
|
|
|
//
|
|
|
|
#define PERFORMANCE_SIGNATURE SIGNATURE_32 ('P', 'e', 'r', 'f')
|
|
|
|
#define PERF_TOKEN_SIZE 28
|
|
|
|
#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)
|
|
|
|
#define PERF_PEI_ENTRY_MAX_NUM 50
|
2013-05-23 04:56:41 +02:00
|
|
|
#define PERF_DATA_MAX_LENGTH 0x4000
|
2009-02-23 03:57:46 +01:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
CHAR8 Token[PERF_TOKEN_SIZE];
|
|
|
|
UINT32 Duration;
|
|
|
|
} PERF_DATA;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
UINT64 BootToOs;
|
|
|
|
UINT64 S3Resume;
|
|
|
|
UINT32 S3EntryNum;
|
|
|
|
PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
|
|
|
|
UINT64 CpuFreq;
|
|
|
|
UINT64 BDSRaw;
|
|
|
|
UINT32 Count;
|
|
|
|
UINT32 Signiture;
|
|
|
|
} PERF_HEADER;
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
#define PERFORMANCE_PROTOCOL_GUID \
|
2012-04-24 11:12:36 +02:00
|
|
|
{ 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
|
|
|
|
|
|
|
|
#define PERFORMANCE_EX_PROTOCOL_GUID \
|
|
|
|
{ 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
//
|
2009-02-23 03:57:46 +01:00
|
|
|
// Forward reference for pure ANSI compatibility
|
2007-06-26 10:03:14 +02:00
|
|
|
//
|
|
|
|
typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;
|
2012-04-24 11:12:36 +02:00
|
|
|
typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL;
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
|
|
|
|
//
|
|
|
|
#define DXE_PERFORMANCE_STRING_SIZE 32
|
|
|
|
#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
|
|
|
|
|
|
|
|
//
|
|
|
|
// The default guage entries number for DXE phase.
|
|
|
|
//
|
|
|
|
#define INIT_DXE_GAUGE_DATA_ENTRIES 800
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_PHYSICAL_ADDRESS Handle;
|
2010-03-17 21:48:52 +01:00
|
|
|
CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.
|
|
|
|
CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.
|
|
|
|
UINT64 StartTimeStamp; ///< Start time point.
|
|
|
|
UINT64 EndTimeStamp; ///< End time point.
|
2007-06-26 10:03:14 +02:00
|
|
|
} GAUGE_DATA_ENTRY;
|
|
|
|
|
2012-04-24 11:12:36 +02:00
|
|
|
typedef struct {
|
|
|
|
EFI_PHYSICAL_ADDRESS Handle;
|
|
|
|
CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.
|
|
|
|
CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.
|
|
|
|
UINT64 StartTimeStamp; ///< Start time point.
|
|
|
|
UINT64 EndTimeStamp; ///< End time point.
|
|
|
|
UINT32 Identifier; ///< Identifier.
|
|
|
|
} GAUGE_DATA_ENTRY_EX;
|
|
|
|
|
2007-06-26 10:03:14 +02:00
|
|
|
//
|
|
|
|
// The header must be aligned at 8 bytes
|
|
|
|
//
|
|
|
|
typedef struct {
|
2010-03-17 21:48:52 +01:00
|
|
|
UINT32 NumberOfEntries; ///< The number of all performance gauge entries.
|
2007-06-26 10:03:14 +02:00
|
|
|
UINT32 Reserved;
|
|
|
|
} GAUGE_DATA_HEADER;
|
|
|
|
|
2011-03-10 08:39:51 +01:00
|
|
|
//
|
|
|
|
// SMM Performance Protocol definitions
|
|
|
|
//
|
|
|
|
|
|
|
|
#define SMM_PERFORMANCE_PROTOCOL_GUID \
|
2012-04-24 11:12:36 +02:00
|
|
|
{ 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }
|
|
|
|
|
|
|
|
#define SMM_PERFORMANCE_EX_PROTOCOL_GUID \
|
|
|
|
{ 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } }
|
2011-03-10 08:39:51 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// SMM_PERFORMANCE_STRING_SIZE.
|
|
|
|
//
|
|
|
|
#define SMM_PERFORMANCE_STRING_SIZE 32
|
|
|
|
#define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)
|
|
|
|
|
|
|
|
//
|
|
|
|
// The default guage entries number for SMM phase.
|
|
|
|
//
|
|
|
|
#define INIT_SMM_GAUGE_DATA_ENTRIES 200
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
UINTN Function;
|
|
|
|
EFI_STATUS ReturnStatus;
|
|
|
|
UINTN NumberOfEntries;
|
|
|
|
UINTN LogEntryKey;
|
|
|
|
GAUGE_DATA_ENTRY *GaugeData;
|
|
|
|
} SMM_PERF_COMMUNICATE;
|
|
|
|
|
2012-04-24 11:12:36 +02:00
|
|
|
typedef struct {
|
|
|
|
UINTN Function;
|
|
|
|
EFI_STATUS ReturnStatus;
|
|
|
|
UINTN NumberOfEntries;
|
|
|
|
UINTN LogEntryKey;
|
|
|
|
GAUGE_DATA_ENTRY_EX *GaugeDataEx;
|
|
|
|
} SMM_PERF_COMMUNICATE_EX;
|
|
|
|
|
2011-03-10 08:39:51 +01:00
|
|
|
#define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1
|
|
|
|
#define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2
|
|
|
|
|
2007-06-26 10:03:14 +02:00
|
|
|
/**
|
|
|
|
Adds a record at the end of the performance measurement log
|
|
|
|
that records the start time of a performance measurement.
|
|
|
|
|
2009-06-11 16:17:23 +02:00
|
|
|
The added record contains the Handle, Token, and Module.
|
|
|
|
The end time of the new record is not recorded, so it is set to zero.
|
2007-06-26 10:03:14 +02:00
|
|
|
If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
|
|
|
|
If TimeStamp is zero, the start time in the record is filled in with the value
|
|
|
|
read from the current time stamp.
|
|
|
|
|
2010-03-17 21:48:52 +01:00
|
|
|
@param Handle The pointer to environment specific context used
|
2007-06-26 10:03:14 +02:00
|
|
|
to identify the component being measured.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param Token The pointer to a Null-terminated ASCII string
|
2007-06-26 10:03:14 +02:00
|
|
|
that identifies the component being measured.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param Module The pointer to a Null-terminated ASCII string
|
2007-06-26 10:03:14 +02:00
|
|
|
that identifies the module being measured.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param TimeStamp The 64-bit time stamp.
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The data was read correctly from the device.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:09:47 +02:00
|
|
|
(EFIAPI * PERFORMANCE_START_GAUGE)(
|
2007-06-26 10:03:14 +02:00
|
|
|
IN CONST VOID *Handle, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Token, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Module, OPTIONAL
|
|
|
|
IN UINT64 TimeStamp
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Searches the performance measurement log from the beginning of the log
|
|
|
|
for the first matching record that contains a zero end time and fills in a valid end time.
|
|
|
|
|
|
|
|
Searches the performance measurement log from the beginning of the log
|
2010-03-17 21:48:52 +01:00
|
|
|
for the first record that matches Handle, Token, and Module, and has an end time value of zero.
|
2007-06-26 10:03:14 +02:00
|
|
|
If the record can not be found then return EFI_NOT_FOUND.
|
|
|
|
If the record is found and TimeStamp is not zero,
|
|
|
|
then the end time in the record is filled in with the value specified by TimeStamp.
|
|
|
|
If the record is found and TimeStamp is zero, then the end time in the matching record
|
|
|
|
is filled in with the current time stamp value.
|
|
|
|
|
2010-03-17 21:48:52 +01:00
|
|
|
@param Handle The pointer to environment specific context used
|
2007-06-26 10:03:14 +02:00
|
|
|
to identify the component being measured.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param Token The pointer to a Null-terminated ASCII string
|
2007-06-26 10:03:14 +02:00
|
|
|
that identifies the component being measured.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param Module The pointer to a Null-terminated ASCII string
|
2007-06-26 10:03:14 +02:00
|
|
|
that identifies the module being measured.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param TimeStamp The 64-bit time stamp.
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The end of the measurement was recorded.
|
|
|
|
@retval EFI_NOT_FOUND The specified measurement record could not be found.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:09:47 +02:00
|
|
|
(EFIAPI * PERFORMANCE_END_GAUGE)(
|
2007-06-26 10:03:14 +02:00
|
|
|
IN CONST VOID *Handle, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Token, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Module, OPTIONAL
|
|
|
|
IN UINT64 TimeStamp
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrieves a previously logged performance measurement.
|
2012-04-24 11:12:36 +02:00
|
|
|
It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
|
|
|
|
and then eliminate the Identifier.
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
Retrieves the performance log entry from the performance log specified by LogEntryKey.
|
|
|
|
If it stands for a valid entry, then EFI_SUCCESS is returned and
|
|
|
|
GaugeDataEntry stores the pointer to that entry.
|
|
|
|
|
|
|
|
@param LogEntryKey The key for the previous performance measurement log entry.
|
|
|
|
If 0, then the first performance measurement log entry is retrieved.
|
2009-06-11 16:17:23 +02:00
|
|
|
@param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.
|
|
|
|
|
2008-12-12 07:04:02 +01:00
|
|
|
@retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
|
2009-06-11 16:17:23 +02:00
|
|
|
@retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
|
|
|
|
@retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:09:47 +02:00
|
|
|
(EFIAPI * PERFORMANCE_GET_GAUGE)(
|
2007-06-26 10:03:14 +02:00
|
|
|
IN UINTN LogEntryKey,
|
|
|
|
OUT GAUGE_DATA_ENTRY **GaugeDataEntry
|
|
|
|
);
|
|
|
|
|
2012-04-24 11:12:36 +02:00
|
|
|
/**
|
|
|
|
Adds a record at the end of the performance measurement log
|
|
|
|
that records the start time of a performance measurement.
|
|
|
|
|
|
|
|
The added record contains the Handle, Token, Module and Identifier.
|
|
|
|
The end time of the new record is not recorded, so it is set to zero.
|
|
|
|
If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
|
|
|
|
If TimeStamp is zero, the start time in the record is filled in with the value
|
|
|
|
read from the current time stamp.
|
|
|
|
|
|
|
|
@param Handle The pointer to environment specific context used
|
|
|
|
to identify the component being measured.
|
|
|
|
@param Token The pointer to a Null-terminated ASCII string
|
|
|
|
that identifies the component being measured.
|
|
|
|
@param Module The pointer to a Null-terminated ASCII string
|
|
|
|
that identifies the module being measured.
|
|
|
|
@param TimeStamp The 64-bit time stamp.
|
|
|
|
@param Identifier 32-bit identifier. If the value is 0, the created record
|
|
|
|
is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The data was read correctly from the device.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
|
|
|
(EFIAPI * PERFORMANCE_START_GAUGE_EX)(
|
|
|
|
IN CONST VOID *Handle, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Token, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Module, OPTIONAL
|
|
|
|
IN UINT64 TimeStamp,
|
|
|
|
IN UINT32 Identifier
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Searches the performance measurement log from the beginning of the log
|
|
|
|
for the first matching record that contains a zero end time and fills in a valid end time.
|
|
|
|
|
|
|
|
Searches the performance measurement log from the beginning of the log
|
|
|
|
for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.
|
|
|
|
If the record can not be found then return EFI_NOT_FOUND.
|
|
|
|
If the record is found and TimeStamp is not zero,
|
|
|
|
then the end time in the record is filled in with the value specified by TimeStamp.
|
|
|
|
If the record is found and TimeStamp is zero, then the end time in the matching record
|
|
|
|
is filled in with the current time stamp value.
|
|
|
|
|
|
|
|
@param Handle The pointer to environment specific context used
|
|
|
|
to identify the component being measured.
|
|
|
|
@param Token The pointer to a Null-terminated ASCII string
|
|
|
|
that identifies the component being measured.
|
|
|
|
@param Module The pointer to a Null-terminated ASCII string
|
|
|
|
that identifies the module being measured.
|
|
|
|
@param TimeStamp The 64-bit time stamp.
|
|
|
|
@param Identifier 32-bit identifier. If the value is 0, the found record
|
|
|
|
is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The end of the measurement was recorded.
|
|
|
|
@retval EFI_NOT_FOUND The specified measurement record could not be found.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
|
|
|
(EFIAPI * PERFORMANCE_END_GAUGE_EX)(
|
|
|
|
IN CONST VOID *Handle, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Token, OPTIONAL
|
|
|
|
IN CONST CHAR8 *Module, OPTIONAL
|
|
|
|
IN UINT64 TimeStamp,
|
|
|
|
IN UINT32 Identifier
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrieves a previously logged performance measurement.
|
|
|
|
It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
|
|
|
|
and then assign the Identifier with 0.
|
|
|
|
|
|
|
|
Retrieves the performance log entry from the performance log specified by LogEntryKey.
|
|
|
|
If it stands for a valid entry, then EFI_SUCCESS is returned and
|
|
|
|
GaugeDataEntryEx stores the pointer to that entry.
|
|
|
|
|
|
|
|
@param LogEntryKey The key for the previous performance measurement log entry.
|
|
|
|
If 0, then the first performance measurement log entry is retrieved.
|
|
|
|
@param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
|
|
|
|
@retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
|
|
|
|
@retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
|
|
|
(EFIAPI * PERFORMANCE_GET_GAUGE_EX)(
|
|
|
|
IN UINTN LogEntryKey,
|
|
|
|
OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx
|
|
|
|
);
|
|
|
|
|
2007-06-26 10:03:14 +02:00
|
|
|
struct _PERFORMANCE_PROTOCOL {
|
|
|
|
PERFORMANCE_START_GAUGE StartGauge;
|
|
|
|
PERFORMANCE_END_GAUGE EndGauge;
|
|
|
|
PERFORMANCE_GET_GAUGE GetGauge;
|
|
|
|
};
|
|
|
|
|
2012-04-24 11:12:36 +02:00
|
|
|
struct _PERFORMANCE_EX_PROTOCOL {
|
|
|
|
PERFORMANCE_START_GAUGE_EX StartGaugeEx;
|
|
|
|
PERFORMANCE_END_GAUGE_EX EndGaugeEx;
|
|
|
|
PERFORMANCE_GET_GAUGE_EX GetGaugeEx;
|
|
|
|
};
|
|
|
|
|
2007-06-26 10:03:14 +02:00
|
|
|
extern EFI_GUID gPerformanceProtocolGuid;
|
2011-03-10 08:39:51 +01:00
|
|
|
extern EFI_GUID gSmmPerformanceProtocolGuid;
|
2012-04-24 11:12:36 +02:00
|
|
|
extern EFI_GUID gPerformanceExProtocolGuid;
|
|
|
|
extern EFI_GUID gSmmPerformanceExProtocolGuid;
|
2007-06-26 10:03:14 +02:00
|
|
|
|
|
|
|
#endif
|