HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf\r
\r
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
+ DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf\r
+\r
[LibraryClasses.common.DXE_DRIVER]\r
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf\r
EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf\r
EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf\r
EmbeddedPkg/Library/NullDmaLib/NullDmaLib.inf\r
+ EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf\r
\r
EmbeddedPkg/Ebl/Ebl.inf\r
#### EmbeddedPkg/EblExternCmd/EblExternCmd.inf\r
--- /dev/null
+/** @file\r
+*\r
+* Copyright (c) 2017, Linaro, Ltd. All rights reserved.\r
+*\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
+*\r
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DxeServicesLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+\r
+/**\r
+ Return a pool allocated copy of the DTB image that is appropriate for\r
+ booting the current platform via DT.\r
+\r
+ @param[out] Dtb Pointer to the DTB copy\r
+ @param[out] DtbSize Size of the DTB copy\r
+\r
+ @retval EFI_SUCCESS Operation completed successfully\r
+ @retval EFI_NOT_FOUND No suitable DTB image could be located\r
+ @retval EFI_OUT_OF_RESOURCES No pool memory available\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DtPlatformLoadDtb (\r
+ OUT VOID **Dtb,\r
+ OUT UINTN *DtbSize\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ VOID *OrigDtb;\r
+ VOID *CopyDtb;\r
+ UINTN OrigDtbSize;\r
+\r
+ Status = GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid,\r
+ EFI_SECTION_RAW, 0, &OrigDtb, &OrigDtbSize);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ CopyDtb = AllocateCopyPool (OrigDtbSize, OrigDtb);\r
+ if (CopyDtb == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ *Dtb = CopyDtb;\r
+ *DtbSize = OrigDtbSize;\r
+\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+/** @file\r
+*\r
+* Copyright (c) 2017, Linaro, Ltd. All rights reserved.\r
+*\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
+*\r
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010019\r
+ BASE_NAME = DxeDtPlatformDtbLoaderLibDefault\r
+ FILE_GUID = 419a1910-70da-4c99-8696-ba81a57be508\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = DtPlatformDtbLoaderLib|DXE_DRIVER\r
+\r
+[Sources]\r
+ DxeDtPlatformDtbLoaderLibDefault.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ EmbeddedPkg/EmbeddedPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ DxeServicesLib\r
+ MemoryAllocationLib\r
+\r
+[Guids]\r
+ gDtPlatformDefaultDtbFileGuid\r