From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.46]) by mx.groups.io with SMTP id smtpd.web12.10702.1588693594363289164 for ; Tue, 05 May 2020 08:46:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=iQ+Tshrj; spf=pass (domain: arm.com, ip: 40.107.20.46, mailfrom: krzysztof.koch@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=v4eQdyGhM2lANyGht6ysx90XAFg+J8ORrb1heTETNMM=; b=iQ+TshrjjJTMGGrDJbgV4kyoCTkfr+vR6W2YqRc1D6S+NTD8OB0j1SrAt2WBnKFlP3weUOPrAx5eB+aKc7mU3RFAM//oSu/h6qoeIIR2kiD1Jr1VFj1Kyn+Y93rv7pm6y5Gqt5R7f7/CJC1G5HbA4HWw8NX8nkJ/mVttpI0lrpc= Received: from DB8PR09CA0024.eurprd09.prod.outlook.com (2603:10a6:10:a0::37) by AM7PR08MB5383.eurprd08.prod.outlook.com (2603:10a6:20b:102::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Tue, 5 May 2020 15:46:32 +0000 Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:a0:cafe::e1) by DB8PR09CA0024.outlook.office365.com (2603:10a6:10:a0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Tue, 5 May 2020 15:46:32 +0000 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=bestguesspass 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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Tue, 5 May 2020 15:46:32 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Tue, 05 May 2020 15:46:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0f96c89f086a9475 X-CR-MTA-TID: 64aa7808 Received: from c2a5e0763b52.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F49A3BEC-5F37-47CC-B35B-0EC4D0C12FF7.1; Tue, 05 May 2020 15:46:26 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c2a5e0763b52.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 05 May 2020 15:46:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J8kkml3t70JhGl4flOrb9Rht0+4u+0eZzR/svEEUrDISibPdQfZXtmRpCnf2ocK6wagXYumQThmv9KLktydZoOI3OqaCuNWePAikYoMrhxhNJBH6I8mvbAe7Xo+M5vUFG/y1/IQJwxnMRl9NQztp6HDNxnmKgA8L8qDafjwVa0NjvZS6JDmeYyW0UgsPqof93ZlX1gemcUkPx+yhM7GI5xpU8qoGVFQbXQVlahQPmFExu5UgfKtmSgHQXOyE1uoklLnzn7FAZM0f/ylps/BfsnwnSZ/1iRKnEY/ZgxXmSvtBQK0grdLL3oSlpaAkFjVRZueMScPN6yDJlMXk4ax2zA== 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-SenderADCheck; bh=v4eQdyGhM2lANyGht6ysx90XAFg+J8ORrb1heTETNMM=; b=BTn8St1S8DRYaJakrUjs0scAsEa+4OKUmwNWTvS9Au/mNYlrKF9WMUG6ohDY46jzC947dH4pcnK//gYFwUcHIwXmEo5NowhAmSSjVmlJZ8PvzJNaF925jgB3W94dgVLpn6iqsmBXVRvhn8x8B77CQn/S0cQ3BTVdwANRj2bJwFxh2bYeeI0dhRoDxT9fQ5YMPBDncs6CshXVhVv4WsO2GFZA5HxV9e7NcT24HG7gLki0Yqjkjmb4QALhX7Sq4DamZDSX2IEaR6VLN6NgvJuUACmoC24bSejSQyP7t/1Q1RKL+NaDNPVgiNjFjcBPXfCMjttMH2Mlh0TGxqZ1P+flMg== 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=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); 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=v4eQdyGhM2lANyGht6ysx90XAFg+J8ORrb1heTETNMM=; b=iQ+TshrjjJTMGGrDJbgV4kyoCTkfr+vR6W2YqRc1D6S+NTD8OB0j1SrAt2WBnKFlP3weUOPrAx5eB+aKc7mU3RFAM//oSu/h6qoeIIR2kiD1Jr1VFj1Kyn+Y93rv7pm6y5Gqt5R7f7/CJC1G5HbA4HWw8NX8nkJ/mVttpI0lrpc= Received: from AM5PR04CA0027.eurprd04.prod.outlook.com (2603:10a6:206:1::40) by AM5PR0801MB1745.eurprd08.prod.outlook.com (2603:10a6:203:3a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Tue, 5 May 2020 15:46:24 +0000 Received: from AM5EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:1:cafe::6b) by AM5PR04CA0027.outlook.office365.com (2603:10a6:206:1::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26 via Frontend Transport; Tue, 5 May 2020 15:46:24 +0000 Authentication-Results-Original: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass 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; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT007.mail.protection.outlook.com (10.152.16.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2958.20 via Frontend Transport; Tue, 5 May 2020 15:46:24 +0000 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.1415.2; Tue, 5 May 2020 15:46:09 +0000 Received: from E119924.Arm.com (10.57.59.39) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Tue, 5 May 2020 15:46:09 +0000 From: "Krzysztof Koch" To: CC: , , , , Subject: [PATCH v1 6/6] ShellPkg: acpiview: Make PPTT parsing logic data driven Date: Tue, 5 May 2020 16:46:04 +0100 Message-ID: <20200505154604.9848-7-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200505154604.9848-1-krzysztof.koch@arm.com> References: <20200505154604.9848-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(346002)(136003)(396003)(376002)(39860400002)(46966005)(33430700001)(426003)(4326008)(81166007)(44832011)(8676002)(33440700001)(2906002)(1076003)(2616005)(316002)(36756003)(478600001)(6666004)(356005)(8936002)(5660300002)(186003)(26005)(86362001)(82310400002)(70586007)(6916009)(336012)(70206006)(54906003)(7696005)(47076004)(82740400003);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31e50fac-76f7-4a1b-c0ab-08d7f10b7bcf X-MS-TrafficTypeDiagnostic: AM5PR0801MB1745:|AM7PR08MB5383: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 0394259C80 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: emYoAJuZrfxdU3PAVGxaXGBtMsIEuYfbgLmjRu4l8jjhTmi/AFe1PHUuVR8r2PooCWYbl3k+zTQiCM4O3Az5548vcQYuK7tb2OaV6BeDWHKj0Ixth6VXS2SmAA1uAIhE2+/qGSmLCv6TcKWM3JcvEiEiMaVtp1+lsQ4FZ3hX8bCym7UyoKMembmHw1diUUgRcQ7cB0TGGXNBFdaE3hF+jE7BlDbzFC0L1BLexUAXw+FfoDMoiNdA18cnVgJSAQ2AwAxrSVCpgyfHxGNATN8pTaaXTld0oJKQuLUbfyOJejHnFkr7MSGYM40VcckQ5BUpgjV7W0VBwKwLb1hNHI5RB435G/ECRNaWwRhLD0K4mAqELioNRdih4t6mv0/9qz+l05wDJab52AolEoEkQmcaZCPrVGAijkb3poV6kqGTEAE74u1423xacVuR+OKZAjIjle4PNvKOLxSI7ffItELMzi9qZL0NBNhrfEKdsRzFbEuAM+EqcCrViRTpZtWCGV6d0DoJXrHUHKvZuMC+iqlqMDoD9grtsUONiQszT32+Xxs0le5IFtMvoikMj499rSLc4sY/qISIoLDtr5oJ4NziLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1745 Original-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Return-Path: Krzysztof.Koch@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com 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;SFTY:;SFS:(4636009)(346002)(376002)(396003)(39860400002)(136003)(46966005)(33430700001)(7696005)(54906003)(2906002)(316002)(336012)(6916009)(426003)(8936002)(47076004)(36756003)(4326008)(81166007)(86362001)(82740400003)(44832011)(8676002)(2616005)(478600001)(33440700001)(26005)(186003)(6666004)(1076003)(5660300002)(82310400002)(70206006)(70586007);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 015974d2-975a-4ea3-6061-08d7f10b773b X-Forefront-PRVS: 0394259C80 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t4e0TzI8RmRshHIXLFQdWQszkSI1zJAPsMN7SwlUgyC+sJJtvjB7LYvPO0UBnXXDZFXO3o4LBOTHs8YtKBeUALEBgWihucQfWp9wvTZLfAnt1bh0phdztFlEoi4aDCEIk4P22tX5PwqP6Inu191ixrssa4O3EjeS97qS3xDme0ItSmxKZZBBgFaaBQENyQA5W+/bGD/yENUf927tJj1CRZEP+BGMcRVexXW3R9JlcUo7iM3S8mqoywuDhpKkkGyR1q8l+UriMBTpbHGcjTuUKkdFr4qlQVtGDrCk7qCZzNFnbh9/iERL3MQhE2PeERDBdvKunYwumV4ic2HhIo08ugBGrSLy8652a/BXskLzyrJenxkPddft8GwKgIcpDVG5UNHMyFkV7BP/n7G4zC778eOF8VM1mMZrqmDp1lu/nQEHUtS5s6+nCB5DKOpLbgn+N+dHXI2KVbdh5NhwEAlI3g08xNlhfB0ukbS2PckXf74MNl+lJDjmzrnbHf+mH4uOX7MpKfcRhjP9HLcIBovS68FUzpIFVZYW2r0QGBgBc4DKspxOqsf9UPms+49+ksMdFD6He6extfPWNeVOfJUIDw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2020 15:46:32.0271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31e50fac-76f7-4a1b-c0ab-08d7f10b7bcf 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5383 Content-Type: text/plain Replace the switch statement in the main parser loop with a table-driven approach. Use the ParseAcpiStruct () method to resolve how each Processor Topology Structure given should be parsed. Enumerate all structures found in the Processor Properties Topology Table (PPTT) on a per-type basis. Consolidate all metadata about each Processor Topology Structure. Define an array of ACPI_STRUCT_INFO structures to store the name, instance count, architecture support and handling information. Use this array to construct the ACPI_STRUCT_DATABASE for PPTT. Count the number of instances of each Processor Topology Structure type. Optionally report these counts after PPTT table parsing is finished. Remove the definition of the DumpCacheTypeStructure and DumpIDStructure functions. Their only purpose was to call ParseAcpi () and now this process is streamlined. Make DumpProcessorHierarchyNodeStructure function signature match that of ACPI_STRUCT_PARSER_FUNC. This way, the function can be called from ParseAcpiStruct (). References: - ACPI 6.3 Specification - January 2019, Section 5.2.29 Signed-off-by: Krzysztof Koch --- Notes: v1: - Make PPTT parsing logic data driven [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c | 152 ++++++++++---------- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h | 2 +- 2 files changed, 74 insertions(+), 80 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c index 0db272c16af0ad8824c8da4c88dd409c8550112a..b62f79b52cab989942f84b020e1d737e8ef65439 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -21,6 +21,11 @@ STATIC CONST UINT8* ProcessorTopologyStructureLength; STATIC CONST UINT32* NumberOfPrivateResources; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; +/** + Handler for each Processor Topology Structure +**/ +STATIC ACPI_STRUCT_INFO PpttStructs[]; + /** This function validates the Cache Type Structure (Type 1) 'Number of sets' field. @@ -243,22 +248,34 @@ STATIC CONST ACPI_PARSER IdStructureParser[] = { @param [in] Ptr Pointer to the start of the Processor Hierarchy Node Structure data. @param [in] Length Length of the Processor Hierarchy Node Structure. + @param [in] OptArg0 First optional argument (Not used). + @param [in] OptArg1 Second optional argument (Not used). **/ STATIC VOID DumpProcessorHierarchyNodeStructure ( - IN UINT8* Ptr, - IN UINT8 Length + IN UINT8* Ptr, + IN UINT32 Length, + IN CONST VOID* OptArg0 OPTIONAL, + IN CONST VOID* OptArg1 OPTIONAL ) { UINT32 Offset; UINT32 Index; CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; + CHAR8 AsciiBuffer[80]; + + PrintAcpiStructName ( + PpttStructs[EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR].Name, + PpttStructs[EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR].Count, + sizeof (AsciiBuffer), + AsciiBuffer + ); Offset = ParseAcpi ( TRUE, 2, - "Processor Hierarchy Node Structure", + AsciiBuffer, Ptr, Length, PARSER_PARAMS (ProcessorHierarchyNodeStructureParser) @@ -269,7 +286,8 @@ DumpProcessorHierarchyNodeStructure ( if (NumberOfPrivateResources == NULL) { IncrementErrorCount (); Print ( - L"ERROR: Insufficient Processor Hierarchy Node length. Length = %d.\n", + L"ERROR: Insufficient %a Structure length. Length = %d.\n", + PpttStructs[EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR].Name, Length ); return; @@ -296,7 +314,7 @@ DumpProcessorHierarchyNodeStructure ( UnicodeSPrint ( Buffer, sizeof (Buffer), - L"Private resources [%d]", + L"Private resource [%d]", Index ); @@ -312,50 +330,37 @@ DumpProcessorHierarchyNodeStructure ( } /** - This function parses the Cache Type Structure (Type 1). - - @param [in] Ptr Pointer to the start of the Cache Type Structure data. - @param [in] Length Length of the Cache Type Structure. + Information about each Processor Topology Structure type. **/ -STATIC -VOID -DumpCacheTypeStructure ( - IN UINT8* Ptr, - IN UINT8 Length - ) -{ - ParseAcpi ( - TRUE, - 2, - "Cache Type Structure", - Ptr, - Length, - PARSER_PARAMS (CacheTypeStructureParser) - ); -} +STATIC ACPI_STRUCT_INFO PpttStructs[] = { + ADD_ACPI_STRUCT_INFO_FUNC ( + "Processor", + EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR, + ARCH_COMPAT_IA32 | ARCH_COMPAT_X64 | ARCH_COMPAT_ARM | ARCH_COMPAT_AARCH64, + DumpProcessorHierarchyNodeStructure + ), + ADD_ACPI_STRUCT_INFO_ARRAY ( + "Cache", + EFI_ACPI_6_3_PPTT_TYPE_CACHE, + ARCH_COMPAT_IA32 | ARCH_COMPAT_X64 | ARCH_COMPAT_ARM | ARCH_COMPAT_AARCH64, + CacheTypeStructureParser + ), + ADD_ACPI_STRUCT_INFO_ARRAY ( + "ID", + EFI_ACPI_6_3_PPTT_TYPE_ID, + ARCH_COMPAT_IA32 | ARCH_COMPAT_X64 | ARCH_COMPAT_ARM | ARCH_COMPAT_AARCH64, + IdStructureParser + ) +}; /** - This function parses the ID Structure (Type 2). - - @param [in] Ptr Pointer to the start of the ID Structure data. - @param [in] Length Length of the ID Structure. + PPTT structure database **/ -STATIC -VOID -DumpIDStructure ( - IN UINT8* Ptr, - IN UINT8 Length - ) -{ - ParseAcpi ( - TRUE, - 2, - "ID Structure", - Ptr, - Length, - PARSER_PARAMS (IdStructureParser) - ); -} +STATIC ACPI_STRUCT_DATABASE PpttDatabase = { + "Processor Topology Structure", + PpttStructs, + ARRAY_SIZE (PpttStructs) +}; /** This function parses the ACPI PPTT table. @@ -390,6 +395,8 @@ ParseAcpiPptt ( return; } + ResetAcpiStructCounts (&PpttDatabase); + Offset = ParseAcpi ( TRUE, 0, @@ -419,7 +426,8 @@ ParseAcpiPptt ( IncrementErrorCount (); Print ( L"ERROR: Insufficient remaining table buffer length to read the " \ - L"processor topology structure header. Length = %d.\n", + L"%a header. Length = %d.\n", + PpttDatabase.Name, AcpiTableLength - Offset ); return; @@ -430,8 +438,9 @@ ParseAcpiPptt ( ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) { IncrementErrorCount (); Print ( - L"ERROR: Invalid Processor Topology Structure length. " \ - L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", + L"ERROR: Invalid %a length. Length = %d. Offset = %d. " \ + L"AcpiTableLength = %d.\n", + PpttDatabase.Name, *ProcessorTopologyStructureLength, Offset, AcpiTableLength @@ -439,39 +448,24 @@ ParseAcpiPptt ( return; } - PrintFieldName (2, L"* Structure Offset *"); - Print (L"0x%x\n", Offset); - - switch (*ProcessorTopologyStructureType) { - case EFI_ACPI_6_2_PPTT_TYPE_PROCESSOR: - DumpProcessorHierarchyNodeStructure ( - ProcessorTopologyStructurePtr, - *ProcessorTopologyStructureLength - ); - break; - case EFI_ACPI_6_2_PPTT_TYPE_CACHE: - DumpCacheTypeStructure ( - ProcessorTopologyStructurePtr, - *ProcessorTopologyStructureLength - ); - break; - case EFI_ACPI_6_2_PPTT_TYPE_ID: - DumpIDStructure ( - ProcessorTopologyStructurePtr, - *ProcessorTopologyStructureLength - ); - break; - default: - IncrementErrorCount (); - Print ( - L"ERROR: Unknown processor topology structure:" - L" Type = %d, Length = %d\n", - *ProcessorTopologyStructureType, - *ProcessorTopologyStructureLength - ); - } + // Parse the Processor Topology Structure + ParseAcpiStruct ( + 2, + ProcessorTopologyStructurePtr, + &PpttDatabase, + Offset, + *ProcessorTopologyStructureType, + *ProcessorTopologyStructureLength, + NULL, + NULL + ); ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength; Offset += *ProcessorTopologyStructureLength; } // while + + // Report and validate processor topology structure counts + if (GetConsistencyChecking ()) { + ValidateAcpiStructCounts (&PpttDatabase); + } } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h index 2a671203fb0035bbc407ff4bb0ca9960706fa588..a0b0622ba00bda63379b670527145359b738bb7d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h @@ -1,7 +1,7 @@ /** @file Header file for PPTT parser - Copyright (c) 2019, ARM Limited. All rights reserved. + Copyright (c) 2019 - 2020, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'