3 * Copyright (c) 2017, Linaro, Ltd. All rights reserved.
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/BaseLib.h>
12 #include <Library/DxeServicesLib.h>
13 #include <Library/MemoryAllocationLib.h>
16 Return a pool allocated copy of the DTB image that is appropriate for
17 booting the current platform via DT.
19 @param[out] Dtb Pointer to the DTB copy
20 @param[out] DtbSize Size of the DTB copy
22 @retval EFI_SUCCESS Operation completed successfully
23 @retval EFI_NOT_FOUND No suitable DTB image could be located
24 @retval EFI_OUT_OF_RESOURCES No pool memory available
39 Status
= GetSectionFromAnyFv (
40 &gDtPlatformDefaultDtbFileGuid
,
46 if (EFI_ERROR (Status
)) {
50 CopyDtb
= AllocateCopyPool (OrigDtbSize
, OrigDtb
);
51 if (CopyDtb
== NULL
) {
52 return EFI_OUT_OF_RESOURCES
;
56 *DtbSize
= OrigDtbSize
;