From nobody Sat Nov 2 14:36:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489080086402296.18043916401314; Thu, 9 Mar 2017 09:21:26 -0800 (PST) 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) 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) 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) X-Original-To: edk2-devel@lists.01.org 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) 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Laszlo Ersek --- 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/FdtClientD= xe/FdtClientDxe.c index 547a29fce62c..4cf79f70cb2a 100644 --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c @@ -20,6 +20,7 @@ #include #include =20 +#include #include #include =20 @@ -306,6 +307,30 @@ STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol =3D { GetOrInsertChosenNode, }; =20 +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 i= t up + // to the OS to decide whether it prefers ACPI over DT. + // + Status =3D gBS->InstallConfigurationTable (&gFdtTableGuid, mDeviceTree= Base); + ASSERT_EFI_ERROR (Status); + } + + gBS->CloseEvent (Event); +} + +STATIC EFI_EVENT mReadyToBootEvent; + EFI_STATUS EFIAPI InitializeFdtClientDxe ( @@ -333,15 +358,21 @@ InitializeFdtClientDxe ( =20 DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase)); =20 - if (!FeaturePcdGet (PcdPureAcpiBoot)) { - // - // Only install the FDT as a configuration table if we want to leave i= t up - // to the OS to decide whether it prefers ACPI over DT. - // - Status =3D gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeB= ase); - ASSERT_EFI_ERROR (Status); + Status =3D gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProto= colGuid, + EFI_NATIVE_INTERFACE, &mFdtClientProtocol); + if (EFI_ERROR (Status)) { + return Status; } =20 - return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolG= uid, - EFI_NATIVE_INTERFACE, &mFdtClientProtocol); + Status =3D 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/FdtClien= tDxe/FdtClientDxe.inf index 3a0cd37040eb..00017727c32c 100644 --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf @@ -42,6 +42,7 @@ [Protocols] gFdtClientProtocolGuid ## PRODUCES =20 [Guids] + gEfiEventReadyToBootGuid gFdtHobGuid gFdtTableGuid =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel