#include <Protocol/DevicePathFromText.h>\r
\r
#include <Guid/ArmGlobalVariableHob.h>\r
+#include <Guid/Fdt.h>\r
\r
#include <libfdt.h>\r
\r
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