public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, edk2-devel@ml01.01.org
Cc: drjones@redhat.com, leif.lindholm@linaro.org
Subject: Re: [PATCH v2 3/4] ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot
Date: Thu, 9 Mar 2017 18:33:09 +0100	[thread overview]
Message-ID: <6a89fbf7-5fa6-8e84-9b83-58e38f5d21fc@redhat.com> (raw)
In-Reply-To: <1489080073-13328-4-git-send-email-ard.biesheuvel@linaro.org>

On 03/09/17 18:21, Ard Biesheuvel wrote:
> Defer FDT configuration table installation until ReadyToBoot is signaled.
> This allows any driver to make modifications in the mean time, and will
> also allow us to defer the decision of whether to install it in the first
> place to later on in the boot.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.c   | 49 ++++++++++++++++----
>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf |  1 +
>  2 files changed, 41 insertions(+), 9 deletions(-)
> 
> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> index 547a29fce62c..4cf79f70cb2a 100644
> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> @@ -20,6 +20,7 @@
>  #include <Library/HobLib.h>
>  #include <libfdt.h>
>  
> +#include <Guid/EventGroup.h>
>  #include <Guid/Fdt.h>
>  #include <Guid/FdtHob.h>
>  
> @@ -306,6 +307,30 @@ STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {
>    GetOrInsertChosenNode,
>  };
>  
> +STATIC
> +VOID
> +EFIAPI
> +OnReadyToBoot (
> +  EFI_EVENT       Event,
> +  VOID            *Context
> +  )
> +{
> +  EFI_STATUS      Status;
> +
> +  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, mDeviceTreeBase);
> +    ASSERT_EFI_ERROR (Status);
> +  }
> +
> +  gBS->CloseEvent (Event);
> +}
> +
> +STATIC EFI_EVENT         mReadyToBootEvent;
> +
>  EFI_STATUS
>  EFIAPI
>  InitializeFdtClientDxe (
> @@ -333,15 +358,21 @@ 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);
> +  Status = gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
> +                  EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
> +  if (EFI_ERROR (Status)) {
> +    return Status;
>    }
>  
> -  return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
> -                EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
> +  Status = gBS->CreateEventEx (
> +                  EVT_NOTIFY_SIGNAL,
> +                  TPL_CALLBACK,
> +                  OnReadyToBoot,
> +                  NULL,
> +                  &gEfiEventReadyToBootGuid,
> +                  &mReadyToBootEvent
> +                  );
> +  ASSERT_EFI_ERROR (Status);
> +
> +  return EFI_SUCCESS;
>  }
> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> index 3a0cd37040eb..00017727c32c 100644
> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> @@ -42,6 +42,7 @@ [Protocols]
>    gFdtClientProtocolGuid                  ## PRODUCES
>  
>  [Guids]
> +  gEfiEventReadyToBootGuid
>    gFdtHobGuid
>    gFdtTableGuid
>  
> 

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


  reply	other threads:[~2017-03-09 17:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 17:21 [PATCH v2 0/4] ArmVirtPkg: make DT vs ACPI support mutually exclusive Ard Biesheuvel
2017-03-09 17:21 ` [PATCH v2 1/4] ArmVirtPkg/FdtClientDxe: supplement missing EFIAPI calling conv specifiers Ard Biesheuvel
2017-03-09 17:29   ` Laszlo Ersek
2017-03-09 17:32     ` Leif Lindholm
2017-03-09 17:21 ` [PATCH v2 2/4] ArmVirtPkg/ArmVirtPL031FdtClientLib: unconditionally disable DT node Ard Biesheuvel
2017-03-09 17:21 ` [PATCH v2 3/4] ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot Ard Biesheuvel
2017-03-09 17:33   ` Laszlo Ersek [this message]
2017-03-09 17:21 ` [PATCH v2 4/4] ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent Ard Biesheuvel
2017-03-09 17:35   ` Laszlo Ersek
2017-03-09 17:39 ` [PATCH v2 0/4] ArmVirtPkg: make DT vs ACPI support mutually exclusive Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a89fbf7-5fa6-8e84-9b83-58e38f5d21fc@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox