]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c
MdeModulePkg/BmBoot: Report status when fail to load/start boot option
[mirror_edk2.git] / MdeModulePkg / Library / SmmReportStatusCodeLib / ReportStatusCodeLib.c
index 480cb6e5008686ac93eb2edd8a14a9a951bad929..c2fd33e8c1ca236d3e7cc57cea216dde742ba869 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Report Status Code Library for SMM Phase.\r
 \r
-  Copyright (c)  2009, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2009 - 2018, 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
@@ -18,6 +18,7 @@
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
 \r
 #include <Guid/StatusCodeDataTypeId.h>\r
 #include <Guid/StatusCodeDataTypeDebug.h>\r
@@ -91,13 +92,13 @@ InternalReportStatusCode (
         return EFI_UNSUPPORTED;\r
       }\r
     }\r
-  \r
+\r
     //\r
     // A status code service is present in system, so pass in all the parameters to the service.\r
     //\r
     return (*mReportStatusCode) (mStatusCodeProtocol, Type, Value, Instance, (EFI_GUID *)CallerId, Data);\r
   }\r
-  \r
+\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
@@ -436,15 +437,10 @@ ReportStatusCodeEx (
   ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
-  if (gSmst == NULL || gSmst->SmmAllocatePool == NULL || gSmst->SmmFreePool == NULL) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
   //\r
   // Allocate space for the Status Code Header and its buffer\r
   //\r
-  StatusCodeData = NULL;\r
-  gSmst->SmmAllocatePool (EfiRuntimeServicesData, sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize, (VOID **)&StatusCodeData);\r
+  StatusCodeData = AllocatePool (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize);\r
   if (StatusCodeData == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -452,8 +448,8 @@ ReportStatusCodeEx (
   //\r
   // Fill in the extended data header\r
   //\r
-  StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);\r
-  StatusCodeData->Size = (UINT16)ExtendedDataSize;\r
+  StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);\r
+  StatusCodeData->Size = (UINT16) ExtendedDataSize;\r
   if (ExtendedDataGuid == NULL) {\r
     ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;\r
   }\r
@@ -477,7 +473,7 @@ ReportStatusCodeEx (
   //\r
   // Free the allocated buffer\r
   //\r
-  gSmst->SmmFreePool (StatusCodeData);\r
+  FreePool (StatusCodeData);\r
 \r
   return Status;\r
 }\r