]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/DataHubStatusCodeWorker.c
Fix the issues that StatusCode can't work when PcdStatusCodeUseMemory is set to TRUE...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / RuntimeDxe / DataHubStatusCodeWorker.c
index 5c1616e14bf08cbd965506239dd11fdc4ffe02b2..ffee2f9c2acaafebf8c7ea690a940e94233e74c2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Data Hub status code worker.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2010, 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
@@ -24,7 +24,7 @@ EFI_EVENT                 mLogDataHubEvent;
 //\r
 // Cache data hub protocol.\r
 //\r
-EFI_DATA_HUB_PROTOCOL     *mDataHubProtocol;\r
+EFI_DATA_HUB_PROTOCOL     *mDataHubProtocol = NULL;\r
 \r
 \r
 /**\r
@@ -189,6 +189,7 @@ DataHubStatusCodeReportWorker (
   BASE_LIST                         Marker;\r
   CHAR8                             *Format;\r
   UINTN                             CharCount;\r
+  EFI_STATUS                        Status;\r
 \r
   //\r
   // Use atom operation to avoid the reentant of report.\r
@@ -205,6 +206,13 @@ DataHubStatusCodeReportWorker (
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
+  if (mDataHubProtocol == NULL) {\r
+    Status = DataHubStatusCodeInitializeWorker ();\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+  }\r
+  \r
   Record = AcquireRecordBuffer ();\r
   if (Record == NULL) {\r
     //\r
@@ -358,7 +366,10 @@ DataHubStatusCodeInitializeWorker (
                   NULL, \r
                   (VOID **) &mDataHubProtocol\r
                   );\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (EFI_ERROR (Status)) {\r
+    mDataHubProtocol = NULL;\r
+    return Status;\r
+  }\r
 \r
   //\r
   // Create a Notify Event to log data in Data Hub\r