diff mbox series

[edk2,v2,1/3] EmbeddedPkg: add DtPlatformDtbLoaderLib library class

Message ID 20170331105607.3477-2-ard.biesheuvel@linaro.org
State Accepted
Commit 449a5df455ed74cdaa9a95e318388531dc073948
Headers show
Series EmbeddedPkg: revert DTB loading to platform lib | expand

Commit Message

Ard Biesheuvel March 31, 2017, 10:56 a.m. UTC
To abstract the way a platform reasons about which DTB is appropriate,
and the way it ultimately supplies the DTB image, introduce a new library
class to encapsulate this functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 EmbeddedPkg/EmbeddedPkg.dec                          |  1 +
 EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h | 37 ++++++++++++++++++++
 2 files changed, 38 insertions(+)

-- 
2.9.3

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek March 31, 2017, 11:15 a.m. UTC | #1
On 03/31/17 12:56, Ard Biesheuvel wrote:
> To abstract the way a platform reasons about which DTB is appropriate,

> and the way it ultimately supplies the DTB image, introduce a new library

> class to encapsulate this functionality.

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  EmbeddedPkg/EmbeddedPkg.dec                          |  1 +

>  EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h | 37 ++++++++++++++++++++

>  2 files changed, 38 insertions(+)

> 

> diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec

> index 871fc5ff4016..0bed2736c8c3 100644

> --- a/EmbeddedPkg/EmbeddedPkg.dec

> +++ b/EmbeddedPkg/EmbeddedPkg.dec

> @@ -45,6 +45,7 @@ [LibraryClasses.common]

>    GdbSerialLib|Include/Library/GdbSerialLib.h

>    DebugAgentTimerLib|Include/Library/DebugAgentTimerLib.h

>  

> +  DtPlatformDtbLoaderLib|Include/Library/DtPlatformDtbLoaderLib.h

>  

>  [Guids.common]

>    gEmbeddedTokenSpaceGuid       = { 0xe0d8ca17, 0x4276, 0x4386, { 0xbb, 0x79, 0x48, 0xcb, 0x81, 0x3d, 0x3c, 0x4f }}

> diff --git a/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h

> new file mode 100644

> index 000000000000..bb79d2a190f4

> --- /dev/null

> +++ b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h

> @@ -0,0 +1,37 @@

> +/** @file

> +*

> +*  Copyright (c) 2017, Linaro, Ltd. All rights reserved.

> +*

> +*  This program and the accompanying materials

> +*  are licensed and made available under the terms and conditions of the BSD License

> +*  which accompanies this distribution.  The full text of the license may be found at

> +*  http://opensource.org/licenses/bsd-license.php

> +*

> +*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +*

> +**/

> +

> +#ifndef __DT_PLATFORM_DTB_LOADER_LIB_H__

> +#define __DT_PLATFORM_DTB_LOADER_LIB_H__

> +

> +/**

> +  Return a pool allocated copy of the DTB image that is appropriate for

> +  booting the current platform via DT.

> +

> +  @param[out]   Dtb                   Pointer to the DTB copy

> +  @param[out]   DtbSize               Size of the DTB copy

> +

> +  @retval       EFI_SUCCESS           Operation completed successfully

> +  @retval       EFI_NOT_FOUND         No suitable DTB image could be located

> +  @retval       EFI_OUT_OF_RESOURCES  No pool memory available

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +DtPlatformLoadDtb (

> +  OUT   VOID        **Dtb,

> +  OUT   UINTN       *DtbSize

> +  );

> +

> +#endif

> 


Please #include <Uefi/UefiBaseType.h> for the EFI_STATUS type here. With
that change:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>



_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 871fc5ff4016..0bed2736c8c3 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -45,6 +45,7 @@  [LibraryClasses.common]
   GdbSerialLib|Include/Library/GdbSerialLib.h
   DebugAgentTimerLib|Include/Library/DebugAgentTimerLib.h
 
+  DtPlatformDtbLoaderLib|Include/Library/DtPlatformDtbLoaderLib.h
 
 [Guids.common]
   gEmbeddedTokenSpaceGuid       = { 0xe0d8ca17, 0x4276, 0x4386, { 0xbb, 0x79, 0x48, 0xcb, 0x81, 0x3d, 0x3c, 0x4f }}
diff --git a/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h
new file mode 100644
index 000000000000..bb79d2a190f4
--- /dev/null
+++ b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h
@@ -0,0 +1,37 @@ 
+/** @file
+*
+*  Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+*
+*  This program and the accompanying materials
+*  are licensed and made available under the terms and conditions of the BSD License
+*  which accompanies this distribution.  The full text of the license may be found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#ifndef __DT_PLATFORM_DTB_LOADER_LIB_H__
+#define __DT_PLATFORM_DTB_LOADER_LIB_H__
+
+/**
+  Return a pool allocated copy of the DTB image that is appropriate for
+  booting the current platform via DT.
+
+  @param[out]   Dtb                   Pointer to the DTB copy
+  @param[out]   DtbSize               Size of the DTB copy
+
+  @retval       EFI_SUCCESS           Operation completed successfully
+  @retval       EFI_NOT_FOUND         No suitable DTB image could be located
+  @retval       EFI_OUT_OF_RESOURCES  No pool memory available
+
+**/
+EFI_STATUS
+EFIAPI
+DtPlatformLoadDtb (
+  OUT   VOID        **Dtb,
+  OUT   UINTN       *DtbSize
+  );
+
+#endif