]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
Update the copyright notice format
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / DxeReportStatusCodeLibFramework / ReportStatusCodeLib.c
index 941d01f92bdd55f8954adcd7fdf4eb6681152a0a..1b422b3148ec72694fa63b64db1898b37ede7a2c 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Report Status Code Library for DXE Phase.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2009, 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
   http://opensource.org/licenses/bsd-license.php\r
@@ -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