]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Guid/Performance.h
MdeModulePkg/S3SmmInitDone.h: Fix copyright coding style error.
[mirror_edk2.git] / MdeModulePkg / Include / Guid / Performance.h
index 3659ccc3280d1443d549d1bf7313352648761864..72e39787a6166a9b93b845cca59b663f742b568f 100644 (file)
@@ -2,15 +2,15 @@
   This file defines performance-related definitions, including the format of:\r
   * performance GUID HOB.\r
   * performance protocol interfaces.\r
-  * performance variables.  \r
+  * performance variables.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution.  \r
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.                                            \r
+http://opensource.org/licenses/bsd-license.php.\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
@@ -18,6 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef __PERFORMANCE_DATA_H__\r
 #define __PERFORMANCE_DATA_H__\r
 \r
+#define PERFORMANCE_PROPERTY_REVISION 0x1\r
+\r
+typedef struct {\r
+  UINT32                Revision;\r
+  UINT32                Reserved;\r
+  UINT64                Frequency;\r
+  UINT64                TimerStartValue;\r
+  UINT64                TimerEndValue;\r
+} PERFORMANCE_PROPERTY;\r
+\r
 //\r
 // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
 //\r
@@ -26,7 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 typedef struct {\r
   EFI_PHYSICAL_ADDRESS  Handle;\r
-  CHAR8                 Token[PEI_PERFORMANCE_STRING_SIZE];   ///< Measured token string name. \r
+  CHAR8                 Token[PEI_PERFORMANCE_STRING_SIZE];   ///< Measured token string name.\r
   CHAR8                 Module[PEI_PERFORMANCE_STRING_SIZE];  ///< Module string name.\r
   UINT64                StartTimeStamp;                       ///< Start time point.\r
   UINT64                EndTimeStamp;                         ///< End time point.\r
@@ -34,44 +44,24 @@ typedef struct {
 \r
 //\r
 // The header must be aligned at 8 bytes.\r
-// \r
+//\r
 typedef struct {\r
   UINT32                NumberOfEntries;  ///< The number of all performance log entries.\r
   UINT32                Reserved;\r
 } PEI_PERFORMANCE_LOG_HEADER;\r
 \r
 \r
-//\r
-// The data structure for performance data in ACPI memory.\r
-//\r
-#define PERFORMANCE_SIGNATURE   SIGNATURE_32 ('P', 'e', 'r', 'f')\r
-#define PERF_TOKEN_SIZE         28\r
-#define PERF_TOKEN_LENGTH       (PERF_TOKEN_SIZE - 1)\r
-#define PERF_PEI_ENTRY_MAX_NUM  50\r
-\r
-typedef struct {\r
-  CHAR8   Token[PERF_TOKEN_SIZE];\r
-  UINT32  Duration;\r
-} PERF_DATA;\r
-\r
-typedef struct {\r
-  UINT64        BootToOs;\r
-  UINT64        S3Resume;\r
-  UINT32        S3EntryNum;\r
-  PERF_DATA     S3Entry[PERF_PEI_ENTRY_MAX_NUM];\r
-  UINT64        CpuFreq;\r
-  UINT64        BDSRaw;\r
-  UINT32        Count;\r
-  UINT32        Signiture;\r
-} PERF_HEADER;\r
-\r
 #define PERFORMANCE_PROTOCOL_GUID \\r
-  { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
+  { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
+\r
+#define PERFORMANCE_EX_PROTOCOL_GUID \\r
+  { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1,  0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }\r
 \r
 //\r
 // Forward reference for pure ANSI compatibility\r
 //\r
 typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;\r
+typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL;\r
 \r
 //\r
 // DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
@@ -86,12 +76,21 @@ typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;
 \r
 typedef struct {\r
   EFI_PHYSICAL_ADDRESS  Handle;\r
-  CHAR8                 Token[DXE_PERFORMANCE_STRING_SIZE];  ///< Measured token string name. \r
+  CHAR8                 Token[DXE_PERFORMANCE_STRING_SIZE];  ///< Measured token string name.\r
   CHAR8                 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
   UINT64                StartTimeStamp;                      ///< Start time point.\r
   UINT64                EndTimeStamp;                        ///< End time point.\r
 } GAUGE_DATA_ENTRY;\r
 \r
+typedef struct {\r
+  EFI_PHYSICAL_ADDRESS  Handle;\r
+  CHAR8                 Token[DXE_PERFORMANCE_STRING_SIZE];  ///< Measured token string name.\r
+  CHAR8                 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
+  UINT64                StartTimeStamp;                      ///< Start time point.\r
+  UINT64                EndTimeStamp;                        ///< End time point.\r
+  UINT32                Identifier;                          ///< Identifier.\r
+} GAUGE_DATA_ENTRY_EX;\r
+\r
 //\r
 // The header must be aligned at 8 bytes\r
 //\r
@@ -105,7 +104,10 @@ typedef struct {
 //\r
 \r
 #define SMM_PERFORMANCE_PROTOCOL_GUID \\r
-  { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }\r
+  { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa,  0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }\r
+\r
+#define SMM_PERFORMANCE_EX_PROTOCOL_GUID \\r
+  { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6,  0x30, 0xe3, 0xe,  0xe5 } }\r
 \r
 //\r
 // SMM_PERFORMANCE_STRING_SIZE.\r
@@ -126,6 +128,14 @@ typedef struct {
   GAUGE_DATA_ENTRY  *GaugeData;\r
 } SMM_PERF_COMMUNICATE;\r
 \r
+typedef struct {\r
+  UINTN                Function;\r
+  EFI_STATUS           ReturnStatus;\r
+  UINTN                NumberOfEntries;\r
+  UINTN                LogEntryKey;\r
+  GAUGE_DATA_ENTRY_EX  *GaugeDataEx;\r
+} SMM_PERF_COMMUNICATE_EX;\r
+\r
 #define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER          1\r
 #define SMM_PERF_FUNCTION_GET_GAUGE_DATA                  2\r
 \r
@@ -195,6 +205,8 @@ EFI_STATUS
 \r
 /**\r
   Retrieves a previously logged performance measurement.\r
+  It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,\r
+  and then eliminate the Identifier.\r
 \r
   Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
   If it stands for a valid entry, then EFI_SUCCESS is returned and\r
@@ -203,7 +215,7 @@ EFI_STATUS
   @param  LogEntryKey             The key for the previous performance measurement log entry.\r
                                   If 0, then the first performance measurement log entry is retrieved.\r
   @param  GaugeDataEntry          Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.\r
-                                  \r
+\r
   @retval EFI_SUCCESS             The GuageDataEntry is successfully found based on LogEntryKey.\r
   @retval EFI_NOT_FOUND           There is no entry after the measurement referred to by LogEntryKey.\r
   @retval EFI_INVALID_PARAMETER   The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.\r
@@ -216,13 +228,116 @@ EFI_STATUS
   OUT GAUGE_DATA_ENTRY    **GaugeDataEntry\r
   );\r
 \r
+/**\r
+  Adds a record at the end of the performance measurement log\r
+  that records the start time of a performance measurement.\r
+\r
+  The added record contains the Handle, Token, Module and Identifier.\r
+  The end time of the new record is not recorded, so it is set to zero.\r
+  If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
+  If TimeStamp is zero, the start time in the record is filled in with the value\r
+  read from the current time stamp.\r
+\r
+  @param  Handle                  The pointer to environment specific context used\r
+                                  to identify the component being measured.\r
+  @param  Token                   The pointer to a Null-terminated ASCII string\r
+                                  that identifies the component being measured.\r
+  @param  Module                  The pointer to a Null-terminated ASCII string\r
+                                  that identifies the module being measured.\r
+  @param  TimeStamp               The 64-bit time stamp.\r
+  @param  Identifier              32-bit identifier. If the value is 0, the created record\r
+                                  is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.\r
+\r
+  @retval EFI_SUCCESS             The data was read correctly from the device.\r
+  @retval EFI_OUT_OF_RESOURCES    There are not enough resources to record the measurement.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * PERFORMANCE_START_GAUGE_EX)(\r
+  IN CONST VOID   *Handle,  OPTIONAL\r
+  IN CONST CHAR8  *Token,   OPTIONAL\r
+  IN CONST CHAR8  *Module,  OPTIONAL\r
+  IN UINT64       TimeStamp,\r
+  IN UINT32       Identifier\r
+  );\r
+\r
+/**\r
+  Searches the performance measurement log from the beginning of the log\r
+  for the first matching record that contains a zero end time and fills in a valid end time.\r
+\r
+  Searches the performance measurement log from the beginning of the log\r
+  for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.\r
+  If the record can not be found then return EFI_NOT_FOUND.\r
+  If the record is found and TimeStamp is not zero,\r
+  then the end time in the record is filled in with the value specified by TimeStamp.\r
+  If the record is found and TimeStamp is zero, then the end time in the matching record\r
+  is filled in with the current time stamp value.\r
+\r
+  @param  Handle                  The pointer to environment specific context used\r
+                                  to identify the component being measured.\r
+  @param  Token                   The pointer to a Null-terminated ASCII string\r
+                                  that identifies the component being measured.\r
+  @param  Module                  The pointer to a Null-terminated ASCII string\r
+                                  that identifies the module being measured.\r
+  @param  TimeStamp               The 64-bit time stamp.\r
+  @param  Identifier              32-bit identifier. If the value is 0, the found record\r
+                                  is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.\r
+\r
+  @retval EFI_SUCCESS             The end of  the measurement was recorded.\r
+  @retval EFI_NOT_FOUND           The specified measurement record could not be found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * PERFORMANCE_END_GAUGE_EX)(\r
+  IN CONST VOID   *Handle,  OPTIONAL\r
+  IN CONST CHAR8  *Token,   OPTIONAL\r
+  IN CONST CHAR8  *Module,  OPTIONAL\r
+  IN UINT64       TimeStamp,\r
+  IN UINT32       Identifier\r
+  );\r
+\r
+/**\r
+  Retrieves a previously logged performance measurement.\r
+  It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,\r
+  and then assign the Identifier with 0.\r
+\r
+  Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
+  If it stands for a valid entry, then EFI_SUCCESS is returned and\r
+  GaugeDataEntryEx stores the pointer to that entry.\r
+\r
+  @param  LogEntryKey             The key for the previous performance measurement log entry.\r
+                                  If 0, then the first performance measurement log entry is retrieved.\r
+  @param  GaugeDataEntryEx        Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.\r
+\r
+  @retval EFI_SUCCESS             The GuageDataEntryEx is successfully found based on LogEntryKey.\r
+  @retval EFI_NOT_FOUND           There is no entry after the measurement referred to by LogEntryKey.\r
+  @retval EFI_INVALID_PARAMETER   The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * PERFORMANCE_GET_GAUGE_EX)(\r
+  IN  UINTN                 LogEntryKey,\r
+  OUT GAUGE_DATA_ENTRY_EX   **GaugeDataEntryEx\r
+  );\r
+\r
 struct _PERFORMANCE_PROTOCOL {\r
   PERFORMANCE_START_GAUGE             StartGauge;\r
   PERFORMANCE_END_GAUGE               EndGauge;\r
   PERFORMANCE_GET_GAUGE               GetGauge;\r
 };\r
 \r
+struct _PERFORMANCE_EX_PROTOCOL {\r
+  PERFORMANCE_START_GAUGE_EX          StartGaugeEx;\r
+  PERFORMANCE_END_GAUGE_EX            EndGaugeEx;\r
+  PERFORMANCE_GET_GAUGE_EX            GetGaugeEx;\r
+};\r
+\r
 extern EFI_GUID gPerformanceProtocolGuid;\r
 extern EFI_GUID gSmmPerformanceProtocolGuid;\r
+extern EFI_GUID gPerformanceExProtocolGuid;\r
+extern EFI_GUID gSmmPerformanceExProtocolGuid;\r
 \r
 #endif\r