3 * Copyright (c) 2017, Linaro, Ltd. All rights reserved.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/BaseLib.h>
18 #include <Library/DxeServicesLib.h>
19 #include <Library/MemoryAllocationLib.h>
22 Return a pool allocated copy of the DTB image that is appropriate for
23 booting the current platform via DT.
25 @param[out] Dtb Pointer to the DTB copy
26 @param[out] DtbSize Size of the DTB copy
28 @retval EFI_SUCCESS Operation completed successfully
29 @retval EFI_NOT_FOUND No suitable DTB image could be located
30 @retval EFI_OUT_OF_RESOURCES No pool memory available
45 Status
= GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid
,
46 EFI_SECTION_RAW
, 0, &OrigDtb
, &OrigDtbSize
);
47 if (EFI_ERROR (Status
)) {
51 CopyDtb
= AllocateCopyPool (OrigDtbSize
, OrigDtb
);
52 if (CopyDtb
== NULL
) {
53 return EFI_OUT_OF_RESOURCES
;
57 *DtbSize
= OrigDtbSize
;