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.69]) by mx.groups.io with SMTP id smtpd.web09.1275.1639588783165602723 for ; Wed, 15 Dec 2021 09:19:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=VKbvhc7N; spf=pass (domain: arm.com, ip: 40.107.1.69, mailfrom: christopher.jones@arm.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ATTZK8/6SgE3rLlD7S69If8EKzVKCZAyST3L6ANCJsvk4+y6WgyhHXNxMwpbNCCjY0IUiscc3g3dEmMCOTwOS9Qxb7md+wJ5k9Q6qLTMgDaHeCCdbko68+d6ig2tMGpYCAqJVvDhwcrg8af7DXsoko3dcJ5LLMv2q9LW9qJpDd/UBQ3d9Zgf/ky2EHIpwjzhtedlXidpAkwvtj+0XV+CSG/8sa76kdadC/KyEveNFHsUhqtoQSNy4sw0WqEWN5Yl9HNLrr/v8KRjINN+at8NnI70JOw2WXJOazT9I2Rrqu3wXjMcx3NUkCYP8vAzc+UMyAAtfe3KKr/XX2rUEukBfA== 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=V6mivnILLf7eD8YqktiwqzZvRajIfbIQYqLPM89sl24=; b=cx40qYWgs0qrI9I13YRm19uXPduQFt+9qv5QM0N4isJU6huxemOb0lCXuw/JCsyN7bNW6VKVBYfYHGuYyGi1jOCApfyVCDaPMJ8/LdZ5kB4gQLBLzhNVAktgrkVQRsyKi06etZH2g0Rs+juTEVkpZ4GrOlB56D6Khct+z3zMmihP7Qljk36sZfdZpwaXApOn1kYufbXkOUffMEWVyzDYgli5l52ZXzSmt73jh0lq3fXy+P2nu/oAew9Lo+ZfgcUh1mpFrlKTEdwVrY/MSRA37GUa+RLRgFxebtOjUmNeo5oHQPk2iSoy3uZHHGTRWvu/yPcfeBsqFgVtEqwp9L3XCw== 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=V6mivnILLf7eD8YqktiwqzZvRajIfbIQYqLPM89sl24=; b=VKbvhc7NdRrbZjDwxD2JK9Sp1bdaN6iqjXpm7Un+RH+7NUMqwR8r4TPBwUAux+IcHcKe9cRHq8qTUBmYFqnH62dVINmeRQf9MTxlAyn9ciu4rKxnGNDjaRkdmakC4oIMEzp5riXqDPgR42T7eJZO8ogWsEl5b1iy3VNZgZfJcnM= Received: from VE1PR08MB5758.eurprd08.prod.outlook.com (2603:10a6:800:1a0::11) by VE1PR08MB5696.eurprd08.prod.outlook.com (2603:10a6:800:1ae::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 17:19:39 +0000 Received: from VE1PR08MB5758.eurprd08.prod.outlook.com ([fe80::c81e:87f6:288c:db76]) by VE1PR08MB5758.eurprd08.prod.outlook.com ([fe80::c81e:87f6:288c:db76%8]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 17:19:39 +0000 From: "Chris Jones" To: "devel@edk2.groups.io" CC: "ray.ni@intel.com" , "zhichao.gao@intel.com" , Sami Mujawar , nd Subject: [PATCH v1 4/9] ShellPkg: Add ACPI data store Thread-Topic: [PATCH v1 4/9] ShellPkg: Add ACPI data store Thread-Index: AQHX8csoJL7Oty8kg0eE36qtlcoTNg== Date: Wed, 15 Dec 2021 17:19:39 +0000 Message-ID: References: <20211215154722.4860-1-christopher.jones@arm.com> In-Reply-To: <20211215154722.4860-1-christopher.jones@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email 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; x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB5758.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(38100700002)(71200400001)(4326008)(8936002)(122000001)(66946007)(91956017)(36756003)(2616005)(8676002)(37630700001)(38070700005)(83380400001)(6486002)(64756008)(66556008)(316002)(26005)(66446008)(86362001)(76116006)(66476007)(6506007)(5660300002)(508600001)(2906002)(54906003)(6916009)(186003)(6512007);DIR:OUT;SFP:1101; x-microsoft-antispam: BCL:0; x-ms-exchange-crosstenant-originalarrivaltime: 15 Dec 2021 15:47:55.7750 (UTC) x-ms-exchange-crosstenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d x-ms-exchange-transport-crosstenantheadersstamped: AM9PR08MB7136 x-ms-exchange-crosstenant-fromentityheader: HybridOnPrem x-ms-traffictypediagnostic: PR2PR08MB4892:EE_|AM5EUR03FT050:EE_|AM9PR08MB7136:EE_|VE1PR08MB5758:EE_|VE1PR08MB5696:EE_ x-ms-exchange-crosstenant-network-message-id: deda9725-033a-4daa-517d-08d9bfe24313 x-checkrecipientchecked: true x-eopattributedmessage: 1 x-ms-office365-filtering-correlation-id: ad716673-88aa-4601-4a30-08d9bfef1387 x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:883;OLM:883;OLM:883; x-ms-exchange-crosstenant-originalattributedtenantconnectingip: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] x-cr-mta-tid: 64aa7808 x-forefront-antispam-report-untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(40470700001)(5660300002)(83380400001)(6916009)(70206006)(36756003)(26005)(336012)(508600001)(8936002)(2906002)(6666004)(70586007)(316002)(40460700001)(356005)(1076003)(4326008)(81166007)(82310400004)(54906003)(8676002)(2616005)(7696005)(86362001)(426003)(36860700001)(47076005)(30864003)(186003)(36900700001);DIR:OUT;SFP:1101; x-microsoft-antispam-untrusted: BCL:0; x-microsoft-antispam-message-info-original: EVYnwyXWgVq3XYh+FToNYIRKyEmxYXPor41voNfG+sW5ep1G0sCilUwkD3TzrQfm3klksRO+0ib/LhJMhW+Zu2+s1NH8Xb7IrTyXQYsxiLEv279QwKzSzDshnVae40jX7bIFWh005DHs6a8RiP2uWrHoylDFfZgPKkdwIyf9Vw84pr5OPlfbnfulBA66Tiz++/9TwalKNr/5B8/nsrBc8hm5SHDCHpBA6J8QcVSFugfU5elX8ru4kyA7RMQIPX/ZYMA6ZyKffbyrMk9ym92zyIMFkXFDpGsupd7uyRwcl7QFWz8ZwOPeDLQ/8r9aC1+cIAsyd5bZSl5HKfSLOsFC/1r3POB0lxHK62mz+86aqkQ/FEBFSL4INEbGevmzmTFwTdO9EDhH2m7TnD80Ot2Lg2CiZ0TmAsJei2anAs5YB4nzD+k8vizdZbK6tGZVLd7wA293SRPy4EWhSwG8de96VJz1cJdl+fOT+hg8/p0m4BeQNKnWeqku7zqebz7WK94UPWfvZn0CFH9V6IlJ16tmqO3ZhOiz4o8+CD77jwapcXlwdDzZkTvZ3+o0EorAk8xg3mPPaOuKLNHN7tY/8uEtox8K1qWEwJb9kytKyJGuyZ/div0Al1bOpJKJHqyGutagwgGKTVzUEPI4ASlI0gnZQlgGCVSXXLgu0KkREhdbbaiPr/CkF2/fQFFyKjZMcQBwX6q33mPB94KpcxFD011yKMUUy/B9uTzgL7M4mkPKgXeDvowyZu9EXyNtfZFEKbu9oIYJ1AX8QV1rWuLPb1U+Z0HWnNkprepbcB3vhm6U4l7rEVwnXO26g4vVhW7yZMJt250isR4ugkO+LVuIuYQbydBiwVHCRn5umAvl1bjw/UIZROLle0QMSCzQ+X9IPBL8 x-ms-exchange-transport-crosstenantheadersstripped: AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com x-ms-office365-filtering-correlation-id-prvs: deda9725-033a-4daa-517d-08d9bfe24313 x-ms-exchange-crosstenant-authas: Anonymous x-ms-exchange-crosstenant-authsource: AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com x-microsoft-antispam-message-info: mWoPZoQ9xn2bUEKNo+xjA6L2+d320CGXoxKd5nK6uudz5lFe72lREYaJvjMV4vOUDREK3Ntclnc8B7k9Q7v0KJcCWiX4oTFFP0I3BEGGI164f5Igj+ZvaqyjUw3eDpnns35hWhnxT+iaCZzoWjaddG14AFif1UqWEKCGUkvJUPK0Fr8lU+jt6P+qUOWR1aXWc4y0AnxIp1iWTGv5m/SCpGBJOEIbwUwlMWa2pBi1yVHzebznlOmM8ys39RdPY4U7akQSo1MMfwrSE0hzTxS2tWOixSaSzmGhrnl5fTde6LzQE/W0UnVr2jXAL7DZIvg7gSCi8+B2qSkYxqkRvQ/SBoXuJGryAVUiHBOSTe14YsBwrX0io3jN7Us9qBHfOJSBzjNQGo4vi+Eh98MRsaY5wN/6e5I1bmWUnZO6CgkXsUuemPXm2syLmZiVJaKZCKZ66XT8KW3NPvazEoi9GHN/r+fqV5sDQtkiboqL8EcDR9aNPQE6WumPJbx/WIzW92WpTnrg5JpOnw53TXuhGCWk1b0ZTp11XK/4vXVgxrPzx+YvCeo/gi+/V9CMKeLnbJ3rff5Ka0zCczBJYKnqYAD+gsZargxI/XdZ0obJA0WtsNBBXUa2CYoyiIDdrXJUvEGvMHYXTmdJSxck2LDa7rLJbmPzSckgrklf3j/ZJWmEfhATmKujf7u7wUjzA2XXeHpZ+0EPOmLCLGcsynhWT7HQgM8YDnclTjvg1J87TxFS/KOigAC5C6Jw7vXLGbuFZ76pXYRQArJk6F2BPBWX7hveeK9l/O2V4lF3PnRCTzVzgAc= x-mailer: git-send-email 2.17.1 x-cr-mta-cid: 4998860b82076288 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=i03xrXk7Gqj5ViuZ/TmahyJXZYyf6CxTu7ZeVFM2NkI=; b=X4ztegdR2aH8DOXW2hyw3aGwi0RrPMu0EXWusfoFq1SP3gIfB3/bQXtMnDAa53qOGWfQbIjXQpIm5S0g+WL9DZUjhng1S1ax+cEXVdvOkJRODT8cmZP1+5FKNzHmo97JLaBElBDAza9hF10bj7ZKU69bHymQsUGLNSkmD8e8MQE= suggested_attachment_session_id: 32e0fc0f-5379-b042-8174-b4d01b7dcca6 authentication-results: dkim=error (no key for signature) header.d=none;dmarc=none action=none header.from=arm.com; x-microsoft-antispam-prvs: nodisclaimer: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?+ei3r2/cUJUoUrcX/FdSx3QrOKg1m7/JDckNPSgzPENZCIb8xOs/RKzC66?= =?iso-8859-1?Q?Ub42L9dQxQDHS28qmusXVG7X9gdte9cDK/nsKZ3HBQt8sqcPufrK2WHTSk?= =?iso-8859-1?Q?31sKVnSjZ+eS47O7vi5JQB8bWAU/M9vsFMcTOu+pmDDPT/2FqysP0ed1Gm?= =?iso-8859-1?Q?LpifETELAH+jKmrA246CHhdRMIy+lYdFNtTlEpby7wfzz3O2lbYbdfx/sv?= =?iso-8859-1?Q?DU0FQHxk4FNWE/vqZ+zpZGZ7zivZF9k51wX5X015uwH3skqZqhiz7BntwU?= =?iso-8859-1?Q?zvgeTlIRjWPbP0gQNxn5K6itrbHf8IcRoeuy4d0nIjN1TILCUMCwJlOJGf?= =?iso-8859-1?Q?D6BdUcYmTYTU1xO9an5FvzmbYxeb/8g8+oydLJsUn7ZjmydDLcSD7BDbyV?= =?iso-8859-1?Q?wUegXzwLxhCUer5LhsT5IB5cob8SfP9WZo2DM4376+O4rPnuFnrAiKXc9w?= =?iso-8859-1?Q?p9yZ1XwRt9qgzKWMqpMHVe92dVBHvUjb1CKiBiaqkpkDcAecW2RYFAhwwY?= =?iso-8859-1?Q?qjXhdLIJqMrda34cJIcyGl1uaqSNhPZYpk4IG4rxxGeTIqnGE4KtFQNoMc?= =?iso-8859-1?Q?zYLhS8wpvP7cm1V6jn81PcYAeRHvQ2+Zpm2V8afKHAxILfNbD+UUgBMYWM?= =?iso-8859-1?Q?U4o5WRl/K0YODDWUCfNmCdB22SzVhL9j1lRiZFkq74UX35BtrbEeDEvcLs?= =?iso-8859-1?Q?jTUlLV1JQwJwAl/YqeiEDrpy13fQytmdRQbJiNIGP18ZdcxltOiEeA3R7H?= =?iso-8859-1?Q?Ak37qUIifGu07T/wji3QX2C8x3gLLAoVCZfADeCBdecIfs/3bKTILP3YpL?= =?iso-8859-1?Q?IArSpDgxxWmS3N57wvmqJ24KnPZE2vtPUeBUE8PRtsvVERmQRNAqHaeQlE?= =?iso-8859-1?Q?Z00xhpLm7ewztsCuz/z31PVCX9RQsGOcj2mEE4fBAXH/So1+CTSh8mxybF?= =?iso-8859-1?Q?EW/xxnHHk3RVbOD2iR71gQ4XNhFUbVfuucObKnLCr2W8FfGwQfIf8fB5Ua?= =?iso-8859-1?Q?cejRvk9pegXDnBX6baSenoTwDZ1IcpkBiJH4um9jSeBOMfSXU+4G0mqZpU?= =?iso-8859-1?Q?iRFdyUsz+s9mEm4LyOO0LpqG218+/hioME/j/9IgMWX74VOlvcTXc0UxcN?= =?iso-8859-1?Q?Oxe0xWKBMDCo3KYV/x52WI/Zsyw1srAGAANPFHp6CQPINdvhyUDWdXqH52?= =?iso-8859-1?Q?QvkQ+2ebRryKcvZfg98TXwzznztBJ7AMBPDNN27VVCj+aRP+kQ/FsHaiMK?= =?iso-8859-1?Q?/oSt0nTZTUqsf5FqfjLM0aWSPDiT5MbGEllLYO3nA+rC8fbZrN+TiPaA8g?= =?iso-8859-1?Q?iQ7Exgp7TZ4tJvQNSO1jjuwEipnAUYGHpTNH5TGFJH/YarEnLK1+xbdguv?= =?iso-8859-1?Q?FNNVXlpAtAqbYZa9CsTsoF6Z/lGyvrJ50xWGopd+EjOqMrcuIY8llZ3tnN?= =?iso-8859-1?Q?bm+H/oFhIzUycChxluJjckV4e0jzZaCfPS0Sgl3eCaRg2BMZfbe5bOw8FZ?= =?iso-8859-1?Q?XZB3ejj2J+8y0O1azgiFR9MmQPSRoMH/yc+UsnGc+10hYfpdmXnwnO/jh2?= =?iso-8859-1?Q?XrS7OXjPHESeJG17QgaKe90hFX3VUyrVcioricTtC8GEBBECV+Pjsr5Mon?= =?iso-8859-1?Q?vXoDvd0KnFFzrrurU1TEMpqndewuZvBpsoC41OI7ukGjeC1I1OqU72O1QM?= =?iso-8859-1?Q?6IAKRpLqiSCBtdvLXRl7oxkeMBlpxMxht6UAeIV1Hvs7P1oPv508ttSn95?= =?iso-8859-1?Q?owvw=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB5758.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad716673-88aa-4601-4a30-08d9bfef1387 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 17:19:39.3396 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EW5jrv0dcB35g4TnD1etboWfAp3c0fWTXmMcrZLmB/LiiAN4h422ZldN0FdmwpFvqpiyyEr0xX1AD31K0BjmZxxH3Y2/nNqDsLWlSf7FEek= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5696 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: <0234E32D3DFDE54FA59A6D27695B8DCB@eurprd08.prod.outlook.com> Content-Transfer-Encoding: quoted-printable Bugzilla: 3773 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3773)=0A= =0A= Add a store for useful ACPI data that can be used in validation. This=0A= data will be collected from the parsers, stored in the data store and=0A= then can be accessed by validators once all parsing is complete.=0A= =0A= The data is stored dynamically as nodes in a linked list that is=0A= accessed by META_DATA_TYPE.=0A= =0A= Signed-off-by: Chris Jones =0A= ---=0A= ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c = | 6 +=0A= ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.i= nf | 2 +=0A= ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDataStore.c = | 179 ++++++++++++++++++++=0A= ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDataStore.h = | 101 +++++++++++=0A= 4 files changed, 288 insertions(+)=0A= =0A= diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c=0A= index d4d5d907f613589c400544533e950460eed2ce3f..a8e0342591931ea3c91e18a6c5c= dfa23073b1dcc 100644=0A= --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c=0A= +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c=0A= @@ -23,6 +23,7 @@=0A= #include "AcpiView.h"=0A= #include "AcpiViewConfig.h"=0A= #include "Validators/AcpiValidation.h"=0A= +#include "Validators/AcpiDataStore.h"=0A= =0A= STATIC UINT32 mTableCount;=0A= STATIC UINT32 mBinTableCount;=0A= @@ -218,6 +219,9 @@ AcpiView (=0A= ResetErrorCount ();=0A= ResetWarningCount ();=0A= =0A= + // Initialise the ACPI data store=0A= + InitAcpiDataStore ();=0A= +=0A= // Retrieve the user selection of ACPI table to process=0A= GetSelectedAcpiTable (&SelectedTable);=0A= =0A= @@ -294,6 +298,8 @@ AcpiView (=0A= RunValidator (ValidatorId);=0A= }=0A= =0A= + FreeAcpiDataStore ();=0A= +=0A= OriginalAttribute =3D gST->ConOut->Mode->Attribute;=0A= =0A= Print (L"\nTable Statistics:\n");=0A= diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf=0A= index 245ccc811e199ebc511a42989a2024433cbb1a84..04913451289ebaf013e8290e46b= 462a554c9d825 100644=0A= --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf=0A= +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf=0A= @@ -51,6 +51,8 @@ [Sources.common]=0A= Parsers/Xsdt/XsdtParser.c=0A= Validators/AcpiValidation.c=0A= Validators/AcpiValidation.h=0A= + Validators/AcpiDataStore.c=0A= + Validators/AcpiDataStore.h=0A= Validators/AcpiStandard/AcpiStandardValidator.c=0A= UefiShellAcpiViewCommandLib.c=0A= UefiShellAcpiViewCommandLib.uni=0A= diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDa= taStore.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDat= aStore.c=0A= new file mode 100644=0A= index 0000000000000000000000000000000000000000..3a89e814d2b2e8761cb4ea6567a= a941800dea96b=0A= --- /dev/null=0A= +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDataStore= .c=0A= @@ -0,0 +1,179 @@=0A= +/** @file=0A= + Storing and accessing ACPI data collected from parsers.=0A= +=0A= + Copyright (c) 2021, Arm Limited. All rights reserved.
=0A= + SPDX-License-Identifier: BSD-2-Clause-Patent=0A= +**/=0A= +=0A= +#include =0A= +#include =0A= +#include =0A= +#include =0A= +#include "AcpiDataStore.h"=0A= +=0A= +STATIC META_DATA_NODE mAcpiData[MetaDataMax];=0A= +=0A= +/**=0A= + Initialise the ACPI data store.=0A= +**/=0A= +VOID=0A= +EFIAPI=0A= +InitAcpiDataStore (=0A= + VOID=0A= + )=0A= +{=0A= + UINTN Index;=0A= +=0A= + for (Index =3D 0; Index < MetaDataMax; Index++) {=0A= + InitializeListHead (&mAcpiData[Index].Link);=0A= + }=0A= +}=0A= +=0A= +/**=0A= + Return the number of meta data nodes in a linked list of meta data.=0A= +=0A= + @param [in] Type META_DATA_TYPE of data to get length of.=0A= + @param [out] Length Length of the linked list.=0A= +=0A= + @retval EFI_NOT_FOUND ACPI data with the given type cannot be found.=0A= + @retval EFI_SUCCESS Successfully returned the length of the linked li= st.=0A= +**/=0A= +EFI_STATUS=0A= +EFIAPI=0A= +GetMetaDataCount (=0A= + IN META_DATA_TYPE Type,=0A= + OUT UINTN *Length=0A= + )=0A= +{=0A= + META_DATA_NODE *Node;=0A= +=0A= + *Length =3D 0;=0A= +=0A= + if (Type >=3D MetaDataMax) {=0A= + Print (L"ERROR: Meta data type is not recognised.\n");=0A= + return EFI_INVALID_PARAMETER;=0A= + }=0A= +=0A= + Node =3D (META_DATA_NODE *)GetFirstNode (&mAcpiData[Type].Link);=0A= +=0A= + while (!IsNull (&mAcpiData[Type].Link, &Node->Link)) {=0A= + (*Length)++;=0A= + Node =3D (META_DATA_NODE *)GetNextNode (&mAcpiData[Type].Link, &Node->= Link);=0A= + }=0A= +=0A= + return EFI_SUCCESS;=0A= +}=0A= +=0A= +/**=0A= + Get ACPI meta data of the given type.=0A= +=0A= + @param [in] Type META_DATA_TYPE of data to return.=0A= + @param [out] ListHead The head of a linked list of META_DATA_NODE's.= =0A= +=0A= + @retval EFI_INVALID_PARAMETER A parameter is invalid.=0A= + @retval EFI_NOT_FOUND ACPI data with the given type cannot be f= ound.=0A= + @retval EFI_SUCCESS Successfully returned the desired list of= Nodes.=0A= +**/=0A= +EFI_STATUS=0A= +EFIAPI=0A= +GetMetaDataListHead (=0A= + IN META_DATA_TYPE Type,=0A= + OUT META_DATA_NODE **ListHead=0A= + )=0A= +{=0A= + if (Type >=3D MetaDataMax) {=0A= + Print (L"ERROR: Meta data type is not recognised.\n");=0A= + return EFI_INVALID_PARAMETER;=0A= + }=0A= +=0A= + if (ListHead =3D=3D NULL) {=0A= + Print (L"ERROR: List head is NULL.\n");=0A= + return EFI_INVALID_PARAMETER;=0A= + }=0A= +=0A= + if (IsListEmpty (&mAcpiData[Type].Link)) {=0A= + *ListHead =3D NULL;=0A= + return EFI_NOT_FOUND;=0A= + }=0A= +=0A= + *ListHead =3D &mAcpiData[Type];=0A= +=0A= + return EFI_SUCCESS;=0A= +}=0A= +=0A= +/**=0A= + Store ACPI meta data as a new node in the data store.=0A= +=0A= + @param [in] ListType Type of linked list to store the data in.= =0A= + @param [in] NodeType Type to give to the node that stores the d= ata.=0A= + @param [in] Ptr Pointer to the data to store.=0A= + @param [in] Length Length of the data being stored (Ptr).=0A= +=0A= + @retval EFI_OUT_OF_RESOURCES Not enough resources to allocate the data.= =0A= + @retval EFI_SUCCESS Successfully stored the data.=0A= +**/=0A= +EFI_STATUS=0A= +EFIAPI=0A= +StoreAcpiMetaData (=0A= + IN META_DATA_TYPE ListType,=0A= + IN META_DATA_TYPE NodeType,=0A= + IN VOID *Ptr,=0A= + IN UINT8 Length=0A= + )=0A= +{=0A= + META_DATA_NODE *Node;=0A= + UINT8 *Data;=0A= +=0A= + if ((ListType >=3D MetaDataMax) || (NodeType >=3D MetaDataMax)) {=0A= + Print (L"ERROR: Meta data type is not recognised.\n");=0A= + return EFI_INVALID_PARAMETER;=0A= + }=0A= +=0A= + Node =3D AllocateZeroPool (sizeof (META_DATA_NODE));=0A= + if (Node =3D=3D NULL) {=0A= + Print (L"ERROR: Failed to allocate resources for new node.\n");=0A= + return EFI_OUT_OF_RESOURCES;=0A= + }=0A= +=0A= + // Allocate and assign memory for the data to be stored.=0A= + Data =3D AllocateCopyPool (Length, Ptr);=0A= + if (Data =3D=3D NULL) {=0A= + FreePool (Node);=0A= + Print (L"ERROR: Failed to allocate resources for node data.\n");=0A= + return EFI_OUT_OF_RESOURCES;=0A= + }=0A= +=0A= + // Assign fields.=0A= + Node->Type =3D NodeType;=0A= + Node->Data =3D Data;=0A= + Node->Length =3D Length;=0A= +=0A= + InsertTailList (&mAcpiData[ListType].Link, &Node->Link);=0A= +=0A= + return EFI_SUCCESS;=0A= +}=0A= +=0A= +/**=0A= + Free all ACPI data currently stored in the data store.=0A= +**/=0A= +VOID=0A= +EFIAPI=0A= +FreeAcpiDataStore (=0A= + VOID=0A= + )=0A= +{=0A= + UINTN Index;=0A= + META_DATA_NODE *Node;=0A= + META_DATA_NODE *TmpNode;=0A= +=0A= + for (Index =3D 0; Index < MetaDataMax; Index++) {=0A= + Node =3D (META_DATA_NODE *)GetFirstNode (&mAcpiData[Index].Link);=0A= +=0A= + while (!IsNull (&mAcpiData[Index].Link, &Node->Link)) {=0A= + TmpNode =3D Node;=0A= + Node =3D (META_DATA_NODE *)RemoveEntryList (&TmpNode->Link);=0A= + FreePool (TmpNode->Data);=0A= + FreePool (TmpNode);=0A= + }=0A= + }=0A= +}=0A= diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDa= taStore.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDat= aStore.h=0A= new file mode 100644=0A= index 0000000000000000000000000000000000000000..dfe45665372bae2516860d6c4e8= d360ba88f906c=0A= --- /dev/null=0A= +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Validators/AcpiDataStore= .h=0A= @@ -0,0 +1,101 @@=0A= +/** @file=0A= + Header file for storing and accessing ACPI data from parsers.=0A= +=0A= + Copyright (c) 2021, Arm Limited. All rights reserved.
=0A= + SPDX-License-Identifier: BSD-2-Clause-Patent=0A= +**/=0A= +=0A= +#ifndef ACPI_DATA_STORE_H_=0A= +#define ACPI_DATA_STORE_H_=0A= +=0A= +/**=0A= + Types of data that can be stored and accessed in the ACPI data store.=0A= +**/=0A= +typedef enum MetaDataType {=0A= + MetaDataPpttProcs =3D 0, ///< List of all PPTT processor structures.= =0A= + MetaDataMadtGicC =3D 1, ///< List of all MADT GICC structures.=0A= + MetaDataMax=0A= +} META_DATA_TYPE;=0A= +=0A= +/**=0A= + A node containing data about an ACPI table.=0A= +**/=0A= +typedef struct MetaDataNode {=0A= + LIST_ENTRY Link; ///< Linked list entry.=0A= + META_DATA_TYPE Type; ///< Type of meta data.=0A= + UINT8 Length; ///< Length of meta data.=0A= + VOID *Data; ///< Pointer to the meta data.=0A= +} META_DATA_NODE;=0A= +=0A= +/**=0A= + Initialise the ACPI data store.=0A= +**/=0A= +VOID=0A= +EFIAPI=0A= +InitAcpiDataStore (=0A= + VOID=0A= + );=0A= +=0A= +/**=0A= + Return the number of meta data nodes in a linked list of meta data.=0A= +=0A= + @param [in] Type META_DATA_TYPE of data to get length of.=0A= + @param [out] Length Length of the linked list.=0A= +=0A= + @retval EFI_NOT_FOUND ACPI data with the given type cannot be found.=0A= + @retval EFI_SUCCESS Successfully returned the length of the linked li= st.=0A= +**/=0A= +EFI_STATUS=0A= +EFIAPI=0A= +GetMetaDataCount (=0A= + IN META_DATA_TYPE Type,=0A= + OUT UINTN *Length=0A= + );=0A= +=0A= +/**=0A= + Get ACPI meta data of the given type.=0A= +=0A= + @param [in] Type META_DATA_TYPE of data to return.=0A= + @param [out] ListHead The head of a linked list of META_DATA_NODE's.= =0A= +=0A= + @retval EFI_INVALID_PARAMETER A parameter is invalid.=0A= + @retval EFI_NOT_FOUND ACPI data with the given type cannot be f= ound.=0A= + @retval EFI_SUCCESS Successfully returned the desired list of= Nodes.=0A= +**/=0A= +EFI_STATUS=0A= +EFIAPI=0A= +GetMetaDataListHead (=0A= + IN META_DATA_TYPE Type,=0A= + OUT META_DATA_NODE **ListHead=0A= + );=0A= +=0A= +/**=0A= + Store ACPI meta data as a new node in the data store.=0A= +=0A= + @param [in] ListType Type of linked list to store the data in.= =0A= + @param [in] NodeType Type to give to the node that stores the d= ata.=0A= + @param [in] Ptr Pointer to the data to store.=0A= + @param [in] Length Length of the data being stored (Ptr).=0A= +=0A= + @retval EFI_OUT_OF_RESOURCES Not enough resources to allocate the data.= =0A= + @retval EFI_SUCCESS Successfully stored the data.=0A= +**/=0A= +EFI_STATUS=0A= +EFIAPI=0A= +StoreAcpiMetaData (=0A= + IN META_DATA_TYPE ListType,=0A= + IN META_DATA_TYPE NodeType,=0A= + IN VOID *Ptr,=0A= + IN UINT8 Length=0A= + );=0A= +=0A= +/**=0A= + Free all ACPI data currently stored in the data store.=0A= +**/=0A= +VOID=0A= +EFIAPI=0A= +FreeAcpiDataStore (=0A= + VOID=0A= + );=0A= +=0A= +#endif=0A= -- =0A= Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")=0A= =0A=