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.27739.1618201201513495650 for ; Sun, 11 Apr 2021 21:20:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=BoaGVSQb; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0736a39a7a=abner.chang@hpe.com) Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13C4EGwK015725 for ; Mon, 12 Apr 2021 04:20:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=GoeJdYmRmh0M7cAF2Ctx2dz3wGtswo0ftYLa4nxI9ug=; b=BoaGVSQbldPZP4BIS7cBMyiSeC9aN8a5HSo5noMHgKkFkRNY40NonOS4jVsf51uLSmAx qcqVbT1M2PxO+XqmcsrtMpqZbDqmutv5L1/x8502W1s90ip8kWghspNUNEnjGQYA60Gt Q2o6tFSXxwK4rhiZWRPy08bO7FDHQR/A8/+7Q/DtIxtqCJQ9WuQ/jTfz9PL09Ax3IS3v cuXeeywSCeQKCg1Gsk9FSycw4Tp/cuSS3f+xDjDy7Gu0xeJr4IQJNTCSBBjFxv50JmQx hR0dLDA80SiCTL8fCwTUUlgL/NkV27ximyvQyso2ltYy+IbjRuzI+M0/JbZ4rOUA6Ryi cA== Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0a-002e3701.pphosted.com with ESMTP id 37u2jp1m9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 12 Apr 2021 04:20:00 +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 g4t3427.houston.hpe.com (Postfix) with ESMTPS id D99517F for ; Mon, 12 Apr 2021 04:19:59 +0000 (UTC) Received: from G4W9332.americas.hpqcorp.net (16.208.32.118) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 04:19:59 +0000 Received: from G2W6311.americas.hpqcorp.net (16.197.64.53) by G4W9332.americas.hpqcorp.net (16.208.32.118) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 04:19:58 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (15.241.52.10) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 04:19:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UV7LVgO6Ryb5u1h3F+eISvVb8xt2QLHCO2Te1TO0hL1s1Ui/OfLwrdappjdmOY10NuuOiQZO38skmQIJ6OLuR9RiyVDUw4fAQzQET76gPwJUKARKJUeOMAVly0HiB06mRFAg9A8K2p3DRkL2y/UZXsshMWuvaRHkS2qcTRV6YcX9ou0Ie0tmMAXbfysqnbPaa+V5Q4pAfK5tbtmHo15BOpAJBlTvoftmt/mzTmP3rNeXXizuO61v3pFWg/Egr8KijK6lUQs7Q3rG1ifPPMO8HgAoEt2MCW3cT7zsioEze9Y3lBi6i09B+voXcevCiNMWCWBoE5GHcXg07H/hQNQ4Kg== 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=WgtycMJxO01mCjDv/5zC/9deH7hcu/c1d9SkmrMbNo4=; b=WQ++57yb/ou9SkzPxuOzN9rYhOxh6RhsD+yBww4lu0Z5P+PYBh9cRPmr6FJpEFXe6w80ObmardAOVsVe7ryBwRwdDfrwg2BkOqMIR5RkgJoi///kZxm4jEZzHcLEQLc3i2UyYV0/zVBjkPBUDnos5XxPA7aHu9Z2WaAfqp+CCQTsw/fjmCIakxbT5DIMe2UgTZQSeMcarnQAP9bAVOY6W2+gPgjvVCVoyCJaEDzCL+0OqJ18O0mQNchDsK93jNy5qv/rkK866TbpW5YQNUZ2b6M9cgeLVSgGc+OzMSvGxVLZgNYlh9Eh/EPG4CLXuAE6n7NpAXTVqBcxasaRluBYMA== 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 CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7508::16) by CS1PR8401MB0422.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16; Mon, 12 Apr 2021 04:19:56 +0000 Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::28f5:3e45:17cf:9231]) by CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::28f5:3e45:17cf:9231%10]) with mapi id 15.20.4020.022; Mon, 12 Apr 2021 04:19:56 +0000 From: "Abner Chang" To: "Wang, Nickle (HPS SW)" , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [PATCH] RedfishPkg/RedfishConfigHandler: EDKII RedfishConfigHandler Protocol Thread-Topic: [edk2-devel] [PATCH] RedfishPkg/RedfishConfigHandler: EDKII RedfishConfigHandler Protocol Thread-Index: AQHXL09JVwxew15zSbygHxA9BtejaKqwRiTw Date: Mon, 12 Apr 2021 04:19:56 +0000 Message-ID: References: <20210326055520.23823-1-abner.chang@hpe.com> In-Reply-To: Accept-Language: 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: [16.242.247.131] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0c6779b9-10ad-401a-609c-08d8fd6a3a92 x-ms-traffictypediagnostic: CS1PR8401MB0422: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1013; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: P83gGxOWZ9SZXhLft8q+QsdcOAsSmxACsDnX3J+nlm3z8pHHFXvIrmzvEOtkzdlT2Bp2hhlHxvTBM/yoVlo6gybnKHKseyX21Fyqw1z0rU4cRk4ha+NFxsxBGPbe44raDLP55X64kKRo02hxz16e73V92NiWRRBvlQrSo1G6+3OulNoeIu/RWMQOYV4V3s02OVLxnBxE1MhYXg+kd8SYldGVkES/SLrQlw76YelBp/0jw7Qy2tyZ7VUHoDaRwvAK0vn1dC7oUhVsr1ALOORmoy82IMppR6sHJKMnkwop/MMombHhurf4rRDmvT/sUuAHHciTwFoW/Q/ED9HVH9KkTg1NIn+VuzJghzyGWOltyOFQpRMhxhpMCYhX1LIOfOjU5lqpmU/Hr8ZFYLCCd5IMmJ2ANaZYKji/nKuLOW92fSiUEHkJ7KPnfDLLHNq6YSD+c00scM0/dPW2thfHoyFZ/ZlHEOJJM1eDRV7fYPEZjSbRSnV1Yw2+8tzFZiygrGKgNIP1we/p3x6onqpB/UdDW/bKJRapbKuppspqCzcbkfjargoxNVsEndmlXIGZjABacakZBWNvINbexiTicKDsXVGweebGPyTCxYqHxWx+8yllALZmi9M4uFRmSUGZkqGlVit4sKVmJzx2LhPssyst1n43JY+6T6uBinDCGcz08/zLVREYMfu6SCf94Z/U53+N x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(396003)(346002)(136003)(39860400002)(376002)(366004)(83380400001)(30864003)(5660300002)(26005)(9686003)(52536014)(478600001)(53546011)(2906002)(186003)(33656002)(110136005)(55016002)(19627235002)(76116006)(966005)(71200400001)(8936002)(64756008)(6506007)(7696005)(66556008)(86362001)(8676002)(66476007)(66946007)(316002)(66446008)(38100700002)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?m/XfeZKGbk6wnAq9xACCmw/BafBBs/smek15q4wtsQ0FbdNyUEOvuxCT83Nu?= =?us-ascii?Q?Kj+hwufBRZNDGirko6Hbobq+j9MyL5C9V10KaeJjNpL9VhA87DCp1S/6bFHF?= =?us-ascii?Q?ZzxSecQSTOHfyJeyjxCr8/IGuxfExgir8UhmSLBup7ZvqXURWI1j5T6eISiG?= =?us-ascii?Q?uPvcRNO82eHiaOGsN+m2I/B76BogqHm45DulaLZdPlwPIM2PyO7JWcRISyyl?= =?us-ascii?Q?NVFt8DMWiQWb0pGqo8ik5ucq9Y53+Pjz4cACr/awnIBft/59FjF3EYdlQH3S?= =?us-ascii?Q?X0vAkSGJFptfGeoKL5/5Fui4TU7v9E9L6nEu3ZtBR7lNErmcdGlvEp798ws9?= =?us-ascii?Q?po0w5ybxDj3GezIOgGiYAGqpf70iwLdYjW1k5IIwxCdZsaF5zuSOBlxrgr3X?= =?us-ascii?Q?6AfhB8E7SOgVLzcbXHSZVg/5ooh72NbQ3v6pTFJnCth1aNNDLiuRcXKw+bqA?= =?us-ascii?Q?O8OUZ9s1dJxbHYoCoXpbVtcSTQJtyzJUfUx0viKa6K1NyTiLfdFwwlBSDXRl?= =?us-ascii?Q?4R0MNyCezfrcubiY/N297tOlbdl3DplOJRzw01BBkjtcCD5feII7SoDN9Vzb?= =?us-ascii?Q?kg1jntrRH0K3J6zhQLL/Htj4RAKPR+uKltqKy47IP3hV4e4RjvUVJPmv4nT5?= =?us-ascii?Q?axvBEREvA3d8TOoT+qzUjrrgwU2dsT7OIGKYumf2CQ2yqMvphO7jiIDQDg7W?= =?us-ascii?Q?RkmyL8Eb2/sf1JL6UDSTI8/Zqou7osqfwXAvY/RPVxM5OqFYdbiFr7d6PPnS?= =?us-ascii?Q?Zros5yQ1iDFnGzTthhYTYNMVRRpNz9p/bXSmmCoM009Jxv6bjil9ISlnUeQU?= =?us-ascii?Q?t2c7pOgGIeCIF5XD0A2NStKlLAnERx+LJhIaFodAgP8yoCN+t1sScho/K67h?= =?us-ascii?Q?FtEaZtgtW6DgGilyPjPUORQISpcY8F+cnI5CZM/5iPcYyVRk+ivCx0/Qf0mS?= =?us-ascii?Q?YbKuvp0dcEbkDeP6w/22BpXdYY7DGKEUX6TSrxuUqnEANO4+tg2mZwtcQW64?= =?us-ascii?Q?B4IjaK9FSxJLiqkxI9pPlRP97DgEsT5htoyOrhlyapZVyR9rjcx4eQe9ywR1?= =?us-ascii?Q?aW9y/+EwfN4Q3dMCIiUBDBS9Nsnql3wmagZXna7VrFZ6RlAPmQ2DtzRZzOu9?= =?us-ascii?Q?wnhsrcEMCZMsjS/8juBz1+EwJlwRpqPGsAdz34R5W4kD3AewkE1PLdeNNivu?= =?us-ascii?Q?YPquiItwCyNcrmh9usphb1IlLNenGeCV4xDVJX6BYSjPVkV2j9U/8zXe96Ln?= =?us-ascii?Q?xgRaB+oBw2MxWNyuIkBuL9p2d7mk4JBeqCU/+1TyA/TUH6QRBg3WV+4bWuEJ?= =?us-ascii?Q?4d3R4Rp3BSinA28aiwh7CiVu?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 0c6779b9-10ad-401a-609c-08d8fd6a3a92 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2021 04:19:56.1518 (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: tG0CafT7prEg2fhgdTQ2klbgKPR1+IA24Th6FsWet3WJQMGGSda21mtWIDmiejqyZYVcwOm9KByDTD5SuFg76Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0422 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: WbAc8i4UnenNR2GL5em95DjcCIh6bXkl X-Proofpoint-GUID: WbAc8i4UnenNR2GL5em95DjcCIh6bXkl X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-12_03:2021-04-09,2021-04-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 adultscore=0 spamscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120026 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ah, yes. I will revise the copyrights in Redfish.fdf.inc and RedfishCompone= nts.dsc.inc when merge it. Thanks for catching this. Abner > -----Original Message----- > From: Wang, Nickle (HPS SW) > Sent: Monday, April 12, 2021 11:53 AM > To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) > > Subject: RE: [edk2-devel] [PATCH] RedfishPkg/RedfishConfigHandler: EDKII > RedfishConfigHandler Protocol >=20 > Looks good to me. But for the copyright, I think it would be "2020-2021"= , right? > For example: >=20 > -# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
>=20 > Thanks, > Nickle >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Abner > Chang > Sent: Friday, March 26, 2021 1:55 PM > To: devel@edk2.groups.io > Cc: Wang, Nickle (HPS SW) > Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishConfigHandler: EDKII > RedfishConfigHandler Protocol >=20 > The driver is used to manage EDK2 Redfish Configuration Handler > Protocol installed by EDK2 Redfish feature drivers. > This is the EDK2 Redfish client driver written based on the EDK2 > Redfish foundation to initialize EDK2 Redfish feature drivers. >=20 > EDK2 Redfish feature drivers are used to provision/consume/update > the firmware owns Redfish properties during system power on > initialization. >=20 > RedfishConfigHandlerCommon.c has the common code for the driver > instances used in different EDK2 boot phases or used by different > driver models in the future contribution. >=20 > Signed-off-by: Jiaxin Wu > Signed-off-by: Siyuan Fu > Signed-off-by: Fan Wang > Signed-off-by: Abner Chang >=20 > Cc: Nickle Wang > --- > RedfishPkg/RedfishComponents.dsc.inc | 3 +- > RedfishPkg/Redfish.fdf.inc | 3 +- > .../RedfishConfigHandlerDriver.inf | 60 ++ > .../RedfishConfigHandlerCommon.h | 101 +++ > .../RedfishConfigHandlerDriver.h | 159 +++++ > .../RedfishConfigHandlerCommon.c | 265 ++++++++ > .../RedfishConfigHandlerDriver.c | 587 ++++++++++++++++++ > 7 files changed, 1176 insertions(+), 2 deletions(-) > create mode 100644 > RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf > create mode 100644 > RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h > create mode 100644 > RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h > create mode 100644 > RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c > create mode 100644 > RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c >=20 > diff --git a/RedfishPkg/RedfishComponents.dsc.inc > b/RedfishPkg/RedfishComponents.dsc.inc > index 08f1d3bc32..d0116f065c 100644 > --- a/RedfishPkg/RedfishComponents.dsc.inc > +++ b/RedfishPkg/RedfishComponents.dsc.inc > @@ -6,7 +6,7 @@ > # of EDKII Redfish drivers according to the value of flags described in > # "RedfishDefines.dsc.inc". > # > -# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -17,4 +17,5 @@ > RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.inf > RedfishPkg/RedfishRestExDxe/RedfishRestExDxe.inf > RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.inf > + RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf > !endif > diff --git a/RedfishPkg/Redfish.fdf.inc b/RedfishPkg/Redfish.fdf.inc > index a64fd119a9..9673246b3f 100644 > --- a/RedfishPkg/Redfish.fdf.inc > +++ b/RedfishPkg/Redfish.fdf.inc > @@ -5,7 +5,7 @@ > # by using "!include RedfishPkg/RedfisLibs.fdf.inc" to specify the modu= le > instances > # to be built in the firmware volume. > # > -# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -15,4 +15,5 @@ > INF RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.inf > INF RedfishPkg/RedfishRestExDxe/RedfishRestExDxe.inf > INF RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.inf > + INF RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf > !endif > diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.= inf > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf > new file mode 100644 > index 0000000000..def91c7531 > --- /dev/null > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf > @@ -0,0 +1,60 @@ > +## @file > +# INF file for the UEFI driver model Redfish Configuration Handler > +# Driver. > +# > +# Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x0001000b > + BASE_NAME =3D RedfishConfigHandlerDriver > + FILE_GUID =3D 6e881000-5749-11e8-9bf0-8cdcd426c973 > + MODULE_TYPE =3D UEFI_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D RedfishConfigHandlerDriverEntryPoint > + UNLOAD_IMAGE =3D RedfishConfigHandlerDriverUnload > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 RISCV64 > +# > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + NetworkPkg/NetworkPkg.dec > + RedfishPkg/RedfishPkg.dec > + > +[Sources] > + RedfishConfigHandlerDriver.h > + RedfishConfigHandlerDriver.c > + RedfishConfigHandlerCommon.h > + RedfishConfigHandlerCommon.c > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + UefiLib > + MemoryAllocationLib > + NetLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + > +[Protocols] > + gEfiRedfishDiscoverProtocolGuid ## CONSUMES > + gEfiRestExServiceBindingProtocolGuid > + gEfiRestExProtocolGuid ## CONSUMES > + gEdkIIRedfishCredentialProtocolGuid ## CONSUMES > + gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMES > + > +[Guids] > + gEfiEventExitBootServicesGuid ## CONSUMES ## Event > + gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event > + > +[Depex] > + TRUE > + > diff --git > a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h > new file mode 100644 > index 0000000000..5e46c42219 > --- /dev/null > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h > @@ -0,0 +1,101 @@ > +/** @file > + Common Header file for Redfish Configuration Handler UEFI driver > + and DXE driver. > + > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef EFI_REDFISH_CONFIG_HANDLER_COMMON_H_ > +#define EFI_REDFISH_CONFIG_HANDLER_COMMON_H_ > + > +#include > + > +// > +// Libraries > +// > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +// > +// Consumed Protocols > +// > +#include > +#include > + > +// > +// Driver Version > +// > +#define REDFISH_CONFIG_VERSION 0x00000001 > + > +/// > +/// Internal structure used by Redfish Config DXE driver. > +/// > +typedef struct { > + UINT32 CallerId; ///< Caller ID used to indicate Redfish Conf= ig Handler > + ///< has been initiated > + EFI_HANDLE Image; ///< Image handle of Redfish Config Driver > + EFI_EVENT Event; ///< Event for the notification of > EFI_REDFISH_CONFIG_HANDLER_PROTOCOL > + REDFISH_CONFIG_SERVICE_INFORMATION RedfishServiceInfo; /// > Redfish Service information discovered > +} REDFISH_CONFIG_DRIVER_DATA; > + > +/** > + Common code of unloading image for both UEFI/DXE Redfish > Configuration drivers. > + > + @param[in] ImageHandle Handle that identifies the image to be > unloaded. > + > + @retval EFI_SUCCESS The image has been unloaded. > + > +**/ > +EFI_STATUS > +RedfishConfigDriverCommonUnload ( > + IN EFI_HANDLE ImageHandle > + ); > + > +/** > + This is the common code for Redfish configuration UEFI and DXE driver > + initialization. > + > + @param[in] ImageHandle The firmware allocated handle for the U= EFI > image. > + @param[in] SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The operation completed successfully. > + @retval Others An unexpected error occurred. > +**/ > +EFI_STATUS > +RedfishConfigCommonInit ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ); > + > +/** > + This is the common code to stop EDK2 Redfish feature driver. > + > + @retval EFI_SUCCESS All EDK2 Redfish feature drivers are > + stopped. > + @retval Others An unexpected error occurred. > +**/ > +EFI_STATUS > +RedfishConfigCommonStop ( > + VOID > +); > + > +/** > + Callback function executed when a Redfish Config Handler Protocol is > installed > + by EDK2 Redfish Feature Drivers. > + > +**/ > +VOID > +RedfishConfigHandlerInitialization ( > + VOID > + ); > + > +#endif > diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.= h > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h > new file mode 100644 > index 0000000000..58202c41e2 > --- /dev/null > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h > @@ -0,0 +1,159 @@ > +/** @file > + Header file of Redfish Configuration Handler UEFI driver. > + > + Copyright (c) 2019, Intel Corporation. All rights reserved.
> + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef EFI_REDFISH_CONFIG_HANDLER_DRIVER_H_ > +#define EFI_REDFISH_CONFIG_HANDLER_DRIVER_H_ > + > +#include "RedfishConfigHandlerCommon.h" > + > +// > +// UEFI Driver Model Protocols > +// > + > +#include > +#include > +#include > + > +// > +// Protocol instances > +// > +extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding; > + > +extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; > +extern EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential; > +extern EFI_EVENT gEndOfDxeEvent; > +extern EFI_EVENT gExitBootServiceEvent; > + > +/** > + Tests to see if this driver supports a given controller. If a child d= evice is > provided, > + it further tests to see if this driver supports creating a handle for= the > specified child device. > + > + This function checks to see if the driver specified by This supports = the > device specified by > + ControllerHandle. Drivers will typically use the device path attached= to > + ControllerHandle and/or the services from the bus I/O abstraction > attached to > + ControllerHandle to determine if the driver supports ControllerHandle= . > This function > + may be called many times during platform initialization. In order to = reduce > boot times, the tests > + performed by this function must be very small, and take as little tim= e as > possible to execute. This > + function must not change the state of any hardware devices, and this > function must be aware that the > + device specified by ControllerHandle may already be managed by the > same driver or a > + different driver. This function must match its calls to AllocatePages= () with > FreePages(), > + AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol= (). > + Because ControllerHandle may have been previously started by the same > driver, if a protocol is > + already in the opened state, then it must not be closed with > CloseProtocol(). This is required > + to guarantee the state of ControllerHandle is not modified by this fu= nction. > + > + @param[in] This A pointer to the > EFI_DRIVER_BINDING_PROTOCOL instance. > + @param[in] ControllerHandle The handle of the controller to test= . This > handle > + must support a protocol interface th= at supplies > + an I/O abstraction to the driver. > + @param[in] RemainingDevicePath A pointer to the remaining portion o= f a > device path. This > + parameter is ignored by device drive= rs, and is optional for > bus > + drivers. For bus drivers, if this pa= rameter is not NULL, then > + the bus driver must determine if the= bus controller > specified > + by ControllerHandle and the child co= ntroller specified > + by RemainingDevicePath are both supp= orted by this > + bus driver. > + > + @retval EFI_SUCCESS The device specified by ControllerHa= ndle and > + RemainingDevicePath is supported by = the driver specified > by This. > + @retval EFI_ALREADY_STARTED The device specified by > ControllerHandle and > + RemainingDevicePath is already being= managed by the > driver > + specified by This. > + @retval EFI_ACCESS_DENIED The device specified by ControllerHa= ndle > and > + RemainingDevicePath is already being= managed by a > different > + driver or an application that requir= es exclusive access. > + Currently not implemented. > + @retval EFI_UNSUPPORTED The device specified by ControllerHa= ndle > and > + RemainingDevicePath is not supported= by the driver > specified by This. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigDriverBindingSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ); > + > +/** > + Starts a device controller or a bus controller. > + > + The Start() function is designed to be invoked from the EFI boot serv= ice > ConnectController(). > + As a result, much of the error checking on the parameters to Start() = has > been moved into this > + common boot service. It is legal to call Start() from other locations= , > + but the following calling restrictions must be followed, or the syste= m > behavior will not be deterministic. > + 1. ControllerHandle must be a valid EFI_HANDLE. > + 2. If RemainingDevicePath is not NULL, then it must be a pointer to a > naturally aligned > + EFI_DEVICE_PATH_PROTOCOL. > + 3. Prior to calling Start(), the Supported() function for the driver = specified > by This must > + have been called with the same calling parameters, and Supported() > must have returned EFI_SUCCESS. > + > + @param[in] This A pointer to the > EFI_DRIVER_BINDING_PROTOCOL instance. > + @param[in] ControllerHandle The handle of the controller to star= t. This > handle > + must support a protocol interface th= at supplies > + an I/O abstraction to the driver. > + @param[in] RemainingDevicePath A pointer to the remaining portion o= f a > device path. This > + parameter is ignored by device drive= rs, and is optional for > bus > + drivers. For a bus driver, if this p= arameter is NULL, then > handles > + for all the children of Controller a= re created by this driver. > + If this parameter is not NULL and th= e first Device Path > Node is > + not the End of Device Path Node, the= n only the handle for > the > + child device specified by the first = Device Path Node of > + RemainingDevicePath is created by th= is driver. > + If the first Device Path Node of Rem= ainingDevicePath is > + the End of Device Path Node, no chil= d handle is created by > this > + driver. > + > + @retval EFI_SUCCESS The driver is started. > + @retval EFI_ALREADY_STARTED The driver was already started. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigDriverBindingStart ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ); > + > +/** > + Stops a device controller or a bus controller. > + > + The Stop() function is designed to be invoked from the EFI boot servi= ce > DisconnectController(). > + As a result, much of the error checking on the parameters to Stop() h= as > been moved > + into this common boot service. It is legal to call Stop() from other = locations, > + but the following calling restrictions must be followed, or the syste= m > behavior will not be deterministic. > + 1. ControllerHandle must be a valid EFI_HANDLE that was used on a > previous call to this > + same driver's Start() function. > + 2. The first NumberOfChildren handles of ChildHandleBuffer must all b= e a > valid > + EFI_HANDLE. In addition, all of these handles must have been creat= ed in > this driver's > + Start() function, and the Start() function must have called OpenPr= otocol() > on > + ControllerHandle with an Attribute of > EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. > + > + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL > instance. > + @param[in] ControllerHandle A handle to the device being stopped. T= he > handle must > + support a bus specific I/O protocol for= the driver > + to use to stop the device. > + @param[in] NumberOfChildren The number of child device handles in > ChildHandleBuffer. > + @param[in] ChildHandleBuffer An array of child handles to be freed. = May > be NULL > + if NumberOfChildren is 0. > + > + @retval EFI_SUCCESS The device was stopped. > + @retval EFI_DEVICE_ERROR The device could not be stopped due to = a > device error. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigDriverBindingStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer OPTIONAL > + ); > +#endif > diff --git > a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c > new file mode 100644 > index 0000000000..ff465d9ff3 > --- /dev/null > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c > @@ -0,0 +1,265 @@ > +/** @file > + The common code of EDKII Redfish Configuration Handler driver. > + > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "RedfishConfigHandlerCommon.h" > + > +REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; // Only one > Redfish service supproted > + // on platform for = the BIOS > + // Redfish configur= ation. > +EFI_EVENT gEndOfDxeEvent =3D NULL; > +EFI_EVENT gExitBootServiceEvent =3D NULL; > +EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential =3D NULL; > + > +/** > + Callback function executed when the EndOfDxe event group is signaled. > + > + @param[in] Event Event whose notification function is being invo= ked. > + @param[out] Context Pointer to the Context buffer. > + > +**/ > +VOID > +EFIAPI > +RedfishConfigOnEndOfDxe ( > + IN EFI_EVENT Event, > + OUT VOID *Context > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D gCredential->StopService (gCredential, > ServiceStopTypeSecureBootDisabled); > + if (EFI_ERROR(Status) && Status !=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_ERROR, "Redfish credential protocol faied to stop > service on EndOfDxe: %r", Status)); > + } > + > + // > + // Close event, so it will not be invoked again. > + // > + gBS->CloseEvent (gEndOfDxeEvent); > + gEndOfDxeEvent =3D NULL; > +} > + > +/** > + Callback function executed when the ExitBootService event group is > signaled. > + > + @param[in] Event Event whose notification function is being invo= ked. > + @param[out] Context Pointer to the Context buffer > + > +**/ > +VOID > +EFIAPI > +RedfishConfigOnExitBootService ( > + IN EFI_EVENT Event, > + OUT VOID *Context > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D gCredential->StopService (gCredential, > ServiceStopTypeExitBootService); > + if (EFI_ERROR(Status) && Status !=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_ERROR, "Redfish credential protocol faied to stop > service on ExitBootService: %r", Status)); > + } > +} > + > +/** > + Unloads an image. > + > + @param[in] ImageHandle Handle that identifies the image to be > unloaded. > + > + @retval EFI_SUCCESS The image has been unloaded. > + > +**/ > +EFI_STATUS > +RedfishConfigDriverCommonUnload ( > + IN EFI_HANDLE ImageHandle > + ) > +{ > + if (gEndOfDxeEvent !=3D NULL) { > + gBS->CloseEvent (gEndOfDxeEvent); > + gEndOfDxeEvent =3D NULL; > + } > + > + if (gExitBootServiceEvent !=3D NULL) { > + gBS->CloseEvent (gExitBootServiceEvent); > + gExitBootServiceEvent =3D NULL; > + } > + > + if (gRedfishConfigData.Event !=3D NULL) { > + gBS->CloseEvent (gRedfishConfigData.Event); > + gRedfishConfigData.Event =3D NULL; > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + This is the common code for Redfish configuration UEFI and DXE driver > + initialization. > + > + @param[in] ImageHandle The firmware allocated handle for the U= EFI > image. > + @param[in] SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The operation completed successfully. > + @retval Others An unexpected error occurred. > +**/ > +EFI_STATUS > +RedfishConfigCommonInit ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + // > + // Locate Redfish Credential Protocol to get credential for > + // accessing to Redfish service. > + // > + Status =3D gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, > NULL, (VOID **) &gCredential); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_INFO, "%a: No Redfish Credential Protocol is installe= d on > system.", __FUNCTION__)); > + return Status; > + } > + // > + // Create EndOfDxe Event. > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + RedfishConfigOnEndOfDxe, > + NULL, > + &gEfiEndOfDxeEventGroupGuid, > + &gEndOfDxeEvent > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Fail to register End Of DXE event.", > __FUNCTION__)); > + return Status; > + } > + // > + // Create Exit Boot Service event. > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + RedfishConfigOnExitBootService, > + NULL, > + &gEfiEventExitBootServicesGuid, > + &gExitBootServiceEvent > + ); > + if (EFI_ERROR (Status)) { > + gBS->CloseEvent (gEndOfDxeEvent); > + gEndOfDxeEvent =3D NULL; > + DEBUG ((DEBUG_ERROR, "%a: Fail to register Exit Boot Service event.= ", > __FUNCTION__)); > + return Status; > + } > + return EFI_SUCCESS; > +} > +/** > + This is the common code to stop EDK2 Redfish feature driver. > + > + @retval EFI_SUCCESS All EDK2 Redfish feature drivers are > + stopped. > + @retval Others An unexpected error occurred. > +**/ > +EFI_STATUS > +RedfishConfigCommonStop ( > + VOID > +) > +{ > + EFI_STATUS Status; > + EFI_HANDLE *HandleBuffer; > + UINTN NumberOfHandles; > + UINTN Index; > + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; > + > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + NULL, > + &NumberOfHandles, > + &HandleBuffer > + ); > + if (EFI_ERROR (Status) && Status !=3D EFI_NOT_FOUND) { > + return Status; > + } > + > + Status =3D EFI_SUCCESS; > + for (Index =3D 0; Index < NumberOfHandles; Index++) { > + Status =3D gBS->HandleProtocol ( > + HandleBuffer[Index], > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + (VOID**) &ConfigHandler > + ); > + ASSERT_EFI_ERROR (Status); > + > + Status =3D ConfigHandler->Stop (ConfigHandler); > + if (EFI_ERROR (Status) && Status !=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_ERROR, "ERROR: Failed to stop Redfish config handle= r > %p.\n", ConfigHandler)); > + break; > + } > + } > + return Status; > +} > +/** > + Callback function executed when a Redfish Config Handler Protocol is > installed > + by EDK2 Redfish Feature Drivers. > + > +**/ > +VOID > +RedfishConfigHandlerInitialization ( > + VOID > + ) > +{ > + EFI_STATUS Status; > + EFI_HANDLE *HandleBuffer; > + UINTN NumberOfHandles; > + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; > + UINTN Index; > + UINT32 Id; > + > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + NULL, > + &NumberOfHandles, > + &HandleBuffer > + ); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + for (Index =3D 0; Index < NumberOfHandles; Index++) { > + Status =3D gBS->HandleProtocol ( > + HandleBuffer [Index], > + &gEfiCallerIdGuid, > + (VOID **) &Id > + ); > + if (!EFI_ERROR (Status)) { > + continue; > + } > + > + Status =3D gBS->HandleProtocol ( > + HandleBuffer [Index], > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + (VOID**) &ConfigHandler > + ); > + ASSERT_EFI_ERROR (Status); > + Status =3D ConfigHandler->Init (ConfigHandler, > &gRedfishConfigData.RedfishServiceInfo); > + if (EFI_ERROR (Status) && Status !=3D EFI_ALREADY_STARTED) { > + DEBUG ((DEBUG_ERROR, "ERROR: Failed to init Redfish config handle= r > %p.\n", ConfigHandler)); > + } > + // > + // Install caller ID to indicate Redfish Configure Handler is initi= alized. > + // > + Status =3D gBS->InstallProtocolInterface ( > + &HandleBuffer [Index], > + &gEfiCallerIdGuid, > + EFI_NATIVE_INTERFACE, > + (VOID *)&gRedfishConfigData.CallerId > + ); > + ASSERT_EFI_ERROR (Status); > + } > +} > diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.= c > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c > new file mode 100644 > index 0000000000..51378dff4f > --- /dev/null > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c > @@ -0,0 +1,587 @@ > +/** @file > + The UEFI driver model driver which is responsible for locating the > + Redfish service through Redfish host interface and executing EDKII > + Redfish feature drivers. > + > + Copyright (c) 2019, Intel Corporation. All rights reserved.
> + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "RedfishConfigHandlerDriver.h" > + > +EFI_EVENT gEfiRedfishDiscoverProtocolEvent =3D NULL; > + > +// > +// Variables for using RFI Redfish Discover Protocol > +// > +VOID *gEfiRedfishDiscoverRegistration; > +EFI_HANDLE gEfiRedfishDiscoverControllerHandle = =3D NULL; > +EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol =3D NULL; > +BOOLEAN gRedfishDiscoverActivated =3D FALSE; > +BOOLEAN gRedfishServiceDiscovered =3D FALSE; > +// > +// Network interfaces discovered by EFI Redfish Discover Protocol. > +// > +UINTN gNumberOfNetworkInterfaces; > +EFI_REDFISH_DISCOVER_NETWORK_INTERFACE > *gNetworkInterfaceInstances =3D NULL; > +EFI_REDFISH_DISCOVERED_TOKEN *gRedfishDiscoveredToken =3D NU= LL; > + > +/// > +/// Driver Binding Protocol instance > +/// > +EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding =3D { > + RedfishConfigDriverBindingSupported, > + RedfishConfigDriverBindingStart, > + RedfishConfigDriverBindingStop, > + REDFISH_CONFIG_VERSION, > + NULL, > + NULL > +}; > + > +/** > + Stop acquiring Redfish service. > + > +**/ > +VOID > +RedfishConfigStopRedfishDiscovery ( > + VOID > +) > +{ > + if (gRedfishDiscoverActivated) { > + // > + // No more EFI Discover Protocol. > + // > + if (gEfiRedfishDiscoverProtocolEvent !=3D NULL) { > + gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent); > + } > + // > + // Stop Redfish service discovery. > + // > + gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService ( > + gEfiRedfishDiscoverProtocol, > + gNetworkInterfaceInstances > + ); > + gEfiRedfishDiscoverControllerHandle =3D NULL; > + gEfiRedfishDiscoverProtocol =3D NULL; > + gRedfishDiscoverActivated =3D FALSE; > + gRedfishServiceDiscovered =3D FALSE; > + } > +} > + > +/** > + Callback function executed when a Redfish Config Handler Protocol is > installed. > + > + @param[in] Event Event whose notification function is being invok= ed. > + @param[in] Context Pointer to the REDFISH_CONFIG_DRIVER_DATA > buffer. > + > +**/ > +VOID > +EFIAPI > +RedfishConfigHandlerInstalledCallback ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + if (!gRedfishDiscoverActivated) { > + // > + // No Redfish service is discovered yet. > + // > + return; > + } > + > + RedfishConfigHandlerInitialization (); > +} > + > +/** > + Tests to see if this driver supports a given controller. If a child d= evice is > provided, > + it further tests to see if this driver supports creating a handle for= the > specified child device. > + > + This function checks to see if the driver specified by This supports = the > device specified by > + ControllerHandle. Drivers will typically use the device path attached= to > + ControllerHandle and/or the services from the bus I/O abstraction > attached to > + ControllerHandle to determine if the driver supports ControllerHandle= . > This function > + may be called many times during platform initialization. In order to = reduce > boot times, the tests > + performed by this function must be very small, and take as little tim= e as > possible to execute. This > + function must not change the state of any hardware devices, and this > function must be aware that the > + device specified by ControllerHandle may already be managed by the > same driver or a > + different driver. This function must match its calls to AllocatePages= () with > FreePages(), > + AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol= (). > + Because ControllerHandle may have been previously started by the same > driver, if a protocol is > + already in the opened state, then it must not be closed with > CloseProtocol(). This is required > + to guarantee the state of ControllerHandle is not modified by this fu= nction. > + > + @param[in] This A pointer to the > EFI_DRIVER_BINDING_PROTOCOL instance. > + @param[in] ControllerHandle The handle of the controller to test= . This > handle > + must support a protocol interface th= at supplies > + an I/O abstraction to the driver. > + @param[in] RemainingDevicePath A pointer to the remaining portion o= f a > device path. This > + parameter is ignored by device drive= rs, and is optional for > bus > + drivers. For bus drivers, if this pa= rameter is not NULL, then > + the bus driver must determine if the= bus controller > specified > + by ControllerHandle and the child co= ntroller specified > + by RemainingDevicePath are both supp= orted by this > + bus driver. > + > + @retval EFI_SUCCESS The device specified by ControllerHa= ndle and > + RemainingDevicePath is supported by = the driver specified > by This. > + @retval EFI_UNSUPPORTED The device specified by ControllerHa= ndle > and > + RemainingDevicePath is not supported= by the driver > specified by This. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigDriverBindingSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ) > +{ > + EFI_REST_EX_PROTOCOL *RestEx; > + EFI_STATUS Status; > + EFI_HANDLE ChildHandle; > + > + ChildHandle =3D NULL; > + > + // > + // Check if REST EX is ready. This just makes sure > + // the network stack is brought up. > + // > + Status =3D NetLibCreateServiceChild ( > + ControllerHandle, > + This->ImageHandle, > + &gEfiRestExServiceBindingProtocolGuid, > + &ChildHandle > + ); > + if (EFI_ERROR (Status)) { > + return EFI_UNSUPPORTED; > + } > + > + // > + // Test if REST EX protocol is ready. > + // > + Status =3D gBS->OpenProtocol( > + ChildHandle, > + &gEfiRestExProtocolGuid, > + (VOID**) &RestEx, > + This->DriverBindingHandle, > + ControllerHandle, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > + if (EFI_ERROR (Status)) { > + Status =3D EFI_UNSUPPORTED; > + } > + NetLibDestroyServiceChild ( > + ControllerHandle, > + This->ImageHandle, > + &gEfiRestExServiceBindingProtocolGuid, > + ChildHandle > + ); > + return Status; > +} > + > +/** > + Starts a device controller or a bus controller. > + > + The Start() function is designed to be invoked from the EFI boot serv= ice > ConnectController(). > + As a result, much of the error checking on the parameters to Start() = has > been moved into this > + common boot service. It is legal to call Start() from other locations= , > + but the following calling restrictions must be followed, or the syste= m > behavior will not be deterministic. > + 1. ControllerHandle must be a valid EFI_HANDLE. > + 2. If RemainingDevicePath is not NULL, then it must be a pointer to a > naturally aligned > + EFI_DEVICE_PATH_PROTOCOL. > + 3. Prior to calling Start(), the Supported() function for the driver = specified > by This must > + have been called with the same calling parameters, and Supported() > must have returned EFI_SUCCESS. > + > + @param[in] This A pointer to the > EFI_DRIVER_BINDING_PROTOCOL instance. > + @param[in] ControllerHandle The handle of the controller to star= t. This > handle > + must support a protocol interface th= at supplies > + an I/O abstraction to the driver. > + @param[in] RemainingDevicePath A pointer to the remaining portion o= f a > device path. This > + parameter is ignored by device drive= rs, and is optional for > bus > + drivers. For a bus driver, if this p= arameter is NULL, then > handles > + for all the children of Controller a= re created by this driver. > + If this parameter is not NULL and th= e first Device Path > Node is > + not the End of Device Path Node, the= n only the handle for > the > + child device specified by the first = Device Path Node of > + RemainingDevicePath is created by th= is driver. > + If the first Device Path Node of Rem= ainingDevicePath is > + the End of Device Path Node, no chil= d handle is created by > this > + driver. > + > + @retval EFI_SUCCESS The driver is started. > + @retval EFI_ALREADY_STARTED The driver was already started. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigDriverBindingStart ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ) > +{ > + VOID *ConfigHandlerRegistration; > + > + if (gRedfishConfigData.Event !=3D NULL) { > + return EFI_ALREADY_STARTED; > + } > + > + gRedfishConfigData.Event =3D EfiCreateProtocolNotifyEvent ( > + &gEdkIIRedfishConfigHandlerProtocolGuid= , > + TPL_CALLBACK, > + RedfishConfigHandlerInstalledCallback, > + (VOID *)&gRedfishConfigData, > + &ConfigHandlerRegistration > + ); > + return EFI_SUCCESS; > +} > + > +/** > + Stops a device controller or a bus controller. > + > + The Stop() function is designed to be invoked from the EFI boot servi= ce > DisconnectController(). > + As a result, much of the error checking on the parameters to Stop() h= as > been moved > + into this common boot service. It is legal to call Stop() from other = locations, > + but the following calling restrictions must be followed, or the syste= m > behavior will not be deterministic. > + 1. ControllerHandle must be a valid EFI_HANDLE that was used on a > previous call to this > + same driver's Start() function. > + 2. The first NumberOfChildren handles of ChildHandleBuffer must all b= e a > valid > + EFI_HANDLE. In addition, all of these handles must have been creat= ed in > this driver's > + Start() function, and the Start() function must have called OpenPr= otocol() > on > + ControllerHandle with an Attribute of > EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. > + > + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL > instance. > + @param[in] ControllerHandle A handle to the device being stopped. T= he > handle must > + support a bus specific I/O protocol for= the driver > + to use to stop the device. > + @param[in] NumberOfChildren The number of child device handles in > ChildHandleBuffer. > + @param[in] ChildHandleBuffer An array of child handles to be freed. = May > be NULL > + if NumberOfChildren is 0. > + > + @retval EFI_SUCCESS The device was stopped. > + @retval EFI_DEVICE_ERROR The device could not be stopped due to = a > device error. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigDriverBindingStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + > + if (ControllerHandle =3D=3D gEfiRedfishDiscoverControllerHandle) { > + RedfishConfigStopRedfishDiscovery (); > + } > + gBS->CloseProtocol ( > + ControllerHandle, > + &gEfiRedfishDiscoverProtocolGuid, > + gRedfishConfigData.Image, > + gRedfishConfigData.Image > + ); > + > + Status =3D RedfishConfigCommonStop (); > + if (EFI_ERROR (Status)) { > + return EFI_DEVICE_ERROR; > + } > + > + if (gRedfishConfigData.Event !=3D NULL) { > + gBS->CloseEvent (gRedfishConfigData.Event); > + gRedfishConfigData.Event =3D NULL; > + } > + return EFI_SUCCESS; > +} > + > +/** > + Callback function when Redfish service is discovered. > + > + @param[in] Event Event whose notification function is being invo= ked. > + @param[out] Context Pointer to the Context buffer > + > +**/ > +VOID > +EFIAPI > +RedfishServiceDiscoveredCallback ( > + IN EFI_EVENT Event, > + OUT VOID *Context > + ) > +{ > + EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken; > + EFI_REDFISH_DISCOVERED_INSTANCE *RedfishInstance; > + > + if (gRedfishServiceDiscovered) { > + // > + // Only support one Redfish service on platform. > + // > + return; > + } > + > + RedfishDiscoveredToken =3D (EFI_REDFISH_DISCOVERED_TOKEN *)Context; > + RedfishInstance =3D RedfishDiscoveredToken- > >DiscoverList.RedfishInstances; > + // > + // Only pick up the first found Redfish service. > + // > + if (RedfishInstance->Status =3D=3D EFI_SUCCESS) { > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = =3D > RedfishInstance->Information.RedfishRestExHandle; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion = =3D > RedfishInstance->Information.RedfishVersion; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = =3D > RedfishInstance->Information.Location; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = =3D > RedfishInstance->Information.Uuid; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs = =3D > RedfishInstance->Information.Os; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion = =3D > RedfishInstance->Information.OsVersion; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct = =3D > RedfishInstance->Information.Product; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer = =3D > RedfishInstance->Information.ProductVer; > + gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = =3D > RedfishInstance->Information.UseHttps; > + gRedfishServiceDiscovered =3D TRUE; > + } > + > + // > + // Invoke RedfishConfigHandlerInstalledCallback to execute > + // the initialization of Redfish Configure Handler instance. > + // > + RedfishConfigHandlerInstalledCallback (gRedfishConfigData.Event, > &gRedfishConfigData); > +} > + > +/** > + Callback function executed when the EFI_REDFISH_DISCOVER_PROTOCOL > + protocol interface is installed. > + > + @param[in] Event Event whose notification function is being invo= ked. > + @param[out] Context Pointer to the Context buffer > + > +**/ > +VOID > +EFIAPI > +RedfishDiscoverProtocolInstalled ( > + IN EFI_EVENT Event, > + OUT VOID *Context > + ) > +{ > + EFI_STATUS Status; > + UINTN BufferSize; > + EFI_HANDLE HandleBuffer; > + UINTN NetworkInterfaceIndex; > + EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface; > + EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; > + > + DEBUG((DEBUG_INFO, "%a: New network interface is installed on system > by EFI Redfish discover driver.\n", __FUNCTION__)); > + > + BufferSize =3D sizeof (EFI_HANDLE); > + Status =3D gBS->LocateHandle ( > + ByRegisterNotify, > + NULL, > + gEfiRedfishDiscoverRegistration, > + &BufferSize, > + &HandleBuffer > + ); > + if (EFI_ERROR (Status)) { > + DEBUG((DEBUG_ERROR, "%a: Can't locate handle with > EFI_REDFISH_DISCOVER_PROTOCOL installed.\n", __FUNCTION__)); > + } > + gRedfishDiscoverActivated =3D TRUE; > + if (gEfiRedfishDiscoverProtocol =3D=3D NULL) { > + gEfiRedfishDiscoverControllerHandle =3D HandleBuffer; > + // > + // First time to open EFI_REDFISH_DISCOVER_PROTOCOL. > + // > + Status =3D gBS->OpenProtocol( > + gEfiRedfishDiscoverControllerHandle, > + &gEfiRedfishDiscoverProtocolGuid, > + (VOID **)&gEfiRedfishDiscoverProtocol, > + gRedfishConfigData.Image, > + gRedfishConfigData.Image, > + EFI_OPEN_PROTOCOL_BY_DRIVER > + ); > + if (EFI_ERROR (Status)) { > + gEfiRedfishDiscoverProtocol =3D NULL; > + gRedfishDiscoverActivated =3D FALSE; > + DEBUG((DEBUG_ERROR, "%a: Can't locate > EFI_REDFISH_DISCOVER_PROTOCOL.\n", __FUNCTION__)); > + return; > + } > + } > + // > + // Check the new found network interface. > + // > + if (gNetworkInterfaceInstances !=3D NULL) { > + FreePool (gNetworkInterfaceInstances); > + } > + Status =3D gEfiRedfishDiscoverProtocol->GetNetworkInterfaceList( > + gEfiRedfishDiscoverProtocol, > + gRedfishConfigData.Image, > + &gNumberOfNetworkInterfaces, > + &gNetworkInterfaceInstances > + ); > + if (EFI_ERROR (Status) || gNumberOfNetworkInterfaces =3D=3D 0) { > + DEBUG((DEBUG_ERROR, "%a: No network interfaces found on the > handle.\n", __FUNCTION__)); > + return; > + } > + > + gRedfishDiscoveredToken =3D AllocateZeroPool > (gNumberOfNetworkInterfaces * sizeof > (EFI_REDFISH_DISCOVERED_TOKEN)); > + if (gRedfishDiscoveredToken =3D=3D NULL) { > + DEBUG((DEBUG_ERROR, "%a: Not enough memory for > EFI_REDFISH_DISCOVERED_TOKEN.\n", __FUNCTION__)); > + return; > + } > + > + ThisNetworkInterface =3D gNetworkInterfaceInstances; > + ThisRedfishDiscoveredToken =3D gRedfishDiscoveredToken; > + // > + // Loop to discover Redfish service on each network interface. > + // > + for (NetworkInterfaceIndex =3D 0; NetworkInterfaceIndex < > gNumberOfNetworkInterfaces; NetworkInterfaceIndex ++) { > + // > + // Initial this Redfish Discovered Token > + // > + Status =3D gBS->CreateEvent ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + RedfishServiceDiscoveredCallback, > + (VOID *)ThisRedfishDiscoveredToken, > + &ThisRedfishDiscoveredToken->Event > + ); > + if (EFI_ERROR (Status)) { > + DEBUG((DEBUG_ERROR, "%a: Failed to create event for Redfish > discovered token.\n", __FUNCTION__)); > + goto ErrorReturn; > + } > + ThisRedfishDiscoveredToken->Signature =3D > REDFISH_DISCOVER_TOKEN_SIGNATURE; > + ThisRedfishDiscoveredToken->DiscoverList.NumberOfServiceFound =3D 0= ; > + ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances =3D NULL; > + // > + // Acquire for Redfish service which is reported by > + // Redfish Host Interface. > + // > + Status =3D gEfiRedfishDiscoverProtocol->AcquireRedfishService( > + gEfiRedfishDiscoverProtoco= l, > + gRedfishConfigData.Image, > + ThisNetworkInterface, > + EFI_REDFISH_DISCOVER_HOST_= INTERFACE, > + ThisRedfishDiscoveredToken > + ); > + ThisNetworkInterface ++; > + ThisRedfishDiscoveredToken ++; > + } > + if (EFI_ERROR (Status)) { > + DEBUG((DEBUG_ERROR, "%a: Acquire Redfish service fail.\n", > __FUNCTION__)); > + goto ErrorReturn; > + } > + return; > + > +ErrorReturn: > + if (gRedfishDiscoveredToken !=3D NULL) { > + FreePool(gRedfishDiscoveredToken); > + } > +} > + > +/** > + Unloads an image. > + > + @param[in] ImageHandle Handle that identifies the image to be > unloaded. > + > + @retval EFI_SUCCESS The image has been unloaded. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigHandlerDriverUnload ( > + IN EFI_HANDLE ImageHandle > + ) > +{ > + EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; > + UINTN NumberOfNetworkInterfacesIndex; > + > + RedfishConfigDriverCommonUnload (ImageHandle); > + > + RedfishConfigStopRedfishDiscovery (); > + if (gRedfishDiscoveredToken !=3D NULL) { > + ThisRedfishDiscoveredToken =3D gRedfishDiscoveredToken; > + for (NumberOfNetworkInterfacesIndex =3D 0; > NumberOfNetworkInterfacesIndex < gNumberOfNetworkInterfaces; > NumberOfNetworkInterfacesIndex ++) { > + if (ThisRedfishDiscoveredToken->Event !=3D NULL) { > + gBS->CloseEvent (ThisRedfishDiscoveredToken->Event); > + } > + FreePool (ThisRedfishDiscoveredToken); > + ThisRedfishDiscoveredToken ++; > + } > + gRedfishDiscoveredToken =3D NULL; > + } > + return EFI_SUCCESS; > +} > + > +/** > + This is the declaration of an EFI image entry point. This entry point= is > + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers inc= luding > + both device drivers and bus drivers. > + > + @param[in] ImageHandle The firmware allocated handle for the U= EFI > image. > + @param[in] SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The operation completed successfully. > + @retval Others An unexpected error occurred. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishConfigHandlerDriverEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + ZeroMem ((VOID *)&gRedfishConfigData, sizeof > (REDFISH_CONFIG_DRIVER_DATA)); > + gRedfishConfigData.Image =3D ImageHandle; > + // > + // Register event for EFI_REDFISH_DISCOVER_PROTOCOL protocol install > + // notification. > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + RedfishDiscoverProtocolInstalled, > + NULL, > + &gEfiRedfishDiscoverProtocolGuid, > + &gEfiRedfishDiscoverProtocolEvent > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Fail to create event for the installation= of > EFI_REDFISH_DISCOVER_PROTOCOL.", __FUNCTION__)); > + return Status; > + } > + Status =3D gBS->RegisterProtocolNotify ( > + &gEfiRedfishDiscoverProtocolGuid, > + gEfiRedfishDiscoverProtocolEvent, > + &gEfiRedfishDiscoverRegistration > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Fail to register event for the installati= on of > EFI_REDFISH_DISCOVER_PROTOCOL.", __FUNCTION__)); > + return Status; > + } > + > + Status =3D RedfishConfigCommonInit (ImageHandle, SystemTable); > + if (EFI_ERROR (Status)) { > + gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent); > + gEfiRedfishDiscoverProtocolEvent =3D NULL; > + return Status; > + } > + > + // > + // Install UEFI Driver Model protocol(s). > + // > + Status =3D EfiLibInstallDriverBinding ( > + ImageHandle, > + SystemTable, > + &gRedfishConfigDriverBinding, > + ImageHandle > + ); > + if (EFI_ERROR (Status)) { > + gBS->CloseEvent (gEndOfDxeEvent); > + gEndOfDxeEvent =3D NULL; > + gBS->CloseEvent (gExitBootServiceEvent); > + gExitBootServiceEvent =3D NULL; > + gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent); > + gEfiRedfishDiscoverProtocolEvent =3D NULL; > + DEBUG ((DEBUG_ERROR, "%a: Fail to install EFI Binding Protocol of E= FI > Redfish Config driver.", __FUNCTION__)); > + return Status; > + } > + return Status; > +} > + > -- > 2.17.1 >=20 >=20 >=20 >=20 >=20