From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.70]) by mx.groups.io with SMTP id smtpd.web11.8682.1662994578383231594 for ; Mon, 12 Sep 2022 07:56:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=NZCiESUe; spf=pass (domain: arm.com, ip: 40.107.20.70, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=FddUOIuqsuhZ+t1PdF8oVzwAIlFS9XSU2DIIyJTc0B7ywHuCCZ39eM1dVAKMxY42UyR/ULPyJqOuszSwAKX4F/typm8riEb66H4mbYwhwnYi1x828RilImndoTnCoQZryHxPfpGP/jBkkJWF3HE9Nc3wPlqZf7qo+w2h5Nrv5KxQbZXpr/lkXA7kCh2t9M024kBsIlp/+itKf/udXy5Hgr1o29rj7JoUQjjpaYKrL5CauRaq/6AIVNUyzeaiBDdVpNsmVYxiz1qAgNgkWTJzQfS0g601N3S/hxlMxH6o4pL5cQrtAKsz72xntOLpzqgystVybDx9GLOn0qBkcUS4mA== 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=edBkwz5Z2LgGG44Z5T91yIONIEFJ0+EgJWk7TcATGN8=; b=n6kc50eWRLiH7Cfy8xAGUgJZlkkC1XW49Rt8kThN+KXmU7fyGCdkmcOf3FsbTPkwwAM8MID19//yTwp5kRbZP+4EFuAi7y4GJkFnfCH3z9p287dOrmBVn2oDcK6X0bcSK9fZhf3xaIAEYkiOvdQh4xWaqdbu4xwQ/jPZcUVMQDE6ygXLwMKGeM9DHfihuOEckiqsNhtEcoFZ/gnc8rMwYF1FgpsX+8LDjn5tktzgbXLm6api/BkhzHRrpovRe94Fup380pMEZDplvRivBeA5RqQSQj4VJUIB7qLSWKPAicAQssoGxO+aP1LySJUA/YRED/lJJoGUaTiqk0XTAxT3+w== 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] dkim=[1,1,header.d=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=edBkwz5Z2LgGG44Z5T91yIONIEFJ0+EgJWk7TcATGN8=; b=NZCiESUexKCwrkrpGpFkw3wAFxRvRYG265CHplH84qVq29aOWTPBQbWHjcm2kLqPJMiuRBiZ2tfBKCE5BwceQJWOamoXJ/pnuE9E0cC0/Iogqp13sswpd5M0AMt7JPGmnSBYiWeNwtnjT8Jwo63CS4Kuuf8VbrrHnZLwreg5v6w= Received: from DB6PR07CA0175.eurprd07.prod.outlook.com (2603:10a6:6:43::29) by AS8PR08MB8898.eurprd08.prod.outlook.com (2603:10a6:20b:5b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Mon, 12 Sep 2022 14:56:15 +0000 Received: from DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:43:cafe::dd) by DB6PR07CA0175.outlook.office365.com (2603:10a6:6:43::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.12 via Frontend Transport; Mon, 12 Sep 2022 14:56:15 +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 DBAEUR03FT061.mail.protection.outlook.com (100.127.143.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.13 via Frontend Transport; Mon, 12 Sep 2022 14:56:15 +0000 Received: ("Tessian outbound fa99bf31ee7d:v123"); Mon, 12 Sep 2022 14:56:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7453357bd2c74867 X-CR-MTA-TID: 64aa7808 Received: from 8d022e44f9fb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BD1A340A-EFF7-4A6A-BF41-1062BB51441F.1; Mon, 12 Sep 2022 14:56:03 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8d022e44f9fb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 12 Sep 2022 14:56:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5gxmbD9YbWdD6gLnMTAB3R3cCPb0vT+U1eeyrqomwBbbBILDShCDj9x64UUH+3C5+GD1nx/y1hEwiD4CTEZMlRwiDMYJhQGG0ArBT2bhHxLiaOgcM/7+6XE6rlxfdRAyOmw8JRbiCkn9cnCjBOd/Jb6dTeAMcSF/cFvABWLA/IU++rRrk2jy4S3QecEacQHArYOmuUwPtpL6nlzP/q3W4hu5fMCrcOeiLw/D/OzzjgIUJuCFzzJLqIKEDzMtoHVokK1y0ZFAkyfX5VUkDwGPtmsNTrYduL4Ab+RRPn4dhDVAopjMH9frp1+1uWv/UrM8Vql/bAqmVUeCatsFjVWSQ== 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=edBkwz5Z2LgGG44Z5T91yIONIEFJ0+EgJWk7TcATGN8=; b=ACcZzYQVIZpLNGAZDpIRcn85iOK2xv/yjLkQVhjWayQxtrAmrDpoPGSJmR3qcvDZVSng4Cd2HpHqacrTRGXBp3Ttia+qXRa12kii/p0p+VSLtG6whK8ngMn6n5gRp8Joueapt54WDbvh6gn8BntwKQlYW+JNqe4agc1iulX2E16o2NxsdFdJfq0PejxEt7C3zTYfQLURL6bAraHr+96GWWqSqXWItth2J3ImxlyKVOyPg08y6FhPNUjMufw6pHYgZWOrtSTScLst8izXZamd9ZyzcfKhTLpAcif5ElvZxsUUQlf9D9PqOYyV6O+Nm6D2lC0R+hHeGKuF4FOYwMiKGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=edBkwz5Z2LgGG44Z5T91yIONIEFJ0+EgJWk7TcATGN8=; b=NZCiESUexKCwrkrpGpFkw3wAFxRvRYG265CHplH84qVq29aOWTPBQbWHjcm2kLqPJMiuRBiZ2tfBKCE5BwceQJWOamoXJ/pnuE9E0cC0/Iogqp13sswpd5M0AMt7JPGmnSBYiWeNwtnjT8Jwo63CS4Kuuf8VbrrHnZLwreg5v6w= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by DU0PR08MB7590.eurprd08.prod.outlook.com (2603:10a6:10:317::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Mon, 12 Sep 2022 14:56:00 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::b480:677a:ac9b:8f24]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::b480:677a:ac9b:8f24%7]) with mapi id 15.20.5612.022; Mon, 12 Sep 2022 14:56:00 +0000 Message-ID: <883fee40-4e85-b796-12b7-8ae3c2e78acd@arm.com> Date: Mon, 12 Sep 2022 15:55:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH 1/2] DynamicTablesPkg: Add SMBIOS table generation To: Girish Mahadevan , devel@edk2.groups.io, Alexei Fedorov Cc: Samer El-Haj-Mahmoud , Jeff Brasen , Ashish Singhal , Akanksha Jain , Matteo Carlini , Hemendra Dassanayake , Nick Ramirez , William Watson , "nd@arm.com" References: From: "Sami Mujawar" In-Reply-To: X-ClientProxiedBy: LO4P123CA0370.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::15) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6806:EE_|DU0PR08MB7590:EE_|DBAEUR03FT061:EE_|AS8PR08MB8898:EE_ X-MS-Office365-Filtering-Correlation-Id: ad5800f4-a379-4562-a3d2-08da94cef0e5 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: j+2+LnJeflJcId4JeZsUhc7I3BM4otFdTOtOEXrbfTmZa0dnQv1TDesFc2X1YOzrFGh8DgRwX63xINSFgjAdAtGGmsA0091IxU7sl8sMMMuBqieWTOTzsaa9md8GJncuIF2aw4nifz6tW82kQlbP8BcNQIiZQpPN8+yLK2QFcuUbiyabFoYkFs3Um5wZw3jRRiwGChRkGoYQ9+ckmVMASstrcETh17gbUiK2hU6f+0dRvp5SjfBtB1z7Uyz6bFGLmT9kuCILHimn7BNlAhTR/KQPFEcihFx8EGrSltM64CvKxKm6X01LJi3Et33G6+9r736ftC+OUWwSWQ5PdHwDPck2PLH1eaEvLXMuzyYLnfM1pJhMTa5eGh5F91qpKXiZbOZQHDWzEhkfAGCg6dAYE6h+eIqm63Lzl7azBv0kPH7a0d9lubbfnUrgoyVZnIv4Ja/1m0tsnR46t04dz7Q4McP5obkwFJx9Vm6KIdrzt2p8h5gkHUYwqNBwkCXihHR5ksMpBvSDWug+Z+eWR74lx/dYZFV7ZxmZV+MS7VcKGbB2AQnpGVfJLwLasM0lYgpF33mvlfZZPFB3oatqmWtt+wOCRq2+7cCWhcag2ZKYYYFsRlq3dv4xbEaTkzdP7KY6yWtnJSeP+LGw0A5YUlQM/WjnHiDG17/EquWHqYpAmOvRbwtOOJ681TOgJsqOKxA1CvKDfPvJD9K7nvxBE1hdq8LgbG1HJ1LDqJo6G7LTWe2Gr1WWz9oTTTc8mjVeTSvzSInOYuNSFNN7ZB8WCrzdVW5UjGPMHHfOFrdg689cw8UsoNql4yQOYV+SJseuwt+x X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(366004)(39860400002)(376002)(396003)(136003)(6506007)(6486002)(6512007)(53546011)(41300700001)(966005)(26005)(478600001)(2616005)(83380400001)(186003)(4326008)(2906002)(44832011)(5660300002)(30864003)(54906003)(8936002)(110136005)(316002)(6636002)(66556008)(66946007)(66476007)(38100700002)(8676002)(31686004)(31696002)(86362001)(36756003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7590 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 05debfdb-d197-483c-2d84-08da94cee7e0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hDJrseYHbsaLSiVNb05FFImOqL/BLBrtfAjO35mNzPGX6PfGrRzm19Bx0+Z0CEr4kyavDGhQmRoAGz1bhk1WwSOYZctspoMnJDHGeGMGSOyE1rr38Dgtzoa5ZuhDdsOBOEN74kxFmpw2DiGVLmHpPxRklUid8AYIWOjDNhFc1c+QQRqMjqdgJ3ZnQptEfQuXh9I4sWdqZ6u1xceEB30p6lYtnDgt11MrKU5e+qyaBCugYczgktuRr9mdcpjs2LZ48LOCr0DZPwp+1XdsQ/YwGAvH6rbCurJzrnD9oCtsysfUh6+JKNbWXajfVKsdyCa4S4hW8U33JxG5l1zfBrp9/6BAuBCEUTPEnwLew+sQ2C+2c5YL3okIXj9/sVrd9w9h+NjCFZF06Sivjbh+sfR46fRpZJ7tm2yJtxhBehgOGl5M4zXQBjK/3SiJ6rMW6kpXlQXUC+sLOTjYf5KnuRLs8QUsMdjdZ4kjO/vt8qCKTjFpwqyOibcOE8Hv2lpCxLAViR8Gv6HgS8yDRiEepvAppaCuEzYsaKN9FhpZqQvUynL4czRnZfBketGjNX4nh65+6sH5/VaxWntovp6qzPty5cKyxUG2NEqNujLO+uxloHVe9Hv5x9TMwUeMD4PFLhxJNe4OhVAzsZMrWh07SEeOtjesUxLXKt9oIc/tlRjEb56Ae73XiwBT2U36TtFaV3eybFcC6q7HeLBvsq1xaaOAfDzG7NHsSFwf2jwJfqYERmqRypSTBGAjlhyzXIXGLxa82NJ6in8/QQuYHbWu3sCbKo3VWer2Hle08Q7zcn31/TkXQci2C7zm6fJVTEig4XFKeNtIdqxOOfVz6W0NDhU44w== 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:(13230016)(4636009)(346002)(376002)(396003)(39860400002)(136003)(46966006)(36840700001)(40470700004)(81166007)(8676002)(82740400003)(70586007)(70206006)(4326008)(36860700001)(86362001)(31686004)(31696002)(36756003)(356005)(41300700001)(83380400001)(2616005)(53546011)(6512007)(6506007)(26005)(6486002)(966005)(478600001)(40480700001)(316002)(6636002)(47076005)(40460700003)(110136005)(54906003)(44832011)(336012)(2906002)(82310400005)(186003)(8936002)(5660300002)(30864003)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2022 14:56:15.2101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad5800f4-a379-4562-a3d2-08da94cef0e5 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: DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8898 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Girish, Thank you for this patch. I am having difficulty applying this patch locally. Is it possible to share this patch series on a github branch as well, please? It will greatly help me with the review. I normally include a link to my github branch (after the --- line) when positng to the mailing list see https://edk2.groups.io/g/devel/message/93651 Other than that, please see my response inline marked [SAMI]. Regards, Sami Mujawar On 26/08/2022 06:37 pm, Girish Mahadevan wrote: > Modify the DynamicTableManagerDxe driver to install SMBIOS tables in > addition to ACPI tables. > Instead of adding gEfiSmbiosProtocolGuid to the DEPEX list, setup > callback notifications for gEfiSmbiosProtocolGuid and > gEfiAcpiTableProtocolGuid and install the SMBIOS and ACPI tables > in the respective notification ready callback functions. > > Add the ability to install multiple SMBIOS tables to the SMBIOS > factory generator similar to ACPI. > > Signed-off-by: Girish Mahadevan > --- > .../DynamicTableManagerDxe.c | 585 +++++++++++++++++- > .../DynamicTableManagerDxe.inf | 2 +- > .../Include/SmbiosTableGenerator.h | 50 ++ > 3 files changed, 628 insertions(+), 9 deletions(-) > > diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c > index ed62299f9b..1642d6c387 100644 > --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c > +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c > @@ -8,9 +8,11 @@ > **/ > > #include > +#include > #include > #include > #include > +#include > > // Module specific include files. > #include > @@ -31,6 +33,18 @@ GET_OBJECT_LIST ( > CM_STD_OBJ_ACPI_TABLE_INFO > ) > > +/** This macro expands to a function that retrieves the SMBIOS Table > + List from the Configuration Manager. > +*/ > +GET_OBJECT_LIST ( > + EObjNameSpaceStandard, > + EStdObjSmbiosTableList, > + CM_STD_OBJ_SMBIOS_TABLE_INFO > + ) > + > +STATIC VOID *AcpiTableProtocolRegistration; > +STATIC VOID *SmbiosProtocolRegistration; > + > /** A helper function to build and install a single ACPI table. > > This is a helper function that invokes the Table generator interface > @@ -478,6 +492,449 @@ VerifyMandatoryTablesArePresent ( > return Status; > } > > +/** A helper function to build and install an SMBIOS table. > + > + This is a helper function that invokes the Table generator interface > + for building an SMBIOS table. It uses the SmbiosProtocol to install the > + table, then frees the resources allocated for generating it. > + > + @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. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +BuildAndInstallSingleSmbiosTable ( > + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, > + IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator, > + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol, > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo > + ) > +{ > + EFI_STATUS Status; > + EFI_STATUS Status1; > + SMBIOS_STRUCTURE *SmbiosTable; > + EFI_SMBIOS_HANDLE TableHandle; > + > + SmbiosTable = NULL; > + Status = Generator->BuildSmbiosTable ( > + Generator, > + SmbiosTableInfo, > + CfgMgrProtocol, > + &SmbiosTable > + ); [SAMI] I think we may have to add another out parameter to the BuildSmbiosTable () and BuildSmbiosTableEx () interfaces. This parameter shall be a Reference Token that shall be a key in the mapping of Reference Token to the SMBIOS record handle. Please see my feedback in patch 2/2 about the need for a SMBIOS HandleManager. [/SAMI] > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to Build Table." \ > + " TableGeneratorId = 0x%x. Status = %r\n", > + SmbiosTableInfo->TableGeneratorId, > + Status > + )); > + // Free any allocated resources. > + goto exit_handler; > + } > + > + if (SmbiosTable == NULL) { > + Status = EFI_NOT_FOUND; > + goto exit_handler; > + } > + > + TableHandle = SMBIOS_HANDLE_PI_RESERVED; > + // Install SMBIOS table > + Status = SmbiosProtocol->Add ( > + SmbiosProtocol, > + NULL, > + &TableHandle, > + SmbiosTable > + ); [SAMI] I think we need to call an SMBIOS HandleManager interface to map the ReferenceToken received from BuildSmbiosTable () and BuildSmbiosTableEx () and associate it with the TableHandle. > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to Install SMBIOS Table. Status = %r\n", > + Status > + )); > + // Free any allocated resources. > + goto exit_handler; > + } > + > + DEBUG (( > + DEBUG_INFO, > + "INFO: SMBIOS Table installed. Status = %r\n", > + Status > + )); > + > +exit_handler: > + // Free any resources allocated for generating the tables. > + if (Generator->FreeTableResources != NULL) { > + Status1 = Generator->FreeTableResources ( > + Generator, > + SmbiosTableInfo, > + CfgMgrProtocol, > + &SmbiosTable > + ); > + if (EFI_ERROR (Status1)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to Free Table Resources." \ > + "TableGeneratorId = 0x%x. Status = %r\n", > + SmbiosTableInfo->TableGeneratorId, > + Status1 > + )); > + } > + > + // Return the first error status in case of failure > + if (!EFI_ERROR (Status)) { > + Status = Status1; > + } > + } > + > + return Status; > +} > + > +/** A helper function to build and install multiple SMBIOS tables. > + > + This is a helper function that invokes the Table generator interface > + for building SMBIOS tables. It uses the SmbiosProtocol to install the > + tables, then frees the resources allocated for generating it. > + > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol > + interface. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol Interface. > + @param [in] Generator Pointer to the SmbiosTable generator. > + @param [in] SmbiosProtocol Pointer to the Smbios protocol. > + @param [in] AcpiTableInfo 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. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +BuildAndInstallMultipleSmbiosTables ( > + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, > + IN CONST SMBIOS_TABLE_GENERATOR *CONST Generator, > + IN EFI_SMBIOS_PROTOCOL *SmbiosProtocol, > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo > + ) > +{ > + EFI_STATUS Status; > + EFI_STATUS Status1; > + SMBIOS_STRUCTURE **SmbiosTable; > + EFI_SMBIOS_HANDLE TableHandle; > + UINTN TableCount; > + UINTN Index; > + > + TableCount = 0; > + Status = Generator->BuildSmbiosTableEx ( > + Generator, > + SmbiosTableInfo, > + CfgMgrProtocol, > + &SmbiosTable, > + &TableCount > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to Build Table." \ > + " TableGeneratorId = 0x%x. Status = %r\n", > + SmbiosTableInfo->TableGeneratorId, > + Status > + )); > + // Free any allocated resources. > + goto exit_handler; > + } > + > + if ((SmbiosTable == NULL) || (TableCount == 0)) { > + Status = EFI_NOT_FOUND; > + DEBUG (( > + DEBUG_ERROR, > + "%a: TableCount %u SmbiosTable %p \n", > + __FUNCTION__, > + TableCount, > + SmbiosTable > + )); > + goto exit_handler; > + } > + > + for (Index = 0; Index < TableCount; Index++) { > + TableHandle = SMBIOS_HANDLE_PI_RESERVED; > + // Install SMBIOS table > + Status = SmbiosProtocol->Add ( > + SmbiosProtocol, > + NULL, > + &TableHandle, > + SmbiosTable[Index] > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to Install SMBIOS Table. Status = %r\n", > + Status > + )); > + // Free any allocated resources. > + goto exit_handler; > + } > + > + DEBUG (( > + DEBUG_INFO, > + "INFO: SMBIOS Table installed. Status = %r\n", > + Status > + )); > + } > + > +exit_handler: > + // Free any resources allocated for generating the tables. > + if (Generator->FreeTableResourcesEx != NULL) { > + Status1 = Generator->FreeTableResourcesEx ( > + Generator, > + SmbiosTableInfo, > + CfgMgrProtocol, > + &SmbiosTable, > + TableCount > + ); > + if (EFI_ERROR (Status1)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to Free Table Resources." \ > + "TableGeneratorId = 0x%x. Status = %r\n", > + SmbiosTableInfo->TableGeneratorId, > + Status1 > + )); > + } > + > + // Return the first error status in case of failure > + if (!EFI_ERROR (Status)) { > + Status = Status1; > + } > + } > + > + return Status; > +} > + > +/** A helper function to invoke a Table generator > + > + This is a helper function that invokes the Table generator interface > + for building an SMBIOS table. It uses the SmbiosProtocol to install the > + table, then frees the resources allocated for generating it. > + > + @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. > +**/ > +STATIC > +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 > + ) > +{ > + EFI_STATUS Status; > + CONST SMBIOS_TABLE_GENERATOR *Generator; > + > + ASSERT (TableFactoryProtocol != NULL); > + ASSERT (CfgMgrProtocol != NULL); > + ASSERT (SmbiosProtocol != NULL); > + ASSERT (SmbiosTableInfo != NULL); > + > + DEBUG (( > + DEBUG_INFO, > + "INFO: EStdObjSmbiosTableList: Address = 0x%p," \ > + " TableGeneratorId = 0x%x\n", > + SmbiosTableInfo, > + SmbiosTableInfo->TableGeneratorId > + )); > + > + Generator = NULL; > + Status = TableFactoryProtocol->GetSmbiosTableGenerator ( > + TableFactoryProtocol, > + SmbiosTableInfo->TableGeneratorId, > + &Generator > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Table Generator not found." \ > + " TableGeneratorId = 0x%x. Status = %r\n", > + SmbiosTableInfo->TableGeneratorId, > + Status > + )); > + return Status; > + } > + > + if (Generator == NULL) { > + return EFI_NOT_FOUND; > + } > + > + DEBUG (( > + DEBUG_INFO, > + "INFO: Generator found : %s\n", > + Generator->Description > + )); > + > + if (Generator->BuildSmbiosTableEx != NULL) { > + Status = BuildAndInstallMultipleSmbiosTables ( > + TableFactoryProtocol, > + CfgMgrProtocol, > + Generator, > + SmbiosProtocol, > + SmbiosTableInfo > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to find build and install SMBIOS Tables." \ > + " Status = %r\n", > + Status > + )); > + } > + } else if (Generator->BuildSmbiosTable != NULL) { > + Status = BuildAndInstallSingleSmbiosTable ( > + TableFactoryProtocol, > + CfgMgrProtocol, > + Generator, > + SmbiosProtocol, > + SmbiosTableInfo > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to find build and install SMBIOS Table." \ > + " Status = %r\n", > + Status > + )); > + } > + } else { > + Status = EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Table Generator does not implement the" \ > + "SMBIOS_TABLE_GENERATOR_BUILD_TABLE interface." \ > + " TableGeneratorId = 0x%x. Status = %r\n", > + SmbiosTableInfo->TableGeneratorId, > + Status > + )); > + } > + > + return Status; > +} > + > +/** Generate and install SMBIOS tables. > + > + The function gathers the information necessary for installing the > + SMBIOS tables from the Configuration Manager, invokes the generators > + and installs them (via BuildAndInstallAcpiTable). > + > + @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol > + interface. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol Interface. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_NOT_FOUND If a mandatory table or a generator is not found. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +ProcessSmbiosTables ( > + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_PROTOCOL *SmbiosProtocol; > + CM_STD_OBJ_SMBIOS_TABLE_INFO *SmbiosTableInfo; > + UINT32 SmbiosTableCount; > + UINT32 Idx; > + > + Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&SmbiosProtocol); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", Status)); > + return Status; > + } > + > + Status = GetEStdObjSmbiosTableList ( > + CfgMgrProtocol, > + CM_NULL_TOKEN, > + &SmbiosTableInfo, > + &SmbiosTableCount > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to get SMBIOS Table List. Status = %r\n", > + Status > + )); > + return Status; > + } > + > + if (SmbiosTableCount == 0) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: EStdObjSmbiosTableList: SmbiosTableCount = %d\n", > + SmbiosTableCount > + )); > + return EFI_NOT_FOUND; > + } > + [SAMI] I think we may need some additional code to sequence the dependency of SMBIOS table generation. Please see my feedback about SMBIOS Handle Manager in patch 2/2. > + DEBUG (( > + DEBUG_INFO, > + "INFO: EStdObjSmbiosTableList: SmbiosTableCount = %d\n", > + SmbiosTableCount > + )); > + > + for (Idx = 0; Idx < SmbiosTableCount; Idx++) { > + Status = BuildAndInstallSmbiosTable ( > + TableFactoryProtocol, > + CfgMgrProtocol, > + SmbiosProtocol, > + &SmbiosTableInfo[Idx] > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to install SMBIOS Table." \ > + " Id = %u Status = %r\n", > + SmbiosTableInfo[Idx].TableGeneratorId, > + Status > + )); > + } > + } > + > + return Status; > +} > + > /** Generate and install ACPI tables. > > The function gathers the information necessary for installing the > @@ -664,11 +1121,11 @@ ProcessAcpiTables ( > @retval EFI_NOT_FOUND Required interface/object was not found. > @retval EFI_INVALID_PARAMETER Some parameter is incorrect/invalid. > **/ > -EFI_STATUS > -EFIAPI > -DynamicTableManagerDxeInitialize ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > +STATIC > +VOID > +AcpiTableProtocolReady ( > + IN EFI_EVENT Event, > + IN VOID *Context > ) > { > EFI_STATUS Status; > @@ -689,7 +1146,7 @@ DynamicTableManagerDxeInitialize ( > " Status = %r\n", > Status > )); > - return Status; > + return; > } > > // Locate the Configuration Manager for the Platform > @@ -704,7 +1161,7 @@ DynamicTableManagerDxeInitialize ( > "ERROR: Failed to find Configuration Manager protocol. Status = %r\n", > Status > )); > - return Status; > + return; > } > > Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo); > @@ -714,7 +1171,7 @@ DynamicTableManagerDxeInitialize ( > "ERROR: Failed to get Configuration Manager info. Status = %r\n", > Status > )); > - return Status; > + return; > } > > DEBUG (( > @@ -737,6 +1194,118 @@ DynamicTableManagerDxeInitialize ( > Status > )); > } > +} > + > +STATIC > +VOID > +SmbiosProtocolReady ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol; > + CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *CfgMfrInfo; > + EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *TableFactoryProtocol; > + > + // Locate the Dynamic Table Factory > + Status = gBS->LocateProtocol ( > + &gEdkiiDynamicTableFactoryProtocolGuid, > + NULL, > + (VOID **)&TableFactoryProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to find Dynamic Table Factory protocol." \ > + " Status = %r\n", > + Status > + )); > + return; > + } > + > + // Locate the Configuration Manager for the Platform > + Status = gBS->LocateProtocol ( > + &gEdkiiConfigurationManagerProtocolGuid, > + NULL, > + (VOID **)&CfgMgrProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to find Configuration Manager protocol. Status = %r\n", > + Status > + )); > + return; > + } > + > + Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: Failed to get Configuration Manager info. Status = %r\n", > + Status > + )); > + return; > + } > + > + DEBUG (( > + DEBUG_INFO, > + "INFO: Configuration Manager Version = 0x%x, OemID = %c%c%c%c%c%c\n", > + CfgMfrInfo->Revision, > + CfgMfrInfo->OemId[0], > + CfgMfrInfo->OemId[1], > + CfgMfrInfo->OemId[2], > + CfgMfrInfo->OemId[3], > + CfgMfrInfo->OemId[4], > + CfgMfrInfo->OemId[5] > + )); > + > + Status = ProcessSmbiosTables (TableFactoryProtocol, CfgMgrProtocol); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "ERROR: SMBIOS Table processing failure. Status = %r\n", > + Status > + )); > + } > +} > + > +EFI_STATUS > +EFIAPI > +DynamicTableManagerDxeInitialize ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + EFI_EVENT AcpiEvent; > + EFI_EVENT SmbiosEvent; > + > + AcpiEvent = EfiCreateProtocolNotifyEvent ( > + &gEfiAcpiTableProtocolGuid, > + TPL_CALLBACK, > + AcpiTableProtocolReady, > + NULL, > + &AcpiTableProtocolRegistration > + ); > + if (AcpiEvent == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to ACPI create protocol event\r\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + SmbiosEvent = EfiCreateProtocolNotifyEvent ( > + &gEfiSmbiosProtocolGuid, > + TPL_CALLBACK, > + SmbiosProtocolReady, > + NULL, > + &SmbiosProtocolRegistration > + ); > + if (SmbiosEvent == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to SMBIOS create protocol event\r\n", __FUNCTION__)); > + gBS->CloseEvent (AcpiEvent); > + return EFI_OUT_OF_RESOURCES; > + } > > return Status; > } > diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf > index 028c3d413c..ccf58f6099 100644 > --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf > +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf > @@ -36,12 +36,12 @@ > > [Protocols] > gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED > + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED > > gEdkiiConfigurationManagerProtocolGuid # PROTOCOL ALWAYS_CONSUMED > gEdkiiDynamicTableFactoryProtocolGuid # PROTOCOL ALWAYS_CONSUMED > > [Depex] > - gEfiAcpiTableProtocolGuid AND > gEdkiiConfigurationManagerProtocolGuid AND > gEdkiiDynamicTableFactoryProtocolGuid > > diff --git a/DynamicTablesPkg/Include/SmbiosTableGenerator.h b/DynamicTablesPkg/Include/SmbiosTableGenerator.h > index 934d56c90d..7bf6300d90 100644 > --- a/DynamicTablesPkg/Include/SmbiosTableGenerator.h > +++ b/DynamicTablesPkg/Include/SmbiosTableGenerator.h > @@ -168,6 +168,48 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) ( > IN SMBIOS_STRUCTURE **Table > ); > > +/** This function pointer describes the interface to SMBIOS table build > + functions provided by the SMBIOS table generator and called by the > + Table Manager to build an SMBIOS table. > + > + @param [in] Generator Pointer to the SMBIOS table generator. > + @param [in] SmbiosTableInfo Pointer to the SMBIOS table information. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol interface. > + @param [out] Table Pointer to the generated SMBIOS table. > + > + @return EFI_SUCCESS If the table is generated successfully or other > + failure codes as returned by the generator. > +**/ > +typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX) ( > + IN CONST SMBIOS_TABLE_GENERATOR *Generator, > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, > + OUT SMBIOS_STRUCTURE ***Table, > + OUT UINTN *CONST TableCount > + ); > + > +/** This function pointer describes the interface to used by the > + Table Manager to give the generator an opportunity to free > + any resources allocated for building the SMBIOS table. > + > + @param [in] Generator Pointer to the SMBIOS table generator. > + @param [in] SmbiosTableInfo Pointer to the SMBIOS table information. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol interface. > + @param [in] Table Pointer to the generated SMBIOS table. > + > + @return EFI_SUCCESS If freed successfully or other failure codes > + as returned by the generator. > +**/ > +typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLEEX) ( > + IN CONST SMBIOS_TABLE_GENERATOR *Generator, > + IN CONST CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, > + IN SMBIOS_STRUCTURE ***Table, > + IN CONST UINTN TableCount > + ); > + > /** The SMBIOS_TABLE_GENERATOR structure provides an interface that the > Table Manager can use to invoke the functions to build SMBIOS tables. > */ > @@ -189,6 +231,14 @@ typedef struct SmbiosTableGenerator { > allocated for building the SMBIOS table. > */ > SMBIOS_TABLE_GENERATOR_FREE_TABLE FreeTableResources; > + > + /// SMBIOS table extended build function pointer. > + SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX BuildSmbiosTableEx; > + > + /** The function to free any resources > + allocated for building the SMBIOS table. > + */ > + SMBIOS_TABLE_GENERATOR_FREE_TABLEEX FreeTableResourcesEx; > } SMBIOS_TABLE_GENERATOR; > > /** Register SMBIOS table factory generator.