From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2E2AED80D4A for ; Wed, 9 Aug 2023 16:14:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Gf64Z9NRmvTmtFvSATdnrR1khS72jpbJucBSfh9jCco=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Message-ID:Date:User-Agent:Subject:To:CC:References:From:In-Reply-To:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1691597647; v=1; b=jz/IZjwKbntH0eNvY6tfI8HZMbZFdCsqYdNTWyuYE43K0Wmd+ud/Q5MgZc38KnmspYhS2ZBQ 4CxZYdP1WJRH9L08Q/c52+x7blHIJdgLtW1QvTHJHwvOSLdP/pWhqbFGgrlrShHSZT7Fncg1DmO ZqLX5Vdqlhmiv5pNdXMykt6s= X-Received: by 127.0.0.2 with SMTP id Dw5dYY7687511xRWOlaCC9G4; Wed, 09 Aug 2023 09:14:07 -0700 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.73]) by mx.groups.io with SMTP id smtpd.web10.92379.1691597646543377447 for ; Wed, 09 Aug 2023 09:14:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZdnSi3kNRB+v1J49yc7HL1PF1zzBgO4ZdFqL5Y34mygLYYrHHFScHx/nLQt8YccNKL5xZPEmWZcAf4+kf0uw2BIoGRfsn4O48+XnwT1d8DdgA/vSwxM8dbx5YFC7fX8s7Ph0BtLj3t5r+gSwLV7LiiqFf1qemvxBCW8nH01onoOIOu7aUUxDj0Cwwpgr+n8xrQotDr4YI0MeX0njkPHIdwyo/6qsIeQbYoSjrzi9WmtoJ/hCA3W80IJ4ECHLTeXCwlotM3WnoYSdJv39tsCykNQ6G7i3XUeySyRyAhRSEdNwTXcEYPWah23sVKiC9Fy8d3A5bROwkQGs1d7wZgxcpA== 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=Wf9YB+Fysgo+QgHbFAdPcoVWsKmUYsBxX5kY+b2YgWo=; b=eQT9nJiGt0+hkrhMky66w7qYHZbNR7qhclT2D5rXQjJFHkSM64/QxiOfQ63Wall333eUEOgeGp9CmMhrfDNaduLa9KX6kmf1On53Sa1JleBXVXKBzS3cQUbAljemeybkIVybXwpZ/t8OuGcaVcccLq3igjARPiPe8dLB/PalqgYQ7xyKgEgFUzGZfpyU62ESI3B03Ay6xBWgzWEECLEZHaFm2H4rUImse0OjgHLf3zDDt6/93N6bJIvFcP0nhjUUrLW4CmkaGHRzwyVUHGuApw09nNPxG+Ds3Y1FzaIceT73+1FXiMrWD2/T+s6BHslE3gf5CEy4q7/2KMuUPrAcYA== 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 X-Received: from CY5PR12MB6297.namprd12.prod.outlook.com (2603:10b6:930:22::19) by CO6PR12MB5394.namprd12.prod.outlook.com (2603:10b6:5:35f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28; Wed, 9 Aug 2023 16:14:03 +0000 X-Received: from CY5PR12MB6297.namprd12.prod.outlook.com ([fe80::3552:9160:272e:9636]) by CY5PR12MB6297.namprd12.prod.outlook.com ([fe80::3552:9160:272e:9636%7]) with mapi id 15.20.6652.028; Wed, 9 Aug 2023 16:14:03 +0000 Message-ID: <253e9a60-16f9-6d8c-daec-79f1971ca12c@nvidia.com> Date: Wed, 9 Aug 2023 10:13:59 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [edk2-devel] [PATCH v2 2/4] DynamicTablesPkg: Add SMBIOS table dispatcher To: devel@edk2.groups.io, Sami Mujawar CC: Alexei Fedorov , Pierre Gondois , "abner.chang@amd.com" , "Jeff Brasen (jbrasen@nvidia.com)" , "ashishsingha@nvidia.com" , "nramirez@nvidia.com" , "wwatson@nvidia.com" , Matteo Carlini , Akanksha Jain , Sibel.Allinson@arm.com, Samer El-Haj-Mahmoud , Jose Marinho , nd References: <20230308081626.33124-1-sami.mujawar@arm.com> <20230308081626.33124-3-sami.mujawar@arm.com> <1bf32de1-2aa2-c680-4760-bffa0da59adc@nvidia.com> <8FC92511-1E75-4C4B-91C7-9D252728C69E@arm.com> <59d00c3a-0ed8-f73a-68e0-70eb304a7d25@nvidia.com> <9bfe354b-914d-4534-1b8e-5d32411b5354@arm.com> <143a7bee-82dd-53b3-c0d5-58da8129605e@nvidia.com> <834a869f-35e2-08cf-3e93-820e2ef62edb@arm.com> <1775402AB0EAA56A.16579@groups.io> From: "Girish Mahadevan via groups.io" In-Reply-To: <1775402AB0EAA56A.16579@groups.io> X-ClientProxiedBy: BY3PR05CA0008.namprd05.prod.outlook.com (2603:10b6:a03:254::13) To CY5PR12MB6297.namprd12.prod.outlook.com (2603:10b6:930:22::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6297:EE_|CO6PR12MB5394:EE_ X-MS-Office365-Filtering-Correlation-Id: 1003641c-0255-404c-2618-08db98f3a5bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: +qX4hK/nXMWYVumvVKN5JJJl8/1JSu8bk01cI6UqgnwJQFPKFiWEXzvWDyeYxgGZYYufXgbOq8Q3UvJ1LZGpFQKpIGFkuoT4Vu9PNbRlvmGL6U/RES8v6IIfrQSt939Z96YIUsk7UgsB2wi5sPOuMo4tlYX7U0dGy02RAwbRcCIyaE0xWHH9U0+EPFcH4t+K8ls+TiOBTwN66+luMxkPmbAsbIS4upRW39NnlZdYhQg26aj7mL0bPcl8t0UCwv4OBtuEZVk0L+htZpqCmI88KghoXTYgKBeQbOZe0IDmvZPguJ0Rsy8+cKiKg/tl1jZF/MyR2032pebf+iojSdDdrAcUfpU/THIja2YnQU4VDblv4jW2qGlZ+2ez1Yc+YRqGJwBvjuDsQUVSBil9zvcfXSTY/D5ZVpwdDVEBMmgcQb1auE/2xmJPKSWKsm42CG+jDwUU80WhIWwOdp5goPrdTenBsCpYbbs27QbcUb13moRzdjEttvEdQ5O5iDVw+Y+msZxcji5SeVD1lDMBbDJrszNKOcDLSlQixJS0KN+6zUcu0Pib9obBph5db3sqDkiAlH7Sk/J2PYSCTIeBCvlmQK8FCevPQ5vHBfdqUH2UChi4liz0ebJgWmMKyzxsqh0oQs2MUREj+oiinHgkM+wE4g== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8c6aQQnaKG/dCnK5pG+iBdoOxK+0un2ar5BaQc7uw+Vul5gEIJ9J0/kIsrud?= =?us-ascii?Q?5GWgxsXQa4weZRZiV7siTeqFU3ljQtulWlMdmkorc6wJvUS6m4KM1/+wsY1g?= =?us-ascii?Q?45Aw+JguF+Ek+eFmeh6Zb3GB3U6aTbv2U/qwlKAW+1Kv6iOVbHxG9nMZkVqy?= =?us-ascii?Q?zueSy1urXjXqCMOqpQMdkI1IzAadwBjTE9jUl7VV/tTttd/Xa8pu5OGav5BM?= =?us-ascii?Q?KHmsyo8sqRypyUPLyYaJag7u1UYq7KaMyDE08c2Iz5TOxVpPAhnCvSURMz35?= =?us-ascii?Q?1FVMtiAnO7DkoIo6+0BniKrfJU6gZo2DUSfPqDK76JPNYczpjkS2Y0ASizcJ?= =?us-ascii?Q?9Xc60KlhhZ94PDM0+vv5SAGCPQTptlb2sbEMFkLw/QuCas0vMIGYICzO2+jv?= =?us-ascii?Q?9MkDq0LW9r6Pf+fm2IDiCC5vC5M2GaK4KP0yxOVrQyzLu7YXcdiicagPIu1X?= =?us-ascii?Q?INC8hBGJYPmw/xWGR7B7psVjZaSVF93rHWhps7cW7hXnPWpiApAYuggkCU0Q?= =?us-ascii?Q?SCukKmZnnDWc06h2fLe1FnyM2vD+hw5JGOq4yh4/iVWZJL6z2vtZULWyejmd?= =?us-ascii?Q?koH3cX99lcu0TaZTG5c6UYj7EjgGfS77p+gTvfznw9mdiDH3IWpgfE8nDUlR?= =?us-ascii?Q?einSKCWiEkGOO4rFRDt6cwwloCbg1+J53JV2YFLsyoLXESHTNOoQWVkWm+A0?= =?us-ascii?Q?HvQ+HMyw1Lsk6vQlr5Q9FQ8t5koBRph7BnTE/x3CbuzIPUeAsHkY+IQTFEFt?= =?us-ascii?Q?GRA5GHGjh82gud//DlDScuXGy0Xwd6E60vFrWt02UUDOCzh5Ma9SpzRFvXXq?= =?us-ascii?Q?zXCYKZ8kjGJ1sxxH1QSsEG5FnoxRbNL/Z5JKqejDtd8oMKwFpYF2pFfhrFDP?= =?us-ascii?Q?zqWE0wXYkFlVtxpBGByjXM7lY0MVShDJ7SmHlNX9CrgrPco4N4kIdpi9KChG?= =?us-ascii?Q?M0sDE3Z92Uyc2FUvD0n5nSDgJ672s9UjgMs3ff/K25RbAB/ZmUuOTwydeqq5?= =?us-ascii?Q?oJV2XHWqeb+xH09SmhYyXHwOVvq5PMKSG61htnLg7V8eBhMvd4LSNwLB8P4J?= =?us-ascii?Q?jBPch3ohy+ZsfTbHJEYDgVeZoDNhFA7BGB5P1+LVJQBiZs0KkJpMOPCF/ydS?= =?us-ascii?Q?6iPc98bndO7/jnVMQDSkFZ174LTXOKTJ9mcTcrgXl7y7KwxKFSFSRCCdnjZc?= =?us-ascii?Q?lbjbSR0qm+E4LpKXAtc5bojAxyq69etrlRKKv0o0M08Rpa2i5CPtWQkeIYvs?= =?us-ascii?Q?37LxCmJl5W6Cp2S1oMAeI2fzJhL33uouwh3CD0sz6PzDhx5rLFrpPg2RwLnk?= =?us-ascii?Q?szVH3yM6ulzlWYvGQeMs7+rGePkSbbMwpjfq0/4OfU5US0gLbYbfzIgHHehv?= =?us-ascii?Q?yNPvuW98Tdea8yOjOorpa3uwIKZ0A8++n+SeonpFEKgNbY81m/RgqpK4s4Cy?= =?us-ascii?Q?uIv+12LGAR/eEp8VM+IDIOu60NdRgrMTnkBBkSJh3nB1Q4lBIS5hqwT36jDW?= =?us-ascii?Q?jnaaJt8jf5iaZ/bl1/BFA42ETL0oB6QieqYtkvp+jHtYATX1upHo0wKEORxM?= =?us-ascii?Q?CULjoMeopF5y9V1H5jOCScM17D+AlIzg+8TWrLmFuf29zGDmRdf4o+qVi7Ca?= =?us-ascii?Q?RQ=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1003641c-0255-404c-2618-08db98f3a5bd X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 16:14:03.0777 (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: OR2TsTiJnMNPk/ziKAQoac+7z+RFmC+gnGE5XQciliREhCFhMyM8OtlWVH1rTs1dhh95h/+3jdloPN84ONcFNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5394 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gmahadevan@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: xjMHPRzXGQkLb3baKnicjJwPx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="jz/IZjwK"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi Sami, Any chance we can try to get your dispatcher patches in for the upcoming=20 release.(if there are no other comments). Best Regards Girish On 7/25/2023 5:29 PM, Girish Mahadevan via groups.io wrote: > External email: Use caution opening links or attachments >=20 >=20 > Hi Sami >=20 > My responses inline [GM] >=20 > Best Regards > Girish >=20 > On 7/24/2023 11:48 AM, Sami Mujawar wrote: >> External email: Use caution opening links or attachments >> >> >> Hi Girish, >> >> Thank you for taking this effort forward >> >> Please find my response inline marked [SAMI]. >> >> Regards, >> >> Sami Mujawar >> >> On 22/07/2023 12:14 am, Girish Mahadevan wrote: >>> Hi Sami >>> >>> Your patches worked. There was just one thing I had to add to get >>> compile to work. (inline with [GM]), other than that I think you can >>> get this in. >> [SAMI] Thanks for testing these patches. >>> >>> We've implemented about 18 table generators. (Types=C2=A0 0, 1, 2, 3, 8= , 9, >>> 11, 13, 14, 16, 17, 19, 32, 38, 39, 41, 43, 45) >>> Two more are under way (Type 4.7). >> [SAMI] I would be keen to understand how the Type 4 and 7 generators >> would work as I would prefer to avoid duplication of data. >>> >=20 > [GM] > As a first pass we're setting up the generators to just blindly use > SMBIOS specific CM objects to setup these tables. >=20 > Second pass could be to have the generators try to rely on ACPI objects > (PPTT) or fallback to Architecture specific libraries to figure out how > to populate these tables. Honestly we need to think about this a little > more, we'd love to swap notes. > (We are in the prelim stages of these so haven't gotten very far) >=20 >=20 >>> I've setup a github repo here >>> https://github.com/tianocore/edk2/compare/master...gmahadevan:edk2-upst= ream:RFC/smbios-dyntables-v2?expand=3D1 >>> >> [SAMI] Thanks for sharing the github branch. Please also share a github >> branch when you send out your patches for review. >>> >=20 > [GM] > Will do. >=20 >>> I could send you one massive patch train (22 patches or so) or split >>> it up into smaller chunks perhaps just the table generation stuff >>> first and then each generator library. >>> >> [SAMI] I think it may be good to split the patch series to include table >> generation and then 1 or 2 generators to understand the code flow. The >> remaining generators can follow later. I think Type 4 and 7 would be >> really interesting, but you can send what you already have. >> > [GM] > ok, I will send out a patch train for the core generator code and 2 of > the Generators. >=20 > Best Regards > Girish >=20 >>> Let me know. >>> >>> Best Regards >>> Girish >>> >>> >>> On 3/10/2023 9:28 AM, Sami Mujawar wrote: >>>> External email: Use caution opening links or attachments >>>> >>>> >>>> Hi Girish, >>>> >>>> On 10/03/2023 04:23 pm, Girish Mahadevan wrote: >>>>> Hi Sami >>>>> >>>>> Response inline.[GM] >>>>> >>>>> Best Regards >>>>> Girish >>>>> >>>>> On 3/9/2023 3:41 AM, Sami Mujawar wrote: >>>>>> External email: Use caution opening links or attachments >>>>>> >>>>>> >>>>>> Hi Girish, >>>>>> >>>>>> Thank you for your feedback. >>>>>> >>>>>> Please find my response inline marked [SAMI]. >>>>>> >>>>>> Regards, >>>>>> >>>>>> Sami Mujawar >>>>>> >>>>>> =EF=BB=BFOn 08/03/2023, 17:41, "Girish Mahadevan" >>>>> > wrote: >>>>>> >>>>>> >>>>>> 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=20 >>>>>>> dependent >>>>>>> table is installed before the parent SMBIOS table can be installed. >>>>>>> Therefore, introduce a SMBIOS table dispatcher that walks the SMBIO= S >>>>>>> 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/DynamicTableManager= Dxe.inf >>>>>>> >>>>>>> | 4 +- >>>>>>> DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatch= er.c >>>>>>> >>>>>>> | 282 ++++++++++++++++++++ >>>>>>> DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatch= er.h >>>>>>> >>>>>>> | 159 +++++++++++ >>>>>>> 3 files changed, 444 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git >>>>>>> a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManag= erDxe.inf >>>>>>> >>>>>>> b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManag= erDxe.inf >>>>>>> >>>>>>> >>>>>>> index >>>>>>> ad8b3d037c169ca848b5ea84fd1086b83f37876f..b09272d883c6f4f05eb03dcda= b3efeda92b2fbb6 >>>>>>> >>>>>>> 100644 >>>>>>> --- >>>>>>> a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManag= erDxe.inf >>>>>>> >>>>>>> +++ >>>>>>> b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManag= erDxe.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/SmbiosTableDispat= cher.c >>>>>>> >>>>>>> b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat= cher.c >>>>>>> >>>>>>> >>>>>>> new file mode 100644 >>>>>>> index >>>>>>> 0000000000000000000000000000000000000000..0e728538d9f6eb0b164fea3a1= 60d3233db833f8d >>>>>>> >>>>>>> --- /dev/null >>>>>>> +++ >>>>>>> b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat= cher.c >>>>>>> >>>>>>> @@ -0,0 +1,282 @@ >>>>>>> +/** @file >>>>>>> + Dynamic Smbios Table Dispatcher >>>>>>> + >>> [GM] >>> Not sure if it was an oversight, but you missed adding the extern to >>> BuildAndInstallSmbiosTable >> [SAMI] Yes, you are correct. I had tested my changes only using >> simulation so may have removed the stub function when posting the=20 >> patches. >>> >>>>>>> + 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] =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), >>> [GM]: >>> We've made changes to this and to the Firmware inventory >> [SAMI] Did I get something wrong or missed something here? Can you let >> me know, please? >>> >>> >>>>>>> + 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[] =3D { >>>>>>> + "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 =3D 0; Index < ARRAY_SIZE (mSmBiosDispatcher); Index++= ) { >>>>>>> + if ((!Verbose) && (mSmBiosDispatcher[Index].State =3D=3D >>>>>>> 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 =3D 0; Index < SmbiosTableCount; Index++) { >>>>>>> + TableType =3D SmbiosTableInfo[Index].TableType; >>>>>>> + ASSERT (mSmBiosDispatcher[TableType].State !=3D StPresent); >>>>>> >>>>>> >>>>>> [GM] >>>>>> This ASSERT will be hit even if we have multiple SMBIOS CM objects o= f >>>>>> the same type which is legal (for e.g there are multiple tables for >>>>>> type17/19 ) >>>>>> >>>>>> [SAMI] The understanding is that SmbiosTableInfo[] will only contain >>>>>> one entry for a given TableType as it is used to indicate which >>>>>> generators are to be instantiated. >>>>>> >>>>>> Following is the sequence of operations: >>>>>> - The dispatcher is initialised in InitSmbiosTableDispatcher(), whic= h >>>>>> will set the mSmBiosDispatcher[].State to StPresent if >>>>>> SmbiosTableInfo[] contains a table of Table_Type. >>>>>> - SmbiosTableInfo[] will only contain one entry for each table type, >>>>>> e.g. even if there are multiple Type17/Type19 tables to be installed= . >>>>>> This entry indicates that table(s) of Type17/Type19 is/are requested >>>>>> to be installed and that the corresponding generator must be >>>>>> instantiated. >>>>>> - Once the SMBIOS table generator is instantiated, it will then >>>>>> request for the object(s) of the required type from the Configuratio= n >>>>>> Manager that are required to construct the table. >>>>>> - The generator can then decide if multiple SMBIOS tables are to be >>>>>> constructed based on the objects returned by the Configuration >>>>>> Manager. e.g. if multiple Cm_Type17_objects are returned then the >>>>>> corresponding number of Type17 tables will be built by the generator= . >>>>>> >>>>>> Therefore, I think we should not hit the above assert. >>>>>> >>>>> >>>>> [GM] >>>>> That sounds right, I'd made a mistake when installing the CM objects. >>>>> >>>>> I should be installing one of each SMBIOS table so that >>>>> GetEStdObjSmbiosTableList gets the list of the available tables and >>>>> each generator should install multiple tables of a given type based o= n >>>>> the number of CM objects available. >>>>> >>>>> I did expand the existing SMBIOS factory code to install multiple >>>>> tables. >>>>> >>>>> Thanks for the clarification. >>>>> >>>>> Best Regards >>>>> Girish >>>>> >>>> [SAMI] No worries. Please let me know if you face any issues with the >>>> dispatcher or if you identify any problem during integration. >>>> >>>> Regards, >>>> >>>> Sami Mujawar >>>> >>>>> >>>>>> However, the code that may need to change/extend is the call to >>>>>> BuildAndInstallSmbiosTable(). I am not sure if we need to indicate >>>>>> that there could be multiple SMBIOS tables that may be installed. Fo= r >>>>>> now, BuildAndInstallSmbiosTable() implies that a generator of the >>>>>> specified type is to be instantiated for building the SMBIOS table o= f >>>>>> the specified type. >>>>>> >>>>>> Hope this clarifies the scenario and please do let me know if I am >>>>>> missing something. >>>>>> >>>>>> Also, I have only tested this patch with simulated data and there ma= y >>>>>> be some issues that we may find when the full stack is integrated. >>>>>> So, thank you for going through the patch in detail. >>>>>> >>>>>> [SAMI] >>>>>> >>>>>> Best Regards >>>>>> Girish >>>>>> >>>>>> >>>>>>> + mSmBiosDispatcher[TableType].State =3D 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 =3D &mSmBiosDispatcher[TableType]; >>>>>>> + if (Disp->State =3D=3D StNotPresent) { >>>>>>> + 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=20 >>>>>>> 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..d59eab4223c142293bdaf4905= 588f08e7a4a467f >>>>>>> >>>>>>> --- /dev/null >>>>>>> +++ >>>>>>> b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispat= cher.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_ >>>>>>> --=20 >>>>>>> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >>>>>>> >>>>>> >>>>>> >>>>>> >=20 >=20 >=20 >=20 >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107655): https://edk2.groups.io/g/devel/message/107655 Mute This Topic: https://groups.io/mt/97468481/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-