]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure
[mirror_edk2.git] / MdeModulePkg / Library / UefiBootManagerLib / BmBoot.c
index 62c5b2dc94ab309449513a3344432d2a1cdf2820..540d169ec1a6a0170b81581e25c023549a8931b2 100644 (file)
@@ -1387,6 +1387,37 @@ BmExpandLoadFile (
   //\r
   FileBuffer = AllocateReservedPages (EFI_SIZE_TO_PAGES (BufferSize));\r
   if (FileBuffer == NULL) {\r
+    DEBUG_CODE (\r
+      EFI_DEVICE_PATH *LoadFilePath;\r
+      CHAR16          *LoadFileText;\r
+      CHAR16          *FileText;\r
+\r
+      LoadFilePath = DevicePathFromHandle (LoadFileHandle);\r
+      if (LoadFilePath == NULL) {\r
+        LoadFileText = NULL;\r
+      } else {\r
+        LoadFileText = ConvertDevicePathToText (LoadFilePath, FALSE, FALSE);\r
+      }\r
+      FileText = ConvertDevicePathToText (FilePath, FALSE, FALSE);\r
+\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
+        "%a:%a: failed to allocate reserved pages: "\r
+        "BufferSize=%Lu LoadFile=\"%s\" FilePath=\"%s\"\n",\r
+        gEfiCallerBaseName,\r
+        __FUNCTION__,\r
+        (UINT64)BufferSize,\r
+        LoadFileText,\r
+        FileText\r
+        ));\r
+\r
+      if (FileText != NULL) {\r
+        FreePool (FileText);\r
+      }\r
+      if (LoadFileText != NULL) {\r
+        FreePool (LoadFileText);\r
+      }\r
+      );\r
     return NULL;\r
   }\r
 \r