]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add two performance measurement points for SMM performance measurement;
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Aug 2011 02:58:20 +0000 (02:58 +0000)
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Aug 2011 02:58:20 +0000 (02:58 +0000)
2. Introduce SmmCorePlatformHookLib library class defining two platform hook points. Update PI Smm Core to call the hook points before and after invoking registered SMI handlers. A NULL instance of this library class is implemented.

Note that after this check in, DSC files consuming the PiSmmCore.inf need to be updated to add a library instance for SmmCorePlatformHookLib library class.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12140 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h [new file with mode: 0644]
MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.c [new file with mode: 0644]
MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf [new file with mode: 0644]
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/MdeModulePkg.dsc

index 75337f6b1c67112bce2257dcc0babd893115840c..a5e4b6e9803f229fdd8dbc56ea1444216b2d3d98 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM Core Main Entry Point\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -246,11 +246,18 @@ SmmEntryPoint (
   EFI_STATUS                  Status;\r
   EFI_SMM_COMMUNICATE_HEADER  *CommunicateHeader;\r
 \r
+  PERF_START (NULL, "SMM", NULL, 0) ;\r
+\r
   //\r
   // Update SMST using the context\r
   //\r
   CopyMem (&gSmmCoreSmst.SmmStartupThisAp, SmmEntryContext, sizeof (EFI_SMM_ENTRY_CONTEXT));\r
 \r
+  //\r
+  // Call platform hook before Smm Dispatch\r
+  //\r
+  PlatformHookBeforeSmmDispatch ();\r
+\r
   //\r
   // If a legacy boot has occured, then make sure gSmmCorePrivate is not accessed\r
   //\r
@@ -297,11 +304,18 @@ SmmEntryPoint (
     //\r
     SmiManage (NULL, NULL, NULL, NULL);\r
   }\r
+  \r
+  //\r
+  // Call platform hook after Smm Dispatch\r
+  //\r
+  PlatformHookAfterSmmDispatch ();\r
 \r
   //\r
   // Clear the InSmm flag as we are going to leave SMM\r
   //\r
   gSmmCorePrivate->InSmm = FALSE;\r
+\r
+  PERF_END (NULL, "SMM", NULL, 0) ;\r
 }\r
 \r
 /**\r
index 5cd123705600b0e5ad67add6a3c058ae7ec42f52..19af786612b177ac738c216a994c4c17c5cb5138 100644 (file)
@@ -2,7 +2,7 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by SmmCore module.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -43,6 +43,8 @@
 #include <Library/UefiLib.h>                   \r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/SmmCorePlatformHookLib.h>\r
+#include <Library/PerformanceLib.h>\r
 \r
 #include "PiSmmCorePrivateData.h"\r
 \r
index 96886e1e25a2f65835ce0a4ca64bf88d96b7d767..7687a618f7dc6a484689e457c2a55101b1e8491d 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This module provide an SMM CIS compliant implementation of SMM Core.\r
 #\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -54,7 +54,9 @@
   UefiBootServicesTableLib    \r
   MemoryAllocationLib\r
   PcdLib\r
-  \r
+  SmmCorePlatformHookLib\r
+  PerformanceLib\r
+\r
 [Protocols]\r
   gEfiDxeSmmReadyToLockProtocolGuid             # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSmmReadyToLockProtocolGuid                # PROTOCOL ALWAYS_PRODUCED\r
diff --git a/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h b/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h
new file mode 100644 (file)
index 0000000..773d061
--- /dev/null
@@ -0,0 +1,50 @@
+/** @file\r
+  Smm Core Platform Hook Library.  This library class defines a set of platform\r
+  hooks called by the SMM Core.\r
+\r
+Copyright (c) 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
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __SMM_CORE_PLATFORM_HOOK_LIB__\r
+#define __SMM_CORE_PLATFORM_HOOK_LIB__\r
+\r
+/**\r
+  Performs platform specific tasks before invoking registered SMI handlers.\r
+  \r
+  This function performs platform specific tasks before invoking registered SMI handlers.\r
+  \r
+  @retval EFI_SUCCESS       The platform hook completes successfully.\r
+  @retval Other values      The paltform hook cannot complete due to some error.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformHookBeforeSmmDispatch (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Performs platform specific tasks after invoking registered SMI handlers.\r
+  \r
+  This function performs platform specific tasks after invoking registered SMI handlers.\r
+  \r
+  @retval EFI_SUCCESS       The platform hook completes successfully.\r
+  @retval Other values      The paltform hook cannot complete due to some error.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformHookAfterSmmDispatch (\r
+  VOID\r
+  );\r
+  \r
+#endif\r
diff --git a/MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.c b/MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.c
new file mode 100644 (file)
index 0000000..ef38c8f
--- /dev/null
@@ -0,0 +1,52 @@
+/** @file\r
+  Null instance of SmmCorePlatformHookLibNull.\r
+\r
+  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  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
+\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
+\r
+#include <Library/SmmCorePlatformHookLib.h>\r
+\r
+/**\r
+  Performs platform specific tasks before invoking registered SMI handlers.\r
+  \r
+  This function performs platform specific tasks before invoking registered SMI handlers.\r
+  \r
+  @retval EFI_SUCCESS       The platform hook completes successfully.\r
+  @retval Other values      The paltform hook cannot complete due to some error.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformHookBeforeSmmDispatch (\r
+  VOID\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+  Performs platform specific tasks after invoking registered SMI handlers.\r
+  \r
+  This function performs platform specific tasks after invoking registered SMI handlers.\r
+  \r
+  @retval EFI_SUCCESS       The platform hook completes successfully.\r
+  @retval Other values      The paltform hook cannot complete due to some error.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformHookAfterSmmDispatch (\r
+  VOID\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf b/MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
new file mode 100644 (file)
index 0000000..c234577
--- /dev/null
@@ -0,0 +1,35 @@
+## @file\r
+#  SMM Core Platform Hook Null Library instance\r
+#\r
+#  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  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
+#  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
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = SmmCorePlatformHookLibNull\r
+  FILE_GUID                      = FED6583D-2418-4760-AC96-B5E18F0A6326\r
+  MODULE_TYPE                    = SMM_CORE\r
+  VERSION_STRING                 = 1.0\r
+  PI_SPECIFICATION_VERSION       = 0x0001000A\r
+  LIBRARY_CLASS                  = SmmCorePlatformHookLib|SMM_CORE\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64\r
+#\r
+\r
+[Sources]\r
+  SmmCorePlatformHookLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
index 80c9632e60714a5a2b3b7d055b8745f21c95c0d7..b2782df5f087dc69a151f9f835c08c6f9fbebc78 100644 (file)
   ##  @libraryclass  Provide platform specific hooks.\r
   #\r
   PlatformHookLib|Include/Library/PlatformHookLib.h\r
+\r
+  ##  @libraryclass  Provide platform specific hooks for SMM core.\r
+  #\r
+  SmmCorePlatformHookLib|Include/Library/SmmCorePlatformHookLib.h\r
   \r
 [Guids]\r
   ## MdeModule package token space guid\r
index 78cf7603a56fd1626396e01774416a115e45a48d..67c13444d1ead5086d1eab49d0e05182fc81a1c2 100644 (file)
 [LibraryClasses.common.SMM_CORE]\r
   MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf\r
   SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf\r
-  \r
+  SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf  \r
+\r
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
   DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf\r
   MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf\r
   MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf\r
   MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf\r
+  MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf\r
 \r