From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8A87A80394 for ; Thu, 9 Mar 2017 09:21:20 -0800 (PST) Received: by mail-wm0-x234.google.com with SMTP id t189so61435599wmt.1 for ; Thu, 09 Mar 2017 09:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K+TSXRYOhG1qOMOaMRKD+PU5iR5sL2ymvObH0i5EPDs=; b=SEqJcWzBfhfMMzMlA3FRc1t6DJiFdkD0TQYwD3fr6CVztlAnD4C0K51Q1Vc3xUBO8m uyDO7A/gEowtCzgoZxL4x5bJnLonPm8wmSi08J33KJRFM8NA2+KA3eKOUd5aILxZ4VZn HzD4GrBCNUlQjvkpOu6QlkfqsLhOJ5y3p7A3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K+TSXRYOhG1qOMOaMRKD+PU5iR5sL2ymvObH0i5EPDs=; b=sbE/e3BJFjNr05uJf45JnZYL0fJoSEKVhTv3OE4eUH58kGxPg1u8ronPMja+8tTPbT TyiJGg0lIjz8nWQMw8SaHxF7u+FtZhuV6CUR9+483w+a35RWivVsWR8iyYMvzz3j3Svg QWWI8iD5BLZ/LWrUfxE1zbP9AgZX0o07J6kjDUeVJMO4eBYqKcNXxbnula6ENkEnIlJ+ c0tCIgPIDEagyF/VVzPR2hToM5yPm6Zc31rSXEKgJaF8CZ/bHxLw7tVFpH+etZ6f0ugZ QthWNtk6pYG+Kl1wPxWvD3jQ/rxaaYmojqwKQefssIMHP5tbdo7HZyAizjEi9FHESblp cuGw== X-Gm-Message-State: AMke39lDgzBfCHbes7ZcroorrycM8ZtYSFrCQqzlhiNEV7P+9piwODYMmLeVlJcACuRyr9lA X-Received: by 10.28.5.72 with SMTP id 69mr11249959wmf.6.1489080079123; Thu, 09 Mar 2017 09:21:19 -0800 (PST) Received: from ards-macbook-pro.c.hoisthospitality.com ([109.74.48.129]) by smtp.gmail.com with ESMTPSA id p93sm8928768wrc.67.2017.03.09.09.21.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 09:21:18 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Cc: drjones@redhat.com, leif.lindholm@linaro.org, Ard Biesheuvel Date: Thu, 9 Mar 2017 18:21:12 +0100 Message-Id: <1489080073-13328-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489080073-13328-1-git-send-email-ard.biesheuvel@linaro.org> References: <1489080073-13328-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [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:21:20 -0000 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 -- 2.7.4