Revision: 16470
          http://sourceforge.net/p/edk2/code/16470
Author:   lgao4
Date:     2014-12-03 15:34:08 +0000 (Wed, 03 Dec 2014)
Log Message:
-----------
MdeModulePkg: Unregister DXE FpdtStatusCodeHandler.

DXE FpdtStatusCodeHandler is required to be unregistered even if 
StatusCodeReport is disabled. This change makes sure FpdtStatusCodeHandler be 
always unregistered.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
Reviewed-by: Vincent Zimmer <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c

Modified: 
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
===================================================================
--- 
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
     2014-12-03 08:30:56 UTC (rev 16469)
+++ 
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
     2014-12-03 15:34:08 UTC (rev 16470)
@@ -54,6 +54,7 @@
 UINT32                      mBootRecordSize = 0;
 UINT32                      mBootRecordMaxSize = 0;
 UINT8                       *mBootRecordBuffer = NULL;
+BOOLEAN                     mDxeCoreReportStatusCodeEnable = FALSE;
 
 BOOT_PERFORMANCE_TABLE                      *mAcpiBootPerformanceTable = NULL;
 S3_PERFORMANCE_TABLE                        *mAcpiS3PerformanceTable   = NULL;
@@ -595,45 +596,6 @@
 }
 
 /**
-  Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to 
record
-  performance data for ExitBootServicesEntry in FPDT.
-
-  @param[in]  Event   The Event that is being processed.
-  @param[in]  Context The Event Context.
-
-**/
-VOID
-EFIAPI
-FpdtExitBootServicesEventNotify (
-  IN EFI_EVENT        Event,
-  IN VOID             *Context
-  )
-{
-  if (mAcpiBootPerformanceTable == NULL) {
-    //
-    // Firmware Performance Data Table not installed, do nothing.
-    //
-    return ;
-  }
-
-  //
-  // Update Firmware Basic Boot Performance Record for UEFI boot.
-  //
-  mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry = 
GetTimeInNanoSecond (GetPerformanceCounter ());
-
-  //
-  // Dump FPDT Boot Performance record.
-  //
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry));
-  //
-  // ExitBootServicesExit will be updated later, so don't dump it here.
-  //
-}
-
-/**
   Report status code listener of FPDT. This is used to collect performance data
   for OsLoaderLoadImageStart and OsLoaderStartImageStart in FPDT.
 
@@ -670,6 +632,13 @@
   if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) {
     return EFI_UNSUPPORTED;
   }
+  
+  if (Value == (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT)) {
+    //
+    // DxeCore ReportStatusCode Enable so that the capability can be supported.
+    //
+    mDxeCoreReportStatusCodeEnable = TRUE;
+  }
 
   Status = EFI_SUCCESS;
   if (Value == PcdGet32 (PcdProgressCodeOsLoaderLoad)) {
@@ -698,6 +667,11 @@
     mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart = 
GetTimeInNanoSecond (GetPerformanceCounter ());
   } else if (Value == (EFI_SOFTWARE_EFI_BOOT_SERVICE | 
EFI_SW_BS_PC_EXIT_BOOT_SERVICES)) {
     //
+    // Unregister boot time report status code listener.
+    //
+    mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
+
+    //
     // Progress code for ExitBootServices.
     //
     if (mAcpiBootPerformanceTable == NULL) {
@@ -708,11 +682,6 @@
     // Update ExitBootServicesExit for UEFI boot.
     //
     mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesExit = 
GetTimeInNanoSecond (GetPerformanceCounter ());
-
-    //
-    // Unregister boot time report status code listener.
-    //
-    mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
   } else if (Data != NULL && CompareGuid (&Data->Type, 
&gEfiFirmwarePerformanceGuid)) {
     //
     // Append one or more Boot records
@@ -759,7 +728,55 @@
   return Status;
 }
 
+
 /**
+  Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to 
record
+  performance data for ExitBootServicesEntry in FPDT.
+
+  @param[in]  Event   The Event that is being processed.
+  @param[in]  Context The Event Context.
+
+**/
+VOID
+EFIAPI
+FpdtExitBootServicesEventNotify (
+  IN EFI_EVENT        Event,
+  IN VOID             *Context
+  )
+{
+  if (mDxeCoreReportStatusCodeEnable == FALSE) {
+    //
+    // When DxeCore Report Status Code is disabled, 
+    // Unregister boot time report status code listener at ExitBootService 
Event.
+    //
+    mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
+  }
+
+  if (mAcpiBootPerformanceTable == NULL) {
+    //
+    // Firmware Performance Data Table not installed, do nothing.
+    //
+    return ;
+  }
+
+  //
+  // Update Firmware Basic Boot Performance Record for UEFI boot.
+  //
+  mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry = 
GetTimeInNanoSecond (GetPerformanceCounter ());
+
+  //
+  // Dump FPDT Boot Performance record.
+  //
+  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
+  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart));
+  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
+  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry));
+  //
+  // ExitBootServicesExit will be updated later, so don't dump it here.
+  //
+}
+
+/**
   The module Entry Point of the Firmware Performance Data Table DXE driver.
 
   @param[in]  ImageHandle    The firmware allocated handle for the EFI image.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to