From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.10899.1608817976754424265 for ; Thu, 24 Dec 2020 05:52:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=OcUZ0Y+2; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=062783f45b=nickle.wang@hpe.com) Received: from pps.filterd (m0134422.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0BODiDYQ017404 for ; Thu, 24 Dec 2020 13:52:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=u2ClF6TnsRrGKOGrmY1YSKnQEb6vOMarPKQya7Y8atI=; b=OcUZ0Y+23hlE8N9Sy5Xh3BXQOk+jPU4JrV/69C9Z7VmSW2cIxe3uAqn/3CJHSm7GLV+6 jxYt30Yl1922jWKH9zaTefMvBvVWFMcgyT3D9tddRG9DtnabNGBqnEDPW3bcbKhKekDs GMtEZupxyHWJHplz6+sUtC3CrViVvGczRY8pZdnm99DhM+OsaMCDYi2x+9JDSfz2Cy6E UDteNpyK35b65hq92pe0iVbb95SCNPDvC4g0mO0pzgWgt0LqWq5P55M4it5v1XY0Rt9L G1dvNhvkWQDYMgh4bJ5l20EOd621KnQ1sYr59gPthOr2n/Xgk4PKbnNGj6ixp1gAHyXb fw== Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0b-002e3701.pphosted.com with ESMTP id 35k0d0bb2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 Dec 2020 13:52:55 +0000 Received: from G2W6311.americas.hpqcorp.net (g2w6311.austin.hp.com [16.197.64.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2352.austin.hpe.com (Postfix) with ESMTPS id 428C791 for ; Thu, 24 Dec 2020 13:52:55 +0000 (UTC) Received: from G4W9335.americas.hpqcorp.net (16.208.33.85) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 24 Dec 2020 13:52:23 +0000 Received: from G9W9209.americas.hpqcorp.net (2002:10dc:429c::10dc:429c) by G4W9335.americas.hpqcorp.net (2002:10d0:2155::10d0:2155) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 24 Dec 2020 13:52:23 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (15.241.52.10) by G9W9209.americas.hpqcorp.net (16.220.66.156) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 24 Dec 2020 13:52:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ddqc3jTymLC3kQavV/zedhtthcONj2FxpOmw/p93UeSsKpE1CwlzxUBkZBsZojTDAjZLacbbqb3NJtVGO8QvsupFW9EmpOp1ICQ0Sc+WPQBSCJMd+C51c72BcG/N3TNIF+ICDwkU4OjXq5lUb/pfP7bpyNyb9eEFHSo94oK5SrEXnMZEp0yyWQeSpZGOD3SHmMwaF3I/BA7mrkXrc86YA3ilGcLXiZQuo2aoD7xC1VIYwqnUD39dMnYKBOznyMtkBk52OXtqe+01pWjIfNzLXRBPwRi9rv+Wa3yUGtsoouevzHoHPi03WywLfztiXWIvbMEBuXgr5L7CLCObJTuG5w== 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-SenderADCheck; bh=u2ClF6TnsRrGKOGrmY1YSKnQEb6vOMarPKQya7Y8atI=; b=KEpMEAuvcwQ05hboKolAQnH3LUXXQRMZVa6toyLDF2aNLBt1Vlry6920V/T1IzbCm2D+8BOUe1LG6ml+mBefVQ3TuUAPlMUl2daXDrW0pGNVEVxqAxmIU+x6bHlzZ31p0DmiuX2yRRwbtonAMvuscZle18aP6r0s9k5MFUmmgvKH/KRAlsZ/g21lgD27uz3avYHmVzj3kgCWQ2Sb7anhwiZQ2RyE0hcE3F2HK4qeoSCneHwfTtazE/tcwyppf/3BlkpiXB6fdn9I6UYTI7GSE+hXhR5XtBgGJlshhkF6Y4EO1IpdJtrMwuEL3/NOrjZ1hcYl0bfFexo2BcChkLK2xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::7) by DF4PR8401MB1004.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27; Thu, 24 Dec 2020 13:52:21 +0000 Received: from DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM ([fe80::e475:6a2b:ed1c:a060]) by DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM ([fe80::e475:6a2b:ed1c:a060%11]) with mapi id 15.20.3700.026; Thu, 24 Dec 2020 13:52:21 +0000 From: "Nickle Wang" To: "Chang, Abner (HPS SW/FW Technologist)" , "devel@edk2.groups.io" CC: Jiaxin Wu , Siyuan Fu , Fan Wang , Jiewen Yao , "O'Hanley, Peter (EXL)" Subject: Re: [PATCH v2] RedfishPkg/DxeRestExLib: DxeRestExLib Thread-Topic: [PATCH v2] RedfishPkg/DxeRestExLib: DxeRestExLib Thread-Index: AQHW1Tq+1wfDnkuqm0KsBE/bhA5P6aoGTWpQ Date: Thu, 24 Dec 2020 13:52:21 +0000 Message-ID: References: <20201218002220.11748-1-abner.chang@hpe.com> In-Reply-To: <20201218002220.11748-1-abner.chang@hpe.com> Accept-Language: zh-TW, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [61.231.84.216] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 41827e3f-183c-42ed-3a8b-08d8a81322b4 x-ms-traffictypediagnostic: DF4PR8401MB1004: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1824; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OnWq6zHgEqpMOcx26BGRARcDaE6aAgLvOn0AZjWxC+DtaVu6ycz4u7IAXa5/WDyrt+E+vkwJEXW7oN6Q+NJrZSDdLdmkuZchW5guo012vB4etbmKdeaXwm92TI1k1+BHtxpr9VLNzjQ+G0rqkyMYZl0lOqt5zAmnjBePfkjkCHnrZriC1vAuwDBAZqQuP21HzvctYePKXaPuv/2V57LQ9WBx5jMYv3Vt+ExDrOQRIlQ1gqp4tvMUYc/8i23hHlMyvUqKng+DdwXCBGPHdt5DSSloZY+Ipr03BIY1YfVX814paGnLcY3Hp8xP/qzoQzA93NHAdN26NFNCm8baYGjGt2xXnAflMx9u6q6SWhm87RMYLUdSn/3yvZdVuLTxWscKEpHxGreLKyB6Z68F4+m9Dg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(6029001)(376002)(396003)(366004)(346002)(39860400002)(136003)(86362001)(83380400001)(71200400001)(4326008)(26005)(33656002)(186003)(5660300002)(55016002)(76116006)(8936002)(110136005)(8676002)(53546011)(316002)(52536014)(66446008)(9686003)(64756008)(66946007)(6506007)(66476007)(478600001)(7696005)(54906003)(66556008)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?OrhUKO8VOeqK8TcC7bS/KHtN5T5FHD9K+/FHReezNvIw4ncSJ9yltcd16M4y?= =?us-ascii?Q?kGz27g5lYuPId37N5DBxSxWuXaiTiJgXOqYxAIGrdYfAbkZcacKErFPSb6WB?= =?us-ascii?Q?e5G6elGRSbnV+/vyBUL9xdYR6cZhzsHweopWJMvUgBMl2/ZvvM440jyq9rOQ?= =?us-ascii?Q?Z6KRs4x5xyCEnVd/yPAEt0iBIQJwQUt3RSUHz2NEckv1rdf3vR+lM6j47C1j?= =?us-ascii?Q?DtjIhCIqg4tzjrMolEuBDflDvAwTtsXcLLLgzb4nTJTz7nY1rlNLKJwQEOLO?= =?us-ascii?Q?WdVMIIV8oMO4E+/LmHTWBm38s33KRP5XtDVD9LqY7hQ3jMn1yDQJThJom0tM?= =?us-ascii?Q?quXu6E74EmjIStJhgvqb1IYUveo7QtEMxoyqCs+vdehwn1cO7U5YuTGxBF0Y?= =?us-ascii?Q?C7nuxCfRPvFQM0ggk9l4HCJUpZYDxdPNREtqH/aOldaVtCnE0o5FMAfFqAHf?= =?us-ascii?Q?TUQuxxDzvmxUe7oEkgc7UBVsCILu7tl/a0ByVNpQd2oQvqrdF6ktqnVBKMA9?= =?us-ascii?Q?VtcNrfzLd/sdeuyg7AihjwWXOFkBDocP2avkiVWFdFmlVNTLmB/gyK3iuFE+?= =?us-ascii?Q?/rjvhL8BGCXUDCo9JcMLHW5vt/OnZ/GFH7SaBG/gq2nxWahD+V60cDbDGovX?= =?us-ascii?Q?RPKKfZfqvAUB8fhf1yQQckku9IKz44s+QtwmOLrzvOO34wnekBzJobRaPRuO?= =?us-ascii?Q?RmHk7TWOlUxUGjucLDccMtjDk3XKS9bnAEC8xnXiB0MytAdWweVYqCnlxaIx?= =?us-ascii?Q?+WeuFof7mSpO80joq/E7OF/76ue/A/68gAozjG+qiu/Qnm5z+B/RXkXurgKG?= =?us-ascii?Q?zALa7TQSrHPev/2G2oG/V51go8WResbtwZaS+bEPQ6rNMY5uw4wo/Hpj6KU/?= =?us-ascii?Q?y5PX1yogmSwsx9GsKp5Ph0W5NhUXZgVc9gObJLLcfMs/nx89mNxUFUnMv74Q?= =?us-ascii?Q?5xDE5WrDBcZW9W3xgKlxJrhkv1wiAbb3A11om/k+Vc4=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 41827e3f-183c-42ed-3a8b-08d8a81322b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Dec 2020 13:52:21.1957 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: u83s/Ttp3OthAeKQfi3xQ3gHRjO3bmtwtsHCaq8FUACinUBX4kP9l15p/vHJNt0OyyFq8f/iutYymVQbGt1fOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1004 X-OriginatorOrg: hpe.com X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-24_08:2020-12-24,2020-12-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012240086 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nickle Wang > -----Original Message----- > From: Chang, Abner (HPS SW/FW Technologist) > Sent: Friday, December 18, 2020 8:22 AM > To: devel@edk2.groups.io > Cc: Jiaxin Wu ; Siyuan Fu ; Fan > Wang ; Jiewen Yao ; Wang, > Nickle (HPS SW) ; O'Hanley, Peter (EXL) > > Subject: [PATCH v2] RedfishPkg/DxeRestExLib: DxeRestExLib >=20 > Add EFI REST EX helper library to create child instance of > REST EX service. >=20 > Signed-off-by: Abner Chang >=20 > Cc: Jiaxin Wu > Cc: Siyuan Fu > Cc: Fan Wang > Cc: Jiewen Yao > Cc: Nickle Wang > Cc: Peter O'Hanley > --- > RedfishPkg/RedfishPkg.dec | 4 + > RedfishPkg/RedfishLibs.dsc.inc | 1 + > RedfishPkg/RedfishPkg.dsc | 1 + > .../Library/DxeRestExLib/DxeRestExLib.inf | 44 +++++ > RedfishPkg/Include/Library/RestExLib.h | 40 +++++ > .../Library/DxeRestExLib/DxeRestExLib.c | 166 ++++++++++++++++++ > 6 files changed, 256 insertions(+) > create mode 100644 RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf > create mode 100644 RedfishPkg/Include/Library/RestExLib.h > create mode 100644 RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c >=20 > diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec > index fc56b4fefb..89a2a6de1e 100644 > --- a/RedfishPkg/RedfishPkg.dec > +++ b/RedfishPkg/RedfishPkg.dec > @@ -25,6 +25,10 @@ > # Platform implementation-specific Redfish Credential Interface. > RedfishPlatformCredentialLib|Include/Library/RedfishCredentialLib.h >=20 > + ## @libraryclass The helper routines to access REST EX service. > + # This library is only intended to be used by UEFI network stack mod= ules. > + RestExLib|Include/Library/RestExLib.h > + > [Protocols] > ## Include/Protocol/RedfishDiscover.h > gEfiRedfishDiscoverProtocolGuid =3D { 0x5db12509, 0x4550, 0x4347,= { 0x96, > 0xb3, 0x73, 0xc0, 0xff, 0x6e, 0x86, 0x9f }} > diff --git a/RedfishPkg/RedfishLibs.dsc.inc b/RedfishPkg/RedfishLibs.dsc.= inc > index e780b5c270..df21664f4e 100644 > --- a/RedfishPkg/RedfishLibs.dsc.inc > +++ b/RedfishPkg/RedfishLibs.dsc.inc > @@ -11,5 +11,6 @@ > # > ## > !if $(REDFISH_ENABLE) =3D=3D TRUE > + RestExLib|RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf > !endif >=20 > diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc > index 0b5d8cdd4e..5d9476bc79 100644 > --- a/RedfishPkg/RedfishPkg.dsc > +++ b/RedfishPkg/RedfishPkg.dsc > @@ -49,5 +49,6 @@ > [Components] >=20 > RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLibN= ull. > inf > RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull= .inf > + RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf >=20 > !include RedfishPkg/Redfish.dsc.inc > diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf > b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf > new file mode 100644 > index 0000000000..ab87224d57 > --- /dev/null > +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf > @@ -0,0 +1,44 @@ > +## @file > +# Library for REST EX Protocol > +# > +# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x0001001b > + BASE_NAME =3D DxeRestExLib > + FILE_GUID =3D E9CBF727-8AF3-4602-9DBD-A3942869B5A= E > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D RestExLib | DXE_DRIVER DXE_RUNTIME_= DRIVER > UEFI_APPLICATION UEFI_DRIVER > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC RISCV64 > +# > + > +[Sources.common] > + DxeRestExLib.c > + > +[Packages] > + NetworkPkg/NetworkPkg.dec > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + DevicePathLib > + MemoryAllocationLib > + NetLib > + PrintLib > + UefiLib > + UefiBootServicesTableLib > + UefiRuntimeServicesTableLib > + > +[Protocols] > + gEfiRestExServiceBindingProtocolGuid ## PROTOCOL ALWAYS_CONSUMED > + gEfiRestExProtocolGuid ## PROTOCOL ALWAYS_CONSUMED > + > diff --git a/RedfishPkg/Include/Library/RestExLib.h > b/RedfishPkg/Include/Library/RestExLib.h > new file mode 100644 > index 0000000000..a83a43e1a1 > --- /dev/null > +++ b/RedfishPkg/Include/Library/RestExLib.h > @@ -0,0 +1,40 @@ > +/** @file > + This library provides help functions for REST EX Protocol. > + > + (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REST_EX_LIB_H_ > +#define REST_EX_LIB_H_ > + > +/// > +/// Library class public functions > +/// > + > +/** > + This function allows the caller to create child handle for specific > + REST server. > + > + @param[in] Image The image handle used to open service= . > + @param[in] AccessMode Access mode of REST server. > + @param[in] ConfigType Underlying configuration to communica= te with > REST server. > + @param[in] ServiceType REST service type. > + @param[out] ChildInstanceHandle The handle to receive the create chil= d. > + > + @retval EFI_SUCCESS Can't create the corresponding REST EX= child > instance. > + @retval EFI_INVALID_PARAMETERS Any of input parameters is improper. > + > +**/ > +EFI_STATUS > +RestExLibCreateChild ( > + IN EFI_HANDLE Image, > + IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, > + IN EFI_REST_EX_CONFIG_TYPE ConfigType, > + IN EFI_REST_EX_SERVICE_TYPE ServiceType, > + OUT EFI_HANDLE *ChildInstanceHandle > +); > + > +#endif > diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > new file mode 100644 > index 0000000000..05c70c213f > --- /dev/null > +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > @@ -0,0 +1,166 @@ > +/** @file > + This library provides help functions for REST EX Protocol. > + > + (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define REST_EX_CONFIG_DATA_LEN_UNKNOWN 0xff > + > +/** > + This function allows the caller to create child handle for specific > + REST server. > + > + @param[in] Image The image handle used to open service= . > + @param[in] AccessMode Access mode of REST server. > + @param[in] ConfigType Underlying configuration to communica= te with > REST server. > + @param[in] ServiceType REST service type. > + @param[out] ChildInstanceHandle The handle to receive the create chil= d. > + > + @retval EFI_SUCCESS Can't create the corresponding REST EX= child > instance. > + @retval EFI_INVALID_PARAMETERS Any of input parameters is improper. > + > +**/ > +EFI_STATUS > +RestExLibCreateChild ( > + IN EFI_HANDLE Image, > + IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, > + IN EFI_REST_EX_CONFIG_TYPE ConfigType, > + IN EFI_REST_EX_SERVICE_TYPE ServiceType, > + OUT EFI_HANDLE *ChildInstanceHandle > +) > +{ > + EFI_STATUS Status; > + UINTN NoBuffer; > + EFI_HANDLE *Handle; > + EFI_HANDLE ChildHandle; > + EFI_REST_EX_PROTOCOL *RestEx; > + EFI_REST_EX_SERVICE_INFO *RestExServiceInfo; > + UINT8 LenOfConfig; > + > + if (Image =3D=3D NULL || > + AccessMode >=3D EfiRestExServiceModeMax || > + ConfigType >=3D EfiRestExConfigTypeMax || > + ServiceType >=3D EfiRestExServiceTypeMax || > + ChildInstanceHandle =3D=3D NULL > + ) { > + return EFI_INVALID_PARAMETER; > + } > + > + *ChildInstanceHandle =3D NULL; > + // > + // Locate all REST EX binding service. > + // > + Handle =3D NULL; > + NoBuffer =3D 0; > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEfiRestExServiceBindingProtocolGuid, > + NULL, > + &NoBuffer, > + &Handle > + ); > + if (EFI_ERROR (Status) && Status !=3D EFI_BUFFER_TOO_SMALL) { > + return Status; > + } > + Handle =3D (EFI_HANDLE *)AllocateZeroPool (sizeof(EFI_HANDLE) * NoBuff= er); > + if (Handle =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEfiRestExServiceBindingProtocolGuid, > + NULL, > + &NoBuffer, > + &Handle > + ); > + if (EFI_ERROR (Status)) { > + FreePool (Handle); > + return Status; > + } > + > + // > + // Search for the proper REST EX instance. > + // > + while (NoBuffer !=3D 0) { > + ChildHandle =3D NULL; > + Status =3D NetLibCreateServiceChild ( > + *(Handle + (NoBuffer - 1)), > + Image, > + &gEfiRestExServiceBindingProtocolGuid, > + &ChildHandle > + ); > + if (!EFI_ERROR (Status)) { > + Status =3D gBS->OpenProtocol ( > + ChildHandle, > + &gEfiRestExProtocolGuid, > + (VOID **)&RestEx, > + Image, > + NULL, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > + if (EFI_ERROR (Status)) { > + goto ON_ERROR; > + } > + > + // > + // Get the information of REST service provided by this EFI REST E= X driver > + // > + Status =3D RestEx->GetService ( > + RestEx, > + &RestExServiceInfo > + ); > + if (EFI_ERROR (Status)) { > + goto ON_ERROR; > + } > + // > + // Check REST EX property. > + // > + switch (ConfigType) { > + case EfiRestExConfigHttp: > + LenOfConfig =3D sizeof (EFI_REST_EX_HTTP_CONFIG_DATA); > + break; > + > + case EfiRestExConfigUnspecific: > + LenOfConfig =3D REST_EX_CONFIG_DATA_LEN_UNKNOWN; > + break; > + > + default: > + goto ON_ERROR; > + } > + if (RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceAccessMo= de !=3D > AccessMode || > + RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceType != =3D > ServiceType || > + RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigType != =3D > ConfigType || > + ((LenOfConfig !=3D REST_EX_CONFIG_DATA_LEN_UNKNOWN) && > (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength !=3D > LenOfConfig))) { > + goto ON_ERROR; > + } > + } > + // > + // This is proper REST EX instance. > + // > + *ChildInstanceHandle =3D ChildHandle; > + FreePool (Handle); > + return EFI_SUCCESS; > + > +ON_ERROR:; > + NetLibDestroyServiceChild ( > + *(Handle + (NoBuffer - 1)), > + Image, > + &gEfiRestExServiceBindingProtocolGuid, > + ChildHandle > + ); > + NoBuffer --; > + }; > + FreePool (Handle); > + return EFI_NOT_FOUND; > +} > -- > 2.17.1