From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.50]) by mx.groups.io with SMTP id smtpd.web11.18164.1683727650930236596 for ; Wed, 10 May 2023 07:07:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=GXn1m2oa; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.94.50, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aw292F8Q4knjZa00DAeFM1A1mn+grFnF/HuSEVxBXsm7JBga5HBKDjti+aR0Qcm3FgucA+k65Fy9bonNNeF5TAILThfk0CJMbwsg9Oy6VLSFdj7yGpPd325/si5TIUu2b+2JX0MJYs9bo1WITBt+myuMBJGsCqr8/vSjNFnBKqPY7HElPqtNWreP56cvYJxB2ckg1CGIqYK3EE3PJ4Arn3BZ25c3S9OqcWdFAH93G2KftIkIO6IJodhdHZ0TUuz/njjuWiXR+Od2LQKinHGm4ll7MZmn2BwCk+ZIHx+XXBKUaZNMianeXTO3nwCGBYl3tbZCf4m5ZpaVRc5IGfHClQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vj8/oeLRB5RmW27ZjDPn43iaoSkiprSAiaCk/0B8tZo=; b=cjeDFnqH77YTLLlRT0u6rdItlHc+ILdBha/iNwW1BnoVnZ1MhD6Z/UrsjAVvsJbDb81IGQlAiOrDzhky6oQqFycUIeBy7teeOK3kShfD+I4m8ZA2VfyX6R2bp/H6xJfoc8mXS3iSnCXfPWxIumycTlAo5XGbqPxuw1yb86tUnIeTbR01nC8F0ZGIOogYzY0SC9tqvO9KJznQXiHQd0TIpN2KS6Oj6p7EECe7Nl8leK5MixxAHvFDdAX1xYYlbIW+/wYJdU68cenbBvTANuwTHCx5P3X2N1/FKBEWMN6pznU814gkGHs/Bnae9bknIAmxPJmnxF2k0QydunmV57GXCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vj8/oeLRB5RmW27ZjDPn43iaoSkiprSAiaCk/0B8tZo=; b=GXn1m2oacB9Cc7lM8IF7NcJVDDpxEdJUmvNrR5D4CeG9RrgPf3nEIbQ35t3xEqBjbHCweoZ/czIWw3C4C8emmBDsimIU3Soi1lFuv3DVr/ZOswFd8PnfWg5BH5+me5ZaPL0Vd7b7r/WanagYz61c2JUfoulvrWrNvXiBUHbGZyU= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by PH7PR12MB6857.namprd12.prod.outlook.com (2603:10b6:510:1af::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Wed, 10 May 2023 14:07:21 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3%3]) with mapi id 15.20.6363.032; Wed, 10 May 2023 14:07:21 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-redfish-client][PATCH 5/5] RedfishClientPkg: Introduce Bios feature driver Thread-Topic: [edk2-redfish-client][PATCH 5/5] RedfishClientPkg: Introduce Bios feature driver Thread-Index: AQHZg0AO59KUOAAJbEKA967aQykyUq9TivNA Date: Wed, 10 May 2023 14:07:21 +0000 Message-ID: References: <20230510130453.9586-1-nicklew@nvidia.com> In-Reply-To: <20230510130453.9586-1-nicklew@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-05-10T14:07:17Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=8c523980-5ccb-4c8d-a934-6fc2570799f3; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|PH7PR12MB6857:EE_ x-ms-office365-filtering-correlation-id: 026e3d4c-f591-4859-6db6-08db515fdf64 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: D3vTiSN+SLw/JmnSXL/P/W7r8bv9yjktIVYrcAE8P1tEAKl4BGs7/mw4hMvnMTqDtnikraiJ3ttVNGwM9NKW+6lsTSRPH6BcsAC2n9jTKvwE5+sQkieJhW1j8TO26aOBDS8Tx2LX9h0jPRP3PDeSLz6fBAB1mLUtSyTTqHffNmKDIDMX+W6KX1ppsQcwCxEcMh4/TmDAr9y3Mdxn3ETGlmQsMrgY/seaZ1ol4rX6nSBOH4BGye8glZGNrvACyqCfKbexoRkffzAYfkhS7sk707ZvkH73NQaJTezqVvqcEkwZwAK5HRpPbSSUGBGwNA1xR24jkebAdpIRlHF5oOt4vZtNFNZ1dYD7drMwQnwns61yezlvL9G3WFt4T0RfqfcFB332haKdKHgJWumkW6ILUB3DpkIShqKiXeRF6FUywLY72UyvWJ6aJbbXERxtEn3+rfSxadYR9ZDI2wvR1KMioHTGP1MzezP2WU4SP34IPoY9UrYKicj8w+7LV4ADOvyJqxW9ituIkyKbWUiFpbX4O5F1KpEsa3DJEfR2fgjwTeu2eiVqim6+90c6OoNX4uvk9EzC0xmEh/Yy3tdIiDNp8vuZTvGqpVKaADy39ZPkVBtXbLCCkb/UeWXG0xVTVahq1bBS6+xq2QgIzADr/2zGaw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(366004)(376002)(39860400002)(136003)(451199021)(83380400001)(6506007)(9686003)(33656002)(26005)(41300700001)(86362001)(7696005)(38100700002)(55016003)(71200400001)(186003)(53546011)(122000001)(66476007)(66556008)(66946007)(66446008)(64756008)(76116006)(110136005)(38070700005)(478600001)(4326008)(52536014)(8936002)(316002)(19627235002)(2906002)(8676002)(30864003)(5660300002)(559001)(579004)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Jng62pM52TIiP6NeVXF1Xvbxpkn7pzJg8ICM4pljqevHOZC4ug+LGcDb3JRO?= =?us-ascii?Q?5fRMo8VL/VW6CwhW/s/SqnkLSrrz2rH2ABDrGMOvUW4BClt/pPMxrpJYQPxM?= =?us-ascii?Q?3bgsKP3EeABpiUIjUTFicE/N41J5LMdQEWmQLzGcaqARqqb6BBu3hqXi5Omw?= =?us-ascii?Q?aIk/q2Fhz3Y7FPimIBefFp6LdgSu9Vqo9zeeQOZ/MNAGYblZQZ5ZdOG2nXC4?= =?us-ascii?Q?a7i6gtAVuLC7jfeI/DFkGl7PNYVztBCDhbGB+2U6fed+KeZWT+wMGfQDL1Td?= =?us-ascii?Q?yaWgHyGnTSV9ABl8NiNdtAs26QZa2OErfDadyQcQftsvC5nTp+H7QdTTS+mX?= =?us-ascii?Q?XrfWPnkf913sh9MM7s/BCGkOfyS7RZmPdf9I2xvd7LknRH0GatKbvfWneqbA?= =?us-ascii?Q?Tx3yeIraBIsetBPq/cri66SGSIrKzkYsdHzvNz6Gj2P6OqP8bjsxSaI4xeP+?= =?us-ascii?Q?rMjar+pCKWVvZs1PVzIi0mFJQfkwIsXvOkcF2hrEto8SEtsuDdWPnAOGMaZe?= =?us-ascii?Q?c7BE3XFkcTO1wAAFmijPQWpze2Yl0kRVgVQ9Qa11cbTjZW5N8Q/b73lSGird?= =?us-ascii?Q?O3Q70Ykb/BGUwyccfXjBZjohDBpZzmM0Q6M+W9LgP4VtDPPeENrUvsCcGXxN?= =?us-ascii?Q?3xz/pKGPkJ6P7Ky45X4OztSUBA1ArsdhUwlC3rcB8yELMTl5wQBamQkkovqr?= =?us-ascii?Q?ZbP5Dw4Nm/hEchgdIYeSvObUrImvYEPUgf0W9MKWbLki9rGFeHwmxsdkOE/k?= =?us-ascii?Q?a/90JWd3lxwIhm2WQMMjDOBDDrkLVEieIfwaPCSS1H2WI9v95IFd8m4eDWw2?= =?us-ascii?Q?4VW/2dxw0KGpyeNJpxy5JVdHm4UQJ6wdiDxlNMTcrFw0quZ+LQckMfUFb4jo?= =?us-ascii?Q?BX1HW+5aLLoyff6RvIiEXUhU8Eut5CZrxT9IldwXaC3gfjNE1+nlcQnYlBzL?= =?us-ascii?Q?tfPI2O59gfsDt7gc9hbN0Btc+04A2Nnq16ebz0s3WJVpr+V0t81a6krbzIWm?= =?us-ascii?Q?UvEN0w+I5Yc1du47GMmjyL1nYDD2zw/4C//OEhP/35ihrXg93YKm+a8NSsrS?= =?us-ascii?Q?7qmGqh7729noa8/jt8GAQE4H0qtongmc2xYuYvu0O+U+PNDqq7HPhYhc2plz?= =?us-ascii?Q?W51iCOVbbp5pN/+kb54TbZ0/3DuadQ241NIhDs3WC6hf+yPOe/HxTR92Gzwv?= =?us-ascii?Q?enzJ04vWKggHbD/kE4DpbF9z+fdBDAWRo8ThrZFYAWLNUk9LPdkS3DqAGQaF?= =?us-ascii?Q?AnpQSiNHXjQ0+z+Et9C31+sAFyxqRF6ROyL4FnQgze05bIgbbJ0JafXrrCtX?= =?us-ascii?Q?71fCsF1snHlWUkSTYfbuPYm4wlntkC1pggTf6pOzgUGEZEuPR8pkjW5xLJSX?= =?us-ascii?Q?izvet1TfxL/t/WkMaz7PGMolH6yDNi/rhwGzjsIb7U+5/J12p3kRBuBj5C7h?= =?us-ascii?Q?ABwMewYpXD5XBIEdRqRv3ssz9Bkmp3EFpZhnYhJBBJ4GHkdjROK7idGDeAW+?= =?us-ascii?Q?jXSjBMZcEnl6NqIeXKyTASLc2bGNQHM3Q3aOB+TYt75OMPnFIxzGJPEFYohI?= =?us-ascii?Q?22ZETvbqTwxpat550Gk=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 026e3d4c-f591-4859-6db6-08db515fdf64 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2023 14:07:21.4431 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GqwqYcYVwoUpJFqDcB2Pm5xAQQFXlzSpqHdYUo0JIOb977BgTWRV/WGM7zEgs9fk0WxLQVXS6G0IgarM6b5w2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6857 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, May 10, 2023 9:05 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > > Subject: [edk2-redfish-client][PATCH 5/5] RedfishClientPkg: Introduce Bio= s > feature driver >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Introduce new feature driver to support Bios version 1.0.9 schema. > Update corresponding FDF and DSC file to enable this feature driver. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > --- > .../RedfishClientComponents.dsc.inc | 2 + > RedfishClientPkg/RedfishClientLibs.dsc.inc | 6 +- > .../Features/Bios/v1_0_9/Dxe/BiosDxe.inf | 52 ++ > .../Features/Bios/v1_0_9/Common/BiosCommon.h | 30 + > .../Features/Bios/v1_0_9/Common/BiosCommon.c | 745 > +++++++++++++++++ > .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 788 ++++++++++++++++++ > RedfishClientPkg/RedfishClient.fdf.inc | 2 + > 7 files changed, 1624 insertions(+), 1 deletion(-) > create mode 100644 > RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf > create mode 100644 > RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h > create mode 100644 > RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > create mode 100644 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c >=20 > diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc > b/RedfishClientPkg/RedfishClientComponents.dsc.inc > index 084796e4..e83f4bc9 100644 > --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc > +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc > @@ -27,6 +27,7 @@ >=20 > RedfishResourceIdentifyLib|RedfishClientPkg/Library/RedfishResourceIdenti > fyLibComuterSystem/v1_5_0/RedfishResourceIdentifyLibComuterSystem.in > f > } >=20 > RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.inf > + RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf >=20 > !include RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc >=20 > @@ -37,3 +38,4 @@ >=20 > RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_ > Dxe.inf >=20 > RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSys > tem_V1_5_0_Dxe.inf >=20 > RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS > ystemCollection_Dxe.inf > + RedfishClientPkg/Converter/Bios/v1_0_9/RedfishBios_V1_0_9_Dxe.inf > diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc > b/RedfishClientPkg/RedfishClientLibs.dsc.inc > index 05ad09ef..fe0c4b08 100644 > --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc > +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc > @@ -15,12 +15,16 @@ > !endif >=20 > # > - # Below two modules should be pulled in by build tool. > + # Below modules should be pulled in by build tool. > # >=20 > MemoryV1_7_1Lib|RedfishClientPkg/ConverterLib/edk2library/Memory/v1 > _7_1/Lib.inf >=20 > MemoryCollectionLib|RedfishClientPkg/ConverterLib/edk2library/MemoryC > ollection/Lib.inf >=20 > ComputerSystemV1_5_0Lib|RedfishClientPkg/ConverterLib/edk2library/Co > mputerSystem/v1_5_0/Lib.inf >=20 > ComputerSystemCollectionLib|RedfishClientPkg/ConverterLib/edk2library/C > omputerSystemCollection/Lib.inf > + > BiosV1_0_9Lib|RedfishClientPkg/ConverterLib/edk2library/Bios/v1_0_9/Lib.i > nf > + # > + # Above modules should be pulled in by build tool. > + # >=20 > NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf > HttpLib|NetworkPkg/Library/DxeHttpLib/DxeHttpLib.inf > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf > new file mode 100644 > index 00000000..8c01a3b8 > --- /dev/null > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf > @@ -0,0 +1,52 @@ > +## @file > +# > +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development > LP
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D BiosDxe > + FILE_GUID =3D d6c99bb0-ca18-45aa-8be6-a60c3ba5ecd8 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D RedfishResourceEntryPoint > + UNLOAD_IMAGE =3D RedfishResourceUnload > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + RedfishPkg/RedfishPkg.dec > + RedfishClientPkg/RedfishClientPkg.dec > + > +[Sources] > + ../Common/BiosCommon.h > + ../Common/BiosCommon.c > + BiosDxe.c > + > +[LibraryClasses] > + BaseMemoryLib > + DebugLib > + EdkIIRedfishResourceConfigLib > + RedfishLib > + RedfishFeatureUtilityLib > + RedfishVersionLib > + RedfishResourceIdentifyLib > + UefiLib > + UefiDriverEntryPoint > + > +[Protocols] > + gEdkIIRedfishConfigHandlerProtocolGuid ## PRODUCED > + gEfiRestJsonStructureProtocolGuid ## CONSUMED > + gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED > + gEdkIIRedfishFeatureProtocolGuid ## CONSUMED > + > +[Pcd] > + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize > + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize > + > +[Depex] > + TRUE > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h > b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h > new file mode 100644 > index 00000000..9a6f9684 > --- /dev/null > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h > @@ -0,0 +1,30 @@ > +/** @file > + > + Redfish feature driver implementation - internal header file > + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef EFI_REDFISH_BIOS_COMMON_H_ > +#define EFI_REDFISH_BIOS_COMMON_H_ > + > +#include > +#include > + > +// > +// Schema information. > +// > +#define REDFISH_MANAGED_URI L"Systems/{}/Bios" > +#define MAX_URI_LENGTH 256 > +#define RESOURCE_SCHEMA "Bios" > +#define RESOURCE_SCHEMA_MAJOR "1" > +#define RESOURCE_SCHEMA_MINOR "0" > +#define RESOURCE_SCHEMA_ERRATA "9" > +#define RESOURCE_SCHEMA_VERSION "v1_0_9" > +#define REDPATH_ARRAY_PATTERN L"/Bios/.*" > +#define REDPATH_ARRAY_PREFIX L"/Bios/" > +#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-Bios.v1_0_9" > +#define REDFISH_SCHEMA_NAME "ComputerSystem" > + > +#endif > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > new file mode 100644 > index 00000000..22074559 > --- /dev/null > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > @@ -0,0 +1,745 @@ > +/** @file > + Redfish feature driver implementation - common functions > + > + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "BiosCommon.h" > + > +CHAR8 BiosEmptyJson[] =3D "{\"@odata.id\": \"\", \"@odata.type\": > \"#Bios.v1_0_9.Bios\", \"Id\": \"\", \"Name\": \"\", \"Attributes\":{}}"; > + > +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =3D > NULL; > + > +/** > + Consume resource from given URI. > + > + @param[in] This Pointer to > REDFISH_RESOURCE_COMMON_PRIVATE instance. > + @param[in] Json The JSON to consume. > + @param[in] HeaderEtag The Etag string returned in HTTP head= er. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishConsumeResourceCommon ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN CHAR8 *Json, > + IN CHAR8 *HeaderEtag OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + EFI_REDFISH_BIOS_V1_0_9 *Bios; > + EFI_REDFISH_BIOS_V1_0_9_CS *BiosCs; > + EFI_STRING ConfigureLang; > + RedfishCS_Type_EmptyProp_CS_Data *EmptyPropCs; > + > + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (Json)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Bios =3D NULL; > + BiosCs =3D NULL; > + ConfigureLang =3D NULL; > + > + Status =3D Private->JsonStructProtocol->ToStructure ( > + Private->JsonStructProtocol, > + NULL, > + Json, > + (EFI_REST_JSON_STRUCTURE_HEADE= R **)&Bios > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", > __FUNCTION__, Status)); > + return Status; > + } > + > + BiosCs =3D Bios->Bios; > + > + // > + // Check ETAG to see if we need to consume it > + // > + if (CheckEtag (Private->Uri, HeaderEtag, BiosCs->odata_etag)) { > + // > + // No change > + // > + DEBUG ((DEBUG_INFO, "%a, ETAG: %s has no change, ignore consume > action\n", __FUNCTION__, Private->Uri)); > + Status =3D EFI_ALREADY_STARTED; > + goto ON_RELEASE; > + } > + > + // > + // Handle ATTRIBUTEREGISTRY > + // > + if (BiosCs->AttributeRegistry !=3D NULL) { > + // > + // Find corresponding configure language for collection resource. > + // > + ConfigureLang =3D GetConfigureLang (BiosCs->odata_id, > "AttributeRegistry"); > + if (ConfigureLang !=3D NULL) { > + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, > RESOURCE_SCHEMA_VERSION, ConfigureLang, BiosCs->AttributeRegistry); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", > __FUNCTION__, ConfigureLang, Status)); > + } > + > + FreePool (ConfigureLang); > + } else { > + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: > %s\n", __FUNCTION__, Private->Uri)); > + } > + } > + > + // > + // Handle ATTRIBUTES > + // > + if (BiosCs->Attributes =3D=3D NULL) { > + BiosCs->Attributes =3D AllocateZeroPool (sizeof > (RedfishBios_V1_0_9_Attributes_CS)); > + ASSERT (BiosCs->Attributes !=3D NULL); > + } > + > + // > + // Handle ATTRIBUTES->EmptyProperty > + // > + if (BiosCs->Attributes !=3D NULL) { > + // > + // Validate empty property. > + // > + if (BiosCs->Attributes->Prop.ForwardLink =3D=3D &BiosCs->Attributes-= >Prop) > { > + goto ON_RELEASE; > + } > + > + EmptyPropCs =3D (RedfishCS_Type_EmptyProp_CS_Data *)BiosCs- > >Attributes->Prop.ForwardLink; > + if (EmptyPropCs->Header.ResourceType =3D=3D RedfishCS_Type_JSON) { > + DEBUG ((DEBUG_ERROR, "%a, Empty property with > RedfishCS_Type_JSON type resource is not supported yet. (%s)\n", > __FUNCTION__, Private->Uri)); > + goto ON_RELEASE; > + } > + > + // > + // Find corresponding configure language for collection resource. > + // > + ConfigureLang =3D GetConfigureLang (BiosCs->odata_id, "Attributes"); > + if (ConfigureLang !=3D NULL) { > + Status =3D ApplyFeatureSettingsVagueType (RESOURCE_SCHEMA, > RESOURCE_SCHEMA_VERSION, ConfigureLang, EmptyPropCs->KeyValuePtr, > EmptyPropCs->NunmOfProperties); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", > __FUNCTION__, ConfigureLang, Status)); > + } > + > + FreePool (ConfigureLang); > + } else { > + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: > %s\n", __FUNCTION__, Private->Uri)); > + } > + } > + > +ON_RELEASE: > + > + // > + // Release resource. > + // > + Private->JsonStructProtocol->DestoryStructure ( > + Private->JsonStructProtocol, > + (EFI_REST_JSON_STRUCTURE_HEADER *)Bios > + ); > + > + return EFI_SUCCESS; > +} > + > +EFI_STATUS > +ProvisioningBiosProperties ( > + IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, > + IN CHAR8 *InputJson, > + IN CHAR8 *ResourceId, OPTIONAL > + IN EFI_STRING ConfigureLang, > + IN BOOLEAN ProvisionMode, > + OUT CHAR8 **ResultJson > + ) > +{ > + EFI_REDFISH_BIOS_V1_0_9 *Bios; > + EFI_REDFISH_BIOS_V1_0_9_CS *BiosCs; > + EFI_STATUS Status; > + BOOLEAN PropertyChanged; > + CHAR8 *AsciiStringValue; > + RedfishCS_EmptyProp_KeyValue *PropertyVagueValues; > + UINT32 VagueValueNumber; > + > + if ((JsonStructProtocol =3D=3D NULL) || (ResultJson =3D=3D NULL) || > IS_EMPTY_STRING (InputJson) || IS_EMPTY_STRING (ConfigureLang)) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s with: %s\n", > __FUNCTION__, ConfigureLang, (ProvisionMode ? L"Provision resource" : > L"Update resource"))); > + > + *ResultJson =3D NULL; > + PropertyChanged =3D FALSE; > + > + Bios =3D NULL; > + Status =3D JsonStructProtocol->ToStructure ( > + JsonStructProtocol, > + NULL, > + InputJson, > + (EFI_REST_JSON_STRUCTURE_HEADER **)&Bio= s > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, ToStructure failure: %r\n", __FUNCTION__, > Status)); > + return Status; > + } > + > + BiosCs =3D Bios->Bios; > + > + // > + // ID > + // > + if ((BiosCs->Id =3D=3D NULL) && !IS_EMPTY_STRING (ResourceId)) { > + BiosCs->Id =3D AllocateCopyPool (AsciiStrSize (ResourceId), Resource= Id); > + } > + > + // > + // Handle ATTRIBUTEREGISTRY > + // > + if (PropertyChecker (BiosCs->AttributeRegistry, ProvisionMode)) { > + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, > RESOURCE_SCHEMA_VERSION, L"AttributeRegistry", ConfigureLang); > + if (AsciiStringValue !=3D NULL) { > + if (ProvisionMode || (AsciiStrCmp (BiosCs->AttributeRegistry, > AsciiStringValue) !=3D 0)) { > + BiosCs->AttributeRegistry =3D AsciiStringValue; > + PropertyChanged =3D TRUE; > + } > + } > + } > + > + // > + // Handle ATTRIBUTES > + // > + if (BiosCs->Attributes !=3D NULL) { > + // > + // Handle ATTRIBUTES > + // > + if (PropertyChecker (BiosCs->Attributes, ProvisionMode)) { > + PropertyVagueValues =3D GetPropertyVagueValue (RESOURCE_SCHEMA, > RESOURCE_SCHEMA_VERSION, L"Attributes", ConfigureLang, > &VagueValueNumber); > + if (PropertyVagueValues !=3D NULL) { > + if (ProvisionMode || !CompareRedfishPropertyVagueValues ( > + ((RedfishCS_Type_EmptyProp_CS_Data *)Bio= sCs- > >Attributes->Prop.ForwardLink)->KeyValuePtr, > + ((RedfishCS_Type_EmptyProp_CS_Data *)Bio= sCs- > >Attributes->Prop.ForwardLink)->NunmOfProperties, > + PropertyVagueValues, > + VagueValueNumber > + )) > + { > + // > + // Use the properties on system to replace the one on Redfish = service. > + // > + ((RedfishCS_Type_EmptyProp_CS_Data *)BiosCs->Attributes- > >Prop.ForwardLink)->KeyValuePtr =3D PropertyVagueValues; > + ((RedfishCS_Type_EmptyProp_CS_Data *)BiosCs->Attributes- > >Prop.ForwardLink)->NunmOfProperties =3D VagueValueNumber; > + PropertyChanged = =3D TRUE; > + } > + } > + } > + } > + > + // > + // Convert C structure back to JSON text. > + // > + Status =3D JsonStructProtocol->ToJson ( > + JsonStructProtocol, > + (EFI_REST_JSON_STRUCTURE_HEADER *)Bios, > + ResultJson > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __FUNCTION__, > Status)); > + return Status; > + } > + > + // > + // Release resource. > + // > + JsonStructProtocol->DestoryStructure ( > + JsonStructProtocol, > + (EFI_REST_JSON_STRUCTURE_HEADER *)Bios > + ); > + > + return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND); > +} > + > +EFI_STATUS > +ProvisioningBiosResource ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN UINTN Index, > + IN EFI_STRING ConfigureLang > + ) > +{ > + CHAR8 *Json; > + EFI_STATUS Status; > + EFI_STRING NewResourceLocation; > + CHAR8 *EtagStr; > + CHAR8 ResourceId[16]; > + > + if (IS_EMPTY_STRING (ConfigureLang) || (Private =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + EtagStr =3D NULL; > + AsciiSPrint (ResourceId, sizeof (ResourceId), "%d", Index); > + > + Status =3D ProvisioningBiosProperties ( > + Private->JsonStructProtocol, > + BiosEmptyJson, > + ResourceId, > + ConfigureLang, > + TRUE, > + &Json > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, provisioning resource for %s failed: %r\n"= , > __FUNCTION__, ConfigureLang, Status)); > + return Status; > + } > + > + Status =3D CreatePayloadToPostResource (Private->RedfishService, Priva= te- > >Payload, Json, &NewResourceLocation, &EtagStr); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, post Bios resource for %s failed: %r\n", > __FUNCTION__, ConfigureLang, Status)); > + goto RELEASE_RESOURCE; > + } > + > + ASSERT (NewResourceLocation !=3D NULL); > + > + // > + // Keep location of new resource. > + // > + if (NewResourceLocation !=3D NULL) { > + RedfisSetRedfishUri (ConfigureLang, NewResourceLocation); > + } > + > + // > + // Handle Etag > + // > + if (EtagStr !=3D NULL) { > + SetEtagWithUri (EtagStr, NewResourceLocation); > + FreePool (EtagStr); > + } > + > +RELEASE_RESOURCE: > + > + if (NewResourceLocation !=3D NULL) { > + FreePool (NewResourceLocation); > + } > + > + if (Json !=3D NULL) { > + FreePool (Json); > + } > + > + return Status; > +} > + > +EFI_STATUS > +ProvisioningBiosResources ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private > + ) > +{ > + UINTN Index; > + EFI_STATUS Status; > + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST > UnifiedConfigureLangList; > + > + if (Private =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang > (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, > REDPATH_ARRAY_PATTERN, &UnifiedConfigureLangList); > + if (EFI_ERROR (Status) || (UnifiedConfigureLangList.Count =3D=3D 0)) { > + DEBUG ((DEBUG_ERROR, "%a, No HII question found with configure > language: %s: %r\n", __FUNCTION__, REDPATH_ARRAY_PATTERN, Status)); > + return EFI_NOT_FOUND; > + } > + > + // > + // Set the configuration language in the > RESOURCE_INFORMATION_EXCHANGE. > + // This information is sent back to the parent resource (e.g. the coll= ection > driver). > + // > + EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList); > + > + for (Index =3D 0; Index < UnifiedConfigureLangList.Count; Index++) { > + DEBUG ((DEBUG_INFO, "[%d] create Bios resource from: %s\n", > UnifiedConfigureLangList.List[Index].Index, > UnifiedConfigureLangList.List[Index].ConfigureLang)); > + ProvisioningBiosResource (Private, > UnifiedConfigureLangList.List[Index].Index, > UnifiedConfigureLangList.List[Index].ConfigureLang); > + FreePool (UnifiedConfigureLangList.List[Index].ConfigureLang); > + } > + > + return EFI_SUCCESS; > +} > + > +EFI_STATUS > +ProvisioningBiosExistResource ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private > + ) > +{ > + EFI_STATUS Status; > + EFI_STRING ConfigureLang; > + CHAR8 *EtagStr; > + CHAR8 *Json; > + > + if (Private =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + EtagStr =3D NULL; > + Json =3D NULL; > + ConfigureLang =3D NULL; > + > + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri); > + if (ConfigureLang =3D=3D NULL) { > + return EFI_NOT_FOUND; > + } > + > + Status =3D ProvisioningBiosProperties ( > + Private->JsonStructProtocol, > + BiosEmptyJson, > + NULL, > + ConfigureLang, > + TRUE, > + &Json > + ); > + if (EFI_ERROR (Status)) { > + if (Status =3D=3D EFI_NOT_FOUND) { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource > for %s ignored. Nothing changed\n", __FUNCTION__, ConfigureLang)); > + } else { > + DEBUG ((DEBUG_ERROR, "%a, provisioning existing resource for %s > failed: %r\n", __FUNCTION__, ConfigureLang, Status)); > + } > + > + goto ON_RELEASE; > + } > + > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for > %s\n", __FUNCTION__, ConfigureLang)); > + // > + // PUT back to instance > + // > + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Priv= ate- > >Payload, Json, &EtagStr); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", > __FUNCTION__, ConfigureLang, Status)); > + } > + > + // > + // Handle Etag > + // > + if (EtagStr !=3D NULL) { > + SetEtagWithUri (EtagStr, Private->Uri); > + FreePool (EtagStr); > + } > + > +ON_RELEASE: > + > + if (Json !=3D NULL) { > + FreePool (Json); > + } > + > + if (ConfigureLang !=3D NULL) { > + FreePool (ConfigureLang); > + } > + > + return Status; > +} > + > +/** > + Provisioning redfish resource by given URI. > + > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCO= L > instance. > + @param[in] ResourceExist TRUE if resource exists, PUT method w= ill be > used. > + FALSE if resource does not exist POST= method is used. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishProvisioningResourceCommon ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN BOOLEAN ResourceExist > + ) > +{ > + if (Private =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + return (ResourceExist ? ProvisioningBiosExistResource (Private) : > ProvisioningBiosResources (Private)); > +} > + > +/** > + Check resource from given URI. > + > + @param[in] This Pointer to > REDFISH_RESOURCE_COMMON_PRIVATE instance. > + @param[in] Json The JSON to consume. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishCheckResourceCommon ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN CHAR8 *Json > + ) > +{ > + UINTN Index; > + EFI_STATUS Status; > + EFI_STRING *ConfigureLangList; > + UINTN Count; > + EFI_STRING Property; > + > + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (Json)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D RedfishPlatformConfigGetConfigureLang (RESOURCE_SCHEMA, > RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, > &ConfigureLangList, &Count); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, > BiosConfigToRedfishGetConfigureLangRegex failed: %r\n", __FUNCTION__, > Status)); > + return Status; > + } > + > + if (Count =3D=3D 0) { > + return EFI_NOT_FOUND; > + } > + > + Status =3D EFI_SUCCESS; > + for (Index =3D 0; Index < Count; Index++) { > + Property =3D GetPropertyFromConfigureLang (Private->Uri, > ConfigureLangList[Index]); > + if (Property =3D=3D NULL) { > + continue; > + } > + > + DEBUG ((DEBUG_INFO, "%a, [%d] check attribute for: %s\n", > __FUNCTION__, Index, Property)); > + if (!MatchPropertyWithJsonContext (Property, Json)) { > + DEBUG ((DEBUG_INFO, "%a, property is missing: %s\n", __FUNCTION__, > Property)); > + Status =3D EFI_NOT_FOUND; > + } > + } > + > + FreePool (ConfigureLangList); > + > + return Status; > +} > + > +/** > + Update resource to given URI. > + > + @param[in] This Pointer to > REDFISH_RESOURCE_COMMON_PRIVATE instance. > + @param[in] Json The JSON to consume. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishUpdateResourceCommon ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN CHAR8 *InputJson > + ) > +{ > + EFI_STATUS Status; > + CHAR8 *Json; > + EFI_STRING ConfigureLang; > + CHAR8 *EtagStr; > + > + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (InputJson)) { > + return EFI_INVALID_PARAMETER; > + } > + > + EtagStr =3D NULL; > + Json =3D NULL; > + ConfigureLang =3D NULL; > + > + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri); > + if (ConfigureLang =3D=3D NULL) { > + return EFI_NOT_FOUND; > + } > + > + Status =3D ProvisioningBiosProperties ( > + Private->JsonStructProtocol, > + InputJson, > + NULL, > + ConfigureLang, > + FALSE, > + &Json > + ); > + if (EFI_ERROR (Status)) { > + if (Status =3D=3D EFI_NOT_FOUND) { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s ignored. > Nothing changed\n", __FUNCTION__, ConfigureLang)); > + } else { > + DEBUG ((DEBUG_ERROR, "%a, update resource for %s failed: %r\n", > __FUNCTION__, ConfigureLang, Status)); > + } > + > + goto ON_RELEASE; > + } > + > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s\n", > __FUNCTION__, ConfigureLang)); > + // > + // PUT back to instance > + // > + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Priv= ate- > >Payload, Json, &EtagStr); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", > __FUNCTION__, ConfigureLang, Status)); > + } > + > + // > + // Handle Etag > + // > + if (EtagStr !=3D NULL) { > + SetEtagWithUri (EtagStr, Private->Uri); > + FreePool (EtagStr); > + } > + > +ON_RELEASE: > + > + if (Json !=3D NULL) { > + FreePool (Json); > + } > + > + if (ConfigureLang !=3D NULL) { > + FreePool (ConfigureLang); > + } > + > + return Status; > +} > + > +/** > + Identify resource from given URI. > + > + @param[in] This Pointer to > REDFISH_RESOURCE_COMMON_PRIVATE instance. > + @param[in] Json The JSON to consume. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishIdentifyResourceCommon ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN CHAR8 *Json > + ) > +{ > + BOOLEAN Supported; > + EFI_STATUS Status; > + EFI_STRING EndOfChar; > + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList; > + > + Supported =3D RedfishIdentifyResource (Private->Uri, Private->Json); > + if (Supported) { > + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang > (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, > REDPATH_ARRAY_PATTERN, &ConfigLangList); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, > BiosConfigToRedfishGetConfigureLangRegex failed: %r\n", __FUNCTION__, > Status)); > + return Status; > + } > + > + if (ConfigLangList.Count =3D=3D 0) { > + return EFI_SUCCESS; > + } > + > + // EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}")= ; > + Status =3D IsRedpathArray (ConfigLangList.List[0].ConfigureLang, NUL= L, > &EndOfChar); > + if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) { > + ASSERT (FALSE); > + return EFI_DEVICE_ERROR; > + } > + > + if (Status !=3D EFI_SUCCESS) { > + // > + // This is not the collection redpath. > + // > + GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, > &EndOfChar); > + } > + > + *(++EndOfChar) =3D '\0'; > + // > + // Keep URI and ConfigLang mapping > + // > + RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->= Uri); > + // > + // Set the configuration language in the > RESOURCE_INFORMATION_EXCHANGE. > + // This information is sent back to the parent resource (e.g. the co= llection > driver). > + // > + EdkIIRedfishResourceSetConfigureLang (&ConfigLangList); > + DestroyConfiglanguageList (&ConfigLangList); > + return EFI_SUCCESS; > + } > + > + return EFI_UNSUPPORTED; > +} > + > +EFI_STATUS > +HandleResource ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN EFI_STRING Uri > + ) > +{ > + EFI_STATUS Status; > + REDFISH_SCHEMA_INFO SchemaInfo; > + EFI_STRING ConfigLang; > + > + if ((Private =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // Resource match > + // > + > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n", > __FUNCTION__, Uri)); > + > + Status =3D GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s > %r\n", __FUNCTION__, Uri, Status)); > + return Status; > + } > + > + // > + // Check and see if this is target resource that we want to handle. > + // Some resource is handled by other provider so we have to make sure > this first. > + // > + DEBUG ((REDFISH_DEBUG_TRACE, "%s Identify for %s\n", __FUNCTION__, > Uri)); > + ConfigLang =3D RedfishGetConfigLanguage (Uri); > + if (ConfigLang =3D=3D NULL) { > + Status =3D EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Pri= vate- > >InformationExchange); > + if (EFI_ERROR (Status)) { > + if (Status =3D=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_INFO, "%a, \"%s\" is not handled by us\n", > __FUNCTION__, Uri)); > + return EFI_SUCCESS; > + } > + > + DEBUG ((DEBUG_ERROR, "%a, fail to identify resource: \"%s\": %r\n"= , > __FUNCTION__, Uri, Status)); > + return Status; > + } > + } else { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, history record found: %s\n", > __FUNCTION__, ConfigLang)); > + FreePool (ConfigLang); > + } > + > + // > + // Check and see if target property exist or not even when collection > memeber exists. > + // If not, we sill do provision. > + // > + DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __FUNCTION__, > Uri)); > + Status =3D EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > + if (EFI_ERROR (Status)) { > + // > + // The target property does not exist, do the provision to create pr= operty. > + // > + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", > __FUNCTION__, Uri)); > + Status =3D EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri= , > Private->InformationExchange, FALSE); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n"= , > __FUNCTION__, Status)); > + } > + > + return Status; > + } > + > + // > + // Consume first. > + // > + DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", > __FUNCTION__, Uri)); > + Status =3D EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %s: %r\n", > __FUNCTION__, Uri, Status)); > + } > + > + // > + // Patch. > + // > + DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __FUNCTION__, > Uri)); > + Status =3D EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to update resoruce for: %s: %r\n", > __FUNCTION__, Uri, Status)); > + } > + > + return Status; > +} > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > new file mode 100644 > index 00000000..15ec208d > --- /dev/null > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > @@ -0,0 +1,788 @@ > +/** @file > + Redfish feature driver implementation - Bios > + > + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "../Common/BiosCommon.h" > + > +extern REDFISH_RESOURCE_COMMON_PRIVATE > *mRedfishResourcePrivate; > + > +EFI_STATUS > +HandleResource ( > + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, > + IN EFI_STRING Uri > + ); > + > +EFI_HANDLE medfishResourceConfigProtocolHandle; > + > +/** > + Provising redfish resource by given URI. > + > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCO= L > instance. > + @param[in] Uri Target URI to create resource. > + @param[in] PostMode TRUE if the resource does not exist, = post > method is used. > + FALSE if the resource exist but prope= rty is missing, put > method is used. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishResourceProvisioningResource ( > + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, > + IN EFI_STRING Uri, > + IN BOOLEAN PostMode > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + EFI_STATUS Status; > + REDFISH_RESPONSE Response; > + > + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG ((DEBUG_INFO, "%a, provisioning in %s mode\n", __FUNCTION__, > (PostMode ? L"POST" : L"PATCH"))); > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO > COL (This); > + > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", > __FUNCTION__, Uri)); > + return Status; > + } > + > + Private->Uri =3D Uri; > + Private->Payload =3D Response.Payload; > + ASSERT (Private->Payload !=3D NULL); > + > + Status =3D RedfishProvisioningResourceCommon (Private, !PostMode); > + > + // > + // Release resource > + // > + if (Private->Payload !=3D NULL) { > + RedfishFreeResponse ( > + Response.StatusCode, > + Response.HeaderCount, > + Response.Headers, > + Response.Payload > + ); > + Private->Payload =3D NULL; > + } > + > + return Status; > +} > + > +/** > + Consume resource from given URI. > + > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCO= L > instance. > + @param[in] Uri The target URI to consume. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishResourceConsumeResource ( > + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, > + IN EFI_STRING Uri > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + EFI_STATUS Status; > + REDFISH_RESPONSE Response; > + CHAR8 *Etag; > + > + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO > COL (This); > + > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", > __FUNCTION__, Uri)); > + return Status; > + } > + > + Private->Uri =3D Uri; > + Private->Payload =3D Response.Payload; > + ASSERT (Private->Payload !=3D NULL); > + > + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Paylo= ad), > EDKII_JSON_COMPACT); > + ASSERT (Private->Json !=3D NULL); > + > + // > + // Find etag in HTTP response header > + // > + Etag =3D NULL; > + Status =3D GetEtagAndLocation (&Response, &Etag, NULL); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", > __FUNCTION__)); > + } > + > + Status =3D RedfishConsumeResourceCommon (Private, Private->Json, Etag)= ; > + if (EFI_ERROR (Status)) { > + if (Status !=3D EFI_ALREADY_STARTED) { > + DEBUG ((DEBUG_ERROR, "%a, failed to consume resource from: %s: > %r\n", __FUNCTION__, Uri, Status)); > + } > + } else { > + // > + // Keep etag after consuming pending settings. > + // > + if (Etag !=3D NULL) { > + SetEtagWithUri (Etag, Private->Uri); > + } > + } > + > + // > + // Release resource > + // > + if (Private->Payload !=3D NULL) { > + RedfishFreeResponse ( > + Response.StatusCode, > + Response.HeaderCount, > + Response.Headers, > + Response.Payload > + ); > + Private->Payload =3D NULL; > + } > + > + if (Private->Json !=3D NULL) { > + FreePool (Private->Json); > + Private->Json =3D NULL; > + } > + > + return Status; > +} > + > +/** > + Get information about this protocol. > + > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCO= L > instance. > + @param[out] Schema Supported schema. > + @param[out] Major Supported major number. > + @param[out] Minor Supported minor number. > + @param[out] Errata Supported errata number. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishResourceGetInfo ( > + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, > + OUT REDFISH_SCHEMA_INFO *Info > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + > + if ((This =3D=3D NULL) || (Info =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO > COL (This); > + > + AsciiStrCpyS (Info->Schema, REDFISH_SCHEMA_STRING_SIZE, > RESOURCE_SCHEMA); > + AsciiStrCpyS (Info->Major, REDFISH_SCHEMA_VERSION_SIZE, > RESOURCE_SCHEMA_MAJOR); > + AsciiStrCpyS (Info->Minor, REDFISH_SCHEMA_VERSION_SIZE, > RESOURCE_SCHEMA_MINOR); > + AsciiStrCpyS (Info->Errata, REDFISH_SCHEMA_VERSION_SIZE, > RESOURCE_SCHEMA_ERRATA); > + > + return EFI_SUCCESS; > +} > + > +/** > + Update resource to given URI. > + > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCO= L > instance. > + @param[in] Uri The target URI to consume. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishResourceUpdate ( > + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, > + IN EFI_STRING Uri > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + EFI_STATUS Status; > + REDFISH_RESPONSE Response; > + > + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO > COL (This); > + > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", > __FUNCTION__, Uri)); > + return Status; > + } > + > + Private->Uri =3D Uri; > + Private->Payload =3D Response.Payload; > + ASSERT (Private->Payload !=3D NULL); > + > + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Paylo= ad), > EDKII_JSON_COMPACT); > + ASSERT (Private->Json !=3D NULL); > + > + Status =3D RedfishUpdateResourceCommon (Private, Private->Json); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to update resource from: %s: %r\n", > __FUNCTION__, Uri, Status)); > + } > + > + // > + // Release resource > + // > + if (Private->Payload !=3D NULL) { > + RedfishFreeResponse ( > + Response.StatusCode, > + Response.HeaderCount, > + Response.Headers, > + Response.Payload > + ); > + Private->Payload =3D NULL; > + } > + > + if (Private->Json !=3D NULL) { > + FreePool (Private->Json); > + Private->Json =3D NULL; > + } > + > + return Status; > +} > + > +/** > + Check resource on given URI. > + > + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCO= L > instance. > + @param[in] Uri The target URI to consume. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishResourceCheck ( > + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, > + IN EFI_STRING Uri > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + EFI_STATUS Status; > + REDFISH_RESPONSE Response; > + > + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO > COL (This); > + > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", > __FUNCTION__, Uri)); > + return Status; > + } > + > + Private->Uri =3D Uri; > + Private->Payload =3D Response.Payload; > + ASSERT (Private->Payload !=3D NULL); > + > + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Paylo= ad), > EDKII_JSON_COMPACT); > + ASSERT (Private->Json !=3D NULL); > + > + Status =3D RedfishCheckResourceCommon (Private, Private->Json); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n", > __FUNCTION__, Uri, Status)); > + } > + > + // > + // Release resource > + // > + if (Private->Payload !=3D NULL) { > + RedfishFreeResponse ( > + Response.StatusCode, > + Response.HeaderCount, > + Response.Headers, > + Response.Payload > + ); > + Private->Payload =3D NULL; > + } > + > + if (Private->Json !=3D NULL) { > + FreePool (Private->Json); > + Private->Json =3D NULL; > + } > + > + return Status; > +} > + > +/** > + Identify resource on given URI. > + > + @param[in] This Pointer to > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance. > + @param[in] Uri The target URI to consume. > + > + @retval EFI_SUCCESS This is target resource which we want= to > handle. > + @retval EFI_UNSUPPORTED This is not the target resource. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishResourceIdentify ( > + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, > + IN EFI_STRING Uri > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + EFI_STATUS Status; > + REDFISH_RESPONSE Response; > + > + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO > COL (This); > + > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", > __FUNCTION__, Uri)); > + return Status; > + } > + > + Private->Uri =3D Uri; > + Private->Payload =3D Response.Payload; > + ASSERT (Private->Payload !=3D NULL); > + > + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Paylo= ad), > EDKII_JSON_COMPACT); > + ASSERT (Private->Json !=3D NULL); > + > + Status =3D RedfishIdentifyResourceCommon (Private, Private->Json); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, identify %s failed: %r\n", __FUNCTION__, > Uri, Status)); > + } > + > + // > + // Release resource > + // > + if (Private->Payload !=3D NULL) { > + RedfishFreeResponse ( > + Response.StatusCode, > + Response.HeaderCount, > + Response.Headers, > + Response.Payload > + ); > + Private->Payload =3D NULL; > + } > + > + if (Private->Json !=3D NULL) { > + FreePool (Private->Json); > + Private->Json =3D NULL; > + } > + > + return Status; > +} > + > +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig > =3D { > + RedfishResourceProvisioningResource, > + RedfishResourceConsumeResource, > + RedfishResourceUpdate, > + RedfishResourceCheck, > + RedfishResourceIdentify, > + RedfishResourceGetInfo > +}; > + > +/** > + Initialize a Redfish configure handler. > + > + This function will be called by the Redfish config driver to initializ= e each > Redfish configure > + handler. > + > + @param[in] This Pointer to > EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance. > + @param[in] RedfishConfigServiceInfo Redfish service informaion. > + > + @retval EFI_SUCCESS The handler has been initialized = successfully. > + @retval EFI_DEVICE_ERROR Failed to create or configure the= REST EX > protocol instance. > + @retval EFI_ALREADY_STARTED This handler has already been > initialized. > + @retval Other Error happens during the initiali= zation. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishResourceInit ( > + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This, > + IN REDFISH_CONFIG_SERVICE_INFORMATION > *RedfishConfigServiceInfo > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCO > L (This); > + > + Private->RedfishService =3D RedfishCreateService > (RedfishConfigServiceInfo); > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_DEVICE_ERROR; > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + Stop a Redfish configure handler. > + > + @param[in] This Pointer to > EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance. > + > + @retval EFI_SUCCESS This handler has been stoped successf= ully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishResourceStop ( > + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This > + ) > +{ > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + > + Private =3D > REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCO > L (This); > + > + if (Private->Event !=3D NULL) { > + gBS->CloseEvent (Private->Event); > + Private->Event =3D NULL; > + } > + > + if (Private->RedfishService !=3D NULL) { > + RedfishCleanupService (Private->RedfishService); > + Private->RedfishService =3D NULL; > + } > + > + if (Private->Payload !=3D NULL) { > + RedfishCleanupPayload (Private->Payload); > + Private->Payload =3D NULL; > + } > + > + return EFI_SUCCESS; > +} > + > +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { > + RedfishResourceInit, > + RedfishResourceStop > +}; > + > +/** > + Callback function when gEfiRestJsonStructureProtocolGuid is installed. > + > + @param[in] Event Event whose notification function is being invoked= . > + @param[in] Context Pointer to the notification function's context. > +**/ > +VOID > +EFIAPI > +EfiRestJasonStructureProtocolIsReady ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + > + if (mRedfishResourcePrivate =3D=3D NULL) { > + return; > + } > + > + if (mRedfishResourcePrivate->JsonStructProtocol !=3D NULL) { > + return; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEfiRestJsonStructureProtocolGuid, > + NULL, > + (VOID **)&mRedfishResourcePrivate->JsonStructProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to locate > gEfiRestJsonStructureProtocolGuid: %r\n", __FUNCTION__, Status)); > + } > + > + gBS->CloseEvent (Event); > +} > + > +/** > + Unloads an image. > + > + @param ImageHandle Handle that identifies the image to be > unloaded. > + > + @retval EFI_SUCCESS The image has been unloaded. > + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image > handle. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishResourceUnload ( > + IN EFI_HANDLE ImageHandle > + ) > +{ > + EFI_STATUS Status; > + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; > + > + if (mRedfishResourcePrivate =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + ConfigHandler =3D NULL; > + > + // > + // Firstly, find ConfigHandler Protocol interface in this ImageHandle. > + // > + Status =3D gBS->OpenProtocol ( > + ImageHandle, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + (VOID **)&ConfigHandler, > + NULL, > + NULL, > + EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL > + ); > + if (EFI_ERROR (Status) || (ConfigHandler =3D=3D NULL)) { > + return Status; > + } > + > + ConfigHandler->Stop (ConfigHandler); > + > + // > + // Last, uninstall ConfigHandler Protocol and resource protocol. > + // > + Status =3D gBS->UninstallMultipleProtocolInterfaces ( > + ImageHandle, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + ConfigHandler, > + &gEdkIIRedfishResourceConfigProtocolGuid, > + &mRedfishResourcePrivate->RedfishResourceConfig, > + NULL > + ); > + > + FreePool (mRedfishResourcePrivate); > + mRedfishResourcePrivate =3D NULL; > + > + return Status; > +} > + > +/** > + The callback function provided by Redfish Feature driver. > + > + @param[in] This Pointer to EDKII_REDFISH_FEATURE_PR= OTOCOL > instance. > + @param[in] FeatureAction The action Redfish feature driver s= hould > take. > + @param[in] Uri The collection URI. > + @param[in] Context The context of Redfish feature driv= er. > + @param[in,out] InformationExchange The pointer to > RESOURCE_INFORMATION_EXCHANGE > + > + @retval EFI_SUCCESS Redfish feature driver callback is ex= ecuted > successfully. > + @retval Others Some errors happened. > + > + @retval EFI_SUCCESS Redfish feature driver callback is ex= ecuted > successfully. > + @retval Others Some errors happened. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishExternalResourceResourceFeatureCallback ( > + IN EDKII_REDFISH_FEATURE_PROTOCOL *This, > + IN FEATURE_CALLBACK_ACTION FeatureAction, > + IN VOID *Context, > + IN OUT RESOURCE_INFORMATION_EXCHANGE *InformationExchange > + ) > +{ > + EFI_STATUS Status; > + REDFISH_SERVICE RedfishService; > + REDFISH_RESOURCE_COMMON_PRIVATE *Private; > + EFI_STRING ResourceUri; > + > + if (FeatureAction !=3D CallbackActionStartOperation) { > + return EFI_UNSUPPORTED; > + } > + > + Private =3D (REDFISH_RESOURCE_COMMON_PRIVATE *)Context; > + > + RedfishService =3D Private->RedfishService; > + if (RedfishService =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + // > + // Save in private structure. > + // > + Private->InformationExchange =3D InformationExchange; > + > + // > + // Find Redfish version on BMC > + // > + Private->RedfishVersion =3D RedfishGetVersion (RedfishService); > + > + // > + // Create the full URI from Redfish service root. > + // > + ResourceUri =3D (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH * sizeof > (CHAR16)); > + if (ResourceUri =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for full URI.\n", > __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion); > + StrCatS (ResourceUri, MAX_URI_LENGTH, InformationExchange- > >SendInformation.FullUri); > + > + // > + // Initialize collection path > + // > + Private->Uri =3D RedfishGetUri (ResourceUri); > + if (Private->Uri =3D=3D NULL) { > + ASSERT (FALSE); > + return EFI_OUT_OF_RESOURCES; > + } > + > + Status =3D HandleResource (Private, Private->Uri); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: > %r\n", __FUNCTION__, Private->Uri, Status)); > + } > + > + FreePool (Private->Uri); > + return Status; > +} > + > +/** > + Callback function when gEdkIIRedfishFeatureProtocolGuid is installed. > + > + @param[in] Event Event whose notification function is being invoked= . > + @param[in] Context Pointer to the notification function's context. > +**/ > +VOID > +EFIAPI > +EdkIIRedfishFeatureProtocolIsReady ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + EDKII_REDFISH_FEATURE_PROTOCOL *FeatureProtocol; > + > + if (mRedfishResourcePrivate =3D=3D NULL) { > + return; > + } > + > + if (mRedfishResourcePrivate->FeatureProtocol !=3D NULL) { > + return; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEdkIIRedfishFeatureProtocolGuid, > + NULL, > + (VOID **)&FeatureProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to locate > gEdkIIRedfishFeatureProtocolGuid: %r\n", __FUNCTION__, Status)); > + gBS->CloseEvent (Event); > + return; > + } > + > + Status =3D FeatureProtocol->Register ( > + FeatureProtocol, > + REDFISH_MANAGED_URI, > + RedfishExternalResourceResourceFeatureCall= back, > + (VOID *)mRedfishResourcePrivate > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to register %s: %r\n", > __FUNCTION__, REDFISH_MANAGED_URI, Status)); > + } > + > + mRedfishResourcePrivate->FeatureProtocol =3D FeatureProtocol; > + > + gBS->CloseEvent (Event); > +} > + > +/** > + 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 incl= uding > + both device drivers and bus drivers. It initialize the global variable= s and > + publish the driver binding protocol. > + > + @param[in] ImageHandle The firmware allocated handle for the UE= FI > image. > + @param[in] SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The operation completed successfully. > + @retval EFI_ACCESS_DENIED EFI_ISCSI_INITIATOR_NAME_PROTOCOL > was installed unexpectedly. > + @retval Others Other errors as indicated. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishResourceEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + VOID *Registration; > + > + if (mRedfishResourcePrivate !=3D NULL) { > + return EFI_ALREADY_STARTED; > + } > + > + medfishResourceConfigProtocolHandle =3D ImageHandle; > + > + mRedfishResourcePrivate =3D AllocateZeroPool (sizeof > (REDFISH_RESOURCE_COMMON_PRIVATE)); > + CopyMem (&mRedfishResourcePrivate->ConfigHandler, > &mRedfishConfigHandler, sizeof > (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL)); > + CopyMem (&mRedfishResourcePrivate->RedfishResourceConfig, > &mRedfishResourceConfig, sizeof > (EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL)); > + > + // > + // Publish config handler protocol and resource protocol. > + // > + Status =3D gBS->InstallMultipleProtocolInterfaces ( > + &ImageHandle, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + &mRedfishResourcePrivate->ConfigHandler, > + &gEdkIIRedfishResourceConfigProtocolGuid, > + &mRedfishResourcePrivate->RedfishResourceConfig, > + NULL > + ); > + > + EfiCreateProtocolNotifyEvent ( > + &gEfiRestJsonStructureProtocolGuid, > + TPL_CALLBACK, > + EfiRestJasonStructureProtocolIsReady, > + NULL, > + &Registration > + ); > + > + EfiCreateProtocolNotifyEvent ( > + &gEdkIIRedfishFeatureProtocolGuid, > + TPL_CALLBACK, > + EdkIIRedfishFeatureProtocolIsReady, > + (VOID *)mRedfishResourcePrivate, > + &Registration > + ); > + > + return Status; > +} > diff --git a/RedfishClientPkg/RedfishClient.fdf.inc > b/RedfishClientPkg/RedfishClient.fdf.inc > index 90240efb..fa4e5389 100644 > --- a/RedfishClientPkg/RedfishClient.fdf.inc > +++ b/RedfishClientPkg/RedfishClient.fdf.inc > @@ -18,6 +18,7 @@ > INF > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf > INF > RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystem > Dxe.inf > INF > RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.inf > + INF RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf >=20 > !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc > # > @@ -27,4 +28,5 @@ > INF > RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_ > Dxe.inf > INF > RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSys > tem_V1_5_0_Dxe.inf > INF > RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS > ystemCollection_Dxe.inf > + INF > RedfishClientPkg/Converter/Bios/v1_0_9/RedfishBios_V1_0_9_Dxe.inf > !endif > -- > 2.17.1