From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.55]) by mx.groups.io with SMTP id smtpd.web10.37665.1634569873464981846 for ; Mon, 18 Oct 2021 08:11:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=quJjyPbP; spf=pass (domain: arm.com, ip: 40.107.6.55, mailfrom: christopher.jones@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=aneoWLfb2GxSICI/7+L6//InIU2xPm9vewraM8qgYpw=; b=quJjyPbPH7nCx7XMyohP7uj10Vl5uVl8TpaaVzY6lKCRm5SMMrppWmJEVX8iRFzuMcs9bH42K7K4CqUXVDJw24sgwwyVh3aBvXCl2ue8B5d+y0GvmuyWR03vSXXvG3F1tDMba00nmMmANN61NKrDiGb1FTndtxqTbp0KdGfn7Xo= Received: from AM0PR02CA0008.eurprd02.prod.outlook.com (2603:10a6:208:3e::21) by AM6PR08MB3640.eurprd08.prod.outlook.com (2603:10a6:20b:4c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Mon, 18 Oct 2021 15:11:10 +0000 Received: from VE1EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:3e:cafe::98) by AM0PR02CA0008.outlook.office365.com (2603:10a6:208:3e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17 via Frontend Transport; Mon, 18 Oct 2021 15:11:10 +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 VE1EUR03FT060.mail.protection.outlook.com (10.152.19.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 15:11:10 +0000 Received: ("Tessian outbound b9598e0ead92:v103"); Mon, 18 Oct 2021 15:11:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2e4e4c832382d945 X-CR-MTA-TID: 64aa7808 Received: from a8bac76b4337.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D737B590-E428-4A2C-B4C1-D42DA01C5334.1; Mon, 18 Oct 2021 15:11:03 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a8bac76b4337.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Oct 2021 15:11:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDJVi9UhdmnGsdAOb70JsoWZwfx+Txrf6tyJ+XiZB8al5Kq7Q2znsodqxUqJDb1Tlu1qR8wPNpQ+bBxNjYYYuKGqkzp3ULNSaJjvpD3YKTtT/XpHpZqwwYM4LjF4RDkOZFwoP7PwsbBZNQkO2ObRu0X+IC7n0I5pvdFmHxH1+TRT3JN/y+nxa46fL+PAp6+uC5d7wfqwW1u0RkekweBLCND9Crcrqj6X4R8slujDjrPgyzMA/gmKBY8PVGmcN7fUoRDzJ4gFlDdStG0VJXSkAmJBnXoYo3IYpp8uzPv7FgND77PQ66ReO19MSuo0iqCEn4+/HBX25GCJBY669qCD4w== 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=aneoWLfb2GxSICI/7+L6//InIU2xPm9vewraM8qgYpw=; b=JAQl4FI/Hyi26/VfwrnIwDRUKVAjgpXngeuxzY+3Lgv8V0bOKqSChmlolup2xTjddF+66WpIGT5Z7WuoyOFfwq70i2/KxAchdYaX77wA3lEe88uTC5nW7PbHkJ7TfJXTmk5M61aV9K6qLWzpJvQalgxzucwSowd7bk2ZVFfSc8impWM9sr11r0+caOgePYTA0zY3aUCHtwnXOmJZcmCCeDLHk42DMEhFzBYDsLGdYG7Q/U5HDfK42OEdFKMrqZ5i6seM4Ca/uWdSE2YKUKT2r/Hss+QVa/QMPL5K78gy0lpGJrqHqmviWiyqMm9lfio1CtMUGYFYl38qnxfAdpyDEQ== 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 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=aneoWLfb2GxSICI/7+L6//InIU2xPm9vewraM8qgYpw=; b=quJjyPbPH7nCx7XMyohP7uj10Vl5uVl8TpaaVzY6lKCRm5SMMrppWmJEVX8iRFzuMcs9bH42K7K4CqUXVDJw24sgwwyVh3aBvXCl2ue8B5d+y0GvmuyWR03vSXXvG3F1tDMba00nmMmANN61NKrDiGb1FTndtxqTbp0KdGfn7Xo= Received: from AS9PR06CA0019.eurprd06.prod.outlook.com (2603:10a6:20b:462::12) by AS8PR08MB7096.eurprd08.prod.outlook.com (2603:10a6:20b:403::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Mon, 18 Oct 2021 15:11:01 +0000 Received: from AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:462:cafe::d5) by AS9PR06CA0019.outlook.office365.com (2603:10a6:20b:462::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 15:11:01 +0000 X-MS-Exchange-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=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; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT004.mail.protection.outlook.com (10.152.16.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 15:11:01 +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.2308.14; Mon, 18 Oct 2021 15:10:49 +0000 Received: from e125153.arm.com (10.57.27.61) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Mon, 18 Oct 2021 15:10:49 +0000 From: "Chris Jones" To: CC: , , , , , , , Subject: [PATCH v1 4/7] ShellPkg: Add Cache ID to PPTT parser Date: Mon, 18 Oct 2021 16:10:43 +0100 Message-ID: <20211018151046.31232-5-christopher.jones@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211018151046.31232-1-christopher.jones@arm.com> References: <20211018151046.31232-1-christopher.jones@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fdf934e-b9d1-404e-551e-08d99249846e X-MS-TrafficTypeDiagnostic: AS8PR08MB7096:|AM6PR08MB3640: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: awuODFwcqPkF07+HXQsiW+W+UIsS4ASPFMkiU0ZH1bQDKavKxpXqepgYYOpextbSc42Ovq+Lp8U1DyU7SFwxUSaozEokfduTRZmLD9VGtwVVuTRRH3in1ydfpdjuXZnRsPPNXow12hD45bmnG4/vZTZs2Vri/FKfEfcNtat6Oxw9d9tQSKql5xJTu0c7FhVQrtMJ2HjN0jvnrqlgYXOA1lca9QIKxPbLJBddQTNfXptIDzhd0p2h2DxiHVTdzugy03fGhajhQeJHlAQWUZApBtK/eBVVvhAKJ8KgUcBLb8RJsAF3IMXIP1XmL58QeuQ2QALmjFT+KpDeGpAUDdZTf06GdeWzLFfTAclU6PjCRyecgjmHO9Z1O/lCgc+UIhLUh+58JlSGNFYmZKQEl17TxdIllXfAbus7wsZdqnY5dwKvFWduoXtA2E6lijjZ6zJ21RyYDHH34algm1aeO6c+A2UhpSH3sIb3vbOU4Is4pB/2xN6VuKbs/SNaGXP9OftAV5PB0wjmCCTGQOHIRM/E5iyUHdoKF1/JQK/st29gf2sDOXjkZ5hx1f0TvZD0Y16ucNnzUuM1zABIivoZUbCVR2+A0dW3Ewos/agtcnsFABd2HRKJLaQYTF1VdVLrjkOL8JdysH+SdDNYgDYMtE7/WJCcG/76Fj2ln8/smqI8+t8pkeIzMQOfyJa3WaZxcAFxQA8FOamPxYLYr9WrAHzm4LB9rE9Cp7VVNjoGFZyD9DL8Tl+K1T82w6XupSrOk5UCivOn4133l3soNUS4KrIl9ZkeZkYaWtKWl5Uv4krFCX5m+sFa0cUge56FWByTZcSo 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)(46966006)(36840700001)(83380400001)(81166007)(316002)(36756003)(36860700001)(5660300002)(186003)(8676002)(1076003)(7696005)(2906002)(6916009)(508600001)(86362001)(47076005)(70206006)(8936002)(426003)(54906003)(336012)(26005)(70586007)(4326008)(82310400003)(6666004)(356005)(2616005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7096 Return-Path: Christopher.Jones@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: c86756ab-e51c-45a8-ef37-08d992497f34 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nl4rMYWo6t5/l0TfCoKhS1Hhwx2PiFxCxXockTFBt7GN7bm+ToOuqBptpmECfXR5vUEcTTSl+8aWg61bsY2pTcn6AS2kiudmCqn63OyQYeXScqUFvD3yEnmz4GTsaODj7CCZ/x8b5V/2hqAjtC4rS+OFTAnrPPtGYmd0P+FSYU3ZxBwrcZQCBdakMNvUSc7WOco0bJ1ZRFQ27RtZ7eeVWvpY6icKha6KR8YpSAl1+VEZpvtOLaD+hhHIaXGH4019S9PHyZAzrD5c61rBL0oMba/fR2+/Ol9rYiAhr2RKvgfkHEYo2R+CqpolyigHTvq87gXAVRDqc8LO6hye0hlBsRl6gkIWYDlRU0nKERhGVieOiRdy466yVF/zub8d5nhboP14WsvRLWWEnh6FZv16yML5+2wlIpmZP2QD3K2QOBRT0dXdM10aco6jj6WJ9dzWI/BMmLfstjQ9gjkPTBEAUaP7Ek2F1VBxkWReSibsXi9uDMVQ/hXh46i/S0LHJa8p/sC3Cx+Dc478elyFsS0bZkl7uITCHI1569Y16Q0r8IM9FnlKpZ+gVlO6qWro+s5SYcuaVTSe8d9JBbvROU0BK+UHSuavbr8k9/IGeRQ/73YfbmHarJXkfambQ87jvhAwlLrkpGm7/pZaJkbqu/ZVrvyh9RNAqRbFBejtvZoLmOkPPjhNZmycfAff6yWGhla/HOUD1tQ5yNmzR+Tp18k/BBZMVavnExyCekuN/du3cVsJ5YbqkwLPTpLV1f2poacrajm/VLpoh5OAGB6tiE7H23gPwDT4IrcI1LKKQCupxK8= 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)(46966006)(36840700001)(83380400001)(1076003)(70586007)(70206006)(36756003)(508600001)(336012)(8676002)(4326008)(47076005)(81166007)(316002)(26005)(7696005)(8936002)(2616005)(5660300002)(2906002)(54906003)(36860700001)(6666004)(82310400003)(6916009)(426003)(86362001)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 15:11:10.0677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fdf934e-b9d1-404e-551e-08d99249846e 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: VE1EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3640 Content-Type: text/plain Bugzilla: 3697 (https://bugzilla.tianocore.org/show_bug.cgi?id=3697) Update the Acpiview PPTT parser with the Cache ID field and relevant validations as defined in tables 5.140 and 5.141 of the ACPI 6.4 specification. Signed-off-by: Chris Jones --- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c | 118 +++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c index bce9edcedde50e53035059e6da57b9449209a674..a6130eae62c4387d2b6037ecec8db596e4bb6bb1 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -20,8 +20,82 @@ STATIC CONST UINT8* ProcessorTopologyStructureType; STATIC CONST UINT8* ProcessorTopologyStructureLength; STATIC CONST UINT32* NumberOfPrivateResources; +STATIC CONST EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE_FLAGS* CacheFlags; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; +/** + Increment the error count and print an error that a required flag is missing. + + @param [in] FlagName Name of the missing flag. +**/ +STATIC +VOID +EFIAPI +LogCacheFlagError ( + IN CONST CHAR16* FlagName + ) +{ + IncrementErrorCount (); + Print ( + L"\nERROR: On Arm based systems, all cache properties must be" + L"provided in the cache type structure." + L"Missing '%s' flag.", + *FlagName + ); +} + +/** + This function validates the Cache Type Structure (Type 1) Cache Flags field. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateCacheFlags ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ +#if defined(MDE_CPU_ARM) || defined(MDE_CPU_AARCH64) + if (CacheFlags == NULL) { + IncrementErrorCount (); + Print (L"\nERROR: Cache Structure Flags were not successfully read."); + return; + } + + if (CacheFlags->SizePropertyValid == EFI_ACPI_6_4_PPTT_CACHE_SIZE_INVALID) { + LogCacheFlagError (L"Size Property Valid"); + } + if (CacheFlags->NumberOfSetsValid == EFI_ACPI_6_4_PPTT_NUMBER_OF_SETS_INVALID) { + LogCacheFlagError (L"Number Of Sets Valid"); + } + if (CacheFlags->AssociativityValid == EFI_ACPI_6_4_PPTT_ASSOCIATIVITY_INVALID) { + LogCacheFlagError (L"Associativity Valid"); + } + if (CacheFlags->AllocationTypeValid == EFI_ACPI_6_4_PPTT_ALLOCATION_TYPE_INVALID) { + LogCacheFlagError (L"Allocation Type Valid"); + } + if (CacheFlags->CacheTypeValid == EFI_ACPI_6_4_PPTT_CACHE_TYPE_INVALID) { + LogCacheFlagError (L"Cache Type Valid"); + } + if (CacheFlags->WritePolicyValid == EFI_ACPI_6_4_PPTT_WRITE_POLICY_INVALID) { + LogCacheFlagError (L"Write Policy Valid"); + } + if (CacheFlags->LineSizeValid == EFI_ACPI_6_4_PPTT_LINE_SIZE_INVALID) { + LogCacheFlagError (L"Line Size Valid"); + } + // Cache ID was only introduced in revision 3 + if (*(AcpiHdrInfo.Revision) >= 3) { + if (CacheFlags->CacheIdValid == EFI_ACPI_6_4_PPTT_CACHE_ID_INVALID) { + LogCacheFlagError (L"Cache Id Valid"); + } + } +#endif +} + /** This function validates the Cache Type Structure (Type 1) 'Number of sets' field. @@ -141,6 +215,44 @@ ValidateCacheLineSize ( #endif } +/** + This function validates the Cache Type Structure (Type 1) Cache ID field. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateCacheId ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT32 CacheId; + CacheId = *(UINT32*)Ptr; + + // Cache ID was only introduced in revision 3 + if (*(AcpiHdrInfo.Revision) < 3) { + return; + } + + if (CacheFlags == NULL) { + IncrementErrorCount (); + Print (L"\nERROR: Cache Structure Flags were not successfully read."); + return; + } + + if (CacheFlags->CacheIdValid == EFI_ACPI_6_4_PPTT_CACHE_ID_VALID) { + if (CacheId == 0) { + IncrementErrorCount (); + Print (L"\nERROR: 0 is not a valid Cache ID."); + return; + } + } +} + /** This function validates the Cache Type Structure (Type 1) Attributes field. @@ -213,13 +325,15 @@ STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = { {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Flags", 4, 4, L"0x%x", NULL, (VOID**)&CacheFlags, ValidateCacheFlags, + NULL}, {L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, {L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL}, {L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL}, {L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL}, - {L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL} + {L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL}, + {L"Cache ID", 4, 24, L"%d", NULL, NULL, ValidateCacheId, NULL} }; /** -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")