public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver
@ 2018-07-30  7:00 Dandan Bi
  2018-07-30  7:00 ` [patch 1/2] MdeModulePkg: Add definition of Boot Performance Table protocol Dandan Bi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dandan Bi @ 2018-07-30  7:00 UTC (permalink / raw)
  To: edk2-devel; +Cc: Dmitry Antipov, Michael D Kinney, Liming Gao, Star Zeng

Add an internal protocol Firmware Boot Performance Table protocol to
get the performance data from DxeCorePerformanceLib.
Thus the FirmwarePerformanceDxe driver can call the API in the
new protocl to get the performance data instead of through
hook status code.

Cc: Dmitry Antipov <dmanti@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Dandan Bi (2):
  MdeModulePkg: Add definition of Boot Performance Table protocol
  MdeModulePkg: Implement/use Boot Performance Table protocol

 .../Include/Guid/FirmwareBootPerformanceTable.h    | 47 ++++++++++++++
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 74 ++++++----------------
 .../DxeCorePerformanceLib.inf                      |  6 +-
 .../DxeCorePerformanceLibInternal.h                | 15 +++++
 MdeModulePkg/MdeModulePkg.dec                      |  4 ++
 .../FirmwarePerformanceDxe.c                       | 71 ++++++++++++++++-----
 .../FirmwarePerformanceDxe.inf                     |  5 +-
 7 files changed, 144 insertions(+), 78 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/FirmwareBootPerformanceTable.h

-- 
2.14.3.windows.1



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

* [patch 1/2] MdeModulePkg: Add definition of Boot Performance Table protocol
  2018-07-30  7:00 [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Dandan Bi
@ 2018-07-30  7:00 ` Dandan Bi
  2018-07-30  7:00 ` [patch 2/2] MdeModulePkg: Implement/use " Dandan Bi
  2018-08-03  9:39 ` [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Dandan Bi @ 2018-07-30  7:00 UTC (permalink / raw)
  To: edk2-devel; +Cc: Dmitry Antipov, Michael D Kinney, Liming Gao, Star Zeng

Add an internal protocol to get the boot performance data,
which is used by driver FirmwarePerformanceDxe to get the
performance data from performance library (DxeCorePerformanceLib).

Cc: Dmitry Antipov <dmanti@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../Include/Guid/FirmwareBootPerformanceTable.h    | 47 ++++++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                      |  4 ++
 2 files changed, 51 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/FirmwareBootPerformanceTable.h

diff --git a/MdeModulePkg/Include/Guid/FirmwareBootPerformanceTable.h b/MdeModulePkg/Include/Guid/FirmwareBootPerformanceTable.h
new file mode 100644
index 0000000000..61a21445c7
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/FirmwareBootPerformanceTable.h
@@ -0,0 +1,47 @@
+/** @file
+
+Firmware Boot Performance Table Protocol.
+
+Copyright (c) 2018, 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 that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _FIRMWARE_BOOT_PERFORMANCE_TABLE_H_
+#define _FIRMWARE_BOOT_PERFORMANCE_TABLE_H_
+
+//
+// GUID for get firmware boot performance table Protocol
+//
+#define FIRMWARE_BOOT_PERFORMANCE_TABLE_PROTOCOL_GUID \
+  { 0xffc182cf, 0xb0da, 0x4e81, {0xaf, 0xf8, 0x45, 0x0d, 0xab, 0x6d, 0xc9, 0xa7 } }
+
+typedef struct _EDKII_FIRMWARE_BOOT_PERFORMANCE_TABLE_PROTOCOL EDKII_FIRMWARE_BOOT_PERFORMANCE_TABLE_PROTOCOL;
+
+/**
+  Get the address of the Firmware Boot Performance Table.
+
+  @param BootPerformanceTable   - Pointer to the address of firmware boot performance table.
+
+  @retval EFI_SUCCESS           - Successfully created performance record.
+  @retval EFI_OUT_OF_RESOURCES  - Ran out of space to store the records.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *GET_FIRMWARE_BOOT_PERFORMANCE_TABLE)(
+  OUT VOID                   **BootPerformanceTable
+  );
+
+struct _EDKII_FIRMWARE_BOOT_PERFORMANCE_TABLE_PROTOCOL {
+  GET_FIRMWARE_BOOT_PERFORMANCE_TABLE GetFirmwareBootPerformanceTable;
+};
+
+extern EFI_GUID gEdkiiFirmwareBootPerformanceTableProtocolGuid;
+
+#endif // _FIRMWARE_BOOT_PERFORMANCE_TABLE_H_
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 3db97f536e..5faebe5457 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -263,10 +263,14 @@
   #  Include/Guid/PerformanceMeasurement.h
   gEdkiiPerformanceMeasurementProtocolGuid      = { 0xc85d06be, 0x5f75, 0x48ce, { 0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } }
   gEdkiiSmmPerformanceMeasurementProtocolGuid   = { 0xd56b6d73, 0x1a7b, 0x4015, { 0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } }
   gEdkiiPerformanceMeasurementPpiGuid           = { 0x0eca9ae3, 0xa792, 0x418c, { 0xbd, 0x36, 0X6c, 0x2e, 0xca, 0x5c, 0x59, 0xfc } }
 
+  ## Protocol to get firmware boot performance table.
+  #  Include/Guid/FirmwareBootPerformanceTable.h
+  gEdkiiFirmwareBootPerformanceTableProtocolGuid = { 0xffc182cf, 0xb0da, 0x4e81, { 0xaf, 0xf8, 0x45, 0x0d, 0xab, 0x6d, 0xc9, 0xa7 } }
+
   ## Guid is defined for CRC32 encapsulation scheme.
   #  Include/Guid/Crc32GuidedSectionExtraction.h
   gEfiCrc32GuidedSectionExtractionGuid = { 0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } }
 
   ## Include/Guid/StatusCodeCallbackGuid.h
-- 
2.14.3.windows.1



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

* [patch 2/2] MdeModulePkg: Implement/use Boot Performance Table protocol
  2018-07-30  7:00 [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Dandan Bi
  2018-07-30  7:00 ` [patch 1/2] MdeModulePkg: Add definition of Boot Performance Table protocol Dandan Bi
@ 2018-07-30  7:00 ` Dandan Bi
  2018-08-03  9:39 ` [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Dandan Bi @ 2018-07-30  7:00 UTC (permalink / raw)
  To: edk2-devel; +Cc: Dmitry Antipov, Michael D Kinney, Liming Gao, Star Zeng

1.Update DxeCorePerformanceLib to implement the Firmware
Boot performance Table protocol.

2. Update FirmwarePerformanceDxe to use Boot performance
Table protocol get Performance data from DxeCorePerformanceLib

Cc: Dmitry Antipov <dmanti@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 74 ++++++----------------
 .../DxeCorePerformanceLib.inf                      |  6 +-
 .../DxeCorePerformanceLibInternal.h                | 15 +++++
 .../FirmwarePerformanceDxe.c                       | 71 ++++++++++++++++-----
 .../FirmwarePerformanceDxe.inf                     |  5 +-
 5 files changed, 93 insertions(+), 78 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 5798c89fff..7a46be5304 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -88,10 +88,17 @@ EFI_DEVICE_PATH_TO_TEXT_PROTOCOL  *mDevicePathToText = NULL;
 //
 EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL mPerformanceMeasurementInterface = {
   CreatePerformanceMeasurement,
   };
 
+//
+// Interfaces for Firmware Boot Performance Table Protocol.
+//
+EDKII_FIRMWARE_BOOT_PERFORMANCE_TABLE_PROTOCOL mBootPerformanceProtocolInterface = {
+  GetFirmwareBootPerformanceTable,
+  };
+
 PERFORMANCE_PROPERTY  mPerformanceProperty;
 
 /**
   Return the pointer to the FPDT record in the allocated memory.
 
@@ -209,17 +216,21 @@ IsKnownID (
     return FALSE;
   }
 }
 
 /**
-  Allocate buffer for Boot Performance table.
+  Get the address of the Firmware Boot Performance Table.
 
-  @return Status code.
+  @param BootPerformanceTable   - Pointer to the address of firmware boot performance table.
 
+  @retval EFI_SUCCESS           - Successfully created performance record.
+  @retval EFI_OUT_OF_RESOURCES  - Ran out of space to store the records.
 **/
 EFI_STATUS
-AllocateBootPerformanceTable (
+EFIAPI
+GetFirmwareBootPerformanceTable (
+  OUT VOID                   **BootPerformanceTable
   )
 {
   EFI_STATUS                              Status;
   UINTN                                   Size;
   UINT8                                   *SmmBootRecordCommBuffer;
@@ -403,10 +414,12 @@ AllocateBootPerformanceTable (
 
   mBootRecordBuffer  = (UINT8 *) mAcpiBootPerformanceTable;
   mBootRecordSize    = mAcpiBootPerformanceTable->Header.Length;
   mBootRecordMaxSize = mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);
 
+  mFpdtBufferIsReported = TRUE;
+  *BootPerformanceTable = mAcpiBootPerformanceTable;
   return EFI_SUCCESS;
 }
 
 /**
   Get a human readable module name and module guid for the given image handle.
@@ -1302,48 +1315,10 @@ InternalGetPeiPerformance (
     //
     GuidHob = GetNextGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, GET_NEXT_HOB (GuidHob));
   }
 }
 
-/**
-  Report Boot Perforamnce table address as report status code.
-
-  @param  Event    The event of notify protocol.
-  @param  Context  Notify event context.
-
-**/
-VOID
-EFIAPI
-ReportFpdtRecordBuffer (
-  IN EFI_EVENT     Event,
-  IN VOID          *Context
-  )
-{
-  EFI_STATUS      Status;
-  UINT64          BPDTAddr;
-
-  if (!mFpdtBufferIsReported) {
-    Status = AllocateBootPerformanceTable ();
-    if (!EFI_ERROR(Status)) {
-      BPDTAddr = (UINT64)(UINTN)mAcpiBootPerformanceTable;
-      REPORT_STATUS_CODE_EX (
-          EFI_PROGRESS_CODE,
-          EFI_SOFTWARE_DXE_BS_DRIVER,
-          0,
-          NULL,
-          &gEdkiiFpdtExtendedFirmwarePerformanceGuid,
-          &BPDTAddr,
-          sizeof (UINT64)
-          );
-    }
-    //
-    // Set FPDT report state to TRUE.
-    //
-    mFpdtBufferIsReported = TRUE;
-  }
-}
-
 /**
   The constructor function initializes Performance infrastructure for DXE phase.
 
   The constructor function publishes Performance and PerformanceEx protocol, allocates memory to log DXE performance
   and merges PEI performance data to DXE performance log.
@@ -1362,11 +1337,10 @@ DxeCorePerformanceLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS                Status;
   EFI_HANDLE                Handle;
-  EFI_EVENT                 ReadyToBootEvent;
   PERFORMANCE_PROPERTY      *PerformanceProperty;
 
   if (!PerformanceMeasurementEnabled ()) {
     //
     // Do not initialize performance infrastructure if not required.
@@ -1385,28 +1359,16 @@ DxeCorePerformanceLibConstructor (
   Handle = NULL;
   Status = gBS->InstallMultipleProtocolInterfaces (
                   &Handle,
                   &gEdkiiPerformanceMeasurementProtocolGuid,
                   &mPerformanceMeasurementInterface,
+                  &gEdkiiFirmwareBootPerformanceTableProtocolGuid,
+                  &mBootPerformanceProtocolInterface,
                   NULL
                   );
   ASSERT_EFI_ERROR (Status);
 
-  //
-  // Register ReadyToBoot event to report StatusCode data
-  //
-  Status = gBS->CreateEventEx (
-                  EVT_NOTIFY_SIGNAL,
-                  TPL_CALLBACK,
-                  ReportFpdtRecordBuffer,
-                  NULL,
-                  &gEfiEventReadyToBootGuid,
-                  &ReadyToBootEvent
-                  );
-
-  ASSERT_EFI_ERROR (Status);
-
   Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty);
   if (EFI_ERROR (Status)) {
     //
     // Install configuration table for performance property.
     //
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 8fab47ff02..85963263f3 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -71,13 +71,13 @@
   ## PRODUCES             ## SystemTable
   gPerformanceProtocolGuid
   gZeroGuid                                     ## SOMETIMES_CONSUMES ## GUID
   gEfiFirmwarePerformanceGuid                   ## SOMETIMES_PRODUCES ## UNDEFINED # StatusCode Data
   gEdkiiFpdtExtendedFirmwarePerformanceGuid     ## SOMETIMES_CONSUMES ## HOB # StatusCode Data
-  gEfiEventReadyToBootGuid                      ## CONSUMES           ## Event
-  gEdkiiPiSmmCommunicationRegionTableGuid       ## SOMETIMES_CONSUMES    ## SystemTable
-  gEdkiiPerformanceMeasurementProtocolGuid      ## PRODUCES           ## UNDEFINED # Install protocol
+  gEdkiiPiSmmCommunicationRegionTableGuid           ## SOMETIMES_CONSUMES    ## SystemTable
+  gEdkiiPerformanceMeasurementProtocolGuid          ## PRODUCES              ## UNDEFINED # Install protocol
+  gEdkiiFirmwareBootPerformanceTableProtocolGuid    ## PRODUCES              ## UNDEFINED # Install protocol
 
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask         ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdEdkiiFpdtStringRecordEnableOnly  ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize         ## CONSUMES
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
index 2b214e2e57..767c0f7888 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
@@ -21,10 +21,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 #include <PiDxe.h>
 
 #include <Guid/Performance.h>
 #include <Guid/PerformanceMeasurement.h>
+#include <Guid/FirmwareBootPerformanceTable.h>
 #include <Guid/ExtendedFirmwarePerformance.h>
 #include <Guid/ZeroGuid.h>
 #include <Guid/EventGroup.h>
 #include <Guid/FirmwarePerformance.h>
 #include <Guid/PiSmmCommunicationRegionTable.h>
@@ -49,10 +50,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiLib.h>
 #include <Library/ReportStatusCodeLib.h>
 #include <Library/DxeServicesLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 
+/**
+  Get the address of the Firmware Boot Performance Table.
+
+  @param BootPerformanceTable   - Pointer to the address of firmware boot performance table.
+
+  @retval EFI_SUCCESS           - Successfully created performance record.
+  @retval EFI_OUT_OF_RESOURCES  - Ran out of space to store the records.
+**/
+EFI_STATUS
+EFIAPI
+GetFirmwareBootPerformanceTable (
+  OUT VOID                   **BootPerformanceTable
+  );
+
 /**
   Create performance record with event description and a timestamp.
 
   @param CallerIdentifier  - Image handle or pointer to caller ID GUID.
   @param Guid              - Pointer to a GUID.
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
index 3d8e83250e..1f924fbb37 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
@@ -23,10 +23,12 @@
 #include <Protocol/LockBox.h>
 #include <Protocol/Variable.h>
 
 #include <Guid/Acpi.h>
 #include <Guid/FirmwarePerformance.h>
+#include <Guid/FirmwareBootPerformanceTable.h>
+
 #include <Guid/EventGroup.h>
 #include <Guid/EventLegacyBios.h>
 
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/UefiRuntimeServicesTableLib.h>
@@ -284,15 +286,27 @@ FpdtAllocateS3PerformanceTableMemory (
 EFI_STATUS
 InstallFirmwarePerformanceDataTable (
   VOID
   )
 {
-  EFI_STATUS                    Status;
-  EFI_ACPI_TABLE_PROTOCOL       *AcpiTableProtocol;
-  UINTN                         BootPerformanceDataSize;
-  FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
-  UINTN                         Size;
+  EFI_STATUS                                       Status;
+  EFI_ACPI_TABLE_PROTOCOL                          *AcpiTableProtocol;
+  UINTN                                            BootPerformanceDataSize;
+  FIRMWARE_PERFORMANCE_VARIABLE                    PerformanceVariable;
+  UINTN                                            Size;
+  EDKII_FIRMWARE_BOOT_PERFORMANCE_TABLE_PROTOCOL   *FirmwareBootPerformanceTableProtocol;
+
+  //
+  // Locate FirmwareBootPerformanceTable protocol.
+  //
+  Status =  gBS->LocateProtocol (&gEdkiiFirmwareBootPerformanceTableProtocolGuid, NULL, (VOID **) &FirmwareBootPerformanceTableProtocol);
+  if (!EFI_ERROR (Status)) {
+     Status =FirmwareBootPerformanceTableProtocol->GetFirmwareBootPerformanceTable((VOID **)&mReceivedAcpiBootPerformanceTable);
+  }
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   //
   // Get AcpiTable Protocol.
   //
   Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
@@ -507,22 +521,10 @@ FpdtStatusCodeListenerDxe (
     DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
     DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = 0\n"));
     DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
     DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = 0\n"));
     DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit    = 0\n"));
-  } else if (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)) {
-    if (mAcpiBootPerformanceTable == NULL) {
-      //
-      // ACPI Firmware Performance Data Table not installed yet, install it now.
-      //
-      InstallFirmwarePerformanceDataTable ();
-    }
-  } else if (Data != NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmwarePerformanceGuid)) {
-    //
-    // Get the Boot performance table and then install it to ACPI table.
-    //
-    CopyMem (&mReceivedAcpiBootPerformanceTable, Data + 1, Data->Size);
   } else if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
     DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerDxe: Performance data reported through gEfiFirmwarePerformanceGuid will not be collected by FirmwarePerformanceDataTableDxe\n"));
     Status = EFI_UNSUPPORTED;
   } else {
     //
@@ -532,10 +534,32 @@ FpdtStatusCodeListenerDxe (
   }
 
   return Status;
 }
 
+/**
+  Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to
+  install the Firmware Performance Data Table.
+
+  @param[in]  Event   The Event that is being processed.
+  @param[in]  Context The Event Context.
+
+**/
+VOID
+EFIAPI
+FpdtReadyToBootEventNotify (
+  IN EFI_EVENT        Event,
+  IN VOID             *Context
+  )
+{
+  if (mAcpiBootPerformanceTable == NULL) {
+    //
+    // ACPI Firmware Performance Data Table not installed yet, install it now.
+    //
+    InstallFirmwarePerformanceDataTable ();
+  }
+}
 
 /**
   Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to record
   performance data for ExitBootServicesEntry in FPDT.
 
@@ -639,10 +663,23 @@ FirmwarePerformanceDxeEntryPoint (
                   &gEfiEventExitBootServicesGuid,
                   &mExitBootServicesEvent
                   );
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Register the notify function to install firmware performance table.
+  //
+  Status = gBS->CreateEventEx (
+                  EVT_NOTIFY_SIGNAL,
+                  TPL_CALLBACK,
+                  FpdtReadyToBootEventNotify,
+                  NULL,
+                  &gEfiEventReadyToBootGuid,
+                  &mReadyToBootEvent
+                  );
+  ASSERT_EFI_ERROR (Status);
+
   //
   // Retrieve GUID HOB data that contains the ResetEnd.
   //
   GuidHob = GetFirstGuidHob (&gEfiFirmwarePerformanceGuid);
   if (GuidHob != NULL) {
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
index 843cda7021..6f4e8e85fe 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
@@ -67,12 +67,13 @@
   ## SOMETIMES_CONSUMES   ## Variable:L"FirmwarePerformance"
   ## PRODUCES             ## Variable:L"FirmwarePerformance"
   ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication
   ## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data
   gEfiFirmwarePerformanceGuid
-  gEdkiiFpdtExtendedFirmwarePerformanceGuid     ## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data
-  gFirmwarePerformanceS3PointerGuid             ## PRODUCES ## UNDEFINED # SaveLockBox
+  gEdkiiFpdtExtendedFirmwarePerformanceGuid       ## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data
+  gFirmwarePerformanceS3PointerGuid               ## PRODUCES ## UNDEFINED # SaveLockBox
+  gEdkiiFirmwareBootPerformanceTableProtocolGuid  ## CONSUMES # Loacte protocol
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad    ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart   ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize    ## CONSUMES
-- 
2.14.3.windows.1



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

* Re: [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver
  2018-07-30  7:00 [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Dandan Bi
  2018-07-30  7:00 ` [patch 1/2] MdeModulePkg: Add definition of Boot Performance Table protocol Dandan Bi
  2018-07-30  7:00 ` [patch 2/2] MdeModulePkg: Implement/use " Dandan Bi
@ 2018-08-03  9:39 ` Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Gao, Liming @ 2018-08-03  9:39 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org
  Cc: Dmitry Antipov, Kinney, Michael D, Zeng, Star

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

>-----Original Message-----
>From: Bi, Dandan
>Sent: Monday, July 30, 2018 3:00 PM
>To: edk2-devel@lists.01.org
>Cc: Dmitry Antipov <dmanti@microsoft.com>; Kinney, Michael D
><michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>; Zeng,
>Star <star.zeng@intel.com>
>Subject: [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and
>driver
>
>Add an internal protocol Firmware Boot Performance Table protocol to
>get the performance data from DxeCorePerformanceLib.
>Thus the FirmwarePerformanceDxe driver can call the API in the
>new protocl to get the performance data instead of through
>hook status code.
>
>Cc: Dmitry Antipov <dmanti@microsoft.com>
>Cc: Michael D Kinney <michael.d.kinney@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Star Zeng <star.zeng@intel.com>
>Dandan Bi (2):
>  MdeModulePkg: Add definition of Boot Performance Table protocol
>  MdeModulePkg: Implement/use Boot Performance Table protocol
>
> .../Include/Guid/FirmwareBootPerformanceTable.h    | 47 ++++++++++++++
> .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 74 ++++++-----------
>-----
> .../DxeCorePerformanceLib.inf                      |  6 +-
> .../DxeCorePerformanceLibInternal.h                | 15 +++++
> MdeModulePkg/MdeModulePkg.dec                      |  4 ++
> .../FirmwarePerformanceDxe.c                       | 71 ++++++++++++++++-----
> .../FirmwarePerformanceDxe.inf                     |  5 +-
> 7 files changed, 144 insertions(+), 78 deletions(-)
> create mode 100644
>MdeModulePkg/Include/Guid/FirmwareBootPerformanceTable.h
>
>--
>2.14.3.windows.1



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

end of thread, other threads:[~2018-08-03  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-30  7:00 [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Dandan Bi
2018-07-30  7:00 ` [patch 1/2] MdeModulePkg: Add definition of Boot Performance Table protocol Dandan Bi
2018-07-30  7:00 ` [patch 2/2] MdeModulePkg: Implement/use " Dandan Bi
2018-08-03  9:39 ` [patch 0/2] Enahnce Perf data transfer between Dxe Perf Lib and driver Gao, Liming

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