From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.54]) by mx.groups.io with SMTP id smtpd.web09.28724.1658979691206155336 for ; Wed, 27 Jul 2022 20:41:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=XQ90zidT; 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.243.54, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuQM6Km7DazNnKRDiQafrQVWNUVVlvHb4YeS3aGPKJqrp+1SB7nXggcJZ2QrDBqHtVx1dLME9I0E+myG0d7yYaimNbQYl07MmruKiiiPUCNnEU0isdhkilx2tbcH51cRhEQ9piLcq6Pb3dSkGfsdhHVLTUlJJXGOfpJXraNWDGuxinpKy9xTrAlFAUku7F7rDNUtrGnPnD0Ecdkb2YTlh4R6emHRb8ntzT5ezvkAL1pjpo31gdUtfP4qtkVN9TXA5++KwYkjVt4YYejQxvjBiaglmmpzCbYuNKU4eNI0dLzDy7tlMAOz/C88/lOrmJwJBWKBx2zifsbxnROvY+CgMw== 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=Dj/X3sEJB5dGDt0EGaq3PBZVcbcWhycXLk7PWSpwRIM=; b=MBcPK5iXKDgGpOheqkprwajv8vsZlo64R1f2IZtMvyH2lku/FYHs221/EMGGsW5TsjHsjp9OGvdvRubzhQgFQlx79b+ApAskVQmVG/fwEZmKFHf1C/+Bbv5q8rkejp8+WFhsHIHZjbDtxLHIA3I3aSEjmM+Wc+WIJo6yU6D09zNq5B/bPR/VH45/MFs7SFR+trj5UUZ1P6aJmtQ7u4/9wsGtIghFGJfhkthDH6C5KPSTjkNfDLlR7X13NdGZhXdzVXE9zV75MO6KIzKUaIC6fCFLVrhh1PbiIZU2HphIxaPTJM6bkTklxl38XkgI667xT1dHLIb4TD9p+hc4YlS4jQ== 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=Dj/X3sEJB5dGDt0EGaq3PBZVcbcWhycXLk7PWSpwRIM=; b=XQ90zidTBl/uDBAS6VolKmwqKez3Npv9wBIDT24ZAM9gabQCJ4TRsf0B9g9zoJaWbglwiRH6+eLlXFXCVZddSNXVtWx/ESuzw7ixLdRW63mlS4v3h6l3TqEdJbIh6pDVgq5Cl1ap9CnRt61CFXwiUnHq+lgAlZOuBr1Fd7H5uOo= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by DM4PR12MB6206.namprd12.prod.outlook.com (2603:10b6:8:a7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 28 Jul 2022 03:41:28 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::605a:11f4:fc16:8b06]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::605a:11f4:fc16:8b06%5]) with mapi id 15.20.5458.025; Thu, 28 Jul 2022 03:41:28 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: "Yang, Atom" , Nick Ramirez Subject: Re: [edk2-staging][PATCH v3 11/15] edk2-staging/RedfishClientPkg: Rename RedfishMemoryCollection driver Thread-Topic: [edk2-staging][PATCH v3 11/15] edk2-staging/RedfishClientPkg: Rename RedfishMemoryCollection driver Thread-Index: AQHYoVmRDBXxfSfMYkK934xOptnxM62TJQ3g Date: Thu, 28 Jul 2022 03:41:28 +0000 Message-ID: References: <20220727013802.247-1-nickle.wang@hpe.com> <20220727013802.247-12-nickle.wang@hpe.com> In-Reply-To: <20220727013802.247-12-nickle.wang@hpe.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-07-28T03:41:25Z; 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=65006da7-276b-4042-84fe-671a815285b0; 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-office365-filtering-correlation-id: a8217557-5c75-46c8-331c-08da704b0e1b x-ms-traffictypediagnostic: DM4PR12MB6206:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: F7D2zUZDn1enwGUIWyz/xWS9j1SLSWp2iDYn8dUbuvsU7kUllml3nNUJB/PGYlnRzt6fp5lF5ewQksjU2Sr4iCAYOA8bKX0BqtAU1g9wd55Eo9pigdFE3Bis3GrEzDP16NWwT09O7gQLfFTPQvmEn/JfltPJHXx4ttz7+GOeDuaSrKtTltJJ6qeupAT8AF/9iAmU+62iMLS+bEgsdZsPCyZmxgV0QE2o9KgpyKZ2sDiLbZhb417xEIk2ueglsk4UIaPquFTyNqC2cCOqgsIcTqHelThEzxYGS10gjk65qfWrNsGesqq5Pl2bLBrOGHWnUpEXXH4sAl8E35E8yH4whHqA9guF7XNXmnbg1/VnpQ+VQveHn/0rcGnqMnSv48W/26kPdUukiXZzl3BJSWaBNNwo7ojIYIn2MbZMII5dIcQ4edHdNC85qALE9yIcRbYJ2WEVA5VlLZZkQMH+HN8QtMZQ+X0Ww52RDbKW8wTA3SXgXgBWA0cxvzQEL1nQ7yTHDQ61J1dQywr3Asc/HmMP0p3QdWYhHnyp8V6nJSbhtxLXqoDJdRdq3lgNq/rEPH2nOADG88r6SfQUruMM8bVchW/7TrGdDslIo5rrqkw+yOMadXTB5LPA+SGUa1b8Pmyiq3A19aXbGT9dPsNsXj8TmQ2lWIxTIKudHZPg/e1vhy3WXiFe9E2WLZ6g9WhO7bGUaPLtWZgZ/y+gpW9npj4BB9A3+WoLi3uVvVXiJoT9VuYvSmbR0LV4hA7A+cOOu+FQXpdEsAZ28f0APB0QDDE1B8EWDOJpo/ASzzdxalZf++mh5cVuiTOcGXBA5HGpNe4P 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:(13230016)(4636009)(366004)(136003)(376002)(346002)(396003)(39860400002)(38100700002)(55016003)(122000001)(2906002)(83380400001)(30864003)(38070700005)(33656002)(316002)(52536014)(53546011)(86362001)(9686003)(66946007)(8676002)(6506007)(71200400001)(66446008)(54906003)(66476007)(110136005)(76116006)(4326008)(66556008)(64756008)(41300700001)(186003)(7696005)(26005)(296002)(8936002)(478600001)(5660300002)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mrwI/xOrNBzjxcUgGQDauLkHgOHLyBqkMex3IjYpE7DLsp4eXyBd5FCdn930?= =?us-ascii?Q?Jl+6ymCLMSkA50wh4ydLPYQZPfPMuHIFLutE+T3MPsievgjQeLUuAt7zf185?= =?us-ascii?Q?8eAn9xSoZanvNtFZhmggVOGtozNJDZKKCGOtA+d/srICDlz5SCt7AZUFWBdL?= =?us-ascii?Q?MU8U2rBiYw7dBnP4QFvv1Nawcjm0PMGYYrvPdmxYOpF0CNU1FOX9GZKWjpWb?= =?us-ascii?Q?lxKxxXltOs+3kVSGGiu1Sd2PzjefUOAjVxukfw+dT2bRm+LsFW2oNSSOofie?= =?us-ascii?Q?VIJpYu6lOeYkoAUuK4rz2nM4zJQ31c4km4rKrLk0Doh8j6soCSOFeQEX3wSV?= =?us-ascii?Q?3H6kberCj3z0HhE1GXWGtz8+7LPZh30KmSYCl8Ettdpj2+0E/Dqh149ebgXp?= =?us-ascii?Q?DDwDfNDd9NvnWud+lzOoOv71bLrb0lm1qxAHxpOGIQtxlAX55NIAovusafX/?= =?us-ascii?Q?jEJMDRdzdI3zaS5M8FT1ogrXtzB9GlQM78wtdJ4yIdxqSkz9/nvA8TBqhJ1+?= =?us-ascii?Q?rtUrck2R8NepWLBOkaePqx1TjxQfQJYz6RQlbrUcrwwe5xyLCHzV/gFgpjGs?= =?us-ascii?Q?g6o3oftLNj1xaj/JfxNWxuKt0WfFUA1R+0oX+Sv7IPlTDWi5k3S3bbhLfveO?= =?us-ascii?Q?LJtLFJCRIYQohX3HZ601E0MXUalJg3XMKJylqRNw02WTqRRpUX1mImtZXE79?= =?us-ascii?Q?749gb1utrWmc6BugwDHdJrqlTCK4bS8j92YCbEaPkq3ZPIB50iSp8WVjNmkD?= =?us-ascii?Q?rzEB/VzAC2MYNBVBs2DZTDqaMnbrAbOBu0K4hHO8JO4HaUm5sWwu9VyH04Tu?= =?us-ascii?Q?1aKJr/vFfyHpI2pElbtR/Nq7MutDY7eKcOy/+vbPkdZ5mdL7WJKzgvbx2XQH?= =?us-ascii?Q?IckehUwB+YCrlSJieW9kVsTPkbFFPcNSx9Cqj2o2b206hIPFqGFSnZxYCUe5?= =?us-ascii?Q?kAN5DHPq7LsP9N1JhMWFs2q1C2IRopsrOAynvGKimYgdQDwV07uK+6DUgp2U?= =?us-ascii?Q?gto5UOU5RFrGFPmQEuFX8jz/DDcnNdFrqql6ha6g46xz14ewyWFOVFaFonu0?= =?us-ascii?Q?h7b7POC9S3RwqcZ6Vi9TcW3lil7p/yfOoC5ZrEsMfnRoZULrr/jD6t7IMQKn?= =?us-ascii?Q?LWOZBt0fqr3WBNEVURPfZPnaWr/ojY5Fm6UIIVkuT6uHReU4CvficWPLbLob?= =?us-ascii?Q?KvvLxIeqdR5ZAUtcwtbdfXXk66VtUHIVQX92Mha6QXPV3uIQtTLS36rj8Az2?= =?us-ascii?Q?mVDmTOby0lhT1gPVs+3Hpgu3vmPnHuvMmqICJ4rsJf+yg1EmD3PrhyaghujL?= =?us-ascii?Q?ljzcRouGQvy6LBsJ84id7HmdJo+ckM8RwES19EC/cIQNkC6Btp61coVNKlgS?= =?us-ascii?Q?UGdAdwOJGkEOzGjjeZaJhwgOYK5y1EltPwo0Isfm0A4Emr//Pvre6NqSRve6?= =?us-ascii?Q?mnYUc0lSh/VT6MJNYmLoz6jHVjRIMf4rsuzF3d+i8BuZwFB6+0WAW4f+uaVO?= =?us-ascii?Q?2KWZIDbdE2Cqiv9gSKu/DL9jGclkjRdgS+9lkTqA3by5OtD9NX5Rbp0JEQP1?= =?us-ascii?Q?DWiHLQuY/yuyZfUuOX2N8cj30Wuo3VSqIO7v3HZE?= 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: a8217557-5c75-46c8-331c-08da704b0e1b X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jul 2022 03:41:28.7399 (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: 0M36+M5rtEiLLlndj7ZQIT5I/QoRfcPRtquTJpuyalt6sigipQNKCECoDeuPe7cYCokQNYNn27e2xC1xN3qBFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6206 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, July 27, 2022 9:38 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Yang, Atom > ; Nick Ramirez > Subject: [edk2-staging][PATCH v3 11/15] edk2-staging/RedfishClientPkg: > Rename RedfishMemoryCollection driver >=20 > [CAUTION: External Email] >=20 > Rename RedfishMemoryCollectionDxe by removing Redfish prefix. Update > memory collection driver to support "Identify" action and also have code > refactoring to support Redfish operation. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Yang Atom > Cc: Nick Ramirez > --- > .../MemoryCollectionDxe.c} | 259 +++++++++--------- > .../MemoryCollectionDxe.h} | 7 +- > .../MemoryCollectionDxe.inf} | 19 +- > .../Include/RedfishCollectionCommon.h | 14 +- > RedfishClientPkg/RedfishClient.fdf.inc | 2 +- > .../RedfishClientComponents.dsc.inc | 2 +- > 6 files changed, 164 insertions(+), 139 deletions(-) rename > RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.c =3D> MemoryCollectionDxe/MemoryCollectionDxe.c} (66%) > rename > RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.h =3D> MemoryCollectionDxe/MemoryCollectionDxe.h} (64%) > rename > RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.inf =3D> MemoryCollectionDxe/MemoryCollectionDxe.inf} (71%) >=20 > diff --git > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.c > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > c > similarity index 66% > rename from > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.c > rename to > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c > index d97f0f161e..43426a78af 100644 > --- > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.c > +++ > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > +++ c > @@ -1,67 +1,98 @@ > /** @file > - Redfish feature driver implementation - memory collection >=20 > - (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> + Redfish feature driver implementation - MemoryCollection > + > + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > -#include "RedfishMemoryCollectionDxe.h" > +#include "MemoryCollectionDxe.h" >=20 > REDFISH_COLLECTION_PRIVATE *mRedfishCollectionPrivate =3D NULL; >=20 > EFI_STATUS > -ProcessResource ( > +HandleResource ( > IN REDFISH_COLLECTION_PRIVATE *Private, > - IN CHAR8 *Uri > + IN EFI_STRING Uri > ) > { > - EFI_STATUS Status; > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL > *RedfishResrouceProtocol; > - REDFISH_SCHEMA_INFO SchemaInfo; > + EFI_STATUS Status; > + REDFISH_SCHEMA_INFO SchemaInfo; > + EFI_STRING ConfigLang; > + EFI_STRING ReturnedConfigLang; > + UINTN Index; >=20 > if (Private =3D=3D NULL || IS_EMPTY_STRING (Uri)) { > return EFI_INVALID_PARAMETER; > } >=20 > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %a\n", > __FUNCTION__, Uri)); > + // > + // Resource match > + // > + > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n", > + __FUNCTION__, Uri)); >=20 > Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %a > %r\n", __FUNCTION__, Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s > + %r\n", __FUNCTION__, Uri, Status)); > return Status; > } > + // > + // Check and see if this is target resource that we want to handle. > + // Some resource is handled by other provider so we have to make sure > this first. > + // > + DEBUG ((REDFISH_DEBUG_TRACE, "%s Identify for %s\n", __FUNCTION__, > + Uri)); ConfigLang =3D RedfishGetConfigLanguage (Uri); if (ConfigLang > + =3D=3D NULL) { > + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Pri= vate- > >InformationExchange); > + if (EFI_ERROR (Status)) { > + if (Status =3D=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_INFO, "%a, \"%s\" is not handled by us\n", > __FUNCTION__, Uri)); > + return EFI_SUCCESS; > + } >=20 > - RedfishResrouceProtocol =3D GetRedfishResourceConfigProtocol ( > - SchemaInfo.Schema, > - SchemaInfo.Major, > - SchemaInfo.Minor, > - SchemaInfo.Errata > - ); > - if (RedfishResrouceProtocol =3D=3D NULL) { > - return EFI_DEVICE_ERROR; > + DEBUG ((DEBUG_ERROR, "%a, fail to identify resource: \"%s\": %r\n"= , > __FUNCTION__, Uri, Status)); > + return Status; > + } > + } else { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, history record found: %s\n", > __FUNCTION__, ConfigLang)); > + // > + // Set exchange information > + // > + Status =3D GetArrayIndexFromArrayTypeConfigureLang (ConfigLang, > &ReturnedConfigLang, &Index); > + if (!EFI_ERROR (Status) || Status =3D=3D EFI_NOT_FOUND) { > + Private->InformationExchange->ReturnedInformation.Type =3D > InformationTypeCollectionMemberConfigLanguage; > + Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.Count =3D 1; > + Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.List =3D > + AllocateZeroPool(sizeof > + (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG)); > + > + if (Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.List =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for > REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.List [Index].Index =3D Index; > + Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.List [Index].ConfigureLang =3D > + (EFI_STRING)AllocateCopyPool(StrSize(ReturnedConfigLang), (VOI= D > *)ReturnedConfigLang); > + } else { > + DEBUG ((DEBUG_ERROR, "%a, > GetArrayIndexFromArrayTypeConfigureLang fail: %r\n", __FUNCTION__, > Status)); > + } > + FreePool (ConfigLang); > } >=20 > // > // Check and see if target property exist or not even when collection > memeber exists. > // If not, we sill do provision. > // > - DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %a\n", __FUNCTION__, > Uri)); > - Status =3D RedfishResrouceProtocol->Check ( > - RedfishResrouceProtocol, > - Uri > - ); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __FUNCTION__, > + Uri)); Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > if (EFI_ERROR (Status)) { > // > // The target property does not exist, do the provision to create pr= operty. > // > - DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %a\n", > __FUNCTION__, Uri)); > - Status =3D RedfishResrouceProtocol->Provisioning ( > - RedfishResrouceProtocol, > - Uri, > - FALSE > - ); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", > __FUNCTION__, Uri)); > + Status =3D EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri= , > + Private->InformationExchange, FALSE); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n"= , > __FUNCTION__, Status)); > } > @@ -72,41 +103,36 @@ ProcessResource ( > // > // Consume first. > // > - DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %a\n", > __FUNCTION__, Uri)); > - Status =3D RedfishResrouceProtocol->Consume ( > - RedfishResrouceProtocol, > - Uri > - ); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", > __FUNCTION__, > + Uri)); Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri)= ; > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %a %r\n", > __FUNCTION__, Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %s: > + %r\n", __FUNCTION__, Uri, Status)); > } >=20 > // > // Patch. > // > - DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %a\n", __FUNCTION__, > Uri)); > - Status =3D RedfishResrouceProtocol->Update ( > - RedfishResrouceProtocol, > - Uri > - ); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __FUNCTION__, > + Uri)); Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to update resoruce for: %s: %r\n", > + __FUNCTION__, Uri, Status)); } >=20 > return Status; > } >=20 > EFI_STATUS > -ProcessCollection ( > +HandleCollectionResource ( > IN REDFISH_COLLECTION_PRIVATE *Private > ) > { > EFI_STATUS Status; > - EFI_REDFISH_MEMORYCOLLECTION *Memory; > + EFI_REDFISH_MEMORYCOLLECTION *Collection; > EFI_REDFISH_MEMORYCOLLECTION_CS *CollectionCs; > RedfishCS_Link *List; > RedfishCS_Header *Header; > RedfishCS_Type_Uri_Data *UriData; > - CHAR8 *ConfigureLang; > - UINTN Size; > - UINTN Count; > + EFI_STRING MemberUri; >=20 > if (Private =3D=3D NULL) { > return EFI_INVALID_PARAMETER; > @@ -116,7 +142,7 @@ ProcessCollection ( > return EFI_NOT_READY; > } >=20 > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, process collection for: %a\n", > __FUNCTION__, Private->CollectionPath)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, process collection for: %s\n", > + __FUNCTION__, Private->CollectionUri)); >=20 > // > // Convert JSON text to C structure. > @@ -125,14 +151,14 @@ ProcessCollection ( > Private->JsonStructProtocol, > NULL, > Private->CollectionJson, > - (EFI_REST_JSON_STRUCTURE_HEADE= R **)&Memory > + > + (EFI_REST_JSON_STRUCTURE_HEADER **)&Collection > ); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __FUNCTION__, > Status)); > return Status; > } >=20 > - CollectionCs =3D Memory->MemoryCollection; > + CollectionCs =3D Collection->MemoryCollection; >=20 > if (*CollectionCs->Membersodata_count =3D=3D 0) { > return EFI_NOT_FOUND; > @@ -142,23 +168,22 @@ ProcessCollection ( > return EFI_NOT_FOUND; > } >=20 > - Count =3D 0; > List =3D GetFirstLink (&CollectionCs->Members); > while (TRUE) { >=20 > Header =3D (RedfishCS_Header *)List; > if (Header->ResourceType =3D=3D RedfishCS_Type_Uri) { > UriData =3D (RedfishCS_Type_Uri_Data *)Header; > - > - ++Count; > - Size =3D AsciiStrLen (Private->CollectionPath) + 5; > - ConfigureLang =3D AllocatePool (Size); > - ASSERT (ConfigureLang !=3D NULL); > - AsciiSPrint (ConfigureLang, Size, "%a[%d]", Private->CollectionPat= h, > Count); > - > - Status =3D ProcessResource (Private, ConfigureLang); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, process memory resource: %a failed: > %r\n", __FUNCTION__, UriData->Uri, Status)); > + MemberUri =3D NULL; > + MemberUri =3D StrAsciiToUnicode (UriData->Uri); > + ASSERT (MemberUri !=3D NULL); > + if (MemberUri !=3D NULL) { > + Status =3D HandleResource (Private, MemberUri); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, process MemoryCollection resource: > %a failed: %r\n", __FUNCTION__, UriData->Uri, Status)); > + } > + > + FreePool (MemberUri); > } > } >=20 > @@ -172,25 +197,24 @@ ProcessCollection ( > // > // Release resource. > // > - Private->JsonStructProtocol->DestoryStructure (Private- > >JsonStructProtocol, (EFI_REST_JSON_STRUCTURE_HEADER *)Memory); > + Private->JsonStructProtocol->DestoryStructure > + (Private->JsonStructProtocol, (EFI_REST_JSON_STRUCTURE_HEADER > + *)Collection); >=20 > return EFI_SUCCESS; > } >=20 > EFI_STATUS > -CreateCollection ( > +CreateCollectionResource ( > IN REDFISH_COLLECTION_PRIVATE *Private > ) > { > EFI_STATUS Status; > - EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL > *RedfishResrouceProtocol; > REDFISH_SCHEMA_INFO SchemaInfo; >=20 > if (Private =3D=3D NULL) { > return EFI_INVALID_PARAMETER; > } >=20 > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, create resource for collection for: > %a\n", __FUNCTION__, Private->CollectionPath)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, create resource for collection for: > + %s\n", __FUNCTION__, Private->CollectionUri)); >=20 > Status =3D GetSupportedSchemaVersion (REDFISH_SCHEMA_NAME, > &SchemaInfo); > if (EFI_ERROR (Status)) { > @@ -200,18 +224,9 @@ CreateCollection ( >=20 > DEBUG ((REDFISH_DEBUG_TRACE, "%a, supported schema: %a > %a.%a.%a\n", __FUNCTION__, SchemaInfo.Schema, SchemaInfo.Major, > SchemaInfo.Minor, SchemaInfo.Errata)); >=20 > - RedfishResrouceProtocol =3D GetRedfishResourceConfigProtocol > (SchemaInfo.Schema, SchemaInfo.Major, SchemaInfo.Minor, > SchemaInfo.Errata); > - if (RedfishResrouceProtocol =3D=3D NULL) { > - return EFI_DEVICE_ERROR; > - } > - > - Status =3D RedfishResrouceProtocol->Provisioning ( > - RedfishResrouceProtocol, > - Private->CollectionPath, > - TRUE > - ); > + Status =3D EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, > + Private->CollectionUri, Private->InformationExchange, TRUE); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to create resoruce for: %a %r\n", > __FUNCTION__, Private->CollectionPath, Status)); > + DEBUG ((DEBUG_ERROR, "%a, failed to create resoruce for: %s: %r\n", > + __FUNCTION__, Private->CollectionUri, Status)); > } >=20 > return Status; > @@ -248,6 +263,11 @@ ReleaseCollectionResource ( > Private->CollectionJson =3D NULL; > } >=20 > + if (Private->RedfishVersion !=3D NULL) { > + FreePool (Private->RedfishVersion); > + Private->RedfishVersion =3D NULL; > + } > + > return EFI_SUCCESS; > } >=20 > @@ -257,49 +277,19 @@ CollectionHandler ( > ) > { > EFI_STATUS Status; > - CHAR8 *SystemRootPath; > - CHAR8 *PathBuffer; > - UINTN BufferSize; >=20 > if (Private =3D=3D NULL) { > return EFI_INVALID_PARAMETER; > } >=20 > - SystemRootPath =3D NULL; > - PathBuffer =3D NULL; > - > - SystemRootPath =3D RedfishGetSystemRootPath (); > - if (SystemRootPath =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, can not find system root path\n", > __FUNCTION__)); > - return EFI_DEVICE_ERROR; > - } > - > - BufferSize =3D AsciiStrSize (SystemRootPath) + AsciiStrSize > (REDFISH_SCHEMA_NAME); > - PathBuffer =3D AllocatePool (BufferSize); > - if (PathBuffer =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto ON_RELEASE; > - } > - > - AsciiSPrint (PathBuffer, BufferSize, "%a/%a", SystemRootPath, > REDFISH_SCHEMA_NAME); > - > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, collection handler for %a\n", > __FUNCTION__, PathBuffer)); > - > - // > - // Initialize collection path > - // > - Private->CollectionPath =3D RedfishBuildPathWithSystemUuid (PathBuffer= , > TRUE, NULL); > - if (Private->CollectionPath =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto ON_RELEASE; > - } > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, collection handler for %s\n", > + __FUNCTION__, Private->CollectionUri)); >=20 > // > // Query collection from Redfish service. > // > - Status =3D GetResourceByPath (Private->RedfishService, Private- > >CollectionPath, &Private->RedResponse); > + Status =3D GetResourceByUri (Private->RedfishService, > + Private->CollectionUri, &Private->RedResponse); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, unable to get resource from: %a :%r\n", > __FUNCTION__, Private->CollectionPath, Status)); > + DEBUG ((DEBUG_ERROR, "%a, unable to get resource from: %s :%r\n", > + __FUNCTION__, Private->CollectionUri, Status)); > goto ON_RELEASE; > } >=20 > @@ -309,21 +299,13 @@ CollectionHandler ( > Private->CollectionJson =3D JsonDumpString (RedfishJsonInPayload (Priv= ate- > >CollectionPayload), EDKII_JSON_COMPACT); > ASSERT (Private->CollectionJson !=3D NULL); >=20 > - Status =3D ProcessCollection (Private); > + Status =3D HandleCollectionResource (Private); > if (EFI_ERROR (Status) && Status =3D=3D EFI_NOT_FOUND) { > - Status =3D CreateCollection (Private); > + Status =3D CreateCollectionResource (Private); > } >=20 > ON_RELEASE: >=20 > - if (SystemRootPath !=3D NULL) { > - FreePool (SystemRootPath); > - } > - > - if (PathBuffer !=3D NULL) { > - FreePool (PathBuffer); > - } > - > ReleaseCollectionResource (Private); >=20 > return Status; > @@ -334,10 +316,12 @@ ON_RELEASE: >=20 > @param[in] This Pointer to EDKII_REDFISH_FEATURE_PR= OTOCOL > instance. > @param[in] FeatureAction The action Redfish feature driver s= hould > take. > + @param[in] Uri The collection URI. > @param[in] Context The context of Redfish feature driv= er. > - @param[in,out] InformationReturned The pointer to retrive the pointer = to > - FEATURE_RETURNED_INFOMATION. The me= mory block > of this > - information should be freed by call= er. > + @param[in,out] InformationExchange The pointer to > + RESOURCE_INFORMATION_EXCHANGE > + > + @retval EFI_SUCCESS Redfish feature driver callback is ex= ecuted > successfully. > + @retval Others Some errors happened. >=20 > @retval EFI_SUCCESS Redfish feature driver callback is ex= ecuted > successfully. > @retval Others Some errors happened. > @@ -349,12 +333,13 @@ RedfishCollectionFeatureCallback ( > IN EDKII_REDFISH_FEATURE_PROTOCOL *This, > IN FEATURE_CALLBACK_ACTION FeatureAction, > IN VOID *Context, > - IN OUT FEATURE_RETURNED_INFORMATION **InformationReturned > + IN OUT RESOURCE_INFORMATION_EXCHANGE *InformationExchange > ) > { > EFI_STATUS Status; > REDFISH_SERVICE RedfishService; > REDFISH_COLLECTION_PRIVATE *Private; > + EFI_STRING ResourceUri; >=20 > if (FeatureAction !=3D CallbackActionStartOperation) { > return EFI_UNSUPPORTED; > @@ -367,6 +352,36 @@ RedfishCollectionFeatureCallback ( > return EFI_NOT_READY; > } >=20 > + // > + // Save in private structure. > + // > + Private->InformationExchange =3D InformationExchange; > + > + // > + // Find Redfish version on BMC > + // > + Private->RedfishVersion =3D RedfishGetVersion (RedfishService); > + > + // > + // Create the full URI from Redfish service root. > + // > + ResourceUri =3D (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH * > + sizeof(CHAR16)); if (ResourceUri =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for full URI.\n", > __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion); > + StrCatS (ResourceUri, MAX_URI_LENGTH, > + InformationExchange->SendInformation.FullUri); > + > + // > + // Initialize collection path > + // > + Private->CollectionUri =3D RedfishGetUri (ResourceUri); if > + (Private->CollectionUri =3D=3D NULL) { > + ASSERT (FALSE); > + return EFI_OUT_OF_RESOURCES; > + } > + > Status =3D CollectionHandler (Private); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a, CollectionHandler failure: %r\n", > __FUNCTION__, Status)); @@ -549,7 +564,7 @@ RedfishCollectionUnload ( > ) > { > EFI_STATUS Status; > - EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; > + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; >=20 > if (mRedfishCollectionPrivate =3D=3D NULL) { > return EFI_NOT_READY; > diff --git > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.h > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > h > similarity index 64% > rename from > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.h > rename to > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.h > index 83ca836941..75b4a123ff 100644 > --- > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.h > +++ > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > +++ h > @@ -1,7 +1,8 @@ > /** @file > + > Redfish feature driver implementation - internal header file >=20 > - (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -14,5 +15,7 @@ > #include >=20 > #define REDFISH_SCHEMA_NAME "Memory" > -#define REDFISH_MANAGED_URI > L"/redfish/v1/systems/{1}/memory" > +#define REDFISH_MANAGED_URI > L"Chassis/{}/Memory/{};Systems/{}/Memory/{}" > +#define MAX_URI_LENGTH 256 > + > #endif > diff --git > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.inf > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.i > nf > similarity index 71% > rename from > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.inf > rename to > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf > index e7bcf49bdb..05e05712e7 100644 > --- > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.inf > +++ > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > +++ inf > @@ -1,15 +1,18 @@ > ## @file > # > -# (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> +# Redfish MemoryCollection collection driver. > +# > +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development > +LP
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent # ## >=20 > + > [Defines] > INF_VERSION =3D 0x00010005 > - BASE_NAME =3D RedfishMemoryCollectionDxe > - FILE_GUID =3D 9323359C-11E2-49BC-B501-D6280B6DAE1A > + BASE_NAME =3D MemoryCollectionDxe > + FILE_GUID =3D 22facf8f-a007-462c-9be4-638043a26858 > MODULE_TYPE =3D DXE_DRIVER > VERSION_STRING =3D 1.0 > ENTRY_POINT =3D RedfishCollectionEntryPoint > @@ -22,8 +25,8 @@ > RedfishClientPkg/RedfishClientPkg.dec >=20 > [Sources] > - RedfishMemoryCollectionDxe.h > - RedfishMemoryCollectionDxe.c > + MemoryCollectionDxe.h > + MemoryCollectionDxe.c >=20 > [LibraryClasses] > DebugLib > @@ -35,19 +38,19 @@ > UefiLib > UefiDriverEntryPoint > UefiBootServicesTableLib > + EdkIIRedfishResourceConfigLib > + RedfishVersionLib >=20 > [Protocols] > gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMED > gEfiRestJsonStructureProtocolGuid ## CONSUMED > - gEdkIIRedfishResourceConfigProtocolGuid ## CONSUMED > gEdkIIRedfishFeatureProtocolGuid ## CONSUMED >=20 > [Guids] > - gEfiEventReadyToBootGuid >=20 > [Pcd] > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize >=20 > [Depex] > - TRUE > \ No newline at end of file > + TRUE > diff --git a/RedfishClientPkg/Include/RedfishCollectionCommon.h > b/RedfishClientPkg/Include/RedfishCollectionCommon.h > index 05a0f672f3..d4adcedd1f 100644 > --- a/RedfishClientPkg/Include/RedfishCollectionCommon.h > +++ b/RedfishClientPkg/Include/RedfishCollectionCommon.h > @@ -1,7 +1,7 @@ > /** @file > Redfish feature driver collection common header file. >=20 > - (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -10,6 +10,8 @@ > #ifndef EFI_REDFISH_COLLECTION_COMMON_H_ #define > EFI_REDFISH_COLLECTION_COMMON_H_ >=20 > +#include > + > // > // Libraries > // > @@ -22,28 +24,30 @@ > #include > #include > #include > +#include > +#include >=20 > // > // Protocols > // > #include > -#include > #include #include > #include >=20 > -#define IS_EMPTY_STRING(a) ((a) =3D=3D NULL || (a)[0] =3D= =3D '\0') > -#define REDFISH_DEBUG_TRACE DEBUG_INFO > +#define REDFISH_MAX_COLLECTION_INDEX_LEN 8 >=20 > typedef struct _REDFISH_COLLECTION_PRIVATE { > EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol; > EDKII_REDFISH_FEATURE_PROTOCOL *FeatureProtocol; > REDFISH_SERVICE RedfishService; > + RESOURCE_INFORMATION_EXCHANGE *InformationExchange; > EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL ConfigHandler; > - CHAR8 *CollectionPath; > + EFI_STRING CollectionUri; > CHAR8 *CollectionJson; > REDFISH_PAYLOAD CollectionPayload; > REDFISH_RESPONSE RedResponse; > + EFI_STRING RedfishVersion; > } REDFISH_COLLECTION_PRIVATE; >=20 > #define REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL(This) \ > diff --git a/RedfishClientPkg/RedfishClient.fdf.inc > b/RedfishClientPkg/RedfishClient.fdf.inc > index 6292de4e81..3619d2a20f 100644 > --- a/RedfishClientPkg/RedfishClient.fdf.inc > +++ b/RedfishClientPkg/RedfishClient.fdf.inc > @@ -15,7 +15,7 @@ > INF RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > INF > RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf > INF > RedfishClientPkg/Features/Memory/V1_7_1/Dxe/RedfishMemoryDxe.inf > - INF > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.inf > + INF > + > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf >=20 > !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc > # > diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc > b/RedfishClientPkg/RedfishClientComponents.dsc.inc > index ee4602fe79..5f1aff3c4b 100644 > --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc > +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc > @@ -20,7 +20,7 @@ > # Below two modules should be pulled in by build tool. > # > RedfishClientPkg/Features/Memory/V1_7_1/Dxe/RedfishMemoryDxe.inf > - > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.inf > + > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf >=20 > !include RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc >=20 > -- > 2.32.0.windows.2