From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 155AB740040 for ; Thu, 4 Jan 2024 05:09:53 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=TQx24YN9FuKyRjr8UWmFoeQfnN9jjXuriq8Ik2ITs5c=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1704344992; v=1; b=oiPzMIWdvr7eA9SiBcBmR+BL1rdqTYl/j1Z8VXcugZdA+KNpYAF0r4j114K1MEbZK4PH1r3M OP9XlRJbmO+OvL0gtQf0dp2NAgC6RgR1I+z0JQSUvbCqQdmnND/uv8x07qWYn5K8UBnIncX/n7S rzxg9LBTRhxYe+9i1MoZFsNw= X-Received: by 127.0.0.2 with SMTP id 6Lg3YY7687511xt2TrwyvFss; Wed, 03 Jan 2024 21:09:52 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.62]) by mx.groups.io with SMTP id smtpd.web11.47956.1704344992126818976 for ; Wed, 03 Jan 2024 21:09:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mVjDQ7LdtzFPcB9kxZ+0vxc+uTfOeBBLXOqEmh3kQTQeoZ4LGcsGV0T2Ln5HJrxX2V81nJmvlknp35OX/3EeGD6PXAdvFk6nEmWre/pNdoLt7XRIJiVbTp0rSdLnxOStQqO7b4LSBUU4JsQblSX4qKxEXSUpyFNa4im/l+gCI3ORYHRKcsTU5sEJ+rpEJoZiXpojyGiNgnTF732/nAiFlMh7Z6UVMcsyQq1go0enXCasQV9xURv00X1dKj+w2q777PfBJ5GJJ5HBD7QRgatX6tIbRJjAqRHQED2c7Sac9JPOfckJYGfqCsex26MswPPIjlWkzcWiQY9l3Tjme37gjw== 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=VAmDQFkPjgvmTrwt5FQ27JMzZ6iG7DxvYQbbRwI/3xo=; b=cpNR54ZkVOuDA1c0I2hsgO+RSXm1Uw5nFzuz4eE6pKx5xqTSl9vgJ0xemAdZ7/WK9lO5ooxoh0mUv2l5tLFSFqTWbZwvla+hDsbygr877Fwmd/hY+inQB3gXBJd2yoTp8sGOmRvdPQt6G2y3+dz6kVMB1x/9hO2mM4Gotu3WZY2FUGjPYpZGWedPpnvtNWLP3D8hXAb3U47OJRfOoGYw0HDOOheqXgVWd14PNsyNHLIkwcc82Fr4KnMgycJWXZECBHFxOVgNXa35EGpTDhqugy+2lLSRmB8UPt53hpvg7BktGwNZsQIwFeC4bSvadhmk4OWQ5dbiA2+t/EkZZ3BvRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) X-Received: from BYAPR11CA0083.namprd11.prod.outlook.com (2603:10b6:a03:f4::24) by DS0PR12MB6630.namprd12.prod.outlook.com (2603:10b6:8:d2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Thu, 4 Jan 2024 05:09:48 +0000 X-Received: from SJ5PEPF000001D0.namprd05.prod.outlook.com (2603:10b6:a03:f4:cafe::b0) by BYAPR11CA0083.outlook.office365.com (2603:10b6:a03:f4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.22 via Frontend Transport; Thu, 4 Jan 2024 05:09:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.160) by SJ5PEPF000001D0.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 05:09:47 +0000 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 3 Jan 2024 21:09:34 -0800 X-Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 3 Jan 2024 21:09:33 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 3 Jan 2024 21:09:32 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg/Features: introduce boot option collection Date: Thu, 4 Jan 2024 13:09:32 +0800 Message-ID: <20240104050932.70704-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D0:EE_|DS0PR12MB6630:EE_ X-MS-Office365-Filtering-Correlation-Id: e279a629-7b45-413e-ecdd-08dc0ce35f9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: aucs9MPgX3RB/1fzdbAvVAxXYT0rw2qT09TabX/7bjxcjvyjVJpLaD89xxOZD4rWFq+PC0JXyWjMo6MI7VKHBMgJLJH93zd5g7aOnUA73zSEG1VhTd1Gwc6yNsil7sHsJbDZTFDPDaGCrGI4ex8v1RAXyuN3uQQ3dP9DB0f1vsUQ3YAFGQTFWyIyFSAVO6qVln5OfYgergRNzhaLWuKzFK6ZFR9fSoGy3dLTe0oVTvudNA/cFxW/nG6/36pdDHdccqEplqXmDayDBX/ad0WgdwCpFu4UrnEofKPM1wcjAV8aReWWQlUm0eodWgOvzhykbqWs3A3f/ICeKj9I5kL4+DYTn1126rwjenegHVS0WhnvNxB0TzFPxuGaGqhwG+0vT7kX6F9e8cPniF/Wb1tHEdoQdV1W6p/IbEQ9/aYm6+rwVjr4qMYGg3qVN/IjqvvtCY2yAzLruS1DLaDtiCUs3zPWjOxLe1PKYfoq0+B81jE+fU+XiZoPLcnO1tYw13vp2AaiZNGzlvnNmMG2qggJ3EYardAfV+8RHnwvyKtREIagHare6Ls8tJOCrQDB2dnMRV8niIFw+kU3RxYWBAvVigQxVUg57XJs/mKOJgMYWNs3ThnqprQ+AZ69FR8fjFr4PgufpG8T4GxQEv1N0UH3EG4SKeNon9Sda4Gw9Jlk9DPDCQ9+nIUv+s8lst7SsjRbpjQhoH/1NQ/fQJAG7XVhoZxjOaEzVuFWKFtx/Uhig8uUt6766DmcUzoPQVL+84Ii7W0MJ9jrCMvTbP9DWkIxHQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 05:09:47.9747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e279a629-7b45-413e-ecdd-08dc0ce35f9c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6630 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: VOwfKh8cXgeif2ohN1lwHXDYx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=oiPzMIWd; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Introduce Redfish boot option collection driver and library. This is to support Redfish resource at: /redfish/v1/Systems/SYSTEM_ID/BootOptions Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../RedfishClientComponents.dsc.inc | 4 +- RedfishClientPkg/RedfishClientLibs.dsc.inc | 1 + .../BootOptionCollectionDxe.inf | 60 ++ .../BootOptionCollectionDxe.h | 33 + .../BootOptionCollectionDxe.c | 858 ++++++++++++++++++ RedfishClientPkg/RedfishClient.fdf.inc | 4 +- 6 files changed, 958 insertions(+), 2 deletions(-) create mode 100644 RedfishClientPkg/Features/BootOptionCollection/BootOpti= onCollectionDxe.inf create mode 100644 RedfishClientPkg/Features/BootOptionCollection/BootOpti= onCollectionDxe.h create mode 100644 RedfishClientPkg/Features/BootOptionCollection/BootOpti= onCollectionDxe.c diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClie= ntPkg/RedfishClientComponents.dsc.inc index 0e27198a..300f2e21 100644 --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc @@ -7,7 +7,7 @@ # "RedfishClientDefines.dsc.inc". # # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
-# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -32,6 +32,7 @@ } RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemColl= ectionDxe.inf RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf + RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.i= nf =20 !include RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc =20 @@ -43,3 +44,4 @@ RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSystem_V= 1_5_0_Dxe.inf RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerSyste= mCollection_Dxe.inf RedfishClientPkg/Converter/Bios/v1_0_9/RedfishBios_V1_0_9_Dxe.inf + RedfishClientPkg/Converter/BootOptionCollection/RedfishBootOptionCollect= ion_Dxe.inf diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc b/RedfishClientPkg/= RedfishClientLibs.dsc.inc index 572f426e..f961d697 100644 --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc @@ -23,6 +23,7 @@ ComputerSystemV1_5_0Lib|RedfishClientPkg/ConverterLib/edk2library/Comput= erSystem/v1_5_0/Lib.inf ComputerSystemCollectionLib|RedfishClientPkg/ConverterLib/edk2library/Co= mputerSystemCollection/Lib.inf BiosV1_0_9Lib|RedfishClientPkg/ConverterLib/edk2library/Bios/v1_0_9/Lib.= inf + BootOptionCollectionLib|RedfishClientPkg/ConverterLib/edk2library/BootOp= tionCollection/Lib.inf # # Above modules should be pulled in by build tool. # diff --git a/RedfishClientPkg/Features/BootOptionCollection/BootOptionColle= ctionDxe.inf b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCol= lectionDxe.inf new file mode 100644 index 00000000..7977fa46 --- /dev/null +++ b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDx= e.inf @@ -0,0 +1,60 @@ +## @file +# +# Redfish BootOptionCollection collection driver. +# +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BootOptionCollectionDxe + FILE_GUID =3D C66FAB8D-38D0-424D-86F4-F3A37204F7D7 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RedfishCollectionEntryPoint + UNLOAD_IMAGE =3D RedfishCollectionUnload + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishPkg/RedfishPkg.dec + RedfishClientPkg/RedfishClientPkg.dec + +[Sources] + BootOptionCollectionDxe.h + BootOptionCollectionDxe.c + +[LibraryClasses] + DebugLib + BaseMemoryLib + ConverterCommonLib + MemoryAllocationLib + RedfishFeatureUtilityLib + RedfishLib + UefiLib + UefiDriverEntryPoint + UefiBootServicesTableLib + EdkIIRedfishResourceConfigLib + RedfishVersionLib + RedfishHttpCacheLib + UefiBootManagerLib + DevicePathLib + +[Protocols] + gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMED + gEfiRestJsonStructureProtocolGuid ## CONSUMED + gEdkIIRedfishFeatureProtocolGuid ## CONSUMED + +[Guids] + +[Pcd] + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize + +[Depex] + TRUE diff --git a/RedfishClientPkg/Features/BootOptionCollection/BootOptionColle= ctionDxe.h b/RedfishClientPkg/Features/BootOptionCollection/BootOptionColle= ctionDxe.h new file mode 100644 index 00000000..52488ed1 --- /dev/null +++ b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDx= e.h @@ -0,0 +1,33 @@ +/** @file + + Redfish feature driver implementation - internal header file + + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EFI_REDFISH_BOOT_OPTION_COLLECTION_H_ +#define EFI_REDFISH_BOOT_OPTION_COLLECTION_H_ + +#include +#include +#include +#include + +#define REDFISH_SCHEMA_NAME "BootOption" +#define REDFISH_SCHEMA_MAJOR "1" +#define REDFISH_SCHEMA_MINOR "0" +#define REDFISH_SCHEMA_ERRATA "4" +#define REDFISH_MANAGED_URI L"Systems/{}/BootOptio= ns" +#define MAX_URI_LENGTH 256 +#define REDFISH_BOOT_OPTION_REFERENCE_NAME "BootOptionReference" +#define REDFISH_BOOT_OPTION_PREFIX "Boot" +#define REDFISH_BOOT_OPTION_PREFIX_LEN 0x04 +#define REDFISH_BOOT_OPTION_NUM_LEN 0x04 +#define REDFISH_BOOT_OPTION_PARAMETER "?name=3D" +#define REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE DEBUG_INFO + +#endif diff --git a/RedfishClientPkg/Features/BootOptionCollection/BootOptionColle= ctionDxe.c b/RedfishClientPkg/Features/BootOptionCollection/BootOptionColle= ctionDxe.c new file mode 100644 index 00000000..54cabcbe --- /dev/null +++ b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDx= e.c @@ -0,0 +1,858 @@ +/** @file + + Redfish feature driver implementation - BootOptionCollection + + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "BootOptionCollectionDxe.h" + +REDFISH_COLLECTION_PRIVATE *mRedfishCollectionPrivate =3D NULL; + +/** + Process specific member in collection. + + @param[in] Private Pointer to private instance. + @param[in] Uri URI to this member. + + @retval EFI_SUCCESS collection member is handled successfull= y. + @retval Others Errors occur. + +**/ +EFI_STATUS +HandleResource ( + IN REDFISH_COLLECTION_PRIVATE *Private, + IN EFI_STRING Uri + ) +{ + EFI_STATUS Status; + REDFISH_SCHEMA_INFO SchemaInfo; + EFI_STRING ConfigLang; + BOOLEAN SystemRestDetected; + + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + // + // Resource match + // + + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: process resourc= e for: %s\n", __func__, Uri)); + + Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private->JsonS= tructProtocol, Uri, &SchemaInfo); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to get schema information from: %s %r= \n", __func__, Uri, Status)); + return Status; + } + + // + // Check and see if this is target resource that we want to handle. + // Some resource is handled by other provider so we have to make sure th= is first. + // + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: Identify for %s= \n", __func__, Uri)); + SystemRestDetected =3D FALSE; + ConfigLang =3D RedfishGetConfigLanguage (Uri); + if (ConfigLang =3D=3D NULL) { + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Priva= te->InformationExchange); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_UNSUPPORTED) { + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: \"%s\" is= not handled by us\n", __func__, Uri)); + return EFI_SUCCESS; + } else if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: \"%s\" ha= s nothing to handle\n", __func__, Uri)); + return EFI_SUCCESS; + } + + DEBUG ((DEBUG_ERROR, "%a: fail to identify resource: \"%s\": %r\n", = __func__, Uri, Status)); + return Status; + } + + // + // When there is no history record in UEFI variable, this is first boo= t or + // system is reset by defaulting command. The pending setting on BMC m= ay be + // a stale value so we will ignore pending settings in BMC. + // + SystemRestDetected =3D TRUE; + } else { + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: history recor= d found: %s\n", __func__, ConfigLang)); + FreePool (ConfigLang); + } + + // + // Check and see if target property exist or not even when collection me= mber exists. + // If not, we sill do provision. + // + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a Check for %s\n",= __func__, Uri)); + Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_UNSUPPORTED) { + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: \"%s\" is n= ot handled by us\n", __func__, Uri)); + return EFI_ABORTED; + } + + // + // The target property does not exist, do the provision to create prop= erty. + // + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a provision for = %s\n", __func__, Uri)); + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, P= rivate->InformationExchange, FALSE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to provision with GET mode: %r\n", = __func__, Status)); + } + + return Status; + } + + // + // Consume first. + // + if (SystemRestDetected) { + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a system has bee= n reset to default setting. ignore pending settings because they may be sta= le values\n", __func__)); + } else { + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a consume for %s= \n", __func__, Uri)); + Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to consume resource for: %s: %r\n",= __func__, Uri, Status)); + } + } + + // + // Patch. + // + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a update for %s\n"= , __func__, Uri)); + Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to update resource for: %s: %r\n", __= func__, Uri, Status)); + } + + return Status; +} + +/** + This function get boot option number from given Uri and mark the boot op= tion + in BootOptions array as processed. + + @param[in] RedfishService Pointer Redfish service. + @param[in] BootOptions Boot option array. + @param[in] BootOptionCount Number of boot option in BootOptions arr= ay. + @param[in] Uri The URI to get boot option information. + + @retval EFI_SUCCESS Boot option is marked successfully. + @retval Others Errors occur. + +**/ +EFI_STATUS +MarkBootOptionProcessed ( + IN REDFISH_SERVICE RedfishService, + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions, + IN UINTN BootOptionCount, + IN EFI_STRING Uri + ) +{ + UINTN Index; + REDFISH_RESPONSE Response; + EDKII_JSON_VALUE JsonValue; + EDKII_JSON_VALUE BootOptionReference; + EFI_STATUS Status; + CONST CHAR8 *BootReferenceString; + UINTN OptionNumber; + + if ((BootOptions =3D=3D NULL) || (BootOptionCount =3D=3D 0) || IS_EMPTY_= STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + // + // Get boot option reference attribute + // + ZeroMem (&Response, sizeof (REDFISH_RESPONSE)); + Status =3D RedfishHttpGetResource (RedfishService, Uri, &Response, TRUE)= ; + if (EFI_ERROR (Status) || (Response.Payload =3D=3D NULL)) { + DEBUG ((DEBUG_ERROR, "%a: failed to get resource from %s: %r", __func_= _, Uri, Status)); + return Status; + } + + JsonValue =3D RedfishJsonInPayload (Response.Payload); + if (!JsonValueIsObject (JsonValue)) { + Status =3D EFI_NOT_FOUND; + goto ON_RELEASE; + } + + BootOptionReference =3D JsonObjectGetValue (JsonValueGetObject (JsonValu= e), REDFISH_BOOT_OPTION_REFERENCE_NAME); + if (!JsonValueIsString (BootOptionReference)) { + Status =3D EFI_NOT_FOUND; + goto ON_RELEASE; + } + + BootReferenceString =3D JsonValueGetAsciiString (BootOptionReference); + if (BootReferenceString =3D=3D NULL) { + Status =3D EFI_NOT_FOUND; + goto ON_RELEASE; + } + + if (AsciiStrnCmp (BootReferenceString, REDFISH_BOOT_OPTION_PREFIX, REDFI= SH_BOOT_OPTION_PREFIX_LEN) !=3D 0) { + Status =3D EFI_NOT_FOUND; + goto ON_RELEASE; + } + + OptionNumber =3D AsciiStrHexToUintn (&BootReferenceString[4]); + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: boot option num= ber: 0x%x in %s\n", __func__, OptionNumber, Uri)); + + Status =3D EFI_NOT_FOUND; + for (Index =3D 0; Index < BootOptionCount; Index++) { + if (BootOptions[Index].OptionNumber =3D=3D OptionNumber) { + BootOptions[Index].Status =3D EFI_ALREADY_STARTED; + Status =3D EFI_SUCCESS; + break; + } + } + +ON_RELEASE: + + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + + return Status; +} + +/** + Create new member to collection resource. + + @param[in] Private Pointer to private instance. + @param[in] BootOption The boot option which will be updated to BMC. + + @retval EFI_SUCCESS New collection member is created success= fully. + @retval Others Errors occur. + +**/ +EFI_STATUS +CreateCollectionResource ( + IN REDFISH_COLLECTION_PRIVATE *Private, + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ) +{ + EFI_STATUS Status; + REDFISH_SCHEMA_INFO SchemaInfo; + EFI_STRING BootOptionUri; + UINTN UriSize; + + if ((Private =3D=3D NULL) || (BootOption =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + UriSize =3D (StrLen (Private->CollectionUri) + REDFISH_BOOT_OPTION= _PREFIX_LEN + REDFISH_BOOT_OPTION_NUM_LEN + sizeof (REDFISH_BOOT_OPTION_PAR= AMETER) + 1) * sizeof (CHAR16); + BootOptionUri =3D AllocateZeroPool (UriSize); + if (BootOptionUri =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Build URI with query parameter to deliver the boot option name + // + UnicodeSPrint (BootOptionUri, UriSize, L"%s%a%a%04X", Private->Collectio= nUri, REDFISH_BOOT_OPTION_PARAMETER, REDFISH_BOOT_OPTION_PREFIX, BootOption= ->OptionNumber); + + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: create resource= for collection for: %s\n", __func__, BootOptionUri)); + + AsciiStrCpyS (SchemaInfo.Schema, REDFISH_SCHEMA_STRING_SIZE, REDFISH_SCH= EMA_NAME); + AsciiStrCpyS (SchemaInfo.Major, REDFISH_SCHEMA_VERSION_SIZE, REDFISH_SCH= EMA_MAJOR); + AsciiStrCpyS (SchemaInfo.Minor, REDFISH_SCHEMA_VERSION_SIZE, REDFISH_SCH= EMA_MINOR); + AsciiStrCpyS (SchemaInfo.Errata, REDFISH_SCHEMA_VERSION_SIZE, REDFISH_SC= HEMA_ERRATA); + + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: supported schem= a: %a %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, SchemaInf= o.Minor, SchemaInfo.Errata)); + + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, BootOpti= onUri, Private->InformationExchange, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to create resource for: %s: %r\n", __= func__, BootOptionUri, Status)); + } + + return Status; +} + +/** + Process members in collection resource. + + @param[in] Private Pointer to private instance. + + @retval EFI_SUCCESS collection members are handled successfu= lly. + @retval Others Errors occur. + +**/ +EFI_STATUS +HandleCollectionResource ( + IN REDFISH_COLLECTION_PRIVATE *Private + ) +{ + EFI_STATUS Status; + EFI_REDFISH_BOOTOPTIONCOLLECTION *Collection; + EFI_REDFISH_BOOTOPTIONCOLLECTION_CS *CollectionCs; + RedfishCS_Link *List; + RedfishCS_Header *Header; + RedfishCS_Type_Uri_Data *UriData; + EFI_STRING MemberUri; + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; + UINTN BootOptionCount; + UINTN Index; + BOOLEAN IsLegacyOption; + + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if ((Private->JsonStructProtocol =3D=3D NULL) || (Private->CollectionJso= n =3D=3D NULL)) { + return EFI_NOT_READY; + } + + // + // Load boot options in system. + // + BootOptions =3D EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOpti= onTypeBoot); + + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: process collect= ion for: %s\n", __func__, Private->CollectionUri)); + + // + // Convert JSON text to C structure. + // + Status =3D Private->JsonStructProtocol->ToStructure ( + Private->JsonStructProtocol, + NULL, + Private->CollectionJson, + (EFI_REST_JSON_STRUCTURE_HEADER = **)&Collection + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, Statu= s)); + return Status; + } + + CollectionCs =3D Collection->BootOptionCollection; + + // + // Handle existing resources. + // + if ((*CollectionCs->Membersodata_count > 0) && !IsLinkEmpty (&Collection= Cs->Members)) { + List =3D GetFirstLink (&CollectionCs->Members); + while (TRUE) { + Header =3D (RedfishCS_Header *)List; + + if (Header->ResourceType =3D=3D RedfishCS_Type_Uri) { + UriData =3D (RedfishCS_Type_Uri_Data *)Header; + MemberUri =3D NULL; + MemberUri =3D StrAsciiToUnicode (UriData->Uri); + + ASSERT (MemberUri !=3D NULL); + + if (MemberUri !=3D NULL) { + Status =3D HandleResource (Private, MemberUri); + if (EFI_ERROR (Status)) { + if (Status !=3D EFI_ABORTED) { + DEBUG ((DEBUG_ERROR, "%a: process BootOptionCollection resou= rce: %a failed: %r\n", __func__, UriData->Uri, Status)); + } + } + + // + // This boot option is processed. + // + if (Status !=3D EFI_ABORTED) { + Status =3D MarkBootOptionProcessed (Private->RedfishService, B= ootOptions, BootOptionCount, MemberUri); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: mark boot option: %a failed: %r\n"= , __func__, UriData->Uri, Status)); + } + } + + FreePool (MemberUri); + } + } + + if (IsLinkAtEnd (&CollectionCs->Members, List)) { + break; + } + + List =3D GetNextLink (&CollectionCs->Members, List); + } + } + + // + // Handle new resources. + // + for (Index =3D 0; Index < BootOptionCount; Index++) { + // + // This boot option is handled already. + // + if (BootOptions[Index].Status =3D=3D EFI_ALREADY_STARTED) { + continue; + } + + // + // Don't display hidden boot options, but retain inactive ones. + // + if ((BootOptions[Index].Attributes & LOAD_OPTION_HIDDEN) !=3D 0) { + continue; + } + + // + // Group the legacy boot option in the sub title created dynamically + // + IsLegacyOption =3D (BOOLEAN)((DevicePathType (BootOptions[Index].FileP= ath) =3D=3D BBS_DEVICE_PATH) && + (DevicePathSubType (BootOptions[Index].File= Path) =3D=3D BBS_BBS_DP) + ); + + // + // Don't display legacy boot options + // + if (IsLegacyOption) { + continue; + } + + Status =3D CreateCollectionResource (Private, &BootOptions[Index]); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: can not create resource for: %s\n", __func= __, BootOptions[Index].Description)); + } + } + + // + // Release resource. + // + Private->JsonStructProtocol->DestoryStructure (Private->JsonStructProtoc= ol, (EFI_REST_JSON_STRUCTURE_HEADER *)Collection); + EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); + + return EFI_SUCCESS; +} + +EFI_STATUS +ReleaseCollectionResource ( + IN REDFISH_COLLECTION_PRIVATE *Private + ) +{ + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Release resource + // + if (Private->Response.Payload !=3D NULL) { + RedfishFreeResponse ( + Private->Response.StatusCode, + Private->Response.HeaderCount, + Private->Response.Headers, + Private->Response.Payload + ); + Private->Response.StatusCode =3D NULL; + Private->Response.HeaderCount =3D 0; + Private->Response.Headers =3D NULL; + Private->Response.Payload =3D NULL; + } + + if (Private->CollectionJson !=3D NULL) { + FreePool (Private->CollectionJson); + Private->CollectionJson =3D NULL; + } + + if (Private->RedfishVersion !=3D NULL) { + FreePool (Private->RedfishVersion); + Private->RedfishVersion =3D NULL; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +CollectionHandler ( + IN REDFISH_COLLECTION_PRIVATE *Private + ) +{ + EFI_STATUS Status; + + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: collection hand= ler for %s\n", __func__, Private->CollectionUri)); + + // + // Query collection from Redfish service. + // + Status =3D RedfishHttpGetResource (Private->RedfishService, Private->Col= lectionUri, &Private->Response, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: unable to get resource from: %s :%r\n", __fu= nc__, Private->CollectionUri, Status)); + goto ON_RELEASE; + } + + Private->CollectionPayload =3D Private->Response.Payload; + ASSERT (Private->CollectionPayload !=3D NULL); + + Private->CollectionJson =3D JsonDumpString (RedfishJsonInPayload (Privat= e->CollectionPayload), EDKII_JSON_COMPACT); + ASSERT (Private->CollectionJson !=3D NULL); + + Status =3D HandleCollectionResource (Private); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: unable to handle collection resource at: %s = :%r\n", __func__, Private->CollectionUri, Status)); + } + +ON_RELEASE: + + ReleaseCollectionResource (Private); + + return Status; +} + +/** + The callback function provided by Redfish Feature driver. + + @param[in] This Pointer to EDKII_REDFISH_FEATURE_PROT= OCOL instance. + @param[in] FeatureAction The action Redfish feature driver sho= uld take. + @param[in] Uri The collection URI. + @param[in] Context The context of Redfish feature driver= . + @param[in,out] InformationExchange The pointer to RESOURCE_INFORMATION_E= XCHANGE + + @retval EFI_SUCCESS Redfish feature driver callback is exec= uted successfully. + @retval Others Some errors happened. + + @retval EFI_SUCCESS Redfish feature driver callback is exec= uted successfully. + @retval Others Some errors happened. + +**/ +EFI_STATUS +EFIAPI +RedfishCollectionFeatureCallback ( + IN EDKII_REDFISH_FEATURE_PROTOCOL *This, + IN FEATURE_CALLBACK_ACTION FeatureAction, + IN VOID *Context, + IN OUT RESOURCE_INFORMATION_EXCHANGE *InformationExchange + ) +{ + EFI_STATUS Status; + REDFISH_SERVICE RedfishService; + REDFISH_COLLECTION_PRIVATE *Private; + EFI_STRING ResourceUri; + + if (FeatureAction !=3D CallbackActionStartOperation) { + return EFI_UNSUPPORTED; + } + + Private =3D (REDFISH_COLLECTION_PRIVATE *)Context; + + RedfishService =3D Private->RedfishService; + if (RedfishService =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: no Redfish service configured\n", __func__))= ; + return EFI_NOT_READY; + } + + // + // Save in private structure. + // + Private->InformationExchange =3D InformationExchange; + + // + // Find Redfish version on BMC + // + Private->RedfishVersion =3D RedfishGetVersion (RedfishService); + + // + // Create the full URI from Redfish service root. + // + ResourceUri =3D (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH * sizeof (C= HAR16)); + if (ResourceUri =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for full URI.\n", __= func__)); + return EFI_OUT_OF_RESOURCES; + } + + StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion); + StrCatS (ResourceUri, MAX_URI_LENGTH, InformationExchange->SendInformati= on.FullUri); + + // + // Initialize collection path + // + Private->CollectionUri =3D RedfishGetUri (ResourceUri); + if (Private->CollectionUri =3D=3D NULL) { + ASSERT (FALSE); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D CollectionHandler (Private); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: CollectionHandler failure: %r\n", __func__, = Status)); + } + + return EFI_SUCCESS; +} + +/** + Initialize a Redfish configure handler. + + This function will be called by the Redfish config driver to initialize = each Redfish configure + handler. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_HA= NDLER_PROTOCOL instance. + @param[in] RedfishConfigServiceInfo Redfish service information. + + @retval EFI_SUCCESS The handler has been initialized su= ccessfully. + @retval EFI_DEVICE_ERROR Failed to create or configure the R= EST EX protocol instance. + @retval EFI_ALREADY_STARTED This handler has already been initi= alized. + @retval Other Error happens during the initializa= tion. + +**/ +EFI_STATUS +EFIAPI +RedfishCollectionInit ( + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This, + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo + ) +{ + REDFISH_COLLECTION_PRIVATE *Private; + + Private =3D REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL (This); + + Private->RedfishService =3D RedfishCreateService (RedfishConfigServiceIn= fo); + if (Private->RedfishService =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + Stop a Redfish configure handler. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_HANDLER= _PROTOCOL instance. + + @retval EFI_SUCCESS This handler has been stoped successful= ly. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishCollectionStop ( + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This + ) +{ + REDFISH_COLLECTION_PRIVATE *Private; + + Private =3D REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL (This); + + if (Private->RedfishService !=3D NULL) { + RedfishCleanupService (Private->RedfishService); + Private->RedfishService =3D NULL; + } + + ReleaseCollectionResource (Private); + + if (Private->FeatureProtocol !=3D NULL) { + Private->FeatureProtocol->Unregister ( + Private->FeatureProtocol, + REDFISH_MANAGED_URI, + NULL + ); + } + + return EFI_SUCCESS; +} + +/** + Callback function when gEfiRestJsonStructureProtocolGuid is installed. + + @param[in] Event Event whose notification function is being invoked. + @param[in] Context Pointer to the notification function's context. +**/ +VOID +EFIAPI +EfiRestJasonStructureProtocolIsReady ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + if (mRedfishCollectionPrivate =3D=3D NULL) { + return; + } + + if (mRedfishCollectionPrivate->JsonStructProtocol !=3D NULL) { + return; + } + + Status =3D gBS->LocateProtocol ( + &gEfiRestJsonStructureProtocolGuid, + NULL, + (VOID **)&mRedfishCollectionPrivate->JsonStructProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __func__, Status)); + } + + gBS->CloseEvent (Event); +} + +/** + Callback function when gEdkIIRedfishFeatureProtocolGuid is installed. + + @param[in] Event Event whose notification function is being invoked. + @param[in] Context Pointer to the notification function's context. +**/ +VOID +EFIAPI +EdkIIRedfishFeatureProtocolIsReady ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + EDKII_REDFISH_FEATURE_PROTOCOL *FeatureProtocol; + + if (mRedfishCollectionPrivate =3D=3D NULL) { + return; + } + + if (mRedfishCollectionPrivate->FeatureProtocol !=3D NULL) { + return; + } + + Status =3D gBS->LocateProtocol ( + &gEdkIIRedfishFeatureProtocolGuid, + NULL, + (VOID **)&FeatureProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to locate gEdkIIRedfishFeatureProtoco= lGuid: %r\n", __func__, Status)); + gBS->CloseEvent (Event); + return; + } + + Status =3D FeatureProtocol->Register ( + FeatureProtocol, + REDFISH_MANAGED_URI, + RedfishCollectionFeatureCallback, + (VOID *)mRedfishCollectionPrivate + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to register %s: %r\n", __func__, REDF= ISH_MANAGED_URI, Status)); + } + + mRedfishCollectionPrivate->FeatureProtocol =3D FeatureProtocol; + + gBS->CloseEvent (Event); +} + +/** + Unloads an image. + + @param ImageHandle Handle that identifies the image to be unl= oaded. + + @retval EFI_SUCCESS The image has been unloaded. + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. + +**/ +EFI_STATUS +EFIAPI +RedfishCollectionUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; + + if (mRedfishCollectionPrivate =3D=3D NULL) { + return EFI_NOT_READY; + } + + ConfigHandler =3D NULL; + + // + // Firstly, find ConfigHandler Protocol interface in this ImageHandle. + // + Status =3D gBS->OpenProtocol ( + ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + (VOID **)&ConfigHandler, + NULL, + NULL, + EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL + ); + if (EFI_ERROR (Status) || (ConfigHandler =3D=3D NULL)) { + return Status; + } + + ConfigHandler->Stop (ConfigHandler); + + // + // Last, uninstall ConfigHandler Protocol. + // + Status =3D gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + ConfigHandler, + NULL + ); + + FreePool (mRedfishCollectionPrivate); + mRedfishCollectionPrivate =3D NULL; + + return Status; +} + +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { + RedfishCollectionInit, + RedfishCollectionStop +}; + +/** + This is the declaration of an EFI image entry point. This entry point is + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers includ= ing + both device drivers and bus drivers. It initialize the global variables = and + publish the driver binding protocol. + + @param[in] ImageHandle The firmware allocated handle for the UEFI= image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_ACCESS_DENIED EFI_ISCSI_INITIATOR_NAME_PROTOCOL was inst= alled unexpectedly. + @retval Others Other errors as indicated. +**/ +EFI_STATUS +EFIAPI +RedfishCollectionEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Registration; + + if (mRedfishCollectionPrivate !=3D NULL) { + return EFI_ALREADY_STARTED; + } + + mRedfishCollectionPrivate =3D AllocateZeroPool (sizeof (REDFISH_COLLECTI= ON_PRIVATE)); + CopyMem (&mRedfishCollectionPrivate->ConfigHandler, &mRedfishConfigHandl= er, sizeof (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL)); + + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + EFI_NATIVE_INTERFACE, + &mRedfishCollectionPrivate->ConfigHandler + ); + + EfiCreateProtocolNotifyEvent ( + &gEfiRestJsonStructureProtocolGuid, + TPL_CALLBACK, + EfiRestJasonStructureProtocolIsReady, + NULL, + &Registration + ); + + EfiCreateProtocolNotifyEvent ( + &gEdkIIRedfishFeatureProtocolGuid, + TPL_CALLBACK, + EdkIIRedfishFeatureProtocolIsReady, + NULL, + &Registration + ); + + return Status; +} diff --git a/RedfishClientPkg/RedfishClient.fdf.inc b/RedfishClientPkg/Redf= ishClient.fdf.inc index afa6555a..b8619417 100644 --- a/RedfishClientPkg/RedfishClient.fdf.inc +++ b/RedfishClientPkg/RedfishClient.fdf.inc @@ -6,7 +6,7 @@ # to be built in the firmware volume. # # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
-# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -23,6 +23,7 @@ INF RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf INF RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf INF RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf + INF RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionD= xe.inf =20 !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc # @@ -33,4 +34,5 @@ INF RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSyst= em_V1_5_0_Dxe.inf INF RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS= ystemCollection_Dxe.inf INF RedfishClientPkg/Converter/Bios/v1_0_9/RedfishBios_V1_0_9_Dxe.inf + INF RedfishClientPkg/Converter/BootOptionCollection/RedfishBootOptionCol= lection_Dxe.inf !endif --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113134): https://edk2.groups.io/g/devel/message/113134 Mute This Topic: https://groups.io/mt/103517655/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-