From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=FJov2WYq; spf=pass (domain: arm.com, ip: 40.107.2.74, mailfrom: krzysztof.koch@arm.com) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.74]) by groups.io with SMTP; Fri, 07 Jun 2019 01:48:03 -0700 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=oe3pn1F1g4wg/tS3WgyRHUBOuh6Z73hHpWZ9xcDU6ek=; b=FJov2WYq9j27es8daVDozamyPrMbVsHWv8XlbSlepfIeXcNGIjL8FJp2Tk+8mRjm4V9YjH5+RVrkMFXGgiPJYN7b7mSE6AgaS6e4lxS80fOv2toahxfDYF5H10ebkNCwQosSB7B21QCTv35q5AwKIIlruDm06c3Z8boA0F5WETI= Received: from VI1PR08CA0183.eurprd08.prod.outlook.com (2603:10a6:800:d2::13) by DB7PR08MB4604.eurprd08.prod.outlook.com (2603:10a6:10:34::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.15; Fri, 7 Jun 2019 08:47:59 +0000 Received: from DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::207) by VI1PR08CA0183.outlook.office365.com (2603:10a6:800:d2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1965.12 via Frontend Transport; Fri, 7 Jun 2019 08:47:58 +0000 Authentication-Results: spf=temperror (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=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT040.mail.protection.outlook.com (10.152.20.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.1965.12 via Frontend Transport; Fri, 7 Jun 2019 08:47:57 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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; Fri, 7 Jun 2019 08:47:48 +0000 Received: from E119924.Arm.com (10.1.199.124) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 7 Jun 2019 08:47:47 +0000 From: "Krzysztof Koch" To: CC: , , , , , , Subject: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser Date: Fri, 7 Jun 2019 09:47:41 +0100 Message-ID: <20190607084741.19300-1-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 Return-Path: Krzysztof.Koch@arm.com MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:40.67.248.234;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(376002)(396003)(136003)(2980300002)(199004)(189003)(81156014)(77096007)(68736007)(81166006)(356004)(186003)(26005)(1076003)(8676002)(47776003)(48376002)(14444005)(316002)(15650500001)(336012)(426003)(86362001)(16586007)(7696005)(51416003)(476003)(2616005)(63350400001)(63370400001)(5660300002)(486006)(126002)(6306002)(305945005)(54906003)(6666004)(8936002)(44832011)(53936002)(50466002)(966005)(70586007)(53416004)(478600001)(36756003)(70206006)(72206003)(4326008)(2351001)(2906002)(50226002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB4604;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6d49dc1-a480-4516-5df5-08d6eb24d6b2 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:DB7PR08MB4604; X-MS-TrafficTypeDiagnostic: DB7PR08MB4604: X-MS-Exchange-PUrlCount: 1 NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:330; X-Forefront-PRVS: 0061C35778 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: hM1iLVY2vwtY1nYgfV69P6jtL0lNKnykJTJicz+vVCRaPNQdYhC51ulnXFvKFAc+1nM8knsNUli+QuNApegiCyMEPGR0Cr5ClRdpD6XP5uIy8i8fd+PgCZblZzapoBF6lvdu/zJcZvVO84A370ercgsu4SjHqpn0tbuPps7g8tnv7dQ9Qx8U/JgeOE3AZl957whLpM1DKeAAtkvDHX0AxslHNrPivcbhOLdHd7lqyoYzijJvYQkF+bgviXlsZug2hSL436vfLUiLLr/96UEgcDmLA77rjPZdIb/EIwM1n5RJm8QYmkgMswGtioC9ZHEv2/ps3jVPRBJGUgCLaQxgJgKiz+qy0Joc0liYOHCP+YArVZHbGTJnUTndsQ7RUcU7cCA6wpn0vG0MGsDJ5PmU8oIiFKQqRwMlFAYmFPRF9QE= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2019 08:47:57.2727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6d49dc1-a480-4516-5df5-08d6eb24d6b2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4604 Content-Type: text/plain The ACPI 6.3 specification introduces a 'SPE overflow Interrupt' field as part of the GICC structure. Update the MADT parser to decode this field and validate the interrupt ID used. References: - ACPI 6.3 Specification - January 2019 - Arm Generic Interrupt Controller Architecture Specification, GIC architecture version 3 and version 4, issue E - Arm Server Base System Architecture 5.0 Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/477_acpiview_spe_v2 Notes: v2: - Add include sandwich in MadtParser.h [Zhichao] - Add references to specifications in commit message [Zhichao] v1: - Decode and validate SPE Overflow Interrupt field [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 86 ++++++++++++++++++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h | 40 +++++++++ 2 files changed, 118 insertions(+), 8 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index a1bf86ade5313f954a77b325c13394cfce133939..59c3df0cc8a080497b517baf36fc63f1e4ab866f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -1,17 +1,21 @@ /** @file MADT table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 + - ACPI 6.3 Specification - January 2019 + - Arm Generic Interrupt Controller Architecture Specification, + GIC architecture version 3 and version 4, issue E + - Arm Server Base System Architecture 5.0 **/ #include #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "MadtParser.h" // Local Variables STATIC CONST UINT8* MadtInterruptControllerType; @@ -33,6 +37,21 @@ ValidateGICDSystemVectorBase ( IN VOID* Context ); +/** + This function validates the SPE Overflow Interrupt in the GICC. + + @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 +ValidateSpeOverflowInterrupt ( + IN UINT8* Ptr, + IN VOID* Context + ); + /** An ACPI_PARSER array describing the GICC Interrupt Controller Structure. **/ @@ -56,7 +75,9 @@ STATIC CONST ACPI_PARSER GicCParser[] = { {L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 3, 77, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} + {L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL}, + {L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL, + ValidateSpeOverflowInterrupt, NULL} }; /** @@ -160,6 +181,55 @@ ValidateGICDSystemVectorBase ( } } +/** + This function validates the SPE Overflow Interrupt in the GICC. + + @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 +ValidateSpeOverflowInterrupt ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT16 SpeOverflowInterrupt; + + SpeOverflowInterrupt = *(UINT16*)Ptr; + + // SPE not supported by this processor + if (SpeOverflowInterrupt == 0) { + return; + } + + if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) || + ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) && + (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) || + (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) { + IncrementErrorCount (); + Print ( + L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID " + L"ranges of %d-%d or %d-%d (for GICv3.1 or later).", + SpeOverflowInterrupt, + ARM_PPI_ID_MIN, + ARM_PPI_ID_MAX, + ARM_PPI_ID_EXTENDED_MIN, + ARM_PPI_ID_EXTENDED_MAX + ); + } else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) { + IncrementWarningCount(); + Print ( + L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA " + L"Level 3 PPI ID assignment: %d.", + SpeOverflowInterrupt, + ARM_PPI_ID_PMBIRQ + ); + } +} + /** This function parses the ACPI MADT table. When trace is enabled this function parses the MADT table and @@ -233,7 +303,7 @@ ParseAcpiMadt ( } switch (*MadtInterruptControllerType) { - case EFI_ACPI_6_2_GIC: { + case EFI_ACPI_6_3_GIC: { ParseAcpi ( TRUE, 2, @@ -245,7 +315,7 @@ ParseAcpiMadt ( break; } - case EFI_ACPI_6_2_GICD: { + case EFI_ACPI_6_3_GICD: { if (++GICDCount > 1) { IncrementErrorCount (); Print ( @@ -265,7 +335,7 @@ ParseAcpiMadt ( break; } - case EFI_ACPI_6_2_GIC_MSI_FRAME: { + case EFI_ACPI_6_3_GIC_MSI_FRAME: { ParseAcpi ( TRUE, 2, @@ -277,7 +347,7 @@ ParseAcpiMadt ( break; } - case EFI_ACPI_6_2_GICR: { + case EFI_ACPI_6_3_GICR: { ParseAcpi ( TRUE, 2, @@ -289,7 +359,7 @@ ParseAcpiMadt ( break; } - case EFI_ACPI_6_2_GIC_ITS: { + case EFI_ACPI_6_3_GIC_ITS: { ParseAcpi ( TRUE, 2, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h new file mode 100644 index 0000000000000000000000000000000000000000..fbbc43e09adbdf9fea302a03a61e6dc179f06a62 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h @@ -0,0 +1,40 @@ +/** @file + Header file for MADT table parser + + Copyright (c) 2019, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - Arm Generic Interrupt Controller Architecture Specification, + GIC architecture version 3 and version 4, issue E + - Arm Server Base System Architecture 5.0 +**/ + +#ifndef MADT_PARSER_H_ +#define MADT_PARSER_H_ + +/// +/// Level 3 base server system Private Peripheral Inerrupt (PPI) ID assignments +/// +#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 30 +#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 29 +#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 28 +#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 27 +#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 26 +#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25 +#define ARM_PPI_ID_CTIIRQ 24 +#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 23 +#define ARM_PPI_ID_COMMIRQ 22 +#define ARM_PPI_ID_PMBIRQ 21 +#define ARM_PPI_ID_CNTHPS 20 +#define ARM_PPI_ID_CNTHVS 19 + +/// +/// PPI ID allowed ranges +/// +#define ARM_PPI_ID_MAX 31 +#define ARM_PPI_ID_MIN 16 +#define ARM_PPI_ID_EXTENDED_MAX 1119 +#define ARM_PPI_ID_EXTENDED_MIN 1056 + +#endif // MADT_PARSER_H_ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'