]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Guid/Performance.h
Add performance library instances for SMM performance measurement.
[mirror_edk2.git] / MdeModulePkg / Include / Guid / Performance.h
index de813da4b7a17a0efffc12f682159050ad53ee1e..3659ccc3280d1443d549d1bf7313352648761864 100644 (file)
@@ -1,16 +1,16 @@
 /** @file\r
   This file defines performance-related definitions, including the format of:\r
-  * performance GUID HOB\r
-  * performance protocol interfaces\r
+  * performance GUID HOB.\r
+  * performance protocol interfaces.\r
   * performance variables.  \r
 \r
-Copyright (c) 2009, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\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
+The full text of the license may be found at\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
@@ -26,17 +26,17 @@ 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                 Module[PEI_PERFORMANCE_STRING_SIZE];  ///< Module string name\r
-  UINT64                StartTimeStamp;                       ///< Start time point\r
-  UINT64                EndTimeStamp;                         ///< End time point\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
 } PEI_PERFORMANCE_LOG_ENTRY;\r
 \r
 //\r
 // The header must be aligned at 8 bytes.\r
 // \r
 typedef struct {\r
-  UINT32                NumberOfEntries;  ///< The number of all performance log entries\r
+  UINT32                NumberOfEntries;  ///< The number of all performance log entries.\r
   UINT32                Reserved;\r
 } PEI_PERFORMANCE_LOG_HEADER;\r
 \r
@@ -86,20 +86,49 @@ 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                 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name\r
-  UINT64                StartTimeStamp;                      ///< Start time point\r
-  UINT64                EndTimeStamp;                        ///< End time point\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
 //\r
 // The header must be aligned at 8 bytes\r
 //\r
 typedef struct {\r
-  UINT32                NumberOfEntries; ///< The number of all performance gauge entries\r
+  UINT32                NumberOfEntries; ///< The number of all performance gauge entries.\r
   UINT32                Reserved;\r
 } GAUGE_DATA_HEADER;\r
 \r
+//\r
+// SMM Performance Protocol definitions\r
+//\r
+\r
+#define SMM_PERFORMANCE_PROTOCOL_GUID \\r
+  { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }\r
+\r
+//\r
+// SMM_PERFORMANCE_STRING_SIZE.\r
+//\r
+#define SMM_PERFORMANCE_STRING_SIZE     32\r
+#define SMM_PERFORMANCE_STRING_LENGTH   (SMM_PERFORMANCE_STRING_SIZE - 1)\r
+\r
+//\r
+// The default guage entries number for SMM phase.\r
+//\r
+#define INIT_SMM_GAUGE_DATA_ENTRIES     200\r
+\r
+typedef struct {\r
+  UINTN             Function;\r
+  EFI_STATUS        ReturnStatus;\r
+  UINTN             NumberOfEntries;\r
+  UINTN             LogEntryKey;\r
+  GAUGE_DATA_ENTRY  *GaugeData;\r
+} SMM_PERF_COMMUNICATE;\r
+\r
+#define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER          1\r
+#define SMM_PERF_FUNCTION_GET_GAUGE_DATA                  2\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
@@ -110,13 +139,13 @@ typedef struct {
   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                  Pointer to environment specific context used\r
+  @param  Handle                  The pointer to environment specific context used\r
                                   to identify the component being measured.\r
-  @param  Token                   Pointer to a Null-terminated ASCII string\r
+  @param  Token                   The pointer to a Null-terminated ASCII string\r
                                   that identifies the component being measured.\r
-  @param  Module                  Pointer to a Null-terminated ASCII string\r
+  @param  Module                  The pointer to a Null-terminated ASCII string\r
                                   that identifies the module being measured.\r
-  @param  TimeStamp               64-bit time stamp.\r
+  @param  TimeStamp               The 64-bit time stamp.\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
@@ -136,20 +165,20 @@ EFI_STATUS
   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, and Module and has an end time value of zero.\r
+  for the first record that matches Handle, Token, and Module, 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                  Pointer to environment specific context used\r
+  @param  Handle                  The pointer to environment specific context used\r
                                   to identify the component being measured.\r
-  @param  Token                   Pointer to a Null-terminated ASCII string\r
+  @param  Token                   The pointer to a Null-terminated ASCII string\r
                                   that identifies the component being measured.\r
-  @param  Module                  Pointer to a Null-terminated ASCII string\r
+  @param  Module                  The pointer to a Null-terminated ASCII string\r
                                   that identifies the module being measured.\r
-  @param  TimeStamp               64-bit time stamp.\r
+  @param  TimeStamp               The 64-bit time stamp.\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
@@ -194,5 +223,6 @@ struct _PERFORMANCE_PROTOCOL {
 };\r
 \r
 extern EFI_GUID gPerformanceProtocolGuid;\r
+extern EFI_GUID gSmmPerformanceProtocolGuid;\r
 \r
 #endif\r