From nobody Fri Mar 29 11:12:19 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+42304+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1560364356; cv=none; d=zoho.com; s=zohoarc; b=VK+tin7CANwcnjELdIS5echxBaUPv0OioO0ivy8TragK2wUOkiwJXIqBuDlSJd3UNuLH7AvPdB1LKvHNuvXdzbAI1JHZXA7S0ZmtGyxSMyYJ1Io4E1nZkGHug46pGDQerQ1UeXj/edFL9p18x3ShWppNRuOX3NaxyotflIbcyXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560364356; 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=X1+jNYh2bOrqFrnlh7VRHwDlMC14SACIcqVfrpckmn4=; b=a3TP2+4ibVlbdunmy/l/1F1yM/5e7MObY2pQDvFYe1X1e6/AD0SoYcNW+pswq8v/4oCHF+esClWLkTi7ogWVcwipTXuc8J3a7fUc4DrXQSEqrQqv44qzClbalaXcfJToNJQauVrtx5oimIZ8/yu5FPeVGl6zE/2qz4Yv1JgScME= 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+42304+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1560364355917946.8018805559891; Wed, 12 Jun 2019 11:32:35 -0700 (PDT) Return-Path: X-Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.48]) by groups.io with SMTP; Wed, 12 Jun 2019 11:32:34 -0700 X-Received: from DB7PR08CA0016.eurprd08.prod.outlook.com (2603:10a6:5:16::29) 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 18:32:28 +0000 X-Received: from VE1EUR03FT030.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::202) by DB7PR08CA0016.outlook.office365.com (2603:10a6:5:16::29) 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 18:32:28 +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+42304+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 VE1EUR03FT030.mail.protection.outlook.com (10.152.18.66) 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 18:32:26 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1415.2; Wed, 12 Jun 2019 14:10:54 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Wed, 12 Jun 2019 14:10:53 +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 14:10:53 +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 15:10:45 +0100 Message-ID: <20190612141046.30168-2-krzysztof.koch@arm.com> In-Reply-To: <20190612141046.30168-1-krzysztof.koch@arm.com> References: <20190612141046.30168-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: 064c19f8-2464-47de-0398-08d6ef64520b 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: wBaUV6+hAbAi96XkYrYkDwYYGtHyWIU9BVmliF02nVntYKnWyryGv3r/d4IrIELjwUr3jBTu5yOzAM2ZlZsRQuxdjf2G0UkdySerwodH6cnPnxNooapaQep/rIk1EOgpM0PjGdKsecT6gEuob1IKq09l4h9iBPWE7NNwJYWtUNXPijSODEmlV731hSYnGh+2zNMg1TNpEwwSIwDZVjOjJBoBtZAaKcYTQD1dJvdxt4JhwgBiuK60q07pPL5HO4jDvg0rbAMt2zoR6CVnzF6+Vk7eMwnMe2EOqH3S5FxQUVx7t78ORn0+lQEz0JE71LAQyu/vyA61061jP4ye/wwOTes1/9BgCP7VL8ENdgyBHpN4luR1GV8Q2+OT+dhH+uH3VsjaDM0/usGe2j5EYdJdbh8gjzTISqxGyOu3jrGhNyg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2019 18:32:26.9633 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 064c19f8-2464-47de-0398-08d6ef64520b 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=1560364355; bh=ilpQMV16riNTrDKTu/BoxXCx2QXUw9vzGatmSjchVr8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=COKvY4ewuqGra648lGEWGSWBjUYvvHu3L9MQeoQR7MoYWEgeKQnCxUmsslyTg11VTlV D6j4W20+424GOI0AUPx19D9wlYBCn8DYOWHAgaKaczBumbsA+MpbKkHnd4CFQZpBXexup kfrgCRiPELIzlErAVa2lzJTZ23Hd1JkhCb4= 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 Reviewed-by: Alexei Fedorov Reviewed-by: Liming Gao Reviewed-by: Sami Mujawar --- 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 (#42304): https://edk2.groups.io/g/devel/message/42304 Mute This Topic: https://groups.io/mt/32043797/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 Mar 29 11:12:19 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+42300+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1560358332; cv=none; d=zoho.com; s=zohoarc; b=PRTxBQH7tO26ARVO8yWRCEOn0vmiSoFElF+X203XEFr6LaWdVJK+JDxeWfBdxFdWdyx2dj/y/MCaOMvHcU4ynjTghQrXgC0X5BhDIG/Rd9+cV/r0ntlFvCKkWjSJzDr9A1AKnTToGxopMX2hpv0WVhEIRXeEn++9zk7VhDnuF6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560358332; 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=pm5WX4TPngSjg6M0OTPkCT/ATjJcpTKtumD9W8+xiD8=; b=ZLC4V+0XU9JAgxZaoPLkwUQDumzJmupzmLjujikqCBZa0bBqJczbPW56HscDPXI85Op8AudUVfu/ujiX8I03grfUPYgCAXUTgEHGfKH6ffw+269zouFXDETHizDPhikToK2eAJXVFRTIQ86TW1v3+i8DIWRMfST1ZPzPGIQ+G4s= 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+42300+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1560358332512157.45718918201044; Wed, 12 Jun 2019 09:52:12 -0700 (PDT) Return-Path: X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.77]) by groups.io with SMTP; Wed, 12 Jun 2019 09:52:11 -0700 X-Received: from VI1PR0801CA0088.eurprd08.prod.outlook.com (2603:10a6:800:7d::32) by DB6PR08MB2773.eurprd08.prod.outlook.com (2603:10a6:6:20::22) 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:52:04 +0000 X-Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::204) by VI1PR0801CA0088.outlook.office365.com (2603:10a6:800:7d::32) 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:52:04 +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+42300+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 VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) 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:52:02 +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 14:10:54 +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 14:10:53 +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 15:10:46 +0100 Message-ID: <20190612141046.30168-3-krzysztof.koch@arm.com> In-Reply-To: <20190612141046.30168-1-krzysztof.koch@arm.com> References: <20190612141046.30168-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: d884707e-334b-460d-13ee-08d6ef564b5e X-MS-TrafficTypeDiagnostic: DB6PR08MB2773: 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: h6o/INpCNKzVWectdi2XN+fUpWwJj/BSHja66/IO4/XzwKiDadKem2L2NgmpMokc9N57F4nk02mcskLOhBRNIHPouoSBrtsdK7aAlgi6LOFvOZopWu4dKznVrcE9cb82JJlRhuKD1uvVffDYInWmT2+uoJLH8Eq6wvarchVNyCJtYD32Gv7Wy874r+Stf4j09KwXuy+ScRk6LHpkLZKtOpdvJyA6do+EPmOT9KnsMFfiPY5vxJVGC8TVP0NAr4jspdEEL5NCn6hyemqt8RY7OSdEip2Cs96BY59rb3ieUi0YiHxJndDJZWTMI8+6KjykgHwhbJjQ2drYoHtkki5VNgTzZh1+OhR2LaADavW/UinPmRau+CNwbUowKyAtmZqknrqIUsPuKTlbbOLVmi16vmqAf4lJ9nM7+h+tbty1EVI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2019 16:52:02.8134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d884707e-334b-460d-13ee-08d6ef564b5e 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: DB6PR08MB2773 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=1560358331; bh=h2KK4N4C7LpJjrc5Z1nkzqPVeui1Nw6DHsfat0TBhbA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vcvWyg4pgwUW/Xs08RoB4Lql4C8eDCedwtdWR3zW3KK6VagesiQJqAUTZRBRGDx5clJ Y3wgnigCyLSkNiKM6E1dA4Dd2qz9T1bikTE9LJGH8ffS3SoYRZc6rGjEdXx/mF0tFLEpW ilbAr306t+Ra6kwZNNx2M6JiQEvNWWtNBco= 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 Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar --- 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 (#42300): https://edk2.groups.io/g/devel/message/42300 Mute This Topic: https://groups.io/mt/32042696/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-