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 2/3] ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot
Date: Thu, 9 Mar 2017 17:55:27 +0100 [thread overview]
Message-ID: <df454b64-8ebf-d785-7c52-8e8cc577ef3a@redhat.com> (raw)
In-Reply-To: <1489075441-23745-3-git-send-email-ard.biesheuvel@linaro.org>
On 03/09/17 17:04, Ard Biesheuvel wrote:
> Wait for ReadyToBoot to install the FDT configuration table. 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>
> ---
> ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 41 ++++++++++++++++----
> ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf | 1 +
> 2 files changed, 34 insertions(+), 8 deletions(-)
>
> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> index 7cc0c44ca12a..0327af5739f2 100644
> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> @@ -303,6 +303,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);
OK, you didn't forget to close the event. :)
> +}
> +
> +STATIC EFI_EVENT ReadyToBootEvent;
This should be called "mReadyToBootEvent".
> +
> EFI_STATUS
> EFIAPI
> InitializeFdtClientDxe (
> @@ -330,14 +354,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);
> - }
> + Status = gBS->CreateEventEx (
> + EVT_NOTIFY_SIGNAL,
> + TPL_CALLBACK,
> + OnReadyToBoot,
> + NULL,
> + &gEfiEventReadyToBootGuid,
> + &ReadyToBootEvent
> + );
> + ASSERT_EFI_ERROR (Status);
I guess it's OK to insist that this succeed.
Also, this is done after the assignment to mDeviceTreeBase, so that's good.
>
> return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
> EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
However, if the protocol installation fails for any reason, we exit the
driver with an error code, and the driver will be unloaded. We'll have a
dangling callback pointer
In case of failure, the event should be closed (== CreateEventEx()
should be undone).
> 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
>
>
For completeness, can you please also
#include <Guid/EventGroup.h>
for gEfiEventReadyToBootGuid's sake, in the C file? (It is already
pulled in by something else, but, again, for completenes...)
Looks okay to me otherwise.
Thanks
Laszlo
next prev parent reply other threads:[~2017-03-09 16:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 16:03 [PATCH 0/3] ArmVirtQemu: make DT vs ACPI support mutually exclusive Ard Biesheuvel
2017-03-09 16:03 ` [PATCH 1/3] ArmVirtPkg/ArmVirtPL031FdtClientLib: unconditionally disable DT node Ard Biesheuvel
2017-03-09 16:25 ` Leif Lindholm
2017-03-09 16:51 ` Laszlo Ersek
2017-03-09 16:04 ` [PATCH 2/3] ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot Ard Biesheuvel
2017-03-09 16:31 ` Leif Lindholm
2017-03-09 16:55 ` Laszlo Ersek [this message]
2017-03-09 16:04 ` [PATCH 3/3] ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent Ard Biesheuvel
2017-03-09 16:33 ` Leif Lindholm
2017-03-09 17:07 ` Laszlo Ersek
2017-03-11 5:55 ` Laszlo Ersek
2017-03-11 6:57 ` Ard Biesheuvel
2017-03-11 7:38 ` Laszlo Ersek
2017-03-11 10:26 ` Leif Lindholm
2017-03-13 10:23 ` Ard Biesheuvel
2017-03-13 14:53 ` Laszlo Ersek
2017-03-13 14:59 ` Ard Biesheuvel
2017-03-13 20:39 ` Laszlo Ersek
2017-03-13 20:55 ` Laszlo Ersek
2017-03-13 20:55 ` Ard Biesheuvel
2017-03-11 7:21 ` Laszlo Ersek
2017-03-11 7:30 ` Ard Biesheuvel
2017-03-11 7:41 ` Laszlo Ersek
2017-03-11 9:19 ` Ard Biesheuvel
2017-03-11 10:06 ` Laszlo Ersek
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=df454b64-8ebf-d785-7c52-8e8cc577ef3a@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