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 (&gDtPlatformDefaultDtbFileGuid
,
40 EFI_SECTION_RAW
, 0, &OrigDtb
, &OrigDtbSize
);
41 if (EFI_ERROR (Status
)) {
45 CopyDtb
= AllocateCopyPool (OrigDtbSize
, OrigDtb
);
46 if (CopyDtb
== NULL
) {
47 return EFI_OUT_OF_RESOURCES
;
51 *DtbSize
= OrigDtbSize
;