From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web08.35981.1658196002684283310 for ; Mon, 18 Jul 2022 19:00:02 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=C6on+/Uo; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: zhichao.gao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658196002; x=1689732002; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=NGWAFtuVtykad4ZpcnhZE/o8whdSnvE622tEyQb7qIQ=; b=C6on+/UoKdQUidUE0t2yTaPxC+LOW3O2THcTmKricVoYUFlTyjYun1YC sloKS00Mlmxw74MBazuaCOwMoglPZo9Sju8OV/O11Y8mf9SIymLY5RBZF Vfy85yhPuM76lhTkaBugaYiVZXUUpsZSzLhSQy8GuRqSoijbObDJ8kfxW EfP368Gfrm7rgkHa8quyuEi369Bt0HuaHDDsSFDvDTwmyO36tjnw0U9no U/ffO6+zVXCJnLXhuiglvi0SJfEdIPHSOTvgT7/lfRks5neuC8wBTUL7O nBx+gj+eVe0OhMcXdfbE8zsT0DwxfsZ9YKKegh4OTOZqebDbEIMaLCExc g==; X-IronPort-AV: E=McAfee;i="6400,9594,10412"; a="312049048" X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="312049048" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 19:00:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="594662519" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga007.jf.intel.com with ESMTP; 18 Jul 2022 19:00:01 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 18 Jul 2022 19:00:00 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Jul 2022 18:59:59 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 18 Jul 2022 18:59:59 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 18 Jul 2022 18:59:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ib13QzHlJC5oSqRm6IYvwtcS2l9CN+gfm0eKB7V14Bk4cUe0drU7sEIutx+X5MczY30/4GW9DajnRJoCRdPfhyGne6GSJp4HLGdxMKHcRjLs7WjUacmTSL/DUw0ugiRlOIRxEYF0OyvrNrY4S5CLia1jwnCsW5qcTlopzCvkuGF2e7M7iK0RqslpBoOu5/LzopnzyVvV80FmPE9DCW/AM/2bJ2UVyKH5JOL6tvrGJVHPx9ZZNhj24NWseFkd99fy1kOhbhFqkzsbwDUiAAYCa145GTHGjNi4LuYs2wzFTUsUyeX1dgt6AmK7bpluNyzG+ztV53vvaDtMK1JW/1eK6A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TQVhXzpe/xBlo29U8F0aCM11skM8SO/e0JSmcvi/d7g=; b=Ch08Tqf32TE0jRpJXwqji0CgUbLA074aPW7yZWTLJqLbX5QEF4x7sX61MpUaY0tzSR6iTqOl7AhgyKCtyw1Gxw8YoMqWJIGcc4wOtnKtD92AbNIpefHQetrEasst23qEtJOScez9SJl71EBPTHToBZKAeRq/yXokZb6huXvLDsoxUduVqLVFMx0iY0n8bqvD8LtlROoxAbPfHZaqBiqH6JkXe6N3YUZ21FAIEqToTC6+NNfkeG0VEQVKEktVaemxpHSFuFiOmoxBTjEsHYq2thI7yeMcVZXmjLsWxmObSVnY+JyYG6dKgtFPmSdi/JdYHlf+6wgZAtZxBBbBx3mdVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH7PR11MB6377.namprd11.prod.outlook.com (2603:10b6:510:1fb::13) by CY5PR11MB6138.namprd11.prod.outlook.com (2603:10b6:930:2a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.23; Tue, 19 Jul 2022 01:59:57 +0000 Received: from PH7PR11MB6377.namprd11.prod.outlook.com ([fe80::e1e3:11d:934b:47a7]) by PH7PR11MB6377.namprd11.prod.outlook.com ([fe80::e1e3:11d:934b:47a7%6]) with mapi id 15.20.5438.023; Tue, 19 Jul 2022 01:59:57 +0000 From: "Gao, Zhichao" To: "devel@edk2.groups.io" , "sami.mujawar@arm.com" CC: "Alexei.Fedorov@arm.com" , "pierre.gondois@arm.com" , "steven.price@arm.com" , "Lorenzo.Pieralisi@arm.com" , "Matteo.Carlini@arm.com" , "Akanksha.Jain2@arm.com" , "Ben.Adderson@arm.com" , "Ni, Ray" , "nd@arm.com" Subject: Re: [edk2-devel] [PATCH v6 6/8] ShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec Thread-Topic: [edk2-devel] [PATCH v6 6/8] ShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec Thread-Index: AQHYl6H5jokxSTyqaU6n0pPfFucsXK2E9cZA Date: Tue, 19 Jul 2022 01:59:57 +0000 Message-ID: References: <20220714165031.42640-1-sami.mujawar@arm.com> <20220714165031.42640-7-sami.mujawar@arm.com> In-Reply-To: <20220714165031.42640-7-sami.mujawar@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 53c23acd-4372-4204-3b96-08da692a618d x-ms-traffictypediagnostic: CY5PR11MB6138:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 03NV4MaMOBu2w8WGHXIQqs1NUZ+jeT19k6AHrth3rUUCCaDMRn3okJNo6MGwg0MwZoFBFbQo9k7/1o6BNE0dL10c6w+26jnCyLJm7SRj7HGj5BFXyc3bTpi+RE2eu9FufGX1fYmITjvkmQDFIfxjJ2452Cop6NufxJh8tcin+6cZNtjMsuwlJPjW8Cj3MWThFlIlkx0bzeYiYw+PkjQgiNMe4ZvZeVG6d2T/6l6BFTTJ/yYFg/HNkcBtd11xggqZCf2P4168wotOik2wDPbnytwx46VOjVNW178NKSWxbyq8t/na9evClgtZtEpDVFkw3jtszYB2KwyQ6vk35g1OtmDvaEBq832w1g0ipzcu60foQ7Q6MV9WGIDLEm3mLkOU1NwtSiAuCs8AqlvY5Pn/7I3+lxnn0+pn8Zc+djICP3LPlW4mBv2uqQUk6ncRgz9N4ZGKRYs4zG0uYzSjY8R9D8Lh7dFm7rat9FX/3PG2MFz2SQ4ntyq+umq6DfvaOJrWT10rCxcxiXx62IEJq4ItaJIGcfuvllKYA0yr0UVBgvMGGMDS4BlOadFZEb37f1rFJrgI/K5pt7bDyZGgd7b7KADHE4EO9z2G+d6xYmXSCUif6ks02ZzD1vcUPprl+XqMlDBPZc/u0+b/l8tLnlST8m+C8lACAV2olIz/w8itV2gL8ELCHtrNKGy0DcsaH771ElzsInlBb+O8u+5d5jX/EUmJjYOyx7uBWGFeKmIsi4Q0luq6zJz7WVV7xvtqiKuNnZNdutBjN0sgwH+Y+cwyxSCtdcR0zqlKrIaIPEpQhf8fxRCKqhmjAfdFntvsU5CZptvyPW/EkmCwpk6T+n3yzHUEHbGnAVocY/qt0C8Ot0Wx5k5PmTu6NE+paS8zDLhc x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB6377.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39860400002)(346002)(366004)(376002)(396003)(136003)(86362001)(38100700002)(82960400001)(38070700005)(33656002)(9686003)(26005)(478600001)(110136005)(186003)(41300700001)(71200400001)(6506007)(53546011)(966005)(7696005)(30864003)(66556008)(8676002)(76116006)(66476007)(7416002)(64756008)(66946007)(8936002)(5660300002)(54906003)(4326008)(316002)(52536014)(122000001)(83380400001)(66446008)(2906002)(15650500001)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tp/pTCPVwoONMcFrPLbSSXcz2ynMtW9Eyd725tXOwp0k1tmKA9IEYrGJ81a7?= =?us-ascii?Q?QQDd6QB6U+H4hKR1ez1NAKOlCNUU/HviTL5t2pQx2tq2D7QwLCkCogMte/br?= =?us-ascii?Q?ZtxfMyEIvXJog898/O2gl26OEmo/4SdtkmKM5O/n5d/SCILownJ4pAciXfbV?= =?us-ascii?Q?IBt19Va2sc5Un2VvMdp9PSBNA/XbQQ+C605+RCKWkiJ6+9oSymHY5Tq0+SLN?= =?us-ascii?Q?CjuJao2+aTBlW+OW6eNPSd5BErozKlNsP96zCIZjLw5KWsPiPWS20FFy4a0b?= =?us-ascii?Q?QUfLD7JfW3H9VEauCtqXjGrJ6YQ0WlOFMRUcoD7tr7CX55fTVoaV6irx0mZb?= =?us-ascii?Q?58mHNgCcMjNzT1RWwo4rclK7sZbCm4Rf+tRJnX/GUHczafLe1PsVLqkh9N5T?= =?us-ascii?Q?lMK1sG4hYZDVeg9fsu9HX54VN78ncKB3lzbGEZplIkO8iTybaPn5nXGRq3KP?= =?us-ascii?Q?sFlDm80OLI8wN+VezuhVI9Pqnm4HCBaaspq6/Ba8xZ0spTC5wZ12N2VSfNj7?= =?us-ascii?Q?dMIaLwKzbxmrJa8Q0xScqiUV0ycgcs+2ldr2VtBftsxDmraZCvC1221Rvd51?= =?us-ascii?Q?Q1EZx2YLxiPjQnOyqk0fJgg3jdNCjpLpfDOnvVxaUcD35NRZT+gCKhvICqcp?= =?us-ascii?Q?lroDnMQ7859x71K3VeF/gMG88uqQqshVlEck1BRJRL+6jZjdQWKZjP35StSa?= =?us-ascii?Q?XfGpuiKPlLBCk3APsWgf8RJCYstjvvckQiC1fwYn8ZKn5i4AMbQ6OTDbr4Q3?= =?us-ascii?Q?LeDiROFdaEb3yyD510ezOV9zBWRsJGUjOLFxEsxlvi6WMZkxcYETdDyNcmti?= =?us-ascii?Q?WikL7N9DfQwlYSvmmozOtYtzLQX+rE0/1BLDEKLXAmoJLhe/TGzNpeOxOVdF?= =?us-ascii?Q?3FPdR0w8P2zNilEK6ZbcPVi82733WkPxuQwjHy3Ugymdl9bdnQLhJTEztuHA?= =?us-ascii?Q?2KYN7oQE2haMS0Puxd2pPOBqb89gfoxowJ6/jR6CrBwcEisews2Hpb7xd/Lv?= =?us-ascii?Q?Ql3OfPIWQdBknK95Fu5YvUKozGVJVuDwAo6r4CbOidZzA37m0h7v2CKPOyp/?= =?us-ascii?Q?1NKvCz8dum5q4dD9Hbow0Rj1QZjSpEtI5yVXEnARF25UCv6qvkZfKOOTWWAc?= =?us-ascii?Q?/VDU2C3JI15KfkdtERAte6N0nOks/iBLe15y9y/QFCPlIiGtpIF7wYGHtB2n?= =?us-ascii?Q?mLnP0xSXLe5vHaQZ/hljTKIQJxTTI/KiOV23d7RgvcXUYlagQ+19CXMpw1CC?= =?us-ascii?Q?pq6GKQzQz7IFe1Fyjv52kceLWFsnrjl/jf5vCpSZ5IsmG4mx8tPigNbGPZ56?= =?us-ascii?Q?xj0v4uCClOIbkykbos89Ic8c8cJSF9JmMRnbIzSjPgy/DPWloyfT1QFLNOec?= =?us-ascii?Q?MoiLHVupzmAY40/zqRRX55wvHnaQtQWkN6h4DY2gNzQ08aM1YnCofLx2CHG+?= =?us-ascii?Q?fzKcXrPZLhA5dDFhDLObmt7+u0o/5Xv3UM5D63HMAYD8CFLJHLHZioHpeRfH?= =?us-ascii?Q?hMlzH1YCCUTdNvjGr1OfrcT4pHm/GG6i7kEFMVMt5DadivSH7n3vM6tEGgLY?= =?us-ascii?Q?GLYz+6Y0MWqCEgKL5Y6XvLsWXKFCdzqIW5pP8Xk+?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6377.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53c23acd-4372-4204-3b96-08da692a618d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2022 01:59:57.2222 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: p2cfDVtDKVj4tjVYwRYDj/pJdf1Nl4BdZ5jMBGb3hLIRxX9TG/J+yb10vaJ0myhlyI0zqGTelqlctLVGt/jYNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6138 Return-Path: zhichao.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zhichao Gao Thanks, Zhichao > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Sami > Mujawar > Sent: Friday, July 15, 2022 12:50 AM > To: devel@edk2.groups.io > Cc: Sami Mujawar ; Alexei.Fedorov@arm.com; > pierre.gondois@arm.com; steven.price@arm.com; > Lorenzo.Pieralisi@arm.com; Matteo.Carlini@arm.com; > Akanksha.Jain2@arm.com; Ben.Adderson@arm.com; Ni, Ray > ; Gao, Zhichao ; nd@arm.com > Subject: [edk2-devel] [PATCH v6 6/8] ShellPkg: Acpiview: IORT parser upda= te > for IORT Rev E.d spec >=20 > Bugzilla: 3458 - Add support IORT Rev E.d specification updates > (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3458) >=20 > The IO Remapping Table, Platform Design Document, Revision E.d, Feb 2022 > (https://developer.arm.com/documentation/den0049/) > introduces the following updates, collectively including the updates and > errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c: > - increments the IORT table revision to 5. > - updates the node definition to add an 'Identifier' field. > - adds definition of node type 6 - Reserved Memory Range node. > - adds definition for Memory Range Descriptors. > - adds flag to indicate PRI support for root complexes. > - adds flag to indicate if the root complex supports forwarding > of PASID information on translated transactions to the SMMU. > - adds flag to indicate if the root complex supports PASID. > - adds flags to define access privilege and attributes for the > memory ranges. >=20 > Therefore, update the IORT parser to: > - parse the Identifier field. > - parse Reserved Memory Range node. > - parse Memory Range Descriptors. > - add validations to check that the physical range base > and size of the Memory Range Descriptor is 64KB aligned. > - add validation to check that the IORT Table Revision is > not 4 as IORT Rev E.c is deprecated. > - add validation to check that the IORT RMR node revision > is not 2 as it breaks backward compatibility and was > deprecated as part of IORT Rev E.c. > - skip parsing of IORT Rev E, Rev E.a, Rev E.b, Rev E.c as > some fields were deprecated in these revisions. >=20 > Signed-off-by: Sami Mujawar > --- >=20 > Notes: > v6: > - Make output format for Flags filed consistent. [PIERRE] > - Define macro for IORT Rev E.c and RMR Node revision 2 [PIERRE] > and use these to check for deprecated table/node > revisions. > - Identifier field size changed between IORT revision E [PIERRE] > and E.a. so extra checks should be needed. > - Added check to skip parsing if IORT Rev E, E. [SAMI] > as various fields were deprecated between revisions. >=20 > v5: > - No code change since v4. Included r-b received for [SAMI] > v5 series. >=20 > v4: > - Add validation to check that the IORT Table Revision is [SAMI] > not 4 as IORT Rev E.c is deprecated. > - Add validation to check that the IORT RMR node revision [SAMI] > is not 2 as it breaks backward compatibility and was > deprecated as part of IORT Rev E.c. >=20 > v3: > - No code change since v1. Included r-b received for [SAMI] > v2 series. > Ref: https://edk2.groups.io/g/devel/topic/83600720#7665 >=20 > v2: > - No code change since v1. Re-sending with v2 series. [SAMI] >=20 > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | > 230 ++++++++++++++++++-- > 1 file changed, 212 insertions(+), 18 deletions(-) >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c > index > 44d633c5282463078a4cc990bb24ca1992f95634..599cf0ee8f7e4c7ed398fa6046 > 02604d1955d2e6 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPars > +++ er.c > @@ -1,14 +1,16 @@ > /** @file > IORT table parser >=20 > - Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. > + Copyright (c) 2016 - 2022, Arm Limited. All rights reserved. > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @par Reference(s): > - - IO Remapping Table, Platform Design Document, Revision D, March 2018 > + - IO Remapping Table, Platform Design Document, Revision E.d, Feb 20= 22 > + (https://developer.arm.com/documentation/den0049/) >=20 > @par Glossary: > - Ref - Reference > + - Desc - Descriptor > **/ >=20 > #include > @@ -26,6 +28,7 @@ STATIC CONST UINT32 *IortNodeOffset; >=20 > STATIC CONST UINT8 *IortNodeType; > STATIC CONST UINT16 *IortNodeLength; > +STATIC CONST UINT8 *IortNodeRevision; > STATIC CONST UINT32 *IortIdMappingCount; STATIC CONST UINT32 > *IortIdMappingOffset; >=20 > @@ -36,6 +39,9 @@ STATIC CONST UINT32 *PmuInterruptOffset; >=20 > STATIC CONST UINT32 *ItsCount; >=20 > +STATIC CONST UINT32 *RmrMemDescCount; > +STATIC CONST UINT32 *RmrMemDescOffset; > + > /** > This function validates the ID Mapping array count for the ITS node. >=20 > @@ -100,6 +106,52 @@ ValidateItsIdArrayReference ( > } > } >=20 > +/** > + This function validates that the Physical Range address or length is > +not zero > + and is 64K aligned. > + > + @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 > +ValidatePhysicalRange ( > + IN UINT8 *Ptr, > + IN VOID *Context > + ) > +{ > + UINT64 Value; > + > + Value =3D *(UINT64 *)Ptr; > + if ((Value =3D=3D 0) || ((Value & (SIZE_64KB - 1)) !=3D 0)) { > + IncrementErrorCount (); > + Print (L"\nERROR: Physical Range must be 64K aligned and cannot be > +zero."); > + } > +} > + > +/** > + This function validates that the RMR memory range descriptor count. > + > + @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 > +ValidateRmrMemDescCount ( > + IN UINT8 *Ptr, > + IN VOID *Context > + ) > +{ > + if (*(UINT32 *)Ptr =3D=3D 0) { > + IncrementErrorCount (); > + Print (L"\nERROR: Memory Range Descriptor count must be >=3D1."); > + } > +} > + > /** > Helper Macro for populating the IORT Node header in the ACPI_PARSER > array. >=20 > @@ -108,15 +160,15 @@ ValidateItsIdArrayReference ( > @param [out] ValidateIdArrayReference Optional pointer to a function = for > validating the ID Array referen= ce. > **/ > -#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, = \ > - ValidateIdArrayReference) = \ > - { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, = \ > - { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL },= \ > - { L"Revision", 1, 3, L"%d", NULL, NULL, NULL, NULL }, = \ > - { L"Reserved", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, = \ > - { L"Number of ID mappings", 4, 8, L"%d", NULL, = \ > - (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, = \ > - { L"Reference to ID Array", 4, 12, L"0x%x", NULL, = \ > +#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, > \ > + ValidateIdArrayReference) = \ > + { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, = \ > + { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, > \ > + { L"Revision", 1, 3, L"%d", NULL, (VOID**)&IortNodeRevision, NULL, NUL= L }, > \ > + { L"Identifier", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, = \ > + { L"Number of ID mappings", 4, 8, L"%d", NULL, = \ > + (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, > \ > + { L"Reference to ID Array", 4, 12, L"0x%x", NULL, = \ > (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL } >=20 > /** > @@ -235,11 +287,13 @@ STATIC CONST ACPI_PARSER > IortNodeNamedComponentParser[] =3D { **/ STATIC CONST ACPI_PARSER > IortNodeRootComplexParser[] =3D { > PARSE_IORT_NODE_HEADER (NULL, NULL), > - { L"Memory access properties",8, 16, L"0x%lx", NULL, NULL= , NULL, > NULL }, > - { L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL= , NULL, NULL }, > - { L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL= , NULL, > NULL }, > - { L"Memory access size limit",1, 32, L"0x%x", NULL, NULL= , NULL, > NULL }, > - { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL= , NULL, > NULL } > + { L"Memory access properties",8, 16, L"0x%lx", NULL, NULL, NULL, N= ULL }, > + { L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, N= ULL }, > + { L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, N= ULL }, > + { L"Memory access size limit",1, 32, L"0x%x", NULL, NULL, NULL, N= ULL }, > + { L"PASID capabilities", 2, 33, L"0x%x", NULL, NULL, NULL, N= ULL }, > + { L"Reserved", 1, 35, L"%x", NULL, NULL, NULL, N= ULL }, > + { L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, N= ULL }, > }; >=20 > /** > @@ -253,6 +307,29 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] > =3D { > { L"Page 1 Base Address", 8, 32, L"0x%lx= ", NULL, NULL, NULL, > NULL } > }; >=20 > +/** > + An ACPI_PARSER array describing the IORT RMR node. > +**/ > +STATIC CONST ACPI_PARSER IortNodeRmrParser[] =3D { > + PARSE_IORT_NODE_HEADER (NULL, NULL), > + { L"Flags", 4, 16, L"0x%x", NU= LL, NULL, NULL, NULL }, > + { L"Memory Range Desc count", 4, 20, L"%d", NU= LL, > + (VOID **)&RmrMemDescCount, ValidateRmrMemDescCount,NULL }, > + { L"Memory Range Desc Ref", 4, 24, L"0x%x", NU= LL, > + (VOID **)&RmrMemDescOffset, NULL, NULL } > +}; > + > +/** > + An ACPI_PARSER array describing the IORT RMR Memory Range Descriptor. > +**/ > +STATIC CONST ACPI_PARSER IortNodeRmrMemRangeDescParser[] =3D { > + { L"Physical Range offset", 8, 0, L"0x%lx", NULL, NULL, > ValidatePhysicalRange, > + NULL }, > + { L"Physical Range length", 8, 8, L"0x%lx", NULL, NULL, > ValidatePhysicalRange, > + NULL }, > + { L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, = NULL} > +}; > + > /** > This function parses the IORT Node Id Mapping array. >=20 > @@ -607,9 +684,102 @@ DumpIortNodePmcg ( > ); > } >=20 > +/** > + This function parses the IORT RMR Node Memory Range Descriptor array. > + > + @param [in] Ptr Pointer to the start of the Memory Range Descr= iptor > + array. > + @param [in] Length Length of the buffer. > + @param [in] DescCount Memory Range Descriptor count. > +**/ > +STATIC > +VOID > +DumpIortNodeRmrMemRangeDesc ( > + IN UINT8 *Ptr, > + IN UINT32 Length, > + IN UINT32 DescCount > + ) > +{ > + UINT32 Index; > + UINT32 Offset; > + CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi > + > + Index =3D 0; > + Offset =3D 0; > + > + while ((Index < DescCount) && > + (Offset < Length)) > + { > + AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "Mem range Descriptor [%d]", > + Index > + ); > + Offset +=3D ParseAcpi ( > + TRUE, > + 4, > + Buffer, > + Ptr + Offset, > + Length - Offset, > + PARSER_PARAMS (IortNodeRmrMemRangeDescParser) > + ); > + Index++; > + } > +} > + > +/** > + This function parses the IORT RMR node. > + > + @param [in] Ptr Pointer to the start of the buffer. > + @param [in] Length Length of the buffer. > + @param [in] MappingCount The ID Mapping count. > + @param [in] MappingOffset The offset of the ID Mapping array > + from the start of the IORT table. > +**/ > +STATIC > +VOID > +DumpIortNodeRmr ( > + IN UINT8 *Ptr, > + IN UINT16 Length, > + IN UINT32 MappingCount, > + IN UINT32 MappingOffset > + ) > +{ > + ParseAcpi ( > + TRUE, > + 2, > + "RMR Node", > + Ptr, > + Length, > + PARSER_PARAMS (IortNodeRmrParser) > + ); > + > + if (*IortNodeRevision =3D=3D EFI_ACPI_IORT_RMR_NODE_REVISION_02) { > + IncrementErrorCount (); > + Print ( > + L"ERROR: RMR node Rev 2 (defined in IORT Rev E.c) must not be used= ." > + L" IORT tabe Revision E.c is deprecated and must not be used.\n" > + ); > + } > + > + DumpIortNodeIdMappings ( > + Ptr + MappingOffset, > + Length - MappingOffset, > + MappingCount > + ); > + > + DumpIortNodeRmrMemRangeDesc ( > + Ptr + (*RmrMemDescOffset), > + Length - (*RmrMemDescOffset), > + *RmrMemDescCount > + ); > +} > + > /** > This function parses the ACPI IORT table. > - When trace is enabled this function parses the IORT table and traces t= he > ACPI fields. > + When trace is enabled this function parses the IORT table and traces > + the ACPI fields. >=20 > This function also parses the following nodes: > - ITS Group > @@ -618,6 +788,7 @@ DumpIortNodePmcg ( > - SMMUv1/2 > - SMMUv3 > - PMCG > + - RMR >=20 > This function also performs validation of the ACPI table fields. >=20 > @@ -643,6 +814,22 @@ ParseAcpiIort ( > return; > } >=20 > + if ((AcpiTableRevision > EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00) > && > + (AcpiTableRevision < EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05)) > + { > + Print ( > + L"ERROR: Parsing not supported for IORT tabe Revision E, E.= .\n" > + ); > + if (AcpiTableRevision =3D=3D EFI_ACPI_IO_REMAPPING_TABLE_REVISION_04= ) > { > + IncrementErrorCount (); > + Print ( > + L"ERROR: IORT tabe Revision E.c is deprecated and must not be > used.\n" > + ); > + } > + > + return; > + } > + > ParseAcpi ( > TRUE, > 0, > @@ -765,7 +952,14 @@ ParseAcpiIort ( > *IortIdMappingOffset > ); > break; > - > + case EFI_ACPI_IORT_TYPE_RMR: > + DumpIortNodeRmr ( > + NodePtr, > + *IortNodeLength, > + *IortIdMappingCount, > + *IortIdMappingOffset > + ); > + break; > default: > IncrementErrorCount (); > Print (L"ERROR: Unsupported IORT Node type =3D %d\n", *IortNodeT= ype); > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20 >=20 >=20 >=20 >=20