From 9ae650ef6ca9372199adb31fb3432ed8cde353ad Mon Sep 17 00:00:00 2001 From: xli24 Date: Wed, 30 Dec 2009 09:05:31 +0000 Subject: Make use of UefiRuntimeLib for refinement. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9647 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ReportStatusCodeLibInternal.h | 1 + .../RuntimeDxeReportStatusCodeLib.inf | 2 +- .../RuntimeDxeSupport.c | 52 ++++------------------ 3 files changed, 11 insertions(+), 44 deletions(-) (limited to 'MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib') diff --git a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLibInternal.h b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLibInternal.h index 38e69d2343..2ae0be4fd3 100644 --- a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLibInternal.h +++ b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLibInternal.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf index 221ea74c14..5ba91064c0 100644 --- a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf +++ b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf @@ -48,11 +48,11 @@ OemHookStatusCodeLib DevicePathLib MemoryAllocationLib + UefiRuntimeLib [Guids] gEfiStatusCodeSpecificDataGuid ## CONSUMES gEfiStatusCodeDataTypeDebugGuid ## CONSUMES - gEfiEventExitBootServicesGuid ## CONSUMES ## Event gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event diff --git a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeSupport.c b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeSupport.c index 9ebf972213..fd9f8f7a2e 100644 --- a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeSupport.c +++ b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeSupport.c @@ -14,11 +14,9 @@ #include "ReportStatusCodeLibInternal.h" -EFI_EVENT mVirtualAddressChangeEvent; -EFI_EVENT mExitBootServicesEvent; +EFI_EVENT mStatusCodeVirtualAddressChangeEvent; EFI_STATUS_CODE_DATA *mStatusCodeData; -EFI_RUNTIME_SERVICES *mInternalRT; -BOOLEAN mHaveExitedBootServices = FALSE; +EFI_RUNTIME_SERVICES *mStatusCodeInternalRT; EFI_REPORT_STATUS_CODE mReportStatusCode = NULL; /** @@ -39,7 +37,7 @@ InternalGetReportStatusCode ( EFI_STATUS_CODE_PROTOCOL *StatusCodeProtocol; EFI_STATUS Status; - if (!mHaveExitedBootServices) { + if (!EfiAtRuntime ()) { // // Check gBS just in case. ReportStatusCode is called before gBS is initialized. // @@ -122,27 +120,10 @@ ReportStatusCodeLibVirtualAddressChange ( ) { if (mReportStatusCode != NULL) { - mInternalRT->ConvertPointer (0, (VOID **) &mReportStatusCode); + mStatusCodeInternalRT->ConvertPointer (0, (VOID **) &mReportStatusCode); } - mInternalRT->ConvertPointer (0, (VOID **) &mStatusCodeData); - mInternalRT->ConvertPointer (0, (VOID **) &mInternalRT); -} - -/** - Notification function of EVT_SIGNAL_EXIT_BOOT_SERVICES. - - @param Event Event whose notification function is being invoked. - @param Context Pointer to the notification function's context - -**/ -VOID -EFIAPI -ReportStatusCodeLibExitBootServices ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - mHaveExitedBootServices = TRUE; + mStatusCodeInternalRT->ConvertPointer (0, (VOID **) &mStatusCodeData); + mStatusCodeInternalRT->ConvertPointer (0, (VOID **) &mStatusCodeInternalRT); } /** @@ -169,7 +150,7 @@ ReportStatusCodeLibConstruct ( // // Library should not use the gRT directly, for it may be converted by other library instance. // - mInternalRT = gRT; + mStatusCodeInternalRT = gRT; mStatusCodeData = AllocateRuntimePool (sizeof (EFI_STATUS_CODE_DATA) + EFI_STATUS_CODE_DATA_MAX_SIZE); ASSERT (mStatusCodeData != NULL); @@ -187,20 +168,7 @@ ReportStatusCodeLibConstruct ( ReportStatusCodeLibVirtualAddressChange, NULL, &gEfiEventVirtualAddressChangeGuid, - &mVirtualAddressChangeEvent - ); - ASSERT_EFI_ERROR (Status); - - // - // Register notify function for EVT_SIGNAL_EXIT_BOOT_SERVICES - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - ReportStatusCodeLibExitBootServices, - NULL, - &gEfiEventExitBootServicesGuid, - &mExitBootServicesEvent + &mStatusCodeVirtualAddressChangeEvent ); ASSERT_EFI_ERROR (Status); @@ -229,9 +197,7 @@ ReportStatusCodeLibDestruct ( EFI_STATUS Status; ASSERT (gBS != NULL); - Status = gBS->CloseEvent (mVirtualAddressChangeEvent); - ASSERT_EFI_ERROR (Status); - Status = gBS->CloseEvent (mExitBootServicesEvent); + Status = gBS->CloseEvent (mStatusCodeVirtualAddressChangeEvent); ASSERT_EFI_ERROR (Status); FreePool (mStatusCodeData); -- cgit v1.2.3