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=ZyLupbXX; spf=pass (domain: arm.com, ip: 40.107.1.50, mailfrom: sami.mujawar@arm.com) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.50]) by groups.io with SMTP; Fri, 07 Jun 2019 09:59:44 -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=y6p+LpmoGdnytU4orz2YQsOlaWiwwgXIn53xXF34xjo=; b=ZyLupbXXJZKTWGrt2qVJNiLHGDX++9Thfa85CKanFUZ+eaaVhe16l34p/qUy/XhscyKP628jJqyd0iDlq1YfV33gL+w6oErnXIyShvmm4n1QkTN9yxAVuul/pvl5XOqV6GLnYhrIBL7gSpZAOFLz0GrN+gnQADbm81a7lO+w/Aw= Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com (10.172.228.142) by DB6PR0802MB2437.eurprd08.prod.outlook.com (10.172.250.148) 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 16:59:39 +0000 Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::a46c:aa3a:17bf:7909]) by DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::a46c:aa3a:17bf:7909%3]) with mapi id 15.20.1965.011; Fri, 7 Jun 2019 16:59:39 +0000 From: "Sami Mujawar" To: "devel@edk2.groups.io" CC: "jaben.carsey@intel.com" , "ray.ni@intel.com" , "zhichao.gao@intel.com" , Krzysztof Koch , nd Subject: Re: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser Thread-Topic: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser Thread-Index: AQHVHQ20i0fK6Fo4JEujJvPWF3Zlb6aQalOA Date: Fri, 7 Jun 2019 16:59:39 +0000 Message-ID: References: <20190607084741.19300-1-krzysztof.koch@arm.com> In-Reply-To: <20190607084741.19300-1-krzysztof.koch@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 22e5a0c8-818a-4ccd-8304-a61dacba5efc.1 x-checkrecipientchecked: true authentication-results: spf=none (sender IP is ) smtp.mailfrom=Sami.Mujawar@arm.com; x-originating-ip: [217.140.106.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b9ab326d-a724-46ce-0585-08d6eb698762 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0802MB2437; x-ms-traffictypediagnostic: DB6PR0802MB2437: x-ms-exchange-purlcount: 1 nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:161; x-forefront-prvs: 0061C35778 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(39860400002)(136003)(366004)(346002)(13464003)(199004)(189003)(102836004)(8936002)(72206003)(6506007)(478600001)(26005)(74316002)(53546011)(76176011)(71200400001)(14444005)(256004)(53936002)(316002)(2906002)(71190400001)(5660300002)(446003)(81166006)(1730700003)(486006)(186003)(66066001)(476003)(81156014)(7696005)(33656002)(14454004)(4326008)(7736002)(305945005)(8676002)(966005)(68736007)(2351001)(66556008)(229853002)(66446008)(6916009)(73956011)(64756008)(66476007)(76116006)(66946007)(99286004)(15650500001)(6116002)(3846002)(86362001)(25786009)(6436002)(2501003)(52536014)(54906003)(5640700003)(55016002)(6246003)(9686003)(6306002)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0802MB2437;H:DB6PR0802MB2375.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:3; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: m+vo0xGnbiZ2ot0Nvn1OW0Z1VFPYyCLTIy5XIdgXz5L1d0SOiaUiidjpa3HoLmtv0C6Bm6M8R5S1aqQXkwdVxfQykXnFg4nNa4E9HqfKWnHsuVFCIiwtFoiGLu/f2IYFDeSsDu3IEPLvm7/ESQJuTXzD8FgVi0L+6ZWOapWBP9KsMorO5/a8fXER/rrfHdgHLBUTBco3T0TGPu0hlfMA4v3xfjacjZpIb7cXJq+eVNevhNNitXlpCZPfh2ZI6ADoRgvY/gJgRYfZNrP/Vv1GpG6pR6D31W2+GtPxm3KG0RzO8xxJ7w6E//RkQnZIzMQ0QOPfEwrA9vzusKt/M9iBf8FLCJgULGtARaZd/T/lfxK9dx5rq7ckN285ztJHSErMgUrqgXffii1wippamLOkZ1V0W/PDuTLjxYaT/MDJuJM= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9ab326d-a724-46ce-0585-08d6eb698762 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2019 16:59:39.3974 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2437 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sami Mujawar -----Original Message----- From: Krzysztof Koch =20 Sent: 07 June 2019 09:48 AM To: devel@edk2.groups.io Cc: Sami Mujawar ; jaben.carsey@intel.com; ray.ni@int= el.com; zhichao.gao@intel.com; Matteo Carlini ; Ste= phanie Hughes-Fitt ; nd Subject: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser The ACPI 6.3 specification introduces a 'SPE overflow Interrupt' field as p= art of the GICC structure. Update the MADT parser to decode this field and validate the interrupt ID u= sed. 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_acp= iview_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 | 8= 6 ++++++++++++++++++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parser= s/Madt/MadtParser.h | 40 +++++++++ 2 files changed, 118 insertions(+), 8 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Madt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.c index a1bf86ade5313f954a77b325c13394cfce133939..59c3df0cc8a080497b517baf36f= c63f1e4ab866f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.= c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars +++ er.c @@ -1,17 +1,21 @@ /** @file MADT table parser =20 - 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 =20 @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 **/ =20 #include #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "MadtParser.h" =20 // Local Variables STATIC CONST UINT8* MadtInterruptControllerType; @@ -33,6 +37,21 @@ Valida= teGICDSystemVectorBase ( IN VOID* Context ); =20 +/** + 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[] =3D { {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=20 + overflow Interrupt", 2, 78, L"0x%x", NULL, NULL, + ValidateSpeOverflowInterrupt, NULL} }; =20 /** @@ -160,6 +181,55 @@ ValidateGICDSystemVectorBase ( } } =20 +/** + 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 =3D *(UINT16*)Ptr; + + // SPE not supported by this processor if (SpeOverflowInterrupt =3D=3D= =20 + 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 !=3D ARM_PPI_ID_PMBIRQ) { + IncrementWarningCount(); + Print ( + L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with S= BSA " + 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 ( } =20 switch (*MadtInterruptControllerType) { - case EFI_ACPI_6_2_GIC: { + case EFI_ACPI_6_3_GIC: { ParseAcpi ( TRUE, 2, @@ -245,7 +315,7 @@ ParseAcpiMadt ( break; } =20 - case EFI_ACPI_6_2_GICD: { + case EFI_ACPI_6_3_GICD: { if (++GICDCount > 1) { IncrementErrorCount (); Print ( @@ -265,7 +335,7 @@ ParseAcpiMadt ( break; } =20 - 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; } =20 - case EFI_ACPI_6_2_GICR: { + case EFI_ACPI_6_3_GICR: { ParseAcpi ( TRUE, 2, @@ -289,7 +359,7 @@ ParseAcpiMadt ( break; } =20 - 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/Madt= Parser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.h new file mode 100644 index 0000000000000000000000000000000000000000..fbbc43e09adbdf9fea302a03a61= e6dc179f06a62 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars +++ er.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=20 +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)'