From nobody Mon Feb 9 21:37:11 2026 Delivered-To: importer@patchew.org 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+84512+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1638979614860300.5093741078721; Wed, 8 Dec 2021 08:06:54 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id o47zYY1788612xR3JlMrPNH0; Wed, 08 Dec 2021 08:06:54 -0800 X-Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.71]) by mx.groups.io with SMTP id smtpd.web12.14998.1638979612617470754 for ; Wed, 08 Dec 2021 08:06:53 -0800 X-Received: from DBBPR09CA0001.eurprd09.prod.outlook.com (2603:10a6:10:c0::13) by DB6PR0801MB1864.eurprd08.prod.outlook.com (2603:10a6:4:74::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 16:06:49 +0000 X-Received: from DB5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::59) by DBBPR09CA0001.outlook.office365.com (2603:10a6:10:c0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Wed, 8 Dec 2021 16:06:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; 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+84512+1787277+3901457@groups.io; helo=mail02.groups.io; 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; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT050.mail.protection.outlook.com (10.152.21.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.13 via Frontend Transport; Wed, 8 Dec 2021 16:06:49 +0000 X-Received: ("Tessian outbound f493ab4f1fb8:v110"); Wed, 08 Dec 2021 16:06:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c2968633760a69df X-CR-MTA-TID: 64aa7808 X-Received: from 5e2e6c599e81.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6A97D5E8-964D-48C5-A7EE-1255296DF05D.1; Wed, 08 Dec 2021 16:06:43 +0000 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5e2e6c599e81.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Dec 2021 16:06:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jIKilIx2dO7IMDbzuwIPj6OggEPtbMuoFGVcsfjL3JqewM3eorJBf//pF2V7lZoaynVdw/063pWDNzDfHjNNqfzzkqwfUp3+QlLZkYi5ILntMFQQdnGQQoSjRRaNUSYElH04KGO+yfvvsnaiLaVmT02+B8xsYjV7O02kEOYAVBQqSvVXBcZzBk02PpUCba/ECKZGcISPqa30p5H1QJFxBacm22TqdSCXPAgAezjXnQj9vqgBtBiarww5vnClceHAHnOpV+u2YH1G+9cp8Kl517Bp/N4rTLSLMrk7toYuBDjdp+IbYWckz7xhvk46caOS8TNOXuIjDypd8p65aqhuPA== 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=4hPF7qKlRB8hLkXvfl3aWKPCw+6r6IaCDKA4tfCg9jk=; b=HapC8sWLfuU5CHCPjZ5gUUhKPTrrs3kI5I+R0L83x0zG75NgrO/hxODXCFKbj4R8HE3CIpgV7mKlbeUD3pJJMogdUm8xQWOgmwOJQSseDZGDQ8gZ+tpVPURt5QPKDNx+exFx435VbcgVy6f0hseoGPa7J46eZ1ngmCODOlOrqqQM8yRlFXylOPqYINNXsxG0sLfJ0/xRF3Zh4ytnkvEuZ11UmB3Esk9B7XPw2qxg16dDjYmTxArUTHbyq4Qz/qynScGlNYZZ1XDmhPQeDojVnNXUWTAiKkcmEjx92aoBHeyjSQsPNvTwcmyO3uc8Xf09jwApouCYYwt/vbtg81E39w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM7PR02CA0027.eurprd02.prod.outlook.com (2603:10a6:20b:100::37) by VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Wed, 8 Dec 2021 16:06:40 +0000 X-Received: from AM5EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::9a) by AM7PR02CA0027.outlook.office365.com (2603:10a6:20b:100::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11 via Frontend Transport; Wed, 8 Dec 2021 16:06:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT003.mail.protection.outlook.com (10.152.16.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4755.13 via Frontend Transport; Wed, 8 Dec 2021 16:06:40 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 8 Dec 2021 16:06:37 +0000 X-Received: from e125153.arm.com (10.57.3.247) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Wed, 8 Dec 2021 16:06:36 +0000 From: "Chris Jones" To: CC: , , , , , , , Subject: [edk2-devel] [PATCH v3 7/7] DynamicTablesPkg: Add CacheId to PPTT generator Date: Wed, 8 Dec 2021 16:06:30 +0000 Message-ID: <20211208160630.10923-8-christopher.jones@arm.com> In-Reply-To: <20211208160630.10923-1-christopher.jones@arm.com> References: <20211208160630.10923-1-christopher.jones@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 3df39f4d-454e-4abe-9453-08d9ba64bde2 X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB5EUR03FT050:EE_|DB6PR0801MB1864:EE_ 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: dkDEOyRcCZGav8qZYhnTqDK7zYWzBA0rFe+ab6h6DDQfKD7HEf2+StM+wm/jk9ukKFmN0sl+EeOxDhQBlp3nlmeGgV4Ts1RK1sH4/p0xZu9JEKiJsJnmP2XaSF2SqcneaHgOVyQog6cmfSTfghCIhepAN7EJ1SoqpXtCZP7H1OoN81LIpUHwhXbYsARW2tUu/92ws996V5Z87kn1AWO4vfB+SXbk7k20GlI0elLAQbsABkfubYwrGqKri0J7gdx6QcDUjS52IAgFfjFxI2nunOvccZGdfq7EMBNKH65ZXh0UPU5imvGzeFn+c/6qmpsKc8McqRsH6Iv+BdVFlMNhr02Er+wqc3xXp+alyUVo/tURO5m8bNU9xDxBLs9mlgs0rqfWbhq/voTfkZY4sUk+1UgZ0TA1Q53elv7sJsMgsJO6cB5+STXImzhKglBphu72rLHle+bMkmgeLU/gmlTCbn5GP50WggRJsRAyySnXZF8CzkJ6r5eNEA5LAThx+IOtrs7N/rTwk/8hm/1DsIzodPv+Ii+wD5iWpmlQkweCl+61wqd0JlN8DqEpL7YHC3dX6Y3Hmh4rJ9R0Ox6Ofj8hF4foKepV8Et8IpOLLeyV8UhQpab1NVFfx7be6O3qevQKbnEn11A6gvdDd5r1KBmAHe8PojbCVHOcBfowhc9pcvMbMRbxYobC990TKXJF22oW9BrB9pzMX8RnpaZtk4dRz7ybW7I4NR1GG53pZHmvN7qTnpkdP5nIImTj3hnxZrRUpi3juL+UvFjWK81qgBeixW3x5F2GmpQ6VxqVYgvkEcRgDeBFuoyjhBESad1LQWRnBKFJIMFvptktKpZi0mxHOzu35ARu8p+Dxz8XS0r6dUYv/x9U22uPgW3Ra9hzJX76 X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(40470700001)(6666004)(81166007)(26005)(83380400001)(4326008)(426003)(186003)(5660300002)(8676002)(1076003)(36860700001)(2906002)(2616005)(70586007)(7696005)(54906003)(316002)(82310400004)(356005)(8936002)(40460700001)(336012)(6916009)(86362001)(70206006)(508600001)(47076005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4974 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c43b575f-d0b0-439d-1f30-08d9ba64b871 X-Microsoft-Antispam-Message-Info: z37NWyLWw3igS/+lJG5zz7FJsL6/Zn5Ahvgp6s2cu+XSM3yqpwyeFC4XZPjIqlp1vbxY0EV9uD1MlKPHyw8SVVsOcD4jJg8QDRNKVyaOpHUrURN5N+7gaw6QgMAYHDJYOhb3ZP8maEj8L0PGcHYVH4AGbLhBSgEqY7xac7zEuWxRvJpr5//NO08NvoNWKk8w+t1viTeJhd0hPl5NCZAEGWje8SAGiq2PBN+oms1qnbnSX/+f+VRHwwK3M6MDHnAus+4euo+WHEJoaIckU+UzSLXkkyZfJ2l4XXLaQkwuG0RNpitVP68qLWS82qUAkxt6VZXYrCLeFkutMJzkS/iXqytztBsQ4+J1DHPh+2x5vuD0X9jktPFHk0JkQxkLO4T2C6oagUJE+5KaapstcNLJhYQPmVwOZJxsv+KO1hj+p1Q/vqeSUMH58FxyWSZ6AbJcUT9ZbWVkyn2NzIZj1CpQhEOh9zfqY+WJPwkhyry/tUurT1p7T1bT7RJsAA1dAfXijuqWDBu16lXAimdfYwZZGWOEeg/MF2Cs23dgISvLcnj7cacNsdYfC5V0nPHBXDXwtrqfKAYkSKPNYvXWZd6atmkJSfKzTpag9ZJeeRLlaW4Pt0b2OeAdij4LzXfzeeEd3lZyoFpFuaMy94BFymFKhxIhGNfJyHkGMs24afPJ5dMQYaHFe1RbA+PW+IUAKZVCE3MyH5BBvfzLfhQl0teTR2i2DQ6dNdKB78WeFD3JL4+xb1lsR6EaVNXBXTASUgzt+yeinUj01Q1k5MSN3TZp51u6/ZgLXP72kBHy8Wc3kuiZPUy1+KHi8xcCvlMMtMYJCJLZxP6kl/S0GNpEKousGpQSiHX+ZDIJDe6Mb2AMqtQ= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2021 16:06:49.4874 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3df39f4d-454e-4abe-9453-08d9ba64bde2 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: DB5EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1864 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,christopher.jones@arm.com X-Gm-Message-State: EmHLMfDtPYPSRqr3aH4a1R71x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1638979614; bh=O/x8kHbNABq2BMHcrKHMEiToTvlNH19MIKnqB7u6H6k=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=NfKOsp8hrzs0ViNiIjoX39Hoel6lkjUwzFF2UHjktRwzgfpO1IGnxe5KAt55GDpXZa2 WotCL5lw7Sxt2mMwyO3fHdsK9HB5m9kTPBQ2MByw4kZtKXEkKqPNnsGN5e/tkfNvX+ok9 nL7z1OuJLyaaI/XLUsklG0+ohxUb9Ak/DVc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1638979616704100006 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Bugzilla: 3697 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3697) Update the PPTT generator with the CacheId field as defined in table 5.140 of the ACPI 6.4 specification. Also add validations to ensure that the cache id generated is unique. Signed-off-by: Chris Jones --- DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 4 +- DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 102 +++= +++++++++++++++-- 2 files changed, 96 insertions(+), 10 deletions(-) diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index 3246e8884723ac85340bf880a3859800726be3c1..6ea03fca487b96577b8fd8105bc= 3d22047ff5697 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -741,10 +741,12 @@ typedef struct CmArmCacheInfo { /// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field /// is 32-bit wide. UINT32 Associativity; - /// Cache attributes (ACPI 6.3 - January 2019, PPTT, Table 5-156) + /// Cache attributes (ACPI 6.4 - January 2021, PPTT, Table 5.140) UINT8 Attributes; /// Line size in bytes UINT16 LineSize; + /// Unique ID for the cache + UINT32 CacheId; } CM_ARM_CACHE_INFO; =20 /** A structure that describes a reference to another Configuration Manager diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator= .c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c index 3d416ca78ec16a1929ede87abbe4f8f4464ef0cf..6b74572ea2dd8478f14d013e6cb= 7394216e45d8d 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c @@ -726,6 +726,35 @@ AddProcHierarchyNodes ( return Status; } =20 +/** + Test whether CacheId is unique among the CacheIdList. + + @param [in] CacheId Cache ID to check. + @param [in] CacheIdList List of already existing cache IDs. + @param [in] CacheIdListSize Size of CacheIdList. + + @retval TRUE CacheId does not exist in CacheIdList. + @retval FALSE CacheId already exists in CacheIdList. +**/ +STATIC +BOOLEAN +IsCacheIdUnique ( + IN CONST UINT32 CacheId, + IN CONST UINT32 *CacheIdList, + IN CONST UINT32 CacheIdListSize + ) +{ + UINT32 Index; + + for (Index =3D 0; Index < CacheIdListSize; Index++) { + if (CacheIdList[Index] =3D=3D CacheId) { + return FALSE; + } + } + + return TRUE; +} + /** Update the Cache Type Structure (Type 1) information. =20 @@ -738,10 +767,12 @@ AddProcHierarchyNodes ( @param [in] Pptt Pointer to PPTT table structure. @param [in] NodesStartOffset Offset from the start of PPTT table to= the start of Cache Type Structures. + @param [in] Revision Revision of the PPTT table being reque= sted. =20 @retval EFI_SUCCESS Structures updated successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A required object was not found. + @retval EFI_OUT_OF_RESOURCES Out of resources. **/ STATIC EFI_STATUS @@ -749,7 +780,8 @@ AddCacheTypeStructures ( IN CONST ACPI_PPTT_GENERATOR *CONST Gener= ator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMg= rProtocol, IN CONST EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt, - IN CONST UINT32 Nodes= StartOffset + IN CONST UINT32 Nodes= StartOffset, + IN CONST UINT32 Revis= ion ) { EFI_STATUS Status; @@ -758,6 +790,9 @@ AddCacheTypeStructures ( CM_ARM_CACHE_INFO *CacheInfoNode; PPTT_NODE_INDEXER *CacheNodeIterator; UINT32 NodeCount; + BOOLEAN CacheIdUnique; + UINT32 TotalNodeCount; + UINT32 *FoundCacheIds; =20 ASSERT ( (Generator !=3D NULL) && @@ -770,6 +805,13 @@ AddCacheTypeStructures ( =20 CacheNodeIterator =3D Generator->CacheStructIndexedList; NodeCount =3D Generator->CacheStructCount; + TotalNodeCount =3D NodeCount; + + FoundCacheIds =3D AllocateZeroPool (TotalNodeCount * sizeof (*FoundCache= Ids)); + if (FoundCacheIds =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "ERROR: PPTT: Failed to allocate resources.\n")); + return EFI_OUT_OF_RESOURCES; + } =20 while (NodeCount-- !=3D 0) { CacheInfoNode =3D (CM_ARM_CACHE_INFO *)CacheNodeIterator->Object; @@ -789,6 +831,7 @@ AddCacheTypeStructures ( CacheStruct->Flags.CacheTypeValid =3D 1; CacheStruct->Flags.WritePolicyValid =3D 1; CacheStruct->Flags.LineSizeValid =3D 1; + CacheStruct->Flags.CacheIdValid =3D 1; CacheStruct->Flags.Reserved =3D 0; =20 // Populate the reference to the next level of cache @@ -811,7 +854,7 @@ AddCacheTypeStructures ( CacheInfoNode->Token, Status )); - return Status; + goto cleanup; } =20 // Update Cache Structure with the offset for the next level of cache @@ -835,7 +878,7 @@ AddCacheTypeStructures ( CacheInfoNode->NumberOfSets, Status )); - return Status; + goto cleanup; } =20 if (CacheInfoNode->NumberOfSets > PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX) { @@ -862,7 +905,7 @@ AddCacheTypeStructures ( CacheInfoNode->Associativity, Status )); - return Status; + goto cleanup; } =20 // Validate the Associativity field based on the architecture specific= ation @@ -881,7 +924,7 @@ AddCacheTypeStructures ( CacheInfoNode->Associativity, Status )); - return Status; + goto cleanup; } =20 if (CacheInfoNode->Associativity > PPTT_ARM_CACHE_ASSOCIATIVITY_MAX) { @@ -923,7 +966,7 @@ AddCacheTypeStructures ( CacheInfoNode->LineSize, Status )); - return Status; + goto cleanup; } =20 if ((CacheInfoNode->LineSize & (CacheInfoNode->LineSize - 1)) !=3D 0) { @@ -935,18 +978,58 @@ AddCacheTypeStructures ( CacheInfoNode->LineSize, Status )); - return Status; + goto cleanup; } =20 CacheStruct->LineSize =3D CacheInfoNode->LineSize; =20 + if (Revision >=3D 3) { + // Validate and populate cache id + if (CacheInfoNode->CacheId =3D=3D 0) { + Status =3D EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: PPTT: The cache id cannot be zero. Status =3D %r\n", + Status + )); + goto cleanup; + } + + CacheIdUnique =3D IsCacheIdUnique ( + CacheInfoNode->CacheId, + FoundCacheIds, + TotalNodeCount + ); + if (!CacheIdUnique) { + Status =3D EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: PPTT: The cache id is not unique. " \ + "CacheId =3D %d. Status =3D %r\n", + CacheInfoNode->CacheId, + Status + )); + goto cleanup; + } + + // Store the cache id so we can check future cache ids for uniqueness + FoundCacheIds[NodeCount] =3D CacheInfoNode->CacheId; + + CacheStruct->CacheId =3D CacheInfoNode->CacheId; + } + // Next Cache Type Structure CacheStruct =3D (EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE *)((UINT8 *)CacheSt= ruct + CacheStruct->Lengt= h); CacheNodeIterator++; } // Cache Type Structure =20 - return EFI_SUCCESS; + Status =3D EFI_SUCCESS; + +cleanup: + FreePool (FoundCacheIds); + + return Status; } =20 /** @@ -1205,7 +1288,8 @@ BuildPpttTable ( Generator, CfgMgrProtocol, Pptt, - CacheStructOffset + CacheStructOffset, + AcpiTableInfo->AcpiTableRevision ); if (EFI_ERROR (Status)) { DEBUG (( --=20 Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") -=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 (#84512): https://edk2.groups.io/g/devel/message/84512 Mute This Topic: https://groups.io/mt/87591331/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-