From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.41]) by mx.groups.io with SMTP id smtpd.web11.11022.1578503521822287943 for ; Wed, 08 Jan 2020 09:12:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=ugG/OJYy; spf=pass (domain: arm.com, ip: 40.107.1.41, mailfrom: krzysztof.koch@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=TrrxQ/gVOLB6dfQUzkAqQjvgMipcL+4bzr0zLTvxX2Y=; b=ugG/OJYytEXoAOMZS7zTXAFU5Iss+qBkPlF+cdAsFtdQxZWqAd9ZAxktSBupvq4LinA5aPKKjU0S+edvDAdkjKsuisFWADhJIDKA+gy2fHhVzwrNC5ECeBCzRbbELSRmEsqlPXdFTaPjsLXhzyvr04gU3TaK1mtR7VrvL8ar1eM= Received: from HE1PR0802CA0002.eurprd08.prod.outlook.com (2603:10a6:3:bd::12) by DBBPR08MB4854.eurprd08.prod.outlook.com (2603:10a6:10:d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Wed, 8 Jan 2020 17:11:59 +0000 Received: from DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by HE1PR0802CA0002.outlook.office365.com (2603:10a6:3:bd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9 via Frontend Transport; Wed, 8 Jan 2020 17:11:58 +0000 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=bestguesspass 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 DB5EUR03FT026.mail.protection.outlook.com (10.152.20.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Wed, 8 Jan 2020 17:11:58 +0000 Received: ("Tessian outbound ba41a0333779:v40"); Wed, 08 Jan 2020 17:11:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 46b6a04fee60ec3d X-CR-MTA-TID: 64aa7808 Received: from 0d3dcc53b1d7.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E6747EE7-5111-4681-8995-B88500CCA411.1; Wed, 08 Jan 2020 17:11:52 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0d3dcc53b1d7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Jan 2020 17:11:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kVyZ1wJllkvLeRs/f4iGssByqcM+hMxZCVFWVcL+uaoJrDUk3YV6xfpiLBqQbZcPRML+xeyjh6zOirnE71CZs3Wpb5eN7zuWXkYhOMjNBGpCopzgJvcgUnABGeUMJoQl9WwJueoxOsHKQZ5ZwihIPEFuGg3N5UxP79BzU7e+vV3e5BDs68HvBpiF7rlzMn08BTdgIA726Cawir0oQq3728uSDPOT/9trJRCaflM2Gy43xPPihYIQ8szHV9eCU27+5vJ3RxyLgFkNyBQWGtUyMIpOuuif6NIROYnAO8IFA/IfWaSkwyj/WF6gmVIqiw41nlBrk8wkWT2L9xSm+hxxQw== 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-SenderADCheck; bh=TrrxQ/gVOLB6dfQUzkAqQjvgMipcL+4bzr0zLTvxX2Y=; b=MckgN49Dnet+Aw2auCAr1WuxamNG1C4HxwVutxkFMn3A3VGQVRHTseu7srwxV428+vafdX9omZK9ghmWNZXDwf3G572V7LkFbVjRAAuvOXJpTf8ZW/c8zcg81xw75EzTbcZKGOP1W3UUiofXe0UiFz/NIMJ+J3K1wzvAivZvgstmfjYi3/FlAHLBA2hEtZljXdC8k+fES4SC+hwn9G/Y6pvUajmMU68Fhi32bl0CZWXxj31qL/scNlbXPtA0ZqqO/pWy6GtWmdmSirAssGpLpxGQ7l1eKdM8TuEze5OYzwVXe7DtABdDmoyRPagzmAczYD2PQTMvQJ8zlwxZkMQzIA== 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=bestguesspass 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=TrrxQ/gVOLB6dfQUzkAqQjvgMipcL+4bzr0zLTvxX2Y=; b=ugG/OJYytEXoAOMZS7zTXAFU5Iss+qBkPlF+cdAsFtdQxZWqAd9ZAxktSBupvq4LinA5aPKKjU0S+edvDAdkjKsuisFWADhJIDKA+gy2fHhVzwrNC5ECeBCzRbbELSRmEsqlPXdFTaPjsLXhzyvr04gU3TaK1mtR7VrvL8ar1eM= Received: from VI1PR08CA0178.eurprd08.prod.outlook.com (2603:10a6:800:d1::32) by VI1PR0801MB1632.eurprd08.prod.outlook.com (2603:10a6:800:57::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12; Wed, 8 Jan 2020 17:11:51 +0000 Received: from DB5EUR03FT024.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::202) by VI1PR08CA0178.outlook.office365.com (2603:10a6:800:d1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12 via Frontend Transport; Wed, 8 Jan 2020 17:11:51 +0000 Authentication-Results-Original: 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=bestguesspass 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 DB5EUR03FT024.mail.protection.outlook.com (10.152.20.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2602.11 via Frontend Transport; Wed, 8 Jan 2020 17:11:50 +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.1415.2; Wed, 8 Jan 2020 17:11:49 +0000 Received: from E119924.Arm.com (10.1.199.37) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Wed, 8 Jan 2020 17:11:49 +0000 From: "Krzysztof Koch" To: CC: , , , , Subject: [PATCH v3 1/1] ShellPkg: acpiview: Update SRAT parser to ACPI 6.3 Date: Wed, 8 Jan 2020 17:11:44 +0000 Message-ID: <20200108171144.36788-1-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;IPV:;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(136003)(39860400002)(396003)(346002)(376002)(189003)(199004)(6666004)(44832011)(4326008)(54906003)(1076003)(70206006)(6916009)(356004)(5660300002)(966005)(316002)(86362001)(478600001)(36756003)(15650500001)(7696005)(2906002)(19627235002)(26005)(336012)(81156014)(70586007)(8936002)(2616005)(8676002)(426003)(81166006)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0801MB1632;H:nebula.arm.com;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84b564b5-b8c0-401a-e016-08d7945ddeb6 X-MS-TrafficTypeDiagnostic: VI1PR0801MB1632:|DBBPR08MB4854: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 02760F0D1C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: sEak0zClNJm+S9syORDTF8FecGffW9Jit4M2OSxvL2GeoTpdwl6fMKf3ZuTzFLLBiHFYUv6yGG4XU+U7CTGQBVJxZJInW6tVqeStXVjho/LsSSJZYnYzMvF2qg7HLC+95ay4eeZEhCgjPwtD/CcEKduuHynElMeRUxVB6CSthSlvrt/o1Qkrt2M/2H7w5gbYTnY/ep25MyojBEJ6sm0hZBauIAy9BT96/LDvEJTbfIjzlZx0X0pQXqw5/MUTcY8upDfvtQqS4rLfccrqKepxe3sYITRGqtHsOG44ech86ZE1m5P7T098KGSv89Th/sj6xVhMEKlefvpm4mdH/L18gzI8a2lMWm2y/KBghrRGxpvuCGSaKL//igP2uBcwrPdl3iaya+tSI+Wwp59gXcLq0wBIbqkDgQSoHkZ8+DmMkPCwzEEud7WAunNhDcGTMZnwKSlyPJLFhitZhFcqSk3+CkLH1tPb6uP8NPg8YQMXdhINUZnFhDb07GA1mT8pXKAsP7uoY45nXGbMIuNrtW/+FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1632 Original-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=bestguesspass action=none header.from=arm.com; Return-Path: Krzysztof.Koch@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(396003)(346002)(136003)(376002)(199004)(189003)(316002)(86362001)(6666004)(966005)(5660300002)(1076003)(8936002)(8676002)(44832011)(2906002)(36756003)(81166006)(81156014)(54906003)(70586007)(26826003)(15650500001)(70206006)(7696005)(26005)(426003)(2616005)(336012)(4326008)(478600001)(6916009)(186003)(19627235002);DIR:OUT;SFP:1101;SCL:1;SRVR:DBBPR08MB4854;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:Pass;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 30385c69-e8fe-41b1-6534-08d7945dda30 X-Forefront-PRVS: 02760F0D1C X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eCgm+9TecvfcZCp5iB4pztFR4i3Y1oKiUjZP0/lnJmDLnFd7RBJiNnStVyCmkpzMTiVQoy0sFnArHRATAG/uzls35GWl9XrsxmNJrFM7xEY9zUNhobBLd06GFlpjmLKwtDVs3BF5fIXrtcZMD0FKcDAEJyqG0D44/KQxEmbJEXkKTrQhzQoipv+g4FAJwpT7Z0PDBIR2SicrZ3v/+ILGeNnC2joIrKL0zYpfVQ0BACztUqvvY2Zk3hTugTbf6YKGfxhJHFMNXF0NxYAu9iEs3A0gQqyEPwWhsPmpeN4zR/EG2cXBotNn6f3LU9jz4yD+cmjplL6qE/7LaxjNQavMFa9izawiJbmvDl+mqWbpY5ZjMiyU6ziGNqFwo+cYArY19SrLdhNVN+yKDPffejUQevx/hz1I1ALQtnqsaflwAeFdnGwhH2GLq6xbc+cxdagZMETcMR1fS6/KG/pGAoGp3k4Q824dbydkcmtR2uluMYIkfiUh//WDl/ydP8DVvhG13h5zb3IUZm0v7eRRzbGFoQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2020 17:11:58.4940 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84b564b5-b8c0-401a-e016-08d7945ddeb6 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4854 Content-Type: text/plain Add support for 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 --- The changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/582_acpiview_6_3_srat_v3 Notes: v1: - update SRAT parser to ACPI 6.3 [Krzysztof] v2: - rebase on latest master [Krzysztof] v3: - remove redundant forward declarations [Zhichao] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 33 ++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 16 ++ ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 209 +++++++++++++++++++- 3 files changed, 252 insertions(+), 6 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index a569c3c55406ab58536834e56ce9701f7edeffee..2b2ecb93cef9ee28b752e7bf2d920b059dbf7d6b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -405,6 +405,39 @@ Dump8Chars ( ); } +/** + 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 != 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. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index f374f8ebfe313954c05b2a432816cf7ad3af9e32..6deee3542e09bc18b03fdd18dece5b6f9725839c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -184,6 +184,22 @@ Dump8Chars ( IN UINT8* Ptr ); +/** + 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. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index a8aa420487bb6bf29fc38221d0b221573c64b8b3..6fe7bf681132df08133e3e03e3ee3f020d905dd2 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -5,7 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 + - ACPI 6.3 Specification - January 2019 **/ #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; /** @@ -40,6 +41,167 @@ ValidateSratReserved ( } } +/** + This function validates the Device Handle Type field in the Generic Initiator + 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 = *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 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 follows: + + +-----+------+------+ + |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) + ); +} + +/** + An ACPI_PARSER array describing the Device Handle - ACPI +**/ +STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = { + {L"ACPI_HID", 8, 0, L"0x%lx", 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[] = { + {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", Dump12Chars, + NULL, NULL, NULL} +}; + +/** + 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 == NULL) { + IncrementErrorCount (); + Print (L"\nERROR: Device Handle Type read incorrectly.\n"); + return; + } + + Print (L"\n"); + + if (*SratDeviceHandleType == 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 == 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 APIC Proximity Domain field. @@ -103,6 +265,22 @@ STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = { {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, }; +/** + An ACPI_PARSER array describing the Generic Initiator Affinity Structure +**/ +STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = { + {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 Memory Affinity structure. **/ @@ -183,6 +361,7 @@ ParseAcpiSrat ( UINT8* ResourcePtr; UINT32 GicCAffinityIndex; UINT32 GicITSAffinityIndex; + UINT32 GenericInitiatorAffinityIndex; UINT32 MemoryAffinityIndex; UINT32 ApicSapicAffinityIndex; UINT32 X2ApicAffinityIndex; @@ -190,6 +369,7 @@ ParseAcpiSrat ( GicCAffinityIndex = 0; GicITSAffinityIndex = 0; + GenericInitiatorAffinityIndex = 0; MemoryAffinityIndex = 0; ApicSapicAffinityIndex = 0; X2ApicAffinityIndex = 0; @@ -232,7 +412,7 @@ ParseAcpiSrat ( } switch (*SratRAType) { - case EFI_ACPI_6_2_GICC_AFFINITY: + case EFI_ACPI_6_3_GICC_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -249,7 +429,7 @@ ParseAcpiSrat ( ); break; - case EFI_ACPI_6_2_GIC_ITS_AFFINITY: + case EFI_ACPI_6_3_GIC_ITS_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -266,7 +446,24 @@ ParseAcpiSrat ( ); break; - 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), @@ -283,7 +480,7 @@ ParseAcpiSrat ( ); break; - case EFI_ACPI_6_2_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY: + case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -300,7 +497,7 @@ ParseAcpiSrat ( ); break; - 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)'