From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 162DED804CC for ; Wed, 5 Feb 2025 22:09:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=mXBLQ0ltq0V4/85da4SH5Ayj7ddGBbbAoSN25FE/FfE=; c=relaxed/simple; d=groups.io; h=Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240830; t=1738793386; v=1; x=1739052585; b=D4/C+32EtnDnRG8P2YY//5qpI23hvW4hS/C0orpHphdojl4h/EqnxtDJERwp7F7SzU82sVsG vC6SKB9QO7syAVIRYy2nqjNL6rsr/fQJETgOtyKEGEAiiGbPnbfR1+FNhzJCEn1wrGngsm1LTdW z0oJ6mb/ZfZUa7Zf5HVc4PEiZ9aRlrPXV94jrBLCHlW5bjioCEmgEn7DPKGP4uXx7bdFkENEBBL qHs2LJ5BGYduEMvJ1irOTKaBLSHvvhvut5ZsfREOLNfpdCgQS3vZtxxYPgTfsqcb1j6XOW+CWhQ VW1UnqEkOSGCHDLA/HPPBBwW/3Qigb9ANUlNIdDvQQsBQ== X-Received: by 127.0.0.2 with SMTP id bppMYY7687511xt6x2YGdpKq; Wed, 05 Feb 2025 14:09:45 -0800 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.89]) by mx.groups.io with SMTP id smtpd.web11.25778.1738793379919168832 for ; Wed, 05 Feb 2025 14:09:40 -0800 X-Received: from CH2PR17CA0028.namprd17.prod.outlook.com (2603:10b6:610:53::38) by PH7PR12MB7353.namprd12.prod.outlook.com (2603:10b6:510:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.26; Wed, 5 Feb 2025 22:09:33 +0000 X-Received: from DS3PEPF000099DF.namprd04.prod.outlook.com (2603:10b6:610:53:cafe::fa) by CH2PR17CA0028.outlook.office365.com (2603:10b6:610:53::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.27 via Frontend Transport; Wed, 5 Feb 2025 22:09:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099DF.mail.protection.outlook.com (10.167.17.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.14 via Frontend Transport; Wed, 5 Feb 2025 22:09:32 +0000 X-Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 5 Feb 2025 14:09:15 -0800 X-Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 5 Feb 2025 14:09:15 -0800 X-Received: from NV-PF4WDED0.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 5 Feb 2025 14:09:14 -0800 From: "Girish Mahadevan via groups.io" To: , , , , , CC: , , , , Subject: [edk2-devel] [staging/dynamictables-reorg PATCH v0 03/12] DynamicTablesPkg: Add SMBIOS table dispatcher Date: Wed, 5 Feb 2025 15:09:01 -0700 Message-ID: <19de6e3cb31ad28d6a63b9f542ce3549a4800182.1738793024.git.gmahadevan@nvidia.com> In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DF:EE_|PH7PR12MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: 807e9931-4e07-4923-7b63-08dd4631c526 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6HY1sHnQ8SzQrUDzabbXV8Mup0tKlvLWNsBLHo94eBO3JqCkcFdXWlInl4rc?= =?us-ascii?Q?vMYHtK77+GW+9+UxgakADvh3WwFIXOdm3RE6SEXOeaP3CPuQRy2X5yUcuSNz?= =?us-ascii?Q?rWbfadvlo9zTl27eNHdgMC1y/PSprPh9m9zZKs0qYUkHcNdchkjTqSDBJRnH?= =?us-ascii?Q?sEVNSKWMUqZ7CZ/tm2JzKcX1ZO1gMFXgRWeYBm/zgGsn0O6sVHyscGNtu3ru?= =?us-ascii?Q?/Nj4WYhnr/GkCMZjZelmKfJVxPaHY53BrpubF5akSrqypi3TSv0p+zEwLB0M?= =?us-ascii?Q?l2VR9KJH4sF0DPO50DhEJvWRaBNJf80ALhTgLyIIFXhgvkjcLgCheyho8g9O?= =?us-ascii?Q?LzMuEs2vtq4ErQz6KVkdSasDQxb0a8saqzlC6M69y/cCdJvle+kukhtJbytB?= =?us-ascii?Q?YjRrdZEJAEqjbfKSNjbRMBbHQ0DuTPib2vyrA0Z/MjuQk7Ce/Bwhm+Zq/KV5?= =?us-ascii?Q?WdWMyJfCc92YMlkNc24C/jwUE7VjoyjO8zbkX/suS3KVEd3ALNVuBG/nEkj/?= =?us-ascii?Q?wROkaI97T/tcLEtAof93CNIZd8Y9g4FnQwmR83Hgr/CzGUwl583xuSQoAgWm?= =?us-ascii?Q?wxgdFwLBaao0V7YSPMInyp58FOwDR0Rk11lj/AS/kH6GoS4zUGtuLonkqLbd?= =?us-ascii?Q?OthJyQAv57Qnj3omgm7Ny9VvMwyz7f7ViiaCMv8znAthldi37rofY1yNLEFj?= =?us-ascii?Q?+aWhVlUU65rT8QlUPvtPTaJSyMQ1rdbTtoIyFQI+En5nbuMTWO0Yy54ttCMy?= =?us-ascii?Q?RnWeHNrJmkYgJzrrdD/+wlKif33Mf8Q5297X8CiCssAEKkSaLuMoKRUO88Gp?= =?us-ascii?Q?SpNSrBAK7S5HVvPOyb9nc15jg7uCqMU2rT9te6t4Zlk3RfN4b9rPIKa0tYom?= =?us-ascii?Q?2UlAmNNFHzDdEfIFlfeGDSXjXk91aR6/z2789CfuobXMuYq0g0gyXy5dUnRs?= =?us-ascii?Q?r5vo7EsnbLYhg7ruIWzh7QnqXXvauw85eKDZTw8pvOpj+mByjDZB3JndHd5O?= =?us-ascii?Q?vfKpAs91TnrZFpT1aVxjHbSGXj0aKKRzlwrsXBMmcaJfRoVzMbZZ4M+McT1b?= =?us-ascii?Q?M7lH/Iou7EABRoFzhDGJIxfCRTsReQR8w+/ZyOEuSBaPDcTxxLzkewZrxfz/?= =?us-ascii?Q?7lYHmNgZEuKHXUh5560pWEzUzVAREk/Tq5ON5WF5ynqCbxt4XZ3wfMhmswWh?= =?us-ascii?Q?R1oNTFjZygT0Rd5HyzwIyv8AaGwS+onZmjaxPq44nhjcQE1V1cA0zP1f616u?= =?us-ascii?Q?xZ+MzT9WtscTxvJTdVpBAyrP8LtWWGLncc/C2Nsji5ViShXtm97ERwpqy6Jh?= =?us-ascii?Q?OqV9mOlrYpajCgDb8DXXGcYxwX0gHEgAKNbRbz2PudEG+4au6AIMZ9NNq+p8?= =?us-ascii?Q?MMwIa6KYxlfaSV7TUjabqAqLwq7P8R0mgpQm6Z1MSQLWGEWimbf60o3E1b2z?= =?us-ascii?Q?1RDKCNxXbrRwjoAOMhmYo7JNoOTiG7kx2+/l61XWCvt1lK90kTUf36V6PpVz?= =?us-ascii?Q?N06lMe9SsMBtJf8=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2025 22:09:32.9891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 807e9931-4e07-4923-7b63-08dd4631c526 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7353 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 Resent-Date: Wed, 05 Feb 2025 14:09:40 -0800 Resent-From: gmahadevan@nvidia.com Reply-To: devel@edk2.groups.io,gmahadevan@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: sCEM82AfxhYuYgG0HDCfJrTdx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b="D4/C+32E"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=pass (policy=none) header.from=groups.io From: Sami Mujawar 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 --- .../DynamicTableManagerDxe.inf | 4 +- .../SmbiosTableDispatcher.c | 282 ++++++++++++++++++ .../SmbiosTableDispatcher.h | 159 ++++++++++ 3 files changed, 444 insertions(+), 1 deletion(-) create mode 100644 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosT= ableDispatcher.c create mode 100644 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosT= ableDispatcher.h diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableMa= nagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTable= ManagerDxe.inf index 00d03e75be..56b35d4fb0 100644 --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDx= e.inf +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDx= e.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 ## @@ -23,6 +23,8 @@ [Sources] DynamicTableManagerDxe.c DynamicTableManagerDxe.h + SmbiosTableDispatcher.c + SmbiosTableDispatcher.h =20 [Sources.ARM, Sources.AARCH64] Arm/ArmDynamicTableManager.c diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDis= patcher.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDisp= atcher.c new file mode 100644 index 0000000000..0e728538d9 --- /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. Howeve= r, + 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, SMBI= OS_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, SMBI= OS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFO= RMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_DEVICE, SMBI= OS_TYPE_PHYSICAL_MEMORY_ARRAY, SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFO= RMATION, 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 (Ver= bose) +#else +#define DEBUG_PRINT_DISPATCHER_STATUS(x) +#endif + +/** + Initialise the SMBIOS table dispatcher. + + @param SmbiosTableInfo Pointer to the list of SMBIOS tables to be insta= lled. + @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); + 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. Howeve= r, + 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 TableFactoryProto= col, + 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 EFI_NOT_FO= UND)) { + // 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, Sta= tus)); + 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/SmbiosTableDis= patcher.h b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDisp= atcher.h new file mode 100644 index 0000000000..d59eab4223 --- /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 TableFactoryProto= col, + 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 insta= lled. + @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. Howeve= r, + 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 TableFactoryProto= col, + 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 2.25.1 -=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 (#121088): https://edk2.groups.io/g/devel/message/121088 Mute This Topic: https://groups.io/mt/111022004/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-