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 3B34C780091 for ; Fri, 26 Jan 2024 02:32:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=HStAoosTBn4VKjFoBjhSnPBMavWx1sFk3xqrSFpOUlc=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706236331; v=1; b=NhvhoOI24TFin63ON71YC27ROZ5TcKmRTF3Ci2pkxatG6EeoO+4Kpe7xuC2Uzh+wd6NisicK Hs47mAn0b3l1+W70ENAqkFupDlZgfm8RJpwnaHPf69ueTqK8oAPEuXL69RXkBpVQrbHwyIP5qzU jYhsIhCs/T1+KiIVwtYl9JAo= X-Received: by 127.0.0.2 with SMTP id VNUlYY7687511xUnFV8iN8F8; Thu, 25 Jan 2024 18:32:11 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.71]) by mx.groups.io with SMTP id smtpd.web11.6383.1706236330915610132 for ; Thu, 25 Jan 2024 18:32:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XNFYFOFJGTT4m9Efk+MjPvixDXRaCboiArIHY7lMHEIvjSAkfmLBfHL8yJSsOvXHO7R8rrzriUAQWYFJ4uIoE5ObZtwZX4oPe3QiXkPdZ3gxkFxhFug3KQnpx5au4r3X9nXnSMOCNTbROWGK2dd7TP9uoA19Y52qVRo9CpqCyHf/my2YijFXHzeDqHq7Dowgsp1QeQdbXKgXkQODrqrw7Ew2kqWzb4M0u376OZdZajh64gBIwlCGOnltw0M+ndosCioKRffw249F5tW/Grr94ymyfcphqt/yJX4cvDmz9rBmD/a4/YrVbkKhgX5oFTYHlF1NXi8vhsvIsHvM/DGzOg== 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=cnYPFCXgyHS5zaIfpeX9oo5DBaXn4Ju1RJjbk3f/Hyk=; b=V6i1RijGWWHI4EBzAJXN4Wz6H8opbSvHn0Gx7W3txjOiyjELZpcyv5YTTktU4l7/r92lx5yJrDCtFOYRMOCvVtfb+GU5P34Y25rDHTHiV+649vLlHjjInoG0X6SPwRxdE+nMhOLvSCluH6Zw1Ik0LoINxmjZpJQFy8nn1AyNCvJygD1ySUo/0vuzI167RzNvhMTm/3+7FYYDBoVe4NzI216TuBLQ5yaWOJ+gYH6lh8ZP9fTPbli9t/bwEzqO9PBgOfbso6TmhtZtkfe2lIAgBnskHlpcHBhVmhY/NJX0FtpZlEu+S7LRF2FPKfJp4faBm23zEgz298lsHuDxy2T6oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by MN2PR12MB4062.namprd12.prod.outlook.com (2603:10b6:208:1d0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27; Fri, 26 Jan 2024 02:32:04 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6%7]) with mapi id 15.20.7228.022; Fri, 26 Jan 2024 02:32:04 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver Thread-Topic: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver Thread-Index: AQHaT/Maj0KN7p8rDkyl9xEQDMZI6bDrXGbQgAADQrA= Date: Fri, 26 Jan 2024 02:32:04 +0000 Message-ID: References: <20240126010023.958-1-abner.chang@amd.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=e6c64bb7-a7a6-46e4-ac57-dbf6587db1cd;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2024-01-26T02:31:34Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|MN2PR12MB4062:EE_ x-ms-office365-filtering-correlation-id: dee5e7e0-da0a-4881-aca1-08dc1e16fc18 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: J9f0MNsUl/Iz3xcZl0Xdfs92UcXmz94csdxZP2WBSVWQyapdGW76/DpCWNsDrcErbP5lFC8vzElK1ZEBPdb/cf/2qH+UOI1uGuOldxmDRDZ9jZJxdC+X4ehea7QwDwopD9cMd9Qvpk7mIrqTYTpG7QA9rMFrFlhqSGRIhuEefIpsvmXaGVaeoXZufDj+wiQ4DcOMZ4C+ZuFkMouQBawBD3GdsRnqOq+uLC6SpPOdTYRZpsTMvHNLJ9cCPR0OqDN2iD+8YO8dCNFGCDdvzeOEnBS57k3AW9n4vliuAdFhDkasv2NyvbWMijAuPquN2QKG32Hbo5jCOq+h8ci9Mkk8HK1sKmzyV+gJlfOyo/JGvFtCWGbT99x6EU2z6/d2UpQPRTZIAYt06USoRFfM/su8usK2/ocRRhxxg0JYh7KLvILIQ4dtFykAWPNbbmxaSh/7LGXowQIPisRgjeqUS/TZ/7hy76xGhTv1nMPIiP45KD1SkSWauTj+ULKw1U765owfprQjgl2RfxwRiZW6195nlhWazWAizYdaiPbXZ49ZyqT/ejvjGX9woK3oGed1tWFEo9L/F4FC0E7L3JNdTyfpy5NfqcFKkYP/yG7BQOzAXXplcH7OUvrEoZ+Gbx2mtA7zvGuy+SRuXfLZ95dckBSx0+1NqAeIF9rHlGIu84kxT6g= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?onYNKmBpQ0cm6fZrOqDUeWEQGWmLJ1++YFxpq8nBqvlUbkvlmb+RzJfRu+ri?= =?us-ascii?Q?x43+tiMIhxFGKo70b3O0SWGbXz8hlZJIYqcgmZuOCWKKlX4WAfWOtlBA5f8L?= =?us-ascii?Q?h+4/3tXJnpIiBbU/sQoS0y+3WPctqVFipUiQwJJ203hxKG65oFZAZoxK10FM?= =?us-ascii?Q?3EM9wwT9I3UFcHIkG4zyZ/wL0pxjkJHL6Gi/jF0r8dEV9HjmN1kdze3uVhtp?= =?us-ascii?Q?ed2k1HuKZ6JLCTcXH+sjpWRntGkp6yTQdXAyRbJBUcopoxB+uVsesQlBVGHG?= =?us-ascii?Q?BlNaD1PmLSbOb0UOlMKEXUe20ATCdpSmZHu8TT35o+nmhcUTGn5HH9HFRPIu?= =?us-ascii?Q?yg+rLPMhKweREYo4lxvTtIqttteDYdFp+SbH0hbYpNHPXwQctuhXBxPshAp3?= =?us-ascii?Q?zRmFBJu1cghzFwX6gg8F69CDB5cZH+nnUzGFZBrb+B6e0bpnEjvGYpU3eHMf?= =?us-ascii?Q?LkVeQqbdvodq4+V/78VLafLWA+nCNg9EVCCGxbUG2Pqjsuskt0HX36MAl608?= =?us-ascii?Q?1Xgb7ovg8XUBW/xvZaxtaEEQPdoDV7z89u0XuTceACgy9yWwCQHmhMG/tc1o?= =?us-ascii?Q?CDYt/jbasC0ulKuCsLbYFRtHNa0kA7em1th54f9v9bfjbGROsxtjUdWaankU?= =?us-ascii?Q?qT30QusNAHKAyjg9HXpzPg+ejy1ILrhWDJfJNXK+wTiGDW7/LsniVDoJhm5W?= =?us-ascii?Q?017tc/fRVxhymRRe4/EcicMTN82qG5v8QSwqcxaNW/oZj8l3F+LzUj2aMERl?= =?us-ascii?Q?5sFrcnElwXeyfg6JtR6ofu+Lh0wve/bl1GY9ycrCOnB0AJhKiLgOE4Blk1u1?= =?us-ascii?Q?kCjw1vpH7yxEr3dOg+caz/Z4e4hKmfp0p0fsNbl1zWq1Kn1LUNMAhFzZGk5E?= =?us-ascii?Q?0WL2megZTgsXQWBgf9qacl5y4GNqsjKYNN4Iv7SfMRG2cMEXx3j6FtRhC3+u?= =?us-ascii?Q?OuXlJ45PQWtt6BwdvBm8mBUQWg+YNobHM2SrTWz7wxftARDevm1Bh8NO/PcZ?= =?us-ascii?Q?UoMVFoS33wsen0feN5g2VXeZu2X3i1bxRu36N/s7j5oLXVTM+hWdUNYwApwX?= =?us-ascii?Q?9IPbz+yUJdM85/yAX00qxeXr81CidT5O2zbu53fUivH43//bHY00xEC5i83K?= =?us-ascii?Q?hRB8CpcThmsq2YzB9V+PFD9I4Hxp2hD42ZrbI9tAi7fiumH2IlDQmZf82Ee8?= =?us-ascii?Q?Bt70pKlaRYgR7egN4jYJ00KVVJx7oWx/tO212eI1fxeg6aE9Jp5afolzHU7d?= =?us-ascii?Q?URFXLx0WUxfqx6oitF4qj4pd3FANKhyjKI2NwLCpMebXqaZmRiM1WKRyAn/m?= =?us-ascii?Q?bnKn1U9rLL+hMrDZi5OZz5FXokBdxQmu/b91sk1gYVt89BknZmYQM0/zhaUs?= =?us-ascii?Q?MPc0nLHVvGTrCiFVe/eHKsPgsjZJ63fXVtWaZV9J5KlfZUdbUYh8FSJDg131?= =?us-ascii?Q?7oXVWNIfGkVvzWqm2QMLd4blPHcVJVcF2V+cp0C9V6uuZXeR8qWUZ9zzhLsk?= =?us-ascii?Q?D+XUvTVcJoH/HTmr+rLEm1Xb1pJo0OVWOl5ajbWSFWXc/p4tdVPGdt0Vyy2c?= =?us-ascii?Q?wAn3eFNvXVL8cE5jZ34=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dee5e7e0-da0a-4881-aca1-08dc1e16fc18 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2024 02:32:04.6834 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 75WcrXUG9u5rUSB0gfGssL2Zp+1HGQzopIj51M73ueBVN+7Y/IZNDq6IjhMPHQwU9n7jjE7/Usad+YaQYSBM1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4062 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: kfVn3tFid3FbwU5IU5tJNjJLx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=NhvhoOI2; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); 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 [AMD Official Use Only - General] Thanks Nickle, I just sent out the updates. Abner > -----Original Message----- > From: Nickle Wang > Sent: Friday, January 26, 2024 10:21 AM > To: devel@edk2.groups.io; Chang, Abner > Cc: Igor Kulchytskyy > Subject: RE: [edk2-devel] [edk2-redfish-client][PATCH V2] > RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Hi Abner, > > Same minor issue as 1_5_0. Please add "%a:" to below DEBUG call. > > > + DEBUG ((DEBUG_MANAGEABILITY, " No platform Redfish > ConfigureLang > > found for %s\n", __func__, Private->Uri)); > > Regards, > Nickle > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Chang, > Abner > > via groups.io > > Sent: Friday, January 26, 2024 9:00 AM > > To: devel@edk2.groups.io > > Cc: Nickle Wang ; Igor Kulchytskyy > > Subject: [edk2-devel] [edk2-redfish-client][PATCH V2] > > RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver > > > > External email: Use caution opening links or attachments > > > > > > 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/ComputerSystem > Dxe. > > inf > > create mode 100644 > > > RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerS > yste > > mCommon.h > > create mode 100644 > > > RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerS > yste > > mCommon.c > > create mode 100644 > > > RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystem > Dxe. > > c > > > > diff --git > > > a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyste > mD > > xe.inf > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyst > emD > > xe.inf > > new file mode 100644 > > index 0000000000..6bc5cb358e > > --- /dev/null > > +++ > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyst > emD > > xe.inf > > @@ -0,0 +1,53 @@ > > +## @file > > +# > > +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development > LP
> > +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > > +# > > +# 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/Compute > rSyst > > emCommon.h > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute > rSyst > > emCommon.h > > new file mode 100644 > > index 0000000000..c9c8512881 > > --- /dev/null > > +++ > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute > rSyst > > emCommon.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 > > reserved. > > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_ > > +#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_ > > + > > +#include > > > 3_0.h > > > > > +#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/Compute > rSyst > > emCommon.c > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute > rSyst > > emCommon.c > > new file mode 100644 > > index 0000000000..bc24c49206 > > --- /dev/null > > +++ > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute > rSyst > > emCommon.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_PRIVATE instance. > > + @param[in] Json The JSON to consume. > > + @param[in] HeaderEtag The Etag string returned in HTTP he= ader. > > + > > + @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_HEA= DER > > **)&ComputerSystem > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, > Status)); > > + 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 > > consume 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 > > (RedfishComputerSystem_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", > __func__, > > 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, > > RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot- > > >BootOrder); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", > __func__, > > 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- > > >BootSourceOverrideEnabled); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", > __func__, > > 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- > > >BootSourceOverrideMode); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", > __func__, > > 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- > > >BootSourceOverrideTarget); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", > __func__, > > 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- > > >UefiTargetBootSourceOverride); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", > __func__, > > 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 *)Com= puterSystem > > + ); > > + > > + 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_EMPTY_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_HEAD= ER > > **)&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= _HEADER > > **)&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, > > RESOURCE_SCHEMA_VERSION, L"Boot/BootNext", ConfigureLang); > > + if (AsciiStringValue !=3D NULL) { > > + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot- > >BootNext, > > AsciiStringValue) !=3D 0)) { > > + ComputerSystemCsEmpty->Boot->BootNext =3D AsciiStringValue; > > + PropertyChanged =3D TRUE; > > + } > > + } > > + } > > + > > + // > > + // Handle BOOT->BOOTORDER > > + // > > + if (PropertyChecker (ComputerSystemCs->Boot->BootOrder, > ProvisionMode)) { > > + AsciiStringArrayValue =3D GetPropertyStringArrayValue > (RESOURCE_SCHEMA, > > RESOURCE_SCHEMA_VERSION, L"Boot/BootOrder", ConfigureLang, > &ArraySize); > > + if (AsciiStringArrayValue !=3D NULL) { > > + if (ProvisionMode || !CompareRedfishStringArrayValues > > (ComputerSystemCs->Boot->BootOrder, AsciiStringArrayValue, ArraySize)) = { > > + AddRedfishCharArray (&ComputerSystemCsEmpty->Boot- > >BootOrder, > > AsciiStringArrayValue, ArraySize); > > + PropertyChanged =3D TRUE; > > + } > > + } > > + } > > + > > + // > > + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED > > + // > > + if (PropertyChecker (ComputerSystemCs->Boot- > >BootSourceOverrideEnabled, > > ProvisionMode)) { > > + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, > > RESOURCE_SCHEMA_VERSION, L"Boot/BootSourceOverrideEnabled", > > ConfigureLang); > > + if (AsciiStringValue !=3D NULL) { > > + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot- > > >BootSourceOverrideEnabled, AsciiStringValue) !=3D 0)) { > > + ComputerSystemCsEmpty->Boot->BootSourceOverrideEnabled =3D > > AsciiStringValue; > > + PropertyChanged =3D T= RUE; > > + } > > + } > > + } > > + > > + // > > + // Handle BOOT->BOOTSOURCEOVERRIDEMODE > > + // > > + if (PropertyChecker (ComputerSystemCs->Boot- > >BootSourceOverrideMode, > > ProvisionMode)) { > > + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, > > RESOURCE_SCHEMA_VERSION, L"Boot/BootSourceOverrideMode", > > ConfigureLang); > > + if (AsciiStringValue !=3D NULL) { > > + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot- > > >BootSourceOverrideMode, AsciiStringValue) !=3D 0)) { > > + ComputerSystemCsEmpty->Boot->BootSourceOverrideMode =3D > > AsciiStringValue; > > + PropertyChanged =3D TRUE= ; > > + } > > + } > > + } > > + > > + // > > + // Handle BOOT->BOOTSOURCEOVERRIDETARGET > > + // > > + if (PropertyChecker (ComputerSystemCs->Boot- > >BootSourceOverrideTarget, > > ProvisionMode)) { > > + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, > > RESOURCE_SCHEMA_VERSION, L"Boot/BootSourceOverrideTarget", > > ConfigureLang); > > + if (AsciiStringValue !=3D NULL) { > > + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot- > > >BootSourceOverrideTarget, AsciiStringValue) !=3D 0)) { > > + ComputerSystemCsEmpty->Boot->BootSourceOverrideTarget =3D > > AsciiStringValue; > > + PropertyChanged =3D TR= UE; > > + } > > + } > > + } > > + > > + // > > + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE > > + // > > + if (PropertyChecker (ComputerSystemCs->Boot- > > >UefiTargetBootSourceOverride, ProvisionMode)) { > > + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, > > RESOURCE_SCHEMA_VERSION, L"Boot/UefiTargetBootSourceOverride", > > ConfigureLang); > > + if (AsciiStringValue !=3D NULL) { > > + if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot- > > >UefiTargetBootSourceOverride, AsciiStringValue) !=3D 0)) { > > + ComputerSystemCsEmpty->Boot->UefiTargetBootSourceOverride = =3D > > AsciiStringValue; > > + PropertyChanged = =3D TRUE; > > + } > > + } > > + } > > + } > > + > > + // > > + // Convert C structure back to JSON text. > > + // > > + Status =3D JsonStructProtocol->ToJson ( > > + JsonStructProtocol, > > + (EFI_REST_JSON_STRUCTURE_HEADER > > *)ComputerSystemEmpty, > > + 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 > > properties from ResultJson.\n", __func__)); > > + *ResultJson =3D NULL; > > + return Status; > > + } > > + } > > + > > + // > > + // Release resource. > > + // > > + JsonStructProtocol->DestoryStructure ( > > + JsonStructProtocol, > > + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSyst= em > > + ); > > + > > + // > > + // Free memory allocated for Computersystem empty CS > > + // > > + if (ComputerSystemCsEmpty->Boot->BootOrder !=3D NULL) { > > + DestoryRedfishCharArray (ComputerSystemCsEmpty->Boot->BootOrder, > > ArraySize); > > + } > > + > > + JsonStructProtocol->DestoryStructure ( > > + JsonStructProtocol, > > + (EFI_REST_JSON_STRUCTURE_HEADER > *)ComputerSystemEmpty > > + ); > > + 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, Pri= vate- > > >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_SCHEMA, RESOURCE_SCHEMA_VERSION, > > REDPATH_ARRAY_PATTERN, &UnifiedConfigureLangList); > > + if (EFI_ERROR (Status) || (UnifiedConfigureLangList.Count =3D=3D 0))= { > > + DEBUG ((DEBUG_ERROR, "%a: No HII question found with configure > > language: %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 co= llection > > driver). > > + // > > + EdkIIRedfishResourceSetConfigureLang > > (mRedfishResourceConfigProtocolHandle, &UnifiedConfigureLangList); > > + > > + for (Index =3D 0; Index < UnifiedConfigureLangList.Count; Index++) { > > + DEBUG ((DEBUG_MANAGEABILITY, "[%d] create ComputerSystem > resource > > from: %s\n", UnifiedConfigureLangList.List[Index].Index, > > UnifiedConfigureLangList.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 > failed: > > %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, Pr= ivate- > > >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_PROTO= COL > > instance. > > + @param[in] ResourceExist TRUE if resource exists, PUT method= will be > > used. > > + FALSE if resource does not exist PO= ST method 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_PRIVATE instance. > > + @param[in] Json The JSON to consume. > > + @param[in] HeaderEtag The Etag string returned in HTTP he= ader. > > + > > + @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, > > RESOURCE_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, > > ConfigureLangList[Index]); > > + if (Property =3D=3D NULL) { > > + continue; > > + } > > + > > + DEBUG ((DEBUG_MANAGEABILITY, "%a: [%d] check attribute for: %s\n", > > __func__, 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_PRIVATE 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= . > > Nothing changed\n", __func__, ConfigureLang)); > > + Status =3D EFI_SUCCESS; > > + } else { > > + DEBUG ((DEBUG_ERROR, "%a: update resource for %s failed: %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 ((REDFISH_DEBUG_TRACE, "%a: update resource for %s\n", > __func__, > > ConfigureLang)); > > + > > + // > > + // PUT back to instance > > + // > > + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Pr= ivate- > > >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_PRIVATE 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_SCHEMA, RESOURCE_SCHEMA_VERSION, > > REDPATH_ARRAY_PATTERN, &ConfigLangList); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: > > RedfishFeatureGetUnifiedArrayTypeConfigureLang failed: %r\n", __func__, > > Status)); > > + return Status; > > + } > > + > > + if (ConfigLangList.Count =3D=3D 0) { > > + DEBUG ((DEBUG_MANAGEABILITY, " No platform Redfish > ConfigureLang > > found 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, N= ULL, > > &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, > > &EndOfChar); > > + } > > + > > + *(++EndOfChar) =3D '\0'; > > + // > > + // Keep URI and ConfigLang mapping > > + // > > + RedfishSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Privat= e- > >Uri); > > + // > > + // Set the configuration language in the > > RESOURCE_INFORMATION_EXCHANGE. > > + // This information is sent back to the parent resource (e.g. the = collection > > driver). > > + // > > + EdkIIRedfishResourceSetConfigureLang > > (mRedfishResourceConfigProtocolHandle, &ConfigLangList); > > + DestroyConfiglanguageList (&ConfigLangList); > > + return EFI_SUCCESS; > > + } > > + > > + return EFI_UNSUPPORTED; > > +} > > diff --git > > > a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyste > mD > > xe.c > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyst > emD > > xe.c > > new file mode 100644 > > index 0000000000..30a0e64c64 > > --- /dev/null > > +++ > > > b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyst > emD > > xe.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 > > reserved. > > + 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 mRedfishResourceConfigProtocol= Handle; > > + > > +/** > > + Provision redfish resource by given URI. > > + > > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTO= COL > > instance. > > + @param[in] Uri Target URI to create resource. > > + @param[in] PostMode TRUE if the resource does not exist= , post > > method is used. > > + FALSE if the resource exist but pro= perty 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_PROTOC > OL > > (This); > > + > > + if (Private->RedfishService =3D=3D NULL) { > > + return EFI_NOT_READY; > > + } > > + > > + ZeroMem (&Response, sizeof (Response)); > > + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, > &Response, > > TRUE); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func_= _, > > Uri)); > > + 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_PROTO= COL > > 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_PROTOC > OL > > (This); > > + > > + if (Private->RedfishService =3D=3D NULL) { > > + return EFI_NOT_READY; > > + } > > + > > + ZeroMem (&Response, sizeof (Response)); > > + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, > &Response, > > TRUE); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func_= _, > > Uri)); > > + 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", > > __func__, 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, Eta= g); > > + 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_PROTO= COL > > 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_PROTO= COL > > 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_PROTOC > OL > > (This); > > + > > + if (Private->RedfishService =3D=3D NULL) { > > + return EFI_NOT_READY; > > + } > > + > > + ZeroMem (&Response, sizeof (Response)); > > + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, > &Response, > > TRUE); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func_= _, > > Uri)); > > + 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", > > __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 > > + ); > > + 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_PROTO= COL > > 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_PROTOC > OL > > (This); > > + > > + if (Private->RedfishService =3D=3D NULL) { > > + return EFI_NOT_READY; > > + } > > + > > + ZeroMem (&Response, sizeof (Response)); > > + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, > &Response, > > TRUE); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func_= _, > > Uri)); > > + 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_CONFIG_PROTOCOL instance. > > + @param[in] Uri The target URI to consume. > > + > > + @retval EFI_SUCCESS This is target resource which we wa= nt to > 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_PROTOC > OL > > (This); > > + > > + if (Private->RedfishService =3D=3D NULL) { > > + return EFI_NOT_READY; > > + } > > + > > + ZeroMem (&Response, sizeof (Response)); > > + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, > &Response, > > TRUE); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func_= _, > > Uri)); > > + 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= , > > Status)); > > + } > > + > > + // > > + // 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 initial= ize each > Redfish > > configure > > + handler. > > + > > + @param[in] This Pointer to > > EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance. > > + @param[in] RedfishConfigServiceInfo Redfish service information. > > + > > + @retval EFI_SUCCESS The handler has been initialize= d successfully. > > + @retval EFI_DEVICE_ERROR Failed to create or configure t= he REST EX > > protocol instance. > > + @retval EFI_ALREADY_STARTED This handler has already been > initialized. > > + @retval Other Error happens during the initia= lization. > > + > > +**/ > > +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 > > (This); > > + > > + Private->RedfishService =3D RedfishCreateService (RedfishConfigServi= ceInfo); > > + 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 succes= sfully. > > + @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 > > (This); > > + > > + 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 installe= d. > > + > > + @param[in] Event Event whose notification function is being invok= ed. > > + @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->JsonStructProtoco= l > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "%a: failed to locate > > gEfiRestJsonStructureProtocolGuid: %r\n", __func__, Status)); > > + } > > + > > + gBS->CloseEvent (Event); > > +} > > + > > +/** > > + Unloads an image. > > + > > + @param ImageHandle Handle that identifies the image to be > unloaded. > > + > > + @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 ImageHandl= e. > > + // > > + 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 poin= t is > > + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers > including > > + both device drivers and bus drivers. It initialize the global variab= les 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_COMMON_PRIVATE)); > > + CopyMem (&mRedfishResourcePrivate->ConfigHandler, > > &mRedfishConfigHandler, sizeof > > (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL)); > > + CopyMem (&mRedfishResourcePrivate->RedfishResourceConfig, > > &mRedfishResourceConfig, 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; > > +} > > -- > > 2.37.1.windows.1 > > > > > > > >=20 > > -=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 (#114488): https://edk2.groups.io/g/devel/message/114488 Mute This Topic: https://groups.io/mt/103967446/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-