From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.40]) by mx.groups.io with SMTP id smtpd.web09.8635.1666107246280717864 for ; Tue, 18 Oct 2022 08:34:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=Bkau3pFy; spf=pass (domain: arm.com, ip: 40.107.22.40, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=lvJr+jNj4Wkfll1yytwJY+Po8Dp/2O6iiVyutkdcsTlf3xCkMDeWJWiJ87xaQtoXzTq3+J54+Fn7e9Z23pFLzUNF/d6fFprneKP9pXll2nTe9EulEZssih9aT7HcSqjPy2pA58qSHl6/3y86IXo9OvyxPOI/m+X8g26jNQEeblrHs1ScHkmmnlZvmaNu0+HdV3iGiLnldvFM6gTdSejMA/+scDLwa1PIrCV9bippj4sdcjH41rlOsYYdkmk6lHcWXq9nvsGS0hVL3rvQfuZJe/1/MbiOHPO/LlAO5Z8Jf025n1eJizPWLiKx7pwu0xcKvcHf/rA2mOR1I6fhb7+Lgw== ARC-Message-Signature: i=2; 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=3zfkXeg3TjWre7kn30Pg8UCxYK8IXYNuJzJUXYsP/+A=; b=nxqHapeTGQ64WwUYKmwaNLpuqY+dafl3TdQ946OuyBX4rrvAZg5c+6wmnb/SIqHDWjvj02MJw0nks4xMAFJxVctuvFHSbULnECUCXV4jTH7dpGIrtsrWU0+eCm/YgytlqhLI1ky+SGCFhSBVMhOTB1q0x3CNDGzvzVTsp1+C4GWC2nFgNNoamZPyIsZDR4H3f0PrDmmHlWRJbLlc4W0alXm0Pc86J1dJ3DThtYLUoe892udoVH56yk0RiR6NrurHbS6PuPhdLkBQZSGx0Y0Av7Mob3yVZEGb5eqxR7gkZ3ipRA5P85J87ZALPACQPWhLvhEKHkVQdjBWVRXzAZ7M5g== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3zfkXeg3TjWre7kn30Pg8UCxYK8IXYNuJzJUXYsP/+A=; b=Bkau3pFyAQ2yfPA/Kjm+w1UeGKcYDptiNKQfjXyKMSs2QatAc8u3AD8UfY3TQIqbTGOf22JwZKvhevzphaeI0aQStZ2x0uYdrl4zEIAbr7WNpG2WrfmXKKOuDnnV4Aei5//ZdTbXSDA6PHb/H9iaK2HSi/KSH3cnoq+MUUJyzmA= Received: from FR0P281CA0144.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:96::19) by GV1PR08MB7897.eurprd08.prod.outlook.com (2603:10a6:150:5c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Tue, 18 Oct 2022 15:34:01 +0000 Received: from VI1EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:96:cafe::90) by FR0P281CA0144.outlook.office365.com (2603:10a6:d10:96::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Tue, 18 Oct 2022 15:34:00 +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 (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 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VI1EUR03FT034.mail.protection.outlook.com (100.127.144.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20 via Frontend Transport; Tue, 18 Oct 2022 15:34:00 +0000 Received: ("Tessian outbound 6c699027a257:v130"); Tue, 18 Oct 2022 15:34:00 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6a2904df758383c4 X-CR-MTA-TID: 64aa7808 Received: from e83d332106c1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 547F807D-7E55-43AA-AFE6-C235A7F752CF.1; Tue, 18 Oct 2022 15:33:53 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e83d332106c1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 18 Oct 2022 15:33:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nE3ljqscR/cwt2OxG+3dEWGxSlW/Sppg4kQUXz4eM27FR24KwB4rohS3mZhPCG3hMKHTOWpptkR8Fu2QpueYRpdVrhz3GHWrY11wEjhLz0VO5GOPERMdtSw+9BsRCytN/WjZhDVB18SXyJpoAEoMPXkxyXsR0TEAsaSf+WtSTigdehDtefdWvXDozEUQqNT3d5/M0taX2c5HEroRlf5UCUti2rqsTO3w8ShJaw3bouQp4AfzdEEwsqm2OKJaGBXLnolV21cdW4urusfKFgWSpf+1AyqhI4d+URAxhfgoTtxUIDndF9SmXXZ5BEBTU4OzYxw30rDXXFmEQlOM4uf2yA== 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=3zfkXeg3TjWre7kn30Pg8UCxYK8IXYNuJzJUXYsP/+A=; b=AurxiRB+Q5QEiMHLidCyTsylh/D7Dk8OfcMuqHdgTUBeRHlmXxeNSMusJ3cnlROmXGGXWE+yRuzNuhXTTUPJYMLSA9hRS0yNTC1nBmYmWBPOy17B442YB+rIszHuIR2HOSFNnEbYoue8B8OR1Ki3vEpZm7gNSIDgflvtfqj4Axi5F59MEJdS+I1cwFahL5TCnuwG0+CGYOGioL17V4Anml/naPIFJxbBYyTd1nOyg16/jzBMxdW83v0rs+bhUlpgBsB1+ibDFdTPaz8PswC/6Xjt5ZtDQSUjiWYvBnps1gJewESXLBFDUrYD2UphOEWf7T/WBdduJFG8ZUXFp9fkJg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3zfkXeg3TjWre7kn30Pg8UCxYK8IXYNuJzJUXYsP/+A=; b=Bkau3pFyAQ2yfPA/Kjm+w1UeGKcYDptiNKQfjXyKMSs2QatAc8u3AD8UfY3TQIqbTGOf22JwZKvhevzphaeI0aQStZ2x0uYdrl4zEIAbr7WNpG2WrfmXKKOuDnnV4Aei5//ZdTbXSDA6PHb/H9iaK2HSi/KSH3cnoq+MUUJyzmA= Received: from DB6P193CA0006.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::16) by PAWPR08MB10284.eurprd08.prod.outlook.com (2603:10a6:102:369::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Tue, 18 Oct 2022 15:33:49 +0000 Received: from DBAEUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:29:cafe::ff) by DB6P193CA0006.outlook.office365.com (2603:10a6:6:29::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 15:33:49 +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 Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT049.mail.protection.outlook.com (100.127.142.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.20 via Frontend Transport; Tue, 18 Oct 2022 15:33:49 +0000 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.12; Tue, 18 Oct 2022 15:33:46 +0000 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.12 via Frontend Transport; Tue, 18 Oct 2022 15:33:46 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , , , , Subject: [PATCH v1 2/2] DynamicTablesPkg: Add SMBIOS table dispatcher Date: Tue, 18 Oct 2022 16:33:44 +0100 Message-ID: <20221018153344.16876-3-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20221018153344.16876-1-sami.mujawar@arm.com> References: <20221018153344.16876-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT049:EE_|PAWPR08MB10284:EE_|VI1EUR03FT034:EE_|GV1PR08MB7897:EE_ X-MS-Office365-Filtering-Correlation-Id: 7486eba3-a99a-4aff-3362-08dab11e2e22 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: L7U43LXkIilLPnHYxkFqlNa7AaZc97hJjYuNJ4FdYlodW3zCiIi88Y6AWeZwJKxqLDkmLxTfBkWZteZ7EvHKeNmumFXj4U03Y3D0cvOzrbCoJpbOV9faJyTVuBErX3GFZFPUdBAchr6rx6LGlk6GFHyax0N9PdUP2pGIhFuiz9mpGbfiz8Lo0cloPrfyBmGHNjPK634mWw3cIR0mvopqwGfgVOo/CblpFKaLSt3TzUptydC3dKXshkvUXmPPDQ3WBRGUqWvaSXz59ddQte8K8iWULFC1roCuSkcyIOtHwYm+GgtB+XnJdQD8uDew3ZAbhePcBYyj+BNd+DvqUeCRs/j/4sikYrIUL0Ic5tELLAn5TG/Hw/bf8zic4rOJ67BlYRjAH9Irt4JXTOpzHg5QWdMxtIukcqj8bwi8KWjT/hRVPP+8YE6oaq6m5lXKfZSjbIZADJfvZwZXUmPUqmfSjGUB/XVzVWp71PGsT6vYuIGNVAgOkU60HroywoiokTxz1oY5YoPTmoOJ5d5J/BJ74CvCIDVwOoJMuU6VZhGaqI/mDPPI5waoF/nshEA34Q4+9Yb/GxCrg6TTiqM4FAbJXpzF+9bNSplF4nBDl+3SQ8mAsM0vHveSmbaUye4+9jBXuRi5EFHb2Nnmrhvbvzjba3yFfhNV7z1qjBzOcp5sOjDMvxAAna16GMz2WTYI7VZHGX8okgjthktgdEojph8T7fvaVLm1wDRS8UjzS37sJvKx5z4pln30VIntMaMaxO6x1P+G5DFx8eRVeghV9PzfxRcp35x8jH4osldGW1eHqOJ6KcOaE4wqvLDMQlFx+P2b 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:(13230022)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199015)(46966006)(36840700001)(40470700004)(36756003)(41300700001)(30864003)(2906002)(2616005)(1076003)(186003)(8936002)(5660300002)(36860700001)(70586007)(4326008)(8676002)(70206006)(40480700001)(44832011)(316002)(86362001)(6916009)(54906003)(7696005)(82310400005)(81166007)(82740400003)(83380400001)(356005)(336012)(40460700003)(478600001)(26005)(426003)(47076005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB10284 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6a3ad283-f2a0-4838-a2d5-08dab11e2773 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HKw6TYEN4zXhOGwGsZSQzcK4oF/VEzrJ5D8bAKeinvNadZfjVQKy78mL2cyDpa1QixpWTKzhhAYOFQFXewMtwCPYxXjRDzn4TDPRmMoQIqaana3/uaFwcYHCE91/oRdJfqIR1ZnMtVQB3GuM0DibZvG0qygQU/iWSiVLN9Z5AwcfEWt3EeZYcYRE+NKU9/a+XKb8qa9iG7BQhwitY1wUAv2OfUDyuVUvWnMeB4X5Dl6yFYDQRTV9got46Nx3vVVQZvOAaX6f84ZN2w0Nx3sC8p9cwnw/8sjl6lxbuROGVIRUFbOXID184HvLywrnR/xHrVQuzVoaHl2r7xm5Rf79P2KRupAmrkOqfA0SA6kD3mzkRC1FPGhTqWx0FuszWTzJY+toAhFtXCkfrpkXUjaFophzjIOiOu9dFMfxT6AQOzziVKxBNwzMtJ2SbAhRhxI3k746uXYdJnF4u1z/MKK0qra7vSeCIB+wbN4t8K6ppSUcoHoGEpdkKp0YKhTpEDnIT3AMeGAt2PKHKlNNDbONUXEdBPy4kxYCf/gf8F7HPi6vzBXAg4pXJFAdan/sMLdy6V3NbL/TC3X/mvfE8bIeYR1/Y1oJbuIHgYiTphYr5fv2G1IVr67sV/ABV6UIYkT6lPHpx4GrjTjkv9RsFkmUS4WOyuXQ4gxZybpLJex8KywUt0rWGcw75RejOEWvyufNJwSqFLpuzIceUtdFMaQt4H7fNaiiWSGdNkUuScLEnTd5nBWgS+6YhJ/5S+lAPWEv3c5Qx8imWZtmShNfKwiUpw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(39860400002)(346002)(376002)(451199015)(40470700004)(36840700001)(46966006)(36756003)(36860700001)(40480700001)(40460700003)(81166007)(86362001)(8676002)(2616005)(82740400003)(70206006)(70586007)(2906002)(54906003)(6916009)(44832011)(478600001)(1076003)(4326008)(316002)(30864003)(41300700001)(47076005)(5660300002)(336012)(8936002)(426003)(186003)(26005)(83380400001)(82310400005)(7696005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 15:34:00.5912 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7486eba3-a99a-4aff-3362-08dab11e2e22 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: VI1EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB7897 Content-Type: text/plain 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 --- DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf | 4 +- DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c | 304 ++++++++++++++++++++ DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h | 133 +++++++++ 3 files changed, 440 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf index ad8b3d037c169ca848b5ea84fd1086b83f37876f..b09272d883c6f4f05eb03dcdab3efeda92b2fbb6 100644 --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf @@ -1,7 +1,7 @@ ## @file # Module that drives the table generation and installation process. # -# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved. +# Copyright (c) 2017 - 2022, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -22,6 +22,8 @@ [Defines] [Sources] DynamicTableManagerDxe.c + SmbiosTableDispatcher.c + SmbiosTableDispatcher.h [Packages] MdePkg/MdePkg.dec diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c new file mode 100644 index 0000000000000000000000000000000000000000..88907fecdde5e36d40ac22cd486391abbb853e38 --- /dev/null +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c @@ -0,0 +1,304 @@ +/** @file + Dynamic Smbios Table Dispatcher + + Copyright (c) 2022, Arm Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include +#include + +#include +#include + +extern +EFI_STATUS +EFIAPI +BuildAndInstallSmbiosTable ( + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol, + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo + ); + +#if !defined (MDEPKG_NDEBUG) + +/** + A string table describing the SMBIOS dispatcher states. +*/ +STATIC +CONST CHAR8 *SmbiosTableStateTxt[] = { + "StUnknown", + "StNotPresent", + "StPresent", + "StDispatched" +}; + +#endif + +/** + The SMBIOS dispatcher state table. + + The SMBIOS dispatcher state table is used to establish the dependency + order in which the SMBIOS tables are installed. This allows the SMBIOS + dispatcher to dispatch the dependent tables for installation before the + parent table is installed. + The SMBIOS_TABLE_DISPATCHER.Dependency[] field is used to establish the + dependency list. + Elements in the Dependency list are resolved by increasing index. However, + all orders are equivalent as: + - the Parent SMBIOS table will only be installed once all dependencies + have been satisfied. + - no cyclic dependency is allowed. + The dependency list is terminated by SMTT_NULL. +*/ +STATIC +SMBIOS_TABLE_DISPATCHER mSmBiosDispatcher[MAX_SMBIOS_TABLES] = { + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BIOS_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BASEBOARD_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_ENCLOSURE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PROCESSOR_INFORMATION, SMBIOS_TYPE_CACHE_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_MODULE_INFORMATON, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_CACHE_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_SLOTS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_OEM_STRINGS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_GROUP_ASSOCIATIONS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_EVENT_LOG, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_DEVICE, SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PORTABLE_BATTERY, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_RESET, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_HARDWARE_SECURITY, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_POWER_CONTROLS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_VOLTAGE_PROBE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_COOLING_DEVICE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_TEMPERATURE_PROBE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MANAGEMENT_DEVICE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MEMORY_CHANNEL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_IPMI_DEVICE_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_SYSTEM_POWER_SUPPLY, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ADDITIONAL_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_ONBOARD_DEVICES_EXTENDED_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_MANAGEMENT_CONTROLLER_HOST_INTERFACE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_TPM_DEVICE, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_PROCESSOR_ADDITIONAL_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_FIRMWARE_INVENTORY_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL), + SMBIOS_TABLE_DEP (SMBIOS_TYPE_STRING_PROPERTY_INFORMATION, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL, SMTT_NULL) +}; + +#if !defined (MDEPKG_NDEBUG) + +/** + Print the SMBIOS Table Dispatcher state information. + + @param Verbose Print detailed report +**/ +STATIC +VOID +EFIAPI +PrintDispatcherStatus ( + IN BOOLEAN Verbose + ) +{ + UINTN Index; + + DEBUG ((DEBUG_VERBOSE, "Dispatcher Status:\n")); + for (Index = 0; Index < ARRAY_SIZE (mSmBiosDispatcher); Index++) { + if ((!Verbose) && (mSmBiosDispatcher[Index].State < StPresent)) { + continue; + } + + DEBUG (( + DEBUG_VERBOSE, + "%02d: %10a [%02d, %02d, %02d, %02d, %02d]\n", + mSmBiosDispatcher[Index].TableType, + SmbiosTableStateTxt[mSmBiosDispatcher[Index].State], + mSmBiosDispatcher[Index].Dependency[0], + mSmBiosDispatcher[Index].Dependency[1], + mSmBiosDispatcher[Index].Dependency[2], + mSmBiosDispatcher[Index].Dependency[3], + mSmBiosDispatcher[Index].Dependency[4] + )); + } // for + + DEBUG ((DEBUG_VERBOSE, "\n")); +} + +#define DEBUG_PRINT_DISPATCHER_STATUS(Verbose) PrintDispatcherStatus (Verbose) +#else +#define DEBUG_PRINT_DISPATCHER_STATUS(x) +#endif + +/** + Initialise the SMBIOS table dispatcher. + + @param SmbiosTableInfo Pointer to the list of SMBIOS tables to be installed. + @param SmbiosTableCount Count of SMBIOS tables to be installed. +**/ +VOID +EFIAPI +InitSmbiosTableDispatcher ( + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *SmbiosTableInfo, + IN UINT32 SmbiosTableCount + ) +{ + UINTN Index; + SMBIOS_TABLE_TYPE TableType; + + // First search for the list of SMBIOS tables presented + // for installation and update the dispatcher status. + for (Index = 0; Index < SmbiosTableCount; Index++) { + TableType = SmbiosTableInfo[Index].TableType; + ASSERT (mSmBiosDispatcher[TableType].State != StPresent); + mSmBiosDispatcher[TableType].State = StPresent; + } + + // Mark the remaining tables as not presented for installation + for (Index = 0; Index < ARRAY_SIZE (mSmBiosDispatcher); Index++) { + if (mSmBiosDispatcher[Index].State == StUnknown) { + mSmBiosDispatcher[Index].State = StNotPresent; + } + } + + DEBUG_PRINT_DISPATCHER_STATUS (FALSE); +} + +/** Schedule the dispatch of a SMBIOS table. + + The SMBIOS dispatcher state table is used to establish the dependency + order in which the SMBIOS tables are installed. This allows the SMBIOS + dispatcher to dispatch the dependent tables for installation before the + parent table is installed. + The SMBIOS_TABLE_DISPATCHER.Dependency[] field is used to establish the + dependency list. + Elements in the Dependency list are resolved by increasing index. However, + all orders are equivalent as: + - the Parent SMBIOS table will only be installed once all dependencies + have been satisfied. + - no cyclic dependency is allowed. + The dependency list is terminated by SMTT_NULL. + + @param [in] TableType The SMBIOS table type to schedule for + dispatch. + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol + interface. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in] SmbiosProtocol Pointer to the SMBIOS protocol. + @param [in] SmbiosTableInfo Pointer to the SMBIOS table Info. + @param [in] SmbiosTableCount Count of SMBIOS table info objects. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND Required object is not found. + @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration Manager + is less than the Object size for the + requested object. +**/ +EFI_STATUS +EFIAPI +DispatchSmbiosTable ( + IN CONST SMBIOS_TABLE_TYPE TableType, + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol, + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo, + IN CONST UINT32 SmbiosTableCount + ) +{ + EFI_STATUS Status; + UINTN Index; + SMBIOS_TABLE_DISPATCHER *Disp; + + DEBUG ((DEBUG_VERBOSE, "->DP %02d\n", TableType)); + Disp = &mSmBiosDispatcher[TableType]; + if (Disp->State < StPresent) { + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : EFI_NOT_FOUND\n", TableType)); + return EFI_NOT_FOUND; + } + + if (Disp->State == StDispatched) { + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : EFI_ALREADY_STARTED\n", TableType)); + return EFI_ALREADY_STARTED; + } + + // Table is present so check the dependency. + for (Index = 0; Index < MAX_SMBIOS_DEPENDENCY; Index++) { + // Check if the dependency list is terminated by SMTT_NULL. + if (Disp->Dependency[Index] == SMTT_NULL) { + break; + } + + Status = DispatchSmbiosTable ( + Disp->Dependency[Index], + TableFactoryProtocol, + CfgMgrProtocol, + SmbiosProtocol, + SmbiosTableInfo, + SmbiosTableCount + ); + if (EFI_ERROR (Status)) { + if ((Status == EFI_ALREADY_STARTED) || (Status == EFI_NOT_FOUND)) { + // Some dependencies may already be satisfied + // as other tables may also have similar + // dependencies i.e. EFI_ALREADY_STARTED + // Or + // the dependent table may be optional + // and not provided i.e. EFI_NOT_FOUND. + continue; + } + + DEBUG ((DEBUG_VERBOSE, "<-DP %02d : Status = %d\n", TableType, Status)); + return Status; + } + } + + DEBUG ((DEBUG_VERBOSE, "DP %02d : Status = %d\n", TableType, Status)); + + // All dependencies satisfied - Install SMBIOS table + Disp->State = StDispatched; + // Find the SMBIOS table info matching the TableType + for (Index = 0; Index < SmbiosTableCount; Index++) { + if (SmbiosTableInfo[Index].TableType == TableType) { + break; + } + } + + Status = BuildAndInstallSmbiosTable ( + TableFactoryProtocol, + CfgMgrProtocol, + SmbiosProtocol, + &SmbiosTableInfo[Index] + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to install SMBIOS Table." \ + " Id = %u Status = %r\n", + SmbiosTableInfo[Index].TableGeneratorId, + Status + )); + } + + DEBUG_PRINT_DISPATCHER_STATUS (FALSE); + DEBUG ((DEBUG_VERBOSE, "<-DP %0d\n", TableType)); + return Status; +} diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..420e16f62d58cf295b27174ce78ce9e2697918cb --- /dev/null +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h @@ -0,0 +1,133 @@ +/** @file + + Copyright (c) 2022, Arm Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SMBIOS_TABLE_DISPATCHER_H_ +#define SMBIOS_TABLE_DISPATCHER_H_ + +#include +#include + +/** + A SMBIOS Table Type from the OEM range reserved for terminating + the SMBIOS table dispatch dependency. + + Note: According to the SMBIOS specification, Table Types 0 + through 127 (7Fh) are reserved for and defined by the + SMBIOS specification. + Types 128 through 256 (80h to FFh) are available for system and + OEM-specific information. + + This Dynamic SMBIOS table generation implementation defines + TableType FFh as a NULL table which is used by the Dynamic + SMBIOS table dispatcher to terminate the dependency list. +*/ +#define SMTT_NULL 0xFF + +/** + A macro defining the maximum number of dependendant SMBIOS tables + represented by the SMBIOS table dispatcher. +*/ +#define MAX_SMBIOS_DEPENDENCY 5 + +/** + A macro defining the maximum table types handled by the SMBIOS + table dispatcher. +*/ +#define MAX_SMBIOS_TABLES (SMBIOS_TYPE_STRING_PROPERTY_INFORMATION + 1) + +/** + A helper macro to populate the SMBIOS table dispatcher table +*/ +#define SMBIOS_TABLE_DEP(TableId, Dep1, Dep2, Dep3, Dep4, Dep5) \ + { \ + TableId, \ + StUnknown, \ + { Dep1, Dep2, Dep3, Dep4, Dep5 } \ + } + +/** + An enum desribing the states of the SMBIOS table dispatcher. +*/ +typedef enum SmbiosTableState { + StUnknown, ///< Initial state. + StNotPresent, ///< SMBIOS table is not present for installation. + StPresent, ///< SMBIOS table is present for installation. + StDispatched ///< SMBIOS table generators have been dispatched. +} SMBIOS_TABLE_STATE; + +/** + A structure describing the dependencies for a SMBIOS table and + the dispatcher state information. +*/ +typedef struct SmBiosTableDispatcher { + /// SMBIOS Structure/Table Type + SMBIOS_TABLE_TYPE TableType; + /// SMBIOS dispatcher state + SMBIOS_TABLE_STATE State; + /// SMBIOS Structure/Table dependency list + /// The list is terminated using SMTT_NULL. + SMBIOS_TABLE_TYPE Dependency[MAX_SMBIOS_DEPENDENCY]; +} SMBIOS_TABLE_DISPATCHER; + +/** + Initialise the SMBIOS table dispatcher. + + @param SmbiosTableInfo Pointer to the list of SMBIOS tables to be installed. + @param SmbiosTableCount Count of SMBIOS tables to be installed. +**/ +VOID +EFIAPI +InitSmbiosTableDispatcher ( + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *SmbiosTableInfo, + IN UINT32 SmbiosTableCount + ); + +/** Schedule the dispatch of a SMBIOS table. + + The SMBIOS dispatcher state table is used to establish the dependency + order in which the SMBIOS tables are installed. This allows the SMBIOS + dispatcher to dispatch the dependent tables for installation before the + parent table is installed. + The SMBIOS_TABLE_DISPATCHER.Dependency[] field is used to establish the + dependency list. + Elements in the Dependency list are resolved by increasing index. However, + all orders are equivalent as: + - the Parent SMBIOS table will only be installed once all dependencies + have been satisfied. + - no cyclic dependency is allowed. + The dependency list is terminated by SMTT_NULL. + + @param [in] TableType The SMBIOS table type to schedule for + dispatch. + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol + interface. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in] SmbiosProtocol Pointer to the SMBIOS protocol. + @param [in] SmbiosTableInfo Pointer to the SMBIOS table Info. + @param [in] SmbiosTableCount Count of SMBIOS table info objects. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND Required object is not found. + @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration Manager + is less than the Object size for the + requested object. +**/ +EFI_STATUS +EFIAPI +DispatchSmbiosTable ( + IN CONST SMBIOS_TABLE_TYPE TableType, + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol, + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo, + IN CONST UINT32 SmbiosTableCount + ); + +#endif // SMBIOS_TABLE_DISPATCHER_H_ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'