From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.72]) by mx.groups.io with SMTP id smtpd.web09.9901.1633701981542154520 for ; Fri, 08 Oct 2021 07:06:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=3DFcbdAf; spf=pass (domain: arm.com, ip: 40.107.22.72, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gaPmp89WQmzpHiDkWgdwZwC9utEf0nyPkPKC/3R0U5A=; b=3DFcbdAfm+XY5ZNI4nazHLe03Jv98IP9j0WEKwucEWaYTzMXJDBwoQb6T3uUONzDr9gc0iBx6T8xJAVN8cYWOEq37KhPuthuThwJIWIdZpbA5B6U1jFccBPFixTs0r+nrSdSZ1/FMNWQqjiVdSaIXSoHGIRIBpE8WDc/d4hHcZ0= Received: from AM6P191CA0039.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::16) by DB9PR08MB6522.eurprd08.prod.outlook.com (2603:10a6:10:250::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Fri, 8 Oct 2021 14:06:18 +0000 Received: from AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:7f:cafe::5f) by AM6P191CA0039.outlook.office365.com (2603:10a6:209:7f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.21 via Frontend Transport; Fri, 8 Oct 2021 14:06:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT024.mail.protection.outlook.com (10.152.16.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Fri, 8 Oct 2021 14:06:18 +0000 Received: ("Tessian outbound d5def7722ff7:v103"); Fri, 08 Oct 2021 14:06:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c4b76f1a06044e2c X-CR-MTA-TID: 64aa7808 Received: from e514c96e29a2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2A7CB316-B7DC-4649-93AC-777FBB7D282F.1; Fri, 08 Oct 2021 14:06:12 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e514c96e29a2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Oct 2021 14:06:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f78dUHuo9Uo3LDc1kgUuI9vuybYZVf4EMNC7wt8tP8Lu2FTNPTIZOLbWbx4PBKe8Ep9hLNUkCkDcl+VDN7FnOmjgLzWWYdXECMI3O68Ag/KIe3ki5XJGginjWFy/h5D1JtvCT8lyZPUDez8V+pBx1qHLo86nfRljsunT+HJ3x1NY0hgJNA6lD2j6rITD+e21T5E7o/t2WQdDyod95iVNj7/xDmEumJCsCjZ6q5248pJQtxz0BO7xS1ILSvQFYPkiGQU2G59p//Jw5uZBZuoMWR6maYHCNwpv1a/5yevN5XvZqKam3wnCc28fbL84FMfgrcu38Xyqk6KHr3RrA8+W7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gaPmp89WQmzpHiDkWgdwZwC9utEf0nyPkPKC/3R0U5A=; b=ATnOUpWfFYa9DE/H2LK07qYTmu6/aiSMJ60wHgGTdHj/P0E6KbqJljx43hxyFy4CjXpUvz7U+OINMPXWuWoIKeY5vnRbaOEwZ9RZIljlReyoI84VFx2/LZmVUvGDDTPebXHHBSaHpckSklFuSgYYY1FmDu+PnCkYNHma+LZYzxZS1vhB21pQjlrYfu21Paqg4qMMBjTDhMacnGme5m5gzE4augGU9PSKeRhFOuBVkQKCdwR5r6Dxvi1eo0y75unHjAKbuOTpVs+NF/QkcV6TdJb3JfGA1sFReXmqmixAojGgJYfaKCbzLqlI6eeOFVcwBVz3GvRAzjxRFWJAKhR+/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gaPmp89WQmzpHiDkWgdwZwC9utEf0nyPkPKC/3R0U5A=; b=3DFcbdAfm+XY5ZNI4nazHLe03Jv98IP9j0WEKwucEWaYTzMXJDBwoQb6T3uUONzDr9gc0iBx6T8xJAVN8cYWOEq37KhPuthuThwJIWIdZpbA5B6U1jFccBPFixTs0r+nrSdSZ1/FMNWQqjiVdSaIXSoHGIRIBpE8WDc/d4hHcZ0= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM6PR08MB4535.eurprd08.prod.outlook.com (2603:10a6:20b:74::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Fri, 8 Oct 2021 14:06:11 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::54b5:239d:9896:ee65]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::54b5:239d:9896:ee65%4]) with mapi id 15.20.4587.022; Fri, 8 Oct 2021 14:06:11 +0000 Subject: Re: [PATCH v2 03/21] DynamicTablesPkg: Add AddSsdtAcpiHeader() To: Pierre.Gondois@arm.com, devel@edk2.groups.io, Alexei.Fedorov@arm.com, nd References: <20211007153210.26608-1-Pierre.Gondois@arm.com> <20211007153210.26608-4-Pierre.Gondois@arm.com> From: "Sami Mujawar" Message-ID: <4b5173c5-0ce1-5b27-925c-b17ccadf8e91@arm.com> Date: Fri, 8 Oct 2021 15:06:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20211007153210.26608-4-Pierre.Gondois@arm.com> X-ClientProxiedBy: LO4P265CA0038.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::6) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 Received: from [10.1.196.43] (217.140.106.52) by LO4P265CA0038.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.16 via Frontend Transport; Fri, 8 Oct 2021 14:06:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3291b110-8067-4d40-4c24-08d98a64ccc2 X-MS-TrafficTypeDiagnostic: AM6PR08MB4535:|DB9PR08MB6522: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 31CtefGh9cMFQ6vxoR6aR+1LT4D254cgsgzkIJHsuKj7sNBGAU4jxt7GLfaMzrIGl0a8Uj8D4QPvrXDv7o51N1/B4p1o2J3z2fARk9ADQCRl469c7FO0BEiTjYUmmHOuu+BPXsB1TrLPMRYGk6mFA1oAm7qUNO74ek6AgaUtlVoCpB81Qv94gQXK01I/sACQF3+9Av1MlxiByDHswfBOc5LquYZ8NuULvUPu3CmXWMbMYihVIxxrsHr/gfx5UB4PZl3LQBZ0fQgqRKicaqiEB1ZMgWlWSAcILvXh+Ts03MMwr1soSXJsuJW19q45BTchQ3xpNgiqxnkvDUSn2NP6b7W555hLbZUxt9FFYfuN5vzEzBOqyl47YxCbA9pR1afArL40Xds1k3OZBWU4QHMl17zU4F7tCR3Aath4DcTbGyw2cXi2TeQunHNpzojtLz67S82Z/mKHe59Bah7Bg7CKiJA7dx6G81oI7JiyjXLsEb4ANKUdJlFfs3jAUAYLuj0nDfF9/F9nPH+apc6f1nqXsKnhZILdM7WhuiQU1BsseekVsSJDKqsSk+QyKKFVOOzFUSaPm0dSRHVlTC5vDkGu4EMvNMGPHX3FrvWIw+cV58A/ZO13raaia6VTYsIgyT3zecWmgZqSN6nqLGs2os8MLKmdjk9X82+c5AZrpP+S+CKWjoq2HWXFaTA9bEBT9mHLHvf6Zk23zM+LgK56pVMmCojQwkitsJMIXVjKvXYl3bi/Sv8M7OK5wn3Ra0NYY+XcYhnIa8H+l32sTOtVvnvQBQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(2616005)(36756003)(31686004)(31696002)(66476007)(86362001)(37006003)(83380400001)(16576012)(8676002)(8936002)(2906002)(6862004)(66556008)(66946007)(956004)(6636002)(186003)(508600001)(38350700002)(38100700002)(44832011)(316002)(53546011)(5660300002)(26005)(52116002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4535 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ea17039c-fb70-45ec-9c37-08d98a64c87b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z3/u/ArCDYWcarF21tQ13CHzpvQRRrxPC8vFGLYyhmysGWvXsmZxwn56Ao1Wt1o5A7yOmqy9y0Jb3Nr8yvUT83+6G77AeTRWLFmx/ROk/+JINlKdaEQE/1+fXP+DeSpmRFda3ntRU2xEGYWgBuKNs8ywiadpgTDLqEqAKQyGfs3WlK4Mb58R96yIQD2dV5GDbfuIYN+O0x51kjlCKi1C0LlrpVhSQaAlVJXU3aHsuLU+ALgAxmixVMc2VSxsdS3FQAsoBTBgoL4WI4hOwcNL6zm9zt65Daex6K+gjDC6Sq31+f/fTOXGaEV/xY6suVGcMOOpt4CoNWYWxMNNS55H5xXep2hFOFV4OM7A3+X1Qo5HQJslRx4+7oSfXo9NQkyp9PQTFnljkMgffgFZ/G7FXFsUWl80ATzec4MzOe9jFhuYN//h/uucbDDh2cQicVxjgwp3NuEgdBogBi+9K7EVCvdkC41fyg84RqSrom/4ti7XwFi5hfeN5Q9QATuEt5r/I94t+eqaEpurSmp//Ns0557uCL3S06RM7eKN4iWiJUsO4oGgo8i+keDkly70xutC0A2ylkLg/FuB2Vgp6rhvX28ZwctBDgMf8K/1r8YPiA3FJHl92JtRmLp/IteyRKpUhOXtc2CnBztyghhfQkCa0HG48LFsXjI1Tqn2QVMhzjtvZBbJWXF33flF3cFk0hAnmPQjzkJhN3gjSM58ILtd6H3uPbSIqfnY/2gnkLddLQw= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(2906002)(83380400001)(36860700001)(186003)(26005)(53546011)(6636002)(6862004)(316002)(44832011)(508600001)(37006003)(16576012)(6486002)(70206006)(956004)(47076005)(86362001)(31686004)(31696002)(82310400003)(81166007)(356005)(8676002)(5660300002)(2616005)(70586007)(8936002)(336012)(36756003)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2021 14:06:18.5454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3291b110-8067-4d40-4c24-08d98a64ccc2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6522 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB Hi Pierre, Thank you for this patch. Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 07/10/2021 04:31 PM, Pierre.Gondois@arm.com wrote: > 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 > --- > .../Include/Library/TableHelperLib.h | 35 ++++++++ > .../Common/TableHelperLib/TableHelper.c | 87 +++++++++++++++++++ > 2 files changed, 122 insertions(+) > > diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicT= ablesPkg/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_ > > +#include > + > /** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGE= R_INFO > object from the Configuration Manager. > > @@ -62,6 +64,39 @@ AddAcpiHeader ( > IN CONST UINT32 Length > ); > > +/** Build a RootNode containing SSDT ACPI header information using the A= mlLib. > + > + The function utilizes the ACPI table Generator and the Configuration > + Manager protocol to obtain any information required for constructing t= he > + header. It then creates a RootNode. The SSDT ACPI header is part of th= e > + 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 RootN= ode. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND The required object information is not f= ound. > + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration > + Manager is less than the Object size for= the > + requested object. > +**/ > +EFI_STATUS > +EFIAPI > +AddSsdtAcpiHeader ( > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProt= ocol, > + IN CONST ACPI_TABLE_GENERATOR * CONST Generator, > + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableI= nfo, > + OUT AML_ROOT_NODE_HANDLE * RootNode > + ); > + > /** > Function prototype for testing if two arbitrary objects are equal. > > 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; > } > > +/** Build a RootNode containing SSDT ACPI header information using the A= mlLib. > + > + The function utilizes the ACPI table Generator and the Configuration > + Manager protocol to obtain any information required for constructing t= he > + header. It then creates a RootNode. The SSDT ACPI header is part of th= e > + 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 RootN= ode. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND The required object information is not f= ound. > + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration > + Manager is less than the Object size for= the > + requested object. > +**/ > +EFI_STATUS > +EFIAPI > +AddSsdtAcpiHeader ( > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProt= ocol, > + IN CONST ACPI_TABLE_GENERATOR * CONST Generator, > + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableI= nfo, > + 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 com= parable > elements. IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.