diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-02 06:23:54 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-02 06:23:54 +0000 |
commit | c05e7994a16761ef212db0ff6ab95ee2748b29e9 (patch) | |
tree | 3b3721cd918a1bc448245f5fcdf339a9f4e171f1 /MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c | |
parent | 3c28a7280b3f724d4b106d55e2efca37f65b0d2e (diff) | |
download | edk2-platforms-c05e7994a16761ef212db0ff6ab95ee2748b29e9.tar.xz |
Fixed the issue in RuntimeStatusCode library that may not work on the early dispatched Runtime driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12073 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c')
-rw-r--r-- | MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c index cbfd8247b9..f6b7ee756b 100644 --- a/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c +++ b/MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c @@ -1,7 +1,7 @@ /** @file
API implementation for instance of Report Status Code Library.
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2011, 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
@@ -29,6 +29,8 @@ EFI_STATUS_CODE_PROTOCOL *mReportStatusCodeLibStatusCodeProtocol = NULL;
EFI_EVENT mReportStatusCodeLibVirtualAddressChangeEvent;
+EFI_EVENT mReportStatusCodeLibExitBootServicesEvent;
+BOOLEAN mHaveExitedBootServices = FALSE;
/**
Locate the report status code service.
@@ -47,7 +49,7 @@ InternalGetReportStatusCode ( return;
}
- if (EfiAtRuntime ()) {
+ if (mHaveExitedBootServices) {
return;
}
@@ -83,6 +85,28 @@ ReportStatusCodeLibVirtualAddressChange ( }
/**
+ 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
+ )
+{
+ //
+ // Locate the report status code service before enter runtime.
+ //
+ InternalGetReportStatusCode ();
+
+ mHaveExitedBootServices = TRUE;
+}
+
+/**
The constructor function of Runtime DXE Report Status Code Lib.
This function allocates memory for extended status code data, caches
@@ -121,6 +145,19 @@ ReportStatusCodeLibConstructor ( );
ASSERT_EFI_ERROR (Status);
+ //
+ // Register notify function for EVT_SIGNAL_EXIT_BOOT_SERVICES
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ ReportStatusCodeLibExitBootServices,
+ NULL,
+ &gEfiEventExitBootServicesGuid,
+ &mReportStatusCodeLibExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
return EFI_SUCCESS;
}
@@ -149,6 +186,9 @@ ReportStatusCodeLibDestructor ( Status = gBS->CloseEvent (mReportStatusCodeLibVirtualAddressChangeEvent);
ASSERT_EFI_ERROR (Status);
+ Status = gBS->CloseEvent (mReportStatusCodeLibExitBootServicesEvent);
+ ASSERT_EFI_ERROR (Status);
+
return EFI_SUCCESS;
}
@@ -586,7 +626,7 @@ ReportStatusCodeEx ( ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
- if (EfiAtRuntime ()) {
+ if (mHaveExitedBootServices) {
if (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize > EFI_STATUS_CODE_DATA_MAX_SIZE) {
return EFI_OUT_OF_RESOURCES;
}
@@ -634,7 +674,7 @@ ReportStatusCodeEx ( //
// Free the allocated buffer
//
- if (!EfiAtRuntime()) {
+ if (!mHaveExitedBootServices) {
gBS->FreePool (StatusCodeData);
}
|