From nobody Sat Dec 21 13:57:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100834+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1678263419432941.7202183682439; Wed, 8 Mar 2023 00:16:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aB2BYY1788612xcyvH1drB6B; Wed, 08 Mar 2023 00:16:59 -0800 X-Received: from EUR03-DBA-obe.outbound.protection.outlook.com (EUR03-DBA-obe.outbound.protection.outlook.com [40.107.104.77]) by mx.groups.io with SMTP id smtpd.web11.2264.1678263418045698753 for ; Wed, 08 Mar 2023 00:16:58 -0800 X-Received: from AS9PR07CA0006.eurprd07.prod.outlook.com (2603:10a6:20b:46c::7) by GV2PR08MB9400.eurprd08.prod.outlook.com (2603:10a6:150:df::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17; Wed, 8 Mar 2023 08:16:43 +0000 X-Received: from VI1EUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46c:cafe::39) by AS9PR07CA0006.outlook.office365.com (2603:10a6:20b:46c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.16 via Frontend Transport; Wed, 8 Mar 2023 08:16:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+100834+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VI1EUR03FT021.mail.protection.outlook.com (100.127.144.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17 via Frontend Transport; Wed, 8 Mar 2023 08:16:42 +0000 X-Received: ("Tessian outbound cfb430c87a1e:v135"); Wed, 08 Mar 2023 08:16:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8d3a6f856025aee8 X-CR-MTA-TID: 64aa7808 X-Received: from a3bdae69cc99.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1DED4346-C0BB-439C-A61E-9417E0A4D3DB.1; Wed, 08 Mar 2023 08:16:35 +0000 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a3bdae69cc99.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Mar 2023 08:16:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ICnPNKPwD6cJ1mN7MQzflDGHHoN2AGV75SWSPnTaTNCmvBuGQ73n2fCzwMe8s3B1iQRgopUKHmJKVHZhFP5/LJMLJWSQk21KYdFCJJzz2Box6R6MpXnz7N9Sj9onYqNRDNaV5BTaSB6Uif9/KX+wNGK/b9V4DzP7bhosKP9EBC1qMD+8oBGtXZl/RUgsJgkrOS3Q/ofu42ixqvOAb8PMYF303VC0lVMC9kX4nDR0tdT5Q4iMF+Qd36KXX7iMX0x+yH7v8a0FyckcAIuLW2NaRArNdY6SaRgasZ8s2DtDswzTHBdWJc4Lsoatpq3F0u+v4nui5HfePUaVm3gXZo2GVQ== 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=tPPbAHkzo1SD11kcBKJ0tY98Ep+QkLLSaz/cq/Z1W6I=; b=BC82BlWMU10hOVZ+XKG5YeBOS0W5q0kHSkO7ds7Xuj1hOaCLa5G+yzkGMABtxZEzvnBaLj+ZO+AgXSubglZgbqImGyaZMd5PTsPEhQUDyIB+BeqjXwi40Z1qsT5Ns6elkrAT1s/MRoM8wYr8HJEoMG4wq4+QoOyCr6yJaWUL47mZGutmTQ06neVvfPbqtcBHgFPM1ok6F+i+0itm5oS+hbb3xVUITo3k0UzmRAuSR5HFjalqtG3CGn8iLKoY/LvqQz3pzw65np4Nxn7pv1Sa0XX6XQk1DKuqZSaZGaWRy4YhzTyXt9L1w7yVbxjqk8eXY5iMHi/TkT0NLlBAfx70Mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DB6P18901CA0022.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::32) by DU2PR08MB10016.eurprd08.prod.outlook.com (2603:10a6:10:49e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Wed, 8 Mar 2023 08:16:31 +0000 X-Received: from DBAEUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:16:cafe::7d) by DB6P18901CA0022.outlook.office365.com (2603:10a6:4:16::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29 via Frontend Transport; Wed, 8 Mar 2023 08:16:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C X-Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT023.mail.protection.outlook.com (100.127.142.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.29 via Frontend Transport; Wed, 8 Mar 2023 08:16:31 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Wed, 8 Mar 2023 08:16:29 +0000 X-Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Wed, 8 Mar 2023 08:16:29 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , , , , , Subject: [edk2-devel] [PATCH v2 2/4] DynamicTablesPkg: Add SMBIOS table dispatcher Date: Wed, 8 Mar 2023 08:16:24 +0000 Message-ID: <20230308081626.33124-3-sami.mujawar@arm.com> In-Reply-To: <20230308081626.33124-1-sami.mujawar@arm.com> References: <20230308081626.33124-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT023:EE_|DU2PR08MB10016:EE_|VI1EUR03FT021:EE_|GV2PR08MB9400:EE_ X-MS-Office365-Filtering-Correlation-Id: c4b1a41d-6f15-4b93-bc5b-08db1fad7337 X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Hv7+Uv4mFr1DN3W63UuoR5rCmZNXQTl9xwZWGVlKubPExNj4jJi3STd0hG8J4r5fA6n96FnzHMJmujadGhjUaHKMtS/b1Ewdx88/7T9ICRpKcM66c8uE0xVZdy58nyiqvLzJGHd7wLAEmf3L+HET2VEh4qKEr+1WeE7lEZSHFp9HlTVugoDOO+tsbzQYJJjCgP9Fd+vfasCmLPaUBwZKebnANIn5+WT+Vh8iwzb5jr3ObRFF3pBsRdJRQEJvpr93Sw/mqAJJid7YWPsUf1Ar1OHUdeNBcXJ+h46HzmURHCmfTuxGjY9BRF+fgOULBNZKmZ3J7Zq9Vo1ivX/AdjRuMYeuiONx9r56kugfr0lzlVAdzxDJI6Hrj5bGVqy6SHWnP5MOusYLl1jne9JPWUgTlupKNGDSev4trCxpvkowqVWd63fqJt0qfueYMoPw1w46X+DqfMbIknOys1JbkGnjoa0aXGu4L+jybMJ3vwHf5Cw04PMEbutpOJF3XYOszjm3Vk/AUlDQeWNnmrr+ZU9tNmG1y63Toh5y6ooYri3b2etYZuPJKaKkUDYp5+0d8x1KwY8iCoApE1FlSRdTH72McCuU6Orh6tY0p6KtqyrNFjQtHwaw1oSzjA7pcRbw6lqB5gXWhP9XCIKs7tchL386yPbfyVtlgV/AdHvBSsKEm69UShtqqChM/+N3eP8PQahfiSZ2FT/tPd0QFGpS55rQnmk2gLP3g03TZG+iz3stg2g= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(136003)(376002)(396003)(346002)(39860400002)(451199018)(46966006)(40470700004)(36840700001)(40460700003)(36756003)(54906003)(316002)(478600001)(6666004)(8936002)(5660300002)(966005)(356005)(2906002)(70206006)(44832011)(6916009)(30864003)(7696005)(4326008)(8676002)(70586007)(82740400003)(36860700001)(40480700001)(86362001)(2616005)(41300700001)(186003)(26005)(83380400001)(1076003)(82310400005)(47076005)(426003)(81166007)(336012)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10016 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d5fd12eb-e2b6-4d72-c42e-08db1fad6c6b X-Microsoft-Antispam-Message-Info: uxc3WI4448oZluOYlvJA//O2KTDUV1FLN2Z26K6QDFummXyiVfBcvc4sIiHZq+gcnze+3nXsp21HpWjO5yXQHaTLKR2njXVYQhdsA+hqysu36GcHnbkRSfwX+h2tSfzkQJdC23tNuJcGAkobjVdYp1X/F8V0oO8IMYAft4GB5jcmE+M9ZPImTOcGE9EAlD3M1N15bva/dWOIRSlv3QblqVhhLYwacVCMLYmHo3ckPf1IcDA8qd3ykEnb+MDz3KaSc5QcNw8ePBiA/4UHydp5+WXc6yqXZ9uRXUnZlyD8VQM72dRFN4smZ/tcw7BboIwNkTP+eOdaksZScGdInVXFe0XnrnhTC1gRMhHHnD1Xe47jQeNYy4NtBTcnuxF4OhyJ36OrtMg0IevT0zYdSuInpCSdIEfjpl2uvp7zCdzInbmarN+42RRSRVQnRmJYACT0AVhADLr8tA+8MvrV6M+/wOakYW6Q7jA70NFiVGogzQc0v530zjFoH/tUaTILTZ5KCKCxIUqK/43WkqiflVZB5ga/+Wowy/XF3zJhOu5Wr5eEV+WtFg2D+D56S3MLKbWEEOzkaaBrsp43oYtAlmeMmkwoFyUr9LmuZAP/FqDBhmhYrWHCnbK/lUqQ+BIXhNYUDbu0nwqqvc5Rx3mU1RIQTuTYTZCzBrYnCcExbJz4mn93YyydHQl3aaeQMo4e44ip X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2023 08:16:42.4486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4b1a41d-6f15-4b93-bc5b-08db1fad7337 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9400 Precedence: Bulk List-Unsubscribe: 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,sami.mujawar@arm.com X-Gm-Message-State: 855LDQYKzdBX2OtyKw4Mn4W3x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1678263419; bh=t9Ji5MWUQn7m4acfKLwcwzidnTSGdnND/xmt+lIae2E=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=HPH04i5DW0jLcnmeTWsESkPOOn9tuq8JkuVb8BHWi5/3mUbHQ1XYUVKbBSOuhXaOE9p b7vFGr30ARmryKlFga9Jz9Kn64bgdr1OAIM+f/EdjBM+PXJmKjrkF7FsAGo1yef1wsLXl has/55IrvHydTN3ReqmERwqftLTjjYmRJhE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1678263421275100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/DynamicTableMa= nagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTable= ManagerDxe.inf index ad8b3d037c169ca848b5ea84fd1086b83f37876f..b09272d883c6f4f05eb03dcdab3= efeda92b2fbb6 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 ## @@ -22,6 +22,8 @@ [Defines] =20 [Sources] DynamicTableManagerDxe.c + SmbiosTableDispatcher.c + SmbiosTableDispatcher.h =20 [Packages] MdePkg/MdePkg.dec diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDis= patcher.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDisp= atcher.c new file mode 100644 index 0000000000000000000000000000000000000000..0e728538d9f6eb0b164fea3a160= d3233db833f8d --- /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 0000000000000000000000000000000000000000..d59eab4223c142293bdaf490558= 8f08e7a4a467f --- /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 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=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 (#100834): https://edk2.groups.io/g/devel/message/100834 Mute This Topic: https://groups.io/mt/97468481/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-