From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.79]) by mx.groups.io with SMTP id smtpd.web11.18127.1683727582295561692 for ; Wed, 10 May 2023 07:06:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=vo4VQRHP; 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.94.79, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fi68DOtxwEDFjc0LJ6fs4UT+smkFYx8oa2LS48lilYN5FsMylU7VEr8yt1tR6XUiAM4VCiQ6qSt+g7sxvZ7+gb3lIJgAhl8/b8Ox7VGmeRJFuVoO3FmxDtS+9mgm8P7zkf/HBIwbroi0u3XOyYCyICynNZ9GpD5BuRSGJHLmPvKS90HRRtk2C9RGBISHmiVO3/QTlvRPBJaSOuNncsefKcAqE49NXyZ7W8/Rh8ZCa6l9SSlBX50GtYiABhSpyFE+vh3NSq0w6OumPc4rfYtu1mjYTk298vfUi/VwwUvzBp8Kk6wADvz0sxnvmtKKinNGtD9mHtuyXoI9ysMI2jt3og== 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=+kdmiGbMoryf93fvWrE2r9PqeZw6MJplKqJ31tBaaRk=; b=OUE8caJEhCcZ3zyneFrSZXdCjjPSOhHKS1L83h5JN5mC/zS2clDTrufJq3M+meIuqXGwkhwvWrF6FuVXQzuTrW4WJ/x6t/jQlUqiuTjccI0IA1F9f0bObqwZu+lewU5LKXFw9JoRSlL2gXZYD0snC+FqrANSrJiVHW7fqmorqmeQX6vA1FZs0QUnLzgSYDEKGBgmhyG75pg4puDZbYjWjL1blT9D5GNyA7tK41rxMtIBt47oauXtbcXb3bK7/cFnyYoV7CU+Qf1T5sJghl53ZFG5x0Zl2YLac8JpElHQAsKWLsRLpPBDmPv82g797LRBvrz7RwtpDP/qx3QsAbKxrQ== 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=+kdmiGbMoryf93fvWrE2r9PqeZw6MJplKqJ31tBaaRk=; b=vo4VQRHPxvVLtyqVr1soSu6dAdKLCO4Ayd8lxixB0qRPLndF4099xR2IASrKUG1GMzgh+R6mB+WxDZ+f7Qow6T5xh4nOdkhMRMCmpB4yy6hznkVEW570BeMXdpbsO02vCc9pzDVSoNDNggMFi55VT+nABYybWbegbsDZfPoZGzg= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by PH7PR12MB6857.namprd12.prod.outlook.com (2603:10b6:510:1af::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Wed, 10 May 2023 14:06:19 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3%3]) with mapi id 15.20.6363.032; Wed, 10 May 2023 14:06:19 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-redfish-client][PATCH 1/5] RedfishClientPkg: Rename RedfishMemoryCollection driver Thread-Topic: [edk2-redfish-client][PATCH 1/5] RedfishClientPkg: Rename RedfishMemoryCollection driver Thread-Index: AQHZgz/8UnJEw0HVzkWGDowbxxyPIa9Tik6g Date: Wed, 10 May 2023 14:06:18 +0000 Message-ID: References: <20230510130417.9226-1-nicklew@nvidia.com> In-Reply-To: <20230510130417.9226-1-nicklew@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-05-10T14:06:16Z; 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=a9f1a241-460a-418c-b08f-43f55431cd21; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|PH7PR12MB6857:EE_ x-ms-office365-filtering-correlation-id: e7da6e04-f419-41ba-8ff5-08db515fba1f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SjkwtWY5HxQUtvHXrPCirV9n3Dnde/alXOfCAzg9yNxHpKA01Szeo+sfweDIis+Tk0NgY2mQeooJeWUE7JdUgI6w6gNr4LzZcGGywNZleRL0wRX4w6p/WKwFqw4ks1f8lmXbtdmHHYN5MRRbRW1/+lOM1+rO9nDiqCfw625aQ+fT333I3nN4ydM6mqFV6lhfgzOItq+bQSQOeY8GcYuJ9nV1+QWYdYnnmkE+2PnoUdyfcXXMBLH0+NdxkWMbuA+I6fH6fEBujgG7jNX3+ZiqG1ZA0xGA1jnUNLCSHTq0LcwZ8Np+7E7IKFKypg2wzQcTJiBf0vup27WttdAmr6SU53GTw0EagxsTIYtdTuWBtF97D/u+CBcaDRu1xDQ6X/LmJrwtTj5zD8TQHpqzrOc9ho9UKzkxd/oas3PySSo9LFvKfQvE8yF6Ve2TVGES8ZiyctNH+FrB5UYsmnJu1TIglBJ6drj6tAfwZ10tGIIIjpk1szrY4GcU4kpz3jtDvGMj0iVKL9syz+awZftB2GpGFGDz9RbncAtzn7R7nR/Rjji0BGgNeOzuNJ6b7zfpHAn2B24t9gSj5bl8J+ClCY28+7F3NQMY2q5AjgvO7ShnH2GfUv0Ng1CYJh1xoanB5hIb 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:(13230028)(4636009)(396003)(346002)(366004)(376002)(39860400002)(136003)(451199021)(83380400001)(6506007)(9686003)(33656002)(26005)(41300700001)(86362001)(7696005)(38100700002)(55016003)(71200400001)(186003)(53546011)(122000001)(66476007)(66556008)(66946007)(66446008)(64756008)(76116006)(110136005)(38070700005)(478600001)(4326008)(52536014)(8936002)(316002)(2906002)(8676002)(30864003)(5660300002)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?p4+g7UBlo/yVq0MPAq1r3HZEhcGnGJVjb+48DYPq5+l07Qo+dowapsvnSact?= =?us-ascii?Q?pdTp9v53bGCk+dvpgnQePrIoaX9z/5Uq9P1TvrsyLecvYBSTIImq1wcVWpYV?= =?us-ascii?Q?sq6+6L52FqqVsDJrIQv8TCVJMq+sdJyOAQkod6LyvqVt6WGQgtcClq14SlxS?= =?us-ascii?Q?TkOBs3DJD+XZMOR8FS1I/HDkJTgIN4221s13n1bIN430C9kGoLUIEQxDqIQu?= =?us-ascii?Q?O6uncfoexrT2QaCN5lLDKKr3qx3CvcSV1iMbxyTpDOjhpGTggJUt1YJdpVbD?= =?us-ascii?Q?podasnr8gmkIbU9vpXEnRcMAK67SQjSmXkC84Zguz917U6ylE+favhwXzeXb?= =?us-ascii?Q?Ng+4HLXc/L97AiVFnAGwKlh9TEnahdfNaHG1jddEf6IAB3noJKNUQ90KlOHJ?= =?us-ascii?Q?03ec2q4Ml86gCNKegbgvn0Cm5tkIL+ng4wK8fI4Bl+1dgkrRsFKMRU7OuqQs?= =?us-ascii?Q?ZRdDIl3sfRXNvdTFfQxkoeNR9f7NfbxpCrJIzkSOyc34yTcuva1K5sXVf4GM?= =?us-ascii?Q?sNKHk7BvOjVP9wNQCcBpm9Q/YcAF3+RWb4JWVY5yyHRllhmx5iXIFSc5CkHb?= =?us-ascii?Q?xfJlv+82MVVwmCANbF5nEaocy+t+hDf1+Hz5vTjGbJ250o3halZT9yX4N2LF?= =?us-ascii?Q?uPaltcYFzeDe0mBPP+ReXG3wIEIJWqYpQpj+tN4fcQpyaiD8VWvEnbolEZgr?= =?us-ascii?Q?cmzTfVbQQp+esZaHkigXREaV1l5B7ZzZ++0PbcbiNaAZPRPojEG7RO4SS6QC?= =?us-ascii?Q?GZHJu0/XB+4nA9lQLNaLXVCXHjxYw2tTUylmUQnjHKMFfhNBXVQSi/wHEiT8?= =?us-ascii?Q?PRbm4PTruW0NxK1tYhBlnH7Ry00C7LdnPdzZrdiz89i2FGcGhT1Dd6U+0WOi?= =?us-ascii?Q?HyH1mzjuqG994sVLtcEtNvqRIJl022vYW/3Sn6Rei3Y+TslgleZk90KjZXBO?= =?us-ascii?Q?r07n8Ja/EbU8rQOcmd849z3BPIkEMmG8OTYXOUqsPAJNWN1YlVzi2/uhuamm?= =?us-ascii?Q?133+KJMiEs9MBLa+7sB9oFh5HEBxU35+AOUuCSynmQsW6Ry+apO6gQks/LYC?= =?us-ascii?Q?iYIj4rHQHxBH9Bo2OTKQU5oBEtKlXaiG3Yuf3tAyFbxpMcXCFHGeN+G6GMvD?= =?us-ascii?Q?Pu/0hGT8RfHkp2yIYvjfzGxi0yyQVA06KDobe6Jz1rG2o9l8JwgAz/mSif8y?= =?us-ascii?Q?9wPsr7MiGq1BdqwvJQHBPDv2h+im3AY1S0YHpCH9sx6DD7ysdoa8mDzOckIY?= =?us-ascii?Q?5SUQj2DNUTnCrKJogq2/Q70Iu4Fa7q4gY9wBAoNAg8WGy6dmfSHmz6u/4ztE?= =?us-ascii?Q?TucPrcmN59RoxpGezkoayU48/Uc0qeobsMVsWS6x4hFABWQFCBSmDjZLxFr0?= =?us-ascii?Q?5IsXuoWWTk6MW97KqjW6bLOH5ZZPAG92T1OKBRUXRuUzNjYBDim04cKfvNyc?= =?us-ascii?Q?IQT0j5pHF6ZzFGS1MgkI9RPmVDKuIeXgwfhgq8dvsvp1171ayEx0jTnbzkpY?= =?us-ascii?Q?ixNZ/O0HiOCKh+jnpkYCyfbtrc8Ks8uu44VbT8II+HjJoEnyCYdisQWhnquo?= =?us-ascii?Q?wfLKooMF4XXdfKCO+rI=3D?= 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: e7da6e04-f419-41ba-8ff5-08db515fba1f X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2023 14:06:18.9070 (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: mdmJPGMihlJWkxh/eyKfqQwQtNot+NfCnWfRW6YV0GLgdZ22UlesI13vwP9Cb0rfyC1U6V3d46y9DWhFJ+r2Hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6857 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Please review your commit message in which the characters per line should b= e < 76. Reviewed-by: > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, May 10, 2023 9:04 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > > Subject: [edk2-redfish-client][PATCH 1/5] RedfishClientPkg: Rename > RedfishMemoryCollection driver >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=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: Igor Kulchytskyy > --- > .../RedfishClientComponents.dsc.inc | 2 +- > .../MemoryCollectionDxe.inf} | 17 +- > .../MemoryCollectionDxe.h} | 7 +- > .../Include/RedfishCollectionCommon.h | 14 +- > .../MemoryCollectionDxe.c} | 269 ++++++++++-------- > RedfishClientPkg/RedfishClient.fdf.inc | 2 +- > 6 files changed, 170 insertions(+), 141 deletions(-) rename > RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.inf =3D> MemoryCollectionDxe/MemoryCollectionDxe.inf} (71%) > rename > RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.h =3D> MemoryCollectionDxe/MemoryCollectionDxe.h} (65%) > rename > RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.c =3D> MemoryCollectionDxe/MemoryCollectionDxe.c} (65%) >=20 > diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc > b/RedfishClientPkg/RedfishClientComponents.dsc.inc > index ee4602fe..5f1aff3c 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 > 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 c28a3bfe..05e05712 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,15 +38,15 @@ > UefiLib > UefiDriverEntryPoint > UefiBootServicesTableLib > + EdkIIRedfishResourceConfigLib > + RedfishVersionLib >=20 > [Protocols] > gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMED > gEfiRestJsonStructureProtocolGuid ## CONSUMED > - gEdkIIRedfishResourceConfigProtocolGuid ## CONSUMED > gEdkIIRedfishFeatureProtocolGuid ## CONSUMED >=20 > [Guids] > - gEfiEventReadyToBootGuid >=20 > [Pcd] > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize > diff --git > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.h > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > h > similarity index 65% > rename from > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.h > rename to > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.h > index e5da48db..3d02285d 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/Include/RedfishCollectionCommon.h > b/RedfishClientPkg/Include/RedfishCollectionCommon.h > index 3c1e72b6..59cc3607 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') -#de= fine > 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/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.c > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > c > similarity index 65% > rename from > RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC > ollectionDxe.c > rename to > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c > index e70a7f76..c86628a4 100644 > --- > a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory > CollectionDxe.c > +++ > b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe. > +++ c > @@ -1,67 +1,101 @@ > /** @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; > } >=20 > - RedfishResrouceProtocol =3D GetRedfishResourceConfigProtocol ( > - SchemaInfo.Schema, > - SchemaInfo.Major, > - SchemaInfo.Minor, > - SchemaInfo.Errata > - ); > - if (RedfishResrouceProtocol =3D=3D NULL) { > - return EFI_DEVICE_ERROR; > + // > + // 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; > + } > + > + 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 +106,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 +145,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 +154,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,22 +171,21 @@ ProcessCollection ( > return EFI_NOT_FOUND; > } >=20 > - Count =3D 0; > - List =3D GetFirstLink (&CollectionCs->Members); > + List =3D GetFirstLink (&CollectionCs->Members); > while (TRUE) { > 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)); > + UriData =3D (RedfishCS_Type_Uri_Data *)Header; > + 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 > @@ -171,25 +199,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; > + EFI_STATUS Status; > + 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)) { > @@ -199,18 +226,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; > @@ -246,6 +264,11 @@ ReleaseCollectionResource ( > Private->CollectionJson =3D NULL; > } >=20 > + if (Private->RedfishVersion !=3D NULL) { > + FreePool (Private->RedfishVersion); > + Private->RedfishVersion =3D NULL; > + } > + > return EFI_SUCCESS; > } >=20 > @@ -255,49 +278,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 > @@ -307,21 +300,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; > @@ -332,10 +317,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. > @@ -347,12 +334,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; > @@ -365,6 +353,37 @@ 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)); diff --git a/RedfishClientPkg/RedfishClient.fdf.i= nc > b/RedfishClientPkg/RedfishClient.fdf.inc > index 6292de4e..3619d2a2 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 > # > -- > 2.17.1