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 CC1DFAC0B16 for ; Thu, 7 Mar 2024 03:58:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=jOjPc/OWEaB/HcnZmtIb2/oRHJa2fujBXKfhAjfuBv0=; c=relaxed/simple; d=groups.io; h=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=20240206; t=1709783926; v=1; b=pV1muuQKDKPxl1aG1InwD2onJXCwORRj+fNZj/lY97KotAZ5S6tKuDUJmYB2lZMmHdGPBkEL ialbPAIWVCdCluf1PioK44ddIJHT1NeB8YhtcaGaslGS1raHzhnQevZbZrWgeUJ0um1/M2J+QJ1 gEf17YJJpcPN1Cm1dW30030TLMHlpnjDZhEbUB+Ml/5/Q4I5TU6qzSzNdtZndTT9AdZBfiOTHbf 3E983/HcpJ9f7l4N64RSZGmY2lJQxh6A0neyUlfJGPkTxb36WYJLda50UoB9Uo82h+4iNGXoJJ8 n2xlO0RLnK0tA03odo18XhnqfgoidavJIcMc7WHWQNRBg== X-Received: by 127.0.0.2 with SMTP id yi9HYY7687511xZTtUYwiec6; Wed, 06 Mar 2024 19:58:46 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.76]) by mx.groups.io with SMTP id smtpd.web11.15525.1709783925323557683 for ; Wed, 06 Mar 2024 19:58:45 -0800 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by DS7PR12MB5912.namprd12.prod.outlook.com (2603:10b6:8:7d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26; Thu, 7 Mar 2024 03:58:42 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::e006:4173:de2c:aca0]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::e006:4173:de2c:aca0%5]) with mapi id 15.20.7362.024; Thu, 7 Mar 2024 03:58:42 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH v3 2/2] RedfishClientPkg/Edk2RedfishResourceConfigLib: support config2 protocol Thread-Topic: [edk2-redfish-client][PATCH v3 2/2] RedfishClientPkg/Edk2RedfishResourceConfigLib: support config2 protocol Thread-Index: AQHacD7yGBDDOmydBUq/ppYQhmhrhbErpvtg Date: Wed, 06 Mar 2024 19:58:45 -0800 Message-ID: References: <20240307032358.42644-1-nicklew@nvidia.com> In-Reply-To: <20240307032358.42644-1-nicklew@nvidia.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=4a8f9557-370a-435f-8918-5eb5477857c0;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-03-07T03:58:38Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|DS7PR12MB5912:EE_ x-ms-office365-filtering-correlation-id: 6f9a859e-39df-4912-e769-08dc3e5ae12c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 2qH6NDEN2f4682DybawILUUp4lYwTuA4jw3Twy95nieP0Sgpdc4+/D8BlkzGfPMa2wWXhR3vZ0896Vq2gA6g7d1WZzlWH+bJGEKbrUkzcPyRuH2I1MELwMCTjXJ08cihFLe69LX0YWW6EAE0nSwLaZklgxahkBV6/4GpBNjeQZaXikdML2UNXFJXEguWx37ipGW2BCLFdr+SYkVOkb+LdyTKnsvdsiGDA4HWn+Ny3Ni8O9xqhZKw/UB0qG7eXTRaTJ0J35SobIU8/HJX2OGMfEKi7WT+ORp6m+RtY1kK72QXldunnpmuPw/YDRcFHOEeRdeB8jdFNo8m62CcaSuHuKoTxBvYBUQocmxrLYQHZMDgAORlyx+UioZsQUtSJVvi5btlgubjK62qdPyMy9XSFOgjcIdB/oBcamy+ev3x8JLd+R7hNTbAyvvE/Qra08p0iplq+LB863CUwYiItGy7Te985M8ao98a8bzI+AeYYd0O/GngDF9wn18l4r1L6jojWFjYxvIdt1vKPQZRrW+a6+mzRI7tflbgptVylZihhnRntHAEaTld7kx7ANy5tQlty9x7rBaatCVs72yjeB0vsbA3aILESyWDU0eUxAVUGfJFmLV5xwWXuQFVIWNwBJN7sRvjEm7IvA07Djzlb6ow4VP9F8pEr1/XBnhjJcTM/efpUmlbZjF1W9ZZijmqFt2HN6XU9egreg1Ybjo+v2ydyQ== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?C1JS/KFjP7LsD8bFPCZwZRSYdu4ae+ft2W8JWxcOmWl6iHeUzBPm81btFnhJ?= =?us-ascii?Q?KpAOWmxetw0Ogppn5d3zJNVCW83vhfyi6wNv7a7e8cjAXUJTU4FkB5ANO1to?= =?us-ascii?Q?Z4cp/u42o++OTwvTRtE22ImPGZqeOMYGi36aVEkBQGI3pENW6wEoU11kJhu2?= =?us-ascii?Q?yjHcmbJ8JgECgC3sKKwzrtdJqeZoTNKdvjDJaGGQF0xFql7NKVCnb70Euave?= =?us-ascii?Q?rdcyDJpODOIKNrY0bqTfOW6SclYC78i7g9IrHNwfZS+/pY/v7AgpMrOqJYlE?= =?us-ascii?Q?BSNKLhEKCZQqYer+zN5mW/etUsuHSVSnXJ9uXqLdtzf9S6vE4+oIGeSFCwS7?= =?us-ascii?Q?1PBB0IXjv4aeEhZXOatFLvIKWxKnJqCIClprMHFE3P8GG3s0mjM9HoAoUG1j?= =?us-ascii?Q?aCrYbdRYOF2jtcuJLAmnFMAZnE2YYo0how2Y+Z37UzZWZkjTmqYdbRH/dNX+?= =?us-ascii?Q?p7L34KmeXZBqpqYhGofHMD8raHcUwAnKpPNiNLSdT4jDyOH7oGUzhNxC00eR?= =?us-ascii?Q?Pnjkug6d+TJ309v/80YoocQUsjXgQuSD94dz7nbKV2TSCL60l7EP/HH9xzDh?= =?us-ascii?Q?yeBmBpGB/AaQoQcc2xQ/WAf9c5da+URfQD/Hp1Jjqb3JfrQagiANo9L+L8xT?= =?us-ascii?Q?fiq3UmB80jQv5f9UTDjhhi83aaIFyd+9ocsodRxgxyhRajkq2U4ue8oVS1Pe?= =?us-ascii?Q?0pJmF7hj2GQPjNjQVObReEu1lhtRqJ8WWcdFvQxfc/K/1VVPmC9cYuAy0L8A?= =?us-ascii?Q?zrZQDNlHZ3TVmuPZEESP5MbIDCn0IDz7z0Jv2XvN1dGfoZRRqDcdtm+u7eLZ?= =?us-ascii?Q?gUPkfs9MH6PaQhQqiP8fywjc/nupU4qoHZtK9cm3dzk7MhsHERaaJsvLULLu?= =?us-ascii?Q?j/01oy/utUgVt/KJgs9sJOzFu3gWrN75fcdfH9nfquP0nlco+YbjguDb2IAV?= =?us-ascii?Q?Uc21CkhbuMnmyuwpcdqxeIS7VYGNxZ8L3JueTZoHpgAUwFLkZgYaMvVG2FiE?= =?us-ascii?Q?67LJAZbz03yrj0TevXmQc/vXSVjHhp2GDPkvWE+oFbxcSEMjMRL/OL31bO1/?= =?us-ascii?Q?W8HorSavQYUlnbHhYDQ3piP0ql0HDKbYHeHRY8OAmWbVq+s0hJeu+10RNdN2?= =?us-ascii?Q?9tQX2uLyJ/26ej485JT6XHWLc323EazOcu6ePcd0qEE3iLbHxeXOEHElmZ6M?= =?us-ascii?Q?ReEgjsGSD0RLNTmqHCKJ2t2cZIcncl8dw690eWEnSNOAQ4DLmzZALTK5+din?= =?us-ascii?Q?19wpDwomN2m8w0YeljG6ikkeDvuyXhw/nRlyhChi9qd0X6W5W+lZKuNkMPt5?= =?us-ascii?Q?Fcg2DklHOaBb1kUKpEPvGuv7M9uyBhTk+gvEazYiODfBvzZrCUIbFWLXKlpr?= =?us-ascii?Q?B9a7ca20rizF+86RHtZUpdPRYZELFBZkDNuAIM3h4Mx5qV1aMAH4vBjwX3je?= =?us-ascii?Q?BuYc5pym0LpnW29Uh/aG6zYWMX3iVlNqcH7qspcqqtcX1fws3hTXmyNU6GKy?= =?us-ascii?Q?WBq6FIFKIurMxYlQo6W7mUCyoLWy0nN8x83cyhkFsBWcVy35CFq4xfogxB9T?= =?us-ascii?Q?Di2zzSXJNs5f2MJ2FyAG+kLbZf9eqUpG6dNxK3DE?= 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: 6f9a859e-39df-4912-e769-08dc3e5ae12c X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2024 03:58:42.5206 (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: 7qedOM8tQZ0kdqvJjL3PfVEd1FxK/Hrt+x0ZaCY4ChTaBb9a7oixCJugyheQQeQJ+86/t2LfrHyZ/DJGQDe86Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5912 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: ttyWAhZfg9xzhgJw5ImiBS2Xx7686176AA= 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=20240206 header.b=pV1muuQK; dmarc=pass (policy=none) header.from=groups.io; 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] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Thursday, March 7, 2024 11:24 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [edk2-redfish-client][PATCH v3 2/2] > RedfishClientPkg/Edk2RedfishResourceConfigLib: support config2 protocol > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > -Support Redfish resource config2 protocol in Edk2RedfishResourceConfigLi= b. > This library will try Redfish resource config2 protocol first. And if > there is no matching protocol found, Redfish resource config protocol wil= l > be used. > -Because EdkIIRedfishResourceConfigLib is updated to support Redfish > resource config2 protocol, update corresponding functions in feature > drivers. > > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > .../EdkIIRedfishResourceConfigLib.inf | 4 +- > .../Library/EdkIIRedfishResourceConfigLib.h | 33 +- > .../EdkIIRedfishResourceConfigInternal.h | 44 ++ > .../Features/Bios/v1_0_9/Common/BiosCommon.c | 14 +- > .../BootOptionCollectionDxe.c | 14 +- > .../ComputerSystemCollectionDxe.c | 16 +- > .../MemoryCollectionDxe/MemoryCollectionDxe.c | 16 +- > .../EdkIIRedfishResourceConfigLib.c | 391 ++++++++++++++---- > 8 files changed, 415 insertions(+), 117 deletions(-) > create mode 100644 > RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResour= c > eConfigInternal.h > > diff --git > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.inf > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.inf > index 2d10445f0..998a05c80 100644 > --- > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.inf > +++ > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.inf > @@ -22,6 +22,7 @@ > # > > [Sources] > + EdkIIRedfishResourceConfigInternal.h > EdkIIRedfishResourceConfigLib.c > > [Packages] > @@ -42,8 +43,9 @@ > RedfishHttpLib > > [Protocols] > - gEdkIIRedfishResourceConfigProtocolGuid ## CONSUMES ## > + gEdkIIRedfishResourceConfigProtocolGuid ## CONSUMES ## > gEdkIIRedfishFeatureInterchangeDataProtocolGuid ## CONSUMES ## > + gEdkIIRedfishResourceConfig2ProtocolGuid ## CONSUEMS ## > > [Pcd] > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize > diff --git a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigL= ib.h > b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > index 3aa953cec..57c7f2b80 100644 > --- a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > +++ b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > > /** > @@ -23,6 +24,7 @@ > > @param[in] Schema Redfish schema information. > @param[in] Uri Target URI to create resource. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > @param[in] InformationExchange Pointer to > RESOURCE_INFORMATION_EXCHANGE. > @param[in] HttpPostMode TRUE if resource does not exist, HTTP= POST > method is used. > FALSE if the resource exist but some = of properties are > missing, > @@ -33,9 +35,11 @@ > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigProvisioning ( > IN REDFISH_SCHEMA_INFO *Schema, > IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL, > IN RESOURCE_INFORMATION_EXCHANGE *InformationExchange, > IN BOOLEAN HttpPostMode > ); > @@ -45,15 +49,18 @@ EdkIIRedfishResourceConfigProvisioning ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > > @retval EFI_SUCCESS Value is returned successfully. > @retval Others Some error happened. > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigConsume ( > IN REDFISH_SCHEMA_INFO *Schema, > - IN EFI_STRING Uri > + IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL > ); > > /** > @@ -61,21 +68,25 @@ EdkIIRedfishResourceConfigConsume ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > > @retval EFI_SUCCESS Value is returned successfully. > @retval Others Some error happened. > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigUpdate ( > IN REDFISH_SCHEMA_INFO *Schema, > - IN EFI_STRING Uri > + IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL > ); > > /** > Check resource on given URI. > > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > > @retval EFI_SUCCESS Value is returned successfully. > @retval EFI_UNSUPPORTED This resource is not owned by feature > driver. > @@ -84,9 +95,11 @@ EdkIIRedfishResourceConfigUpdate ( > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigCheck ( > IN REDFISH_SCHEMA_INFO *Schema, > - IN EFI_STRING Uri > + IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL > ); > > /** > @@ -94,6 +107,7 @@ EdkIIRedfishResourceConfigCheck ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > @param[in] InformationExchange Pointer to > RESOURCE_INFORMATION_EXCHANGE. > > @retval EFI_SUCCESS This is target resource which we want= to handle. > @@ -107,10 +121,12 @@ EdkIIRedfishResourceConfigCheck ( > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigIdentify ( > IN REDFISH_SCHEMA_INFO *Schema, > IN EFI_STRING Uri, > - IN RESOURCE_INFORMATION_EXCHANGE *InformationExchangeUri > + IN CHAR8 *JsonText OPTIONAL, > + IN RESOURCE_INFORMATION_EXCHANGE *InformationExchange > ); > > /** > @@ -126,6 +142,7 @@ EdkIIRedfishResourceConfigIdentify ( > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceSetConfigureLang ( > IN EFI_HANDLE ImageHandle, > IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigLangList > @@ -133,11 +150,14 @@ EdkIIRedfishResourceSetConfigureLang ( > > /** > > - Get schema information by given protocol and service instance. > + Get schema information by given protocol and service instance if JsonT= ext > + is NULL or empty. When JsonText is provided by caller, this function r= ead > + schema information from JsonText. > > @param[in] RedfishService Pointer to Redfish service instance. > @param[in] JsonStructProtocol Json Structure protocol instance. > @param[in] Uri Target URI. > + @param[in] JsonText Redfish data in JSON format. This is o= ptional. > @param[out] SchemaInfo Returned schema information. > > @retval EFI_SUCCESS Schema information is returned success= fully. > @@ -145,10 +165,12 @@ EdkIIRedfishResourceSetConfigureLang ( > > **/ > EFI_STATUS > +EFIAPI > GetRedfishSchemaInfo ( > IN REDFISH_SERVICE *RedfishService, > IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, > IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL, > OUT REDFISH_SCHEMA_INFO *SchemaInfo > ); > > @@ -164,6 +186,7 @@ GetRedfishSchemaInfo ( > > **/ > EFI_STATUS > +EFIAPI > GetSupportedSchemaVersion ( > IN CHAR8 *Schema, > OUT REDFISH_SCHEMA_INFO *SchemaInfo > diff --git > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigInternal.h > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigInternal.h > new file mode 100644 > index 000000000..51984738b > --- /dev/null > +++ > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigInternal.h > @@ -0,0 +1,44 @@ > +/** @file > + Header file of EDKII Redfish Resource Config Library. > + > + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_RESOURCE_CONFIG_INTERNAL_H_ > +#define REDFISH_RESOURCE_CONFIG_INTERNAL_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/// > +/// Definition of EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOLS > +/// > +typedef union { > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *ConfigProtocol; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Config2Protocol; > +} EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOLS; > + > +/// > +/// Definition of REDFISH_CONFIG_PROTOCOL_CACHE > +/// > +typedef struct { > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOLS RedfishResourceConfig; > + EFI_HANDLE CachedHandle; > + REDFISH_SCHEMA_INFO SchemaInfoCache; > +} REDFISH_CONFIG_PROTOCOL_CACHE; > + > +#define SCHEMA_NAME_PREFIX "x-uefi-redfish-" > +#define SCHEMA_NAME_PREFIX_OFFSET (AsciiStrLen > (SCHEMA_NAME_PREFIX)) > + > +#endif > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > index 1f3c30147..1eb269a84 100644 > --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > @@ -782,7 +782,7 @@ HandleResource ( > > DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n", > __func__, Uri)); > > - Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > + Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, NULL, &SchemaInfo); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s > %r\n", __func__, Uri, Status)); > return Status; > @@ -795,7 +795,7 @@ HandleResource ( > DEBUG ((REDFISH_DEBUG_TRACE, "%a Identify for %s\n", __func__, Uri)); > ConfigLang =3D RedfishGetConfigLanguage (Uri); > if (ConfigLang =3D=3D NULL) { > - Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Pri= vate- > >InformationExchange); > + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, NUL= L, > Private->InformationExchange); > if (EFI_ERROR (Status)) { > if (Status =3D=3D EFI_UNSUPPORTED) { > DEBUG ((DEBUG_MANAGEABILITY, "%a, \"%s\" is not handled by us\n"= , > __func__, Uri)); > @@ -811,17 +811,17 @@ HandleResource ( > } > > // > - // Check and see if target property exist or not even when collection > memeber exists. > + // Check and see if target property exist or not even when collection > member exists. > // If not, we sill do provision. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > // > // The target property does not exist, do the provision to create pr= operty. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)= ); > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, > Private->InformationExchange, FALSE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri,= NULL, > Private->InformationExchange, FALSE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n"= , > __func__, Status)); > } > @@ -833,7 +833,7 @@ HandleResource ( > // Consume first. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to consume resource for: %s: %r\n", > __func__, Uri, Status)); > } > @@ -842,7 +842,7 @@ HandleResource ( > // Patch. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to update resource for: %s: %r\n", > __func__, Uri, Status)); > } > diff --git > a/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe > .c > b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe > .c > index 4f94a4495..cd1437f54 100644 > --- > a/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe > .c > +++ > b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe > .c > @@ -44,7 +44,7 @@ HandleResource ( > > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: > process resource for: %s\n", __func__, Uri)); > > - Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > + Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, NULL, &SchemaInfo); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to get schema information from: %s > %r\n", __func__, Uri, Status)); > return Status; > @@ -58,7 +58,7 @@ HandleResource ( > SystemRestDetected =3D FALSE; > ConfigLang =3D RedfishGetConfigLanguage (Uri); > if (ConfigLang =3D=3D NULL) { > - Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Pri= vate- > >InformationExchange); > + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, NUL= L, > Private->InformationExchange); > if (EFI_ERROR (Status)) { > if (Status =3D=3D EFI_UNSUPPORTED) { > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: > \"%s\" is not handled by us\n", __func__, Uri)); > @@ -88,7 +88,7 @@ HandleResource ( > // If not, we sill do provision. > // > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a Check > for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > if (Status =3D=3D EFI_UNSUPPORTED) { > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: > \"%s\" is not handled by us\n", __func__, Uri)); > @@ -99,7 +99,7 @@ HandleResource ( > // The target property does not exist, do the provision to create pr= operty. > // > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a > provision for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, > Private->InformationExchange, FALSE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri,= NULL, > Private->InformationExchange, FALSE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to provision with GET mode: %r\n"= , > __func__, Status)); > } > @@ -114,7 +114,7 @@ HandleResource ( > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a > system has been reset to default setting. ignore pending settings because= they > may be stale values\n", __func__)); > } else { > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a > consume for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri, NULL= ); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to consume resource for: %s: %r\n= ", > __func__, Uri, Status)); > } > @@ -124,7 +124,7 @@ HandleResource ( > // Patch. > // > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a update > for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to update resource for: %s: %r\n", > __func__, Uri, Status)); > } > @@ -262,7 +262,7 @@ CreateCollectionResource ( > > DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a: > supported schema: %a %a.%a.%a\n", __func__, SchemaInfo.Schema, > SchemaInfo.Major, SchemaInfo.Minor, SchemaInfo.Errata)); > > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, > BootOptionUri, Private->InformationExchange, TRUE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, > BootOptionUri, NULL, Private->InformationExchange, TRUE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to create resource for: %s: %r\n", > __func__, BootOptionUri, Status)); > } > diff --git > a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > index 975ba0564..55a6d07db 100644 > --- > a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > +++ > b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > @@ -35,7 +35,7 @@ HandleResource ( > > DEBUG ((REDFISH_DEBUG_TRACE, "%a: process resource for: %s\n", > __func__, Uri)); > > - Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > + Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, NULL, &SchemaInfo); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to get schema information from: %s > %r\n", __func__, Uri, Status)); > return Status; > @@ -48,7 +48,7 @@ HandleResource ( > DEBUG ((REDFISH_DEBUG_TRACE, "%a Identify for %s\n", __func__, Uri)); > ConfigLang =3D RedfishGetConfigLanguage (Uri); > if (ConfigLang =3D=3D NULL) { > - Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Pri= vate- > >InformationExchange); > + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, NUL= L, > Private->InformationExchange); > if (EFI_ERROR (Status)) { > if (Status =3D=3D EFI_UNSUPPORTED) { > DEBUG ((DEBUG_MANAGEABILITY, "%a: \"%s\" is not handled by us\n"= , > __func__, Uri)); > @@ -90,11 +90,11 @@ HandleResource ( > } > > // > - // Check and see if target property exist or not even when collection > memeber exists. > + // Check and see if target property exist or not even when collection > member exists. > // If not, we sill do provision. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > if (Status =3D=3D EFI_UNSUPPORTED) { > DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"%s\" is not handled by us\n", > __func__, Uri)); > @@ -105,7 +105,7 @@ HandleResource ( > // The target property does not exist, do the provision to create pr= operty. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)= ); > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, > Private->InformationExchange, FALSE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri,= NULL, > Private->InformationExchange, FALSE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to provision with PATCH mode: %r\= n", > __func__, Status)); > } > @@ -117,7 +117,7 @@ HandleResource ( > // Consume first. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to consume resource for: %s: %r\n", > __func__, Uri, Status)); > } > @@ -126,7 +126,7 @@ HandleResource ( > // Patch. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to update resource for: %s: %r\n", > __func__, Uri, Status)); > } > @@ -236,7 +236,7 @@ CreateCollectionResource ( > > DEBUG ((REDFISH_DEBUG_TRACE, "%a: supported schema: %a > %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, > SchemaInfo.Minor, SchemaInfo.Errata)); > > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Privat= e- > >CollectionUri, Private->InformationExchange, TRUE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Privat= e- > >CollectionUri, NULL, Private->InformationExchange, TRUE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: failed to create resource for: %s: %r\n", > __func__, Private->CollectionUri, Status)); > } > diff --git > a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c > index 1b7d74e86..d963fb52a 100644 > --- > a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c > +++ > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c > @@ -35,7 +35,7 @@ HandleResource ( > > DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n", > __func__, Uri)); > > - Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > + Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, NULL, &SchemaInfo); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s > %r\n", __func__, Uri, Status)); > return Status; > @@ -48,7 +48,7 @@ HandleResource ( > DEBUG ((REDFISH_DEBUG_TRACE, "%a Identify for %s\n", __func__, Uri)); > ConfigLang =3D RedfishGetConfigLanguage (Uri); > if (ConfigLang =3D=3D NULL) { > - Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Pri= vate- > >InformationExchange); > + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, NUL= L, > Private->InformationExchange); > if (EFI_ERROR (Status)) { > if (Status =3D=3D EFI_UNSUPPORTED) { > DEBUG ((DEBUG_MANAGEABILITY, "%a, \"%s\" is not handled by us\n"= , > __func__, Uri)); > @@ -86,17 +86,17 @@ HandleResource ( > } > > // > - // Check and see if target property exist or not even when collection > memeber exists. > + // Check and see if target property exist or not even when collection > member exists. > // If not, we sill do provision. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > // > // The target property does not exist, do the provision to create pr= operty. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)= ); > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, > Private->InformationExchange, FALSE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri,= NULL, > Private->InformationExchange, FALSE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n"= , > __func__, Status)); > } > @@ -108,7 +108,7 @@ HandleResource ( > // Consume first. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to consume resource for: %s: %r\n", > __func__, Uri, Status)); > } > @@ -117,7 +117,7 @@ HandleResource ( > // Patch. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri)); > - Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > + Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri, NULL); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to update resource for: %s: %r\n", > __func__, Uri, Status)); > } > @@ -227,7 +227,7 @@ CreateCollectionResource ( > > DEBUG ((REDFISH_DEBUG_TRACE, "%a, supported schema: %a > %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, > SchemaInfo.Minor, SchemaInfo.Errata)); > > - Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Privat= e- > >CollectionUri, Private->InformationExchange, TRUE); > + Status =3D EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Privat= e- > >CollectionUri, NULL, Private->InformationExchange, TRUE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to create resource for: %s: %r\n", > __func__, Private->CollectionUri, Status)); > } > diff --git > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.c > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.c > index 5d0944f8c..4ba5c309d 100644 > --- > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.c > +++ > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.c > @@ -7,32 +7,23 @@ > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL > *mRedfishResourceConfigProtocol =3D NULL; > -EFI_HANDLE mCachedHandle; > -EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL > mRedfishFeatureInterchangeData; > -REDFISH_SCHEMA_INFO mSchemaInfoCache; > > -#define SCHEMA_NAME_PREFIX "x-uefi-redfish-" > -#define SCHEMA_NAME_PREFIX_OFFSET (AsciiStrLen > (SCHEMA_NAME_PREFIX)) > +#include "EdkIIRedfishResourceConfigInternal.h" > + > +REDFISH_CONFIG_PROTOCOL_CACHE > *mRedfishResourceConfigCache =3D NULL; > +REDFISH_CONFIG_PROTOCOL_CACHE > *mRedfishResourceConfig2Cache =3D NULL; > +EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL > mRedfishFeatureInterchangeData; > > /** > > - Get schema information by given protocol and service instance. > + Get schema information by given protocol and service instance if JsonT= ext > + is NULL or empty. When JsonText is provided by caller, this function r= ead > + schema information from JsonText. > > @param[in] RedfishService Pointer to Redfish service instance. > @param[in] JsonStructProtocol Json Structure protocol instance. > @param[in] Uri Target URI. > + @param[in] JsonText Redfish data in JSON format. This is o= ptional. > @param[out] SchemaInfo Returned schema information. > > @retval EFI_SUCCESS Schema information is returned success= fully. > @@ -40,35 +31,45 @@ REDFISH_SCHEMA_INFO > mSchemaInfoCache; > > **/ > EFI_STATUS > +EFIAPI > GetRedfishSchemaInfo ( > IN REDFISH_SERVICE *RedfishService, > IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, > IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL, > OUT REDFISH_SCHEMA_INFO *SchemaInfo > ) > { > EFI_STATUS Status; > REDFISH_RESPONSE Response; > - REDFISH_PAYLOAD Payload; > - CHAR8 *JsonText; > + CHAR8 *JsonData; > EFI_REST_JSON_STRUCTURE_HEADER *Header; > > if ((RedfishService =3D=3D NULL) || (JsonStructProtocol =3D=3D NULL) |= | > IS_EMPTY_STRING (Uri) || (SchemaInfo =3D=3D NULL)) { > return EFI_INVALID_PARAMETER; > } > > + JsonData =3D NULL; > + Header =3D NULL; > ZeroMem (&Response, sizeof (Response)); > - Status =3D RedfishHttpGetResource (RedfishService, Uri, NULL, &Respons= e, > TRUE); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to get resource from %s: %r", > __func__, Uri, Status)); > - return Status; > - } > + if (IS_EMPTY_STRING (JsonText)) { > + Status =3D RedfishHttpGetResource (RedfishService, Uri, NULL, &Respo= nse, > TRUE); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: failed to get resource from %s: %r", > __func__, Uri, Status)); > + return Status; > + } > > - Payload =3D Response.Payload; > - ASSERT (Payload !=3D NULL); > + if (Response.Payload !=3D NULL) { > + JsonData =3D JsonDumpString (RedfishJsonInPayload (Response.Payloa= d), > EDKII_JSON_COMPACT); > + } > + } else { > + JsonData =3D AllocateCopyPool (AsciiStrSize (JsonText), JsonText); > + } > > - JsonText =3D JsonDumpString (RedfishJsonInPayload (Payload), > EDKII_JSON_COMPACT); > - ASSERT (JsonText !=3D NULL); > + if (IS_EMPTY_STRING (JsonData)) { > + Status =3D EFI_NOT_FOUND; > + goto ON_RELEASE; > + } > > // > // Convert JSON text to C structure. > @@ -76,17 +77,12 @@ GetRedfishSchemaInfo ( > Status =3D JsonStructProtocol->ToStructure ( > JsonStructProtocol, > NULL, > - JsonText, > + JsonData, > &Header > ); > if (EFI_ERROR (Status)) { > - if (Status =3D=3D EFI_UNSUPPORTED) { > - DEBUG ((DEBUG_ERROR, "%a, No proper JSON to C structure converter > for this Redfish resource.\n", __func__)); > - } else { > - DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, > Status)); > - } > - > - return Status; > + DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, > Status)); > + goto ON_RELEASE; > } > > AsciiStrCpyS (SchemaInfo->Schema, REDFISH_SCHEMA_STRING_SIZE, > Header->JsonRsrcIdentifier.NameSpace.ResourceTypeName); > @@ -94,14 +90,19 @@ GetRedfishSchemaInfo ( > AsciiStrCpyS (SchemaInfo->Minor, REDFISH_SCHEMA_VERSION_SIZE, > Header->JsonRsrcIdentifier.NameSpace.MinorVersion); > AsciiStrCpyS (SchemaInfo->Errata, REDFISH_SCHEMA_VERSION_SIZE, > Header->JsonRsrcIdentifier.NameSpace.ErrataVersion); > > +ON_RELEASE: > // > // Release resource. > // > JsonStructProtocol->DestoryStructure (JsonStructProtocol, Header); > - FreePool (JsonText); > + > + if (JsonData !=3D NULL) { > + FreePool (JsonData); > + } > + > RedfishHttpFreeResponse (&Response); > > - return EFI_SUCCESS; > + return Status; > } > > /** > @@ -116,6 +117,7 @@ GetRedfishSchemaInfo ( > > **/ > EFI_STATUS > +EFIAPI > GetSupportedSchemaVersion ( > IN CHAR8 *Schema, > OUT REDFISH_SCHEMA_INFO *SchemaInfo > @@ -257,17 +259,17 @@ GetRedfishResourceConfigProtocol ( > return NULL; > } > > - if (mRedfishResourceConfigProtocol !=3D NULL) { > - if ((AsciiStrCmp (Schema->Schema, mSchemaInfoCache.Schema) =3D=3D 0)= && > - (AsciiStrCmp (Schema->Major, mSchemaInfoCache.Major) =3D=3D 0) &= & > - (AsciiStrCmp (Schema->Minor, mSchemaInfoCache.Minor) =3D=3D 0) &= & > - (AsciiStrCmp (Schema->Errata, mSchemaInfoCache.Errata) =3D=3D 0)= ) > + if ((mRedfishResourceConfigCache !=3D NULL) && > (mRedfishResourceConfigCache->RedfishResourceConfig.ConfigProtocol !=3D > NULL)) { > + if ((AsciiStrCmp (Schema->Schema, mRedfishResourceConfigCache- > >SchemaInfoCache.Schema) =3D=3D 0) && > + (AsciiStrCmp (Schema->Major, mRedfishResourceConfigCache- > >SchemaInfoCache.Major) =3D=3D 0) && > + (AsciiStrCmp (Schema->Minor, mRedfishResourceConfigCache- > >SchemaInfoCache.Minor) =3D=3D 0) && > + (AsciiStrCmp (Schema->Errata, mRedfishResourceConfigCache- > >SchemaInfoCache.Errata) =3D=3D 0)) > { > if (Handle !=3D NULL) { > - *Handle =3D mCachedHandle; > + *Handle =3D mRedfishResourceConfigCache->CachedHandle; > } > > - return mRedfishResourceConfigProtocol; > + return mRedfishResourceConfigCache- > >RedfishResourceConfig.ConfigProtocol; > } > } > > @@ -310,9 +312,116 @@ GetRedfishResourceConfigProtocol ( > } > > if (Found) { > - mCachedHandle =3D HandleBuffer[Index]; > - mRedfishResourceConfigProtocol =3D Protocol; > - CopyMem (&mSchemaInfoCache, Schema, sizeof > (REDFISH_SCHEMA_INFO)); > + if (mRedfishResourceConfigCache !=3D NULL) { > + mRedfishResourceConfigCache->CachedHandle = =3D > HandleBuffer[Index]; > + mRedfishResourceConfigCache->RedfishResourceConfig.ConfigProtocol = =3D > Protocol; > + CopyMem (&mRedfishResourceConfigCache->SchemaInfoCache, Schema, > sizeof (REDFISH_SCHEMA_INFO)); > + } > + > + if (Handle !=3D NULL) { > + *Handle =3D HandleBuffer[Index]; > + } > + } > + > + FreePool (HandleBuffer); > + > + return (Found ? Protocol : NULL); > +} > + > +/** > + > + Find Redfish Resource Config2 Protocol that supports given schema and > version. > + > + @param[in] Schema Schema name. > + @param[out] Handle Pointer to receive the handle that has > EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL > + installed on it. > + > + @retval EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL * Pointer to > protocol > + @retval NULL No protocol f= ound. > + > +**/ > +EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL * > +GetRedfishResourceConfig2Protocol ( > + IN REDFISH_SCHEMA_INFO *Schema, > + OUT EFI_HANDLE *Handle OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + EFI_HANDLE *HandleBuffer; > + UINTN NumberOfHandles; > + UINTN Index; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Protocol; > + REDFISH_SCHEMA_INFO SchemaInfo; > + BOOLEAN Found; > + > + if (IS_EMPTY_STRING (Schema->Schema) || > + IS_EMPTY_STRING (Schema->Major) || > + IS_EMPTY_STRING (Schema->Minor) || > + IS_EMPTY_STRING (Schema->Errata) > + ) > + { > + return NULL; > + } > + > + if ((mRedfishResourceConfig2Cache !=3D NULL) && > (mRedfishResourceConfig2Cache->RedfishResourceConfig.Config2Protocol !=3D > NULL)) { > + if ((AsciiStrCmp (Schema->Schema, mRedfishResourceConfig2Cache- > >SchemaInfoCache.Schema) =3D=3D 0) && > + (AsciiStrCmp (Schema->Major, mRedfishResourceConfig2Cache- > >SchemaInfoCache.Major) =3D=3D 0) && > + (AsciiStrCmp (Schema->Minor, mRedfishResourceConfig2Cache- > >SchemaInfoCache.Minor) =3D=3D 0) && > + (AsciiStrCmp (Schema->Errata, mRedfishResourceConfig2Cache- > >SchemaInfoCache.Errata) =3D=3D 0)) > + { > + if (Handle !=3D NULL) { > + *Handle =3D mRedfishResourceConfig2Cache->CachedHandle; > + } > + > + return mRedfishResourceConfig2Cache- > >RedfishResourceConfig.Config2Protocol; > + } > + } > + > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEdkIIRedfishResourceConfig2ProtocolGuid, > + NULL, > + &NumberOfHandles, > + &HandleBuffer > + ); > + if (EFI_ERROR (Status)) { > + return NULL; > + } > + > + Found =3D FALSE; > + > + for (Index =3D 0; Index < NumberOfHandles; Index++) { > + Status =3D gBS->HandleProtocol ( > + HandleBuffer[Index], > + &gEdkIIRedfishResourceConfig2ProtocolGuid, > + (VOID **)&Protocol > + ); > + if (EFI_ERROR (Status)) { > + continue; > + } > + > + Status =3D Protocol->GetInfo (Protocol, &SchemaInfo); > + if (EFI_ERROR (Status)) { > + continue; > + } > + > + if ((AsciiStrCmp (Schema->Schema, SchemaInfo.Schema) =3D=3D 0) && > + (AsciiStrCmp (Schema->Major, SchemaInfo.Major) =3D=3D 0) && > + (AsciiStrCmp (Schema->Minor, SchemaInfo.Minor) =3D=3D 0) && > + (AsciiStrCmp (Schema->Errata, SchemaInfo.Errata) =3D=3D 0)) > + { > + Found =3D TRUE; > + break; > + } > + } > + > + if (Found) { > + if (mRedfishResourceConfig2Cache !=3D NULL) { > + mRedfishResourceConfig2Cache->CachedHandle = =3D > HandleBuffer[Index]; > + mRedfishResourceConfig2Cache- > >RedfishResourceConfig.Config2Protocol =3D Protocol; > + CopyMem (&mRedfishResourceConfig2Cache->SchemaInfoCache, > Schema, sizeof (REDFISH_SCHEMA_INFO)); > + } > + > if (Handle !=3D NULL) { > *Handle =3D HandleBuffer[Index]; > } > @@ -379,6 +488,7 @@ InstallInterchangeDataProtocol ( > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceSetConfigureLang ( > IN EFI_HANDLE ImageHandle, > IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigLangList > @@ -411,7 +521,7 @@ EdkIIRedfishResourceSetConfigureLang ( > Interface->ResourceInformationExchage- > >ReturnedInformation.ConfigureLanguageList.List =3D > AllocateZeroPool (sizeof (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG) > * ConfigLangList->Count); > if (Interface->ResourceInformationExchage- > >ReturnedInformation.ConfigureLanguageList.List =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for > REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __func__)); > + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for > REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __func__)); > return EFI_OUT_OF_RESOURCES; > } > > @@ -425,10 +535,11 @@ EdkIIRedfishResourceSetConfigureLang ( > } > > /** > - Provising redfish resource by given URI. > + Provision redfish resource by given URI. > > @param[in] Schema Redfish schema information. > @param[in] Uri Target URI to create resource. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > @param[in] InformationExchange Pointer to > RESOURCE_INFORMATION_EXCHANGE. > @param[in] HttpPostMode TRUE if resource does not exist, HTTP= POST > method is used. > FALSE if the resource exist but some = of properties are > missing, > @@ -439,18 +550,41 @@ EdkIIRedfishResourceSetConfigureLang ( > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigProvisioning ( > IN REDFISH_SCHEMA_INFO *Schema, > IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL, > IN RESOURCE_INFORMATION_EXCHANGE *InformationExchange, > IN BOOLEAN HttpPostMode > ) > { > - EFI_HANDLE Handle; > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *protocol; > + EFI_HANDLE Handle; > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *ConfigProtocol; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Config2Protocol; > > - protocol =3D GetRedfishResourceConfigProtocol (Schema, &Handle); > - if ((protocol =3D=3D NULL) || (Handle =3D=3D NULL)) { > + // > + // Initialization. > + // > + Handle =3D NULL; > + ConfigProtocol =3D NULL; > + Config2Protocol =3D NULL; > + > + // > + // Try to use config2 protocol first. > + // > + Config2Protocol =3D GetRedfishResourceConfig2Protocol (Schema, &Handle= ); > + if ((Config2Protocol !=3D NULL) && (Handle !=3D NULL)) { > + // > + // Install EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL on > the child > + // feature driver handle. > + // > + InstallInterchangeDataProtocol (Handle, InformationExchange); > + return Config2Protocol->Provisioning (Config2Protocol, Uri, JsonText= , > HttpPostMode); > + } > + > + ConfigProtocol =3D GetRedfishResourceConfigProtocol (Schema, &Handle); > + if ((ConfigProtocol =3D=3D NULL) || (Handle =3D=3D NULL)) { > return EFI_DEVICE_ERROR; > } > > @@ -459,7 +593,7 @@ EdkIIRedfishResourceConfigProvisioning ( > // feature driver handle. > // > InstallInterchangeDataProtocol (Handle, InformationExchange); > - return protocol->Provisioning (protocol, Uri, HttpPostMode); > + return ConfigProtocol->Provisioning (ConfigProtocol, Uri, HttpPostMode= ); > } > > /** > @@ -467,25 +601,43 @@ EdkIIRedfishResourceConfigProvisioning ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > > @retval EFI_SUCCESS Value is returned successfully. > @retval Others Some error happened. > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigConsume ( > IN REDFISH_SCHEMA_INFO *Schema, > - IN EFI_STRING Uri > + IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL > ) > { > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *protocol; > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *ConfigProtocol; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Config2Protocol; > > - protocol =3D GetRedfishResourceConfigProtocol (Schema, NULL); > - if (protocol =3D=3D NULL) { > + // > + // Initialization. > + // > + ConfigProtocol =3D NULL; > + Config2Protocol =3D NULL; > + > + // > + // Try to use config2 protocol first. > + // > + Config2Protocol =3D GetRedfishResourceConfig2Protocol (Schema, NULL); > + if (Config2Protocol !=3D NULL) { > + return Config2Protocol->Consume (Config2Protocol, Uri, JsonText); > + } > + > + ConfigProtocol =3D GetRedfishResourceConfigProtocol (Schema, NULL); > + if (ConfigProtocol =3D=3D NULL) { > return EFI_DEVICE_ERROR; > } > > - return protocol->Consume (protocol, Uri); > + return ConfigProtocol->Consume (ConfigProtocol, Uri); > } > > /** > @@ -493,25 +645,43 @@ EdkIIRedfishResourceConfigConsume ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > > @retval EFI_SUCCESS Value is returned successfully. > @retval Others Some error happened. > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigUpdate ( > IN REDFISH_SCHEMA_INFO *Schema, > - IN EFI_STRING Uri > + IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL > ) > { > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *protocol; > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *ConfigProtocol; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Config2Protocol; > + > + // > + // Initialization. > + // > + ConfigProtocol =3D NULL; > + Config2Protocol =3D NULL; > > - protocol =3D GetRedfishResourceConfigProtocol (Schema, NULL); > - if (protocol =3D=3D NULL) { > + // > + // Try to use config2 protocol first. > + // > + Config2Protocol =3D GetRedfishResourceConfig2Protocol (Schema, NULL); > + if (Config2Protocol !=3D NULL) { > + return Config2Protocol->Update (Config2Protocol, Uri, JsonText); > + } > + > + ConfigProtocol =3D GetRedfishResourceConfigProtocol (Schema, NULL); > + if (ConfigProtocol =3D=3D NULL) { > return EFI_DEVICE_ERROR; > } > > - return protocol->Update (protocol, Uri); > + return ConfigProtocol->Update (ConfigProtocol, Uri); > } > > /** > @@ -519,25 +689,43 @@ EdkIIRedfishResourceConfigUpdate ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > > @retval EFI_SUCCESS Value is returned successfully. > @retval Others Some error happened. > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigCheck ( > IN REDFISH_SCHEMA_INFO *Schema, > - IN EFI_STRING Uri > + IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL > ) > { > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *protocol; > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *ConfigProtocol; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Config2Protocol; > + > + // > + // Initialization. > + // > + ConfigProtocol =3D NULL; > + Config2Protocol =3D NULL; > + > + // > + // Try to use config2 protocol first. > + // > + Config2Protocol =3D GetRedfishResourceConfig2Protocol (Schema, NULL); > + if (Config2Protocol !=3D NULL) { > + return Config2Protocol->Check (Config2Protocol, Uri, JsonText); > + } > > - protocol =3D GetRedfishResourceConfigProtocol (Schema, NULL); > - if (protocol =3D=3D NULL) { > + ConfigProtocol =3D GetRedfishResourceConfigProtocol (Schema, NULL); > + if (ConfigProtocol =3D=3D NULL) { > return EFI_DEVICE_ERROR; > } > > - return protocol->Check (protocol, Uri); > + return ConfigProtocol->Check (ConfigProtocol, Uri); > } > > /** > @@ -545,6 +733,7 @@ EdkIIRedfishResourceConfigCheck ( > > @param[in] Schema Redfish schema information. > @param[in] Uri The target URI to consume. > + @param[in] JsonText The JSON data in ASCII string format.= This is > optional. > @param[in] InformationExchange Pointer to > RESOURCE_INFORMATION_EXCHANGE. > > @retval EFI_SUCCESS This is target resource which we want= to handle. > @@ -553,17 +742,40 @@ EdkIIRedfishResourceConfigCheck ( > > **/ > EFI_STATUS > +EFIAPI > EdkIIRedfishResourceConfigIdentify ( > IN REDFISH_SCHEMA_INFO *Schema, > IN EFI_STRING Uri, > + IN CHAR8 *JsonText OPTIONAL, > IN RESOURCE_INFORMATION_EXCHANGE *InformationExchange > ) > { > - EFI_HANDLE Handle; > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *protocol; > + EFI_HANDLE Handle; > + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *ConfigProtocol; > + EDKII_REDFISH_RESOURCE_CONFIG2_PROTOCOL *Config2Protocol; > + > + // > + // Initialization. > + // > + Handle =3D NULL; > + ConfigProtocol =3D NULL; > + Config2Protocol =3D NULL; > + > + // > + // Try to use config2 protocol first. > + // > + Config2Protocol =3D GetRedfishResourceConfig2Protocol (Schema, &Handle= ); > + if ((Config2Protocol !=3D NULL) && (Handle !=3D NULL)) { > + // > + // Install EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL on > the child > + // feature driver handle. > + // > + InstallInterchangeDataProtocol (Handle, InformationExchange); > + return Config2Protocol->Identify (Config2Protocol, Uri, JsonText); > + } > > - protocol =3D GetRedfishResourceConfigProtocol (Schema, &Handle); > - if (protocol =3D=3D NULL) { > + ConfigProtocol =3D GetRedfishResourceConfigProtocol (Schema, &Handle); > + if (ConfigProtocol =3D=3D NULL) { > return EFI_DEVICE_ERROR; > } > > @@ -572,17 +784,17 @@ EdkIIRedfishResourceConfigIdentify ( > // feature driver handle. > // > InstallInterchangeDataProtocol (Handle, InformationExchange); > - return protocol->Identify (protocol, Uri); > + return ConfigProtocol->Identify (ConfigProtocol, Uri); > } > > /** > > - Initial resource config library instace. > + Initial resource config library instance. > > @param[in] ImageHandle The image handle. > @param[in] SystemTable The system table. > > - @retval EFI_SUCEESS Install Boot manager menu success. > + @retval EFI_SUCCESS Install Boot manager menu success. > @retval Other Return error status. > > **/ > @@ -593,8 +805,17 @@ RedfishResourceConfigConstructor ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - mRedfishResourceConfigProtocol =3D NULL; > - ZeroMem (&mSchemaInfoCache, sizeof (REDFISH_SCHEMA_INFO)); > + mRedfishResourceConfigCache =3D AllocateZeroPool (sizeof > (REDFISH_CONFIG_PROTOCOL_CACHE)); > + if (mRedfishResourceConfigCache =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + mRedfishResourceConfig2Cache =3D AllocateZeroPool (sizeof > (REDFISH_CONFIG_PROTOCOL_CACHE)); > + if (mRedfishResourceConfig2Cache =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + ZeroMem (&mRedfishFeatureInterchangeData, sizeof > (mRedfishFeatureInterchangeData)); > > return EFI_SUCCESS; > } > @@ -615,7 +836,15 @@ RedfishResourceConfigDestructor ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - mRedfishResourceConfigProtocol =3D NULL; > + if (mRedfishResourceConfigCache !=3D NULL) { > + FreePool (mRedfishResourceConfigCache); > + mRedfishResourceConfigCache =3D NULL; > + } > + > + if (mRedfishResourceConfig2Cache !=3D NULL) { > + FreePool (mRedfishResourceConfig2Cache); > + mRedfishResourceConfig2Cache =3D NULL; > + } > > return EFI_SUCCESS; > } > -- > 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116471): https://edk2.groups.io/g/devel/message/116471 Mute This Topic: https://groups.io/mt/104781209/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-