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.28488.1618208809668590506 for ; Sun, 11 Apr 2021 23:26:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=hakOXbm1; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0736f389ed=nickle.wang@hpe.com) Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13C6QnEZ030839 for ; Mon, 12 Apr 2021 06:26:49 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=lcFrBWoU40T37xnCrLg+O4Oa9M51qE6eacAfu0Xu7rU=; b=hakOXbm1RlhJc20rvlI3rcwS9CF7GbJNvxiEEC+ehWuU+bx/uD1e/CUh7XUbaAqjDiaX cHW0FSh+p9Y4Don3tPBNLUi488pH1Co5Csxv1+N7dtl7S2fgwHAQPV1H1Us6KBzFMIMw GeuQW/Q175kkxuQslE+m1nEnO4fKWOaNHczuHylP3Co2O1ofXKC2lc9dyOLDvUKOxPa7 0JpRktce6hEERk52FHtvXrPJLSqhHEzkPCIyCWKC1x/FVjB3LbDS96Wk2+wd0Z3CBtep n25heuEkhAlatfBZwbP44PyBKlsLER1dtzRtIxjHGmCU6LsWStEO1hBhDIhWCku773TF EQ== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 37unbkx9nv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 12 Apr 2021 06:26:48 +0000 Received: from G4W9121.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.210.21.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id 3BBEE65 for ; Mon, 12 Apr 2021 06:26:48 +0000 (UTC) Received: from G2W6310.americas.hpqcorp.net (2002:10c5:4034::10c5:4034) by G4W9121.americas.hpqcorp.net (2002:10d2:1510::10d2:1510) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 06:26:48 +0000 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (15.241.52.11) by G2W6310.americas.hpqcorp.net (16.197.64.52) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 06:26:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HI+5CdzZoeHQ7GaEHRUWgDMYGIJgAeQXZUCvIVL5YtYMmXMO0H6lfBQ3sUIGVao3k9p1nYWgu2d7aliYeX1ScCySEYMds3ujYxXL/O8GvZaK8GtBHb5pzHtdx38nP9OCLkJqN9pGfzfpjSr8v7jmgngyn2osqMFflDchikjCvJXf7jbJ5ZCgQsV9rS7duOE10rTUB3DESx43tbwH5ZTZ3Z+UuH9eaUrS58tKOlQep9QlA76WGTw+jTVyxB1Nn4YijUtEFktdD9dSZBgfLmuVkJXvhuujVzm14dpklbF7CDyqUlI2Vk1T0yJ9YzWC3z6DMXZooFTksQJDgxpb1WAeTg== 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=Z/D6WyPBHOAtKXYPEb6oKZC+r9pitl2qsef5ffn0jLk=; b=iT3hxFXVzv7074F+o4yNUZ6VqS0AV+U9g7rk5fnwpDbCo+lmASJgFL0jD1/KMdWu2zaUx6s63uHx0aAjh3yln01ypS5WtVlFuywNL489h9AxE/lg6DFnWFHJSLdqX2d7YJEYoGjuN02iwBKfhCGd+avAHnwP05nQlm39H8AsmNA/WHH3fpwMiA+8mpnu11ex3ZXGgfhtngtkYD6ZUPliCUHg1X2bfOvJdWdKPHnwsl91ozkc1+m/Kk98i5o4wxBpTXZ5VtouCbhowY45qHSZMPj7pYPeT2HiujFi6mJ34dU3Wr6WRXu26RdDBmX6bF1LLqKVn2+sbMivQzrSdpS0cg== 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 DF4PR8401MB1291.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Mon, 12 Apr 2021 06:26:44 +0000 Received: from DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM ([fe80::455b:8cf4:9ae8:32fe]) by DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM ([fe80::455b:8cf4:9ae8:32fe%10]) with mapi id 15.20.4020.022; Mon, 12 Apr 2021 06:26:44 +0000 From: "Nickle Wang" To: "Chang, Abner (HPS SW/FW Technologist)" , "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: AQHXIgvKOUfbsvfyd0GHb6PBQ2PlHqqwWiIAgAAH9gCAACNsEA== Date: Mon, 12 Apr 2021 06:26:44 +0000 Message-ID: References: <20210326055520.23823-1-abner.chang@hpe.com> In-Reply-To: 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: [118.161.8.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9198071d-dcdd-4408-0ea7-08d8fd7bf177 x-ms-traffictypediagnostic: DF4PR8401MB1291: 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: nY6+Hew748AT5hVNLeUk2lra4sPg9SZ11FFf39Ox6MJBxRM35nfNKe4JuR2EzVBppTRwcIMOsYMnztt+NPSTLsdrSpH2L/uLOU/KNjqxARELSkNyweeYuxZXSQsIdRAbDP20Jdt9rMcpPO06/15HaQSdhVvHZbUtRXKz1zktI+FMd6Eq+OyIEhvPVuFEn2kv2tDfLNlWGVWfL37GxaMeXbEn/8Dx3wxgR+50i+lEQx3/8oes+Dzkdgh8rgKxg+NnUSAjOhG6wwkjcTKbROrGoj7fsWcNq25JcqCRCNfm70QELZySV4Jtp1ia++bcfhMxLXiJZ6rH0m+Slz5a7qa1yHtRy1qyAbo4KEZcuK507ecq+me8ykmQF/L5x7lKrk9kjbHr/2YjFMgmd1sZKpy/L2d8khiNhlFva5jwloiNH2iQg9jrZKonAllc2kOF9LDC7cyZ8DRXSSaMhHTY9a2/OJ7xTR+D9LXXQZcvAafTecq21d6wWU43MOCh/j3jXnbmvihXYcvXd8lNrkLKpCoBJC/f1aIfEwrX1W5h3eOskPIENATqts9jinqddCBr/wBONI9UJI+vIw6qEn1Qqoq9Mifv/LO08hM3QzIBPty68TLEHqniU+qulJoTjxpUh6YDBrXbfm6drEfFapv01Yx7SVBJQThd0/LRhld3wmHfQnY0jOVlQiwukwal/oT3zYGb 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:(376002)(396003)(39860400002)(346002)(136003)(366004)(64756008)(186003)(966005)(30864003)(26005)(9686003)(66446008)(66556008)(83380400001)(76116006)(7696005)(478600001)(66946007)(38100700002)(19627235002)(316002)(66476007)(2906002)(8936002)(55016002)(71200400001)(6506007)(33656002)(86362001)(110136005)(5660300002)(8676002)(53546011)(55236004)(52536014)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?EXIIXCRw48hITLHegfN2wb2f9oNhPjqrxs1ilRtxZcKhaDbyjmVnV9sN9mmD?= =?us-ascii?Q?rx9h8Gl79laa/JEsE8yQEjsOt/i2C+97TyUJRIEEEcbzN1mZhmEh9x2dq65Q?= =?us-ascii?Q?5XQFfj3DoksIvRLQWYfxbctnCbstv171368HYOegGeL3FTGM6P343i7OimOW?= =?us-ascii?Q?6Kb2eqqOb710cj9q+B8+p7PJciBTdJxJ8ELZuQJKpM95mEPbqu6rJ532KsDa?= =?us-ascii?Q?DkWW2ejpYzYuQp9wZinAJQVzQHVXDvY/DSS3/p1FtxOfNw4hcM1GutBd95/J?= =?us-ascii?Q?HaqrQt/N5PWuw5EqNUFkhPRoucYf5QrySBGsRYPoVGD/mKBFHwzNMvuyNErX?= =?us-ascii?Q?hNCQslg3IoHUJTt3HDA0M/ldpAoy1/0bbywnd3j5mMbh3mCUU1y0i39vIntp?= =?us-ascii?Q?meTGGYX8BbMti8CqbSGgyGfrwyq0TmGIXK8LhXv+reM7F2NSHgMhHEaltHsu?= =?us-ascii?Q?/vVAd9h+wrc7T26CWtbKzLHzuOirJGfdke0HhNSu520zp0bJ7Cod5eGAT3mB?= =?us-ascii?Q?0yhSS3p7fudS/de+eqj83zy8x2ucRtJDnUxZi7sljA7D2kRo70xOeVr1aLIz?= =?us-ascii?Q?FWCHWHZaW5FvH2rHpf0n9KzhLZkr7jeecdeON4T0VGQimi/1jO3IwjPjsbb3?= =?us-ascii?Q?teP5e9RVEuuAsPfUSWR5Pf/f6YAhHJFUeMOCkNFXl1xw+wH43HxvUABdRHx8?= =?us-ascii?Q?RQkcfvA1fvlAw1TJznL/5srnWO48Zd1oSfNAKGBZJgbKENoewhtL2xv7G9Ax?= =?us-ascii?Q?jkoeauaHmbEZNu02FKiSbU79tofNJ6mGS1esoi0716RoJPSkeg6r5YBiH0id?= =?us-ascii?Q?36fFNkxyy1cj0sbdiT5D0jD0vaLYQ8hUB47+/baFZ2TmyjOBD7FjrlHcwc/s?= =?us-ascii?Q?wqR9LKUWpaRhqdNlG3uso6VedM5Ao4KtV31NaB4EubO/ba3DVsy1XX4875Ii?= =?us-ascii?Q?iGPfCWvr/gIFy54qJU6RgSn5O6ufvw9axGY+QCWk2Xz0l04o3S0YdxZ7ocE1?= =?us-ascii?Q?gjext49mA6riAOVANtXbx91le9l7EvlbVNuzeieBpu5KZyD/j+VCOXxzDZ7O?= =?us-ascii?Q?zuVymKpydCW9wr8lBljBJACgs5s2nLNNKTa04UlS5pgquEoO15ambrevgaz2?= =?us-ascii?Q?Ahp1+gKQk3WKnaS5+vP0eInjq8qCX1mnbn/nSE2Rcq6w5B9uZk4VQVB9WqSF?= =?us-ascii?Q?5gN1kMByTTB+vc2fb5656ZO0MqYwILhyQxZ3HbevHSeh1nNqTRjOT2JAaGIQ?= =?us-ascii?Q?nNqVKPatxI4rZ9z3ZbhCHjpCdE03wGwlTZ/mguXTOy3Ha009zSYzDLCOkZXz?= =?us-ascii?Q?n/NxOQuPpCoGDQUGVKNgWOZT?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 9198071d-dcdd-4408-0ea7-08d8fd7bf177 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2021 06:26:44.4477 (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: hyTQBpJA09GF6c5HzL3PcuhufHHYs2UhkUEPZHTwOB1A9zcv/O3TMBSjgawkN0h0Ju6xPXbU52yhnIJy0gQhpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1291 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: WRpXSUR1esgarAscjkZjL6KhevszwIKS X-Proofpoint-GUID: WRpXSUR1esgarAscjkZjL6KhevszwIKS 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-12,2021-04-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 adultscore=0 suspectscore=0 clxscore=1015 phishscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120042 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nickle Wang Got it. Thanks Abner. Nickle -----Original Message----- From: Chang, Abner (HPS SW/FW Technologist) =20 Sent: Monday, April 12, 2021 12:20 PM To: Wang, Nickle (HPS SW) ; devel@edk2.groups.io Subject: RE: [edk2-devel] [PATCH] RedfishPkg/RedfishConfigHandler: EDKII R= edfishConfigHandler Protocol Ah, yes. I will revise the copyrights in Redfish.fdf.inc and RedfishCompon= ents.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