From nobody Fri Apr 26 05:41:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42295+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1560357086; cv=none; d=zoho.com; s=zohoarc; b=IfsnWuQGrLc/RxBLjIU+JF2bQfKcM37KP0Lc3xdLKjy+X6ulDRw9yoSOBI765ui4WKaQvr7Jt4IzXcR0WCvsky4TNMpZVvuvKmf9+wskH52KwoDnkwQ8yx08myPmOeAB/R44iAoNNqWcPS/JCwHpT8Y2tz4IAyGSV7xTiTQMlGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560357086; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=nrX0G4C2Wp4ogdO16AEb5k2GwPpu1FXkJ6We2n2Vdp0=; b=ix0s0up+mN1fZ1TQyga7+VjxGbRzxhQ2sxXEePuvkCd3ALveXj9qWDiXMeq8xcbMS8kg2UQaW5tImRXI3YBu5XyGrz88X1UpfoU8uKAyVwxNpXujP6oS5gnDM0L9/MQPNtQuDNexr/qxghe6aCrLU2UN0SkJiHfLKkFApDkmOjk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42295+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1560357086732120.11442257722695; Wed, 12 Jun 2019 09:31:26 -0700 (PDT) Return-Path: X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.84]) by groups.io with SMTP; Wed, 12 Jun 2019 09:31:25 -0700 X-Received: from VI1PR0802CA0008.eurprd08.prod.outlook.com (2603:10a6:800:aa::18) by AM6PR08MB4599.eurprd08.prod.outlook.com (2603:10a6:20b:90::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.11; Wed, 12 Jun 2019 16:31:21 +0000 X-Received: from VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::203) by VI1PR0802CA0008.outlook.office365.com (2603:10a6:800:aa::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1965.12 via Frontend Transport; Wed, 12 Jun 2019 16:31:21 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42295+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT027.mail.protection.outlook.com (10.152.18.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.1987.11 via Frontend Transport; Wed, 12 Jun 2019 16:31:20 +0000 X-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; Wed, 12 Jun 2019 12:31:08 +0000 X-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; Wed, 12 Jun 2019 12:31:08 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 1/2] MdePkg: Add Generic Initiator Affinity Structure definitions to SRAT Date: Wed, 12 Jun 2019 13:31:00 +0100 Message-ID: <20190612123101.65584-2-krzysztof.koch@arm.com> In-Reply-To: <20190612123101.65584-1-krzysztof.koch@arm.com> References: <20190612123101.65584-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b1fe1aff-2299-4a21-735d-08d6ef5366e9 X-MS-TrafficTypeDiagnostic: AM6PR08MB4599: X-MS-Exchange-PUrlCount: 1 NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 147TrMLWSFaued8nR5WivgQ4A13GKkIbyHqSFI7z2y1buoYZpAq8CXsK/rxl9yjisORd/Mo1zsAR1Jnx0id3GVbGkdv6QzbwIsTD80Z3H2pCs4iVFi4JbNAMh8xKQkvr3weqP1EpCIEJy8oEDNC9SrVGVs4ArspOTuuW1cEhQhKmgWpJyuUgIMDCf+zgGS/4rfnWabeB6gvfLWgG/7EpTny9xtzSzI+Z/MdZCeXXQkBz4cruzjorT+8rFi6kHONn2w+nH5y+9h2TAY5qZa5HHD5bjUAgPnOerfsOHmz/niEVWIpsVlKP9Wkg1jiFoyqJSpT00HzVTWGqDD526KxkazM4J3rA8wlQ2chOLr53hWP7z5epnwsL8hnNR4HS5hTmX2+rPPU68a3aTc33AOojJF9JeJUVzYHwieUbzwWZxPY= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2019 16:31:20.6172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1fe1aff-2299-4a21-735d-08d6ef5366e9 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: AM6PR08MB4599 Precedence: Bulk List-Unsubscribe: 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560357086; bh=w23IyeVzVA1vpPjlKFmfhUos6CZXXnSL2anfq2bg55c=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=SRbdY90n3ugH6ETqNt/kQczEPBJfpVhHRDvEz2vhbWphJNmmU9nyA0wDe4hKvT8AWbJ 1dQy+g687Cx7Aw1ZkPA87XQwHl6/sSegFStTYJXJeZw0bd248ZNA00shgYqUMVjADnlgR Lj4zp1E+qeLmnXfsNIjnv3cH4Txy5QMgPDs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add Generic Initiator Affinity Structure to the list of recognised System Resource Affinity Table (SRAT) structure types. Add definitions for Device Handle Types inside the Generic Initiator Affinity Structure. References: - ACPI 6.3 January 2019, Table 5-78 Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/582_acp= iview_6_3_srat_v1 Notes: v1: - define the SRAT Generic Initiator Affinity Struct type [Krzysztof] - define the SRAT Device Handle Types [Krzysztof] MdePkg/Include/IndustryStandard/Acpi63.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/IndustryStandard/Acpi63.h b/MdePkg/Include/Indu= stryStandard/Acpi63.h index a8e011579ffcf070ecdfd2c6726a16d1afd65891..eca1f9357b70f10887e680ff13c= 97c0beab3600b 100644 --- a/MdePkg/Include/IndustryStandard/Acpi63.h +++ b/MdePkg/Include/IndustryStandard/Acpi63.h @@ -639,7 +639,7 @@ typedef struct { =20 // // SRAT structure types. -// All other values between 0x05 an 0xFF are reserved and +// All other values between 0x06 an 0xFF are reserved and // will be ignored by OSPM. // #define EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY 0x00 @@ -647,6 +647,7 @@ typedef struct { #define EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_AFFINITY 0x02 #define EFI_ACPI_6_3_GICC_AFFINITY 0x03 #define EFI_ACPI_6_3_GIC_ITS_AFFINITY 0x04 +#define EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY 0x05 =20 /// /// Processor Local APIC/SAPIC Affinity Structure Definition @@ -733,6 +734,14 @@ typedef struct { UINT32 ItsId; } EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE; =20 +// +// Generic Initiator Affinity Structure Device Handle Types +// All other values between 0x02 an 0xFF are reserved and +// will be ignored by OSPM. +// +#define EFI_ACPI_6_3_ACPI_DEVICE_HANDLE 0x00 +#define EFI_ACPI_6_3_PCI_DEVICE_HANDLE 0x01 + /// /// Device Handle - ACPI /// -- '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 (#42295): https://edk2.groups.io/g/devel/message/42295 Mute This Topic: https://groups.io/mt/32042459/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- From nobody Fri Apr 26 05:41:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42297+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1560357890; cv=none; d=zoho.com; s=zohoarc; b=DniZVTBHiu9gcLXOpcS4cEcfWwQ2ltfDTlAf3en4tIeb0w0XRRLjYKfy6c/xVgDX8NDzKA8q3YOTuc+H+1Ee9siQThomG6xSQuRhs00Gdeqbr0eiUVCqLfpe+qXFd7BZmTVnP1hbbC7ql7IXcW/m3ONNJfMvh4GjQ2BOnlDVTSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560357890; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=zfM0f0X4TFujJ5A4jOSkse2qes/CBdFoUWNXgvuIUsc=; b=ZKRUrvbCnfKzNbpekj2cItWdW+Tjtvc8VxSs2wPZuNPusFD23/gOwhW2iF/LeNKV1462xFeclJJ8naLTP2hlDPxA+zHZqIkKpIck0BDiadJ6i/DK7RI6LRiiiYmGUl+2cztRTuLAvy0lPzgLrNXIsP4eEzK2m+NTSX4vM7ueOdU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42297+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1560357890033150.94638134127842; Wed, 12 Jun 2019 09:44:50 -0700 (PDT) Return-Path: X-Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.55]) by groups.io with SMTP; Wed, 12 Jun 2019 09:44:49 -0700 X-Received: from VI1PR0802CA0026.eurprd08.prod.outlook.com (2603:10a6:800:a9::12) by HE1PR08MB2779.eurprd08.prod.outlook.com (2603:10a6:7:34::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.12; Wed, 12 Jun 2019 16:44:42 +0000 X-Received: from VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::207) by VI1PR0802CA0026.outlook.office365.com (2603:10a6:800:a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.14 via Frontend Transport; Wed, 12 Jun 2019 16:44:42 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42297+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT018.mail.protection.outlook.com (10.152.18.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.1987.11 via Frontend Transport; Wed, 12 Jun 2019 16:44:40 +0000 X-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; Wed, 12 Jun 2019 12:31:09 +0000 X-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; Wed, 12 Jun 2019 12:31:08 +0000 From: "Krzysztof Koch" To: CC: , , , , , , Subject: [edk2-devel] [PATCH v1 2/2] ShellPkg: acpiview: Update SRAT parser to ACPI 6.3 Date: Wed, 12 Jun 2019 13:31:01 +0100 Message-ID: <20190612123101.65584-3-krzysztof.koch@arm.com> In-Reply-To: <20190612123101.65584-1-krzysztof.koch@arm.com> References: <20190612123101.65584-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a4e002c-e837-4466-f5ad-08d6ef5543e6 X-MS-TrafficTypeDiagnostic: HE1PR08MB2779: X-MS-Exchange-PUrlCount: 1 NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: Yitu2kDBwvZluBp+vN0ySo6hjdijOJoCDJA9gRCDqBfPDswftk+wOFdAvsWiGl1DkHLYE374297KDRvuumhIwMazqTv4y2/TZcbFvJGPuAe0HTdiqu9TTdyg0m5I4hrKI45ac79d0FKsHmXarBRa6cWQMMwWtN96N+8R5qOsxdlFIxgGPtzFKvuZ1xuKNjrXPXr/WbzmnzKFQULPBFWirRlC/jSzs+w46lwjcaa9PNHUlA2Y2qWC5idz4p9wlY/BJo/Rj9t2z8NkuDnalJNBCTlcLwccM6A/NX7D9FxAtbP2EyTzyd+GxoOieWx8SSyzWjArzVZFtnni2va3i4Uj1j+ZaUdKlKQyrMgRvKUkodDciS85DLTyb4Mm2djcDL0Uaml99AIIvBRtKSK6gkcFCoqiNck6FYZ1ijRZ1GTjyEg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2019 16:44:40.8335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a4e002c-e837-4466-f5ad-08d6ef5543e6 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: HE1PR08MB2779 Precedence: Bulk List-Unsubscribe: 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560357889; bh=YBoQRdVgvgPtiho+cNk7FGZ8+NtIssmMfSp7tuONZj4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=hy2dxp3ZlqASvCrjfNlhX9US3gaNd8qA5kZGQm/bYzlBd9nAirVuV+LkP4gQlfWsDtG 868hrx6dApkwuFiGXKGDWL+53qgSh7drpQUF6KM6nCQXufA10syBk/eNEV82/oZu0tc+z 3Y4J80uke7FT5Zy1Ms/IR6BvvZkgt6LJFBI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for parsing revision 3 of System Resource Affinity Table (SRAT). Decode and dump the new Generic Initiator Affinity Structure. Validate the Device Handle Type field inside the Generic Initiator Affinity Structure. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/582_acp= iview_6_3_srat_v1 Notes: v1: - dump and validate the Generic Initiator Affinity Struct [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | = 35 ++- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | = 16 ++ ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 2= 56 +++++++++++++++++++- 3 files changed, 299 insertions(+), 8 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index b5965507b498b9fa9bc4d3124b2285f509004c4f..60523936732f901317ee93d03fe= 06df1403f3695 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -1,7 +1,7 @@ /** @file ACPI 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 @@ -401,6 +401,39 @@ Dump8Chars ( ); } =20 +/** + This function traces 12 characters which can be optionally + formated using the format string if specified. + + If no format string is specified the Format must be NULL. + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +VOID +EFIAPI +Dump12Chars ( + IN CONST CHAR16* Format OPTIONAL, + IN UINT8* Ptr + ) +{ + Print ( + (Format !=3D NULL) ? Format : L"%c%c%c%c%c%c%c%c%c%c%c%c", + Ptr[0], + Ptr[1], + Ptr[2], + Ptr[3], + Ptr[4], + Ptr[5], + Ptr[6], + Ptr[7], + Ptr[8], + Ptr[9], + Ptr[10], + Ptr[11] + ); +} + /** This function indents and prints the ACPI table Field Name. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 7657892d9fd2e2e14c6578611ff0cf1b6f6cd750..5b23ab6fa9bd2f87e0347287872= 685a2f74622f3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -184,6 +184,22 @@ Dump8Chars ( IN UINT8* Ptr ); =20 +/** + This function traces 12 characters which can be optionally + formated using the format string if specified. + + If no format string is specified the Format must be NULL. + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +VOID +EFIAPI +Dump12Chars ( + IN CONST CHAR16* Format OPTIONAL, + IN UINT8* Ptr + ); + /** This function indents and prints the ACPI table Field Name. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index 075ff2a141a82b522e8aaedb7ad79249aaf5eaac..8c268a11454d13c9e278691d619= a580c4c14c08e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -1,11 +1,11 @@ /** @file SRAT 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 **/ =20 #include @@ -17,6 +17,7 @@ // Local Variables STATIC CONST UINT8* SratRAType; STATIC CONST UINT8* SratRALength; +STATIC CONST UINT8* SratDeviceHandleType; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; =20 /** @@ -34,6 +35,51 @@ ValidateSratReserved ( IN VOID* Context ); =20 +/** + This function validates the Device Handle Type field in the Generic Init= iator + Affinity Structure. + + @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 +ValidateSratDeviceHandleType ( + IN UINT8* Ptr, + IN VOID* Context + ); + +/** + This function traces the Device Handle field inside Generic Initiator + Affinity Structure. + + @param [in] Format Format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +STATIC +VOID +EFIAPI +DumpSratDeviceHandle ( + IN CONST CHAR16* Format, + IN UINT8* Ptr + ); + +/** + This function traces the PCI BDF Number field inside Device Handle - PCI + + @param [in] Format Format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +STATIC +VOID +EFIAPI +DumpSratPciBdfNumber ( + IN CONST CHAR16* Format, + IN UINT8* Ptr + ); + /** This function traces the APIC Proximity Domain field. =20 @@ -90,6 +136,41 @@ STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] =3D= { {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, }; =20 +/** + An ACPI_PARSER array describing the Generic Initiator Affinity Structure +**/ +STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] =3D { + {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, + + {L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Device Handle Type", 1, 3, L"%d", NULL, (VOID**)&SratDeviceHandleType, + ValidateSratDeviceHandleType, NULL}, + {L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL}, + {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL} +}; + +/** + An ACPI_PARSER array describing the Device Handle - ACPI +**/ +STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] =3D { + {L"ACPI_HID", 8, 0, L"0x%x", NULL, NULL, NULL, NULL}, + {L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} +}; + +/** + An ACPI_PARSER array describing the Device Handle - PCI +**/ +STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] =3D { + {L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL}, + {L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL}, + {L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12C= hars, + NULL, NULL, NULL} +}; + /** An ACPI_PARSER array describing the Memory Affinity structure. **/ @@ -159,6 +240,148 @@ ValidateSratReserved ( } } =20 +/** + This function validates the Device Handle Type field in the Generic Init= iator + Affinity Structure. + + @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 +ValidateSratDeviceHandleType ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT8 DeviceHandleType; + + DeviceHandleType =3D *Ptr; + + if (DeviceHandleType > EFI_ACPI_6_3_PCI_DEVICE_HANDLE) { + IncrementErrorCount (); + Print ( + L"\nERROR: Invalid Device Handle Type: %d. Must be between 0 and %d.= ", + DeviceHandleType, + EFI_ACPI_6_3_PCI_DEVICE_HANDLE + ); + } +} + +/** + This function traces the Device Handle field inside Generic Initiator + Affinity Structure. + + @param [in] Format Format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +STATIC +VOID +EFIAPI +DumpSratDeviceHandle ( + IN CONST CHAR16* Format, + IN UINT8* Ptr + ) +{ + if (SratDeviceHandleType =3D=3D NULL) { + IncrementErrorCount (); + Print (L"\nERROR: Device Handle Type read incorrectly.\n"); + return; + } + + Print (L"\n"); + + if (*SratDeviceHandleType =3D=3D EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) { + ParseAcpi ( + TRUE, + 2, + NULL, + Ptr, + sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_ACPI), + PARSER_PARAMS (SratDeviceHandleAcpiParser) + ); + } else if (*SratDeviceHandleType =3D=3D EFI_ACPI_6_3_PCI_DEVICE_HANDLE) { + ParseAcpi ( + TRUE, + 2, + NULL, + Ptr, + sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_PCI), + PARSER_PARAMS (SratDeviceHandlePciParser) + ); + } +} + +/** + This function traces the PCI BDF Number field inside Device Handle - PCI + + @param [in] Format Format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +STATIC +VOID +EFIAPI +DumpSratPciBdfNumber ( + IN CONST CHAR16* Format, + IN UINT8* Ptr + ) +{ + CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; + + Print (L"\n"); + + /* + The PCI BDF Number subfields are printed in the order specified in the= ACPI + specification. The format of the 16-bit PCI BDF Number field is as fol= lows: + + +-----+------+------+ + |DEV | FUNC | BUS | + +-----+------+------+ + |15:11| 10:8 | 7:0 | + +-----+------+------+ + */ + + // Print PCI Bus Number (Bits 7:0 of Byte 2) + UnicodeSPrint ( + Buffer, + sizeof (Buffer), + L"PCI Bus Number" + ); + PrintFieldName (4, Buffer); + Print ( + L"0x%x\n", + *Ptr + ); + + Ptr++; + + // Print PCI Device Number (Bits 7:3 of Byte 3) + UnicodeSPrint ( + Buffer, + sizeof (Buffer), + L"PCI Device Number" + ); + PrintFieldName (4, Buffer); + Print ( + L"0x%x\n", + (*Ptr & (BIT7 | BIT6 | BIT5 | BIT4 | BIT3)) >> 3 + ); + + // PCI Function Number (Bits 2:0 of Byte 3) + UnicodeSPrint ( + Buffer, + sizeof (Buffer), + L"PCI Function Number" + ); + PrintFieldName (4, Buffer); + Print ( + L"0x%x\n", + *Ptr & (BIT2 | BIT1 | BIT0) + ); +} + /** This function traces the APIC Proximity Domain field. =20 @@ -211,6 +434,7 @@ ParseAcpiSrat ( UINT8* ResourcePtr; UINT32 GicCAffinityIndex; UINT32 GicITSAffinityIndex; + UINT32 GenericInitiatorAffinityIndex; UINT32 MemoryAffinityIndex; UINT32 ApicSapicAffinityIndex; UINT32 X2ApicAffinityIndex; @@ -218,6 +442,7 @@ ParseAcpiSrat ( =20 GicCAffinityIndex =3D 0; GicITSAffinityIndex =3D 0; + GenericInitiatorAffinityIndex =3D 0; MemoryAffinityIndex =3D 0; ApicSapicAffinityIndex =3D 0; X2ApicAffinityIndex =3D 0; @@ -247,7 +472,7 @@ ParseAcpiSrat ( ); =20 switch (*SratRAType) { - case EFI_ACPI_6_2_GICC_AFFINITY: + case EFI_ACPI_6_3_GICC_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -264,7 +489,7 @@ ParseAcpiSrat ( ); break; =20 - case EFI_ACPI_6_2_GIC_ITS_AFFINITY: + case EFI_ACPI_6_3_GIC_ITS_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -281,7 +506,24 @@ ParseAcpiSrat ( ); break; =20 - case EFI_ACPI_6_2_MEMORY_AFFINITY: + case EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY: + AsciiSPrint ( + Buffer, + sizeof (Buffer), + "Generic Initiator Affinity Structure [%d]", + GenericInitiatorAffinityIndex++ + ); + ParseAcpi ( + TRUE, + 2, + Buffer, + ResourcePtr, + *SratRALength, + PARSER_PARAMS (SratGenericInitiatorAffinityParser) + ); + break; + + case EFI_ACPI_6_3_MEMORY_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -298,7 +540,7 @@ ParseAcpiSrat ( ); break; =20 - case EFI_ACPI_6_2_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY: + case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -315,7 +557,7 @@ ParseAcpiSrat ( ); break; =20 - case EFI_ACPI_6_2_PROCESSOR_LOCAL_X2APIC_AFFINITY: + case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), -- '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 (#42297): https://edk2.groups.io/g/devel/message/42297 Mute This Topic: https://groups.io/mt/32042587/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-