From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (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 CBB328038F for ; Thu, 9 Mar 2017 08:04:11 -0800 (PST) Received: by mail-wm0-x22f.google.com with SMTP id n11so59749791wma.0 for ; Thu, 09 Mar 2017 08:04:11 -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=MgiKS4l3zKU8aOhetE7xTpDCzz2Fte6+KhmR5XwOgZE=; b=kZU+ruQ6pKXfTb9Nh7PYfTbGiJLrvQHjh8g12X+Ar4PyiJC5HAuuFZOHcn0DflmJHj WMGM6kbcNhB1e4uaIM49e0LusRDhe9X/qSocyW4E4nx6TO2OVr+M0ddAr/Aru83KWw27 fPRwTWU578lJ4RZgFsQ7ZOaW5fJMNyzWe4PDA= 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=MgiKS4l3zKU8aOhetE7xTpDCzz2Fte6+KhmR5XwOgZE=; b=FmgWUjfevfDhtc4HhWEruVe1Uhso2CD+5DBsxytiKcgFu3WtitDVpr0YGaaoPjncxk dm06pCxhmsVpwudjE0whh7ltuaS0rlLmkKrDr3ZBxahZ9/RhbgxIjZnZrWxfbHHMVIKk SM7BmkZlQdyh8UKhRD/bST6i9JqzTZSiHy8rt9ZBjz7dwPcbFOOXnM1hdoxqJCb4spaI Mj+KzX+YJa3hlxZJFvXTQ4WsLUTA6DWoXdxownXaaeNxJ0UTWIBT+lG0X+avoXJw84su Pp6cQfJSsUowPGcxocIvkRtoA1CsPWJqg/Je4ZoXDihXtg61WvPRTSP6TgpgeVQjXN/o vGYA== X-Gm-Message-State: AMke39naT4C1Bq3QlDgp99vCHR7p6MtBs43x5G5eV2sHaRduZnTNbW/6Vqpx0raVTlABeh1Z X-Received: by 10.28.170.67 with SMTP id t64mr28270575wme.18.1489075450256; Thu, 09 Mar 2017 08:04:10 -0800 (PST) Received: from ards-macbook-pro.c.hoisthospitality.com ([109.74.48.129]) by smtp.gmail.com with ESMTPSA id t194sm27830872wmd.13.2017.03.09.08.04.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 08:04:09 -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 17:04:00 +0100 Message-Id: <1489075441-23745-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489075441-23745-1-git-send-email-ard.biesheuvel@linaro.org> References: <1489075441-23745-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 2/3] 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 16:04:12 -0000 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 --- 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); +} + +STATIC EFI_EVENT ReadyToBootEvent; + 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); return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid, EFI_NATIVE_INTERFACE, &mFdtClientProtocol); 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