summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c')
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
index dcd7c41001..8aae7b2c4e 100644
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
+++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
@@ -27,6 +27,7 @@
#include <Protocol/DevicePathFromText.h>
#include <Guid/ArmGlobalVariableHob.h>
+#include <Guid/Fdt.h>
#include <libfdt.h>
@@ -178,41 +179,28 @@ EblDumpFdt (
IN CHAR8 **Argv
)
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH* FdtDevicePath;
- EFI_PHYSICAL_ADDRESS FdtBlob;
- UINTN FdtBlobSize;
- UINTN Ret;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
+ EFI_STATUS Status;
+ VOID *FdtBlob;
+ UINTN Ret;
// If no FDT file is passed to the argument then get the one from the platform
if (Argc < 2) {
- Status = GetEnvironmentVariable (L"Fdt", &gArmGlobalVariableGuid, NULL, NULL, (VOID**)&FdtDevicePath);
- if (Status == EFI_NOT_FOUND) {
- // No set yet, get the Default Device Path
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
- FdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
+ Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, &FdtBlob);
+ if (EFI_ERROR (Status)) {
+ Print (L"ERROR: Did not find the Fdt Blob.\n");
+ return Status;
}
} else {
return EFI_NOT_FOUND;
}
- Status = BdsLoadImage (FdtDevicePath, AllocateAnyPages, &FdtBlob, &FdtBlobSize);
- if (EFI_ERROR(Status)) {
- Print (L"ERROR: Did not find the Fdt Blob.\n");
- return Status;
- }
-
- Ret = fdt_check_header((CONST VOID*)(UINTN)FdtBlob);
+ Ret = fdt_check_header (FdtBlob);
if (Ret != 0) {
- Print (L"ERROR: Device Tree header not valid (err:%d)\n",Ret);
- return Status;
+ Print (L"ERROR: Device Tree header not valid (err:%d)\n", Ret);
+ return EFI_INVALID_PARAMETER;
}
- DumpFdt ((VOID*)(UINTN)FdtBlob);
-
- FreePool (FdtDevicePath);
+ DumpFdt (FdtBlob);
return EFI_SUCCESS;
}