From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.78]) by mx.groups.io with SMTP id smtpd.web11.34428.1670814946222490903 for ; Sun, 11 Dec 2022 19:15:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=rD4p/6On; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.93.78, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QOxWv0zT6TKsG1ciNSPt7fY5b82ma7JituCM3mFFBqfWXG76rES1WKj00ZlSghxi/l/bH1w0367gde0AOUVb32VABPl4vuMvYOy5vTuLxzqslzxOmXUwEIOaIqigUDHS7bgFgBClTojhECzkx5zWLD9psgHlK0wroUpGIYjNXR61M1DoXEgiwdXASEsltEOPMjXbca86OShq2KJvqOOjrzb3wDO7E0e1Ay5GLhygX8XOQ8JZ0CqZ57kDjWJmiOY5ZkTm/PZbAbYBwN40GeaJjGbYNKxtm4EPaRmWiEqDoszC2bMKNS+u/KZGd1pyuHcSyGRFMelfgc4zdlVRru2cSw== 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=UWJFoehYbetyz7eziGfO6JH/H7dCZlnKIVM3rEaSCG0=; b=V6bVO7/9NkROTD8pmS46ta6o3dzLNzjvQGv1o/VhBk+nFT6JMVbooHQRNqi1mV9Xj2gHXpnY+EEfaROm38LmJt0q0fdXC2GEvbRTXV9O4S8TJFs32wmp1HIgnr5VSaMflbdMdjVgW0r9/mRO6YfBbyYLnH7ZxiMw5Rn1jaDqUTVQlrhvPGWaNgUwfEn+RLK2G6F+23Qa/MhalcBl0aOce1pk+TK4SuRlCHBj2iSViIX39PxthLPFIzKXiRbC9POMGaHSQPIFBm4dT55CUfxRMDNk/Jvnvjy42V8NScahPCQi0GRO2FJ7+srAnCV/MwD7DGQsqo1MI6/jfhcDWHqloA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UWJFoehYbetyz7eziGfO6JH/H7dCZlnKIVM3rEaSCG0=; b=rD4p/6OnpRHK7PC5BbOhMQd2RLkMhkPlq3X0olMrDM2PUjS27D1bFswi5WaH2C8haDKTidWLteeqMx4hmxb1a+3y+pMXGXop7rA4BR7M9Me6QgB09zsGIDcdUTLwKhdo19DY05fFa1K0qA6/LcPz55EOlHHscpYL060fzKIOOCw= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by DM6PR12MB4418.namprd12.prod.outlook.com (2603:10b6:5:28e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Mon, 12 Dec 2022 03:15:42 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::ce0a:283e:839:34bd]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::ce0a:283e:839:34bd%3]) with mapi id 15.20.5880.019; Mon, 12 Dec 2022 03:15:42 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-staging][PATCH 2/3] edk2-staging/RedfishClientPkg: Add Redfish Resource Addendum Library Thread-Topic: [edk2-staging][PATCH 2/3] edk2-staging/RedfishClientPkg: Add Redfish Resource Addendum Library Thread-Index: AQHZCkn1ZfqasIBFLEC/+XOB8UTFpa5plIUw Date: Mon, 12 Dec 2022 03:15:42 +0000 Message-ID: References: <20221207144100.354-1-nicklew@nvidia.com> In-Reply-To: <20221207144100.354-1-nicklew@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-12-12T03:15:40Z; 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_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=c2382a3b-2745-4425-9f76-62527471ad54; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|DM6PR12MB4418:EE_ x-ms-office365-filtering-correlation-id: fa3b2402-39a5-4141-ad47-08dadbef272a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MIPMYD/k4rnRDh3xpVrnPLB8yNz0GVhv+qN9xx5ErDKlvxRfC961vSlQn7CZ8rjhYaafoGk9UmprGryl+lJV86/+M9Mi7iMYDXw6rax4t6uyS5WHhyZh3KBcteYSP+F2pbQv1Yv93+ovujH31onJfrxu+8OFdb6tmk6eJchJPJJbXCy6k7mVir9+gPWDXeBX0U8LgRxNi6sASxk/BPNDi/KnC8jRkH8gtOBgXmArDMxTYBJCY+srzVLxwJFlKEYz98kFY+yUygxCfkXr+9dCLZzAZEHfUoN+UyxvTxOKMlWO12eYJCER76cQtedPblt/OrCOYPwvoWAQKvX+lEomRRZSls3kYWO+5W06s4eVdpKr1JKfhO05Zly1fsRHSJmBDSCgIGI/FQ6kg8RWHdLGhfCDPy6U4vGBpfH4M+0pX8aCCKyiK6Sd3iJnL98sIdV4WPqcpz/KkXq9ih2v2rm5+EiwluQCOihZj8Z5KfYsmDuoZzPB7pj0SSyyjd3fkgUd6kKdaSu7suT0fAkkOzbVtzXXME3x+3lMaIzR+RZs5wA/RF1dMOxsI7aRkFRWgWd/J6GE+J6CMp1BHXGX3wLKdWEtJGrS5HYW6LQACik8pnptuNGc83ibCpPP0k5WGbRdGAH+C0DpCuhnOYvCrrLSus7lBx8xV5eAUOylDkJtfmgh6S3WI+bnXswKjxFflr0rNrpH/pgSq7zxPy4iu9Vr+Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(136003)(346002)(366004)(376002)(396003)(451199015)(9686003)(41300700001)(83380400001)(26005)(186003)(478600001)(52536014)(316002)(8936002)(71200400001)(5660300002)(38070700005)(54906003)(110136005)(33656002)(53546011)(76116006)(66946007)(66446008)(86362001)(4326008)(8676002)(66476007)(66556008)(64756008)(7696005)(6506007)(38100700002)(122000001)(30864003)(55016003)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1mzvrJ088Fs5gK8Uu3Twj7/N08vPQ18oWmzRpFwdsjrWHeI1ftlPRMDZzCCU?= =?us-ascii?Q?ErbdwnqXiYo//vjz7MiB+aANtxUK6Y+UAz4ae8VpYSaydpQNZEcHfx/EaRqX?= =?us-ascii?Q?c7EoWoxBMtZrmGUn9F66KFjtGVw6qss0X20N9RJfiJJKeiSQEScadL7Bv9CQ?= =?us-ascii?Q?g98YxMc01CCVS8TeE5z2l8v9GMe4IGQaPuh4xk5v4vOhhAsfmO6nCdFxeiYZ?= =?us-ascii?Q?N7pm+IqUmv73fzRwKxUfBc1uQK0dOlg3e5LvAj3SAsazaPxTKZ5juSWf//nk?= =?us-ascii?Q?1kd/RZcV90YQgoka+G/3fgfEvwFYdFGBF7BjSeS82N5mrJ8RFnrBhZ49DB93?= =?us-ascii?Q?wQfuIBEiTUbBkp9ARMFc13LDrOFFq0t6JHy3kbDMH+I/QfyQbL6HuinCWGVt?= =?us-ascii?Q?tuaoJzG8uxsw4hIa9+DoE9EBbZpYFszue19am8R+OZDP2Vns5GPx/0/7VPgP?= =?us-ascii?Q?QkTzmCpX/HLY6TkKnSsH5hASGVVPLN1izKv7nFOoMwKLpURKPKU1u2YLYwJ/?= =?us-ascii?Q?KYDmoojhsQHBAb/Wojls1yFJNbA1wx8m8ZebBq96nUZrCQfZJiLMSm2+y25Y?= =?us-ascii?Q?p3WlgzE1Wcyqf464TeeQ3Sh/uXsVose00KrWHBi7QalRBBKu3PONatzLxSuC?= =?us-ascii?Q?JrAaUnl0z4c4hylRrF5wJIhOCBUYOQehMugtixoRdMrJfL1sC5nvgYnsczQk?= =?us-ascii?Q?cKugn0xUgF4HDX35L56o9vcgu0ks6S0H4wghRk1kFHHdvnBCGaxlyZWfSl2S?= =?us-ascii?Q?SzcUcwxw12pHWpBSdysm7iLGreVoz8EBBe4w8o/Pmbi832BBILIf7VriD6F5?= =?us-ascii?Q?kS0XFF5tEGh1RGr0DgGNy4l80/z+Is/pGWu6tXNdumMX05i0Y3QUUxjTUoJj?= =?us-ascii?Q?QWHjEn5kwVzF+9+2VUPMVwjqHLwvKplDIaW0sIBcmWUkMXSP8XXIrOqgQ3Ds?= =?us-ascii?Q?SszG7JnNVLi5J5pavlR/sxetwN4ArUa9KOru1y27+czTFkcZucNtasfR1g1m?= =?us-ascii?Q?ChkzV3AZT5HMC3StnAcisF75bSw7UoPBiaM+4hSBmzMNDHPZpcmcPUqDoe5V?= =?us-ascii?Q?4ouhBPB++BFHPmlL7M6ifMmz94KMeIbAQjuwA+lqj4yOUbbzNZyVo6BM1b60?= =?us-ascii?Q?hnGvQc2Ro11SOyuWov68CL+xqvfwqlmqBj2NgEokoGBhoZZFDGCLbkoBC+dd?= =?us-ascii?Q?/Bn21THItxLZ2vuIiAty6RC4W+KwyxDvyMEpO4B8huJrbVidfhgQ3nEY26Pg?= =?us-ascii?Q?OZV98WeSwiwghoCv2ym5uzHyCEkCXSW5LXvzZo3JWXbXWAluMrfG4XV5tsF+?= =?us-ascii?Q?x6PF/9Xr2id5QTX2MjZrN2k0LtA4Uzjotq1tbrVEQojP2gkDl9hLVxA6lmDH?= =?us-ascii?Q?CzaSXP+YPqDA5qzfiLKknPmfeVfzB7OUREUgxmyxCp9HlTE4BWuzF8n6wO6S?= =?us-ascii?Q?dfA2/r5jvht/JszYUO1hvCThUICQRBlgWPX2mvZNYBaNHSlavMeTBCbDsmOc?= =?us-ascii?Q?8h6Nbx9JIvF2FhFokxOe69jZDRFpjOFhPydui06AaEwk5qqCRIBEeXnySWg8?= =?us-ascii?Q?MpNPeg0ITbqKVHMIFIyHaCoFtJ8Nu45VGe4xQwV9?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa3b2402-39a5-4141-ad47-08dadbef272a X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2022 03:15:42.6652 (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: VGpWD0iUpUhOz2milaunqcTTq5bcGVWBPEikBY50Ksvc9uhdzl8n7T76eCwor3RTxp8SI3N3BQzP+eROw8vdow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4418 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, December 7, 2022 10:41 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [edk2-staging][PATCH 2/3] edk2-staging/RedfishClientPkg: Add > Redfish Resource Addendum Library >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Implement RedfishAddendumLib to support Redfish Resource Addendum > Protocol. > Feature driver calls this library to get addendum data before providing d= ata > to Redfish service. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > .../Include/Library/RedfishAddendumLib.h | 63 +++++ > .../RedfishAddendumLib/RedfishAddendumLib.c | 258 > ++++++++++++++++++ > .../RedfishAddendumLib/RedfishAddendumLib.inf | 40 +++ > RedfishClientPkg/RedfishClientLibs.dsc.inc | 2 + > 4 files changed, 363 insertions(+) > create mode 100644 > RedfishClientPkg/Include/Library/RedfishAddendumLib.h > create mode 100644 > RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.c > create mode 100644 > RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf >=20 > diff --git a/RedfishClientPkg/Include/Library/RedfishAddendumLib.h > b/RedfishClientPkg/Include/Library/RedfishAddendumLib.h > new file mode 100644 > index 0000000000..4215257820 > --- /dev/null > +++ b/RedfishClientPkg/Include/Library/RedfishAddendumLib.h > @@ -0,0 +1,63 @@ > +/** @file > + This file defines the Redfish event library interface. > + > + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_ADDENDUM_LIB_H_ > +#define REDFISH_ADDENDUM_LIB_H_ > + > +#include > +#include > +#include > + > +/** > + Provising redfish resource with with addendum data in given schema. > + > + @param[in] Uri Uri of input resource. > + @param[in] Schema Redfish schema string. > + @param[in] Version Schema version string. > + @param[in] JsonText Input resource in JSON format string. > + @param[out] JsonWithAddendum The input resource with addendum > value attached. > + > + @retval EFI_SUCCESS Addendum data is attached. > + @retval EFI_UNSUPPORTED No addendum data is required in given > schema. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishGetAddendumData ( > + IN EFI_STRING Uri, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN CHAR8 *JsonText, > + OUT CHAR8 **JsonWithAddendum > + ); > + > +/** > + Provising redfish OEM resource with given schema information. > + > + @param[in] Uri Uri of input resource. > + @param[in] Schema Redfish schema string. > + @param[in] Version Schema version string. > + @param[in] JsonText Input resource in JSON format string. > + @param[out] JsonWithOem The input resource with OEM value > attached. > + > + @retval EFI_SUCCESS OEM data is attached. > + @retval EFI_UNSUPPORTED No OEM data is required in given sche= ma. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishGetOemData ( > + IN EFI_STRING Uri, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN CHAR8 *JsonText, > + OUT CHAR8 **JsonWithOem > + ); > + > +#endif > diff --git > a/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.c > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.c > new file mode 100644 > index 0000000000..4154d01e5a > --- /dev/null > +++ > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.c > @@ -0,0 +1,258 @@ > +/** @file > + Redfish event library to deliver Redfish specific event. > + > + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include #include > + > + > +/** > + > + Convert Unicode string to ASCII string. It's call responsibility to re= lease > returned buffer. > + > + @param[in] UnicodeStr Unicode string to convert. > + > + @retval CHAR8 * ASCII string returned. > + @retval NULL Errors occur. > + > +**/ > +CHAR8 * > +UnicodeToAscii ( > + IN EFI_STRING UnicodeStr > + ) > +{ > + CHAR8 *AsciiStr; > + UINTN AsciiStrSize; > + EFI_STATUS Status; > + > + if (IS_EMPTY_STRING (UnicodeStr)) { > + return NULL; > + } > + > + AsciiStrSize =3D StrLen (UnicodeStr) + 1; > + AsciiStr =3D AllocatePool (AsciiStrSize); > + if (AsciiStr =3D=3D NULL) { > + return NULL; > + } > + > + Status =3D UnicodeStrToAsciiStrS (UnicodeStr, AsciiStr, AsciiStrSize); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "UnicodeStrToAsciiStrS failed: %r\n", Status)); > + FreePool (AsciiStr); > + return NULL; > + } > + > + return AsciiStr; > +} Please check if UnicodeStrToAsciiStrS(); works for you. > + > +/** > + Provising redfish resource with with addendum data in given schema. > + > + @param[in] Uri Uri of input resource. > + @param[in] Schema Redfish schema string. > + @param[in] Version Schema version string. > + @param[in] JsonText Input resource in JSON format string. > + @param[out] JsonWithAddendum The input resource with addendum > value attached. Please add "The return value must be freed by the caller using FreePool().= " > + > + @retval EFI_SUCCESS Addendum data is attached. > + @retval EFI_UNSUPPORTED No addendum data is required in given > schema. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishGetAddendumData ( > + IN EFI_STRING Uri, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN CHAR8 *JsonText, > + OUT CHAR8 **JsonWithAddendum > + ) > +{ > + REDFISH_RESOURCE_SCHEMA_INFO SchemaInfo; > + EDKII_JSON_VALUE JsonValue; > + EFI_STATUS Status; > + EFI_HANDLE *HandleBuffer; > + UINTN NumberOfHandles; > + UINTN Index; > + EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL *Protocol; > + > + if (IS_EMPTY_STRING (Uri) || IS_EMPTY_STRING (Schema) || > IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (JsonText) || > (JsonWithAddendum =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + *JsonWithAddendum =3D NULL; > + SchemaInfo.Uri =3D UnicodeToAscii (Uri); > + SchemaInfo.Schema =3D Schema; > + SchemaInfo.Version =3D Version; > + NumberOfHandles =3D 0; > + HandleBuffer =3D NULL; > + > + JsonValue =3D JsonLoadString (JsonText, 0, NULL); if ((JsonValue =3D= =3D > + NULL) || !JsonValueIsObject (JsonValue)) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEdkIIRedfishResourceAddendumProtocolGuid, > + NULL, > + &NumberOfHandles, > + &HandleBuffer > + ); > + if (EFI_ERROR (Status)) { > + goto ON_RELEASE; > + } > + > + for (Index =3D 0; Index < NumberOfHandles; Index++) { > + Status =3D gBS->HandleProtocol ( > + HandleBuffer[Index], > + &gEdkIIRedfishResourceAddendumProtocolGuid, > + (VOID **)&Protocol > + ); > + if (EFI_ERROR (Status)) { > + continue; > + } > + > + Status =3D Protocol->ProvisioningCallback (Protocol, &SchemaInfo, > JsonValue); > + if (!EFI_ERROR (Status)) { > + *JsonWithAddendum =3D JsonDumpString (JsonValue, > EDKII_JSON_COMPACT); > + break; > + } > + } > + > +ON_RELEASE: > + > + if (HandleBuffer !=3D NULL) { > + FreePool (HandleBuffer); > + } > + > + if (JsonValue !=3D NULL) { > + JsonValueFree (JsonValue); > + } > + > + if (SchemaInfo.Uri !=3D NULL) { > + FreePool (SchemaInfo.Uri); > + } > + > + return Status; > +} > + > +/** > + Provising redfish OEM resource with given schema information. > + > + @param[in] Uri Uri of input resource. > + @param[in] Schema Redfish schema string. > + @param[in] Version Schema version string. > + @param[in] JsonText Input resource in JSON format string. > + @param[out] JsonWithOem The input resource with OEM value > attached. > + > + @retval EFI_SUCCESS OEM data is attached. > + @retval EFI_UNSUPPORTED No OEM data is required in given sche= ma. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishGetOemData ( > + IN EFI_STRING Uri, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN CHAR8 *JsonText, > + OUT CHAR8 **JsonWithOem > + ) > +{ > + REDFISH_RESOURCE_SCHEMA_INFO SchemaInfo; > + EDKII_JSON_VALUE JsonValue; > + EDKII_JSON_VALUE JsonValueWithOem; The naming of JsonValueWithOem is a little bit confused. How about just nam= ing it as JsonValueOem? Which is a JSON new object inserted with OEM resou= rce by OEM callback. > + EFI_STATUS Status; > + EFI_HANDLE *HandleBuffer; > + UINTN NumberOfHandles; > + UINTN Index; > + EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL *Protocol; > + > + if (IS_EMPTY_STRING (Uri) || IS_EMPTY_STRING (Schema) || > IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (JsonText) || > (JsonWithOem =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + *JsonWithOem =3D NULL; > + SchemaInfo.Uri =3D UnicodeToAscii (Uri); > + SchemaInfo.Schema =3D Schema; > + SchemaInfo.Version =3D Version; > + JsonValue =3D NULL; > + JsonValueWithOem =3D NULL; > + NumberOfHandles =3D 0; > + HandleBuffer =3D NULL; > + > + JsonValue =3D JsonLoadString (JsonText, 0, NULL); if ((JsonValue =3D= =3D > + NULL) || !JsonValueIsObject (JsonValue)) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + JsonValueWithOem =3D JsonValueInitObject (); if ((JsonValueWithOem = =3D=3D > + NULL) || !JsonValueIsObject (JsonValueWithOem)) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto ON_RELEASE; > + } > + > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEdkIIRedfishResourceAddendumProtocolGuid, > + NULL, > + &NumberOfHandles, > + &HandleBuffer > + ); > + if (EFI_ERROR (Status)) { > + goto ON_RELEASE; > + } > + > + for (Index =3D 0; Index < NumberOfHandles; Index++) { > + Status =3D gBS->HandleProtocol ( > + HandleBuffer[Index], > + &gEdkIIRedfishResourceAddendumProtocolGuid, > + (VOID **)&Protocol > + ); > + if (EFI_ERROR (Status)) { > + continue; > + } > + > + Status =3D Protocol->OemCallback (Protocol, &SchemaInfo, > JsonValueWithOem); > + if (!EFI_ERROR (Status)) { > + Status =3D JsonObjectSetValue (JsonValue, "Oem", JsonValueWithOem)= ; > + if (!EFI_ERROR (Status)) { > + *JsonWithOem =3D JsonDumpString (JsonValue, EDKII_JSON_COMPACT); > + } > + > + break; > + } > + } > + > +ON_RELEASE: > + > + if (HandleBuffer !=3D NULL) { > + FreePool (HandleBuffer); > + } > + > + if (JsonValue !=3D NULL) { > + JsonValueFree (JsonValue); > + } > + > + if (JsonValueWithOem !=3D NULL) { > + JsonValueFree (JsonValueWithOem); > + } > + > + if (SchemaInfo.Uri !=3D NULL) { > + FreePool (SchemaInfo.Uri); > + } > + > + return Status; > +} > diff --git > a/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > new file mode 100644 > index 0000000000..7b9ef6114f > --- /dev/null > +++ > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > @@ -0,0 +1,40 @@ > +## @file > +# > +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent # ## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D RedfishAddendumLib > + FILE_GUID =3D 7B227D39-746D-4247-8291-27B0FA79A7A= F > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D RedfishAddendumLib| DXE_DRIVER > UEFI_DRIVER > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC > +# > + > +[Sources] > + RedfishAddendumLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + RedfishPkg/RedfishPkg.dec > + RedfishClientPkg/RedfishClientPkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + UefiBootServicesTableLib > + MemoryAllocationLib > + UefiLib > + JsonLib > + > +[Protocols] > + gEdkIIRedfishResourceAddendumProtocolGuid ## CONSUMED ## > + > diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc > b/RedfishClientPkg/RedfishClientLibs.dsc.inc > index fe0c4b0885..6ce50e1980 100644 > --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc > +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc > @@ -6,6 +6,7 @@ > # of EDKII network library classes. > # > # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -37,3 +38,4 @@ >=20 > EdkIIRedfishResourceConfigLib|RedfishClientPkg/Library/EdkIIRedfishResou > rceConfigLib/EdkIIRedfishResourceConfigLib.inf >=20 > RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.= i > nf >=20 > RedfishVersionLib|RedfishClientPkg/Library/RedfishVersionLib/RedfishVersi > onLib.inf > + > + > RedfishAddendumLib|RedfishClientPkg/Library/RedfishAddendumLib/Redfi Also add the library to [Components] section in RedfishClientPkg.dsc. Abner > sh > + AddendumLib.inf > -- > 2.38.1.windows.1