From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.40]) by mx.groups.io with SMTP id smtpd.web12.2777.1574069591840492299 for ; Mon, 18 Nov 2019 01:33:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=cjw/8SY9; spf=pass (domain: arm.com, ip: 40.107.3.40, mailfrom: sami.mujawar@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=ktmrk3CfVG3x8PvRwYr9Z56gy9joWHW3KFYRvqqPEKA=; b=cjw/8SY9NmJA+Ad4DjFjJuH+RFV6a70hRWFAi437HqYSWkY8h7gSR2V7FP1kkldpuImXrFogKw2MhfdzRDThDcHXfjF6saX8fhK/Qb+1PcRbH5WsXJu5RFODHdal+YhssP0gX9/lS/TyMiVZR8XL3pxPyT72tiuhwVX2j2Yg5V4= Received: from AM6PR08CA0025.eurprd08.prod.outlook.com (2603:10a6:20b:c0::13) by VE1PR08MB5056.eurprd08.prod.outlook.com (2603:10a6:803:116::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.26; Mon, 18 Nov 2019 09:33:09 +0000 Received: from VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::206) by AM6PR08CA0025.outlook.office365.com (2603:10a6:20b:c0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.22 via Frontend Transport; Mon, 18 Nov 2019 09:33:09 +0000 Authentication-Results: spf=fail (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=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 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 VE1EUR03FT047.mail.protection.outlook.com (10.152.19.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.23 via Frontend Transport; Mon, 18 Nov 2019 09:33:08 +0000 Received: ("Tessian outbound 927f2cdd66cc:v33"); Mon, 18 Nov 2019 09:33:06 +0000 X-CR-MTA-TID: 64aa7808 Received: from d3a50f56828a.3 (cr-mta-lb-1.cr-mta-net [104.47.13.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 83D87EAE-9D39-480A-88C5-3E861000C772.1; Mon, 18 Nov 2019 09:33:01 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04lp2052.outbound.protection.outlook.com [104.47.13.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d3a50f56828a.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Nov 2019 09:33:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qt586RDZoENiBeKTS4pvNC8w2J+G/TQ+2mjdkYsSYk61TFHxZ3qOsu+zfYqNMH0VueazgGI/rlNAxz8VDljWhO19Osr6yc3IXou0FpROKrSgixBDNb38lF6L27MG9v8OHulqsM5CRFOGznyDc9NKr9gTrb/DutgqoOR2a4IVRkJGJXW51s0F91OhEN/XDUA6itX7MfXSmRx9QCuMZuCz6+LW6TtNFxoibRlKThnL1mwIJP5ZqaJy2kREjlLy3o1k5r1qO3u4cMG2pEGDtFT5ZUQ3TSkDl8yn+U0XvJ8FKEqfp5kxX9nHiXda8Jwyd7EBtBgVVhqGa+sLYefCt7NM8w== 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=ktmrk3CfVG3x8PvRwYr9Z56gy9joWHW3KFYRvqqPEKA=; b=YObVLbrAPFO5EZwCLqrmitRQF1upRf/Dbdx+PYO19zH9lAj1UnS9+iAWf1emtLUYEv+ijn4w9Sjkg7dzr2s6yTbwNHHevAHXQlIXJfWXYZBl5Bz83d89ULltNlRRIzPpPtYynNOerDdaoLbGM4S04129P4j5R+5anehwtzZ1c06CLR9NTQj92sPYv4djMjt8rY5u4SzwJMrS0sdRCD6zX9MLnblf+gSVyxAqCjFUP2k+hTimiP/zH1D978S6q0Vlaz37i7/dhoeGtuptiZQQaqy4UCfbnJkoyQAnpt1QORQwiNznEPhmJWPJmxhBVqvGBLQX0hs7aBiH76NEZ7BghQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=ktmrk3CfVG3x8PvRwYr9Z56gy9joWHW3KFYRvqqPEKA=; b=cjw/8SY9NmJA+Ad4DjFjJuH+RFV6a70hRWFAi437HqYSWkY8h7gSR2V7FP1kkldpuImXrFogKw2MhfdzRDThDcHXfjF6saX8fhK/Qb+1PcRbH5WsXJu5RFODHdal+YhssP0gX9/lS/TyMiVZR8XL3pxPyT72tiuhwVX2j2Yg5V4= Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com (10.172.228.142) by DB6PR0802MB2215.eurprd08.prod.outlook.com (10.172.228.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.27; Mon, 18 Nov 2019 09:32:59 +0000 Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::e5fd:d568:961b:8ce6]) by DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::e5fd:d568:961b:8ce6%9]) with mapi id 15.20.2451.029; Mon, 18 Nov 2019 09:32:58 +0000 From: "Sami Mujawar" To: Krzysztof Koch , "devel@edk2.groups.io" CC: "ray.ni@intel.com" , "zhichao.gao@intel.com" , Matteo Carlini , nd Subject: Re: [PATCH v2 1/1] ShellPkg: acpiview: Update SRAT parser to ACPI 6.3 Thread-Topic: [PATCH v2 1/1] ShellPkg: acpiview: Update SRAT parser to ACPI 6.3 Thread-Index: AQHVmWcPf/1ke7p1VEOXm8uPgEdVWaeQsz/w Date: Mon, 18 Nov 2019 09:32:58 +0000 Message-ID: References: <20191112143937.68588-1-krzysztof.koch@arm.com> In-Reply-To: <20191112143937.68588-1-krzysztof.koch@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: fc7504c7-f5de-4a56-b304-a97db8287382.1 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Sami.Mujawar@arm.com; x-originating-ip: [217.140.106.52] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 34134c6e-9cc6-4838-c422-08d76c0a52a4 X-MS-TrafficTypeDiagnostic: DB6PR0802MB2215:|DB6PR0802MB2215:|VE1PR08MB5056: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:8273;OLM:8273; x-forefront-prvs: 0225B0D5BC X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(13464003)(199004)(189003)(66066001)(71190400001)(53546011)(6506007)(102836004)(71200400001)(3846002)(6116002)(30864003)(5660300002)(86362001)(186003)(476003)(316002)(966005)(33656002)(305945005)(486006)(606006)(7736002)(2906002)(15974865002)(2501003)(66476007)(66556008)(64756008)(66446008)(52536014)(478600001)(66946007)(110136005)(14454004)(54906003)(11346002)(446003)(14444005)(99286004)(76116006)(15650500001)(229853002)(9686003)(6306002)(74316002)(55016002)(26005)(236005)(4326008)(25786009)(81156014)(81166006)(8676002)(7696005)(6246003)(76176011)(19627235002)(6436002)(733005)(8936002)(256004);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0802MB2215;H:DB6PR0802MB2375.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: MuKsnFAQJamW/gG56GI+dEhEkz1nAyy2OjJapDn07GY//Ec0wknCGAlVV2g9s2d9KyCWvHeo1pm7rMn5uR/gXJ7lJkDFO3D9u7rN2sRqiemItaM+HE/900oGUtE76ZxxCv+1KWyVjpbI39Pp7rd0v141S9xoVOX2Rb5Onl1f3YqR7N7LHulPI7zZF3RqNc8Ebp7gNdbxSwNLP5hjqp4vMGffXGmytsyHZicj/BJTwWEo463E3ZwuTzwDqxAVXchz5lu83f+Bua/spLFf5249OolPRG+SBu061Z3Q2laY7cOcXhXeXKrPQ1MJlNd2UTVgS4JtDzxXMUN+dM2Hjfcl4AqhshrV0yhWfReQNoAyK4UbKiIsCl5KBbB5J6oUYAuS1ninAUCUtz8TO2iBypbLL4bKQVRn/a9HmZ/xXf7rz535XNrbEW+qyt69EOTyu+Ak MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2215 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Sami.Mujawar@arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: =?us-ascii?Q?CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS?= =?us-ascii?Q?:(10009020)(4636009)(346002)(376002)(396003)(136003)(3986040?= =?us-ascii?Q?0002)(1110001)(339900001)(189003)(199004)(13464003)(30864003?= =?us-ascii?Q?)(14444005)(86362001)(733005)(446003)(7696005)(126002)(87460?= =?us-ascii?Q?02)(9686003)(2906002)(6306002)(50466002)(23726003)(74316002)?= =?us-ascii?Q?(46406003)(606006)(305945005)(7736002)(356004)(22756006)(550?= =?us-ascii?Q?16002)(66066001)(47776003)(4326008)(6116002)(97756001)(38460?= =?us-ascii?Q?02)(186003)(26005)(52536014)(81166006)(81156014)(26826003)(7?= =?us-ascii?Q?6176011)(476003)(54906003)(76130400001)(102836004)(566030000?= =?us-ascii?Q?2)(2501003)(6506007)(53546011)(110136005)(478600001)(1962723?= =?us-ascii?Q?5002)(8676002)(6246003)(316002)(11346002)(8936002)(229853002?= =?us-ascii?Q?)(105606002)(236005)(99286004)(36906005)(486006)(336012)(159?= =?us-ascii?Q?74865002)(33656002)(14454004)(15650500001)(25786009)(7058600?= =?us-ascii?Q?7)(70206006)(966005);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR08MB50?= =?us-ascii?Q?56;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:?= =?us-ascii?Q?Fail;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaw?= =?us-ascii?Q?s.com;MX:1;A:1;?= X-MS-Office365-Filtering-Correlation-Id-Prvs: a0155ee1-f1f2-4484-a0ff-08d76c0a4cc8 X-MS-Exchange-PUrlCount: 6 NoDisclaimer: True X-Forefront-PRVS: 0225B0D5BC X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YEk8gbwY5c75BbEEfwJPXUtaXHGopt8rtnzaXgJNOdSxFPMz9Xx/a6Pq+Zs46O2xcmTtmNAKjTJOZPyYDINB8/Y82SLTU4yIw3HWXCGEoxzRRSrD4y8j0FtOlAGWoMZpNktNZvtIrY+CQHdd/bivppLlp//4D7sg0mApKDLkSn1c9KRz8UczgbOvHY2SJXidw/LtTy9oJ9Iafh2nwCB0ZlFKH2oSd6S+e9eDq7gQ1hBtvR8/O+rTmQDesJZjLh/EK6zrxeDvSZ/6RXvgzATvICiVLABZ7SidyaHrtTS69riwDtp76CJo/YfspPr0fWC12lyOQDsU3Ped++nh4YKK3d5nmq5w9LMM7Www3HjBZz2aYdgD7so1NfIvgjN5P8RNA0CPC5MrNXiBdVRgnN7RI3nJ4/zdub4TbGS/kqqHj1zwwQwPhjUTYCsUN7ANBBdqhIlFamHkoVPpXT2m9jrG88OatjzIuT2Jbiwi4CLgqdM= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2019 09:33:08.6775 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34134c6e-9cc6-4838-c422-08d76c0a52a4 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: VE1PR08MB5056 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sami Mujawar Regards, Sami Mujawar -----Original Message----- From: Krzysztof Koch =20 Sent: 12 November 2019 02:40 PM To: devel@edk2.groups.io Cc: ray.ni@intel.com; zhichao.gao@intel.com; Matteo Carlini ; Sami Mujawar ; nd Subject: [PATCH v2 1/1] ShellPkg: acpiview: Update SRAT parser to ACPI 6.3 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 --- The changes can be seen at https://github.com/KrzysztofKoch1/edk2/tree/582_= acpiview_6_3_srat_v2 Notes: v2: - rebase on latest master [Krzysztof] Readme.md | = 4 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | = 33 +++ ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | = 16 + ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 3= 13 ++++++++++++++++++-- 4 files changed, 343 insertions(+), 23 deletions(-) diff --git a/Readme.md b/Readme.md index acbcca88d3c62d392e6f94b1ad7de2d8627e3a38..594f16b20756ab78987fef4feac= 2e439743d5b4a 100644 --- a/Readme.md +++ b/Readme.md @@ -17,7 +17,7 @@ for the UEFI and PI specifications from www.uefi.org. Windows VS2019 - edk2-ci + master @@ -34,7 +34,7 @@ for the UEFI and PI specifications from www.uefi.org. Ubuntu GCC - edk2-ci + master diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index a569c3c55406ab58536834e56ce9701f7edeffee..2b2ecb93cef9ee28b752e7bf2d9= 20b059dbf7d6b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -405,6 +405,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 20ca358bddfa5953bfb1d1bebaebbf3079eaba01..0dc721bd2cc59538432d4a9cab6= c21728cc77d33 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 a8aa420487bb6bf29fc38221d0b221573c64b8b3..d60476eb748e022f45d231e24c3= 2b2b53e29bbd7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.= c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPars +++ er.c @@ -5,7 +5,7 @@ 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 /** @@ -32,13 +33,52 @@ EFIAPI ValidateSratReserved ( IN UINT8* Ptr, IN VOID* Context - ) -{ - if (*(UINT32*)Ptr !=3D 1) { - IncrementErrorCount (); - Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n")= ; - } -} + ); + +/** + This function validates the Device Handle Type field in the Generic=20 +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 + ); + +/** + 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 -=20 +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 + ); =20 /** This function traces the APIC Proximity Domain field. @@ -52,14 +92,7 @@ EFIAPI DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr - ) -{ - UINT32 ProximityDomain; - - ProximityDomain =3D Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); - - Print (Format, ProximityDomain); -} + ); =20 /** An ACPI_PARSER array describing the SRAT Table. @@ -103,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=20 +Structure **/ STATIC CONST ACPI_PARSER=20 +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,=20 +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=20 +CONST ACPI_PARSER SratDeviceHandleAcpiParser[] =3D { + {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=20 +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,=20 +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. **/ @@ -152,6 +220,190 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = =3D { {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL} }; =20 +/** + This function validates the Reserved field in the SRAT table header. + + @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 +ValidateSratReserved ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + if (*(UINT32*)Ptr !=3D 1) { + IncrementErrorCount (); + Print (L"\nERROR: Reserved should be 1 for backward=20 +compatibility.\n"); + } +} + +/** + This function validates the Device Handle Type field in the Generic=20 +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 =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 -=20 +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. + + @param [in] Format Format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +STATIC +VOID +EFIAPI +DumpSratApicProximity ( + IN CONST CHAR16* Format, + IN UINT8* Ptr + ) +{ + UINT32 ProximityDomain; + + ProximityDomain =3D Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + + Print (Format, ProximityDomain); +} + /** This function parses the ACPI SRAT table. When trace is enabled this function parses the SRAT table and @@ -183,6 = +435,7 @@ ParseAcpiSrat ( UINT8* ResourcePtr; UINT32 GicCAffinityIndex; UINT32 GicITSAffinityIndex; + UINT32 GenericInitiatorAffinityIndex; UINT32 MemoryAffinityIndex; UINT32 ApicSapicAffinityIndex; UINT32 X2ApicAffinityIndex; @@ -190,6 +443,7 @@ ParseAcpiSrat ( =20 GicCAffinityIndex =3D 0; GicITSAffinityIndex =3D 0; + GenericInitiatorAffinityIndex =3D 0; MemoryAffinityIndex =3D 0; ApicSapicAffinityIndex =3D 0; X2ApicAffinityIndex =3D 0; @@ -232,7 +486,7 @@ ParseAcpiSrat ( } =20 switch (*SratRAType) { - case EFI_ACPI_6_2_GICC_AFFINITY: + case EFI_ACPI_6_3_GICC_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -249,7 +503,7 @@ ParseAcpiSrat ( ); break; =20 - case EFI_ACPI_6_2_GIC_ITS_AFFINITY: + case EFI_ACPI_6_3_GIC_ITS_AFFINITY: AsciiSPrint ( Buffer, sizeof (Buffer), @@ -266,7 +520,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), @@ -283,7 +554,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), @@ -300,7 +571,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)'