diff options
author | Liming Gao <liming.gao@intel.com> | 2014-12-03 15:34:08 +0000 |
---|---|---|
committer | lgao4 <lgao4@Edk2> | 2014-12-03 15:34:08 +0000 |
commit | 40a0f8cb78cb6728039465b92d6808d262d2d110 (patch) | |
tree | ef0cf4f3996b63197063f4f3647b975d1bff01d8 /MdeModulePkg/Universal/Acpi | |
parent | 8546dfeace040f9f6547cb1b44651a44b8b9670e (diff) | |
download | edk2-platforms-40a0f8cb78cb6728039465b92d6808d262d2d110.tar.xz |
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 <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Vincent Zimmer <vincent.zimmer@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16470 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Acpi')
-rw-r--r-- | MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c | 105 |
1 files changed, 61 insertions, 44 deletions
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c index caf924ccf8..b1801a70f8 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c @@ -54,6 +54,7 @@ UINTN mFirmwarePerformanceTableTemplateKey = 0; 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 @@ FpdtLegacyBootEventNotify ( }
/**
- 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 @@ FpdtStatusCodeListenerDxe ( 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 @@ FpdtStatusCodeListenerDxe ( 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 @@ FpdtStatusCodeListenerDxe ( // 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,6 +728,54 @@ FpdtStatusCodeListenerDxe ( 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.
|