From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.78]) by mx.groups.io with SMTP id smtpd.web11.82884.1684136371991258932 for ; Mon, 15 May 2023 00:39:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=njnTNb4o; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.101.78, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j8txK7s+T9vb8X8cUXCplyf3K8dJKcbloYuVmQUd4ajy6/uRGFQ8CEcqGmjsJPfqEMtoPJAXINbvRjJ69btgB1Pd+SvwlAPTUTdjghCGubZV2dwjqXF67E2OdAuNpf4yN2G5kD0hyzpufx6YXEiP3OHkkK4UEoSNQQ0HCOoCLHSnj2mvThnVs5q0sWjykoPnIpv3pQLxCXJ8REuyYEUoCumZFxTZv5D+QXhdGQQnfIKw1sAgkpiDwSnBi28pcPLKHkj7enBcHhZOBMQ1wRAH91DMgWH4xgICaQRPg1WlgJaG8RqPTnOuqVH0C1ZZGrOKrcisEoFY2Wno3Z977v5YCA== 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=uks/CnXdQ2H6wiBLkpmiXoly6IlRHrQT4QFWW+YsdCs=; b=IKZTLJi4etS/6je+3huQ4y1ProIqiMuUbsKeMsSJrbAqO4ghngM7yemGZR7csDcoYVDnC/PpC5JPzAsnaOrBNzBV5ZPK7j+4VN65Lt5Vss7wllwFBLTKJrAsYp3rRHwgbDnJaIndVKp3qJnLBIZwdvikBGzbZ6qla9j+dEwHKvYIRSnRlki7G/mjmkZa4zveO6j8sUEg/coVj4XO4zYauHrXwsoSZM7T0oVPMeVg3dEjNfXjaRBA4HPoDLgPdHh0P3hLRq8GxW39ZfjZJ8TEURsfyo2Pqe1zdhNyADpt7mwLqp6/eviRy5mP6epvkHHhU6Jz7zWDIKt/fpnPp12QnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uks/CnXdQ2H6wiBLkpmiXoly6IlRHrQT4QFWW+YsdCs=; b=njnTNb4oJG6Bm64Zfp2eBLXlxvtk/38KBe7ZOxhNOMeKKw+F1XMJ//EyOhZ5NgkRut4Q0p2xIKiFaDtovVL2QiYw1iySiBNtiuUOFpMSNSYjfrr4lDlnRq7cFkNSSaHktd0xzlxWV1KbkUyriUKl0C+GVoAMSZBlhO/gYghuXvqPAyt/bLNIA4tlX1x/HzUV4mrGBxmSJIwCOKYO8WNo8e4LXmDO9gyE2Df/ofqRptkX+K+ZpS7rLwyraJRNhMrlofcHNyHgiqDm+0Ra9uCuT9WGcewQ+04siJoibmYLm8d2Jv9jdsRIfsZ+ZS61obuFxjaKRdsnMJ6hI2J/pAcc2A== Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by CH3PR12MB8933.namprd12.prod.outlook.com (2603:10b6:610:17a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 07:39:27 +0000 Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::d9df:b45b:2cc1:f017]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::d9df:b45b:2cc1:f017%5]) with mapi id 15.20.6387.023; Mon, 15 May 2023 07:39:27 +0000 From: "Nickle Wang" To: "Chang, Abner" , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-redfish-client][PATCH 2/3] RedfishClientPkg: Add Redfish Resource Addendum Library Thread-Topic: [edk2-redfish-client][PATCH 2/3] RedfishClientPkg: Add Redfish Resource Addendum Library Thread-Index: AQHZhKKhrTsTbnAaQESZr8yKWHd0s69aqDcwgABPDoA= Date: Mon, 15 May 2023 07:39:27 +0000 Message-ID: References: <20230512072301.17881-1-nicklew@nvidia.com> In-Reply-To: Accept-Language: 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=2023-05-15T03:19:30Z; 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=79db31a1-69dd-478b-b7ba-096a2ba4bfc5; 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=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|CH3PR12MB8933:EE_ x-ms-office365-filtering-correlation-id: 973b64d9-9465-4ba2-a326-08db55178306 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9dBhrn85fwzfnGRSIXCkjw/zic8INkULUEn1C2fOQTIoTmIgadNpPGPyEqX2yx1nofjSFByLzNc2WmOfJx7FRBcnSwOUPOUgLFb+CYJLSgsAfjegtbL8AkyEFxY3g8Is3Lo6E4zDuBn2iiZRHd1w5rK6J3gRbxyDHj8SoXO8wCItwN0SuRFyQRUhvRuKnTgLp9hTTzoG4LDBVl+eXcIP2/EV/hKnt8UDfXeFqYPXyx6ciLYsxCFi+8Fwbn4VJtPALTERJ5VPoFd83RzaD7neja/+ycyEUHwxmMB/PzQPzl2z2Ci6dBc3INC+y5lGwiwjMv9ubUsgF9CMRoTz1mrkVMEgeYSx+7/Ig7nGDbVwRroXZkMnc+NdW2KvcM4+QHtJwUvih7SbYwgRI6eALITctq535Qnzdvt75mnFNWMfAVz8hbJuPAtCOfkoJR6szxvaXNQHjT9A5MNQKonR/I+tSR8vXMhaf5Y8If+AhnYKNRBOsYQXYDVPtehyQbjBFozO4S4jusGL3I3qi9S7yEdObYHfL5kJ76bzlKXeGo2DReBAb6+Xxkv9aEjWhoTp7d7V0OCETYMS05NsvW4qNWi1QOCgEHTjdQN0wwCNd0FJJdC4EsgZSmZ4Ssb2D8jLEcut x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR12MB7031.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(366004)(451199021)(33656002)(86362001)(110136005)(316002)(66556008)(66446008)(64756008)(66946007)(66476007)(4326008)(76116006)(478600001)(7696005)(55016003)(2906002)(8936002)(8676002)(5660300002)(52536014)(41300700001)(30864003)(38070700005)(38100700002)(122000001)(26005)(186003)(53546011)(9686003)(6506007)(83380400001)(71200400001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?YviDoEORGKG6D/eM/jrLelejZloYVgJQel2E59zrQXZgKu7svsFOFnmr+I7F?= =?us-ascii?Q?6wUgt3W59Gt96Put81htibUAGOanZ4U30prj+RGCzy/D0xq5UMiQRqJmdQEZ?= =?us-ascii?Q?jnNynldgVbcyPJfeKJ9xRJFgqTQxnbP0IAOKELLEm/8hfhNyS64vv7Dl1cz+?= =?us-ascii?Q?o1oSl+HDqPv+jCWWxrgPv/M80kza6XNxNvMF9HVbXf4k7YZkLDBCGHlFtRQ4?= =?us-ascii?Q?1LdKdMKmEZbfQVWXobkK0xAy8V0cDYKkkfIJ0W6D8Jh3qT3lAdvvGeBRbl10?= =?us-ascii?Q?Aob2j/ibeU58nd4HtRAiYNyrMVA0yF0OGbvl01YgmP06K7BlALASW6cn5/Eo?= =?us-ascii?Q?cuKWohscMwpHeuXTkHtABc1QVHRnQo/QwygaXFCHJzTXgK2bftQbKv2f3ih6?= =?us-ascii?Q?mFLvwSqpk6JVcEmwK5rHkx7rkPHOlot+hB9XnkL1xGVqRJQz9cZrVp41EH3O?= =?us-ascii?Q?F3gXgq4PWDVoNHDK61XVl/eeJUIYhnJUO4KmYv6hmZ32qHxM8AiQ5SnbbgG/?= =?us-ascii?Q?ZRi7YTa/+JMiQC648S+Uvr2ZdzNawSmJEja+kIciyBv/chkW2HU8juTmHWKQ?= =?us-ascii?Q?4Pb/5S24J6R9lARnEeojfvd9pQe7nDt6/IZ6xozhLyPVCw5ewyEI7bCqvARI?= =?us-ascii?Q?7jQOm6ju+bBw0ZyUvYRieg4QYHG+27iEwD3kagz7Qex9DPjizUGMRQSrWFBR?= =?us-ascii?Q?9vuxQLzd4qRU2j7wccpuSUQXobHxnR2A+p/H1onqad1vA0uWqTICLrVe4wnC?= =?us-ascii?Q?UOLGEsikzBGbZnUNcBHjTiDWmKwqsHPsMvQr44L8o5FCqQJW3wELQapWuT1n?= =?us-ascii?Q?x/3/aNZhxOfbf0VtOM2zHGbHp2M/M06AHJl33RtIVnF7s5DqR+ojPswddv+L?= =?us-ascii?Q?fDm/sStZvn9Q8Bu5mG4BS1meL1KjCyogNdbWQDml2gX2hGU5W8SvaeesKk0e?= =?us-ascii?Q?WA9IZkRAcfDOWCaPWDvuGR+L/TNSR7E2dXm6sEy/OlTtAqxCu5rb/mC1W6kB?= =?us-ascii?Q?TjGOdUSelhl7AeC0lMcfmHMVXZtjsxamQ1JlHccxwVwpXoLnZu9Rnx3enURY?= =?us-ascii?Q?dhf5F2KJtLGAHyGVr4yk02NO9Sxrhii9tmxC3Zw/DG+6Hi9uqfad+tTASkgj?= =?us-ascii?Q?5AV5CcSMXUqt2TWmcDbMauTBNOJKXV1bjMe1t66PGMe4Sli6vN8z4G5PTdF4?= =?us-ascii?Q?bDItAxiVHYBJoUidqiMKQ5cwme6Pnccr/0DgnWS4j5qn8D5Hir4yQ04mU3Qz?= =?us-ascii?Q?seed/7CyJke3f1eVAS48LTRZwfU3nL0xWcdlxF/vT+Ynb0CjgySjoX1Chf25?= =?us-ascii?Q?o3PNY3z8uY+uzedhCY90MO9606Md+E4bpm880nzFXWhNlXmVGUORz+fScAOB?= =?us-ascii?Q?mLqksAuVD/FnzeyMUq9PNNEQr2fegWYjQDrgjXN0CtSdya5otc4QhaYZKh45?= =?us-ascii?Q?EY0R9Jmd/K4kOo9S/c0Rc02c48k9+/LxLQPd+e7tA3gbluIkioUMOepfohwK?= =?us-ascii?Q?+RGdG4Kj+u9LIzlP7sV6fFWAtqEYwhU4YqJ8Bi48qg2L7y8k6+aGXoORqwri?= =?us-ascii?Q?3zUpr+JUx2v/LlxRMnY=3D?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 973b64d9-9465-4ba2-a326-08db55178306 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 May 2023 07:39:27.3462 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5rQlahZ3YBBJLPPYl7AkzjHKz8w+Lf7DsCEkTOKdNVdC07VldYtpip7CqCyRsWt3+SIXN4websWxpvqP50HtNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8933 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for your review comments, Abner! Updated in version 2 patch-set. Regards, Nickle > -----Original Message----- > From: Chang, Abner > Sent: Monday, May 15, 2023 11:20 AM > To: Nickle Wang ; devel@edk2.groups.io > Cc: Igor Kulchytskyy > Subject: RE: [edk2-redfish-client][PATCH 2/3] RedfishClientPkg: Add Redfi= sh > Resource Addendum Library >=20 > External email: Use caution opening links or attachments >=20 >=20 > [AMD Official Use Only - General] >=20 > Hi Nickle, > I read though this patch and was confused by function naming and the func= tion > description in the function header. I think we have to revise it and mak= e the > description of functionality clear for user to follow. >=20 > I apologize if we ever discussed this before however I don't have the syn= chronous > mind now. >=20 > 1. Protocol definitions > This protocol is provided by platform that would like to add an additi= onal Redfish > resource in "Oem" property or to add other platform specific property in = the > name other than "Oem". > Both of two protocol interfaces give platform an chance to add "OEM" o= r other > Redfish property, however the naming of function prototypes are not consi= stent. > The naming of "OemCallback" and "ProvisioningCallback" are also not consi= stent. >=20 > How do you think the naming below, >=20 > struct _EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL { > UINT64 Revision; > EDKII_REDFISH_RESOURCE_ADDENDUM_OEM > AddAddendumOemRedfishResource; ///< > EDKII_REDFISH_RESOURCE_ADDENDUM_OTHER > AddAddendumOtherRedfishResource; ///< > }; > Would above look simple and clear? Also, please add some comments to thes= e > two functions if you are agree with this change. >=20 > 2. Function naming in the library, > RedfishGetOemData -> RedfishGetAddendumOemData > RedfishGetAddendumData-> RedfishGetAddendumOtherData >=20 > 3. The current description in function header looks to me not quite clear= . Please > elaborates some more functionality in the function header and parameters >=20 > 4. Shall we have to update readme.md? >=20 > Thanks > Abner >=20 >=20 > > -----Original Message----- > > From: Nickle Wang > > Sent: Friday, May 12, 2023 3:23 PM > > To: devel@edk2.groups.io > > Cc: Chang, Abner ; Igor Kulchytskyy > > > > Subject: [edk2-redfish-client][PATCH 2/3] RedfishClientPkg: Add > > Redfish Resource Addendum Library > > > > Caution: This message originated from an External Source. Use proper > > caution when opening attachments, clicking links, or responding. > > > > > > Implement RedfishAddendumLib to support Redfish Resource Addendum > > Protocol. > > Feature driver calls this library to get addendum data before > > providing data to Redfish service > > > > Signed-off-by: Nickle Wang > > Cc: Abner Chang > > Cc: Igor Kulchytskyy > > --- > > RedfishClientPkg/RedfishClientLibs.dsc.inc | 4 +- > > RedfishClientPkg/RedfishClientPkg.dsc | 2 + > > .../RedfishAddendumLib/RedfishAddendumLib.inf | 40 +++ > > .../Include/Library/RedfishAddendumLib.h | 65 +++++ > > .../RedfishAddendumLib/RedfishAddendumLib.c | 262 > > ++++++++++++++++++ > > 5 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 > > RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > > create mode 100644 > > RedfishClientPkg/Include/Library/RedfishAddendumLib.h > > create mode 100644 > > RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.c > > > > diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc > > b/RedfishClientPkg/RedfishClientLibs.dsc.inc > > index fe0c4b08..5ea38015 100644 > > --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc > > +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc > > @@ -2,10 +2,11 @@ > > # Redfish DSC include file for [LibraryClasses*] section of all Archit= ectures. > > # > > # This file can be included to the [LibraryClasses*] section(s) of a > > platform DSC file -# by using "!include RedfishPkg/RedfisLibs.dsc.inc" > > to specify the library instances > > +# by using "!include RedfishPkg/RedfishLibs.dsc.inc" to specify the > > +library > > instances > > # of EDKII network library classes. > > # > > # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development > > LP
> > +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights > > reserved. > > # > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > # > > @@ -37,3 +38,4 @@ > > > > EdkIIRedfishResourceConfigLib|RedfishClientPkg/Library/EdkIIRedfishRes > > EdkIIRedfishResourceConfigLib|ou > > rceConfigLib/EdkIIRedfishResourceConfigLib.inf > > > > RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventL > > RedfishEventLib|ib.i > > nf > > > > RedfishVersionLib|RedfishClientPkg/Library/RedfishVersionLib/RedfishVe > > RedfishVersionLib|rsi > > onLib.inf > > + > > RedfishAddendumLib|RedfishClientPkg/Library/RedfishAddendumLib/Redfi > > shAddendumLib.inf > > diff --git a/RedfishClientPkg/RedfishClientPkg.dsc > > b/RedfishClientPkg/RedfishClientPkg.dsc > > index 2b2149cc..d3b645b6 100644 > > --- a/RedfishClientPkg/RedfishClientPkg.dsc > > +++ b/RedfishClientPkg/RedfishClientPkg.dsc > > @@ -2,6 +2,7 @@ > > # Redfish Client Package > > # > > # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP. > > +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights > > reserved. > > # > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > # > > @@ -49,5 +50,6 @@ > > > > > > RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilit > > yLib.i > > nf > > RedfishClientPkg/PrivateLibrary/RedfishLib/RedfishLib.inf > > + RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > > > > !include RedfishClientPkg/RedfishClient.dsc.inc > > diff --git > > a/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > > new file mode 100644 > > index 00000000..1ecfaa69 > > --- /dev/null > > +++ > > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf > > @@ -0,0 +1,40 @@ > > +## @file > > +# > > +# Copyright (c) 2022-2023, 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-27B0FA79A= 7AF > > + 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/Include/Library/RedfishAddendumLib.h > > b/RedfishClientPkg/Include/Library/RedfishAddendumLib.h > > new file mode 100644 > > index 00000000..d77347fd > > --- /dev/null > > +++ b/RedfishClientPkg/Include/Library/RedfishAddendumLib.h > > @@ -0,0 +1,65 @@ > > +/** @file > > + This file defines the Redfish addendum library interface. > > + > > + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All > > + rights > > reserved. > > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef REDFISH_ADDENDUM_LIB_H_ > > +#define REDFISH_ADDENDUM_LIB_H_ > > + > > +#include > > +#include > > +#include > > + > > +/** > > + Provide redfish resource 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_NOT_FOUND No addendum protocol is found in sy= stem. > > + @retval EFI_UNSUPPORTED No addendum data is required in giv= en > > 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 > > + ); > > + > > +/** > > + Provide 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_NOT_FOUND No addendum protocol is found in sy= stem. > > + @retval EFI_UNSUPPORTED No OEM data is required in given sc= hema. > > + @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 00000000..6aa6e3cc > > --- /dev/null > > +++ > > b/RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.c > > @@ -0,0 +1,262 @@ > > +/** @file > > + Redfish addendum library helps Redfish application to get addendum > > +data > > and OEM > > + data from platform driver. > > + > > + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All > > + rights > > reserved. > > + > > + 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 > > + release > > 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; > > +} > > + > > +/** > > + Provide redfish resource 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. > > + It is the caller's responsibility to f= ree this buffer. > > + > > + @retval EFI_SUCCESS Addendum data is attached. > > + @retval EFI_NOT_FOUND No addendum protocol is found in sy= stem. > > + @retval EFI_UNSUPPORTED No addendum data is required in giv= en > > 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; > > +} > > + > > +/** > > + Provide 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_NOT_FOUND No addendum protocol is found in sy= stem. > > + @retval EFI_UNSUPPORTED No OEM data is required in given sc= hema. > > + @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 JsonValueOem; > > + 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; > > + JsonValueOem =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; > > + } > > + > > + JsonValueOem =3D JsonValueInitObject (); if ((JsonValueOem =3D=3D N= ULL) > > + || !JsonValueIsObject (JsonValueOem)) { > > + 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, JsonValue= Oem); > > + if (!EFI_ERROR (Status)) { > > + Status =3D JsonObjectSetValue (JsonValue, "Oem", JsonValueOem); > > + 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 (JsonValueOem !=3D NULL) { > > + JsonValueFree (JsonValueOem); > > + } > > + > > + if (SchemaInfo.Uri !=3D NULL) { > > + FreePool (SchemaInfo.Uri); > > + } > > + > > + return Status; > > +} > > -- > > 2.17.1