/** @file\r
API implementation for instance of Report Status Code Library.\r
\r
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
EFI_STATUS_CODE_PROTOCOL *mReportStatusCodeLibStatusCodeProtocol = NULL;\r
EFI_EVENT mReportStatusCodeLibVirtualAddressChangeEvent;\r
+EFI_EVENT mReportStatusCodeLibExitBootServicesEvent;\r
+BOOLEAN mHaveExitedBootServices = FALSE;\r
\r
/**\r
Locate the report status code service.\r
return;\r
}\r
\r
- if (EfiAtRuntime ()) {\r
+ if (mHaveExitedBootServices) {\r
return;\r
}\r
\r
EfiConvertPointer (0, (VOID **) &mReportStatusCodeLibStatusCodeProtocol);\r
}\r
\r
+/**\r
+ Notification function of EVT_SIGNAL_EXIT_BOOT_SERVICES.\r
+\r
+ @param Event Event whose notification function is being invoked.\r
+ @param Context Pointer to the notification function's context\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ReportStatusCodeLibExitBootServices (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // Locate the report status code service before enter runtime.\r
+ // \r
+ InternalGetReportStatusCode ();\r
+ \r
+ mHaveExitedBootServices = TRUE;\r
+}\r
+\r
/**\r
The constructor function of Runtime DXE Report Status Code Lib.\r
\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ //\r
+ // Register notify function for EVT_SIGNAL_EXIT_BOOT_SERVICES\r
+ // \r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ ReportStatusCodeLibExitBootServices,\r
+ NULL,\r
+ &gEfiEventExitBootServicesGuid,\r
+ &mReportStatusCodeLibExitBootServicesEvent\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
Status = gBS->CloseEvent (mReportStatusCodeLibVirtualAddressChangeEvent);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ Status = gBS->CloseEvent (mReportStatusCodeLibExitBootServicesEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
\r
- if (EfiAtRuntime ()) {\r
+ if (mHaveExitedBootServices) {\r
if (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize > EFI_STATUS_CODE_DATA_MAX_SIZE) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
//\r
// Free the allocated buffer\r
//\r
- if (!EfiAtRuntime()) {\r
+ if (!mHaveExitedBootServices) {\r
gBS->FreePool (StatusCodeData);\r
}\r
\r
## @file\r
# Report status code library instance which supports logging message in DXE & runtime phase.\r
#\r
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
gEfiStatusCodeSpecificDataGuid ## CONSUMES\r
gEfiStatusCodeDataTypeDebugGuid ## CONSUMES\r
gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event\r
+ gEfiEventExitBootServicesGuid ## CONSUMES ## Event\r
\r
[Protocols]\r
gEfiStatusCodeRuntimeProtocolGuid ## CONSUMES\r