]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
ArmPlatformPkg/Bds: Remove any use of the "Fdt" UEFI variable
[mirror_edk2.git] / ArmPlatformPkg / Library / EblCmdLib / EblCmdFdt.c
index dcd7c41001c46aa77dcfe66ad1c476f1404ff05c..8aae7b2c4e08f98cf683d43be1d75dfd6cba7da6 100644 (file)
@@ -27,6 +27,7 @@
 #include <Protocol/DevicePathFromText.h>\r
 \r
 #include <Guid/ArmGlobalVariableHob.h>\r
+#include <Guid/Fdt.h>\r
 \r
 #include <libfdt.h>\r
 \r
@@ -178,41 +179,28 @@ EblDumpFdt (
   IN CHAR8  **Argv\r
   )\r
 {\r
-  EFI_STATUS           Status;\r
-  EFI_DEVICE_PATH*     FdtDevicePath;\r
-  EFI_PHYSICAL_ADDRESS FdtBlob;\r
-  UINTN                FdtBlobSize;\r
-  UINTN                Ret;\r
-  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;\r
+  EFI_STATUS  Status;\r
+  VOID        *FdtBlob;\r
+  UINTN       Ret;\r
 \r
   // If no FDT file is passed to the argument then get the one from the platform\r
   if (Argc < 2) {\r
-    Status = GetEnvironmentVariable (L"Fdt", &gArmGlobalVariableGuid, NULL, NULL, (VOID**)&FdtDevicePath);\r
-    if (Status == EFI_NOT_FOUND) {\r
-      // No set yet, get the Default Device Path\r
-      Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);\r
-      ASSERT_EFI_ERROR(Status);\r
-      FdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));\r
+    Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, &FdtBlob);\r
+    if (EFI_ERROR (Status)) {\r
+      Print (L"ERROR: Did not find the Fdt Blob.\n");\r
+      return Status;\r
     }\r
   } else {\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  Status = BdsLoadImage (FdtDevicePath, AllocateAnyPages, &FdtBlob, &FdtBlobSize);\r
-  if (EFI_ERROR(Status)) {\r
-    Print (L"ERROR: Did not find the Fdt Blob.\n");\r
-    return Status;\r
-  }\r
-\r
-  Ret = fdt_check_header((CONST VOID*)(UINTN)FdtBlob);\r
+  Ret = fdt_check_header (FdtBlob);\r
   if (Ret != 0) {\r
-    Print (L"ERROR: Device Tree header not valid (err:%d)\n",Ret);\r
-    return Status;\r
+    Print (L"ERROR: Device Tree header not valid (err:%d)\n", Ret);\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  DumpFdt ((VOID*)(UINTN)FdtBlob);\r
-\r
-  FreePool (FdtDevicePath);\r
+  DumpFdt (FdtBlob);\r
 \r
   return EFI_SUCCESS;\r
 }\r