[edk2,v3,6/9] ArmVirtPkg/VirtFdtDxe: move FDT config table installation to FdtClientDxe

Message ID 1460534539-2169-7-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show

Commit Message

Ard Biesheuvel April 13, 2016, 8:02 a.m.
Now that FdtClientDxe is the core driver that takes ownership of the host
supplied FDT, it makes sense to put it in charge of installing the FDT
configuration table as well.
---
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf |  4 ++++
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf     |  4 ----
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c   | 11 +++++++++++
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c       | 10 ----------
 4 files changed, 15 insertions(+), 14 deletions(-)

-- 
2.5.0

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

Comments

Laszlo Ersek April 13, 2016, 12:50 p.m. | #1
On 04/13/16 10:02, Ard Biesheuvel wrote:
> Now that FdtClientDxe is the core driver that takes ownership of the host

> supplied FDT, it makes sense to put it in charge of installing the FDT

> configuration table as well.

> ---

>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf |  4 ++++

>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf     |  4 ----

>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.c   | 11 +++++++++++

>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c       | 10 ----------

>  4 files changed, 15 insertions(+), 14 deletions(-)

> 

> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf

> index 3647d37b02d2..3a0cd37040eb 100644

> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf

> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf

> @@ -43,6 +43,10 @@ [Protocols]

>  

>  [Guids]

>    gFdtHobGuid

> +  gFdtTableGuid

> +

> +[FeaturePcd]

> +  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot

>  

>  [Depex]

>    TRUE

> diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

> index 8c098e5885ae..4dd46cf87011 100644

> --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

> +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

> @@ -45,13 +45,9 @@ [LibraryClasses]

>    XenIoMmioLib

>  

>  [Guids]

> -  gFdtTableGuid

>    gVirtioMmioTransportGuid

>    gFdtHobGuid

>  

> -[FeaturePcd]

> -  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot

> -

>  [Protocols]

>    gEfiDevicePathProtocolGuid

>  

> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c

> index 9c589e620cb4..c336e2410033 100644

> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c

> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c

> @@ -20,6 +20,7 @@

>  #include <Library/HobLib.h>

>  #include <libfdt.h>

>  

> +#include <Guid/Fdt.h>

>  #include <Guid/FdtHob.h>

>  

>  #include <Protocol/FdtClient.h>

> @@ -234,6 +235,7 @@ InitializeFdtClientDxe (

>  {

>    VOID              *Hob;

>    VOID              *DeviceTreeBase;

> +  EFI_STATUS        Status;

>  

>    Hob = GetFirstGuidHob (&gFdtHobGuid);

>    if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (UINT64)) {

> @@ -251,6 +253,15 @@ InitializeFdtClientDxe (

>  

>    DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));

>  

> +  if (!FeaturePcdGet (PcdPureAcpiBoot)) {

> +    //

> +    // Only install the FDT as a configuration table if we want to leave it up

> +    // to the OS to decide whether it prefers ACPI over DT.

> +    //

> +    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);

> +    ASSERT_EFI_ERROR (Status);

> +  }

> +

>    return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,

>                  EFI_NATIVE_INTERFACE, &mFdtClientProtocol);

>  }

> diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c

> index 8fe1277b6b49..cebd4aa91fd9 100644

> --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c

> +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c

> @@ -28,7 +28,6 @@

>  #include <libfdt.h>

>  #include <Library/XenIoMmioLib.h>

>  

> -#include <Guid/Fdt.h>

>  #include <Guid/VirtioMmioTransport.h>

>  #include <Guid/FdtHob.h>

>  

> @@ -215,14 +214,5 @@ InitializeVirtFdtDxe (

>      }

>    }

>  

> -  if (!FeaturePcdGet (PcdPureAcpiBoot)) {

> -    //

> -    // Only install the FDT as a configuration table if we want to leave it up

> -    // to the OS to decide whether it prefers ACPI over DT.

> -    //

> -    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);

> -    ASSERT_EFI_ERROR (Status);

> -  }

> -

>    return EFI_SUCCESS;

>  }

> 


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/FdtClientDxe/FdtClientDxe.inf b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
index 3647d37b02d2..3a0cd37040eb 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
@@ -43,6 +43,10 @@  [Protocols]
 
 [Guids]
   gFdtHobGuid
+  gFdtTableGuid
+
+[FeaturePcd]
+  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot
 
 [Depex]
   TRUE
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
index 8c098e5885ae..4dd46cf87011 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
@@ -45,13 +45,9 @@  [LibraryClasses]
   XenIoMmioLib
 
 [Guids]
-  gFdtTableGuid
   gVirtioMmioTransportGuid
   gFdtHobGuid
 
-[FeaturePcd]
-  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot
-
 [Protocols]
   gEfiDevicePathProtocolGuid
 
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index 9c589e620cb4..c336e2410033 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -20,6 +20,7 @@ 
 #include <Library/HobLib.h>
 #include <libfdt.h>
 
+#include <Guid/Fdt.h>
 #include <Guid/FdtHob.h>
 
 #include <Protocol/FdtClient.h>
@@ -234,6 +235,7 @@  InitializeFdtClientDxe (
 {
   VOID              *Hob;
   VOID              *DeviceTreeBase;
+  EFI_STATUS        Status;
 
   Hob = GetFirstGuidHob (&gFdtHobGuid);
   if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (UINT64)) {
@@ -251,6 +253,15 @@  InitializeFdtClientDxe (
 
   DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));
 
+  if (!FeaturePcdGet (PcdPureAcpiBoot)) {
+    //
+    // Only install the FDT as a configuration table if we want to leave it up
+    // to the OS to decide whether it prefers ACPI over DT.
+    //
+    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
+    ASSERT_EFI_ERROR (Status);
+  }
+
   return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
                 EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
 }
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 8fe1277b6b49..cebd4aa91fd9 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -28,7 +28,6 @@ 
 #include <libfdt.h>
 #include <Library/XenIoMmioLib.h>
 
-#include <Guid/Fdt.h>
 #include <Guid/VirtioMmioTransport.h>
 #include <Guid/FdtHob.h>
 
@@ -215,14 +214,5 @@  InitializeVirtFdtDxe (
     }
   }
 
-  if (!FeaturePcdGet (PcdPureAcpiBoot)) {
-    //
-    // Only install the FDT as a configuration table if we want to leave it up
-    // to the OS to decide whether it prefers ACPI over DT.
-    //
-    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
-    ASSERT_EFI_ERROR (Status);
-  }
-
   return EFI_SUCCESS;
 }