From nobody Thu May 16 23:34:39 2024 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+107971+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+107971+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1692778293; cv=none; d=zohomail.com; s=zohoarc; b=mVP/j79osJVOREj5dMB/3YN3h02gVcRd3xi3i1AqmnHm1kUmPI5Xszgtg4KFtukxexJUthB42OAcgt9cW3RbLIdxrTmRLfnKw2teKW7x+bWAoF6hRDvPgWXuoJoJboEDMWK84T5T7wZeqGoaP2dfiEI0RIRe52jens8qevQgLuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692778293; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=TjPCxsPI1QLRJTdAGA+PaSNZMWtx7h5+ZnDQ2LU9UEE=; b=lTvsZz0BVEld+/jcR7rRrdHyka1HiBVvW566Q0aWjnVV0nTB0C9wv+V/oEIg4C985TGI70rvOvveWEgEcZ0vvPYz4Acivb6qkTEHy+qi4cTmxW6j8+STvMZQqYm7IJDXUt8gkhltUrIsmU6AKzIoYQg54A5xrEDc2Io77mXkdww= 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+107971+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 1692778293420561.2007286384915; Wed, 23 Aug 2023 01:11:33 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=j4IOwe2Z0CiR2tiC8wk8BK0vmoiOEaCx1TZDkposSKQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1692778292; v=1; b=Jlyo8vaCXsXHp2r54qEYixERZ4NwhoSQe1lelx9pvP+v0b3g7Jbsh5kIbegcgvc9QsXM7aB+ BkKYQinObrGZI42lu19z70mnsktCS5k5dhLB5cd/A+LJtArlsP4c6hlQv2j46xb4jplvsOMsyWR UZgRVsL3+FJCmRqQHjc0DMMY= X-Received: by 127.0.0.2 with SMTP id 4wFgYY1788612xoSlWITLu5v; Wed, 23 Aug 2023 01:11:32 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.6928.1692778291801629269 for ; Wed, 23 Aug 2023 01:11:32 -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 E019A113E; Wed, 23 Aug 2023 01:12:11 -0700 (PDT) X-Received: from josmar02Desktop.cambridge.arm.com (josmar02Desktop.cambridge.arm.com [10.2.78.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 75EBF3F740; Wed, 23 Aug 2023 01:11:30 -0700 (PDT) From: "Jose Marinho" To: devel@edk2.groups.io Cc: Jose Marinho , Sami Mujawar , Pierre Gondois , Samer El-Haj-Mahmoud Subject: [edk2-devel] [PATCH] DynamicTablesPkg: HOWTO for Handcrafted tables Date: Wed, 23 Aug 2023 09:11:15 +0100 Message-Id: <20230823081115.792120-1-jose.marinho@arm.com> MIME-Version: 1.0 Precedence: Bulk 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,jose.marinho@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 6C7qRDyp2WJUSSgy7RQEorEmx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1692778294493100001 Content-Type: text/plain; charset="utf-8" Cc: Sami Mujawar Cc: Pierre Gondois Cc: Samer El-Haj-Mahmoud Signed-off-by: Jose Marinho --- DynamicTablesPkg/Readme.md | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/DynamicTablesPkg/Readme.md b/DynamicTablesPkg/Readme.md index 6b0a6c7a40..bfc2715a85 100644 --- a/DynamicTablesPkg/Readme.md +++ b/DynamicTablesPkg/Readme.md @@ -157,6 +157,126 @@ performed, and validate the generated output. - Disassemble the generated AML using the iASL compiler and verifying the output. =20 +### Bespoke ACPI tables + +The Dynamic Tables framework supports the creation of several tables using +standard generators, see Feature Summary Section for a list of such tables. + +The supported platforms already contain several tables. +If a table is not present for the platform, two alternative processes can = be followed: + +- define the table in using ASL, +- define the table in packed C structures (also known as RAW). + +The two approaches are detailed below. + +#### Adding an ASL table for which the Dynamic Tables Framework does not p= rovide a standard generator + +This method creates the SSDT table from the ASL source, using a standard g= enerator. +Perform the following steps: + +1. Create the table source file, placing it within the ConfigurationManage= r source tree, e.g.: + +Create a file Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationM= anagerDxe/AslTables/NewTableSource.asl +with the following contents: + +``` +DefinitionBlock ("", "SSDT", 2, "XXXXXX", "XXXXXXXX", 1) { + Scope(_SB) { + Device(FLA0) { + Name(_HID, "XXXX0000") + Name(_UID, 0) + + // _DSM - Device Specific Method + Function(_DSM,{IntObj,BuffObj},{BuffObj, IntObj, IntObj, PkgObj}) + { + W0 =3D 0x1 + return (W0) + } + } + } +} +``` + +2. Reference the table source file in ConfigurationMangerDxe.inf + +``` + [Sources] + AslTables/NewTableSource.asl +``` + +3. Update the ConfigurationManager.h file +Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/Conf= igurationManager.h + + 1. Add an array to hold the AML code: +``` + extern CHAR8 newtablesource_aml_code[]; +``` + +Note: the array name is composed of the ASL source file name all in lower = case, followed by the _aml_code postfix. + +4. Increment the macro PLAT_ACPI_TABLE_COUNT + +5. Add a new CM_STD_OBJ_ACPI_TABLE_INFO structure entry and initialise. + + - the entry contains: + - the table signature, + - the table revision (unused in this case), + - the ID of the standard generator to be used (the SSDT generator in t= his case). + - a pointer to the AML code, + +``` + // Table defined in the NewTableSource.asl file + { + EFI_ACPI_6_4_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, + 0, // Unused + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt), + (EFI_ACPI_DESCRIPTION_HEADER*)newtablesource_aml_code + }, +``` + +#### Add a RAW table for which there is no standard generator + +An ACPI table can be defined as a packed C struct in the C source code. Th= is is referred to as the "raw" table format. +The steps to create a table in raw format are detailed below: + +1. Define the table in a C source file and populate the ACPI table structu= re field with the required values. + + For example, create the file Platform/ARM/VExpressPkg/ConfigurationManage= r/ConfigurationManagerDxe/RawTable.c + +``` + // Example creating the HMAT in raw format + EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat =3D { + ... + }; +``` + +2. Reference the table source file in ConfigurationMangerDxe.inf + +``` + [Sources] + RawTable.c +``` + +2. Increment the macro PLAT_ACPI_TABLE_COUNT + +3. Add a new CM_STD_OBJ_ACPI_TABLE_INFO structure entry and initialise. + + - the entry contains: + - the table signature, + - the table revision, + - the RAW generator ID. + - a pointer to the C packed struct that defines the table, + +``` + { + EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, + EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdRaw), + (EFI_ACPI_DESCRIPTION_HEADER*)&Hmat + }, +``` + # Roadmap =20 The current implementation of the Configuration Manager populates the --=20 2.40.0.141.g8d90352acc -=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 (#107971): https://edk2.groups.io/g/devel/message/107971 Mute This Topic: https://groups.io/mt/100910824/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-