From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B454880391 for ; Thu, 9 Mar 2017 09:33:12 -0800 (PST) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51F644E358; Thu, 9 Mar 2017 17:33:13 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-228.phx2.redhat.com [10.3.116.228]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29HXBnJ006132; Thu, 9 Mar 2017 12:33:11 -0500 To: Ard Biesheuvel , edk2-devel@ml01.01.org References: <1489080073-13328-1-git-send-email-ard.biesheuvel@linaro.org> <1489080073-13328-4-git-send-email-ard.biesheuvel@linaro.org> Cc: drjones@redhat.com, leif.lindholm@linaro.org From: Laszlo Ersek Message-ID: <6a89fbf7-5fa6-8e84-9b83-58e38f5d21fc@redhat.com> Date: Thu, 9 Mar 2017 18:33:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1489080073-13328-4-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 09 Mar 2017 17:33:13 +0000 (UTC) Subject: Re: [PATCH v2 3/4] ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 17:33:12 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 > Reviewed-by: Leif Lindholm > --- > 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 > #include > > +#include > #include > #include > > @@ -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