[edk2] [PATCH 2/6] ArmVirtPkg: introduce FDT_CLIENT_PROTOCOL.GetOsExposure() member function

Laszlo Ersek posted 6 patches 7 years, 7 months ago
There is a newer version of this series
[edk2] [PATCH 2/6] ArmVirtPkg: introduce FDT_CLIENT_PROTOCOL.GetOsExposure() member function
Posted by Laszlo Ersek 7 years, 7 months ago
Introduce a protocol member function that allows consumers of the protocol
to determine whether the FDT is exposed to the guest OS.

The initial implementation simply reflects !PcdPureAcpiBoot.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 ArmVirtPkg/Include/Protocol/FdtClient.h | 26 ++++++++++++++++++++
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c  | 11 +++++++++
 2 files changed, 37 insertions(+)

diff --git a/ArmVirtPkg/Include/Protocol/FdtClient.h b/ArmVirtPkg/Include/Protocol/FdtClient.h
index aad76db388be..4e189c2a3d2a 100644
--- a/ArmVirtPkg/Include/Protocol/FdtClient.h
+++ b/ArmVirtPkg/Include/Protocol/FdtClient.h
@@ -115,6 +115,30 @@ EFI_STATUS
   OUT INT32                   *Node
   );
 
+/*
+  @param[out] FdtExposedToOs  Whether the firmware exposes the FDT to the guest
+                              OS as an EFI system configuration table.
+
+  @retval EFI_NOT_STARTED  The protocol instance is in the process of
+                           determining whether it should expose the FDT to the
+                           guest OS as an EFI system configuration table.
+
+                           This status code is never returned to modules that
+                           depend on the protocol with a DEPEX, or wait for it
+                           with a TPL_CALLBACK protocol notify. Protocol
+                           notifies registered at higher task priority levels
+                           may see this return value (but such protocol
+                           notifies should not be used in the first place, in
+                           general).
+
+  @retval EFI_SUCCESS      FdtExposedToOs has been set.
+*/
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_GET_OS_EXPOSURE) (
+  OUT BOOLEAN *FdtExposedToOs
+  );
+
 struct _FDT_CLIENT_PROTOCOL {
   FDT_CLIENT_GET_NODE_PROPERTY             GetNodeProperty;
   FDT_CLIENT_SET_NODE_PROPERTY             SetNodeProperty;
@@ -128,6 +152,8 @@ struct _FDT_CLIENT_PROTOCOL {
   FDT_CLIENT_FIND_NEXT_MEMORY_NODE_REG     FindNextMemoryNodeReg;
 
   FDT_CLIENT_GET_OR_INSERT_CHOSEN_NODE     GetOrInsertChosenNode;
+
+  FDT_CLIENT_GET_OS_EXPOSURE               GetOsExposure;
 };
 
 extern EFI_GUID gFdtClientProtocolGuid;
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index 547a29fce62c..6082b22d35c1 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -294,6 +294,16 @@ GetOrInsertChosenNode (
   return EFI_SUCCESS;
 }
 
+STATIC
+EFI_STATUS
+GetOsExposure (
+  OUT BOOLEAN *FdtExposedToOs
+  )
+{
+  *FdtExposedToOs = !FeaturePcdGet (PcdPureAcpiBoot);
+  return EFI_SUCCESS;
+}
+
 STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {
   GetNodeProperty,
   SetNodeProperty,
@@ -304,6 +314,7 @@ STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {
   FindMemoryNodeReg,
   FindNextMemoryNodeReg,
   GetOrInsertChosenNode,
+  GetOsExposure
 };
 
 EFI_STATUS
-- 
2.9.3


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