]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
authorStar Zeng <star.zeng@intel.com>
Fri, 28 Jul 2017 02:05:08 +0000 (10:05 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 1 Aug 2017 09:49:18 +0000 (17:49 +0800)
Add SecPerformancePpiCallBack to get SEC performance data and
build HOB to convey the SEC performance data to DXE phase.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
UefiCpuPkg/SecCore/SecCore.inf
UefiCpuPkg/SecCore/SecMain.c
UefiCpuPkg/SecCore/SecMain.h

index 0d135e62ec33c48381c1c33a923069a8b5ad6e0c..a8f8a6da27280b86c6b45fefb724aad2e81b8775 100644 (file)
   ## SOMETIMES_PRODUCES\r
   gEfiSecPlatformInformation2PpiGuid\r
   gEfiTemporaryRamDonePpiGuid                          ## PRODUCES\r
   ## SOMETIMES_PRODUCES\r
   gEfiSecPlatformInformation2PpiGuid\r
   gEfiTemporaryRamDonePpiGuid                          ## PRODUCES\r
+  ## NOTIFY\r
+  ## SOMETIMES_CONSUMES\r
+  gPeiSecPerformancePpiGuid\r
+\r
+[Guids]\r
+  ## SOMETIMES_PRODUCES   ## HOB\r
+  gEfiFirmwarePerformanceGuid\r
 \r
 [Pcd]\r
   gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize  ## CONSUMES\r
 \r
 [Pcd]\r
   gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize  ## CONSUMES\r
index 18b7782bb87d905ff8fb98943e9c90d2e4973aed..e9e243ca0585594d480527f5bdfda0dad681d724 100644 (file)
@@ -21,6 +21,14 @@ EFI_PEI_TEMPORARY_RAM_DONE_PPI gSecTemporaryRamDonePpi = {
 EFI_SEC_PLATFORM_INFORMATION_PPI  mSecPlatformInformationPpi = { SecPlatformInformation };\r
 \r
 EFI_PEI_PPI_DESCRIPTOR            mPeiSecPlatformInformationPpi[] = {\r
 EFI_SEC_PLATFORM_INFORMATION_PPI  mSecPlatformInformationPpi = { SecPlatformInformation };\r
 \r
 EFI_PEI_PPI_DESCRIPTOR            mPeiSecPlatformInformationPpi[] = {\r
+  {\r
+    //\r
+    // SecPerformance PPI notify descriptor.\r
+    //\r
+    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
+    &gPeiSecPerformancePpiGuid,\r
+    (VOID *) (UINTN) SecPerformancePpiCallBack\r
+  },\r
   {\r
     EFI_PEI_PPI_DESCRIPTOR_PPI,\r
     &gEfiTemporaryRamDonePpiGuid,\r
   {\r
     EFI_PEI_PPI_DESCRIPTOR_PPI,\r
     &gEfiTemporaryRamDonePpiGuid,\r
@@ -55,6 +63,44 @@ SecStartupPhase2(
   IN VOID                     *Context\r
   );\r
 \r
   IN VOID                     *Context\r
   );\r
 \r
+/**\r
+  Entry point of the notification callback function itself within the PEIM.\r
+  It is to get SEC performance data and build HOB to convey the SEC performance\r
+  data to DXE phase.\r
+\r
+  @param  PeiServices      Indirect reference to the PEI Services Table.\r
+  @param  NotifyDescriptor Address of the notification descriptor data structure.\r
+  @param  Ppi              Address of the PPI that was installed.\r
+\r
+  @return Status of the notification.\r
+          The status code returned from this function is ignored.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecPerformancePpiCallBack (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  PEI_SEC_PERFORMANCE_PPI       *SecPerf;\r
+  FIRMWARE_SEC_PERFORMANCE      Performance;\r
+\r
+  SecPerf = (PEI_SEC_PERFORMANCE_PPI *) Ppi;\r
+  Status = SecPerf->GetPerformance ((CONST EFI_PEI_SERVICES **) PeiServices, SecPerf, &Performance);\r
+  if (!EFI_ERROR (Status)) {\r
+    BuildGuidDataHob (\r
+      &gEfiFirmwarePerformanceGuid,\r
+      &Performance,\r
+      sizeof (FIRMWARE_SEC_PERFORMANCE)\r
+    );\r
+    DEBUG ((DEBUG_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", Performance.ResetEnd));\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
 /**\r
 \r
   Entry point to the C language phase of SEC. After the SEC assembly\r
 /**\r
 \r
   Entry point to the C language phase of SEC. After the SEC assembly\r
index 6e31a953f75720623dbae945aac54ed6e718a46e..46c7d41c6e3ef0cc6f3c5f9130ae5353cb3f5cdc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Master header file for SecCore.\r
 \r
 /** @file\r
   Master header file for SecCore.\r
 \r
-  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2008 - 2017, 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
   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
@@ -20,6 +20,9 @@
 #include <Ppi/SecPlatformInformation.h>\r
 #include <Ppi/SecPlatformInformation2.h>\r
 #include <Ppi/TemporaryRamDone.h>\r
 #include <Ppi/SecPlatformInformation.h>\r
 #include <Ppi/SecPlatformInformation2.h>\r
 #include <Ppi/TemporaryRamDone.h>\r
+#include <Ppi/SecPerformance.h>\r
+\r
+#include <Guid/FirmwarePerformance.h>\r
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -157,4 +160,24 @@ RepublishSecPlatformInformationPpi (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
+/**\r
+  Entry point of the notification callback function itself within the PEIM.\r
+  It is to get SEC performance data and build HOB to convey the SEC performance\r
+  data to DXE phase.\r
+\r
+  @param  PeiServices      Indirect reference to the PEI Services Table.\r
+  @param  NotifyDescriptor Address of the notification descriptor data structure.\r
+  @param  Ppi              Address of the PPI that was installed.\r
+\r
+  @return Status of the notification.\r
+          The status code returned from this function is ignored.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecPerformancePpiCallBack (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  );\r
+\r
 #endif\r
 #endif\r