]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fixed the issue in RuntimeStatusCode library that may not work on the early dispatche...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Aug 2011 06:23:54 +0000 (06:23 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Aug 2011 06:23:54 +0000 (06:23 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12073 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf

index cbfd8247b91b81df395b317a3195efe19b1b6e79..f6b7ee756bc6f6851e229b0e010de85eb362b23f 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -29,6 +29,8 @@
 \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
@@ -47,7 +49,7 @@ InternalGetReportStatusCode (
     return;\r
   }\r
   \r
-  if (EfiAtRuntime ()) {\r
+  if (mHaveExitedBootServices) {\r
     return;\r
   }\r
   \r
@@ -82,6 +84,28 @@ ReportStatusCodeLibVirtualAddressChange (
   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
@@ -121,6 +145,19 @@ ReportStatusCodeLibConstructor (
                   );\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
@@ -149,6 +186,9 @@ ReportStatusCodeLibDestructor (
   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
@@ -586,7 +626,7 @@ ReportStatusCodeEx (
   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
@@ -634,7 +674,7 @@ ReportStatusCodeEx (
   //\r
   // Free the allocated buffer\r
   //\r
-  if (!EfiAtRuntime()) {\r
+  if (!mHaveExitedBootServices) {\r
     gBS->FreePool (StatusCodeData);\r
   }\r
 \r
index ccdb66eb6d0526a66ab607ea855b5a1f170da467..6d1542dfc25875ce0d57fb08fd69f2efa0d12361 100644 (file)
@@ -1,7 +1,7 @@
 ## @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
@@ -48,6 +48,7 @@
   gEfiStatusCodeSpecificDataGuid                ## CONSUMES\r
   gEfiStatusCodeDataTypeDebugGuid               ## CONSUMES\r
   gEfiEventVirtualAddressChangeGuid             ## CONSUMES ## Event\r
+  gEfiEventExitBootServicesGuid                 ## CONSUMES ## Event\r
 \r
 [Protocols]\r
   gEfiStatusCodeRuntimeProtocolGuid             ## CONSUMES\r