From nobody Mon Feb 9 22:39:01 2026 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+81587+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+81587+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1633620771; cv=none; d=zohomail.com; s=zohoarc; b=J5TWKJ7yVPeKOZwysdLjrFuYb1qiTAOJ6Avp9kRGJYZVLZ0bHBa8Fk4Twc1xuii6dEYCkSPzpz8XmaQedizVfBhgtU0fbawOmXjwBzdVRxhptUJX6YJhkF95YnbhcZJYflv0zI3r5q8V9RoMAtS+Uh0YJzRJlxHOgZ2TNthPClI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633620771; h=Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=SHfsGqRcVIimXmauGbSyAESeJg2NXKk+PMD1uGJp8bc=; b=I5dk+2qCgL8cKc7Ahhx7T0LuvAWBhglMA79YkBrIHGL4aRgOrteQV3YJCP8afgTCa0Y8wkYNNTmiV2x0lVozeXs6afk8fr4WwSXa74/QFdzF6vgwTxqdZP+HwMY+xe/mZoovX2g1H7C0cYaE9RekpHwuX601FE4K8OIL1FBSiOg= 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+81587+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 1633620771491667.9716963746713; Thu, 7 Oct 2021 08:32:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id BO34YY1788612x0cAyIrTCgL; Thu, 07 Oct 2021 08:32:50 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.13577.1633620768001397205 for ; Thu, 07 Oct 2021 08:32:48 -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 6814511B3; Thu, 7 Oct 2021 08:32:42 -0700 (PDT) X-Received: from e120189.arm.com (unknown [10.57.72.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 62DCC3F66F; Thu, 7 Oct 2021 08:32:41 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io, Sami Mujawar , Alexei.Fedorov@arm.com Subject: [edk2-devel] [PATCH v2 03/21] DynamicTablesPkg: Add AddSsdtAcpiHeader() Date: Thu, 7 Oct 2021 16:31:52 +0100 Message-Id: <20211007153210.26608-4-Pierre.Gondois@arm.com> In-Reply-To: <20211007153210.26608-1-Pierre.Gondois@arm.com> References: <20211007153210.26608-1-Pierre.Gondois@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,pierre.gondois@arm.com X-Gm-Message-State: aFjh3NqijwFepXy2RQg0xDdrx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633620770; bh=wfKNS+v/dRy4u3eSFLrVEmZ3/yxwsa5dQf3TWI8nGdQ=; h=Date:From:Reply-To:Subject:To; b=emmcqqf92S06MACjg+y76GphAdE6uawcQ61sL7gh4V4AOc64TTV+i+pLA/SCr+6do4e 0jTXKrcY9RISZjSzu7dLsaL9rUcqBaPPLMc5Ou1gyT6z6ncU6b0/rAQiWrvoHzs/qjJAZ rOuR/uTUmP6jXLu61PYDPRVWyyMllWIup1E= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633620775072100006 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois To fetch the Oem information from the ConfigurationManagerProtocol and the AcpiTableInfo, and populate the SSDT ACPI header when creating a RootNode via the AmlLib, create AddSsdtAcpiHeader(). Signed-off-by: Pierre Gondois Reviewed-by: Sami Mujawar --- .../Include/Library/TableHelperLib.h | 35 ++++++++ .../Common/TableHelperLib/TableHelper.c | 87 +++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTab= lesPkg/Include/Library/TableHelperLib.h index 6d362ff99a27..76f9e8c25fea 100644 --- a/DynamicTablesPkg/Include/Library/TableHelperLib.h +++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h @@ -12,6 +12,8 @@ #ifndef TABLE_HELPER_LIB_H_ #define TABLE_HELPER_LIB_H_ =20 +#include + /** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_I= NFO object from the Configuration Manager. =20 @@ -62,6 +64,39 @@ AddAcpiHeader ( IN CONST UINT32 Length ); =20 +/** Build a RootNode containing SSDT ACPI header information using the Aml= Lib. + + The function utilizes the ACPI table Generator and the Configuration + Manager protocol to obtain any information required for constructing the + header. It then creates a RootNode. The SSDT ACPI header is part of the + RootNode. + + This is essentially a wrapper around AmlCodeGenDefinitionBlock () + from the AmlLib. + + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + protocol interface. + @param [in] Generator Pointer to the ACPI table Generator. + @param [in] AcpiTableInfo Pointer to the ACPI table info structure. + @param [out] RootNode If success, contains the created RootNode. + The SSDT ACPI header is part of the RootNod= e. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration + Manager is less than the Object size for t= he + requested object. +**/ +EFI_STATUS +EFIAPI +AddSsdtAcpiHeader ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtoc= ol, + IN CONST ACPI_TABLE_GENERATOR * CONST Generator, + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInf= o, + OUT AML_ROOT_NODE_HANDLE * RootNode + ); + /** Function prototype for testing if two arbitrary objects are equal. =20 diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c b= /DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c index f98da7ffdd67..d92c82eac99e 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c @@ -185,6 +185,93 @@ error_handler: return Status; } =20 +/** Build a RootNode containing SSDT ACPI header information using the Aml= Lib. + + The function utilizes the ACPI table Generator and the Configuration + Manager protocol to obtain any information required for constructing the + header. It then creates a RootNode. The SSDT ACPI header is part of the + RootNode. + + This is essentially a wrapper around AmlCodeGenDefinitionBlock () + from the AmlLib. + + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + protocol interface. + @param [in] Generator Pointer to the ACPI table Generator. + @param [in] AcpiTableInfo Pointer to the ACPI table info structure. + @param [out] RootNode If success, contains the created RootNode. + The SSDT ACPI header is part of the RootNod= e. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration + Manager is less than the Object size for t= he + requested object. +**/ +EFI_STATUS +EFIAPI +AddSsdtAcpiHeader ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtoc= ol, + IN CONST ACPI_TABLE_GENERATOR * CONST Generator, + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInf= o, + OUT AML_ROOT_NODE_HANDLE * RootNode + ) +{ + EFI_STATUS Status; + UINT64 OemTableId; + UINT32 OemRevision; + CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo; + + ASSERT (CfgMgrProtocol !=3D NULL); + ASSERT (Generator !=3D NULL); + ASSERT (AcpiTableInfo !=3D NULL); + + if ((CfgMgrProtocol =3D=3D NULL) || + (Generator =3D=3D NULL) || + (AcpiTableInfo =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + Status =3D GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to get Configuration Manager info. Status =3D %r\n", + Status + )); + return Status; + } + + if (AcpiTableInfo->OemTableId !=3D 0) { + OemTableId =3D AcpiTableInfo->OemTableId; + } else { + OemTableId =3D SIGNATURE_32 ( + CfgMfrInfo->OemId[0], + CfgMfrInfo->OemId[1], + CfgMfrInfo->OemId[2], + CfgMfrInfo->OemId[3] + ) | + ((UINT64)Generator->AcpiTableSignature << 32); + } + + if (AcpiTableInfo->OemRevision !=3D 0) { + OemRevision =3D AcpiTableInfo->OemRevision; + } else { + OemRevision =3D CfgMfrInfo->Revision; + } + + Status =3D AmlCodeGenDefinitionBlock ( + "SSDT", + (CONST CHAR8*)&CfgMfrInfo->OemId, + (CONST CHAR8*)&OemTableId, + OemRevision, + RootNode + ); + ASSERT_EFI_ERROR (Status); + return Status; +} + /** Test and report if a duplicate entry exists in the given array of compar= able elements. --=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 (#81587): https://edk2.groups.io/g/devel/message/81587 Mute This Topic: https://groups.io/mt/86148197/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-