[edk2,v2,01/24] ArmVirtPkg: introduce FdtClientProtocol

Message ID 1460108711-12122-2-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 8dbae2c197fa7127bdbb6d5d1fb5dc8af6dd4157
Headers show

Commit Message

Ard Biesheuvel April 8, 2016, 9:44 a.m.
This introduces the FdtClientProtocol, which will be used to expose the
device tree provided by the host to other DXE drivers.

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

---
 ArmVirtPkg/ArmVirtPkg.dec               |   3 +
 ArmVirtPkg/Include/Protocol/FdtClient.h | 108 ++++++++++++++++++++
 2 files changed, 111 insertions(+)

-- 
2.5.0

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

Comments

Laszlo Ersek April 8, 2016, 12:15 p.m. | #1
On 04/08/16 11:44, Ard Biesheuvel wrote:
> This introduces the FdtClientProtocol, which will be used to expose the

> device tree provided by the host to other DXE drivers.

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

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

> ---

>  ArmVirtPkg/ArmVirtPkg.dec               |   3 +

>  ArmVirtPkg/Include/Protocol/FdtClient.h | 108 ++++++++++++++++++++

>  2 files changed, 111 insertions(+)


> +

> +#define FDT_CLIENT_PROTOCOL_GUID { \

> +  0xE11FACA0, 0x4710, 0x4C8E, {0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C }\


Space before \ missing; can be fixed up without a repost.

> +  FDT_CLIENT_GET_CHOSEN_NODE               GetOrInsertChosenNode;


Typedef should also be renamed to FDT_CLIENT_GET_OR_INSERT_CHOSEN_NODE.
Can be fixed up without a repost.

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


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

Patch

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index b6ff63677837..fa908253b320 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -34,6 +34,9 @@  [Guids.common]
   gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
   gEarlyPL011BaseAddressGuid       = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
 
+[Protocols]
+  gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   # This is the physical address where the device tree is expected to be stored
diff --git a/ArmVirtPkg/Include/Protocol/FdtClient.h b/ArmVirtPkg/Include/Protocol/FdtClient.h
new file mode 100644
index 000000000000..0913c89a8e45
--- /dev/null
+++ b/ArmVirtPkg/Include/Protocol/FdtClient.h
@@ -0,0 +1,108 @@ 
+/** @file
+
+  DISCLAIMER: the FDT_CLIENT_PROTOCOL introduced here is a work in progress,
+  and should not be used outside of the EDK II tree.
+
+  Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+
+  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 __FDT_CLIENT_H__
+#define __FDT_CLIENT_H__
+
+#define FDT_CLIENT_PROTOCOL_GUID { \
+  0xE11FACA0, 0x4710, 0x4C8E, {0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C }\
+  }
+
+//
+// Protocol interface structure
+//
+typedef struct _FDT_CLIENT_PROTOCOL FDT_CLIENT_PROTOCOL;
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_GET_NODE_PROPERTY) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  IN  INT32                   Node,
+  IN  CONST CHAR8             *PropertyName,
+  OUT CONST VOID              **Prop,
+  OUT UINT32                  *PropSize OPTIONAL
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_SET_NODE_PROPERTY) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  IN  INT32                   Node,
+  IN  CONST CHAR8             *PropertyName,
+  IN  CONST VOID              *Prop,
+  IN  UINT32                  PropSize
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  IN  CONST CHAR8             *CompatibleString,
+  OUT INT32                   *Node
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_NEXT_COMPATIBLE_NODE) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  IN  CONST CHAR8             *CompatibleString,
+  IN  INT32                   PrevNode,
+  OUT INT32                   *Node
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE_PROPERTY) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  IN  CONST CHAR8             *CompatibleString,
+  IN  CONST CHAR8             *PropertyName,
+  OUT CONST VOID              **Prop,
+  OUT UINT32                  *PropSize OPTIONAL
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE_REG) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  IN  CONST CHAR8             *CompatibleString,
+  OUT CONST VOID              **Reg,
+  OUT UINT32                  *RegElemSize,
+  OUT UINT32                  *RegSize
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_GET_CHOSEN_NODE) (
+  IN  FDT_CLIENT_PROTOCOL     *This,
+  OUT INT32                   *Node
+  );
+
+struct _FDT_CLIENT_PROTOCOL {
+  FDT_CLIENT_GET_NODE_PROPERTY             GetNodeProperty;
+  FDT_CLIENT_SET_NODE_PROPERTY             SetNodeProperty;
+
+  FDT_CLIENT_FIND_COMPATIBLE_NODE          FindCompatibleNode;
+  FDT_CLIENT_FIND_NEXT_COMPATIBLE_NODE     FindNextCompatibleNode;
+  FDT_CLIENT_FIND_COMPATIBLE_NODE_PROPERTY FindCompatibleNodeProperty;
+  FDT_CLIENT_FIND_COMPATIBLE_NODE_REG      FindCompatibleNodeReg;
+
+  FDT_CLIENT_GET_CHOSEN_NODE               GetOrInsertChosenNode;
+};
+
+extern EFI_GUID gFdtClientProtocolGuid;
+
+#endif