]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
remove a segment of code, in which it forces EHCI to be connected firstly before...
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / DxeReportStatusCodeLibFramework / ReportStatusCodeLib.c
index 941d01f92bdd55f8954adcd7fdf4eb6681152a0a..ac29009c7448d1502c26954ac9e8c0909ec65e0a 100644 (file)
@@ -34,6 +34,7 @@ EFI_REPORT_STATUS_CODE  mReportStatusCode = NULL;
   Locate the report status code service.\r
 \r
   @return   Function pointer to the report status code service.\r
+            NULL is returned if no status code service is available.\r
 \r
 **/\r
 EFI_REPORT_STATUS_CODE\r
@@ -281,7 +282,8 @@ ReportStatusCodeExtractDebugInfo (
   *ErrorLevel = DebugInfo->ErrorLevel;\r
 \r
   //\r
-  // Here the address returned in Marker is 64-bit aligned.\r
+  // The first 12 * sizeof (UINT64) bytes following EFI_DEBUG_INFO are for variable arguments\r
+  // of format in DEBUG string. Its address is returned in Marker and has to be 64-bit aligned.\r
   // It must be noticed that EFI_DEBUG_INFO follows EFI_STATUS_CODE_DATA, whose size is\r
   // 20 bytes. The size of EFI_DEBUG_INFO is 4 bytes, so we can ensure that Marker\r
   // returned is 64-bit aligned.\r
@@ -289,10 +291,6 @@ ReportStatusCodeExtractDebugInfo (
   // cause unalignment exception.\r
   //\r
   *Marker = (BASE_LIST) (DebugInfo + 1);\r
-  //\r
-  // The first 12 * UINTN bytes of the string are really an\r
-  // argument stack to support varargs on the Format string.\r
-  //\r
   *Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);\r
 \r
   return TRUE;\r
@@ -493,11 +491,15 @@ ReportStatusCodeEx (
   ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
+  if (gBS == NULL || gBS->AllocatePool == NULL || gBS->FreePool == NULL) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Allocate space for the Status Code Header and its buffer\r
   //\r
   StatusCodeData = NULL;\r
-  StatusCodeData = AllocatePool (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize);\r
+  gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize, (VOID **)&StatusCodeData);\r
   if (StatusCodeData == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -530,7 +532,7 @@ ReportStatusCodeEx (
   //\r
   // Free the allocated buffer\r
   //\r
-  FreePool (StatusCodeData);\r
+  gBS->FreePool (StatusCodeData);\r
 \r
   return Status;\r
 }\r