From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web08.2695.1659054592761928902 for ; Thu, 28 Jul 2022 17:29:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=NNuSLCK5; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=02091d93fc=nickle.wang@hpe.com) Received: from pps.filterd (m0150244.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26SMMH45017389; Fri, 29 Jul 2022 00:29:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=6axu20cCI/Io+bmoxO28AalxH/Ct1Bw3MTURHNAcYrY=; b=NNuSLCK5tIu6lJUzgy/eGnsd3ugtbdc9zgID5YNWpDWFdeG9WBQ3YX9iWm6RhrOdgP7V NkbUCS7g4CQCfiG8ittipVoPLtfMm4C+sLnGJ1Fkzw0VVoAvdS2lk2VRctpqwuUmb2Et xPqPVFV3lfVbKy4g6EfpftTUmuOCYXUscGDGCZDao1CErkD0TD9bpjmhBq+MqfIst4Vs dEbWPulFC9PruRlScW5ns0LxuxTQXp1X/b/xGzlbaVsedChiIFauNYPupwlzJ8MVQnOa /uXJ++g3eF9G3383mlmKG203sHx5CofSAIXA8unPLzCAdCTZTPcR+aNHs0tYOdV/HScN FA== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3hm36hgpsn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 00:29:50 +0000 Received: from p1wg14924.americas.hpqcorp.net (unknown [10.119.18.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id 91A918001AA; Fri, 29 Jul 2022 00:29:49 +0000 (UTC) Received: from p1wg14928.americas.hpqcorp.net (10.119.18.116) by p1wg14924.americas.hpqcorp.net (10.119.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Thu, 28 Jul 2022 12:29:49 -1200 Received: from p1wg14924.americas.hpqcorp.net (10.119.18.113) by p1wg14928.americas.hpqcorp.net (10.119.18.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Thu, 28 Jul 2022 12:29:48 -1200 Received: from p1wg14921.americas.hpqcorp.net (16.230.19.124) by p1wg14924.americas.hpqcorp.net (10.119.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15 via Frontend Transport; Thu, 28 Jul 2022 12:29:48 -1200 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (192.58.206.38) by edge.it.hpe.com (16.230.19.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Thu, 28 Jul 2022 12:29:48 -1200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B925evgGFalPI5OrrZ3qK/dGazIQGid6oFmUVWwsQIW7CsyFFThlE+dPaooF3n0kH9WCKoeqHNNKEd/97z4pAFMo8exDd2ynrRm3em+EcQiIf+5fxN9yDKLqkoPijIJHND8/QYOIT7eawTmEuWSayIxnREsAvJVVeRMyrsMdZcmghsdi/6LKXQGiXFTgOmOGWJI/K6RIwESPZ55HvrklA4Ido2msm1FYtheQL+SqtG/vbfobL1/lNE39JmTU5K2iu3Ywc5hfUqXrcOFZS4smf+P0CsZgENRsqHfWasJYUbXwd/GGcmQPT3v49Q+xitDB9jSf9LNbfET4tfNKXHy70w== 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=6axu20cCI/Io+bmoxO28AalxH/Ct1Bw3MTURHNAcYrY=; b=eBLZo8aQpXSFUCmpIeKG4PmzqQXZjrmcAGMQpnfU1kQW2uKE2U8SfzIbzNzo2NgbjDUgHO/5Secb2oPJ/0blbu61MvQDGVQuXKuTuRRY4FFyMpxjpT98A1vsP6JBlMLZwzSHOc4mXV68CKO3GbUBZHVLfzSjPgNZbv537GtEp/DMJawnNsvkXsdfj9rb+qL9fJLJudgvkbeYovUy+FQBQgoJJllRsUYPvU5Ck7inyuF+GwlWrzBxTRw/ItOZeJTsCGAuQwSquW4T1+OmTeQHSFeF3YM9jcVjy0sNDQ9wdpRAsKPByWWqZE8IZyqBwwk/t83LZsNfHD/LShuGLFsKHw== 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 MW4PR84MB1729.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1a4::16) by MW5PR84MB1474.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1c0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Fri, 29 Jul 2022 00:29:46 +0000 Received: from MW4PR84MB1729.NAMPRD84.PROD.OUTLOOK.COM ([fe80::fc00:e16:3f30:fe16]) by MW4PR84MB1729.NAMPRD84.PROD.OUTLOOK.COM ([fe80::fc00:e16:3f30:fe16%5]) with mapi id 15.20.5482.006; Fri, 29 Jul 2022 00:29:46 +0000 From: "Nickle Wang" To: "Chang, Abner" , "devel@edk2.groups.io" CC: "Yang, Atom" , Nick Ramirez Subject: Re: [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg: Introduce Bios feature driver Thread-Topic: [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg: Introduce Bios feature driver Thread-Index: AQHYoVmWtgjr9DVHxkOGsC+rzyV1UK2TJv6ggAFad3A= Date: Fri, 29 Jul 2022 00:29:46 +0000 Message-ID: References: <20220727013802.247-1-nickle.wang@hpe.com> <20220727013802.247-16-nickle.wang@hpe.com> In-Reply-To: Accept-Language: en-US, zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-07-28T03:48:08Z; 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=34f88302-f4a1-4cb1-9eb6-0e9b87ca4d84; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 08945c41-8231-4e20-49e3-08da70f970a5 x-ms-traffictypediagnostic: MW5PR84MB1474:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DkHm7C4OQl++SJZaUQ3a/YAtwEyBNCmFi5MEBloI5FGgTCOjAjM5gXKgvDCG73mmDI0nCRnFoED3TuY6J4IZFK+DmC5MA/fWG2bips6xEBOKxM6Gza3FjLaS+KFINHfLDGApwvDYlwAPuV4TIQuFKkmX0sB9MTLqKlraW8NJ+60rS1U2atd8pzTo6niFi79zTyb5Wn6CDpAH36QzlQM4dUrMTodR8UIUjoYrD6uUY4K3vG/yp6HS92EPu+5xVRMIKUrwa1dFg2COQF7s0w3bbUxsZEB51drpPGC4Kt0yYVZR9ccWJjT5UgwrhSPv5sZvkgz2IYVuEHbcf6L2xN6E3CwqL8TgnVZfLOdiOTVAqbMQFntFndNGiqEnoqP8eYIMzRdhnDvuacBOGFl8fkw8fJIjN2QP0t3D8FWHDXrirG20TFHov58Nv0iTCsHilRcoaH0EJmtqv/piC3g7S9zykaPsMpMiU7YU6oCwBBrUf+Tdk4c05T849FPGYjEY65FYyL7zYkqK57y6fqctyth6FMB8E++ahd1mT5tUtmrbzPUj/Z323gALeFNsy7pbFtliwaht5i9uxE1jb3AEu9drAehnlR1Zi5ezBiVaqxr4/Fo3bzE6U2Y7zYpS9nR5luo973K+AKYjsStCbcA6VMRvharwNwQYwaWMHZRJLOd9eyMQKqlzSWAbeVFI7/bOEXc0lLEUfdeA9KjmULs0InDx2wl8/zYc1o0623JYor228ryx+DwBqRRmvswR3nFH4BJgy01BeerL0sbGP5Qe2CgzadjCD80oUS0Z/5n8D8B/3cLP4hTWTtb7pHdpzGPjZq09KXFs5nFT/xeQahIYty8xng== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR84MB1729.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230016)(39860400002)(346002)(136003)(376002)(366004)(396003)(82960400001)(478600001)(71200400001)(7696005)(26005)(9686003)(6506007)(38100700002)(53546011)(186003)(41300700001)(83380400001)(122000001)(38070700005)(4326008)(33656002)(8936002)(5660300002)(2906002)(30864003)(66556008)(52536014)(55016003)(19627235002)(110136005)(54906003)(8676002)(66946007)(316002)(64756008)(66476007)(76116006)(86362001)(66446008)(559001)(579004)(44824005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VliqpNBPsJ1spHiBRCnI8y2pA3Se2mwTwCMrU2OJtOtQRHHwNXb8UKBdrZH6?= =?us-ascii?Q?oYTPEb4DS1//InOUjHcT2jX+B8AbhwakiA79Q1eObPLNiEzKeiO8kP52Cyva?= =?us-ascii?Q?bd6MQxCucYM0ZuPdG2Z4Q8PFcynCQPvIXLdrSAmJ/E8cym6j/DQw92U8RW6z?= =?us-ascii?Q?Yj6w2EJHdpGN3irTEd6FYQRwm+Xq0l/S7hNzTbHNInrd1iZA6jRA0MlAbk/w?= =?us-ascii?Q?dVIRcMBKVvJAsb0MPN1kCE2jATNX+/8tGBgUDRsZAhBfZttgvGKoE6z06UJ4?= =?us-ascii?Q?au1AaHhodMqfbWrDxuAvosXSptFVOb4cpX5+57aVGbl7eXZ5U/XQsRCa0ucd?= =?us-ascii?Q?El8U1mhbYYs/T/pr5oS11AwFhS2h7Azn7QQq/K6iMWCSD5CUdTPmcQwR9bzQ?= =?us-ascii?Q?JU+C09GRvls4/mg+gCOpDfk9d7EoFF4g2TQTcQEXM13ei1g7cUyjETqRcMR4?= =?us-ascii?Q?TUcWKPkwbD8sfPhy6X5/qPSuJJ6s/f5yLA6yR+nl11IsW6wiMHNxXbYyemF1?= =?us-ascii?Q?ILCX+AiaV4jRUK16fvYc67ylk/M0+kwIHHuzK44kj28DDdyzEyN3U/fHSg+M?= =?us-ascii?Q?uPd1ujuEZmjR5zexTXOqqq2YieHNegLgIffl0CrRY1Vhv0s8ff37MZt4jAb7?= =?us-ascii?Q?1BZF902eDNjz3Meaq6t2sWRGNQC0GNHm3ZCZUv8JuXNkSQ3U032xBnu1rEXr?= =?us-ascii?Q?6ZBuGu43cYgQFTa7ltEqPw4FAWi0AvkgVWff73IQtDzD3km9y4JsZ50LK+lq?= =?us-ascii?Q?MNaIBJSNWzMAra6NgwJfuQyHvYTGkWd5JPqPxnM6VvcR3YXWtuKmPzPO7Woa?= =?us-ascii?Q?VOHZUDv+Kfx2085bgNMKFsf4ghFeYR32aG/5Bc7SNpzT0rBVCbUuRQcq405m?= =?us-ascii?Q?T5ScMKTKvvyyCVErHtWimOR4vjysD3+KhDbkz3BauQdXlJpO5TZ0NBqhNMOV?= =?us-ascii?Q?FfcMrgTmOQOTUy87w6wRhhvQObjNoFLE4BO9KgseWN0c8rsgLsPRCrmcXrPA?= =?us-ascii?Q?/3i13Q360g8cYH9rJnES/fD7Yc793tjDJHaV5QJaxC3BNk8ZnqM8ab+YNiwQ?= =?us-ascii?Q?BSgLtbYJmyXlmYrlZWQFC9KWPcdshVunI0RaJAXsvXf1ucg3jDTS7SPeyqyC?= =?us-ascii?Q?tgvpiBMnH/Vcqp/WvlLJJPCLM1YPYRgt66t6CoyJfmgyUqJKw55XHxwsjRUX?= =?us-ascii?Q?5DwYAGtR+IWneQW6Et7mD83C9kyGEHYlaKGvau/Zcl/yasvw0N710hXCK/JQ?= =?us-ascii?Q?fzfb3GgAcXMleSPsrzP8WxniV9q+3AuA+UAdGKswXG16nQk8S+pjrMbO8yn8?= =?us-ascii?Q?K7SaQI8pQ1MBvsRxNKl5Q/HtQOGSc2tOXgqDpkBo+/ftN1Wl9mrG1Df9b98o?= =?us-ascii?Q?/FpSi3vj2ZM31mdGAIyoctJh7ITjBWDZgR6csZ3gR+KLUsVrCnItjdq8tOUB?= =?us-ascii?Q?fpviBEJdCSxSP/bQx/9PK7XUKs9wD/6Aa302olxiSdFNAKBWZGvSwdadyufO?= =?us-ascii?Q?yY7Ece5QQbDmZ6blIsx2/cJjpQyf095umgbCxCNVo+4i3EeuDqsa67vWL89k?= =?us-ascii?Q?1mf+B2WHn7lHMQO8e9xbwj5UXR0weP8EtYz6/3M5?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR84MB1729.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 08945c41-8231-4e20-49e3-08da70f970a5 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2022 00:29:46.5082 (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: NT/uocxkeOii4lzWA2YzfkBexVCW3z5X5HvU7//LcXazJrEGtAgCTyh1itPHTdYIquebos1p6YItSL70SHmXww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR84MB1474 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: rgf8gHb3vvW_sGc8oO9PTZI1d-oka-01 X-Proofpoint-ORIG-GUID: rgf8gHb3vvW_sGc8oO9PTZI1d-oka-01 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-28_06,2022-07-28_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 spamscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207290000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thank you so much for your help to review my patch files. Will address comm= ents and push them to edk2-staging repo. Nickle -----Original Message----- From: Chang, Abner =20 Sent: Thursday, July 28, 2022 11:48 AM To: Wang, Nickle (Server BIOS) ; devel@edk2.groups.io Cc: Yang, Atom ; Nick Ramirez Subject: RE: [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg: = Introduce Bios feature driver [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, July 27, 2022 9:38 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Yang, Atom > ; Nick Ramirez > Subject: [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg: > Introduce Bios feature driver >=20 > [CAUTION: External Email] >=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: Yang Atom > Cc: Nick Ramirez > --- > .../Features/Bios/v1_0_9/Common/BiosCommon.c | 741 > ++++++++++++++++ > .../Features/Bios/v1_0_9/Common/BiosCommon.h | 30 + > .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 789 ++++++++++++++++++ > .../Features/Bios/v1_0_9/Dxe/BiosDxe.inf | 52 ++ > RedfishClientPkg/RedfishClient.fdf.inc | 2 + > .../RedfishClientComponents.dsc.inc | 2 + > RedfishClientPkg/RedfishClientLibs.dsc.inc | 6 +- > 7 files changed, 1621 insertions(+), 1 deletion(-) > create mode 100644 > RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > create mode 100644 > RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h > create mode 100644 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > create mode 100644 > RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf >=20 > 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 0000000000..d910d0d8a9 > --- /dev/null > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c > @@ -0,0 +1,741 @@ > +/** @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 *)Bios= Cs- > >Attributes->Prop.ForwardLink)->KeyValuePtr, > + ((RedfishCS_Type_EmptyProp_CS_Data *)Bios= Cs- > >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/Common/BiosCommon.h > b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h > new file mode 100644 > index 0000000000..321ded7637 > --- /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/Dxe/BiosDxe.c > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > new file mode 100644 > index 0000000000..a478061cde > --- /dev/null > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > @@ -0,0 +1,789 @@ > +/** @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/Features/Bios/v1_0_9/Dxe/BiosDxe.inf > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf > new file mode 100644 > index 0000000000..8c01a3b877 > --- /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/RedfishClient.fdf.inc > b/RedfishClientPkg/RedfishClient.fdf.inc > index 90240efbf7..fa4e53898b 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 > diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc > b/RedfishClientPkg/RedfishClientComponents.dsc.inc > index 084796e4b5..e83f4bc9bf 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 05ad09ef5e..fe0c4b0885 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 > -- > 2.32.0.windows.2