public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore
@ 2017-07-31  3:31 Star Zeng
  2017-07-31  3:31 ` [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned Star Zeng
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Star Zeng @ 2017-07-31  3:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Liming Gao, Jeff Fan

Current SEC performance data getting code in FirmwarePerformancePei
may get wrong SEC performance data if FirmwarePerformancePei executes
after memory discovered, it can be removed after SecPerformancePpiCallBack
is added in SecCore.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>

Star Zeng (3):
  UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte
    aligned
  UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
  MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code

 .../FirmwarePerformancePei.c                       | 39 ++--------------
 .../FirmwarePerformancePei.inf                     |  9 +---
 .../FirmwarePerformancePei.uni                     |  6 +--
 UefiCpuPkg/SecCore/SecCore.inf                     |  7 +++
 UefiCpuPkg/SecCore/SecMain.c                       | 53 +++++++++++++++++++++-
 UefiCpuPkg/SecCore/SecMain.h                       | 25 +++++++++-
 6 files changed, 89 insertions(+), 50 deletions(-)

-- 
2.7.0.windows.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned
  2017-07-31  3:31 [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Star Zeng
@ 2017-07-31  3:31 ` Star Zeng
  2017-07-31  4:55   ` Fan, Jeff
  2017-07-31  3:31 ` [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack Star Zeng
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Star Zeng @ 2017-07-31  3:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Liming Gao, Jeff Fan

As HOB which has 8byte aligned requirement will be built based on them
in PEI 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>
---
 UefiCpuPkg/SecCore/SecMain.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c
index 077d0db49f53..a53fa04cc303 100644
--- a/UefiCpuPkg/SecCore/SecMain.c
+++ b/UefiCpuPkg/SecCore/SecMain.c
@@ -1,7 +1,7 @@
 /** @file
   C functions in SEC
 
-  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -230,6 +230,11 @@ SecStartupPhase2(
     ASSERT (SecCoreData->PeiTemporaryRamSize > Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
     SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN) SecCoreData->PeiTemporaryRamBase + Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
     SecCoreData->PeiTemporaryRamSize = SecCoreData->PeiTemporaryRamSize - Index * sizeof (EFI_PEI_PPI_DESCRIPTOR);
+    //
+    // Adjust the Base and Size to be 8-byte aligned.
+    //
+    SecCoreData->PeiTemporaryRamBase = (VOID *)(((UINTN)SecCoreData->PeiTemporaryRamBase + 7) & ~0x07);
+    SecCoreData->PeiTemporaryRamSize &= ~0x07;
   } else {
     //
     // No addition PPI, PpiList directly point to the common PPI list.
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
  2017-07-31  3:31 [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Star Zeng
  2017-07-31  3:31 ` [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned Star Zeng
@ 2017-07-31  3:31 ` Star Zeng
  2017-07-31  4:56   ` Fan, Jeff
  2017-07-31  3:31 ` [PATCH 3/3] MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code Star Zeng
  2017-08-01  9:01 ` [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Gao, Liming
  3 siblings, 1 reply; 7+ messages in thread
From: Star Zeng @ 2017-07-31  3:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Liming Gao, Jeff Fan

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>
---
 UefiCpuPkg/SecCore/SecCore.inf |  7 +++++++
 UefiCpuPkg/SecCore/SecMain.c   | 46 ++++++++++++++++++++++++++++++++++++++++++
 UefiCpuPkg/SecCore/SecMain.h   | 25 ++++++++++++++++++++++-
 3 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf
index 0d135e62ec33..a8f8a6da2728 100644
--- a/UefiCpuPkg/SecCore/SecCore.inf
+++ b/UefiCpuPkg/SecCore/SecCore.inf
@@ -71,6 +71,13 @@ [Ppis]
   ## SOMETIMES_PRODUCES
   gEfiSecPlatformInformation2PpiGuid
   gEfiTemporaryRamDonePpiGuid                          ## PRODUCES
+  ## NOTIFY
+  ## SOMETIMES_CONSUMES
+  gPeiSecPerformancePpiGuid
+
+[Guids]
+  ## SOMETIMES_PRODUCES   ## HOB
+  gEfiFirmwarePerformanceGuid
 
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize  ## CONSUMES
diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c
index a53fa04cc303..3d4e6ac92a5e 100644
--- a/UefiCpuPkg/SecCore/SecMain.c
+++ b/UefiCpuPkg/SecCore/SecMain.c
@@ -22,6 +22,14 @@ EFI_SEC_PLATFORM_INFORMATION_PPI  mSecPlatformInformationPpi = { SecPlatformInfo
 
 EFI_PEI_PPI_DESCRIPTOR            mPeiSecPlatformInformationPpi[] = {
   {
+    //
+    // SecPerformance PPI notify descriptor.
+    //
+    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
+    &gPeiSecPerformancePpiGuid,
+    (VOID *) (UINTN) SecPerformancePpiCallBack
+  },
+  {
     EFI_PEI_PPI_DESCRIPTOR_PPI,
     &gEfiTemporaryRamDonePpiGuid,
     &gSecTemporaryRamDonePpi
@@ -56,6 +64,44 @@ SecStartupPhase2(
   );
 
 /**
+  Entry point of the notification callback function itself within the PEIM.
+  It is to get SEC performance data and build HOB to convey the SEC performance
+  data to DXE phase.
+
+  @param  PeiServices      Indirect reference to the PEI Services Table.
+  @param  NotifyDescriptor Address of the notification descriptor data structure.
+  @param  Ppi              Address of the PPI that was installed.
+
+  @return Status of the notification.
+          The status code returned from this function is ignored.
+**/
+EFI_STATUS
+EFIAPI
+SecPerformancePpiCallBack (
+  IN EFI_PEI_SERVICES           **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID                       *Ppi
+  )
+{
+  EFI_STATUS                    Status;
+  PEI_SEC_PERFORMANCE_PPI       *SecPerf;
+  FIRMWARE_SEC_PERFORMANCE      Performance;
+
+  SecPerf = (PEI_SEC_PERFORMANCE_PPI *) Ppi;
+  Status = SecPerf->GetPerformance (PeiServices, SecPerf, &Performance);
+  if (!EFI_ERROR (Status)) {
+    BuildGuidDataHob (
+      &gEfiFirmwarePerformanceGuid,
+      &Performance,
+      sizeof (FIRMWARE_SEC_PERFORMANCE)
+    );
+    DEBUG ((DEBUG_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", Performance.ResetEnd));
+  }
+
+  return Status;
+}
+
+/**
 
   Entry point to the C language phase of SEC. After the SEC assembly
   code has initialized some temporary memory and set up the stack,
diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
index 6e31a953f757..46c7d41c6e3e 100644
--- a/UefiCpuPkg/SecCore/SecMain.h
+++ b/UefiCpuPkg/SecCore/SecMain.h
@@ -1,7 +1,7 @@
 /** @file
   Master header file for SecCore.
 
-  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -20,6 +20,9 @@
 #include <Ppi/SecPlatformInformation.h>
 #include <Ppi/SecPlatformInformation2.h>
 #include <Ppi/TemporaryRamDone.h>
+#include <Ppi/SecPerformance.h>
+
+#include <Guid/FirmwarePerformance.h>
 
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
@@ -157,4 +160,24 @@ RepublishSecPlatformInformationPpi (
   VOID
   );
 
+/**
+  Entry point of the notification callback function itself within the PEIM.
+  It is to get SEC performance data and build HOB to convey the SEC performance
+  data to DXE phase.
+
+  @param  PeiServices      Indirect reference to the PEI Services Table.
+  @param  NotifyDescriptor Address of the notification descriptor data structure.
+  @param  Ppi              Address of the PPI that was installed.
+
+  @return Status of the notification.
+          The status code returned from this function is ignored.
+**/
+EFI_STATUS
+EFIAPI
+SecPerformancePpiCallBack (
+  IN EFI_PEI_SERVICES           **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID                       *Ppi
+  );
+
 #endif
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code
  2017-07-31  3:31 [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Star Zeng
  2017-07-31  3:31 ` [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned Star Zeng
  2017-07-31  3:31 ` [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack Star Zeng
@ 2017-07-31  3:31 ` Star Zeng
  2017-08-01  9:01 ` [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Gao, Liming
  3 siblings, 0 replies; 7+ messages in thread
From: Star Zeng @ 2017-07-31  3:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Liming Gao

Current SEC performance data getting code in FirmwarePerformancePei
may get wrong SEC performance data if FirmwarePerformancePei executes
after memory discovered.

And as SecCore has added SecPerformancePpiCallBack to get SEC performance
data and build HOB to convey the SEC performance data to DXE phase.

This patch is to remove the SEC performance data getting code in
FirmwarePerformancePei.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../FirmwarePerformancePei.c                       | 39 ++--------------------
 .../FirmwarePerformancePei.inf                     |  9 +----
 .../FirmwarePerformancePei.uni                     |  6 ++--
 3 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
index 396462e7aa97..e4800b7bdd8a 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
@@ -1,13 +1,11 @@
 /** @file
   This module updates S3 Resume Performance Record in ACPI Firmware Performance
-  Data Table in S3 resume boot mode. In normal boot mode, this module consumes
-  SecPerformance PPI produced by SEC phase and build Hob to convey the SEC
-  performance data to DXE phase.
+  Data Table in S3 resume boot mode.
 
   This module register report status code listener to collect performance data
   for S3 Resume Performance Record on S3 resume boot path.
 
-  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -21,7 +19,6 @@
 #include <PiPei.h>
 
 #include <Ppi/ReportStatusCodeHandler.h>
-#include <Ppi/SecPerformance.h>
 
 #include <Guid/FirmwarePerformance.h>
 
@@ -31,7 +28,6 @@
 #include <Library/TimerLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/LockBoxLib.h>
-#include <Library/HobLib.h>
 #include <Library/PcdLib.h>
 
 /**
@@ -79,7 +75,7 @@ FpdtStatusCodeListenerPei (
   // Check whether status code is what we are interested in.
   //
   if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) ||
-  	  (Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE))) {
+      (Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE))) {
     return EFI_UNSUPPORTED;
   }
 
@@ -157,8 +153,6 @@ FirmwarePerformancePeiEntryPoint (
 {
   EFI_STATUS               Status;
   EFI_PEI_RSC_HANDLER_PPI  *RscHandler;
-  PEI_SEC_PERFORMANCE_PPI  *SecPerf;
-  FIRMWARE_SEC_PERFORMANCE Performance;
 
   if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {
     //
@@ -176,32 +170,5 @@ FirmwarePerformancePeiEntryPoint (
     ASSERT_EFI_ERROR (Status);
   }
 
-  //
-  // Normal boot - build Hob for SEC performance data.
-  //
-  Status = PeiServicesLocatePpi (
-             &gPeiSecPerformancePpiGuid,
-             0,
-             NULL,
-             (VOID **) &SecPerf
-             );
-  if (!EFI_ERROR (Status)) {
-    Status = SecPerf->GetPerformance (PeiServices, SecPerf, &Performance);
-  }
-  if (!EFI_ERROR (Status)) {
-    BuildGuidDataHob (
-      &gEfiFirmwarePerformanceGuid,
-      &Performance,
-      sizeof (FIRMWARE_SEC_PERFORMANCE)
-    );
-    DEBUG ((EFI_D_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", Performance.ResetEnd));
-  } else {
-    //
-    // SEC performance PPI is not installed or fail to get performance data
-    // from SEC Performance PPI.
-    //
-    DEBUG ((EFI_D_ERROR, "FPDT: WARNING: SEC Performance PPI not installed or failed!\n"));
-  }
-
   return EFI_SUCCESS;
 }
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf
index 25049f832371..88cd0af8a1b2 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf
@@ -2,13 +2,11 @@
 #  Firmware Performance Pei Module.
 #
 #  In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI Firmware Performance Data Table.
-#  In normal boot mode, it consumes SecPerformance PPI produced by SEC phase
-#  and build Hob to convey the SEC performance data to DXE phase.
 #
 #  This module register report status code listener to collect performance data
 #  for S3 Resume Performance Record on S3 resume boot path.
 #
-#  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -46,7 +44,6 @@ [LibraryClasses]
   PeiServicesLib
   BaseLib
   DebugLib
-  HobLib
   TimerLib
   BaseMemoryLib
   LockBoxLib
@@ -54,13 +51,9 @@ [LibraryClasses]
 
 [Ppis]
   gEfiPeiRscHandlerPpiGuid                      ## CONSUMES
-  gPeiSecPerformancePpiGuid                     ## SOMETIMES_CONSUMES
 
 [Guids]
   ## SOMETIMES_CONSUMES   ## UNDEFINED # RestoreLockBox
-  ## SOMETIMES_PRODUCES   ## HOB
-  ## SOMETIMES_CONSUMES   ## Variable:L"FirmwarePerformance"
-  gEfiFirmwarePerformanceGuid
   gFirmwarePerformanceS3PointerGuid             ## SOMETIMES_CONSUMES ## UNDEFINED # RestoreLockBox
 
 [FeaturePcd]
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.uni b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.uni
index 8e718c0c0126..3ae182c7d65e 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.uni
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.uni
@@ -2,13 +2,11 @@
 // Firmware Performance Pei Module.
 //
 // In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI Firmware Performance Data Table.
-// In normal boot mode, it consumes SecPerformance PPI produced by SEC phase
-// and build Hob to convey the SEC performance data to DXE phase.
 // 
 // This module register report status code listener to collect performance data
 // for S3 Resume Performance Record on S3 resume boot path.
 //
-// Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 //
 // This program and the accompanying materials
 // are licensed and made available under the terms and conditions of the BSD License
@@ -23,5 +21,5 @@
 
 #string STR_MODULE_ABSTRACT             #language en-US "Firmware Performance Pei Module."
 
-#string STR_MODULE_DESCRIPTION          #language en-US "In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI Firmware Performance Data Table. In normal boot mode, it consumes SecPerformance PPI produced by SEC phase and builds a Hob to convey the SEC performance data to DXE phase. This module register report status code listener to collect performance data for S3 Resume Performance Record on S3 resume boot path."
+#string STR_MODULE_DESCRIPTION          #language en-US "In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI Firmware Performance Data Table. This module register report status code listener to collect performance data for S3 Resume Performance Record on S3 resume boot path."
 
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned
  2017-07-31  3:31 ` [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned Star Zeng
@ 2017-07-31  4:55   ` Fan, Jeff
  0 siblings, 0 replies; 7+ messages in thread
From: Fan, Jeff @ 2017-07-31  4:55 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by: Jeff Fan <jeff.fan@intel.com>

-----Original Message-----
From: Zeng, Star 
Sent: Monday, July 31, 2017 11:32 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star; Gao, Liming; Fan, Jeff
Subject: [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned

As HOB which has 8byte aligned requirement will be built based on them in PEI 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>
---
 UefiCpuPkg/SecCore/SecMain.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index 077d0db49f53..a53fa04cc303 100644
--- a/UefiCpuPkg/SecCore/SecMain.c
+++ b/UefiCpuPkg/SecCore/SecMain.c
@@ -1,7 +1,7 @@
 /** @file
   C functions in SEC
 
-  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at @@ -230,6 +230,11 @@ SecStartupPhase2(
     ASSERT (SecCoreData->PeiTemporaryRamSize > Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
     SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN) SecCoreData->PeiTemporaryRamBase + Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
     SecCoreData->PeiTemporaryRamSize = SecCoreData->PeiTemporaryRamSize - Index * sizeof (EFI_PEI_PPI_DESCRIPTOR);
+    //
+    // Adjust the Base and Size to be 8-byte aligned.
+    //
+    SecCoreData->PeiTemporaryRamBase = (VOID *)(((UINTN)SecCoreData->PeiTemporaryRamBase + 7) & ~0x07);
+    SecCoreData->PeiTemporaryRamSize &= ~0x07;
   } else {
     //
     // No addition PPI, PpiList directly point to the common PPI list.
--
2.7.0.windows.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
  2017-07-31  3:31 ` [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack Star Zeng
@ 2017-07-31  4:56   ` Fan, Jeff
  0 siblings, 0 replies; 7+ messages in thread
From: Fan, Jeff @ 2017-07-31  4:56 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by: Jeff Fan <jeff.fan@intel.com>

-----Original Message-----
From: Zeng, Star 
Sent: Monday, July 31, 2017 11:32 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star; Gao, Liming; Fan, Jeff
Subject: [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack

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>
---
 UefiCpuPkg/SecCore/SecCore.inf |  7 +++++++
 UefiCpuPkg/SecCore/SecMain.c   | 46 ++++++++++++++++++++++++++++++++++++++++++
 UefiCpuPkg/SecCore/SecMain.h   | 25 ++++++++++++++++++++++-
 3 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf index 0d135e62ec33..a8f8a6da2728 100644
--- a/UefiCpuPkg/SecCore/SecCore.inf
+++ b/UefiCpuPkg/SecCore/SecCore.inf
@@ -71,6 +71,13 @@ [Ppis]
   ## SOMETIMES_PRODUCES
   gEfiSecPlatformInformation2PpiGuid
   gEfiTemporaryRamDonePpiGuid                          ## PRODUCES
+  ## NOTIFY
+  ## SOMETIMES_CONSUMES
+  gPeiSecPerformancePpiGuid
+
+[Guids]
+  ## SOMETIMES_PRODUCES   ## HOB
+  gEfiFirmwarePerformanceGuid
 
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize  ## CONSUMES diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index a53fa04cc303..3d4e6ac92a5e 100644
--- a/UefiCpuPkg/SecCore/SecMain.c
+++ b/UefiCpuPkg/SecCore/SecMain.c
@@ -22,6 +22,14 @@ EFI_SEC_PLATFORM_INFORMATION_PPI  mSecPlatformInformationPpi = { SecPlatformInfo
 
 EFI_PEI_PPI_DESCRIPTOR            mPeiSecPlatformInformationPpi[] = {
   {
+    //
+    // SecPerformance PPI notify descriptor.
+    //
+    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
+    &gPeiSecPerformancePpiGuid,
+    (VOID *) (UINTN) SecPerformancePpiCallBack  },  {
     EFI_PEI_PPI_DESCRIPTOR_PPI,
     &gEfiTemporaryRamDonePpiGuid,
     &gSecTemporaryRamDonePpi
@@ -56,6 +64,44 @@ SecStartupPhase2(
   );
 
 /**
+  Entry point of the notification callback function itself within the PEIM.
+  It is to get SEC performance data and build HOB to convey the SEC 
+ performance  data to DXE phase.
+
+  @param  PeiServices      Indirect reference to the PEI Services Table.
+  @param  NotifyDescriptor Address of the notification descriptor data structure.
+  @param  Ppi              Address of the PPI that was installed.
+
+  @return Status of the notification.
+          The status code returned from this function is ignored.
+**/
+EFI_STATUS
+EFIAPI
+SecPerformancePpiCallBack (
+  IN EFI_PEI_SERVICES           **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID                       *Ppi
+  )
+{
+  EFI_STATUS                    Status;
+  PEI_SEC_PERFORMANCE_PPI       *SecPerf;
+  FIRMWARE_SEC_PERFORMANCE      Performance;
+
+  SecPerf = (PEI_SEC_PERFORMANCE_PPI *) Ppi;  Status = 
+ SecPerf->GetPerformance (PeiServices, SecPerf, &Performance);  if 
+ (!EFI_ERROR (Status)) {
+    BuildGuidDataHob (
+      &gEfiFirmwarePerformanceGuid,
+      &Performance,
+      sizeof (FIRMWARE_SEC_PERFORMANCE)
+    );
+    DEBUG ((DEBUG_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", 
+ Performance.ResetEnd));  }
+
+  return Status;
+}
+
+/**
 
   Entry point to the C language phase of SEC. After the SEC assembly
   code has initialized some temporary memory and set up the stack, diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h index 6e31a953f757..46c7d41c6e3e 100644
--- a/UefiCpuPkg/SecCore/SecMain.h
+++ b/UefiCpuPkg/SecCore/SecMain.h
@@ -1,7 +1,7 @@
 /** @file
   Master header file for SecCore.
 
-  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at @@ -20,6 +20,9 @@  #include <Ppi/SecPlatformInformation.h>  #include <Ppi/SecPlatformInformation2.h>  #include <Ppi/TemporaryRamDone.h>
+#include <Ppi/SecPerformance.h>
+
+#include <Guid/FirmwarePerformance.h>
 
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
@@ -157,4 +160,24 @@ RepublishSecPlatformInformationPpi (
   VOID
   );
 
+/**
+  Entry point of the notification callback function itself within the PEIM.
+  It is to get SEC performance data and build HOB to convey the SEC 
+performance
+  data to DXE phase.
+
+  @param  PeiServices      Indirect reference to the PEI Services Table.
+  @param  NotifyDescriptor Address of the notification descriptor data structure.
+  @param  Ppi              Address of the PPI that was installed.
+
+  @return Status of the notification.
+          The status code returned from this function is ignored.
+**/
+EFI_STATUS
+EFIAPI
+SecPerformancePpiCallBack (
+  IN EFI_PEI_SERVICES           **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID                       *Ppi
+  );
+
 #endif
--
2.7.0.windows.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore
  2017-07-31  3:31 [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Star Zeng
                   ` (2 preceding siblings ...)
  2017-07-31  3:31 ` [PATCH 3/3] MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code Star Zeng
@ 2017-08-01  9:01 ` Gao, Liming
  3 siblings, 0 replies; 7+ messages in thread
From: Gao, Liming @ 2017-08-01  9:01 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Fan, Jeff

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zeng, Star
>Sent: Monday, July 31, 2017 11:32 AM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>;
>Fan, Jeff <jeff.fan@intel.com>
>Subject: [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance
>data in SecCore
>
>Current SEC performance data getting code in FirmwarePerformancePei
>may get wrong SEC performance data if FirmwarePerformancePei executes
>after memory discovered, it can be removed after
>SecPerformancePpiCallBack
>is added in SecCore.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Jeff Fan <jeff.fan@intel.com>
>
>Star Zeng (3):
>  UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte
>    aligned
>  UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
>  MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting
>code
>
> .../FirmwarePerformancePei.c                       | 39 ++--------------
> .../FirmwarePerformancePei.inf                     |  9 +---
> .../FirmwarePerformancePei.uni                     |  6 +--
> UefiCpuPkg/SecCore/SecCore.inf                     |  7 +++
> UefiCpuPkg/SecCore/SecMain.c                       | 53 +++++++++++++++++++++-
> UefiCpuPkg/SecCore/SecMain.h                       | 25 +++++++++-
> 6 files changed, 89 insertions(+), 50 deletions(-)
>
>--
>2.7.0.windows.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-01  9:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-31  3:31 [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Star Zeng
2017-07-31  3:31 ` [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned Star Zeng
2017-07-31  4:55   ` Fan, Jeff
2017-07-31  3:31 ` [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack Star Zeng
2017-07-31  4:56   ` Fan, Jeff
2017-07-31  3:31 ` [PATCH 3/3] MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code Star Zeng
2017-08-01  9:01 ` [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox