From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.64]) by mx.groups.io with SMTP id smtpd.web12.1960.1666659263016193095 for ; Mon, 24 Oct 2022 17:54:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=QCv55VQq; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.100.64, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ks0A2swEizQbKfKWxaA47I1IZYLalFnLycwMC5d0VgsvoYF2JnieQ8Pl+JDGcB2UDxHJUeNm1T9yPzcF2DvsSGqgyuKU/emGmZSZscaqyLJ1W8Xzss7n1WgZbIHUvZCuQtu3A8LDMbh18pBDfOj0Gtw+euXII2y5N8V9y/WMr/Zzvd72uYeN5oXUOTjXCajjGLDX3m5Srg69kwSo21zOIFZKBqrNRxADVQoTtWoMPq+vVco7CAK1mtp0ezcMDL+qGYmaKatYCg5sEy4rkbmi7h5ECZExLE0v2uy0Pk5JzVZKVz6EsEVNON+ZSt6yapugpg/na9Z2bjqQlToRwcWxEg== 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=teMQXssjf4SN0/E9odKFE6iT2rSS/NQKViNTlQu1vgs=; b=Emz4yUrXXHoVU0/kJTTLQRnKCxDmpK/FE2TZyMrD09HA38IlxXmQxq/qKTtpi6fOYGw2eGPFBG2nAZlMOhWC5zti5GGHwAOJPJhKwcD2Im+PdIGR4Z/eDBlR1wSRQtlDudvomjNpJir59uNEyM24vnrZP3u1mD14MyqjsNZU8iqjqD03wqWAWxnZn4aLq8HygkgJj6mEL4mL0EUsbFIO4SG0TVp84NNEJgbWNPmwTgOxcY8U120CaF3eM63NHF4+A9CSAcXBRD74z49uKQ0URLp8GkNtre5lnUDJrnbdPTuPHjuP6wzDnp/TXVy2dhO9O36Wrt5ZGJ7Ea+4xlcV8wA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=teMQXssjf4SN0/E9odKFE6iT2rSS/NQKViNTlQu1vgs=; b=QCv55VQq5KLj2hDfm5un1VAlkOfiHZiAIl1Dg6clCY+IxBMJSWC+6I/Kib82JMdaTM7KqN3iBpPIjR5S4C4Ayon51/XfL8p1VpD0B0mlmf9/z23cuU30EWV39B490K+RVjaqMD1jvaKV+SUGgHg1c3LT7434QxkYc95T/iERdBw= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by CY8PR12MB7146.namprd12.prod.outlook.com (2603:10b6:930:5e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Tue, 25 Oct 2022 00:54:20 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::2eab:b851:827c:1d88]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::2eab:b851:827c:1d88%3]) with mapi id 15.20.5746.028; Tue, 25 Oct 2022 00:54:19 +0000 From: "Chang, Abner" To: Sami Mujawar , "devel@edk2.groups.io" CC: "Alexei.Fedorov@arm.com" , "pierre.gondois@arm.com" , "gmahadevan@nvidia.com" , "jbrasen@nvidia.com" , "ashishsingha@nvidia.com" , "nramirez@nvidia.com" , "wwatson@nvidia.com" , "Matteo.Carlini@arm.com" , "Akanksha.Jain2@arm.com" , "Ben.Adderson@arm.com" , "Samer.El-Haj-Mahmoud@arm.com" , "nd@arm.com" Subject: Re: [PATCH v1 2/2] DynamicTablesPkg: Add SMBIOS table dispatcher Thread-Topic: [PATCH v1 2/2] DynamicTablesPkg: Add SMBIOS table dispatcher Thread-Index: AQHY4wcT8NzxxnPK802A5hux2rCeT64eR68Q Date: Tue, 25 Oct 2022 00:54:19 +0000 Message-ID: References: <20221018153344.16876-1-sami.mujawar@arm.com> <20221018153344.16876-3-sami.mujawar@arm.com> In-Reply-To: <20221018153344.16876-3-sami.mujawar@arm.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-10-25T00:54:16Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=a61fb077-479b-480f-b21d-ab0083bb91f4; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|CY8PR12MB7146:EE_ x-ms-office365-filtering-correlation-id: c58d3da8-c4e9-4aed-e740-08dab62372ec x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: neC8dJZ3q5xDGvotD4Wwr7jJT1Q/iB8qWAEvbqusS/68ILCPuYqe9NjUtE2TP7Qn40CKRjqaR6b0oZxJs+NT1MVe1bQ8fGUU5SXz3nBtzNW7wl4GTBmQlJhkN74pjBTa3HMeQuNCMEc1jGa75WV0YkO1+o3D57iZFZw6WbpavbeMh+uPNwr2amtAZwdNi6jjbgGOnEcHk7o5WcAG0tdNuhNiVJ463jzxMyBagBIk+MdAaJSnGbtw9nXAq2oCeYa402U/MOAzqMZQSlcp0tKxWnuZxAfTcJx62cdM8QpSuoEK54goyUWTHM/vj7qgJTMrVLGYJ1LvshaiyPl1rBUNH0LDy/S5CFPSDT0CQYQddaAZfASn74Glh/J0iPuij6JqKI9JnL1LDYB9AlGGy8IfbB3sR1aavn3hl2+IGsL3Fm1ybMcFmaqiWxDh3SIx/br8qFzqMmOY7XZttjKLh/CKu2g/MvC0EvV0+C/82Qofi/TZRsZRNcrOYmLZiw5fHbIOSLRVgpM9ZJnJz30ibgLrebfi6Fgjp7wt3PP96rOaSXV+JQEpVz91uU3O3pD0WqT3M3YwYHVlCTCPRBkwjCjxIKWfO4Oz+6dhFC4TBl2b+SHHzZREKBB/QgnPzM0nGKP6jKseFy8M8n3h3cFbY1OuV63nYxrgDpO+ATy/rJLXaWDwW1NFZyivCodjhzNaxx0LhT1ZGTCjHBY3FB+FBuLAtLeY/k4Atb7+UCkaYA1ap092oeGdfX8i3nStKBupzydwZyf+xTxLycUx9V1oDuSMyA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(39860400002)(396003)(346002)(366004)(376002)(451199015)(33656002)(86362001)(122000001)(38100700002)(38070700005)(26005)(186003)(9686003)(2906002)(83380400001)(7696005)(53546011)(7416002)(5660300002)(6506007)(55016003)(30864003)(4326008)(8936002)(66946007)(316002)(478600001)(66556008)(76116006)(64756008)(110136005)(8676002)(41300700001)(71200400001)(54906003)(66476007)(52536014)(66446008)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?HTpU1hvb049e0f21fmVFc14Th2bu4MqotROq7Re9k9ERlEtJNGHIXZe3baK7?= =?us-ascii?Q?ls2audqHcBku+4LYK4AJkYZmiyv4ImdNBCO39ZY/yEirMzL4j7hFJMDGyMpS?= =?us-ascii?Q?/L4Mu9qRnJC7SIpMRmyR0RXiTGQuN72+AOA1YRR43LfyvLyAf/nqL9tX/ppr?= =?us-ascii?Q?hhSgPxN52ae2NxA8+KEWlEBjmeA6VAcBChPX/ZEBLHr19VJsTi/zwCM9DWq3?= =?us-ascii?Q?rrMAo6X1Z5//bjS8Fc5/vm6zjh51Y8ZvKqWJ+nsPRWclZoOhaHrs8tg8CXmp?= =?us-ascii?Q?mBCKaXzSIbMXe2ohxNCnnW1hvHFPJvUgsZoOUT/gsUNbWOICRzCuDu5EJWts?= =?us-ascii?Q?9xKS0whu5jRAE/Pf+vy3/kh7MIj3EmJb+SOekAupsDf87yAWmGWNHwsPr043?= =?us-ascii?Q?Z1qs4XNMpyxbEbzqBf28oPuu23v4E43GdaZKpb4PMWiKqGL+B6YtHK+dYviP?= =?us-ascii?Q?QgOww5p893WqrfFcC/2xSePbIzLTS8d24ICu2WKIoe7p7Xb45UebEsNHYERH?= =?us-ascii?Q?HxofYioZlcfyx2AAHKZQfN4YV/UkACHyqqQ1+iwLA64D2IZzL4v3+tgKF3ti?= =?us-ascii?Q?n4fspBWZ0QsujCI+fK/ZXWpil0b701QaKXc/RZDvgsUaBKsGsYKvK00er0Le?= =?us-ascii?Q?ink+GrjbaYrtyB3GC3ZEJUOpBt6F8oVcmg43mUAh43AUx9EuNxixX5bviawv?= =?us-ascii?Q?mmf0hIyVomdgpoz9MnWwaCuSd6rNbW7qorxeUJ5j5pWZGN5W3Fenl3L68cmR?= =?us-ascii?Q?5R/CB0Cx8De+YqV9QO4wAoZ85p+L/493dNetOUYDVt49MAddBzH5HS5XB4f/?= =?us-ascii?Q?wUhVUOgL9/gEZZuYB6we/j343/cafo0yEE44DvDWXxtd4MMM6fYW0VQkzfQB?= =?us-ascii?Q?gXMHVLerPVg13EH5sEFI7nBLHrMOiYj1wyzGCSVc8VtsmjicgdvdDWjGfK9D?= =?us-ascii?Q?/EJSRba7wPf4w7zCluWHF6ZwSJ7oobHXtlxoEM4LsEbXxRNKMDfdEolmy/S8?= =?us-ascii?Q?GxXeZx92+8Kj44ZG/GQQyByc+j7mFSl4S15OfQ2H1a39Jzv2pgB7OobF+ncE?= =?us-ascii?Q?otIUo5mOzcLwlJLP9+OlGBVWEJsqQxRPLVwdqPBjBnT4OrqMkKR4u6oLP5ZR?= =?us-ascii?Q?BIk4ji1y1mPk2rPFEvFL/StCGguuW60NFlOishitq9n+sRUyF52NR8Zy5wGB?= =?us-ascii?Q?4ly0S52EaoNC0YRnzjQN32eeDAhf8ogATqJ1Vlw3tzhF7VSu1ApUNxBnQ0Sm?= =?us-ascii?Q?KZPYRu1SPXR1QiTa7Z3Q6wwB5g2+paQhGjjSaoSmZ36pZjEcQ4jMZRizrz9j?= =?us-ascii?Q?M5TIyXTslHZjX9lAyYSTZj5BLFd+jK2tfxsaAiFjspwnSUTi9ncg0U/6WXbE?= =?us-ascii?Q?PogckFTPGzESKdJaWV+CQ8WyYpjFIClw5VVYRjq/yh4y9ufGsZuEhzx6E1n5?= =?us-ascii?Q?2ty/GKQPb9EcI8hHxCxy69jufmbV1Kh5Z5WcMyJfhv/NflxAt5bwI7UgUN1R?= =?us-ascii?Q?V7oWwEFr6b1HFUg9OQkXxDcIC+/LgdMb2s1V8wQyJVCZtR/RLlfOn1EtANa/?= =?us-ascii?Q?AzwH9vEoVkZct6pqcLE=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c58d3da8-c4e9-4aed-e740-08dab62372ec X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2022 00:54:19.3960 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hSx7kplbcqoIoAOWsmFDQUpf35/67og7ORZhbLJWl7rP8vWgcrhqsp/mlyaGoL0arqwCGkw1hkWCHKgYLc9ojg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7146 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] > -----Original Message----- > From: Sami Mujawar > Sent: Tuesday, October 18, 2022 11:34 PM > To: devel@edk2.groups.io > Cc: Sami Mujawar ; Alexei.Fedorov@arm.com; > pierre.gondois@arm.com; gmahadevan@nvidia.com; Chang, Abner > ; jbrasen@nvidia.com; ashishsingha@nvidia.com; > nramirez@nvidia.com; wwatson@nvidia.com; Matteo.Carlini@arm.com; > Akanksha.Jain2@arm.com; Ben.Adderson@arm.com; Samer.El-Haj- > Mahmoud@arm.com; nd@arm.com > Subject: [PATCH v1 2/2] DynamicTablesPkg: Add SMBIOS table dispatcher >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Some SMBIOS structure/table fields have dependency on other SMBIOS > structures/tables. These dependencies are established using handles > pointing to the dependent tables. >=20 > A SMBIOS table handle can be obtained by either installing a SMBIOS table= or > by allocating a handle, which requires complex management to avoid any > clashes. >=20 > Obtaining a SMBIOS handle by installation requires that the dependent tab= le > is installed before the parent SMBIOS table can be installed. > Therefore, introduce a SMBIOS table dispatcher that walks the SMBIOS > dependency list and schedules the dependent tables to be installed before > the parent table is installed. >=20 > Signed-off-by: Sami Mujawar > Cc: Alexei Fedorov > Cc: Pierre Gondois > Cc: Girish Mahadevan > Cc: Jeff Brasen > Cc: Ashish Singhal > Cc: Nick Ramirez > Cc: William Watson > Cc: Abner Chang > Cc: Samer El-Haj-Mahmoud > --- >=20 > DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManag > erDxe.inf | 4 +- >=20 > DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatch > er.c | 304 ++++++++++++++++++++ >=20 > DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatch > er.h | 133 +++++++++ > 3 files changed, 440 insertions(+), 1 deletion(-) >=20 > diff --git > a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableMan > agerDxe.inf > b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableMan > agerDxe.inf > index > ad8b3d037c169ca848b5ea84fd1086b83f37876f..b09272d883c6f4f05eb03dcdab > 3efeda92b2fbb6 100644 > --- > a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableMan > agerDxe.inf > +++ > b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableMan > age > +++ rDxe.inf > @@ -1,7 +1,7 @@ > ## @file > # Module that drives the table generation and installation process. > # > -# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved. > +# Copyright (c) 2017 - 2022, Arm Limited. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -22,6 +22,8 @@ > [Defines] >=20 > [Sources] > DynamicTableManagerDxe.c > + SmbiosTableDispatcher.c > + SmbiosTableDispatcher.h >=20 > [Packages] > MdePkg/MdePkg.dec > diff --git > a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat > cher.c > b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat > cher.c > new file mode 100644 > index > 0000000000000000000000000000000000000000..88907fecdde5e36d40ac22cd4 > 86391abbb853e38 > --- /dev/null > +++ > b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat > c > +++ her.c > @@ -0,0 +1,304 @@ > +/** @file > + Dynamic Smbios Table Dispatcher > + > + Copyright (c) 2022, Arm Limited. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > + > +#include > +#include > + > +extern > +EFI_STATUS > +EFIAPI > +BuildAndInstallSmbiosTable ( > + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST > +TableFactoryProtocol, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST > CfgMgrProtocol, > + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol= , > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo > + ); You can move above external reference to the header file. > + > +#if !defined (MDEPKG_NDEBUG) > + > +/** > + A string table describing the SMBIOS dispatcher states. > +*/ > +STATIC > +CONST CHAR8 *SmbiosTableStateTxt[] =3D { > + "StUnknown", > + "StNotPresent", > + "StPresent", > + "StDispatched" > +}; > + > +#endif You can merge above #if block with below #if !defined (MDEPKG_NDEBUG). Other looks good to me. Abner > + > +/** > + The SMBIOS dispatcher state table. > + > + The SMBIOS dispatcher state table is used to establish the dependency > + order in which the SMBIOS tables are installed. This allows the > +SMBIOS > + dispatcher to dispatch the dependent tables for installation before > +the > + parent table is installed. > + The SMBIOS_TABLE_DISPATCHER.Dependency[] field is used to establish > +the > + dependency list. > + Elements in the Dependency list are resolved by increasing index. > +However, > + all orders are equivalent as: > + - the Parent SMBIOS table will only be installed once all dependencies > + have been satisfied. > + - no cyclic dependency is allowed. > + The dependency list is terminated by SMTT_NULL. > +*/ > +STATIC > +SMBIOS_TABLE_DISPATCHER mSmBiosDispatcher[MAX_SMBIOS_TABLES] > =3D { > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BIOS_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BASEBOARD_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_ENCLOSURE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PROCESSOR_INFORMATION, > SMBIOS_TYPE_CACHE_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_MODULE_INFORMATON, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_CACHE_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_SLOTS, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_OEM_STRINGS, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_GROUP_ASSOCIATIONS, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_EVENT_LOG, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, > SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, > SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_DEVICE, > SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, > SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, > SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PORTABLE_BATTERY, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_RESET, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_HARDWARE_SECURITY, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_POWER_CONTROLS, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_VOLTAGE_PROBE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_COOLING_DEVICE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_TEMPERATURE_PROBE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MANAGEMENT_DEVICE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_CHANNEL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_IPMI_DEVICE_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_POWER_SUPPLY, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ADDITIONAL_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_ONBOARD_DEVICES_EXTENDED_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_MANAGEMENT_CONTROLLER_HOST_INTERFACE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_TPM_DEVICE, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_PROCESSOR_ADDITIONAL_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP > (SMBIOS_TYPE_FIRMWARE_INVENTORY_INFORMATION, SMTT_NULL, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL), > + SMBIOS_TABLE_DEP (SMBIOS_TYPE_STRING_PROPERTY_INFORMATION, > SMTT_NULL, SMTT_NULL, = SMTT_NULL, > SMTT_NULL, SMTT_NULL) > +}; I'm not quite sure but is it possible a circular dependence? (for example, = the cross reference handle) > + > +#if !defined (MDEPKG_NDEBUG) > + > +/** > + Print the SMBIOS Table Dispatcher state information. > + > + @param Verbose Print detailed report > +**/ > +STATIC > +VOID > +EFIAPI > +PrintDispatcherStatus ( > + IN BOOLEAN Verbose > + ) > +{ > + UINTN Index; > + > + DEBUG ((DEBUG_VERBOSE, "Dispatcher Status:\n")); for (Index =3D 0; > + Index < ARRAY_SIZE (mSmBiosDispatcher); Index++) { > + if ((!Verbose) && (mSmBiosDispatcher[Index].State < StPresent)) { > + continue; > + } > + > + DEBUG (( > + DEBUG_VERBOSE, > + "%02d: %10a [%02d, %02d, %02d, %02d, %02d]\n", > + mSmBiosDispatcher[Index].TableType, > + SmbiosTableStateTxt[mSmBiosDispatcher[Index].State], > + mSmBiosDispatcher[Index].Dependency[0], > + mSmBiosDispatcher[Index].Dependency[1], > + mSmBiosDispatcher[Index].Dependency[2], > + mSmBiosDispatcher[Index].Dependency[3], > + mSmBiosDispatcher[Index].Dependency[4] > + )); > + } // for > + > + DEBUG ((DEBUG_VERBOSE, "\n")); > +} > + > +#define DEBUG_PRINT_DISPATCHER_STATUS(Verbose) > PrintDispatcherStatus > +(Verbose) #else #define DEBUG_PRINT_DISPATCHER_STATUS(x) #endif > + > +/** > + Initialise the SMBIOS table dispatcher. > + > + @param SmbiosTableInfo Pointer to the list of SMBIOS tables to be > installed. > + @param SmbiosTableCount Count of SMBIOS tables to be installed. > +**/ > +VOID > +EFIAPI > +InitSmbiosTableDispatcher ( > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *SmbiosTableInfo, > + IN UINT32 SmbiosTableCount > + ) > +{ > + UINTN Index; > + SMBIOS_TABLE_TYPE TableType; > + > + // First search for the list of SMBIOS tables presented // for > + installation and update the dispatcher status. > + for (Index =3D 0; Index < SmbiosTableCount; Index++) { > + TableType =3D SmbiosTableInfo[Index].TableType; > + ASSERT (mSmBiosDispatcher[TableType].State !=3D StPresent); > + mSmBiosDispatcher[TableType].State =3D StPresent; } > + > + // Mark the remaining tables as not presented for installation for > + (Index =3D 0; Index < ARRAY_SIZE (mSmBiosDispatcher); Index++) { > + if (mSmBiosDispatcher[Index].State =3D=3D StUnknown) { > + mSmBiosDispatcher[Index].State =3D StNotPresent; > + } > + } > + > + DEBUG_PRINT_DISPATCHER_STATUS (FALSE); } > + > +/** Schedule the dispatch of a SMBIOS table. > + > + The SMBIOS dispatcher state table is used to establish the dependency > + order in which the SMBIOS tables are installed. This allows the SMBIOS > + dispatcher to dispatch the dependent tables for installation before > + the parent table is installed. > + The SMBIOS_TABLE_DISPATCHER.Dependency[] field is used to establish > + the dependency list. > + Elements in the Dependency list are resolved by increasing index. > + However, all orders are equivalent as: > + - the Parent SMBIOS table will only be installed once all dependencies > + have been satisfied. > + - no cyclic dependency is allowed. > + The dependency list is terminated by SMTT_NULL. > + > + @param [in] TableType The SMBIOS table type to schedule fo= r > + dispatch. > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protoco= l > + interface. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol Interface. > + @param [in] SmbiosProtocol Pointer to the SMBIOS protocol. > + @param [in] SmbiosTableInfo Pointer to the SMBIOS table Info. > + @param [in] SmbiosTableCount Count of SMBIOS table info objects. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND Required object is not found. > + @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration > Manager > + is less than the Object size for the > + requested object. > +**/ > +EFI_STATUS > +EFIAPI > +DispatchSmbiosTable ( > + IN CONST SMBIOS_TABLE_TYPE TableType, > + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST > +TableFactoryProtocol, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST > CfgMgrProtocol, > + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol= , > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo= , > + IN CONST UINT32 SmbiosTableCoun= t > + ) > +{ > + EFI_STATUS Status; > + UINTN Index; > + SMBIOS_TABLE_DISPATCHER *Disp; > + > + DEBUG ((DEBUG_VERBOSE, "->DP %02d\n", TableType)); Disp =3D > + &mSmBiosDispatcher[TableType]; if (Disp->State < StPresent) { > + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : EFI_NOT_FOUND\n", > TableType)); > + return EFI_NOT_FOUND; > + } > + > + if (Disp->State =3D=3D StDispatched) { > + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : EFI_ALREADY_STARTED\n", > TableType)); > + return EFI_ALREADY_STARTED; > + } > + > + // Table is present so check the dependency. > + for (Index =3D 0; Index < MAX_SMBIOS_DEPENDENCY; Index++) { > + // Check if the dependency list is terminated by SMTT_NULL. > + if (Disp->Dependency[Index] =3D=3D SMTT_NULL) { > + break; > + } > + > + Status =3D DispatchSmbiosTable ( > + Disp->Dependency[Index], > + TableFactoryProtocol, > + CfgMgrProtocol, > + SmbiosProtocol, > + SmbiosTableInfo, > + SmbiosTableCount > + ); > + if (EFI_ERROR (Status)) { > + if ((Status =3D=3D EFI_ALREADY_STARTED) || (Status =3D=3D EFI_NOT_= FOUND)) { > + // Some dependencies may already be satisfied > + // as other tables may also have similar > + // dependencies i.e. EFI_ALREADY_STARTED > + // Or > + // the dependent table may be optional > + // and not provided i.e. EFI_NOT_FOUND. > + continue; > + } > + > + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : Status =3D %d\n", TableType, > Status)); > + return Status; > + } > + } > + > + DEBUG ((DEBUG_VERBOSE, "DP %02d : Status =3D %d\n", TableType, > + Status)); > + > + // All dependencies satisfied - Install SMBIOS table Disp->State =3D > + StDispatched; // Find the SMBIOS table info matching the TableType > + for (Index =3D 0; Index < SmbiosTableCount; Index++) { > + if (SmbiosTableInfo[Index].TableType =3D=3D TableType) { > + break; > + } > + } > + > + Status =3D BuildAndInstallSmbiosTable ( > + TableFactoryProtocol, > + CfgMgrProtocol, > + SmbiosProtocol, > + &SmbiosTableInfo[Index] > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to install SMBIOS Table." \ > + " Id =3D %u Status =3D %r\n", > + SmbiosTableInfo[Index].TableGeneratorId, > + Status > + )); > + } > + > + DEBUG_PRINT_DISPATCHER_STATUS (FALSE); > + DEBUG ((DEBUG_VERBOSE, "<-DP %0d\n", TableType)); > + return Status; > +} > diff --git > a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat > cher.h > b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat > cher.h > new file mode 100644 > index > 0000000000000000000000000000000000000000..420e16f62d58cf295b27174ce7 > 8ce9e2697918cb > --- /dev/null > +++ > b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat > c > +++ her.h > @@ -0,0 +1,133 @@ > +/** @file > + > + Copyright (c) 2022, Arm Limited. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef SMBIOS_TABLE_DISPATCHER_H_ > +#define SMBIOS_TABLE_DISPATCHER_H_ > + > +#include > +#include > + > +/** > + A SMBIOS Table Type from the OEM range reserved for terminating > + the SMBIOS table dispatch dependency. > + > + Note: According to the SMBIOS specification, Table Types 0 through > + 127 (7Fh) are reserved for and defined by the SMBIOS specification. > + Types 128 through 256 (80h to FFh) are available for system and > + OEM-specific information. > + > + This Dynamic SMBIOS table generation implementation defines > + TableType FFh as a NULL table which is used by the Dynamic > + SMBIOS table dispatcher to terminate the dependency list. > +*/ > +#define SMTT_NULL 0xFF > + > +/** > + A macro defining the maximum number of dependendant SMBIOS tables > + represented by the SMBIOS table dispatcher. > +*/ > +#define MAX_SMBIOS_DEPENDENCY 5 > + > +/** > + A macro defining the maximum table types handled by the SMBIOS > + table dispatcher. > +*/ > +#define MAX_SMBIOS_TABLES > (SMBIOS_TYPE_STRING_PROPERTY_INFORMATION + > +1) > + > +/** > + A helper macro to populate the SMBIOS table dispatcher table */ > +#define SMBIOS_TABLE_DEP(TableId, Dep1, Dep2, Dep3, Dep4, Dep5) \ > + { \ > + TableId, \ > + StUnknown, \ > + { Dep1, Dep2, Dep3, Dep4, Dep5 } \ > + } > + > +/** > + An enum desribing the states of the SMBIOS table dispatcher. > +*/ > +typedef enum SmbiosTableState { > + StUnknown, ///< Initial state. > + StNotPresent, ///< SMBIOS table is not present for installation. > + StPresent, ///< SMBIOS table is present for installation. > + StDispatched ///< SMBIOS table generators have been dispatched. > +} SMBIOS_TABLE_STATE; > + > +/** > + A structure describing the dependencies for a SMBIOS table and > + the dispatcher state information. > +*/ > +typedef struct SmBiosTableDispatcher { > + /// SMBIOS Structure/Table Type > + SMBIOS_TABLE_TYPE TableType; > + /// SMBIOS dispatcher state > + SMBIOS_TABLE_STATE State; > + /// SMBIOS Structure/Table dependency list > + /// The list is terminated using SMTT_NULL. > + SMBIOS_TABLE_TYPE Dependency[MAX_SMBIOS_DEPENDENCY]; > +} SMBIOS_TABLE_DISPATCHER; > + > +/** > + Initialise the SMBIOS table dispatcher. > + > + @param SmbiosTableInfo Pointer to the list of SMBIOS tables to be > installed. > + @param SmbiosTableCount Count of SMBIOS tables to be installed. > +**/ > +VOID > +EFIAPI > +InitSmbiosTableDispatcher ( > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *SmbiosTableInfo, > + IN UINT32 SmbiosTableCount > + ); > + > +/** Schedule the dispatch of a SMBIOS table. > + > + The SMBIOS dispatcher state table is used to establish the dependency > + order in which the SMBIOS tables are installed. This allows the SMBIOS > + dispatcher to dispatch the dependent tables for installation before > + the parent table is installed. > + The SMBIOS_TABLE_DISPATCHER.Dependency[] field is used to establish > + the dependency list. > + Elements in the Dependency list are resolved by increasing index. > + However, all orders are equivalent as: > + - the Parent SMBIOS table will only be installed once all dependencies > + have been satisfied. > + - no cyclic dependency is allowed. > + The dependency list is terminated by SMTT_NULL. > + > + @param [in] TableType The SMBIOS table type to schedule fo= r > + dispatch. > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protoco= l > + interface. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol Interface. > + @param [in] SmbiosProtocol Pointer to the SMBIOS protocol. > + @param [in] SmbiosTableInfo Pointer to the SMBIOS table Info. > + @param [in] SmbiosTableCount Count of SMBIOS table info objects. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND Required object is not found. > + @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration > Manager > + is less than the Object size for the > + requested object. > +**/ > +EFI_STATUS > +EFIAPI > +DispatchSmbiosTable ( > + IN CONST SMBIOS_TABLE_TYPE TableType, > + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST > +TableFactoryProtocol, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST > CfgMgrProtocol, > + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol= , > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo= , > + IN CONST UINT32 SmbiosTableCoun= t > + ); > + > +#endif // SMBIOS_TABLE_DISPATCHER_H_ > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'