From patchwork Thu Mar 9 17:21:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 95129 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp458613qgd; Thu, 9 Mar 2017 09:21:24 -0800 (PST) X-Received: by 10.99.171.5 with SMTP id p5mr14939768pgf.182.1489080084526; Thu, 09 Mar 2017 09:21:24 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id d24si7006445plj.282.2017.03.09.09.21.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 09:21:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A3ACA80398; Thu, 9 Mar 2017 09:21:22 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: drjones@redhat.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek 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