From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.66]) by mx.groups.io with SMTP id smtpd.web11.164.1678297304320209184 for ; Wed, 08 Mar 2023 09:41:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=D3nPyPaK; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.102.66, mailfrom: gmahadevan@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kgM8tgVdQdx0H1JwXshcKIu1Wjz36EWqcBS/t4hSmxH4rYeZqOe2yW33rB4BhYVIPBUT2gHgfYn9nY8DSpUHDIFurNNoHdqL+xalf7EtW7PD5Ns6eg3l+a2NZeRdVHdTEGWxeTmUEXbuhjbBGNTwRvmX+zLoYwmDfEv9xf6O6sWZ4dwHSTrufnGjtL91PCTk0N0aqiFyo/9oM3f4JTBCkGYsvKifXKwBteamncgl5ljBsi7nEB6rWzDPgGAnnxMhJoIJWlWy+fv+YdK4NTODZdVJyY30eL5+XmDrUvGgCvB7d+UReEtdoIoXiN08SfbXhvPg+mm7FP7QTqKe2FKbBg== 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=9GvZFKcrMxvZehJ03bMOZBcaqKiqCUcbQ+yW7O2Z7wQ=; b=U7Caetk+ehBywN5Nphs9lnrn24uXQ5/hT7zGr8u4yPQpChOGJyAsxYopFzkc2CsSuDfxyxPeE7jdiKL0b/kt62ib0gPvgDCFLqJtIqcCbnBJ7t2jBL1bsIfTuIZOKJqGd7VMpUnskTWdh7P95I5m+A26tTPGAQMzmtvE2mYuUhY3CyCxJS9w0pe+DQajXWuxiu1mWGEhPyjh2pgo0L17IR0z8gR7iTEcbH32cJFJszkbaERzGx5tkxvnM4zt5Bg+1vI5RjTdg3b5VyNg0WchHP/T8SIlsw7kY1Jsipgf42zYDdy5HzAVjutoGcU5IL9IXV1uIQQUQfJvxGCBxTdZIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9GvZFKcrMxvZehJ03bMOZBcaqKiqCUcbQ+yW7O2Z7wQ=; b=D3nPyPaKZyEZy49t1UvoZYJ3g5GuB7wun6OUdgn7lnAWxCGbgDYTVHin7t4KEjab5hJ+/7bxv9FqDkRQoNowm1VasaF1u+KfZh7lkHw8xaiO9ihVo/VDR51CA01JG6gC5FCvoxtjqcyY45UDFd8DpLHVXHy57lK5e37USi7rhsjVAIM62zyKsc+2oWbhG0mPQbAxHy/KT+h4OFQOk00teVr8+heFlzYuGNxC0+G02EwTWnDSWOUNk2C7FJSywjlcX3ovmdav2itCjRUuK1xbK5mQngPUGSS6+zHTuhI7Vxdjo1m4c6NpaSH9Z/zx7km4iSzuJO5L9Cm6kSxRJZDaNg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6297.namprd12.prod.outlook.com (2603:10b6:930:22::19) by DS7PR12MB8251.namprd12.prod.outlook.com (2603:10b6:8:e3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Wed, 8 Mar 2023 17:41:41 +0000 Received: from CY5PR12MB6297.namprd12.prod.outlook.com ([fe80::cb1a:2484:aef1:bc76]) by CY5PR12MB6297.namprd12.prod.outlook.com ([fe80::cb1a:2484:aef1:bc76%4]) with mapi id 15.20.6156.028; Wed, 8 Mar 2023 17:41:41 +0000 Message-ID: <1bf32de1-2aa2-c680-4760-bffa0da59adc@nvidia.com> Date: Wed, 8 Mar 2023 10:41:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2 2/4] DynamicTablesPkg: Add SMBIOS table dispatcher To: Sami Mujawar , devel@edk2.groups.io Cc: Alexei.Fedorov@arm.com, pierre.gondois@arm.com, abner.chang@amd.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, Jose.Marinho@arm.com, nd@arm.com References: <20230308081626.33124-1-sami.mujawar@arm.com> <20230308081626.33124-3-sami.mujawar@arm.com> From: "Girish Mahadevan" In-Reply-To: <20230308081626.33124-3-sami.mujawar@arm.com> X-ClientProxiedBy: SJ0PR13CA0115.namprd13.prod.outlook.com (2603:10b6:a03:2c5::30) To CY5PR12MB6297.namprd12.prod.outlook.com (2603:10b6:930:22::19) Return-Path: gmahadevan@nvidia.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6297:EE_|DS7PR12MB8251:EE_ X-MS-Office365-Filtering-Correlation-Id: bbbd9d2c-7786-4af0-4f36-08db1ffc6052 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vv4ofzp6HaQoJIGoFOdhilxb+Sff1TS4BKAFt9VjxtBoB/KsCeyXryrLpleicd0Mq39nmzauSAYnDmTRktCXBLRLV4cs0DMCo4Gifke7GJYm72nY8Yq+wnXx+scuuMyGfRVEwBNPWKzi5M2HVBmS8abV80EolKHPmsAFwvzvvEvt6BD6Z37tF1ChNpjU63WVo/sx3ZnyIGZxU4FQcv2EitG4y22veSNO0lyMbBMosvq8SVehQL+Oqg0hA6l7vW7SML/YY4EfN1wx6Z4m4fLnvO26xgFqyzHFkkCI2/zxRtIwU7maH+vJOXOtJv1ehrfh4WrlxHYoyLXSPLKurpO32YEFKC66s59Ms3hIn13ZCr5+49kOlKwcfpuIXH1OmZOG8SjX9MXXuuaSySAi0rASGUf9YVt4wnr6SJLMt8houc7fH4QIyfbHedJqZ4nyY2eOB0tKRM38gmhLxNX2wu4E6+LTAQJNadmA0QS268sQJABMAAcExVZcUjgPz8MtdjNOsSjQFs2QdH9U/hg3lYhFK8+qTj9fPkZj/+ClV2bbBHPWkESM3y0ZJ/2umxKAA/SQf8Ie81h6JT//GJ1GVydwMFKK4cTNc/k82zN/bMn4vbIWDmPt/MU4+zCETUs8GJFLyZzBDrtBgq7I5m1XwEyNqPkTpYSRjI/v3OdBWDrj2hQvCSf6s99mYbyCDna326MBY1CwfsFRpwDaz7x/CaA9VMB5844zUJJ6UdKRSS1VKL4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6297.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(451199018)(31686004)(4326008)(36756003)(7416002)(30864003)(66946007)(8936002)(2906002)(41300700001)(66476007)(66556008)(86362001)(5660300002)(31696002)(38100700002)(8676002)(6486002)(966005)(6666004)(478600001)(316002)(83380400001)(6512007)(2616005)(53546011)(186003)(6506007)(26005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VnM4LzFZcEJWM2V1OGF6OVdhS0k2ZDZ6Z2VIMG5IK242N1F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VQzbEFYNGw2aG1JVTI5UXVmWDdBRGVEOUt4QnVFaWM3d3JGeHdTNzdR?= =?utf-8?B?ZUxjM2k5T1B5ZmFqZlc5REN6N3RyY0kvbzFrVU1RZkpCUDZsaWJOeFo3UVVu?= =?utf-8?B?YnI5bngwM3luOXJ2WitYTEk4QnU1bC9odm8rTTVWTjZkNzNnNE9CRjRKbC9z?= =?utf-8?B?VjM3QVJzeWZqOXRjTDFRckxxU29acWk4RDZDR1FtUzZkOXY4UXB6SGVUcjlS?= =?utf-8?B?U0tselNsdVFDRlhPTTdQallMRFM4Z3REdW8rSGNXR21leThyVlpJYlBmb2Ro?= =?utf-8?B?UFNXMHpDRXZyR0JPcTFrOTJadFYwYUc5c0hraDlva1RBcEJoSkkyWTlWbkh6?= =?utf-8?B?eUE9PQ==?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbbd9d2c-7786-4af0-4f36-08db1ffc6052 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2023 17:41:41.3939 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k1HPpGIGqVEy5QQEOfQs+tkClINCFs80Bwpwg8U2zWAHS61EEfj1oMKzSOZgemOYWEphWGoZLiLasONAkIoI9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8251 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Sami Thanks for v2, I will apply these to my tree and test it out. One small comment before I review/test the patch train inline (prefixed by [GM]) Best Regards Girish On 3/8/2023 1:16 AM, Sami Mujawar wrote: > External email: Use caution opening links or attachments > > > Some SMBIOS structure/table fields have dependency on other SMBIOS > structures/tables. These dependencies are established using handles > pointing to the dependent tables. > > 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. > > Obtaining a SMBIOS handle by installation requires that the dependent > table 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. > > 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 > Cc: Jose Marinho > --- > > Notes: > v2: > - Update dispatcher state machine to remove StUnknown. [SAMI] > - Move extern function to header file and move debug [ABNER] > code together. > - Updated code based on review feedback to move extern [SAMI] > function to header file and also moved the debug code > together. > Ref: https://edk2.groups.io/g/devel/message/95341 > > DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf | 4 +- > DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c | 282 ++++++++++++++++++++ > DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h | 159 +++++++++++ > 3 files changed, 444 insertions(+), 1 deletion(-) > > diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf > index ad8b3d037c169ca848b5ea84fd1086b83f37876f..b09272d883c6f4f05eb03dcdab3efeda92b2fbb6 100644 > --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf > +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.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] > > [Sources] > DynamicTableManagerDxe.c > + SmbiosTableDispatcher.c > + SmbiosTableDispatcher.h > > [Packages] > MdePkg/MdePkg.dec > diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c > new file mode 100644 > index 0000000000000000000000000000000000000000..0e728538d9f6eb0b164fea3a160d3233db833f8d > --- /dev/null > +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c > @@ -0,0 +1,282 @@ > +/** @file > + Dynamic Smbios Table Dispatcher > + > + Copyright (c) 2022 - 2023, Arm Limited. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > + > +#include > +#include > + > +/** > + 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] = { > + 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) > +}; > + > +#if !defined (MDEPKG_NDEBUG) > + > +/** > + A string table describing the SMBIOS dispatcher states. > +*/ > +STATIC > +CONST CHAR8 *SmbiosTableStateTxt[] = { > + "StNotPresent", > + "StPresent", > + "StDispatched" > +}; > + > +/** > + 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 = 0; Index < ARRAY_SIZE (mSmBiosDispatcher); Index++) { > + if ((!Verbose) && (mSmBiosDispatcher[Index].State == StNotPresent)) { > + 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; > + > + // Search for the list of SMBIOS tables presented > + // for installation and update the dispatcher status. > + for (Index = 0; Index < SmbiosTableCount; Index++) { > + TableType = SmbiosTableInfo[Index].TableType; > + ASSERT (mSmBiosDispatcher[TableType].State != StPresent); [GM] This ASSERT will be hit even if we have multiple SMBIOS CM objects of the same type which is legal (for e.g there are multiple tables for type17/19 ) Best Regards Girish > + mSmBiosDispatcher[TableType].State = StPresent; > + } > + > + 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 for > + dispatch. > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol > + 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 SmbiosTableCount > + ) > +{ > + EFI_STATUS Status; > + UINTN Index; > + SMBIOS_TABLE_DISPATCHER *Disp; > + > + DEBUG ((DEBUG_VERBOSE, "->DP %02d\n", TableType)); > + Disp = &mSmBiosDispatcher[TableType]; > + if (Disp->State == StNotPresent) { > + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : EFI_NOT_FOUND\n", TableType)); > + return EFI_NOT_FOUND; > + } > + > + if (Disp->State == StDispatched) { > + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : EFI_ALREADY_STARTED\n", TableType)); > + return EFI_ALREADY_STARTED; > + } > + > + // Table is present so check the dependency. > + for (Index = 0; Index < MAX_SMBIOS_DEPENDENCY; Index++) { > + // Check if the dependency list is terminated by SMTT_NULL. > + if (Disp->Dependency[Index] == SMTT_NULL) { > + break; > + } > + > + Status = DispatchSmbiosTable ( > + Disp->Dependency[Index], > + TableFactoryProtocol, > + CfgMgrProtocol, > + SmbiosProtocol, > + SmbiosTableInfo, > + SmbiosTableCount > + ); > + if (EFI_ERROR (Status)) { > + if ((Status == EFI_ALREADY_STARTED) || (Status == 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 = %d\n", TableType, Status)); > + return Status; > + } > + } > + > + DEBUG ((DEBUG_VERBOSE, "DP %02d : Status = %d\n", TableType, Status)); > + > + // All dependencies satisfied - Install SMBIOS table > + Disp->State = StDispatched; > + // Find the SMBIOS table info matching the TableType > + for (Index = 0; Index < SmbiosTableCount; Index++) { > + if (SmbiosTableInfo[Index].TableType == TableType) { > + break; > + } > + } > + > + Status = BuildAndInstallSmbiosTable ( > + TableFactoryProtocol, > + CfgMgrProtocol, > + SmbiosProtocol, > + &SmbiosTableInfo[Index] > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to install SMBIOS Table." \ > + " Id = %u Status = %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/SmbiosTableDispatcher.h b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h > new file mode 100644 > index 0000000000000000000000000000000000000000..d59eab4223c142293bdaf4905588f08e7a4a467f > --- /dev/null > +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h > @@ -0,0 +1,159 @@ > +/** @file > + > + Copyright (c) 2022 - 2023, 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, \ > + StNotPresent, \ > + { Dep1, Dep2, Dep3, Dep4, Dep5 } \ > + } > + > +/** > + An enum describing the states of the SMBIOS table dispatcher. > +*/ > +typedef enum SmbiosTableState { > + 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; > + > +/** > + A helper function to build and install a SMBIOS table. > + > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol > + 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. > + > + @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. > +**/ > +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 > + ); > + > +/** > + 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 for > + dispatch. > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol > + 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 SmbiosTableCount > + ); > + > +#endif // SMBIOS_TABLE_DISPATCHER_H_ > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >