]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
Add conditional check before output status code.
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / DxeReportStatusCodeLibFramework / ReportStatusCodeLib.c
index f29831563c083fd62d919a46896e87646ef4900d..9e35cdda9083f5e6094099352758d35473437f03 100644 (file)
@@ -48,22 +48,28 @@ InternalReportStatusCode (
   IN EFI_STATUS_CODE_DATA     *Data     OPTIONAL\r
   )\r
 {\r
-  //\r
-  // If gStatusCode is NULL, then see if a Status Code Protocol instance is present\r
-  // in the handle database.\r
-  //\r
-  if (mReportStatusCode == NULL) {\r
-    mReportStatusCode = InternalGetReportStatusCode ();\r
+  if ((ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r
+    (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ||\r
+    (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) {\r
+    //\r
+    // If gStatusCode is NULL, then see if a Status Code Protocol instance is present\r
+    // in the handle database.\r
+    //\r
     if (mReportStatusCode == NULL) {\r
-      return EFI_UNSUPPORTED;\r
+      mReportStatusCode = InternalGetReportStatusCode ();\r
+      if (mReportStatusCode == NULL) {\r
+        return EFI_UNSUPPORTED;\r
+      }\r
     }\r
+  \r
+    //\r
+    // A Status Code Protocol is present in the handle database, so pass in all the\r
+    // parameters to the ReportStatusCode() service of the Status Code Protocol\r
+    //\r
+    return (*mReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data);\r
   }\r
-\r
-  //\r
-  // A Status Code Protocol is present in the handle database, so pass in all the\r
-  // parameters to the ReportStatusCode() service of the Status Code Protocol\r
-  //\r
-  return (*mReportStatusCode) (Type, Value, Instance, (EFI_GUID *)CallerId, Data);\r
+  \r
+  return EFI_UNSUPPORTED;\r
 }\r
 \r
 \r