From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web10.28038.1658975140966820032 for ; Wed, 27 Jul 2022 19:25:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=Juzk+8jj; 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.236.40, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMNWMfpxLgLZZ4oaqRY6xBPZwaucCWupad8QchZQa2fIf1cseXvlQ72L/Z15KLrj/DaIX/2zRs/dsvWaZOk0q3uPWkhNmi1TjuuL+11yjah9V9O/ccxC66oZPNlHweYX2QYY3NdDTm2sEy+mIRCmY5KvOHlqA60C4YNek7QTD6FiES1ZXYEmxLCPsSJnTf9XyZz5PDYzWdhoLYw21yhLtR1Ns39xuX7uT/BhIAaAbm3XP/WMzqOO73UaMx4qaiaR3KqOwjN/n7AzubRbhUlFuonvT0XiDgXNGuNvD2rqV2kOuFBjx5vs7s+ZXs2BRk3GyIFj4kbpuH+yJfJGRRBZAQ== 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=WHj/V9G6fCNuybmQeqye/PKChR7xSmagu9cYf9TzjeU=; b=c5kVH75f7dFIXpdX0m1BqcFynNhSL/oCdZWlpVCs1noTMQ1Xrrn6fuUped8cB9ARumLWUtQbWs8PfZvadfrKFzuTi+gULMR/KH2FjMipbiAGm0REAAicJutyITs0+EP3KAT6X1ZNbVnj5q7Wj07oDxnzf635v+7MU3a6n5F5FYNZV11alQkvhS6QQDJJLPHQkTEyrYXLnQsJDrAWd44MDrY5/SoPymSDg9ymae/jvWaI2x9DZmfQ7xKJGjzOvjHBvV+2/FfUlUd0QyA7O6TtKkHJ3Jw/qfsTdqh+5zDF6kmapSlHjMiASsL0lmFKIQIwQ6S0pbjWSpDI7SvcxEJY2g== 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=WHj/V9G6fCNuybmQeqye/PKChR7xSmagu9cYf9TzjeU=; b=Juzk+8jjXgUPWW8AM7c6ZGuARnitNXl8B+EAbJXHVPxsBCM9+sQww5o1cyMtwGXcp9bvtHume5dwyByUW8Go4gbr4vE9ZJZmoUC4lgsbRNE02GMuzr8o89vZZv7Pv0lnSVQhH09kD/zSr7bS1rd1TMaU/zf8pDw/7Cg7SSprNX0= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by DS0PR12MB6486.namprd12.prod.outlook.com (2603:10b6:8:c5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Thu, 28 Jul 2022 02:25:37 +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 02:25:37 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: "Yang, Atom" , Nick Ramirez Subject: Re: [edk2-staging][PATCH v3 08/15] edk2-staging/RedfishClientPkg: Update Redfish feature core driver Thread-Topic: [edk2-staging][PATCH v3 08/15] edk2-staging/RedfishClientPkg: Update Redfish feature core driver Thread-Index: AQHYoVmOciD2wlDrbEC781pto772462TD92w Date: Thu, 28 Jul 2022 02:25:37 +0000 Message-ID: References: <20220727013802.247-1-nickle.wang@hpe.com> <20220727013802.247-9-nickle.wang@hpe.com> In-Reply-To: <20220727013802.247-9-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-28T02:25:35Z; 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=6e08d2d5-dd1e-4b02-babd-fd56ec233fa1; 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: 6f37f627-c7a1-4d03-c9fb-08da7040755e x-ms-traffictypediagnostic: DS0PR12MB6486:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 64J+cyMo+58Cor0osuWhmlYbpmxRhdFiCDH478m6Pc7wUKCuJIoAn9CdWgYDD4laq1adQ18k1zVXwzzyrXdSGsdB6ncbP3zdzgiyVkBdxF3hZrIq0hnpkc9TBV+BWfSnzT1KLeqico1IrU1o8ZhfavOS13Sy0xhfD7czVAiF3CuuaixRPkYnMtD2e0IIs0T/PTfqsaEU92GwYx5h10zvGR9g6Y/uVgExZy2U7DX4h/YeBxT0wbjMIhGW/xTGvauYCvJwgR4kFaYM4ZDdo1I/+41dUuek73K8GwAclA7H2K/Ew6l9UxrAW77c7uQJwnAebYrECPhGYi921jpj2EP+TvEzBEKpQD7SE413GY71wi4NmJyUoAGe/Lp9vjARcNgM7jLdtODWvFvh7mvZiYQFAXElblRWpQr4WTK2PwQNSANn7Ujm0e5KWH+SH0vOjwGn+ZcT8onQMuiAxTw4IncfzfK9TjK/U/1Z1ak3hX7KOLm1CRurO1ODYU/BJ4sBKPnjoOn9as2Vs+RUfxMcgnoWfqhB8pa0KPIaptH7uDpv3rWPqHPTUCgMQk689v8m+88FGK4SvTVXhO96oqYTcA1YmPN2+c8bkDAErA6jU+2CHH8ZemeWxWYeqgQ/30m7pLY3KEqq58c9HWbZ8Bz/bjkqOHZmljkZHPMdeL9eRfwdU7K3gMflDMsbODnxqhD4U1sBgEeO+Rq9Bdb0BxHpjQdGfxvHlsfldr72EkkAw8nNCx1seWX8DYQiuiwY3hhEOYmfXPwQLUvtl2OE5flWMME24WJWX5X1ZeBfXf+133szN23C2bLOudhCQnsnPh14AFLK 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)(376002)(396003)(39860400002)(136003)(346002)(366004)(66476007)(66446008)(38100700002)(52536014)(8676002)(66556008)(76116006)(66946007)(5660300002)(122000001)(316002)(8936002)(64756008)(38070700005)(6506007)(26005)(83380400001)(4326008)(186003)(7696005)(478600001)(55016003)(9686003)(71200400001)(41300700001)(53546011)(30864003)(110136005)(54906003)(2906002)(15650500001)(86362001)(296002)(33656002)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bJvRxbaf/jk4Y3IAB8YqKD7AyOUnuyV47/X/lJwaDDWSBTcz4taTFC6/iSbm?= =?us-ascii?Q?0NzlbdAQ+mcCRVShtiVsV3tROpdFYYRgwPQfFGp1xqo8w/x7rrF3hfWPjEbj?= =?us-ascii?Q?RIDXQ19phTBHVEaCSsp01q3qKPKs2wapViW0bgqvkBoGVFUx7lnS3+fADLiL?= =?us-ascii?Q?LcMB+gjj59P0IHThES+E7vYPdzMnR4lxZ62yBuFmBBTeHL7qYaB84+jOLK6R?= =?us-ascii?Q?bhADqdF/f+B96rdsBB72+ZdgdpGdgpqU+kAwhk0Lk8ywMwJ+aWNjACbLLsLi?= =?us-ascii?Q?QUFu2fmLsTaDqPYJ3DmcfQFKHydcPzUn9VRL7WiC/OjmuX/ZRMaZVdlw9LZQ?= =?us-ascii?Q?rgnIG6Stx86qeO0vQ6gVPV4F752JHa1lrOjxXK/vSdcdWUj1Cm4GV3QV+Gz5?= =?us-ascii?Q?gQ2WvD0gbY2E1dq4y8KtxXkORNxCpEvEVe6Gd3W6h/c+kc1OIiOfRObyZiIR?= =?us-ascii?Q?Yau0VoVS1yZeB8v/3Ni9s8ZbrUPWHNNk93snTowjgp2L7zBYQn99O8No7JDG?= =?us-ascii?Q?s4FzNC7Y5wewAYUhsYvJSFn4GATR3ksqZHGw0gojReEo6vP1MnR0hTb+ZWLh?= =?us-ascii?Q?/gfhVb/tjTd/uBrFyZixfd9LrUGfNChoVOcQuZscMnvQmE2+QPTzBl5ikzHb?= =?us-ascii?Q?AKVdBqriS1fce5m6Y8KiLKNCoT/5FcjPX2zPhnhohN8TKXHhmb7lbtk6RiPr?= =?us-ascii?Q?3uSd4Ar4+Lq5CsTdh4ch7Jq1bUPZVzguQYhcLQunrKTkrFz1Pvdwm3+Rrs09?= =?us-ascii?Q?/KVsrXToZmIdttIQfsiIOAjVKHTpHS61aCP9pTlghp9OjZ/NZ/CZSRq91M6h?= =?us-ascii?Q?iGq219FCH5koDWsq93E3fDaXDBh8zcxwjqpUQVvgUjijmhLkPhmNWY2ssnwE?= =?us-ascii?Q?9n75vwhMoCYOQXXRr23q26lP9PYyOzChlLQVGVs6tgYK/8FK98eNBxnXEVQr?= =?us-ascii?Q?7IcwL/c7ZbOWD/kGRb3UIYD6JrTn6fjC+jzd3YW/tKhaiHlMIXLBAeWDar60?= =?us-ascii?Q?slnFNAP46ZaDwhpmqKJztt+ko7znKUpk1V304qNRv/95HCUFRWJ4HIoV3nKb?= =?us-ascii?Q?RH1jJDYAFIscgHjBwbTlmI9FEMIQgGTzhUyDDggt62Bi+1Gzm/8xP6By/1Bh?= =?us-ascii?Q?K38Ue9HfFo6+RufWUKJqvMqJsRGF5GwCc/gUdcJSGn3KJn+aosjO/rENTKR4?= =?us-ascii?Q?iiQ1YQaA7+Af68GbPfxSRIu0Zet4DpsMvDitRHO96/9KYI6G66MffOa84zxV?= =?us-ascii?Q?w3tribAAzFmIrz3NYY9DcNFuDLhBpUYqyugM8xHVszj5NiLuee8bv2xSmNEL?= =?us-ascii?Q?S6nlrgVraGTbCtqcTMi5cZIi5exjNhPY6epVgaIRUfV7uyDMqk0afFAPddw/?= =?us-ascii?Q?u1ACtpUlmMJcsy6kxSvvisjtfmE+ZFoO1eq1vRiVSdGIF4QLI1i/ymnsmLSX?= =?us-ascii?Q?h1FiUZBFc7Xh7e+DdCInkicNE7i0VvflXoFTm+5maDH+dqO0pw0wxcdluzTQ?= =?us-ascii?Q?OYoM62b3T047z37TCd/CrHuvp3Rgt4cutjWlz6LeFFOOjQUFb7HSfBMZHN64?= =?us-ascii?Q?ewQRCt2KuOKDo0xFn7A=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: 6f37f627-c7a1-4d03-c9fb-08da7040755e X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jul 2022 02:25:37.5398 (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: bvBK4+tXMUP0wp6+IaLmadhUrjKPtruPd+JgfJdYMJ3HkCcLM/gG8Swo9kN06L1ix4IAHuA2euLMnpicMutVFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6486 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 08/15] edk2-staging/RedfishClientPkg: > Update Redfish feature core driver >=20 > [CAUTION: External Email] >=20 > Update Redfish feature core driver to support Redfish resource with multi= ple > parents. A resource may be presented in different resource and the link i= n > different resource point to the same location. Also add interchange data > interface in feature core driver so feature core driver can talk to featu= re > drivers directly. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Yang Atom > Cc: Nick Ramirez > --- > .../Include/Protocol/EdkIIRedfishFeature.h | 20 +- > .../RedfishFeatureCoreDxe.c | 290 ++++++++++++++++-- > .../RedfishFeatureCoreDxe.h | 20 +- > .../RedfishFeatureCoreDxe.inf | 5 +- > 4 files changed, 278 insertions(+), 57 deletions(-) >=20 > diff --git a/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h > b/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h > index 036622128d..26814c8786 100644 > --- a/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h > +++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h > @@ -1,7 +1,7 @@ > /** @file > This file defines the EDKII_REDFISH_FEATURE_PROTOCOL interface. >=20 > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -10,6 +10,8 @@ > #ifndef EDKII_REDFISH_FEATURE_H_ > #define EDKII_REDFISH_FEATURE_H_ >=20 > +#include > + > typedef struct _EDKII_REDFISH_FEATURE_PROTOCOL > EDKII_REDFISH_FEATURE_PROTOCOL; >=20 > #define EDKII_REDFISH_FEATURE_PROTOCOL_GUID \ @@ -23,25 +25,13 > @@ typedef enum { > CallbackActionMax > } FEATURE_CALLBACK_ACTION; >=20 > -typedef enum { > - InformationTypeNone =3D 0, ///< Invalid information. > - InformationTypeCollectionMemberUri, ///< URI to the new created > collection member. > - InformationTypeMax > -} FEATURE_RETURNED_INFORMATION_TYPE; > - > -typedef struct { > - FEATURE_RETURNED_INFORMATION_TYPE Type; -} > FEATURE_RETURNED_INFORMATION; > - > /** > The callback function provided by Redfish Feature driver. >=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] 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] ExchangeInformation The pointer to > RESOURCE_INFORMATION_EXCHANGE. >=20 > @retval EFI_SUCCESS Redfish feature driver callback is ex= ecuted > successfully. > @retval Others Some errors happened. > @@ -53,7 +43,7 @@ EFI_STATUS > 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 *ExchangeInformation > ); > /** > The registration function for the Redfish Feature driver. > diff --git > a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c > b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c > index 49e1cd6b60..3414f0c942 100644 > --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c > +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c > @@ -2,7 +2,7 @@ > RedfishFeatureCoreDxe produces EdkIIRedfishFeatureCoreProtocol > for EDK2 Redfish Feature driver registration. >=20 > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -13,38 +13,188 @@ > EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent; > REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext; > REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList; > +RESOURCE_INFORMATION_EXCHANGE *mInformationExchange; > + > +/** > + Setup the information to deliver to child feature/collection driver. > + > + @param[in] ThisList REDFISH_FEATURE_INTERNAL_DATA ins= tance. > + @param[in] ParentConfgLanguageUri Parent configure language URI. > + > +**/ > +EFI_STATUS > +SetupExchangeInformationInfo ( > + IN REDFISH_FEATURE_INTERNAL_DATA *ThisList, > + IN EFI_STRING ParentConfgLanguageUri > + ) > +{ > + ThisList->InformationExchange->SendInformation.ParentUri =3D > +(EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16)); > + if (ThisList->InformationExchange->SendInformation.ParentUri =3D=3D NU= LL) { > + return EFI_OUT_OF_RESOURCES; > + } > + ThisList->InformationExchange->SendInformation.PropertyName =3D > +(EFI_STRING)AllocateZeroPool(MaxNodeNameLength * sizeof (CHAR16)); > + if (ThisList->InformationExchange->SendInformation.PropertyName =3D=3D > NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + ThisList->InformationExchange->SendInformation.FullUri =3D > +(EFI_STRING)AllocateZeroPool(MaxParentUriLength * sizeof (CHAR16)); > + if (ThisList->InformationExchange->SendInformation.FullUri =3D=3D NULL= ) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + // > + // Setup property name > + // > + StrCpyS (ThisList->InformationExchange->SendInformation.PropertyName, > + MaxNodeNameLength, ThisList->NodeName); > + > + // > + // Setup parent config language URI > + // > + StrCpyS (ThisList->InformationExchange->SendInformation.ParentUri, > + MaxParentUriLength, ParentConfgLanguageUri); > + > + // > + // Full config language URI > + // > + StrCpyS (ThisList->InformationExchange->SendInformation.FullUri, > + MaxParentUriLength, > + ThisList->InformationExchange->SendInformation.ParentUri > + ); > + if (StrLen (ThisList->InformationExchange->SendInformation.FullUri) != =3D 0) { > + StrCatS (ThisList->InformationExchange->SendInformation.FullUri, > +MaxParentUriLength, L"/"); > + } > + StrCatS (ThisList->InformationExchange->SendInformation.FullUri, > +MaxParentUriLength, > +ThisList->InformationExchange->SendInformation.PropertyName); > + return EFI_SUCCESS; > +} > + > +/** > + Destroy the exchange information. > + > + @param[in] ThisList REDFISH_FEATURE_INTERNAL_DATA instance. > + > +**/ > +EFI_STATUS > +DestroryExchangeInformation ( > + IN REDFISH_FEATURE_INTERNAL_DATA *ThisList > + ) > +{ > + > + if (ThisList->InformationExchange !=3D NULL) { > + if (ThisList->InformationExchange->SendInformation.Type =3D=3D > InformationTypeCollectionMemberUri) { > + if (ThisList->InformationExchange->SendInformation.ParentUri !=3D = NULL) > { > + FreePool (ThisList->InformationExchange->SendInformation.ParentU= ri); > + ThisList->InformationExchange->SendInformation.ParentUri =3D NUL= L; > + } > + if (ThisList->InformationExchange->SendInformation.PropertyName != =3D > NULL) { > + FreePool (ThisList->InformationExchange- > >SendInformation.PropertyName); > + ThisList->InformationExchange->SendInformation.PropertyName =3D > NULL; > + } > + if (ThisList->InformationExchange->SendInformation.FullUri !=3D NU= LL) { > + FreePool (ThisList->InformationExchange->SendInformation.FullUri= ); > + ThisList->InformationExchange->SendInformation.FullUri =3D NULL; > + } > + } > + > + if (ThisList->InformationExchange->ReturnedInformation.Type =3D=3D > InformationTypeCollectionMemberConfigLanguage) { > + DestroyConfiglanguageList (&ThisList->InformationExchange- > >ReturnedInformation.ConfigureLanguageList); > + } > + > + ThisList->InformationExchange->SendInformation.Type =3D > InformationTypeNone; > + ThisList->InformationExchange->ReturnedInformation.Type =3D > + InformationTypeNone; > + > + } > + return EFI_SUCCESS; > +} >=20 > /** > Startup child feature drivers and it's sibing feature drivers. >=20 > - @param[in] ThisFeatureDriverList This feature driver list. > - @param[in] StartupContext Start up information > + @param[in] ThisFeatureDriverList This feature driver list. > + @param[in] CurrentConfigLanguageUri The current parent configure > language URI. > + @param[in] StartupContext Start up information >=20 > **/ > VOID > StartUpFeatureDriver ( > IN REDFISH_FEATURE_INTERNAL_DATA *ThisFeatureDriverList, > + IN EFI_STRING CurrentConfigLanguageUri, > IN REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext > ) > { > EFI_STATUS Status; > + UINTN Index; > REDFISH_FEATURE_INTERNAL_DATA *ThisList; > + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList; > + EFI_STRING NextParentUri; > + > + NextParentUri =3D (EFI_STRING)AllocateZeroPool (MaxParentUriLength * > + sizeof (CHAR16)); if (NextParentUri =3D=3D NULL) { > + DEBUG((DEBUG_ERROR, "%a: Fail to allocate memory for parent > configure language.\n", __FUNCTION__)); > + return; > + } > + if (CurrentConfigLanguageUri !=3D NULL) { > + StrCpyS(NextParentUri, MaxParentUriLength, > + CurrentConfigLanguageUri); } >=20 > ThisList =3D ThisFeatureDriverList; > while (TRUE) { > if (ThisList->Callback !=3D NULL) { > - Status =3D ThisList->Callback( > - StartupContext->This, > - StartupContext->Action, > - ThisList->Context, > - &ThisList->ReturnedInformation > - ); > + ThisList->InformationExchange =3D mInformationExchange; > + Status =3D SetupExchangeInformationInfo (ThisList, NextParentUri); > + if (!EFI_ERROR (Status)) { > + Status =3D ThisList->Callback( > + StartupContext->This, > + StartupContext->Action, > + ThisList->Context, > + ThisList->InformationExchange > + ); > + } > if (EFI_ERROR (Status)) { > - DEBUG((DEBUG_ERROR, "%a: Callback to EDK2 Redfish feature driver > fail.", __FUNCTION__)); > + DEBUG((DEBUG_ERROR, "%a: Callback to EDK2 Redfish feature > + driver fail: %s.\n", __FUNCTION__, > + ThisList->InformationExchange->SendInformation.FullUri)); > } > } > - if (ThisList->ChildList !=3D NULL) { > - StartUpFeatureDriver (ThisList->ChildList, StartupContext); > + if (!EFI_ERROR (Status) && ThisList->Callback !=3D NULL && ThisList- > >ChildList !=3D NULL) { > + // > + // Go through child list only when the parent node is managed by > feature driver. > + // > + if (ThisList->Flags & > REDFISH_FEATURE_INTERNAL_DATA_IS_COLLECTION) { > + // > + // The collection driver's callback is invoked. > InformationTypeCollectionMemberConfigLanguage > + // should be returned in RESOURCE_INFORMATION_RETURNED. > + // > + if (ThisList->InformationExchange->ReturnedInformation.Type =3D= =3D > InformationTypeCollectionMemberConfigLanguage) { > + // > + // Copy RESOURCE_INFORMATION_RETURNED then destroy the > exchange information. > + // > + CopyConfiglanguageList (&ThisList->InformationExchange- > >ReturnedInformation.ConfigureLanguageList, &ConfigLangList); > + DestroryExchangeInformation(ThisList); > + // > + // Modify the collection instance according to the returned > InformationTypeCollectionMemberConfigLanguage. > + // > + for (Index =3D 0; Index < ConfigLangList.Count; Index ++) { > + StrCatS (NextParentUri, MaxParentUriLength, ThisList->NodeNa= me); > + StrCatS (NextParentUri, MaxParentUriLength, > NodeIsCollectionSymbol); > + SetResourceConfigLangMemberInstance (&NextParentUri, > MaxParentUriLength, (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG > *)&ConfigLangList.List[Index]); > + StartUpFeatureDriver(ThisList->ChildList, NextParentUri, > StartupContext); > + } > + DestroyConfiglanguageList (&ConfigLangList); > + } else { > + DEBUG((DEBUG_ERROR, "%a: No > InformationTypeCollectionMemberConfigLanguage of %s returned.\n", > __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri)); > + DEBUG((DEBUG_ERROR, "%a: Redfish service maybe not connected o= r > the network has problems.\n", __FUNCTION__)); > + return; > + } > + } else { > + StrCatS (NextParentUri, MaxParentUriLength, ThisList->NodeName); > + StartUpFeatureDriver(ThisList->ChildList, NextParentUri, > StartupContext); > + } > + // > + // Restore the parent configure language URI for this level. > + // > + if (CurrentConfigLanguageUri !=3D NULL) { > + StrCpyS(NextParentUri, MaxParentUriLength, > CurrentConfigLanguageUri); > + } else{ > + NextParentUri [0] =3D 0; > + } > + } else { > + DestroryExchangeInformation (ThisList); > } > // > // Check sibling Redfish feature driver. > @@ -57,6 +207,10 @@ StartUpFeatureDriver ( > // > ThisList =3D ThisList->SiblingList; > }; > + if (NextParentUri !=3D NULL) { > + FreePool (NextParentUri); > + } > + > } >=20 > /** > @@ -85,10 +239,30 @@ RedfishFeatureDriverStartup( > if (ResourceUriNodeList =3D=3D NULL) { > return; > } > + > + // > + // Initial dispatcher variables. > + // > + mInformationExchange =3D (RESOURCE_INFORMATION_EXCHANGE > + *)AllocateZeroPool (sizeof (RESOURCE_INFORMATION_EXCHANGE)); if > (mInformationExchange =3D=3D NULL) { > + DEBUG((DEBUG_ERROR, "%a: Fail to allocate memory for exchange > information.\n", __FUNCTION__)); > + return; > + } > + > + // > + // Signal event before doing provisioning // > + SignalReadyToProvisioningEvent (); > + > // > // Invoke the callback by the hierarchy level > // > - StartUpFeatureDriver (ResourceUriNodeList, StartupContext); > + StartUpFeatureDriver (ResourceUriNodeList, NULL, StartupContext); > + > + // > + // Signal event after provisioning finished // > + SignalAfterProvisioningEvent (); > } >=20 > /** > @@ -97,6 +271,8 @@ RedfishFeatureDriverStartup( > @param[in,out] PtrToNewInternalData Pointer to receive new instance o= f > REDFISH_FEATURE_INTERNAL_DATA. > @param[in] NodeName Name of URI node. > + @param[in] NodeIsCollection TRUE means the node to add is the > collection node. > + Otherwise it is a resource node. >=20 > @retval EFI_SUCCESS New entry is inserted successfully. > @retval EFI_INVALID_PARAMETER Improper given parameters. > @@ -106,7 +282,8 @@ RedfishFeatureDriverStartup( > EFI_STATUS > NewInternalInstance ( > IN OUT REDFISH_FEATURE_INTERNAL_DATA **PtrToNewInternalData, > - IN EFI_STRING NodeName > + IN EFI_STRING NodeName, > + IN BOOLEAN NodeIsCollection > ) > { > REDFISH_FEATURE_INTERNAL_DATA *NewInternalData; > @@ -126,8 +303,7 @@ NewInternalInstance ( > StrnCpyS (NewInternalData->NodeName, StrSize (NodeName), (CONST > CHAR16 *)NodeName, StrLen (NodeName)); > NewInternalData->SiblingList =3D NULL; > NewInternalData->ChildList =3D NULL; > - if (NodeName[0] =3D=3D (UINT16)NodeIsCollectionLeftBracket && > - NodeName [StrLen (NodeName) - 1] =3D=3D > (UINT16)NodeIsCollectionRightBracket) { > + if (NodeIsCollection) { > NewInternalData->Flags |=3D > REDFISH_FEATURE_INTERNAL_DATA_IS_COLLECTION; > } > *PtrToNewInternalData =3D NewInternalData; > @@ -138,11 +314,15 @@ NewInternalInstance ( > Insert the URI node into internal data structure >=20 > @param[in] HeadEntryToInsert The head entry to start the searc= hing. > + @param[in] PrevisouEntry Previsou entry. > @param[in] NodeName Name of URI node. > + @param[in] NodeIsCollection TRUE means the node to add is the > collection node. > + Otherwise it is a resource node. > @param[in, out] NextNodeEntry Pointer to receive the pointer of= next > head > entry for inserting the follow up= nodes. > The returned LIST_ENTRY is the ad= dress of > ChildList link list. > + @param[out] MatchNodeEntry The matched node entry. > @retval EFI_SUCCESS New entry is inserted successfully. > @retval EFI_INVALID_PARAMETER Improper given parameters. > @retval EFI_OUT_OF_RESOURCES Lack of memory for the internal data > structure. > @@ -151,8 +331,11 @@ NewInternalInstance ( > EFI_STATUS > InsertRedfishFeatureUriNode ( > IN REDFISH_FEATURE_INTERNAL_DATA *HeadEntryToInsert, > + IN REDFISH_FEATURE_INTERNAL_DATA **PrevisouEntry, > IN EFI_STRING NodeName, > - IN OUT REDFISH_FEATURE_INTERNAL_DATA **NextNodeEntry > + IN BOOLEAN NodeIsCollection, > + IN OUT REDFISH_FEATURE_INTERNAL_DATA **NextNodeEntry, > + OUT REDFISH_FEATURE_INTERNAL_DATA **MatchNodeEntry > ) > { > EFI_STATUS Status; > @@ -160,6 +343,7 @@ InsertRedfishFeatureUriNode ( > REDFISH_FEATURE_INTERNAL_DATA *ThisInternalData; > REDFISH_FEATURE_INTERNAL_DATA *SiblingList; >=20 > + *MatchNodeEntry =3D NULL; > if (NodeName =3D=3D NULL) { > DEBUG((DEBUG_ERROR, "%a: Node name is NULL.\n", __FUNCTION__)); > return EFI_INVALID_PARAMETER; > @@ -169,17 +353,18 @@ InsertRedfishFeatureUriNode ( > return EFI_INVALID_PARAMETER; > } >=20 > - if (HeadEntryToInsert =3D=3D NULL || HeadEntryToInsert->ChildList =3D= =3D NULL) { > - Status =3D NewInternalInstance (&NewInternalData, NodeName); > + if (HeadEntryToInsert =3D=3D NULL) { > + Status =3D NewInternalInstance (&NewInternalData, NodeName, > NodeIsCollection); > if (EFI_ERROR (Status)) { > return Status; > } > - if (HeadEntryToInsert =3D=3D NULL) { > + if (HeadEntryToInsert =3D=3D NULL && ResourceUriNodeList =3D=3D NULL= ) { > ResourceUriNodeList =3D NewInternalData; > } else { > - HeadEntryToInsert->ChildList =3D NewInternalData; > + (*PrevisouEntry)->ChildList =3D NewInternalData; > } > - *NextNodeEntry =3D NewInternalData; > + *PrevisouEntry =3D NewInternalData; > + *NextNodeEntry =3D NewInternalData->ChildList; > return EFI_SUCCESS; > } > // > @@ -189,22 +374,26 @@ InsertRedfishFeatureUriNode ( > SiblingList =3D ThisInternalData->SiblingList; > while (TRUE) { > if (StrCmp((CONST CHAR16 *)ThisInternalData->NodeName, (CONST > CHAR16 *)NodeName) =3D=3D 0) { > + *MatchNodeEntry =3D ThisInternalData; > *NextNodeEntry =3D ThisInternalData->ChildList; > + *PrevisouEntry =3D ThisInternalData; > return EFI_SUCCESS; > } > // > // If sibing exist? > // > if (SiblingList =3D=3D NULL) { > - Status =3D NewInternalInstance (&NewInternalData, NodeName); > + Status =3D NewInternalInstance (&NewInternalData, NodeName, > NodeIsCollection); > if (EFI_ERROR (Status)) { > return Status; > } > ThisInternalData->SiblingList =3D NewInternalData; > + *PrevisouEntry =3D NewInternalData; > *NextNodeEntry =3D NewInternalData->ChildList; > return EFI_SUCCESS; > } > - SiblingList =3D SiblingList->SiblingList; > + ThisInternalData =3D SiblingList; > + SiblingList =3D ThisInternalData->SiblingList; > }; > return EFI_SUCCESS; > } > @@ -250,7 +439,12 @@ RedfishFeatureRegister ( > UINTN Index; > UINTN AnchorIndex; > UINTN UriLength; > + BOOLEAN NewUri; > REDFISH_FEATURE_INTERNAL_DATA *ThisUriNode; > + REDFISH_FEATURE_INTERNAL_DATA *PreUriNode; > + REDFISH_FEATURE_INTERNAL_DATA *NewUriNode; > + REDFISH_FEATURE_INTERNAL_DATA *MatchNodeEntry; > + BOOLEAN ItsCollection; >=20 > if (FeatureManagedUri =3D=3D NULL || Callback =3D=3D NULL) { > DEBUG((DEBUG_ERROR, "%a: The given parameter is invalid\n", > __FUNCTION__)); > @@ -263,27 +457,62 @@ RedfishFeatureRegister ( > Index =3D 0; > AnchorIndex =3D 0; > ThisUriNode =3D ResourceUriNodeList; > - do { > + PreUriNode =3D ResourceUriNodeList; > + NewUri =3D FALSE; > + while ((Index < UriLength)) { > if ((Index - AnchorIndex + 1) >=3D MaxNodeNameLength) { // Increase = one > for the NULL terminator > DEBUG((DEBUG_ERROR, "%a: the length of node name is >=3D > MaxNodeNameLength\n", __FUNCTION__)); > ASSERT (FALSE); > } > NodeName[Index - AnchorIndex] =3D *(FeatureManagedUri + Index); > - if (NodeName [Index - AnchorIndex] =3D=3D NodeSeperator || NodeName > [Index - AnchorIndex] =3D=3D (CHAR16)0) { > + if (NodeName [Index - AnchorIndex] =3D=3D NodeSeperator || NodeName > [Index - AnchorIndex] =3D=3D UriSeperator || NodeName [Index - AnchorInde= x] > =3D=3D (CHAR16)0) { > + if (NodeName [Index - AnchorIndex] =3D=3D UriSeperator) { > + NewUri =3D TRUE; > + } > NodeName [Index - AnchorIndex] =3D 0; > AnchorIndex =3D Index + 1; > // > // Insert node > // > if (StrLen(NodeName) !=3D 0) { > - Status =3D InsertRedfishFeatureUriNode(ThisUriNode, NodeName, > &ThisUriNode); > + ItsCollection =3D FALSE; > + if ((Index + StrLen(NodeIsCollectionSymbol)) < UriLength && > + *(FeatureManagedUri + Index + 1) =3D=3D NodeIsCollectionLeft= Bracket > && > + *(FeatureManagedUri + Index + 2) =3D=3D NodeIsCollectionRigh= tBracket) > { > + Index +=3D (StrLen(NodeIsCollectionSymbol)); > + AnchorIndex +=3D (StrLen(NodeIsCollectionSymbol)); > + ItsCollection =3D TRUE; > + if (*(FeatureManagedUri + Index) =3D=3D UriSeperator) { > + NewUri =3D TRUE;; > + } > + } > + Status =3D InsertRedfishFeatureUriNode(ThisUriNode, &PreUriNode, > NodeName, ItsCollection, &NewUriNode, &MatchNodeEntry); > if (EFI_ERROR (Status)) { > return Status; > } > + ThisUriNode =3D NewUriNode; > + } > + if (NewUri || ((Index + 1) >=3D UriLength)) { > + // > + // Setup the callabck and restart the searching for the > + // next URI. > + // > + if (MatchNodeEntry !=3D NULL) { > + MatchNodeEntry->Callback =3D Callback; > + MatchNodeEntry->Context =3D Context; > + MatchNodeEntry =3D NULL; > + } else { > + PreUriNode->Callback =3D Callback; > + PreUriNode->Context =3D Context; > + } > + NewUri =3D FALSE; > + ThisUriNode =3D ResourceUriNodeList; > + Index ++; > + continue; > } > } > Index ++; > - } while ((Index < UriLength)); > + }; >=20 > if (ThisUriNode =3D=3D NULL) { > // > @@ -292,11 +521,6 @@ RedfishFeatureRegister ( > DEBUG((DEBUG_ERROR, "%a: No URI node is added\n", __FUNCTION__)); > return EFI_INVALID_PARAMETER; > } > - // > - // Add feature driver info to internal data instance. > - // > - ThisUriNode->Callback =3D Callback; > - ThisUriNode->Context =3D Context; > return EFI_SUCCESS; > } >=20 > diff --git > a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h > b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h > index 7b1778b038..84b5e456d1 100644 > --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h > +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h > @@ -1,7 +1,7 @@ > /** @file > Definitions of RedfishFeatureCoreDxe >=20 > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -16,22 +16,26 @@ > #include > #include > #include > -#include > #include > +#include > +#include >=20 > #define MaxNodeNameLength 64 > +#define MaxParentUriLength 512 > #define NodeSeperator L'/' > -#define NodeIsCollectionLeftBracket '{' > -#define NodeIsCollectionRightBracket '}' > +#define UriSeperator L';' > +#define NodeIsCollectionLeftBracket L'{' > +#define NodeIsCollectionRightBracket L'}' > +#define NodeIsCollectionSymbol L"/{}" >=20 > typedef struct _REDFISH_FEATURE_INTERNAL_DATA > REDFISH_FEATURE_INTERNAL_DATA; > struct _REDFISH_FEATURE_INTERNAL_DATA { > REDFISH_FEATURE_INTERNAL_DATA *SiblingList; ///< Next same level in > hierarchy of resource URI. > REDFISH_FEATURE_INTERNAL_DATA *ChildList; ///< Next level in > hierarchy of resource URI. > - EFI_STRING NodeName; ///< Name of the node in hierarc= hy of > resource URI. > - REDFISH_FEATURE_CALLBACK Callback; ///< Callback function of Redfis= h > feature driver. > - VOID *Context; ///< Context of feature driver. > - FEATURE_RETURNED_INFORMATION *ReturnedInformation; ///< > Information returned from Redfish feature driver. > + EFI_STRING NodeName; ///< Name of the node in h= ierarchy of > resource URI. > + REDFISH_FEATURE_CALLBACK Callback; ///< Callback function of > Redfish feature driver. > + VOID *Context; ///< Context of feature dr= iver. > + RESOURCE_INFORMATION_EXCHANGE *InformationExchange; ///< > Information returned from Redfish feature driver. > UINT32 Flags; > }; > #define REDFISH_FEATURE_INTERNAL_DATA_IS_COLLECTION 0x00000001 > diff --git > a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf > b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf > index 5a2cd7fecc..ddcf991006 100644 > --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf > +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf > @@ -3,7 +3,7 @@ > # EdkIIRedfishFeatureCoreProtocol to EDK2 Redfish Feature > # drivers for the registration. > # > -# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development > LP
> # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## > @@ -27,6 +27,7 @@ > [Packages] > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > + RedfishPkg/RedfishPkg.dec > RedfishClientPkg/RedfishClientPkg.dec >=20 > [LibraryClasses] > @@ -35,6 +36,8 @@ > DebugLib > MemoryAllocationLib > PrintLib > + RedfishEventLib > + RedfishFeatureUtilityLib > UefiBootServicesTableLib > UefiDriverEntryPoint > UefiLib > -- > 2.32.0.windows.2