From nobody Thu Dec 18 20:00:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+77168+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+77168+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1624874137; cv=none; d=zohomail.com; s=zohoarc; b=ShExQsK2UaRBtTrPycmioTcjGzTam+ugtFzgQTAG7XujLSuuDvRgIjovqHdgFqwiWMJepP2noqlOBosDElbzGqpt1lGj0jlFnzMtATkC/YbWVnfnxQCLYlUhJti6lTM5d5O6QYguXBPaRRGQJTgn9sG90DV9aOVVf/9ewxjxoUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624874137; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Q04hDrnhAGP513bGAEJFCL50kdi6JjMsYdNJ5RFspcY=; b=Yd+3gLkkIqmZsU7tJXdp1nLHKdzsre7sdBmW36ymTpXXlE9MTQ56T67ZfRwNLWDWGn6bHm0z6UWqEMd7Ixpz1QsCGkO9Ro3c7X8JT4wJADyPxXSrS6iGte7iz1e8FdREVzPpokC0Wfvvk0zHaZiIwTX6qm9y1Y/eC3gSujP/Qg8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+77168+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624874137319729.4249508307744; Mon, 28 Jun 2021 02:55:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6z5wYY1788612xEzn5J5Gscg; Mon, 28 Jun 2021 02:55:37 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.9049.1624874131324244780 for ; Mon, 28 Jun 2021 02:55:31 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D2E21D6E; Mon, 28 Jun 2021 02:55:25 -0700 (PDT) X-Received: from entos-thunderx2-desktop.shanghai.arm.com (entos-thunderx2-desktop.shanghai.arm.com [10.169.212.208]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C156D3F694; Mon, 28 Jun 2021 02:55:23 -0700 (PDT) From: "Jianyong Wu" To: devel@edk2.groups.io Cc: lersek@redhat.com, sami.mujawar@arm.com, ardb+tianocore@kernel.org, justin.he@arm.com, jianyong.wu@arm.com Subject: [edk2-devel] [PATCH v3 1/3] Acpi: reimplement PlatformHasAcpi for Cloud Hypervisor Date: Mon, 28 Jun 2021 17:55:04 +0800 Message-Id: <20210628095506.36076-2-jianyong.wu@arm.com> In-Reply-To: <20210628095506.36076-1-jianyong.wu@arm.com> References: <20210628095506.36076-1-jianyong.wu@arm.com> Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jianyong.wu@arm.com X-Gm-Message-State: nGX3FZrrgZdlOdaJULtxCv9Gx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624874137; bh=EgtY+aWLNQcssdAqJ9/uzgf/I08iSLJtJegHS72/kEI=; h=Cc:Date:From:Reply-To:Subject:To; b=Ab8+5RkYFGqZdKhWMnDH6DLqbPNcjqQdr6U7Qqf6LNzhy9M9V6ZNfJ0JTSzk44kwHT/ CLKaGpUyIR3bXJq2erYsAWE/BqX26brOypud+1NCfJbfKcz8h/H+TeE914OHiWDYCubGu MBt3U8/Qd420trehIWrE4bXgSGoPLhDoaVo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The current implementation of PlatformHasAcpiDt is not a common library and is on behalf of qemu. So give a specific version for Cloud Hypervisor here. Signed-off-by: Jianyong Wu Reviewed-by: Sami Mujawar --- .../CloudHvHasAcpiDtDxe.inf | 43 ++++++++++++ .../CloudHvHasAcpiDtDxe.c | 69 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDt= Dxe.inf create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDt= Dxe.c diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf= b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf new file mode 100644 index 000000000000..eb63a4136545 --- /dev/null +++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf @@ -0,0 +1,43 @@ +## @file +# Decide whether the firmware should expose an ACPI- and/or a Device Tree-= based +# hardware description to the operating system. +# +# Copyright (c) 2021, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 1.25 + BASE_NAME =3D CloudHvPlatformHasAcpiDtDxe + FILE_GUID =3D 71fe72f9-6dc1-199d-5054-13b4200ee88d + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PlatformHasAcpiDt + +[Sources] + CloudHvHasAcpiDtDxe.c + +[Packages] + ArmVirtPkg/ArmVirtPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + PcdLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL + gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL + +[Pcd] + gArmVirtTokenSpaceGuid.PcdForceNoAcpi + +[Depex] + gEfiVariableArchProtocolGuid diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c b= /ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c new file mode 100644 index 000000000000..48a446c68a45 --- /dev/null +++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c @@ -0,0 +1,69 @@ +/** @file + Decide whether the firmware should expose an ACPI- and/or a Device Tree-= based + hardware description to the operating system. + + Copyright (c) 2021, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +PlatformHasAcpiDt ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // If we fail to install any of the necessary protocols below, the OS wi= ll be + // unbootable anyway (due to lacking hardware description), so tolerate = no + // errors here. + // + if (MAX_UINTN =3D=3D MAX_UINT64 && + !PcdGetBool (PcdForceNoAcpi)) + { + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkiiPlatformHasAcpiGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + if (EFI_ERROR (Status)) { + goto Failed; + } + + return Status; + } + + // + // Expose the Device Tree otherwise. + // + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkiiPlatformHasDeviceTreeGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + if (EFI_ERROR (Status)) { + goto Failed; + } + + return Status; + +Failed: + ASSERT_EFI_ERROR (Status); + CpuDeadLoop (); + // + // Keep compilers happy. + // + return Status; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#77168): https://edk2.groups.io/g/devel/message/77168 Mute This Topic: https://groups.io/mt/83841320/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-