From nobody Sun May 12 12:39:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114481+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 170623084549314.676615539769273; Thu, 25 Jan 2024 17:00:45 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=bhGquyWzMXSLnM81CZJvUpGkBPHcEa/KFCnWiMu5lVs=; 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=1706230845; v=1; b=qmuswVmXarGM9ClNGjb08WKCW/L4i6Qg2sGT+9WmI2LdyzB6Sl6l+tH0P/1yF0UGK0kvhWxD raFixkjVyWRPbKcHaOi1jmO9nmCf5Oi4bP/SBKWz0ISTlQ1gvEyYGoaRcgK5Obu5YzonWQYPqMU qdDRvJ+OfPt2qzI6A03+NSDM= X-Received: by 127.0.0.2 with SMTP id lfXCYY1788612xcNmZGxPFGa; Thu, 25 Jan 2024 17:00:45 -0800 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.42]) by mx.groups.io with SMTP id smtpd.web10.4145.1706230844030979929 for ; Thu, 25 Jan 2024 17:00:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWZiToXNxonXIuIToEoCyq30jljFBcsii3dHxef4/MLBFwH1gW4gKnDQojzI9L9Vq9I14vc0+7dbgqug6MMpATkL1Ek9gYVjTzNip9hSNyLe5DR8+BfahQjlHjYxk90qsLApMBpzh1bXKQaYPlzUUZGR5Cq0/hyNvFO+VZN5Uv7Mruxmr7AdoPqPgGaFZscJpwLyGmqO32TEvDIz//FIFlztmn35As6TrFg3PFPrsVcCwIJonRXK/MZW9tjkR85Vl8sKcPP4RtYDD6+wPe0I216tPh+Usq3qnDR6PdKOAH3hngVP1AKlLIvkaVEc+pjITVyMDt9EzmZ8Ke5RfnspOw== 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=xGCYJaFsguLWl8GFR9NrQ4LW0rire6q5DQmU71R+DIQ=; b=BzxeePweyG1WLy5IEdAYUOdf6RbpblOkMCZe0L1Ii+LAx5Vr5UJ3J2rw9xOXEJe+Zi7K92ErEaLp2j8amP1VH9VdGNit3fwhc/eB21fhhk29MX2fXABmqQhluJVz59AZ6wIXMp4uNwS2vCNf2gZmbL9Z8+l904jCJLJYSjRdz9Wc5wPNtyk+GVI3z4WsfAzmW57fBp/CNqBULSveuhxqPQNbokJdxKsBmapTXZVmtYWJA5NopKxRJOgwNOreYDc/8qeBZ7jrLcuK+7auBlJ8r/ibECoPEb8H4H7SRfVtmOGgdKCT2XpN7Rr0myE2EJzHXjvX8dbRCcczsz3h63vjTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) X-Received: from BY5PR17CA0048.namprd17.prod.outlook.com (2603:10b6:a03:167::25) by CH3PR12MB8509.namprd12.prod.outlook.com (2603:10b6:610:157::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.26; Fri, 26 Jan 2024 01:00:38 +0000 X-Received: from SJ1PEPF00001CE0.namprd05.prod.outlook.com (2603:10b6:a03:167:cafe::b4) by BY5PR17CA0048.outlook.office365.com (2603:10b6:a03:167::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22 via Frontend Transport; Fri, 26 Jan 2024 01:00:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114481+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE0.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Fri, 26 Jan 2024 01:00:37 +0000 X-Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 25 Jan 2024 19:00:35 -0600 From: "Chang, Abner via groups.io" To: CC: Nickle Wang , Igor Kulchytskyy Subject: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver Date: Fri, 26 Jan 2024 09:00:23 +0800 Message-ID: <20240126010023.958-1-abner.chang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE0:EE_|CH3PR12MB8509:EE_ X-MS-Office365-Filtering-Correlation-Id: eb7669f6-cb7c-483c-f788-08dc1e0a35b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Vrvew/3oBnb3dIJpvogHw4+3XPy+uWlGsuDzCZ0RnTSflKZX5YFIXNcsNWSjt6naHn1x/dtbmaYGtXoYnnAqflfmEt4BUfCW+SyDapjv5t65bYit/YtnlMyJeLbEhTZ58Gf7PbHwaCrNJuKDO6gQ3PSsjYHH+6imsBp4meGX7lvM5IgfpCiZfAYyBzGTZutdV9fVBUDbZkONciA3/z7b5QZ3NlQ6tAhoeG3QIfb0JywPlrXoZPAhuMAKL+N1Noo7cdusnYUK6p2/bQqzTnLgNIL0A8++NabnRELjckWDnWfYdFpkU30/TwZ3Erd1hSqf0LLRATEwc1RU8YfG03PAH7tcZowJxXCgciyDmm20m5hYPHmtnh3aDvVenlafksmb995vZcS2OQHkNox8hapiczM29/vh4C221wI11h6X16pGUHZrWc6u/r1iHTUSDqZp8VuB4v12zglP2YUZ0bVKLq/l4jU3PbiFSVzpwfQNDbkxhb6gBYtwPEFQ5UV7bLzZdsGX9VwfsOW+Yji4pjimV+D6yXkB8O70Ogmg5czpaiPWjAyyoOdu8mUrS+ghRf0OKaVvtDa3yjOQsbbtFoDAWgZzSNLeUAptvB+F3NRk6Ytvr9li4BS5RrtawWSE+G5wlygqK1LAi91Awwohb+inRV5pPprzDu2+ivFCcSGawowC0mx0OaIvBlcE8100XXpeee76sCGUIVw89WGtSlgcueMPREgM4EIdeG41L+DXPwBvVltT88CKvScg4Z6qjNhssg3lo1rl+pUMPn8oW7ULVb7gDaKj2SSQuN6CA7LJdb8= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 01:00:37.7789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb7669f6-cb7c-483c-f788-08dc1e0a35b2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8509 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,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 8R9czCifHstJ8BGeoa84QtG7x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706230847436100003 Content-Type: text/plain; charset="utf-8" From: Abner Chang Initial version of edk2 Redfish feature of Redfish schema ComputerSystem_1_13_0. This driver handles ComputerSystem Boot properties but not all. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy --- .../v1_13_0/Dxe/ComputerSystemDxe.inf | 53 ++ .../v1_13_0/Common/ComputerSystemCommon.h | 29 + .../v1_13_0/Common/ComputerSystemCommon.c | 899 ++++++++++++++++++ .../v1_13_0/Dxe/ComputerSystemDxe.c | 702 ++++++++++++++ 4 files changed, 1683 insertions(+) create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/Co= mputerSystemDxe.inf create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common= /ComputerSystemCommon.h create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common= /ComputerSystemCommon.c create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/Co= mputerSystemDxe.c diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerS= ystemDxe.inf b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/Compute= rSystemDxe.inf new file mode 100644 index 0000000000..6bc5cb358e --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDx= e.inf @@ -0,0 +1,53 @@ +## @file +# +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D ComputerSystemDxe + FILE_GUID =3D D94362A1-C358-4059-B014-F07D1AE04F16 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RedfishResourceEntryPoint + UNLOAD_IMAGE =3D RedfishResourceUnload + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishPkg/RedfishPkg.dec + RedfishClientPkg/RedfishClientPkg.dec + +[Sources] + ../Common/ComputerSystemCommon.h + ../Common/ComputerSystemCommon.c + ComputerSystemDxe.c + +[LibraryClasses] + BaseMemoryLib + DebugLib + EdkIIRedfishResourceConfigLib + RedfishLib + RedfishFeatureUtilityLib + RedfishResourceIdentifyLib + UefiLib + UefiDriverEntryPoint + RedfishAddendumLib + RedfishHttpCacheLib + +[Protocols] + gEdkIIRedfishConfigHandlerProtocolGuid ## PRODUCED + gEfiRestJsonStructureProtocolGuid ## CONSUMED + gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED + +[Pcd] + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize + +[Depex] + TRUE diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Comput= erSystemCommon.h b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/= ComputerSystemCommon.h new file mode 100644 index 0000000000..c9c8512881 --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyste= mCommon.h @@ -0,0 +1,29 @@ +/** @file + + Redfish feature driver implementation - internal header file + (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 + +**/ + +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_ +#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_ + +#include +#include + +// +// Schema information. +// +#define RESOURCE_SCHEMA "ComputerSystem" +#define RESOURCE_SCHEMA_MAJOR "1" +#define RESOURCE_SCHEMA_MINOR "13" +#define RESOURCE_SCHEMA_ERRATA "0" +#define RESOURCE_SCHEMA_VERSION "v1_13_0" +#define REDPATH_ARRAY_PATTERN L"/Systems/\\{.*\\}/" +#define REDPATH_ARRAY_PREFIX L"/Systems/" +#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-ComputerSystem.v1_13_0" + +#endif diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Comput= erSystemCommon.c b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/= ComputerSystemCommon.c new file mode 100644 index 0000000000..bc24c49206 --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyste= mCommon.c @@ -0,0 +1,899 @@ +/** @file + Redfish feature driver implementation - common functions + + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "ComputerSystemCommon.h" + +CHAR8 ComputerSystemEmptyJson[] =3D "{\"@odata.id\": \"\", \"@odata.type\= ": \"#ComputerSystem.v1_13_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\"= , \"Boot\":{}}"; + +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =3D = NULL; +EFI_HANDLE mRedfishResourceConfigProtocolHandle =3D = NULL; + +/** + Consume resource from given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + @param[in] HeaderEtag The Etag string returned in HTTP header. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishConsumeResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *Json, + IN CHAR8 *HeaderEtag OPTIONAL + ) +{ + EFI_STATUS Status; + EFI_REDFISH_COMPUTERSYSTEM_V1_13_0 *ComputerSystem; + EFI_REDFISH_COMPUTERSYSTEM_V1_13_0_CS *ComputerSystemCs; + EFI_STRING ConfigureLang; + + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (Json)) { + return EFI_INVALID_PARAMETER; + } + + ComputerSystem =3D NULL; + ComputerSystemCs =3D NULL; + ConfigureLang =3D NULL; + + Status =3D Private->JsonStructProtocol->ToStructure ( + Private->JsonStructProtocol, + NULL, + Json, + (EFI_REST_JSON_STRUCTURE_HEADER = **)&ComputerSystem + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, Statu= s)); + return Status; + } + + ComputerSystemCs =3D ComputerSystem->ComputerSystem; + + // + // Check ETAG to see if we need to consume it + // + if (CheckEtag (Private->Uri, HeaderEtag, NULL)) { + // + // No change + // + DEBUG ((DEBUG_MANAGEABILITY, "%a: ETAG: %s has no change, ignore consu= me action\n", __func__, Private->Uri)); + Status =3D EFI_SUCCESS; + goto ON_RELEASE; + } + + // + // Handle BOOT + // + if (ComputerSystemCs->Boot =3D=3D NULL) { + ComputerSystemCs->Boot =3D AllocateZeroPool (sizeof (RedfishComputerSy= stem_V1_13_0_Boot_CS)); + ASSERT (ComputerSystemCs->Boot !=3D NULL); + } + + // + // Handle BOOT->BOOTNEXT + // + if (ComputerSystemCs->Boot->BootNext !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootNext"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootNext); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __func__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTORDER + // + if (ComputerSystemCs->Boot->BootOrder !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootOrder"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringArrayType (RESOURCE_SCHEMA, RES= OURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootOrder); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED + // + if (ComputerSystemCs->Boot->BootSourceOverrideEnabled !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideEnabled"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideE= nabled); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDEMODE + // + if (ComputerSystemCs->Boot->BootSourceOverrideMode !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideMode"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideM= ode); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDETARGET + // + if (ComputerSystemCs->Boot->BootSourceOverrideTarget !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideTarget"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideT= arget); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __func__, Private->Uri)); + } + } + + // + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE + // + if (ComputerSystemCs->Boot->UefiTargetBootSourceOverride !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= UefiTargetBootSourceOverride"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->UefiTargetBootSourc= eOverride); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); + } + } + +ON_RELEASE: + + // + // Release resource. + // + Private->JsonStructProtocol->DestoryStructure ( + Private->JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystem + ); + + return EFI_SUCCESS; +} + +EFI_STATUS +ProvisioningComputerSystemProperties ( + IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, + IN CHAR8 *InputJson, + IN CHAR8 *ResourceId OPTIONAL, + IN EFI_STRING ConfigureLang, + IN BOOLEAN ProvisionMode, + OUT CHAR8 **ResultJson + ) +{ + EFI_REDFISH_COMPUTERSYSTEM_V1_13_0 *ComputerSystem; + EFI_REDFISH_COMPUTERSYSTEM_V1_13_0_CS *ComputerSystemCs; + EFI_REDFISH_COMPUTERSYSTEM_V1_13_0 *ComputerSystemEmpty; + EFI_REDFISH_COMPUTERSYSTEM_V1_13_0_CS *ComputerSystemCsEmpty; + EFI_STATUS Status; + BOOLEAN PropertyChanged; + CHAR8 *AsciiStringValue; + CHAR8 **AsciiStringArrayValue; + UINTN ArraySize; + + if ((JsonStructProtocol =3D=3D NULL) || (ResultJson =3D=3D NULL) || IS_E= MPTY_STRING (InputJson) || IS_EMPTY_STRING (ConfigureLang)) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s with: %s\n", __func__,= ConfigureLang, (ProvisionMode ? L"Provision resource" : L"Update resource"= ))); + + *ResultJson =3D NULL; + PropertyChanged =3D FALSE; + + ComputerSystem =3D NULL; + Status =3D JsonStructProtocol->ToStructure ( + JsonStructProtocol, + NULL, + InputJson, + (EFI_REST_JSON_STRUCTURE_HEADER *= *)&ComputerSystem + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: ToStructure failure: %r\n", __func__, Status= )); + return Status; + } + + ComputerSystemEmpty =3D NULL; + Status =3D JsonStructProtocol->ToStructure ( + JsonStructProtocol, + NULL, + ComputerSystemEmptyJson, + (EFI_REST_JSON_STRUCTURE_HEA= DER **)&ComputerSystemEmpty + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: ToStructure failure: %r\n", __func__, Status= )); + return Status; + } + + ComputerSystemCs =3D ComputerSystem->ComputerSystem; + // + // Initial an empty ComputerSystemCS + // + ComputerSystemCsEmpty =3D ComputerSystemEmpty->ComputerSystem; + + // + // Handle BOOT + // + if (ComputerSystemCs->Boot !=3D NULL) { + // + // Handle BOOT->BOOTNEXT + // + if (PropertyChecker (ComputerSystemCs->Boot->BootNext, ProvisionMode))= { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootNext", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootNex= t, AsciiStringValue) !=3D 0)) { + ComputerSystemCsEmpty->Boot->BootNext =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + + // + // Handle BOOT->BOOTORDER + // + if (PropertyChecker (ComputerSystemCs->Boot->BootOrder, ProvisionMode)= ) { + AsciiStringArrayValue =3D GetPropertyStringArrayValue (RESOURCE_SCHE= MA, RESOURCE_SCHEMA_VERSION, L"Boot/BootOrder", ConfigureLang, &ArraySize); + if (AsciiStringArrayValue !=3D NULL) { + if (ProvisionMode || !CompareRedfishStringArrayValues (ComputerSys= temCs->Boot->BootOrder, AsciiStringArrayValue, ArraySize)) { + AddRedfishCharArray (&ComputerSystemCsEmpty->Boot->BootOrder, As= ciiStringArrayValue, ArraySize); + PropertyChanged =3D TRUE; + } + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED + // + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideEnabled= , ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideEnabled", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootSou= rceOverrideEnabled, AsciiStringValue) !=3D 0)) { + ComputerSystemCsEmpty->Boot->BootSourceOverrideEnabled =3D Ascii= StringValue; + PropertyChanged =3D TRUE; + } + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDEMODE + // + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideMode, P= rovisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideMode", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootSou= rceOverrideMode, AsciiStringValue) !=3D 0)) { + ComputerSystemCsEmpty->Boot->BootSourceOverrideMode =3D AsciiStr= ingValue; + PropertyChanged =3D TRUE; + } + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDETARGET + // + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideTarget,= ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideTarget", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootSou= rceOverrideTarget, AsciiStringValue) !=3D 0)) { + ComputerSystemCsEmpty->Boot->BootSourceOverrideTarget =3D AsciiS= tringValue; + PropertyChanged =3D TRUE; + } + } + } + + // + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE + // + if (PropertyChecker (ComputerSystemCs->Boot->UefiTargetBootSourceOverr= ide, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/UefiTargetBootSourceOverride", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->UefiTar= getBootSourceOverride, AsciiStringValue) !=3D 0)) { + ComputerSystemCsEmpty->Boot->UefiTargetBootSourceOverride =3D As= ciiStringValue; + PropertyChanged =3D TR= UE; + } + } + } + } + + // + // Convert C structure back to JSON text. + // + Status =3D JsonStructProtocol->ToJson ( + JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystemEmpty, + ResultJson + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status)); + return Status; + } + + if (PropertyChanged) { + // Remove Redfish unchangeable properties. + Status =3D RedfishRemoveUnchangeableProperties (ResultJson); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Fail to remove Redfish unchangeable proper= ties from ResultJson.\n", __func__)); + *ResultJson =3D NULL; + return Status; + } + } + + // + // Release resource. + // + JsonStructProtocol->DestoryStructure ( + JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem + ); + + // + // Free memory allocated for Computersystem empty CS + // + if (ComputerSystemCsEmpty->Boot->BootOrder !=3D NULL) { + DestoryRedfishCharArray (ComputerSystemCsEmpty->Boot->BootOrder, Array= Size); + } + + JsonStructProtocol->DestoryStructure ( + JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystemEm= pty + ); + return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND); +} + +EFI_STATUS +ProvisioningComputerSystemResource ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN UINTN Index, + IN EFI_STRING ConfigureLang + ) +{ + CHAR8 *Json; + CHAR8 *JsonWithAddendum; + EFI_STATUS Status; + EFI_STRING NewResourceLocation; + CHAR8 *EtagStr; + CHAR8 ResourceId[16]; + + if (IS_EMPTY_STRING (ConfigureLang) || (Private =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + EtagStr =3D NULL; + AsciiSPrint (ResourceId, sizeof (ResourceId), "%d", Index); + + Status =3D ProvisioningComputerSystemProperties ( + Private->JsonStructProtocol, + ComputerSystemEmptyJson, + ResourceId, + ConfigureLang, + TRUE, + &Json + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: provisioning resource for %s failed: %r\n", = __func__, ConfigureLang, Status)); + return Status; + } + + // + // Check and see if platform has OEM data or not + // + Status =3D RedfishGetOemData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + // + // Check and see if platform has addendum data or not + // + Status =3D RedfishGetAddendumData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + Status =3D CreatePayloadToPostResource (Private->RedfishService, Private= ->Payload, Json, &NewResourceLocation, &EtagStr); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: post ComputerSystem resource for %s failed: = %r\n", __func__, ConfigureLang, Status)); + goto RELEASE_RESOURCE; + } + + ASSERT (NewResourceLocation !=3D NULL); + + // + // Keep location of new resource. + // + if (NewResourceLocation !=3D NULL) { + RedfishSetRedfishUri (ConfigureLang, NewResourceLocation); + } + +RELEASE_RESOURCE: + + if (EtagStr !=3D NULL) { + FreePool (EtagStr); + } + + if (NewResourceLocation !=3D NULL) { + FreePool (NewResourceLocation); + } + + if (Json !=3D NULL) { + FreePool (Json); + } + + return Status; +} + +EFI_STATUS +ProvisioningComputerSystemResources ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private + ) +{ + UINTN Index; + EFI_STATUS Status; + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST UnifiedConfigureLangList; + + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHE= MA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &UnifiedConfigureLangLi= st); + if (EFI_ERROR (Status) || (UnifiedConfigureLangList.Count =3D=3D 0)) { + DEBUG ((DEBUG_ERROR, "%a: No HII question found with configure languag= e: %s: %r\n", __func__, REDPATH_ARRAY_PATTERN, Status)); + return EFI_NOT_FOUND; + } + + // + // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. + // This information is sent back to the parent resource (e.g. the collec= tion driver). + // + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHand= le, &UnifiedConfigureLangList); + + for (Index =3D 0; Index < UnifiedConfigureLangList.Count; Index++) { + DEBUG ((DEBUG_MANAGEABILITY, "[%d] create ComputerSystem resource from= : %s\n", UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangLi= st.List[Index].ConfigureLang)); + ProvisioningComputerSystemResource (Private, UnifiedConfigureLangList.= List[Index].Index, UnifiedConfigureLangList.List[Index].ConfigureLang); + FreePool (UnifiedConfigureLangList.List[Index].ConfigureLang); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +ProvisioningComputerSystemExistResource ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private + ) +{ + EFI_STATUS Status; + EFI_STRING ConfigureLang; + CHAR8 *Json; + CHAR8 *JsonWithAddendum; + + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Json =3D NULL; + ConfigureLang =3D NULL; + + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri); + if (ConfigureLang =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + Status =3D ProvisioningComputerSystemProperties ( + Private->JsonStructProtocol, + ComputerSystemEmptyJson, + NULL, + ConfigureLang, + TRUE, + &Json + ); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((DEBUG_MANAGEABILITY, "%a: provisioning existing resource for= %s ignored. Nothing changed\n", __func__, ConfigureLang)); + Status =3D EFI_SUCCESS; + } else { + DEBUG ((DEBUG_ERROR, "%a: provisioning existing resource for %s fail= ed: %r\n", __func__, ConfigureLang, Status)); + } + + goto ON_RELEASE; + } + + // + // Check and see if platform has OEM data or not + // + Status =3D RedfishGetOemData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + // + // Check and see if platform has addendum data or not + // + Status =3D RedfishGetAddendumData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + DEBUG ((DEBUG_MANAGEABILITY, "%a: provisioning existing resource for %s\= n", __func__, ConfigureLang)); + + // + // PUT back to instance + // + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: patch resource for %s failed: %r\n", __func_= _, ConfigureLang, Status)); + } + +ON_RELEASE: + + if (Json !=3D NULL) { + FreePool (Json); + } + + if (ConfigureLang !=3D NULL) { + FreePool (ConfigureLang); + } + + return Status; +} + +/** + Provisioning redfish resource by given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] ResourceExist TRUE if resource exists, PUT method wil= l be used. + FALSE if resource does not exist POST m= ethod is used. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishProvisioningResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN BOOLEAN ResourceExist + ) +{ + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + return (ResourceExist ? ProvisioningComputerSystemExistResource (Private= ) : ProvisioningComputerSystemResources (Private)); +} + +/** + Check resource from given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + @param[in] HeaderEtag The Etag string returned in HTTP header. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishCheckResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *Json, + IN CHAR8 *HeaderEtag OPTIONAL + ) +{ + UINTN Index; + EFI_STATUS Status; + EFI_STRING *ConfigureLangList; + UINTN Count; + EFI_STRING Property; + + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (Json)) { + return EFI_INVALID_PARAMETER; + } + + // + // Check ETAG to see if we need to check it + // + if (CheckEtag (Private->Uri, HeaderEtag, NULL)) { + // + // No change + // + DEBUG ((DEBUG_MANAGEABILITY, "%a: ETAG: %s has no change, ignore check= action\n", __func__, Private->Uri)); + return EFI_SUCCESS; + } + + Status =3D RedfishPlatformConfigGetConfigureLang (RESOURCE_SCHEMA, RESOU= RCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigureLangList, &Count); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed: %r\n", __func__, Status)); + return Status; + } + + if (Count =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + Status =3D EFI_SUCCESS; + for (Index =3D 0; Index < Count; Index++) { + Property =3D GetPropertyFromConfigureLang (Private->Uri, ConfigureLang= List[Index]); + if (Property =3D=3D NULL) { + continue; + } + + DEBUG ((DEBUG_MANAGEABILITY, "%a: [%d] check attribute for: %s\n", __f= unc__, Index, Property)); + if (!MatchPropertyWithJsonContext (Property, Json)) { + DEBUG ((DEBUG_MANAGEABILITY, "%a: property is missing: %s\n", __func= __, Property)); + Status =3D EFI_NOT_FOUND; + } + } + + FreePool (ConfigureLangList); + + return Status; +} + +/** + Update resource to given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishUpdateResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *InputJson + ) +{ + EFI_STATUS Status; + CHAR8 *Json; + CHAR8 *JsonWithAddendum; + EFI_STRING ConfigureLang; + + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (InputJson)) { + return EFI_INVALID_PARAMETER; + } + + Json =3D NULL; + ConfigureLang =3D NULL; + + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri); + if (ConfigureLang =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + Status =3D ProvisioningComputerSystemProperties ( + Private->JsonStructProtocol, + InputJson, + NULL, + ConfigureLang, + FALSE, + &Json + ); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((DEBUG_MANAGEABILITY, "%a: update resource for %s ignored. No= thing changed\n", __func__, ConfigureLang)); + Status =3D EFI_SUCCESS; + } else { + DEBUG ((DEBUG_ERROR, "%a: update resource for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + } + + goto ON_RELEASE; + } + + // + // Check and see if platform has OEM data or not + // + Status =3D RedfishGetOemData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + // + // Check and see if platform has addendum data or not + // + Status =3D RedfishGetAddendumData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + DEBUG ((REDFISH_DEBUG_TRACE, "%a: update resource for %s\n", __func__, C= onfigureLang)); + + // + // PUT back to instance + // + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: patch resource for %s failed: %r\n", __func_= _, ConfigureLang, Status)); + } + +ON_RELEASE: + + if (Json !=3D NULL) { + FreePool (Json); + } + + if (ConfigureLang !=3D NULL) { + FreePool (ConfigureLang); + } + + return Status; +} + +/** + Identify resource from given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishIdentifyResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *Json + ) +{ + BOOLEAN Supported; + EFI_STATUS Status; + EFI_STRING EndOfChar; + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList; + + Supported =3D RedfishIdentifyResource (Private->Uri, Private->Json); + if (Supported) { + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SC= HEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: RedfishFeatureGetUnifiedArrayTypeConfigure= Lang failed: %r\n", __func__, Status)); + return Status; + } + + if (ConfigLangList.Count =3D=3D 0) { + DEBUG ((DEBUG_MANAGEABILITY, " No platform Redfish ConfigureLang fo= und for %s\n", __func__, Private->Uri)); + return EFI_SUCCESS; + } + + EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}"); + if (EndOfChar =3D=3D NULL) { + ASSERT (FALSE); + return EFI_DEVICE_ERROR; + } + + // EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}"); + Status =3D IsRedpathArray (ConfigLangList.List[0].ConfigureLang, NULL,= &EndOfChar); + if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) { + ASSERT (FALSE); + return EFI_DEVICE_ERROR; + } + + if (Status !=3D EFI_SUCCESS) { + // + // This is not the collection redpath. + // + GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, &End= OfChar); + } + + *(++EndOfChar) =3D '\0'; + // + // Keep URI and ConfigLang mapping + // + RedfishSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->U= ri); + // + // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. + // This information is sent back to the parent resource (e.g. the coll= ection driver). + // + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHa= ndle, &ConfigLangList); + DestroyConfiglanguageList (&ConfigLangList); + return EFI_SUCCESS; + } + + return EFI_UNSUPPORTED; +} diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerS= ystemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerS= ystemDxe.c new file mode 100644 index 0000000000..30a0e64c64 --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDx= e.c @@ -0,0 +1,702 @@ +/** @file + Redfish feature driver implementation - ComputerSystem + + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "../Common/ComputerSystemCommon.h" + +extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; +extern EFI_HANDLE mRedfishResourceConfigProtocolHand= le; + +/** + Provision redfish resource by given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri Target URI to create resource. + @param[in] PostMode TRUE if the resource does not exist, po= st method is used. + FALSE if the resource exist but propert= y is missing, put method is used. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceProvisioningResource ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri, + IN BOOLEAN PostMode + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((DEBUG_MANAGEABILITY, "%a: provisioning in %s mode\n", __func__, = (PostMode ? L"POST" : L"PATCH"))); + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Status =3D RedfishProvisioningResourceCommon (Private, !PostMode); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to provision resource to: %s: %r\n", = __func__, Uri, Status)); + } else { + // + // Get latest ETag on URI and keep it in variable. + // + SetEtagFromUri (Private->RedfishService, Private->Uri, TRUE); + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + return Status; +} + +/** + Consume resource from given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceConsumeResource ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + EFI_STRING PendingSettingUri; + REDFISH_RESPONSE PendingSettingResponse; + REDFISH_RESPONSE *ExpectedResponse; + CHAR8 *Etag; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); + return Status; + } + + // + // Check and see if "@Redfish.Settings" exist or not. + // + ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE)); + Status =3D GetPendingSettings ( + Private->RedfishService, + Response.Payload, + &PendingSettingResponse, + &PendingSettingUri + ); + if (!EFI_ERROR (Status)) { + DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", __fu= nc__, PendingSettingUri)); + Private->Uri =3D PendingSettingUri; + ExpectedResponse =3D &PendingSettingResponse; + } else { + DEBUG ((REDFISH_DEBUG_TRACE, "%a: No @Redfish.Settings is found\n", __= func__)); + Private->Uri =3D Uri; + ExpectedResponse =3D &Response; + } + + Private->Payload =3D ExpectedResponse->Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + // + // Find etag in HTTP response header + // + Etag =3D NULL; + GetHttpResponseEtag (ExpectedResponse, &Etag); + Status =3D RedfishConsumeResourceCommon (Private, Private->Json, Etag); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", = __func__, Private->Uri, Status)); + } + + // + // Release resource + // + if (Etag !=3D NULL) { + FreePool (Etag); + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + if (Response.Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + } + + if (PendingSettingResponse.Payload !=3D NULL) { + RedfishFreeResponse ( + PendingSettingResponse.StatusCode, + PendingSettingResponse.HeaderCount, + PendingSettingResponse.Headers, + PendingSettingResponse.Payload + ); + } + + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +/** + Get information about this protocol. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[out] Schema Supported schema. + @param[out] Major Supported major number. + @param[out] Minor Supported minor number. + @param[out] Errata Supported errata number. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceGetInfo ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + OUT REDFISH_SCHEMA_INFO *Info + ) +{ + if ((This =3D=3D NULL) || (Info =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + AsciiStrCpyS (Info->Schema, REDFISH_SCHEMA_STRING_SIZE, RESOURCE_SCHEMA); + AsciiStrCpyS (Info->Major, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA_= MAJOR); + AsciiStrCpyS (Info->Minor, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA_= MINOR); + AsciiStrCpyS (Info->Errata, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA= _ERRATA); + + return EFI_SUCCESS; +} + +/** + Update resource to given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceUpdate ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + Status =3D RedfishUpdateResourceCommon (Private, Private->Json); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to update resource to: %s: %r\n", __f= unc__, Uri, Status)); + } else { + // + // Get latest ETag on URI and keep it in variable. + // + SetEtagFromUri (Private->RedfishService, Private->Uri, TRUE); + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + RedfishHttpResetResource (Uri); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +/** + Check resource on given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceCheck ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + CHAR8 *Etag; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + // + // Find etag in HTTP response header + // + Etag =3D NULL; + GetHttpResponseEtag (&Response, &Etag); + Status =3D RedfishCheckResourceCommon (Private, Private->Json, Etag); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to check resource from: %s: %r\n", __= func__, Uri, Status)); + } + + // + // Release resource + // + if (Etag !=3D NULL) { + FreePool (Etag); + } + + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +/** + Identify resource on given URI. + + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS This is target resource which we want t= o handle. + @retval EFI_UNSUPPORTED This is not the target resource. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceIdentify ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + Status =3D RedfishIdentifyResourceCommon (Private, Private->Json); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: identify %s failed: %r\n", __func__, Uri, St= atus)); + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig =3D { + RedfishResourceProvisioningResource, + RedfishResourceConsumeResource, + RedfishResourceUpdate, + RedfishResourceCheck, + RedfishResourceIdentify, + RedfishResourceGetInfo +}; + +/** + 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 +RedfishResourceInit ( + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This, + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his); + + 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 +RedfishResourceStop ( + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his); + + if (Private->Event !=3D NULL) { + gBS->CloseEvent (Private->Event); + Private->Event =3D NULL; + } + + if (Private->RedfishService !=3D NULL) { + RedfishCleanupService (Private->RedfishService); + Private->RedfishService =3D NULL; + } + + if (Private->Payload !=3D NULL) { + RedfishCleanupPayload (Private->Payload); + Private->Payload =3D NULL; + } + + return EFI_SUCCESS; +} + +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { + RedfishResourceInit, + RedfishResourceStop +}; + +/** + 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 (mRedfishResourcePrivate =3D=3D NULL) { + return; + } + + if (mRedfishResourcePrivate->JsonStructProtocol !=3D NULL) { + return; + } + + Status =3D gBS->LocateProtocol ( + &gEfiRestJsonStructureProtocolGuid, + NULL, + (VOID **)&mRedfishResourcePrivate->JsonStructProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __func__, Status)); + } + + 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 +RedfishResourceUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; + + if (mRedfishResourcePrivate =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 and resource protocol. + // + Status =3D gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + ConfigHandler, + &gEdkIIRedfishResourceConfigProtocolGuid, + &mRedfishResourcePrivate->RedfishResourceConfig, + NULL + ); + + FreePool (mRedfishResourcePrivate); + mRedfishResourcePrivate =3D NULL; + + return Status; +} + +/** + 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 Others Other errors as indicated. +**/ +EFI_STATUS +EFIAPI +RedfishResourceEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Registration; + + if (mRedfishResourcePrivate !=3D NULL) { + return EFI_ALREADY_STARTED; + } + + mRedfishResourceConfigProtocolHandle =3D ImageHandle; + + mRedfishResourcePrivate =3D AllocateZeroPool (sizeof (REDFISH_RESOURCE_C= OMMON_PRIVATE)); + CopyMem (&mRedfishResourcePrivate->ConfigHandler, &mRedfishConfigHandler= , sizeof (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL)); + CopyMem (&mRedfishResourcePrivate->RedfishResourceConfig, &mRedfishResou= rceConfig, sizeof (EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL)); + + // + // Publish config handler protocol and resource protocol. + // + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + &mRedfishResourcePrivate->ConfigHandler, + &gEdkIIRedfishResourceConfigProtocolGuid, + &mRedfishResourcePrivate->RedfishResourceConfig, + NULL + ); + + EfiCreateProtocolNotifyEvent ( + &gEfiRestJsonStructureProtocolGuid, + TPL_CALLBACK, + EfiRestJasonStructureProtocolIsReady, + NULL, + &Registration + ); + + return Status; +} --=20 2.37.1.windows.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 (#114481): https://edk2.groups.io/g/devel/message/114481 Mute This Topic: https://groups.io/mt/103967446/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-