From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web09.2909.1652866293752963012 for ; Wed, 18 May 2022 02:31:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=KIIdUudf; 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.147.86, mailfrom: prvs=0137e89ecd=abner.chang@hpe.com) Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24I4WTqC005433 for ; Wed, 18 May 2022 09:31:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=RjUWMLniCjfOZxQRvqfratLgaAeXReUuQuajhJdr8l0=; b=KIIdUudfpthqYY2flu3ENtw8liKkiExcQC6elkyVrfX8xIb8NGVcMYVCwzNR9LnXiqwE Po31SmOCU+n/8zoZISGKj5B3lj6q6FmvHQUa0PvncdQhKc2s+kwgicaczrRqkw8Ns8sG vle+fRozM+h/kuaGBLqBTNQTC6caujmvZKJ67SU0t8wLh63DXxgdIfqLb+joQA637CXD efzQpyz64ukC0FsG8p0+5c9IfDTEEjc16ELzbwcPLUTJ8AL2TSIe+iels9WzrQlJPaqg HONu9736ctK+mjcr9vtX+kz6AzDssTl8d2W9sckaikwo/Ia+I5uq6HUjE01lW3WJ2AwB xg== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3g4c9k5udh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 18 May 2022 09:31:31 +0000 Received: from p1wg14923.americas.hpqcorp.net (unknown [10.119.18.111]) (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 2A1CB8005C2 for ; Wed, 18 May 2022 09:31:31 +0000 (UTC) Received: from p1wg14928.americas.hpqcorp.net (10.119.18.116) by p1wg14923.americas.hpqcorp.net (10.119.18.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Tue, 17 May 2022 21:31:28 -1200 Received: from p1wg14926.americas.hpqcorp.net (10.119.18.115) 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; Tue, 17 May 2022 21:31:27 -1200 Received: from P1WG14918.americas.hpqcorp.net (16.230.19.121) by p1wg14926.americas.hpqcorp.net (10.119.18.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15 via Frontend Transport; Tue, 17 May 2022 21:31:27 -1200 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (192.58.206.38) by edge.it.hpe.com (16.230.19.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Wed, 18 May 2022 09:31:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SLln+Z9glpXVXmxH4tZFSAca4kEVeql5W/Pzr+huE8E01F23fl5eRmyDD8olUFqQMhkq305TQEgJXzoos0HadFNGSSa0vWVqDlv5O37GtCq1Jkjh1+ccyTAaOnYt46ulsRbq4UdgQgVpOeL7ds0rjJoD7AEJt6/0kV44PlbIb5ngeihNsP9TgY37RS6tWZkLCfScWkGNWwkbcZLpungY00PBOmrwMMAO5USw21b4cnHQL0Tjh6V6GB4u43bjZXBRDGPi83LHIBylxkMIdj7d93ijsHtNQHkoRpl1iwB/WWlg80Pd0ZBJqZOUBgd3TQzIgUBkeWuUQNUv1sn0cYrA+Q== 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=RjUWMLniCjfOZxQRvqfratLgaAeXReUuQuajhJdr8l0=; b=hk9h1jLYpXb9YTOqVt0jXIgB4492aCYdOnx8hgNA+Y3Kd40nbYt91AQUuvERNbax8H1oBaJK3IEbS29CY+uGBCoygorLLr3cAhK3ZnmEg/6FmOtuEU5KnH/B/oN4szxpG207x9XJDkZS0tF3ERdxs/wKHWTEoVY06csI/Rw8omeXl4i+ZBvujOb9Ujj6JrWdf/I4san1eVMRELR9jk28Am3DXRc1oz6eUSeymjqo9JGzr5XXbeJqygTg30AeUd+jPUIRhwSivj8bOkK7WIW2V68XrQkjC+Qncp1UZ+TzzVu0XZVKVCd3V1VO2xkjknVs6PcLZQRg2qyvrXiMLM/LFA== 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 PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:173::6) by SJ1PR84MB3068.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:a03:45d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 09:31:22 +0000 Received: from PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM ([fe80::ccc7:75d5:2ce1:9b5a]) by PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM ([fe80::ccc7:75d5:2ce1:9b5a%9]) with mapi id 15.20.5273.014; Wed, 18 May 2022 09:31:22 +0000 From: "Abner Chang" To: "Wang, Nickle (Server BIOS)" , "devel@edk2.groups.io" Subject: Re: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Add support of array type attribute Thread-Topic: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Add support of array type attribute Thread-Index: AQHYabBeTKVMfVmab0mH22AlsTFhw60kEAqw Date: Wed, 18 May 2022 09:31:21 +0000 Message-ID: References: <20220517041925.577-1-nickle.wang@hpe.com> In-Reply-To: <20220517041925.577-1-nickle.wang@hpe.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4ed29ff6-02b2-435b-be7b-08da38b12ba9 x-ms-traffictypediagnostic: SJ1PR84MB3068:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qkox2E/I5Sj2M/MN2v8BqeFMH2uUhFD8Q2C/99ro0nLfyeSTQ4lzY2L5vk+3Mz+Z2DVzvJvMzAtEaRa1Hs8YGAv0dvRUHXRbjiWQl66OyKP8LUxNpTZcyBtu6mMFFDFIVKZLsNEfQNwWQxnKOpkQICSDydUcWL6Lxb+1hlFykW2eI34riZfH/uEesF1o757gKm5Mc1hCXupVlTAzM90qG70gbZyUyPreDN2hu42aCbqPjgYSCT+XrUePBkCZrPTlJ8XfIeYA56WwjdwwM65HIgieRkZ61c8jComQcWLRJZKiIfRePRL4/EM4mJtqLV/MO0/9skmsgLvFM9HAjKGahW7bWsQ3jJlePUsl4bUwLlwCli0WZXOVv9d3IpF1jAJ5hzl+6p7ySRPMKj61pM1p/k4VULJ6j56zVGrNibY6080NY/vETMn9HBUdfetHkJnRSLSIAC0p0e48zfymW0YWdWdTCUuTf7WvdDUfrPLX2pdxLsUOcaY4c3qbgq0xEMwaPgQHD+sq/hstXUdpuKz4shsnoGwIzW3oOd4+TXdnxpYe/rDL+kPPRHhbjLnEhv7lr5KUaex3O5hxchOJ8Q+2uJ/96SCl2+7qxzNIgNRLvLLrOBkDf+LOd5hychmlC7ZEkrYxiQO4N1WXt49ui4Q/QGOUXGzSZL1MRvpQ4h73fWMVyPebHsL02dUx0DRFn/sqGwhNuarsX7yzsS7g80VuYwRlytRszMRntToCemwDU0VkTN7skMRwxS6jy3TqyKW/nZjK99R1L7Ay8BB/znDRGQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(366004)(38070700005)(66476007)(66946007)(26005)(2906002)(76116006)(64756008)(66556008)(86362001)(66446008)(5660300002)(53546011)(52536014)(8936002)(71200400001)(508600001)(30864003)(110136005)(8676002)(38100700002)(82960400001)(7696005)(186003)(33656002)(83380400001)(316002)(19627235002)(122000001)(6506007)(55016003)(9686003)(290074003)(403724002)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9GWDjVL/3z25igTrJgErebxZDfNtv59/aW8MTZmc09uWr+NvFr+r9hw5AmCf?= =?us-ascii?Q?zQiJ13T9PbfKlkXn9wGuo1KeGenq/B7F1D1Xp61GacEss6AB/HgL70AxCLoG?= =?us-ascii?Q?pbLwghWtoHF/iIXwLUrCuoUPXi6M+8LYj3DMkZr4YhW/+nY4+TCb6bbQpC3o?= =?us-ascii?Q?llbqO15jN4G9rEAGOjOyMYjj275aaxgUDKYs7PKyyM2ohelvLekNZyokw/14?= =?us-ascii?Q?cTBqwylF+Xz5WNlqyhq5zguSOIc+INEJzhIIYRcKqNye0H3mhHP4r1r6L1xZ?= =?us-ascii?Q?8uA972aOd+WEt7FFgCurORZOlxE/lW1DKDDkOjpd2+6RegBRbbGufOHLu+0C?= =?us-ascii?Q?VEcdTGdIp0QF2OH7adGL3Mr16D1kz+9tf00VXoD9Hqr98rc4rbGCvNRCKhTm?= =?us-ascii?Q?W49vFpdeQIx6thpfdk+v/vyeSZASkwnNADzNUHYV9vWKxFdnYAu4VQHQuAkQ?= =?us-ascii?Q?K7hWAN2TJ/qtf+UsMeLHcezcVdxfXPq2NeXk2m62d4Ft5xr0PuTEksEsLgVS?= =?us-ascii?Q?mCPE+MZ+8bLuiyqXx4PO51nB/iGAmm8K0BOpAGobWzze4l9dcUnx8e9UP7zl?= =?us-ascii?Q?KitpGq+RvG3Ldl0H2XBBPzc2wzkllC5+YEe84GTjWRfYkGcs+bMIWghMNQWq?= =?us-ascii?Q?vu2EUX6KgnHEFMPgfZrqX/p3i90NW0vRQLaIQFWk4vKh/LMwhnlg5zy4UW2+?= =?us-ascii?Q?OusLjAyYRNP5ZFTjBcjAKjYlKoVn4CzehNU9E0fckjFs1HCrne97OKNKfjTx?= =?us-ascii?Q?R812QK5jj4ZHpHwmYnbB2hNzmrtG3cUjw/7e1HGNNfJ/PIvgITZqSAIcVYth?= =?us-ascii?Q?z6foVoC5vCUf+/aVl2jVCjRshQjFGXHpNKTYasBm/VrXmYAI/w/viwJnFan0?= =?us-ascii?Q?R6FirqcEmsjeWBrt91dI3b6YIuVQckBsZaxe0X5SJBQPSYG9f8lxMi+jzK5e?= =?us-ascii?Q?sqk8j24ny/5JqQY6CyPrEV0FQEpWyGq/+6Qg79ehOqBYcY7yG2mEmEcZHyLd?= =?us-ascii?Q?swQB1OWbXPogLe9cSBoaVI+PXMW7IUSQYxPlSaDCAEYUodKqspWY6ZAbK/BT?= =?us-ascii?Q?pmXzr5mrVXoyV5q81oEVfuH3In7U9EEEdniTq4bYKxxSB3j6p2qX84Y0umf2?= =?us-ascii?Q?vzJjJvEWt5oQHw8Apuip/mQqywWXapfhf5HBhNxMQzbpSd5X2X9wv6856Ua/?= =?us-ascii?Q?Fj30JRvkD9PEe2N5VhVVaQ/ZVBmhlvjESOViUtKrJazIfL1Gqf43O0ombMXt?= =?us-ascii?Q?0WiVPOY5bteHEy9UVq4YyhL9jIE0zSClP1SubJcqQ6kNid7vGT3hbD8KczZP?= =?us-ascii?Q?bFUYCpQmTgpFHUr/qoqR27N0naX3ywp4FY7M+Y6wpJDQgAtK41DPX6LQdkMK?= =?us-ascii?Q?afalyf/VNgvjZ3GzQ+Cecsmc/zK7lqFWx8oH/lzR2Kf05Cvo9GFOcWfuIGdx?= =?us-ascii?Q?GPIs7o2zU1LVY2gEIExr7vDdVJB/FbgQ8uhKZX0cFK4iUqbJMKe5VG6++zq6?= =?us-ascii?Q?98WS/Og74oPUBlWrOYjo0UhqH5D8pqWNPFDknn7iIrv+YNNbbUiOHvmzVf3u?= =?us-ascii?Q?yFpt8+MDYJJwe1V/Lo4WPSTsJJHWtdxCvkjo+TxIyiEAyvkr2ZaWzIzU8Bv6?= =?us-ascii?Q?/U3bxGgVG8wHzMT8hfJl1w8lHUPNJQHdwJeHF5Cpz1Hx8ItNwShNELz753ss?= =?us-ascii?Q?+alHJ0FGct8geISdbErc0ir3KybthPiFdRXDBvBBCw6ikp6+54RK3s3yBVYq?= =?us-ascii?Q?iyKvEVUp7g=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 4ed29ff6-02b2-435b-be7b-08da38b12ba9 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 May 2022 09:31:21.8945 (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: g91DtrOEk7YHxQcaU8x4wkb1+9Bg200kYt7rS5Dag37MFWdy8nWMuPbwft3XvRfST3rowuIJToi+eoB8d1QjVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR84MB3068 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: 8HlX2xaIVqFeen7oQoVa25pQddoNNqcY X-Proofpoint-ORIG-GUID: 8HlX2xaIVqFeen7oQoVa25pQddoNNqcY X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-18_03,2022-05-17_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 phishscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205180051 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Wang, Nickle (Server BIOS) > Sent: Tuesday, May 17, 2022 12:19 PM > To: devel@edk2.groups.io > Cc: Wang, Nickle (Server BIOS) ; Chang, Abner (HPS > SW/FW Technologist) > Subject: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Add support > of array type attribute >=20 > Add Redfish array type attribute support. Add function to handle > HII ordered list question in order to convert value array in > HII ordered list to Redfish array attribute. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > --- > .../Protocol/EdkIIRedfishPlatformConfig.h | 299 +- > .../RedfishPlatformConfigDxe.c | 3112 ++++++++++------- > .../RedfishPlatformConfigDxe.h | 128 +- > .../RedfishPlatformConfigDxe.inf | 104 +- > .../RedfishPlatformConfigImpl.c | 2526 ++++++------- > .../RedfishPlatformConfigImpl.h | 572 +-- > 6 files changed, 3660 insertions(+), 3081 deletions(-) >=20 > diff --git a/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > b/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > index 895b010227..8c11021eeb 100644 > --- a/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > +++ b/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > @@ -1,147 +1,152 @@ > -/** @file > - This file defines the EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > interface. > - > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef EDKII_REDFISH_PLATFORM_CONFIG_H_ > -#define EDKII_REDFISH_PLATFORM_CONFIG_H_ > - > -typedef struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL; > - > -/** > - Definition of EDKII_REDFISH_TYPE_VALUE > - **/ > -typedef union { > - INT64 Integer; > - BOOLEAN Boolean; > - CHAR8 *Buffer; > -} EDKII_REDFISH_TYPE_VALUE; > - > -/** > - Definition of EDKII_REDFISH_VALUE_TYPES > - **/ > -typedef enum { > - REDFISH_VALUE_TYPE_UNKNOWN =3D 0, > - REDFISH_VALUE_TYPE_INTEGER, > - REDFISH_VALUE_TYPE_BOOLEAN, > - REDFISH_VALUE_TYPE_STRING, > - REDFISH_VALUE_TYPE_MAX > -} EDKII_REDFISH_VALUE_TYPES; > - > -/** > - Definition of EDKII_REDFISH_VALUE > - **/ > -typedef struct { > - EDKII_REDFISH_VALUE_TYPES Type; > - EDKII_REDFISH_TYPE_VALUE Value; > -} EDKII_REDFISH_VALUE; > - > -/** > - Get Redfish value with the given Schema and Configure Language. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] Schema The Redfish schema to query. > - @param[in] Version The Redfish version to query. > - @param[in] ConfigureLang The target value which match this con= figure > Language. > - @param[out] Value The returned value. > - > - @retval EFI_SUCCESS Value is returned successfully. > - @retval Others Some error happened. > - > -**/ > -typedef > -EFI_STATUS > -(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE) ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN CHAR8 *Schema, > - IN CHAR8 *Version, > - IN EFI_STRING ConfigureLang, > - OUT EDKII_REDFISH_VALUE *Value > - ); > - > -/** > - Set Redfish value with the given Schema and Configure Language. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] Schema The Redfish schema to query. > - @param[in] Version The Redfish version to query. > - @param[in] ConfigureLang The target value which match this con= figure > Language. > - @param[in] Value The value to set. > - > - @retval EFI_SUCCESS Value is returned successfully. > - @retval Others Some error happened. > - > -**/ > -typedef > -EFI_STATUS > -(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE) ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN CHAR8 *Schema, > - IN CHAR8 *Version, > - IN EFI_STRING ConfigureLang, > - IN EDKII_REDFISH_VALUE Value > - ); > - > -/** > - Get the list of Configure Language from platform configuration by the = given > Schema and Pattern. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] Schema The Redfish schema to query. > - @param[in] Version The Redfish version to query. > - @param[in] Pattern The target Configure Language pattern= . > - @param[out] ConfigureLangList The list of Configure Language. > - @param[out] Count The number of Configure Language in > ConfigureLangList. > - > - @retval EFI_SUCCESS ConfigureLangList is returned success= fully. > - @retval Others Some error happened. > - > -**/ > -typedef > -EFI_STATUS > -(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG) ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN CHAR8 *Schema, > - IN CHAR8 *Version, > - IN EFI_STRING Pattern, > - OUT EFI_STRING **ConfigureLangList, > - OUT UINTN *Count > - ); > - > - > -/** > - Get the list of supported Redfish schema from platform configuration o= n > the give HII handle. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] HiiHandle The target handle to search. If handl= e is NULL, > - this function returns all schema from= HII database. > - @param[out] SupportedSchema The supported schema list which is > separated by ';'. > - For example: "x-uefi-redfish-Memory.v= 1_7_1;x-uefi- > redfish-Boot.v1_0_1" > - The SupportedSchema is allocated by t= he callee. It's caller's > - responsibility to free this buffer us= ing FreePool(). > - > - @retval EFI_SUCCESS Schema is returned successfully. > - @retval Others Some error happened. > - > -**/ > -typedef > -EFI_STATUS > -(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA) > ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN EFI_HII_HANDLE HiiHandle, OPTI= ONAL > - OUT CHAR8 **SupportedSchema > - ); > - > -struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL { > - EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE GetValue; > - EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE SetValue; > - EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG > GetConfigureLang; > - EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA > GetSupportedSchema; > -}; > - > -extern EFI_GUID gEdkIIRedfishPlatformConfigProtocolGuid; > - > -#endif > +/** @file >=20 > + This file defines the EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > interface. >=20 > + >=20 > + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > + >=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef EDKII_REDFISH_PLATFORM_CONFIG_H_ >=20 > +#define EDKII_REDFISH_PLATFORM_CONFIG_H_ >=20 > + >=20 > +typedef struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL; >=20 > + >=20 > +/** >=20 > + Definition of EDKII_REDFISH_TYPE_VALUE >=20 > + **/ >=20 > +typedef union { >=20 > + INT64 Integer; >=20 > + BOOLEAN Boolean; >=20 > + CHAR8 *Buffer; >=20 > + CHAR8 **StringArray; >=20 > + INT64 *IntegerArray; >=20 > +} EDKII_REDFISH_TYPE_VALUE; >=20 > + >=20 > +/** >=20 > + Definition of EDKII_REDFISH_VALUE_TYPES >=20 > + **/ >=20 > +typedef enum { >=20 > + REDFISH_VALUE_TYPE_UNKNOWN =3D 0, >=20 > + REDFISH_VALUE_TYPE_INTEGER, >=20 > + REDFISH_VALUE_TYPE_BOOLEAN, >=20 > + REDFISH_VALUE_TYPE_STRING, >=20 > + REDFISH_VALUE_TYPE_STRING_ARRAY, >=20 > + REDFISH_VALUE_TYPE_INTEGER_ARRAY, >=20 > + REDFISH_VALUE_TYPE_MAX >=20 > +} EDKII_REDFISH_VALUE_TYPES; >=20 > + >=20 > +/** >=20 > + Definition of EDKII_REDFISH_VALUE >=20 > + **/ >=20 > +typedef struct { >=20 > + EDKII_REDFISH_VALUE_TYPES Type; >=20 > + EDKII_REDFISH_TYPE_VALUE Value; >=20 > + UINTN ArrayCount; >=20 > +} EDKII_REDFISH_VALUE; >=20 > + >=20 > +/** >=20 > + Get Redfish value with the given Schema and Configure Language. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] Schema The Redfish schema to query. >=20 > + @param[in] Version The Redfish version to query. >=20 > + @param[in] ConfigureLang The target value which match this con= figure > Language. >=20 > + @param[out] Value The returned value. >=20 > + >=20 > + @retval EFI_SUCCESS Value is returned successfully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE) ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version, >=20 > + IN EFI_STRING ConfigureLang, >=20 > + OUT EDKII_REDFISH_VALUE *Value >=20 > + ); >=20 > + >=20 > +/** >=20 > + Set Redfish value with the given Schema and Configure Language. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] Schema The Redfish schema to query. >=20 > + @param[in] Version The Redfish version to query. >=20 > + @param[in] ConfigureLang The target value which match this con= figure > Language. >=20 > + @param[in] Value The value to set. >=20 > + >=20 > + @retval EFI_SUCCESS Value is returned successfully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE) ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version, >=20 > + IN EFI_STRING ConfigureLang, >=20 > + IN EDKII_REDFISH_VALUE Value >=20 > + ); >=20 > + >=20 > +/** >=20 > + Get the list of Configure Language from platform configuration by the > given Schema and Pattern. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] Schema The Redfish schema to query. >=20 > + @param[in] Version The Redfish version to query. >=20 > + @param[in] Pattern The target Configure Language pattern= . >=20 > + @param[out] ConfigureLangList The list of Configure Language. >=20 > + @param[out] Count The number of Configure Language in > ConfigureLangList. >=20 > + >=20 > + @retval EFI_SUCCESS ConfigureLangList is returned success= fully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG) ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version, >=20 > + IN EFI_STRING Pattern, >=20 > + OUT EFI_STRING **ConfigureLangList, >=20 > + OUT UINTN *Count >=20 > + ); >=20 > + >=20 > + >=20 > +/** >=20 > + Get the list of supported Redfish schema from platform configuration o= n > the give HII handle. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] HiiHandle The target handle to search. If handl= e is NULL, >=20 > + this function returns all schema from= HII database. >=20 > + @param[out] SupportedSchema The supported schema list which is > separated by ';'. >=20 > + For example: "x-uefi-redfish-Memory.v= 1_7_1;x-uefi- > redfish-Boot.v1_0_1" >=20 > + The SupportedSchema is allocated by t= he callee. It's > caller's >=20 > + responsibility to free this buffer us= ing FreePool(). >=20 > + >=20 > + @retval EFI_SUCCESS Schema is returned successfully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA) > ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN EFI_HII_HANDLE HiiHandle, OPTI= ONAL >=20 > + OUT CHAR8 **SupportedSchema >=20 > + ); >=20 > + >=20 > +struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL { >=20 > + EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE GetValue; >=20 > + EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE SetValue; >=20 > + EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG > GetConfigureLang; >=20 > + EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA > GetSupportedSchema; >=20 > +}; >=20 > + >=20 > +extern EFI_GUID gEdkIIRedfishPlatformConfigProtocolGuid; >=20 > + >=20 > +#endif >=20 > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > index 67818cccd2..f61bebefef 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > @@ -1,1304 +1,1808 @@ > -/** @file > - > - The implementation of EDKII Redfidh Platform Config Protocol. > - > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#include "RedfishPlatformConfigDxe.h" > -#include "RedfishPlatformConfigImpl.h" > - > -REDFISH_PLATFORM_CONFIG_PRIVATE *mRedfishPlatformConfigPrivate =3D > NULL; > - > -/** > - Compare two value in HII statement format. > - > - @param[in] Value1 Firt value to compare. > - @param[in] Value2 Second value to be compared. > - > - @retval UINTN 0 is retuned when two values are equal. > - 1 is returned when first value is greater than s= econd value. > - -1 is returned when second value is greater than= first value. > - > -**/ > -UINTN > -CompareHiiStatementValue ( > - IN HII_STATEMENT_VALUE *Value1, > - IN HII_STATEMENT_VALUE *Value2 > - ) > -{ > - INTN Result; > - UINT64 Data1; > - UINT64 Data2; > - > - if (Value1 =3D=3D NULL || Value2 =3D=3D NULL) { > - return 0xFF; > - } > - > - switch (Value1->Type) { > - case EFI_IFR_TYPE_NUM_SIZE_8: > - Data1 =3D Value1->Value.u8; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_16: > - Data1 =3D Value1->Value.u16; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_32: > - Data1 =3D Value1->Value.u32; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_64: > - Data1 =3D Value1->Value.u64; > - break; > - case EFI_IFR_TYPE_BOOLEAN: > - Data1 =3D (Value1->Value.b ? 1 : 0); > - break; > - default: > - return 0xFF; > - } > - > - switch (Value2->Type) { > - case EFI_IFR_TYPE_NUM_SIZE_8: > - Data2 =3D Value2->Value.u8; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_16: > - Data2 =3D Value2->Value.u16; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_32: > - Data2 =3D Value2->Value.u32; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_64: > - Data2 =3D Value2->Value.u64; > - break; > - case EFI_IFR_TYPE_BOOLEAN: > - Data2 =3D (Value2->Value.b ? 1 : 0); > - break; > - default: > - return 0xFF; > - } > - > - Result =3D (Data1 =3D=3D Data2 ? 0 : (Data1 > Data2 ? 1 : -1)); > - > - return Result; > -} > - > -/** > - Convert HII value to the string in HII one-of opcode. > - > - @param[in] Statement Statement private instance > - > - @retval EFI_STRING_ID The string ID in HII database. > - 0 is returned when something goes wrong. > - > -**/ > -EFI_STRING_ID > -HiiValueToOneOfOptionStringId ( > - IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement > - ) > -{ > - LIST_ENTRY *Link; > - HII_QUESTION_OPTION *Option; > - > - if (Statement->HiiStatement->Operand !=3D EFI_IFR_ONE_OF_OP) { > - return 0; > - } > - > - if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { > - return 0; > - } > - > - Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); > - while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { > - Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); > - > - if (CompareHiiStatementValue (&Statement->HiiStatement->Value, > &Option->Value) =3D=3D 0) { > - return Option->Text; > - } > - > - Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); > - } > - > - return 0; > -} > - > -/** > - Convert HII string to the value in HII one-of opcode. > - > - @param[in] Statement Statement private instance > - @param[in] Schema Schema string > - @param[in] HiiString Input string > - @param[out] Value Value returned > - > - @retval EFI_SUCCESS HII value is returned successfully. > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -HiiStringToOneOfOptionValue ( > - IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement, > - IN CHAR8 *Schema, > - IN EFI_STRING HiiString, > - OUT HII_STATEMENT_VALUE *Value > - ) > -{ > - LIST_ENTRY *Link; > - HII_QUESTION_OPTION *Option; > - EFI_STRING TmpString; > - BOOLEAN Found; > - > - if (Statement =3D=3D NULL || IS_EMPTY_STRING (HiiString) || Value =3D= =3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (Statement->HiiStatement->Operand !=3D EFI_IFR_ONE_OF_OP) { > - return EFI_UNSUPPORTED; > - } > - > - if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { > - return EFI_NOT_FOUND; > - } > - > - Found =3D FALSE; > - Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); > - while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { > - Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); > - > - TmpString =3D HiiGetRedfishString (Statement->ParentForm- > >ParentFormset->HiiHandle, Schema, Option->Text); > - if (TmpString !=3D NULL) { > - if (StrCmp (TmpString, HiiString) =3D=3D 0) { > - CopyMem (Value, &Option->Value, sizeof (HII_STATEMENT_VALUE)); > - Found =3D TRUE; > - } > - FreePool (TmpString); > - } > - > - if (Found) { > - return EFI_SUCCESS; > - } > - > - Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); > - } > - > - return EFI_NOT_FOUND; > -} > - > -/** > - Convert HII value to numeric value in Redfish format. > - > - @param[in] Value Value to be converted. > - @param[out] RedfishValue Value in Redfish format. > - > - @retval EFI_SUCCESS Redfish value is returned successfully. > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -HiiValueToRedfishNumeric ( > - IN HII_STATEMENT_VALUE *Value, > - OUT EDKII_REDFISH_VALUE *RedfishValue > - ) > -{ > - if (Value =3D=3D NULL || RedfishValue =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - switch (Value->Type) { > - case EFI_IFR_TYPE_NUM_SIZE_8: > - RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; > - RedfishValue->Value.Integer =3D (INT64)Value->Value.u8; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_16: > - RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; > - RedfishValue->Value.Integer =3D (INT64)Value->Value.u16; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_32: > - RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; > - RedfishValue->Value.Integer =3D (INT64)Value->Value.u32; > - break; > - case EFI_IFR_TYPE_NUM_SIZE_64: > - RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; > - RedfishValue->Value.Integer =3D (INT64)Value->Value.u64; > - break; > - case EFI_IFR_TYPE_BOOLEAN: > - RedfishValue->Type =3D REDFISH_VALUE_TYPE_BOOLEAN; > - RedfishValue->Value.Boolean =3D Value->Value.b; > - break; > - default: > - RedfishValue->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; > - break; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Convert numeric value in Redfish format to HII value. > - > - @param[in] RedfishValue Value in Redfish format to be converted. > - @param[out] Value HII value returned. > - > - @retval EFI_SUCCESS HII value is returned successfully. > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -RedfishNumericToHiiValue ( > - IN EDKII_REDFISH_VALUE *RedfishValue, > - OUT HII_STATEMENT_VALUE *Value > - ) > -{ > - if (Value =3D=3D NULL || RedfishValue =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - switch (RedfishValue->Type) { > - case REDFISH_VALUE_TYPE_INTEGER: > - Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_64; > - Value->Value.u64 =3D (UINT64)RedfishValue->Value.Integer; > - break; > - case REDFISH_VALUE_TYPE_BOOLEAN: > - Value->Type =3D EFI_IFR_TYPE_BOOLEAN; > - Value->Value.b =3D RedfishValue->Value.Boolean; > - break; > - default: > - Value->Type =3D EFI_IFR_TYPE_UNDEFINED; > - break; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Return the full Redfish schema string from the given Schema and Versio= n. > - > - Returned schema string is: Schema + '.' + Version > - > - @param[in] Schema Schema string > - @param[in] Version Schema version string > - > - @retval CHAR8 * Schema string. NULL when errors occur. > - > -**/ > -CHAR8 * > -GetFullSchemaString ( > - IN CHAR8 *Schema, > - IN CHAR8 *Version > - ) > -{ > - UINTN Size; > - CHAR8 *FullName; > - > - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version)) { > - return NULL; > - } > - > - Size =3D AsciiStrSize(CONFIGURE_LANGUAGE_PREFIX) + AsciiStrSize (Schem= a) > + AsciiStrSize (Version); > - > - FullName =3D AllocatePool (Size); > - if (FullName =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, out-of-resource\n", __FUNCTION__)); > - return NULL; > - } > - > - AsciiSPrint (FullName, Size, "%a%a.%a", CONFIGURE_LANGUAGE_PREFIX, > Schema, Version); > - > - return FullName; > -} > - > -/** > - Common implementation to get statement private instance. > - > - @param[in] RedfishPlatformConfigPrivate Private instance. > - @param[in] Schema Redfish schema string. > - @param[in] ConfigureLang Configure language that re= fers to this > statement. > - @param[out] Statement Statement instance > - > - @retval EFI_SUCCESS HII value is returned successfully. > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -RedfishPlatformConfigGetStatementCommon ( > - IN REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate, > - IN CHAR8 *Schema, > - IN EFI_STRING ConfigureLang, > - OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE **Statement > - ) > -{ > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; > - > - if (RedfishPlatformConfigPrivate =3D=3D NULL || IS_EMPTY_STRING (Schem= a) > || IS_EMPTY_STRING (ConfigureLang) || Statement =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - *Statement =3D NULL; > - > - Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - TargetStatement =3D GetStatementPrivateByConfigureLang > (&RedfishPlatformConfigPrivate->FormsetList, Schema, ConfigureLang); > - if (TargetStatement =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, No match HII statement is found by the > given %s in schema %a\n", __FUNCTION__, ConfigureLang, Schema)); > - return EFI_NOT_FOUND; > - } > - > - // > - // Find current HII question value. > - // > - Status =3D GetQuestionValue ( > - TargetStatement->ParentForm->ParentFormset->HiiFormSet, > - TargetStatement->ParentForm->HiiForm, > - TargetStatement->HiiStatement, > - GetSetValueWithHiiDriver > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to get question current value: %r\n= ", > __FUNCTION__, Status)); > - return Status; > - } > - > - > - if (TargetStatement->HiiStatement->Value.Type =3D=3D > EFI_IFR_TYPE_UNDEFINED) { > - return EFI_DEVICE_ERROR; > - } > - > - // > - // Return Value. > - // > - *Statement =3D TargetStatement; > - > - return EFI_SUCCESS; > -} > - > -/** > - Get Redfish value with the given Schema and Configure Language. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] Schema The Redfish schema to query. > - @param[in] Version The Redfish version to query. > - @param[in] ConfigureLang The target value which match this con= figure > Language. > - @param[out] Value The returned value. > - > - @retval EFI_SUCCESS Value is returned successfully. > - @retval Others Some error happened. > - > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPlatformConfigProtocolGetValue ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN CHAR8 *Schema, > - IN CHAR8 *Version, > - IN EFI_STRING ConfigureLang, > - OUT EDKII_REDFISH_VALUE *Value > - ) > -{ > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; > - EFI_STRING_ID StringId; > - CHAR8 *FullSchema; > - EFI_STRING HiiString; > - UINTN Size; > - > - if (This =3D=3D NULL || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || IS_EMPTY_STRING (ConfigureLang) || Value =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); > - Value->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; > - FullSchema =3D NULL; > - HiiString =3D NULL; > - > - FullSchema =3D GetFullSchemaString (Schema, Version); > - if (FullSchema =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - Status =3D RedfishPlatformConfigGetStatementCommon > (RedfishPlatformConfigPrivate, FullSchema, ConfigureLang, > &TargetStatement); > - if (EFI_ERROR (Status)) { > - goto RELEASE_RESOURCE; > - } > - > - switch (TargetStatement->HiiStatement->Operand) { > - case EFI_IFR_ONE_OF_OP: > - StringId =3D HiiValueToOneOfOptionStringId (TargetStatement); > - if (StringId =3D=3D 0) { > - ASSERT (FALSE); > - Status =3D EFI_DEVICE_ERROR; > - goto RELEASE_RESOURCE; > - } > - > - HiiString =3D HiiGetRedfishString (TargetStatement->ParentForm- > >ParentFormset->HiiHandle, FullSchema, StringId); > - if (HiiString =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, Can not find string ID: 0x%x with %a\n= ", > __FUNCTION__, StringId, FullSchema)); > - Status =3D EFI_NOT_FOUND; > - goto RELEASE_RESOURCE; > - } > - > - Size =3D StrLen (HiiString) + 1; > - Value->Value.Buffer =3D AllocatePool (Size); > - if (Value->Value.Buffer =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto RELEASE_RESOURCE; > - } > - > - UnicodeStrToAsciiStrS (HiiString, Value->Value.Buffer, Size); > - Value->Type =3D REDFISH_VALUE_TYPE_STRING; > - > - break; > - case EFI_IFR_STRING_OP: > - if (TargetStatement->HiiStatement->Value.Type !=3D > EFI_IFR_TYPE_STRING) { > - ASSERT (FALSE); > - Status =3D EFI_DEVICE_ERROR; > - goto RELEASE_RESOURCE; > - } > - > - Value->Type =3D REDFISH_VALUE_TYPE_STRING; > - Value->Value.Buffer =3D AllocateCopyPool (StrSize ((CHAR16 > *)TargetStatement->HiiStatement->Value.Buffer), TargetStatement- > >HiiStatement->Value.Buffer); > - if (Value->Value.Buffer =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto RELEASE_RESOURCE; > - } > - break; > - case EFI_IFR_CHECKBOX_OP: > - case EFI_IFR_NUMERIC_OP: > - Status =3D HiiValueToRedfishNumeric (&TargetStatement->HiiStatemen= t- > >Value, Value); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to convert HII value to Redfish > value: %r\n", __FUNCTION__, Status)); > - goto RELEASE_RESOURCE; > - } > - break; > - default: > - DEBUG ((DEBUG_ERROR, "%a, catch unsupported type: 0x%x! Please > contact with author if we need to support this type.\n", __FUNCTION__, > TargetStatement->HiiStatement->Operand)); > - ASSERT (FALSE); > - Status =3D EFI_UNSUPPORTED; > - goto RELEASE_RESOURCE; > - } > - > -RELEASE_RESOURCE: > - > - if (FullSchema !=3D NULL) { > - FreePool (FullSchema); > - } > - > - if (HiiString !=3D NULL) { > - FreePool (HiiString); > - } > - > - return Status; > -} > - > -/** > - Function to save question value into HII database. > - > - @param[in] HiiFormset HII form-set instance > - @param[in] HiiForm HII form instance > - @param[in] HiiStatement HII statement that keeps new value. > - @param[in] Value New value to applyu. > - > - @retval EFI_SUCCESS HII value is returned successfully. > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -RedfishPlatformConfigSaveQuestionValue ( > - IN HII_FORMSET *HiiFormset, > - IN HII_FORM *HiiForm, > - IN HII_STATEMENT *HiiStatement, > - IN HII_STATEMENT_VALUE *Value > - ) > -{ > - EFI_STATUS Status; > - > - if (HiiFormset =3D=3D NULL || HiiForm =3D=3D NULL || HiiStatement =3D= =3D NULL || > Value =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - Status =3D SetQuestionValue ( > - HiiFormset, > - HiiForm, > - HiiStatement, > - Value > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to set question value: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - Status =3D SubmitForm (HiiFormset, HiiForm); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to submit form: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Common implementation to set statement private instance. > - > - @param[in] RedfishPlatformConfigPrivate Private instance. > - @param[in] Schema Redfish schema string. > - @param[in] ConfigureLang Configure language that re= fers to this > statement. > - @param[in] Statement Statement instance > - > - @retval EFI_SUCCESS HII value is returned successfully. > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -RedfishPlatformConfigSetStatementCommon ( > - IN REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate, > - IN CHAR8 *Schema, > - IN EFI_STRING ConfigureLang, > - IN HII_STATEMENT_VALUE *StatementValue > - ) > -{ > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; > - EFI_STRING TempBuffer; > - > - if (RedfishPlatformConfigPrivate =3D=3D NULL || IS_EMPTY_STRING (Schem= a) > || IS_EMPTY_STRING (ConfigureLang) || StatementValue =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - TempBuffer =3D NULL; > - > - Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - TargetStatement =3D GetStatementPrivateByConfigureLang > (&RedfishPlatformConfigPrivate->FormsetList, Schema, ConfigureLang); > - if (TargetStatement =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, No match HII statement is found by the > given %s in schema %a\n", __FUNCTION__, ConfigureLang, Schema)); > - return EFI_NOT_FOUND; > - } > - > - if (StatementValue->Type !=3D TargetStatement->HiiStatement->Value.Typ= e) > { > - // > - // We treat one-of type as string in Redfish. But one-of statement i= s not > - // in string format from HII point of view. Do a patch here. > - // > - if (TargetStatement->HiiStatement->Operand =3D=3D EFI_IFR_ONE_OF_OP > && StatementValue->Type =3D=3D EFI_IFR_TYPE_STRING) { > - TempBuffer =3D AllocatePool (StatementValue->BufferLen * sizeof > (CHAR16)); > - if (TempBuffer =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - AsciiStrToUnicodeStrS (StatementValue->Buffer, TempBuffer, > StatementValue->BufferLen); > - FreePool (StatementValue->Buffer); > - StatementValue->Buffer =3D NULL; > - StatementValue->BufferLen =3D 0; > - > - Status =3D HiiStringToOneOfOptionValue (TargetStatement, Schema, > TempBuffer, StatementValue); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to find option value by the giv= en > %s\n", __FUNCTION__, TempBuffer)); > - FreePool (TempBuffer); > - return EFI_NOT_FOUND; > - } > - > - FreePool (TempBuffer); > - } else if (TargetStatement->HiiStatement->Operand =3D=3D > EFI_IFR_NUMERIC_OP && StatementValue->Type =3D=3D > EFI_IFR_TYPE_NUM_SIZE_64) { > - // > - // Redfish only has numeric value type and it does not care about = the > value size. > - // Do a patch here so we have proper value size applied. > - // > - StatementValue->Type =3D TargetStatement->HiiStatement->Value.Type= ; > - } else { > - DEBUG ((DEBUG_ERROR, "%a, catch value type mismatch! input type: > 0x%x but target value type: 0x%x\n", __FUNCTION__, StatementValue- > >Type, TargetStatement->HiiStatement->Value.Type)); > - ASSERT (FALSE); > - } > - } > - > - Status =3D RedfishPlatformConfigSaveQuestionValue ( > - TargetStatement->ParentForm->ParentFormset->HiiFormSet, > - TargetStatement->ParentForm->HiiForm, > - TargetStatement->HiiStatement, > - StatementValue > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to save question value: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Set Redfish value with the given Schema and Configure Language. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] Schema The Redfish schema to query. > - @param[in] Version The Redfish version to query. > - @param[in] ConfigureLang The target value which match this con= figure > Language. > - @param[in] Value The value to set. > - > - @retval EFI_SUCCESS Value is returned successfully. > - @retval Others Some error happened. > - > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPlatformConfigProtocolSetValue ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN CHAR8 *Schema, > - IN CHAR8 *Version, > - IN EFI_STRING ConfigureLang, > - IN EDKII_REDFISH_VALUE Value > - ) > -{ > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > - CHAR8 *FullSchema; > - HII_STATEMENT_VALUE NewValue; > - > - if (This =3D=3D NULL || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || IS_EMPTY_STRING (ConfigureLang)) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (Value.Type =3D=3D REDFISH_VALUE_TYPE_UNKNOWN || Value.Type >=3D > REDFISH_VALUE_TYPE_MAX) { > - return EFI_INVALID_PARAMETER; > - } > - > - RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); > - FullSchema =3D NULL; > - > - FullSchema =3D GetFullSchemaString (Schema, Version); > - if (FullSchema =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - ZeroMem (&NewValue, sizeof (HII_STATEMENT_VALUE)); > - > - switch (Value.Type) { > - case REDFISH_VALUE_TYPE_INTEGER: > - case REDFISH_VALUE_TYPE_BOOLEAN: > - Status =3D RedfishNumericToHiiValue (&Value, &NewValue); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to convert Redfish value to Hii > value: %r\n", __FUNCTION__, Status)); > - goto RELEASE_RESOURCE; > - } > - break; > - case REDFISH_VALUE_TYPE_STRING: > - NewValue.Type =3D EFI_IFR_TYPE_STRING; > - NewValue.BufferLen =3D (UINT16)AsciiStrSize (Value.Value.Buffer); > - NewValue.Buffer =3D AllocateCopyPool (NewValue.BufferLen, > Value.Value.Buffer); > - if (NewValue.Buffer =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto RELEASE_RESOURCE; > - } > - break; > - default: > - ASSERT (FALSE); > - break; > - } > - > - Status =3D RedfishPlatformConfigSetStatementCommon > (RedfishPlatformConfigPrivate, FullSchema, ConfigureLang, &NewValue); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to set value to statement: %r\n", > __FUNCTION__, Status)); > - } > - > -RELEASE_RESOURCE: > - > - if (FullSchema !=3D NULL) { > - FreePool (FullSchema); > - } > - > - return Status; > -} > - > -/** > - Get the list of Configure Language from platform configuration by the = given > Schema and Pattern. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] Schema The Redfish schema to query. > - @param[in] Version The Redfish version to query. > - @param[in] Pattern The target Configure Language pattern= . > - @param[out] ConfigureLangList The list of Configure Language. > - @param[out] Count The number of Configure Language in > ConfigureLangList. > - > - @retval EFI_SUCCESS ConfigureLangList is returned success= fully. > - @retval Others Some error happened. > - > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPlatformConfigProtocolGetConfigureLang ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN CHAR8 *Schema, > - IN CHAR8 *Version, > - IN EFI_STRING Pattern, > - OUT EFI_STRING **ConfigureLangList, > - OUT UINTN *Count > - ) > -{ > - REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST StatementList; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF *StatementRef; > - LIST_ENTRY *NextLink; > - EFI_STRING TmpString; > - EFI_STRING *TmpConfigureLangList; > - UINTN Index; > - CHAR8 *FullSchema; > - > - if (This =3D=3D NULL || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || Count =3D=3D NULL || ConfigureLangList =3D=3D NULL || > IS_EMPTY_STRING (Pattern)) { > - return EFI_INVALID_PARAMETER; > - } > - > - *Count =3D 0; > - *ConfigureLangList =3D NULL; > - FullSchema =3D NULL; > - RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); > - > - Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - FullSchema =3D GetFullSchemaString (Schema, Version); > - if (FullSchema =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - Status =3D GetStatementPrivateByConfigureLangRegex ( > - RedfishPlatformConfigPrivate->RegularExpressionProtocol, > - &RedfishPlatformConfigPrivate->FormsetList, > - FullSchema, > - Pattern, > - &StatementList > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, > GetStatementPrivateByConfigureLangRegex failure: %r\n", __FUNCTION__, > Status)); > - goto RELEASE_RESOURCE; > - } > - > - if (!IsListEmpty (&StatementList.StatementList)) { > - > - TmpConfigureLangList =3D AllocateZeroPool (sizeof (CHAR16 *) * > StatementList.Count); > - if (TmpConfigureLangList =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto RELEASE_RESOURCE; > - } > - > - Index =3D 0; > - NextLink =3D GetFirstNode (&StatementList.StatementList); > - while (!IsNull (&StatementList.StatementList, NextLink)) { > - StatementRef =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK (NextLink); > - NextLink =3D GetNextNode (&StatementList.StatementList, NextLink); > - > - ASSERT (StatementRef->Statement->Description !=3D 0); > - if (StatementRef->Statement->Description !=3D 0) { > - TmpString =3D HiiGetRedfishString (StatementRef->Statement- > >ParentForm->ParentFormset->HiiHandle, FullSchema, StatementRef- > >Statement->Description); > - ASSERT (TmpString !=3D NULL); > - if (TmpString !=3D NULL) { > - TmpConfigureLangList[Index] =3D AllocateCopyPool (StrSize (Tmp= String), > TmpString); > - ASSERT (TmpConfigureLangList[Index] !=3D NULL); > - FreePool (TmpString); > - ++Index; > - } > - } > - } > - } > - > - *Count =3D StatementList.Count; > - *ConfigureLangList =3D TmpConfigureLangList; > - > -RELEASE_RESOURCE: > - > - if (FullSchema !=3D NULL) { > - FreePool (FullSchema); > - } > - > - ReleaseStatementList (&StatementList); > - > - return Status; > -} > - > - > -/** > - Get the list of supported Redfish schema from paltform configuration o= n > give HII handle. > - > - @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. > - @param[in] HiiHandle The target handle to search. If handl= e is NULL, > - this function return all schema from = HII database. > - @param[out] SupportedSchema The supported schema list which is > separated by ';'. > - The SupportedSchema is allocated by t= he callee. It's caller's > - responsibility to free this buffer us= ing FreePool(). > - > - @retval EFI_SUCCESS Schema is returned successfully. > - @retval Others Some error happened. > - > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPlatformConfigProtocolGetSupportedSchema ( > - IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > - IN EFI_HII_HANDLE HiiHandle, OPTIO= NAL > - OUT CHAR8 **SupportedSchema > - ) > -{ > - REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > - EFI_STATUS Status; > - LIST_ENTRY *HiiFormsetLink; > - LIST_ENTRY *HiiFormsetNextLink; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; > - UINTN Index; > - UINTN StringSize; > - CHAR8 *StringBuffer; > - UINTN StringIndex; > - > - if (This =3D=3D NULL || SupportedSchema =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - *SupportedSchema =3D NULL; > - > - RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); > - > - Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); > - return Status; > - } > - > - if (IsListEmpty (&RedfishPlatformConfigPrivate->FormsetList)) { > - return EFI_NOT_FOUND; > - } > - > - // > - // Calculate for string buffer size. > - // > - StringSize =3D 0; > - HiiFormsetLink =3D GetFirstNode (&RedfishPlatformConfigPrivate- > >FormsetList); > - while (!IsNull (&RedfishPlatformConfigPrivate->FormsetList, > HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (&RedfishPlatformConfigPrivate- > >FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - if (HiiHandle !=3D NULL && HiiHandle !=3D HiiFormsetPrivate->HiiHand= le) { > - HiiFormsetLink =3D HiiFormsetNextLink; > - continue; > - } > - > - if (HiiFormsetPrivate->SupportedSchema.Count > 0) { > - for (Index =3D 0; Index < HiiFormsetPrivate->SupportedSchema.Count= ; > Index++) { > - StringSize +=3D AsciiStrSize (HiiFormsetPrivate- > >SupportedSchema.SchemaList[Index]); > - } > - } > - > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - if (StringSize =3D=3D 0) { > - return EFI_NOT_FOUND; > - } > - > - StringBuffer =3D AllocatePool (StringSize); > - if (StringBuffer =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - StringIndex =3D 0; > - HiiFormsetLink =3D GetFirstNode (&RedfishPlatformConfigPrivate- > >FormsetList); > - while (!IsNull (&RedfishPlatformConfigPrivate->FormsetList, > HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (&RedfishPlatformConfigPrivate- > >FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - if (HiiHandle !=3D NULL && HiiHandle !=3D HiiFormsetPrivate->HiiHand= le) { > - HiiFormsetLink =3D HiiFormsetNextLink; > - continue; > - } > - > - if (HiiFormsetPrivate->SupportedSchema.Count > 0) { > - for (Index =3D 0; Index < HiiFormsetPrivate->SupportedSchema.Count= ; > Index++) { > - AsciiStrCpyS (&StringBuffer[StringIndex], (StringSize - StringIn= dex), > HiiFormsetPrivate->SupportedSchema.SchemaList[Index]); > - StringIndex +=3D AsciiStrLen (HiiFormsetPrivate- > >SupportedSchema.SchemaList[Index]); > - StringBuffer[StringIndex] =3D ';'; > - ++StringIndex; > - } > - } > - > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - StringBuffer[--StringIndex] =3D '\0'; > - > - *SupportedSchema =3D StringBuffer; > - > - return EFI_SUCCESS; > -} > - > -/** > - Functions which are registered to receive notification of > - database events have this prototype. The actual event is encoded > - in NotifyType. The following table describes how PackageType, > - PackageGuid, Handle, and Package are used for each of the > - notification types. > - > - @param[in] PackageType Package type of the notification. > - @param[in] PackageGuid If PackageType is > - EFI_HII_PACKAGE_TYPE_GUID, then this is > - the pointer to the GUID from the Guid > - field of EFI_HII_PACKAGE_GUID_HEADER. > - Otherwise, it must be NULL. > - @param[in] Package Points to the package referred to by the > - notification Handle The handle of the package > - list which contains the specified package. > - @param[in] Handle The HII handle. > - @param[in] NotifyType The type of change concerning the > - database. See > - EFI_HII_DATABASE_NOTIFY_TYPE. > - > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPlatformConfigFormUpdateNotify ( > - IN UINT8 PackageType, > - IN CONST EFI_GUID *PackageGuid, > - IN CONST EFI_HII_PACKAGE_HEADER *Package, > - IN EFI_HII_HANDLE Handle, > - IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType > - ) > -{ > - EFI_STATUS Status; > - > - if (NotifyType =3D=3D EFI_HII_DATABASE_NOTIFY_NEW_PACK || NotifyType > =3D=3D EFI_HII_DATABASE_NOTIFY_ADD_PACK) { > - // > - // HII formset on this handle is updated by driver during run-time. = The > formset needs to be reloaded. > - // > - Status =3D NotifyFormsetUpdate (Handle, &mRedfishPlatformConfigPriva= te- > >PendingList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to notify updated formset of HII > handle: 0x%x\n", __FUNCTION__, Handle)); > - return Status; > - } > - } else if (NotifyType =3D=3D EFI_HII_DATABASE_NOTIFY_REMOVE_PACK) { > - // > - // HII resource is removed. The formset is no longer exist. > - // > - Status =3D NotifyFormsetDeleted (Handle, > &mRedfishPlatformConfigPrivate->PendingList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to notify deleted formset of HII > handle: 0x%x\n", __FUNCTION__, Handle)); > - return Status; > - } > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - This is a EFI_HII_STRING_PROTOCOL notification event handler. > - > - Install HII package notification. > - > - @param[in] Event Event whose notification function is being invoked= . > - @param[in] Context Pointer to the notification function's context. > - > -**/ > -VOID > -EFIAPI > -HiiStringProtocolInstalled ( > - IN EFI_EVENT Event, > - IN VOID *Context > - ) > -{ > - EFI_STATUS Status; > - > - // > - // Locate HII database protocol. > - // > - Status =3D gBS->LocateProtocol ( > - &gEfiHiiStringProtocolGuid, > - NULL, > - (VOID **)&mRedfishPlatformConfigPrivate->HiiString > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, locate EFI_HII_STRING_PROTOCOL failure: > %r\n", __FUNCTION__, Status)); > - return; > - } > - > - gBS->CloseEvent (Event); > - mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent =3D NULL; > -} > - > -/** > - This is a EFI_HII_DATABASE_PROTOCOL notification event handler. > - > - Install HII package notification. > - > - @param[in] Event Event whose notification function is being invoked= . > - @param[in] Context Pointer to the notification function's context. > - > -**/ > -VOID > -EFIAPI > -HiiDatabaseProtocolInstalled ( > - IN EFI_EVENT Event, > - IN VOID *Context > - ) > -{ > - EFI_STATUS Status; > - > - // > - // Locate HII database protocol. > - // > - Status =3D gBS->LocateProtocol ( > - &gEfiHiiDatabaseProtocolGuid, > - NULL, > - (VOID **)&mRedfishPlatformConfigPrivate->HiiDatabase > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, locate EFI_HII_DATABASE_PROTOCOL > failure: %r\n", __FUNCTION__, Status)); > - return; > - } > - > - // > - // Register package notification when new form package is installed. > - // > - Status =3D mRedfishPlatformConfigPrivate->HiiDatabase- > >RegisterPackageNotify ( > - mRedfishPlatformConfigPriva= te->HiiDatabase, > - EFI_HII_PACKAGE_FORMS, > - NULL, > - RedfishPlatformConfigFormUp= dateNotify, > - EFI_HII_DATABASE_NOTIFY_NEW= _PACK, > - &mRedfishPlatformConfigPriv= ate->NotifyHandle > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, RegisterPackageNotify for > EFI_HII_DATABASE_NOTIFY_NEW_PACK failure: %r\n", __FUNCTION__, > Status)); > - } > - > - // > - // Register package notification when new form package is updated. > - // > - Status =3D mRedfishPlatformConfigPrivate->HiiDatabase- > >RegisterPackageNotify ( > - mRedfishPlatformConfigPriva= te->HiiDatabase, > - EFI_HII_PACKAGE_FORMS, > - NULL, > - RedfishPlatformConfigFormUp= dateNotify, > - EFI_HII_DATABASE_NOTIFY_ADD= _PACK, > - &mRedfishPlatformConfigPriv= ate->NotifyHandle > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, RegisterPackageNotify for > EFI_HII_DATABASE_NOTIFY_NEW_PACK failure: %r\n", __FUNCTION__, > Status)); > - } > - > -#if REDFISH_PLATFORM_CONFIG_DELETE_EXPIRED_FORMSET > - // > - // Register package notification when new form package is removed. > - // > - Status =3D mRedfishPlatformConfigPrivate->HiiDatabase- > >RegisterPackageNotify ( > - mRedfishPlatformConfigPriva= te->HiiDatabase, > - EFI_HII_PACKAGE_FORMS, > - NULL, > - RedfishPlatformConfigFormUp= dateNotify, > - EFI_HII_DATABASE_NOTIFY_REM= OVE_PACK, > - &mRedfishPlatformConfigPriv= ate->NotifyHandle > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, RegisterPackageNotify for > EFI_HII_DATABASE_NOTIFY_NEW_PACK failure: %r\n", __FUNCTION__, > Status)); > - } > -#endif > - > - gBS->CloseEvent (Event); > - mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent =3D NULL; > - > -} > - > -/** > - This is a EFI_REGULAR_EXPRESSION_PROTOCOL notification event handler. > - > - @param[in] Event Event whose notification function is being invoked= . > - @param[in] Context Pointer to the notification function's context. > - > -**/ > -VOID > -EFIAPI > -RegexProtocolInstalled ( > - IN EFI_EVENT Event, > - IN VOID *Context > - ) > -{ > - EFI_STATUS Status; > - > - // > - // Locate regular expression protocol. > - // > - Status =3D gBS->LocateProtocol ( > - &gEfiRegularExpressionProtocolGuid, > - NULL, > - (VOID **)&mRedfishPlatformConfigPrivate- > >RegularExpressionProtocol > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, locate > EFI_REGULAR_EXPRESSION_PROTOCOL failure: %r\n", __FUNCTION__, > Status)); > - return; > - } > - > - gBS->CloseEvent (Event); > - mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent =3D NULL; > - > -} > - > -/** > - 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 > -RedfishPlatformConfigDxeUnload ( > - IN EFI_HANDLE ImageHandle > - ) > -{ > - EFI_STATUS Status; > - > - if (mRedfishPlatformConfigPrivate !=3D NULL) { > - Status =3D gBS->UninstallProtocolInterface ( > - mRedfishPlatformConfigPrivate->ImageHandle, > - &gEdkIIRedfishPlatformConfigProtocolGuid, > - (VOID*)&mRedfishPlatformConfigPrivate->Protocol > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, can not uninstall > gEdkIIRedfishPlatformConfigProtocolGuid: %r\n", __FUNCTION__, Status)); > - ASSERT (FALSE); > - } > - > - // > - // Close events > - // > - if (mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent !=3D NU= LL) { > - gBS->CloseEvent (mRedfishPlatformConfigPrivate- > >HiiDbNotify.ProtocolEvent); > - } > - if (mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent != =3D NULL) > { > - gBS->CloseEvent (mRedfishPlatformConfigPrivate- > >HiiStringNotify.ProtocolEvent); > - } > - if (mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent !=3D NU= LL) { > - gBS->CloseEvent (mRedfishPlatformConfigPrivate- > >RegexNotify.ProtocolEvent); > - } > - > - // > - // Unregister package notification. > - // > - if (mRedfishPlatformConfigPrivate->NotifyHandle !=3D NULL) { > - mRedfishPlatformConfigPrivate->HiiDatabase->UnregisterPackageNotif= y > ( > - mRedfishPlatformConfigPrivate-= >HiiDatabase, > - mRedfishPlatformConfigPrivate-= >NotifyHandle > - ); > - } > - > - ReleaseFormsetList (&mRedfishPlatformConfigPrivate->FormsetList); > - FreePool (mRedfishPlatformConfigPrivate); > - mRedfishPlatformConfigPrivate =3D NULL; > - } > - > - return EFI_SUCCESS; > -} > - > - > -/** > - This is the declaration of an EFI image entry point. This entry point = is > - the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers incl= uding > - both device drivers and bus drivers. > - > - @param ImageHandle The firmware allocated handle for the UE= FI > image. > - @param SystemTable A pointer to the EFI System Table. > - > - @retval EFI_SUCCESS The operation completed successfully. > - @retval Others An unexpected error occurred. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPlatformConfigDxeEntryPoint ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ) > -{ > - EFI_STATUS Status; > - > - mRedfishPlatformConfigPrivate =3D (REDFISH_PLATFORM_CONFIG_PRIVATE > *)AllocateZeroPool (sizeof (REDFISH_PLATFORM_CONFIG_PRIVATE)); > - if (mRedfishPlatformConfigPrivate =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, can not allocate pool for > REDFISH_PLATFORM_CONFIG_PRIVATE\n", __FUNCTION__)); > - ASSERT (FALSE); > - return EFI_OUT_OF_RESOURCES; > - } > - > - // > - // Protocol initialization > - // > - mRedfishPlatformConfigPrivate->ImageHandle =3D ImageHandle; > - mRedfishPlatformConfigPrivate->Protocol.GetValue =3D > RedfishPlatformConfigProtocolGetValue; > - mRedfishPlatformConfigPrivate->Protocol.SetValue =3D > RedfishPlatformConfigProtocolSetValue; > - mRedfishPlatformConfigPrivate->Protocol.GetConfigureLang =3D > RedfishPlatformConfigProtocolGetConfigureLang; > - mRedfishPlatformConfigPrivate->Protocol.GetSupportedSchema =3D > RedfishPlatformConfigProtocolGetSupportedSchema; > - > - InitializeListHead (&mRedfishPlatformConfigPrivate->FormsetList); > - InitializeListHead (&mRedfishPlatformConfigPrivate->PendingList); > - > - Status =3D gBS->InstallProtocolInterface ( > - &ImageHandle, > - &gEdkIIRedfishPlatformConfigProtocolGuid, > - EFI_NATIVE_INTERFACE, > - (VOID*)&mRedfishPlatformConfigPrivate->Protocol > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, can not install > gEdkIIRedfishPlatformConfigProtocolGuid: %r\n", __FUNCTION__, Status)); > - ASSERT (FALSE); > - } > - > - // > - // Install protocol notification if HII database protocol is installed= . > - // > - mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( > - &gEfiHiiDa= tabaseProtocolGuid, > - TPL_CALLBA= CK, > - HiiDatabas= eProtocolInstalled, > - NULL, > - &mRedfishP= latformConfigPrivate- > >HiiDbNotify.Registration > - ); > - if (mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent =3D=3D NU= LL) { > - DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notification for > gEfiHiiDatabaseProtocolGuid\n", __FUNCTION__)); > - ASSERT (FALSE); > - } > - > - // > - // Install protocol notification if HII string protocol is installed. > - // > - mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( > - &gEfiH= iiStringProtocolGuid, > - TPL_CA= LLBACK, > - HiiStr= ingProtocolInstalled, > - NULL, > - &mRedf= ishPlatformConfigPrivate- > >HiiStringNotify.Registration > - ); > - if (mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent =3D= =3D NULL) > { > - DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notification for > gEfiHiiStringProtocolGuid\n", __FUNCTION__)); > - ASSERT (FALSE); > - } > - > - // > - // Install protocol notification if regular expression protocol is ins= talled. > - // > - mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( > - &gEfiRegul= arExpressionProtocolGuid, > - TPL_CALLBA= CK, > - RegexProto= colInstalled, > - NULL, > - &mRedfishP= latformConfigPrivate- > >RegexNotify.Registration > - ); > - if (mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent =3D=3D NU= LL) { > - DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notification for > gEfiRegularExpressionProtocolGuid\n", __FUNCTION__)); > - ASSERT (FALSE); > - } > - > - return EFI_SUCCESS; > -} > +/** @file >=20 > + >=20 > + The implementation of EDKII Redfidh Platform Config Protocol. >=20 > + >=20 > + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > + >=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include "RedfishPlatformConfigDxe.h" >=20 > +#include "RedfishPlatformConfigImpl.h" >=20 > + >=20 > +REDFISH_PLATFORM_CONFIG_PRIVATE *mRedfishPlatformConfigPrivate =3D > NULL; >=20 > + >=20 > + >=20 > +/** >=20 > + Zero extend integer/boolean to UINT64 for comparing. >=20 > + >=20 > + @param Value HII Value to be converted. >=20 > + >=20 > +**/ >=20 > +UINT64 >=20 > +ExtendHiiValueToU64 ( >=20 > + IN HII_STATEMENT_VALUE *Value >=20 > + ) >=20 > +{ >=20 > + UINT64 Temp; >=20 > + >=20 > + Temp =3D 0; >=20 > + switch (Value->Type) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + Temp =3D Value->Value.u8; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + Temp =3D Value->Value.u16; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + Temp =3D Value->Value.u32; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_BOOLEAN: >=20 > + Temp =3D Value->Value.b; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_TIME: >=20 > + case EFI_IFR_TYPE_DATE: >=20 > + default: >=20 > + break; >=20 > + } >=20 > + >=20 > + return Temp; >=20 > +} >=20 > + >=20 > +/** >=20 > + Set value of a data element in an Array by its Index in ordered list b= uffer. >=20 > + >=20 > + @param Array The data array. >=20 > + @param Type Type of the data in this array. >=20 > + @param Index Zero based index for data in this array= . >=20 > + @param Value The value to be set. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +OrderedListSetArrayData ( >=20 > + IN VOID *Array, >=20 > + IN UINT8 Type, >=20 > + IN UINTN Index, >=20 > + IN UINT64 Value >=20 > + ) >=20 > +{ >=20 > + >=20 > + ASSERT (Array !=3D NULL); >=20 > + >=20 > + switch (Type) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + *(((UINT8 *) Array) + Index) =3D (UINT8) Value; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + *(((UINT16 *) Array) + Index) =3D (UINT16) Value; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + *(((UINT32 *) Array) + Index) =3D (UINT32) Value; >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_64: >=20 > + *(((UINT64 *) Array) + Index) =3D (UINT64) Value; >=20 > + break; >=20 > + >=20 > + default: >=20 > + break; >=20 > + } >=20 > +} >=20 > + >=20 > + >=20 > +/** >=20 > + Return data element in an Array by its Index in ordered list array buf= fer. >=20 > + >=20 > + @param Array The data array. >=20 > + @param Type Type of the data in this array. >=20 > + @param Index Zero based index for data in this array= . >=20 > + >=20 > + @retval Value The data to be returned >=20 > + >=20 > +**/ >=20 > +UINT64 >=20 > +OrderedListGetArrayData ( >=20 > + IN VOID *Array, >=20 > + IN UINT8 Type, >=20 > + IN UINTN Index >=20 > + ) >=20 > +{ >=20 > + UINT64 Data; >=20 > + >=20 > + ASSERT (Array !=3D NULL); >=20 > + >=20 > + Data =3D 0; >=20 > + switch (Type) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + Data =3D (UINT64) *(((UINT8 *) Array) + Index); >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + Data =3D (UINT64) *(((UINT16 *) Array) + Index); >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + Data =3D (UINT64) *(((UINT32 *) Array) + Index); >=20 > + break; >=20 > + >=20 > + case EFI_IFR_TYPE_NUM_SIZE_64: >=20 > + Data =3D (UINT64) *(((UINT64 *) Array) + Index); >=20 > + break; >=20 > + >=20 > + default: >=20 > + break; >=20 > + } >=20 > + >=20 > + return Data; >=20 > +} >=20 > + >=20 Please remove the extra blank line. This comment is applied to all code cha= nge in this patch. > + >=20 > +/** >=20 > + Find string ID of option if its value equals to given value. >=20 > + >=20 > + @param[in] HiiStatement Statement to search. >=20 > + @param[in] Value Target value. >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STRING_ID >=20 > +OrderedListOptionValueToStringId ( >=20 > + IN HII_STATEMENT *HiiStatement, >=20 > + IN UINT64 Value >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *Link; >=20 > + HII_QUESTION_OPTION *Option; >=20 > + BOOLEAN Found; >=20 > + UINT64 CurrentValue; >=20 > + >=20 > + if (HiiStatement =3D=3D NULL) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + if (HiiStatement->Operand !=3D EFI_IFR_ORDERED_LIST_OP) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&HiiStatement->OptionListHead)) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + Found =3D FALSE; >=20 > + Link =3D GetFirstNode (&HiiStatement->OptionListHead); >=20 > + while (!IsNull (&HiiStatement->OptionListHead, Link)) { >=20 > + Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > + >=20 > + CurrentValue =3D ExtendHiiValueToU64 (&Option->Value); >=20 > + if (Value =3D=3D CurrentValue) { >=20 > + return Option->Text; >=20 > + } >=20 > + >=20 > + Link =3D GetNextNode (&HiiStatement->OptionListHead, Link); >=20 > + } >=20 > + >=20 > + return 0; >=20 > +} >=20 > + >=20 > +/** >=20 > + Compare two value in HII statement format. >=20 > + >=20 > + @param[in] Value1 Firt value to compare. >=20 > + @param[in] Value2 Second value to be compared. >=20 > + >=20 > + @retval UINTN 0 is retuned when two values are equal. >=20 > + 1 is returned when first value is greater than s= econd value. >=20 > + -1 is returned when second value is greater than= first value. >=20 > + >=20 > +**/ >=20 > +UINTN I think we can define the type of return value as INTN. Then return value o= f 0 means the two values are identical, otherwise returns -1 to the caller.= This is align with the most of compare functions. >=20 > +CompareHiiStatementValue ( >=20 > + IN HII_STATEMENT_VALUE *Value1, >=20 > + IN HII_STATEMENT_VALUE *Value2 >=20 > + ) >=20 > +{ >=20 > + INTN Result; >=20 > + UINT64 Data1; >=20 > + UINT64 Data2; >=20 > + >=20 > + if (Value1 =3D=3D NULL || Value2 =3D=3D NULL) { >=20 > + return 0xFF; >=20 > + } >=20 > + >=20 > + switch (Value1->Type) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + Data1 =3D Value1->Value.u8; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + Data1 =3D Value1->Value.u16; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + Data1 =3D Value1->Value.u32; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_64: >=20 > + Data1 =3D Value1->Value.u64; >=20 > + break; >=20 > + case EFI_IFR_TYPE_BOOLEAN: >=20 > + Data1 =3D (Value1->Value.b ? 1 : 0); >=20 > + break; >=20 > + default: >=20 > + return 0xFF; >=20 > + } >=20 > + >=20 > + switch (Value2->Type) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + Data2 =3D Value2->Value.u8; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + Data2 =3D Value2->Value.u16; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + Data2 =3D Value2->Value.u32; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_64: >=20 > + Data2 =3D Value2->Value.u64; >=20 > + break; >=20 > + case EFI_IFR_TYPE_BOOLEAN: >=20 > + Data2 =3D (Value2->Value.b ? 1 : 0); >=20 > + break; >=20 > + default: >=20 > + return 0xFF; >=20 > + } >=20 > + >=20 > + Result =3D (Data1 =3D=3D Data2 ? 0 : (Data1 > Data2 ? 1 : -1)); >=20 > + >=20 > + return Result; >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert HII value to the string in HII one-of opcode. >=20 > + >=20 > + @param[in] Statement Statement private instance >=20 > + >=20 > + @retval EFI_STRING_ID The string ID in HII database. >=20 > + 0 is returned when something goes wrong. >=20 > + >=20 > +**/ >=20 > +EFI_STRING_ID >=20 > +HiiValueToOneOfOptionStringId ( >=20 > + IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *Link; >=20 > + HII_QUESTION_OPTION *Option; >=20 > + >=20 > + if (Statement->HiiStatement->Operand !=3D EFI_IFR_ONE_OF_OP) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); >=20 > + while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { >=20 > + Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > + >=20 > + if (CompareHiiStatementValue (&Statement->HiiStatement->Value, > &Option->Value) =3D=3D 0) { >=20 > + return Option->Text; >=20 > + } >=20 > + >=20 > + Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); >=20 > + } >=20 > + >=20 > + return 0; >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert HII string to the value in HII one-of opcode. >=20 > + >=20 > + @param[in] Statement Statement private instance >=20 > + @param[in] Schema Schema string >=20 > + @param[in] HiiString Input string >=20 > + @param[out] Value Value returned >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +HiiStringToOneOfOptionValue ( >=20 > + IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING HiiString, >=20 > + OUT HII_STATEMENT_VALUE *Value >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *Link; >=20 > + HII_QUESTION_OPTION *Option; >=20 > + EFI_STRING TmpString; >=20 > + BOOLEAN Found; >=20 > + >=20 > + if (Statement =3D=3D NULL || IS_EMPTY_STRING (HiiString) || Value =3D= =3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (Statement->HiiStatement->Operand !=3D EFI_IFR_ONE_OF_OP) { >=20 > + return EFI_UNSUPPORTED; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + Found =3D FALSE; >=20 > + Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); >=20 > + while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { >=20 > + Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > + >=20 > + TmpString =3D HiiGetRedfishString (Statement->ParentForm- > >ParentFormset->HiiHandle, Schema, Option->Text); >=20 > + if (TmpString !=3D NULL) { >=20 > + if (StrCmp (TmpString, HiiString) =3D=3D 0) { >=20 > + CopyMem (Value, &Option->Value, sizeof (HII_STATEMENT_VALUE)); >=20 > + Found =3D TRUE; >=20 > + } >=20 > + FreePool (TmpString); >=20 > + } >=20 > + >=20 > + if (Found) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); >=20 > + } >=20 > + >=20 > + return EFI_NOT_FOUND; >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert HII value to numeric value in Redfish format. >=20 > + >=20 > + @param[in] Value Value to be converted. >=20 > + @param[out] RedfishValue Value in Redfish format. >=20 > + >=20 > + @retval EFI_SUCCESS Redfish value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +HiiValueToRedfishNumeric ( >=20 > + IN HII_STATEMENT_VALUE *Value, >=20 > + OUT EDKII_REDFISH_VALUE *RedfishValue >=20 > + ) >=20 > +{ >=20 > + if (Value =3D=3D NULL || RedfishValue =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + switch (Value->Type) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; >=20 > + RedfishValue->Value.Integer =3D (INT64)Value->Value.u8; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; >=20 > + RedfishValue->Value.Integer =3D (INT64)Value->Value.u16; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; >=20 > + RedfishValue->Value.Integer =3D (INT64)Value->Value.u32; >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_64: >=20 > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_INTEGER; >=20 > + RedfishValue->Value.Integer =3D (INT64)Value->Value.u64; >=20 > + break; >=20 > + case EFI_IFR_TYPE_BOOLEAN: >=20 > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_BOOLEAN; >=20 > + RedfishValue->Value.Boolean =3D Value->Value.b; >=20 > + break; >=20 > + default: >=20 > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; >=20 > + break; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert numeric value in Redfish format to HII value. >=20 > + >=20 > + @param[in] RedfishValue Value in Redfish format to be converted. >=20 > + @param[out] Value HII value returned. >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +RedfishNumericToHiiValue ( >=20 > + IN EDKII_REDFISH_VALUE *RedfishValue, >=20 > + OUT HII_STATEMENT_VALUE *Value >=20 > + ) >=20 > +{ >=20 > + if (Value =3D=3D NULL || RedfishValue =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + switch (RedfishValue->Type) { >=20 > + case REDFISH_VALUE_TYPE_INTEGER: >=20 > + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_64; >=20 > + Value->Value.u64 =3D (UINT64)RedfishValue->Value.Integer; >=20 > + break; >=20 > + case REDFISH_VALUE_TYPE_BOOLEAN: >=20 > + Value->Type =3D EFI_IFR_TYPE_BOOLEAN; >=20 > + Value->Value.b =3D RedfishValue->Value.Boolean; >=20 > + break; >=20 > + default: >=20 > + Value->Type =3D EFI_IFR_TYPE_UNDEFINED; >=20 > + break; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Dump the value in ordered list buffer. >=20 > + >=20 > + @param[in] OrderedListStatement Ordered list statement. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +DumpOrderedListValue ( >=20 > + IN HII_STATEMENT *OrderedListStatement >=20 > + ) >=20 > +{ >=20 > + UINT8 *Value8; >=20 > + UINT16 *Value16; >=20 > + UINT32 *Value32; >=20 > + UINT64 *Value64; >=20 > + UINTN Count; >=20 > + UINTN Index; >=20 > + >=20 > + if (OrderedListStatement =3D=3D NULL || OrderedListStatement->Operand = !=3D > EFI_IFR_ORDERED_LIST_OP) { >=20 > + return; >=20 > + } >=20 > + >=20 > + DEBUG ((DEBUG_ERROR, "Value.Type=3D 0x%x\n", OrderedListStatement- > >Value.Type)); >=20 > + DEBUG ((DEBUG_ERROR, "Value.BufferValueType=3D 0x%x\n", > OrderedListStatement->Value.BufferValueType)); >=20 > + DEBUG ((DEBUG_ERROR, "Value.BufferLen=3D 0x%x\n", > OrderedListStatement->Value.BufferLen)); >=20 > + DEBUG ((DEBUG_ERROR, "Value.Buffer=3D 0x%x\n", OrderedListStatement- > >Value.Buffer)); >=20 > + DEBUG ((DEBUG_ERROR, "Value.MaxContainers=3D 0x%x\n", > OrderedListStatement->ExtraData.OrderListData.MaxContainers)); >=20 > + DEBUG ((DEBUG_ERROR, "StorageWidth=3D 0x%x\n", > OrderedListStatement->StorageWidth)); >=20 > + >=20 > + if (OrderedListStatement->Value.Buffer =3D=3D NULL) { >=20 > + return; >=20 > + } >=20 > + >=20 > + Value8 =3D NULL; >=20 > + Value16 =3D NULL; >=20 > + Value32 =3D NULL; >=20 > + Value64 =3D NULL; >=20 > + Count =3D 0; >=20 > + >=20 > + switch (OrderedListStatement->Value.BufferValueType) { >=20 > + case EFI_IFR_TYPE_NUM_SIZE_8: >=20 > + Value8 =3D (UINT8 *)OrderedListStatement->Value.Buffer; >=20 > + Count =3D OrderedListStatement->StorageWidth / sizeof (UINT8); >=20 > + for (Index =3D 0; Index < Count; Index++) { >=20 > + DEBUG ((DEBUG_ERROR, "%d ", Value8[Index])); >=20 > + } >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_16: >=20 > + Value16 =3D (UINT16 *)OrderedListStatement->Value.Buffer; >=20 > + Count =3D OrderedListStatement->StorageWidth / sizeof (UINT16); >=20 > + for (Index =3D 0; Index < Count; Index++) { >=20 > + DEBUG ((DEBUG_ERROR, "%d ", Value16[Index])); >=20 > + } >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_32: >=20 > + Value32 =3D (UINT32 *)OrderedListStatement->Value.Buffer; >=20 > + Count =3D OrderedListStatement->StorageWidth / sizeof (UINT32); >=20 > + for (Index =3D 0; Index < Count; Index++) { >=20 > + DEBUG ((DEBUG_ERROR, "%d ", Value32[Index])); >=20 > + } >=20 > + break; >=20 > + case EFI_IFR_TYPE_NUM_SIZE_64: >=20 > + Value64 =3D (UINT64 *)OrderedListStatement->Value.Buffer; >=20 > + Count =3D OrderedListStatement->StorageWidth / sizeof (UINT64); >=20 > + for (Index =3D 0; Index < Count; Index++) { >=20 > + DEBUG ((DEBUG_ERROR, "%d ", Value64[Index])); >=20 > + } >=20 > + break; >=20 > + default: >=20 > + Value8 =3D (UINT8 *)OrderedListStatement->Value.Buffer; >=20 > + Count =3D OrderedListStatement->StorageWidth / sizeof (UINT8); >=20 > + for (Index =3D 0; Index < Count; Index++) { >=20 > + DEBUG ((DEBUG_ERROR, "%d ", Value8[Index])); >=20 > + } >=20 > + break; >=20 > + } >=20 > + >=20 > + DEBUG ((DEBUG_ERROR, "\n")); >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert HII value to the string in HII ordered list opcode. It's calle= r's >=20 > + responsibility to free returned buffer using FreePool(). >=20 > + >=20 > + @param[in] Statement Statement private instance >=20 > + @param[out] ReturnSize The size of returned array >=20 > + >=20 > + @retval EFI_STRING_ID The string ID array for options in ordered l= ist. >=20 > + >=20 > +**/ >=20 > +EFI_STRING_ID * >=20 > +HiiValueToOrderedListOptionStringId ( >=20 > + IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement, >=20 > + OUT UINTN *ReturnSize >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *Link; >=20 > + HII_QUESTION_OPTION *Option; >=20 > + UINTN OptionCount; >=20 > + EFI_STRING_ID *ReturnedArray; >=20 > + UINTN Index; >=20 > + UINT64 Value; >=20 > + >=20 > + if (Statement =3D=3D NULL || ReturnSize =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + *ReturnSize =3D 0; >=20 > + >=20 > + if (Statement->HiiStatement->Operand !=3D EFI_IFR_ORDERED_LIST_OP) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + DEBUG_CODE ( >=20 > + DumpOrderedListValue (Statement->HiiStatement); >=20 > + ); >=20 > + >=20 > + OptionCount =3D 0; >=20 > + Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); >=20 > + while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { >=20 > + Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > + >=20 > + ++OptionCount; >=20 > + >=20 > + Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); >=20 > + } >=20 > + >=20 > + *ReturnSize =3D OptionCount; >=20 > + ReturnedArray =3D AllocatePool (sizeof (EFI_STRING_ID) * OptionCount); >=20 > + if (ReturnedArray =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__)); >=20 > + *ReturnSize =3D 0; >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + for (Index =3D 0; Index < OptionCount; Index++) { >=20 > + Value =3D OrderedListGetArrayData (Statement->HiiStatement- > >Value.Buffer, Statement->HiiStatement->Value.BufferValueType, Index); >=20 > + ReturnedArray[Index] =3D OrderedListOptionValueToStringId (Statement= - > >HiiStatement, Value); >=20 > + } >=20 > + >=20 > + return ReturnedArray; >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert HII string to the value in HII ordered list opcode. >=20 > + >=20 > + @param[in] Statement Statement private instance >=20 > + @param[in] Schema Schema string >=20 > + @param[in] HiiString Input string >=20 > + @param[out] Value Value returned >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +HiiStringToOrderedListOptionValue ( >=20 > + IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING HiiString, >=20 > + OUT UINT64 *Value >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *Link; >=20 > + HII_QUESTION_OPTION *Option; >=20 > + EFI_STRING TmpString; >=20 > + BOOLEAN Found; >=20 > + >=20 > + if (Statement =3D=3D NULL || IS_EMPTY_STRING (HiiString) || Value =3D= =3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + *Value =3D 0; >=20 > + >=20 > + if (Statement->HiiStatement->Operand !=3D EFI_IFR_ORDERED_LIST_OP) { >=20 > + return EFI_UNSUPPORTED; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + Found =3D FALSE; >=20 > + Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); >=20 > + while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { >=20 > + Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > + >=20 > + TmpString =3D HiiGetRedfishString (Statement->ParentForm- > >ParentFormset->HiiHandle, Schema, Option->Text); >=20 > + if (TmpString !=3D NULL) { >=20 > + if (StrCmp (TmpString, HiiString) =3D=3D 0) { >=20 > + *Value =3D ExtendHiiValueToU64 (&Option->Value); >=20 > + Found =3D TRUE; >=20 > + } >=20 > + FreePool (TmpString); >=20 > + } >=20 > + >=20 > + if (Found) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); >=20 > + } >=20 > + >=20 > + return EFI_NOT_FOUND; >=20 > +} >=20 > + >=20 > +/** >=20 > + Convert input ascii string to unicode string. It's caller's >=20 > + responsibility to free returned buffer using FreePool(). >=20 > + >=20 > + @param[in] AsciiString Ascii string to be converted. >=20 > + >=20 > + @retval CHAR16 * Unicode string on return. >=20 > + >=20 > +**/ >=20 > +EFI_STRING >=20 > +StrToUnicodeStr ( >=20 > + IN CHAR8 *AsciiString >=20 > + ) >=20 > +{ >=20 > + UINTN StringLen; >=20 > + EFI_STRING Buffer; >=20 > + EFI_STATUS Status; >=20 > + >=20 > + if (AsciiString =3D=3D NULL || AsciiString[0] =3D=3D '\0') { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + StringLen =3D AsciiStrLen (AsciiString) + 1; >=20 > + Buffer =3D AllocatePool (StringLen * sizeof (CHAR16)); >=20 > + if (Buffer =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + Status =3D AsciiStrToUnicodeStrS (AsciiString, Buffer, StringLen); >=20 > + if (EFI_ERROR (Status)) { >=20 > + FreePool (Buffer); >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + return Buffer; >=20 > +} >=20 > + >=20 > + >=20 > +/** >=20 > + Return the full Redfish schema string from the given Schema and Versio= n. >=20 > + >=20 > + Returned schema string is: Schema + '.' + Version >=20 > + >=20 > + @param[in] Schema Schema string >=20 > + @param[in] Version Schema version string >=20 > + >=20 > + @retval CHAR8 * Schema string. NULL when errors occur. >=20 > + >=20 > +**/ >=20 > +CHAR8 * >=20 > +GetFullSchemaString ( >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version >=20 > + ) >=20 > +{ >=20 > + UINTN Size; >=20 > + CHAR8 *FullName; >=20 > + >=20 > + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version)) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + Size =3D AsciiStrSize(CONFIGURE_LANGUAGE_PREFIX) + AsciiStrSize > (Schema) + AsciiStrSize (Version); >=20 > + >=20 > + FullName =3D AllocatePool (Size); >=20 > + if (FullName =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, out-of-resource\n", __FUNCTION__)); >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + AsciiSPrint (FullName, Size, "%a%a.%a", CONFIGURE_LANGUAGE_PREFIX, > Schema, Version); >=20 > + >=20 > + return FullName; >=20 > +} >=20 > + >=20 > +/** >=20 > + Common implementation to get statement private instance. >=20 > + >=20 > + @param[in] RedfishPlatformConfigPrivate Private instance. >=20 > + @param[in] Schema Redfish schema string. >=20 > + @param[in] ConfigureLang Configure language that re= fers to this > statement. >=20 > + @param[out] Statement Statement instance >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +RedfishPlatformConfigGetStatementCommon ( >=20 > + IN REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING ConfigureLang, >=20 > + OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE **Statement >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; >=20 > + >=20 > + if (RedfishPlatformConfigPrivate =3D=3D NULL || IS_EMPTY_STRING (Schem= a) > || IS_EMPTY_STRING (ConfigureLang) || Statement =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + *Statement =3D NULL; >=20 > + >=20 > + Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + TargetStatement =3D GetStatementPrivateByConfigureLang > (&RedfishPlatformConfigPrivate->FormsetList, Schema, ConfigureLang); >=20 > + if (TargetStatement =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, No match HII statement is found by the > given %s in schema %a\n", __FUNCTION__, ConfigureLang, Schema)); >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + // >=20 > + // Find current HII question value. >=20 > + // >=20 > + Status =3D GetQuestionValue ( >=20 > + TargetStatement->ParentForm->ParentFormset->HiiFormSet, >=20 > + TargetStatement->ParentForm->HiiForm, >=20 > + TargetStatement->HiiStatement, >=20 > + GetSetValueWithHiiDriver >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to get question current value: %r\n= ", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + >=20 > + if (TargetStatement->HiiStatement->Value.Type =3D=3D > EFI_IFR_TYPE_UNDEFINED) { >=20 > + return EFI_DEVICE_ERROR; >=20 > + } >=20 > + >=20 > + // >=20 > + // Return Value. >=20 > + // >=20 > + *Statement =3D TargetStatement; >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get Redfish value with the given Schema and Configure Language. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] Schema The Redfish schema to query. >=20 > + @param[in] Version The Redfish version to query. >=20 > + @param[in] ConfigureLang The target value which match this con= figure > Language. >=20 > + @param[out] Value The returned value. >=20 > + >=20 > + @retval EFI_SUCCESS Value is returned successfully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigProtocolGetValue ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version, >=20 > + IN EFI_STRING ConfigureLang, >=20 > + OUT EDKII_REDFISH_VALUE *Value >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; >=20 > + EFI_STRING_ID StringId; >=20 > + EFI_STRING_ID *StringIdArray; >=20 > + CHAR8 *FullSchema; >=20 > + EFI_STRING HiiString; >=20 > + UINTN Count; >=20 > + UINTN Index; >=20 > + >=20 > + if (This =3D=3D NULL || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || IS_EMPTY_STRING (ConfigureLang) || Value =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); >=20 > + Value->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; >=20 > + Value->ArrayCount =3D 0; >=20 > + Count =3D 0; >=20 > + FullSchema =3D NULL; >=20 > + HiiString =3D NULL; >=20 > + StringIdArray =3D NULL; >=20 > + >=20 > + FullSchema =3D GetFullSchemaString (Schema, Version); >=20 > + if (FullSchema =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + Status =3D RedfishPlatformConfigGetStatementCommon > (RedfishPlatformConfigPrivate, FullSchema, ConfigureLang, > &TargetStatement); >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + switch (TargetStatement->HiiStatement->Operand) { >=20 > + case EFI_IFR_ONE_OF_OP: >=20 > + StringId =3D HiiValueToOneOfOptionStringId (TargetStatement); >=20 > + if (StringId =3D=3D 0) { >=20 > + ASSERT (FALSE); >=20 > + Status =3D EFI_DEVICE_ERROR; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + Value->Value.Buffer =3D HiiGetRedfishAsciiString (TargetStatement- > >ParentForm->ParentFormset->HiiHandle, FullSchema, StringId); >=20 > + if (Value->Value.Buffer =3D=3D NULL) { >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + Value->Type =3D REDFISH_VALUE_TYPE_STRING; >=20 > + break; >=20 > + case EFI_IFR_STRING_OP: >=20 > + if (TargetStatement->HiiStatement->Value.Type !=3D > EFI_IFR_TYPE_STRING) { >=20 > + ASSERT (FALSE); >=20 > + Status =3D EFI_DEVICE_ERROR; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + Value->Type =3D REDFISH_VALUE_TYPE_STRING; >=20 > + Value->Value.Buffer =3D AllocateCopyPool (StrSize ((CHAR16 > *)TargetStatement->HiiStatement->Value.Buffer), TargetStatement- > >HiiStatement->Value.Buffer); >=20 > + if (Value->Value.Buffer =3D=3D NULL) { >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + break; >=20 > + case EFI_IFR_CHECKBOX_OP: >=20 > + case EFI_IFR_NUMERIC_OP: >=20 > + Status =3D HiiValueToRedfishNumeric (&TargetStatement->HiiStatemen= t- > >Value, Value); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to convert HII value to Redfish > value: %r\n", __FUNCTION__, Status)); >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + break; >=20 > + case EFI_IFR_ACTION_OP: >=20 > + if (TargetStatement->HiiStatement->Value.Type !=3D > EFI_IFR_TYPE_ACTION) { >=20 > + ASSERT (FALSE); >=20 > + Status =3D EFI_DEVICE_ERROR; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + // >=20 > + // Action has no value. Just return unknown type. >=20 > + // >=20 > + Value->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; >=20 > + break; >=20 > + case EFI_IFR_ORDERED_LIST_OP: >=20 > + StringIdArray =3D HiiValueToOrderedListOptionStringId (TargetState= ment, > &Count); >=20 > + if (StringIdArray =3D=3D NULL) { >=20 > + ASSERT (FALSE); >=20 > + Status =3D EFI_DEVICE_ERROR; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + Value->Value.StringArray =3D AllocatePool (sizeof (CHAR8 *) * Coun= t); >=20 > + if (Value->Value.StringArray =3D=3D NULL) { >=20 > + ASSERT (FALSE); >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + for (Index =3D 0; Index < Count; Index++) { >=20 > + ASSERT (StringIdArray[Index] !=3D 0); >=20 > + Value->Value.StringArray[Index] =3D HiiGetRedfishAsciiString > (TargetStatement->ParentForm->ParentFormset->HiiHandle, FullSchema, > StringIdArray[Index]); >=20 > + } >=20 > + >=20 > + Value->ArrayCount =3D Count; >=20 > + Value->Type =3D REDFISH_VALUE_TYPE_STRING_ARRAY; >=20 > + break; >=20 > + default: >=20 > + DEBUG ((DEBUG_ERROR, "%a, catch unsupported type: 0x%x! Please > contact with author if we need to support this type.\n", __FUNCTION__, > TargetStatement->HiiStatement->Operand)); >=20 > + ASSERT (FALSE); >=20 > + Status =3D EFI_UNSUPPORTED; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > +RELEASE_RESOURCE: >=20 > + >=20 > + if (FullSchema !=3D NULL) { >=20 > + FreePool (FullSchema); >=20 > + } >=20 > + >=20 > + if (HiiString !=3D NULL) { >=20 > + FreePool (HiiString); >=20 > + } >=20 > + >=20 > + if (StringIdArray !=3D NULL) { >=20 > + FreePool (StringIdArray); >=20 > + } >=20 > + >=20 > + return Status; >=20 > +} >=20 > + >=20 > +/** >=20 > + Function to save question value into HII database. >=20 > + >=20 > + @param[in] HiiFormset HII form-set instance >=20 > + @param[in] HiiForm HII form instance >=20 > + @param[in] HiiStatement HII statement that keeps new value. >=20 > + @param[in] Value New value to applyu. >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +RedfishPlatformConfigSaveQuestionValue ( >=20 > + IN HII_FORMSET *HiiFormset, >=20 > + IN HII_FORM *HiiForm, >=20 > + IN HII_STATEMENT *HiiStatement, >=20 > + IN HII_STATEMENT_VALUE *Value >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + if (HiiFormset =3D=3D NULL || HiiForm =3D=3D NULL || HiiStatement =3D= =3D NULL || > Value =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + Status =3D SetQuestionValue ( >=20 > + HiiFormset, >=20 > + HiiForm, >=20 > + HiiStatement, >=20 > + Value >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to set question value: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + Status =3D SubmitForm (HiiFormset, HiiForm); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to submit form: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Common implementation to set statement private instance. >=20 > + >=20 > + @param[in] RedfishPlatformConfigPrivate Private instance. >=20 > + @param[in] Schema Redfish schema string. >=20 > + @param[in] ConfigureLang Configure language that re= fers to this > statement. >=20 > + @param[in] Statement Statement instance >=20 > + >=20 > + @retval EFI_SUCCESS HII value is returned successfully. >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +RedfishPlatformConfigSetStatementCommon ( >=20 > + IN REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING ConfigureLang, >=20 > + IN HII_STATEMENT_VALUE *StatementValue >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; >=20 > + EFI_STRING TempBuffer; >=20 > + UINT8 *StringArray; >=20 > + UINTN Index; >=20 > + UINT64 Value; >=20 > + CHAR8 **CharArray; >=20 > + >=20 > + if (RedfishPlatformConfigPrivate =3D=3D NULL || IS_EMPTY_STRING (Schem= a) > || IS_EMPTY_STRING (ConfigureLang) || StatementValue =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + TempBuffer =3D NULL; >=20 > + StringArray =3D NULL; >=20 > + >=20 > + Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + TargetStatement =3D GetStatementPrivateByConfigureLang > (&RedfishPlatformConfigPrivate->FormsetList, Schema, ConfigureLang); >=20 > + if (TargetStatement =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, No match HII statement is found by the > given %s in schema %a\n", __FUNCTION__, ConfigureLang, Schema)); >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + if (StatementValue->Type !=3D TargetStatement->HiiStatement- > >Value.Type) { >=20 > + // >=20 > + // We treat one-of type as string in Redfish. But one-of statement i= s not >=20 > + // in string format from HII point of view. Do a patch here. >=20 > + // >=20 > + if (TargetStatement->HiiStatement->Operand =3D=3D EFI_IFR_ONE_OF_OP > && StatementValue->Type =3D=3D EFI_IFR_TYPE_STRING) { >=20 > + >=20 > + TempBuffer =3D StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer); >=20 > + if (TempBuffer =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + FreePool (StatementValue->Buffer); >=20 > + StatementValue->Buffer =3D NULL; >=20 > + StatementValue->BufferLen =3D 0; >=20 > + >=20 > + Status =3D HiiStringToOneOfOptionValue (TargetStatement, Schema, > TempBuffer, StatementValue); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to find option value by the giv= en > %s\n", __FUNCTION__, TempBuffer)); >=20 > + FreePool (TempBuffer); >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + FreePool (TempBuffer); >=20 > + } else if (TargetStatement->HiiStatement->Operand =3D=3D > EFI_IFR_ORDERED_LIST_OP && StatementValue->Type =3D=3D > EFI_IFR_TYPE_STRING) { >=20 > + // >=20 > + // We treat ordered list type as string in Redfish. But ordered li= st > statement is not >=20 > + // in string format from HII point of view. Do a patch here. >=20 > + // >=20 > + StringArray =3D AllocateZeroPool (TargetStatement->HiiStatement- > >StorageWidth); >=20 > + if (StringArray =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + // >=20 > + // Arrage new option order from input string array >=20 > + // >=20 > + CharArray =3D (CHAR8 **)StatementValue->Buffer; >=20 > + for (Index =3D 0; Index < StatementValue->BufferLen; Index++) { >=20 > + TempBuffer =3D StrToUnicodeStr (CharArray[Index]); >=20 > + if (TempBuffer =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + Status =3D HiiStringToOrderedListOptionValue (TargetStatement, S= chema, > TempBuffer, &Value); >=20 > + if (EFI_ERROR (Status)) { >=20 > + ASSERT (FALSE); >=20 > + continue; >=20 > + } >=20 > + FreePool (TempBuffer); >=20 > + OrderedListSetArrayData (StringArray, TargetStatement->HiiStatem= ent- > >Value.BufferValueType, Index, Value); >=20 > + } >=20 > + >=20 > + StatementValue->Type =3D EFI_IFR_TYPE_BUFFER; >=20 > + StatementValue->Buffer =3D StringArray; >=20 > + StatementValue->BufferLen =3D TargetStatement->HiiStatement- > >StorageWidth; >=20 > + StatementValue->BufferValueType =3D TargetStatement->HiiStatement- > >Value.BufferValueType; >=20 > + } else if (TargetStatement->HiiStatement->Operand =3D=3D > EFI_IFR_NUMERIC_OP && StatementValue->Type =3D=3D > EFI_IFR_TYPE_NUM_SIZE_64) { >=20 > + // >=20 > + // Redfish only has numeric value type and it does not care about = the > value size. >=20 > + // Do a patch here so we have proper value size applied. >=20 > + // >=20 > + StatementValue->Type =3D TargetStatement->HiiStatement->Value.Type= ; >=20 > + } else { >=20 > + DEBUG ((DEBUG_ERROR, "%a, catch value type mismatch! input type: > 0x%x but target value type: 0x%x\n", __FUNCTION__, StatementValue- > >Type, TargetStatement->HiiStatement->Value.Type)); >=20 > + ASSERT (FALSE); >=20 > + } >=20 > + } >=20 > + >=20 > + Status =3D RedfishPlatformConfigSaveQuestionValue ( >=20 > + TargetStatement->ParentForm->ParentFormset->HiiFormSet, >=20 > + TargetStatement->ParentForm->HiiForm, >=20 > + TargetStatement->HiiStatement, >=20 > + StatementValue >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to save question value: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Set Redfish value with the given Schema and Configure Language. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] Schema The Redfish schema to query. >=20 > + @param[in] Version The Redfish version to query. >=20 > + @param[in] ConfigureLang The target value which match this con= figure > Language. >=20 > + @param[in] Value The value to set. >=20 > + >=20 > + @retval EFI_SUCCESS Value is returned successfully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigProtocolSetValue ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version, >=20 > + IN EFI_STRING ConfigureLang, >=20 > + IN EDKII_REDFISH_VALUE Value >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; >=20 > + CHAR8 *FullSchema; >=20 > + HII_STATEMENT_VALUE NewValue; >=20 > + >=20 > + if (This =3D=3D NULL || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || IS_EMPTY_STRING (ConfigureLang)) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (Value.Type =3D=3D REDFISH_VALUE_TYPE_UNKNOWN || Value.Type >=3D > REDFISH_VALUE_TYPE_MAX) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); >=20 > + FullSchema =3D NULL; >=20 > + >=20 > + FullSchema =3D GetFullSchemaString (Schema, Version); >=20 > + if (FullSchema =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + ZeroMem (&NewValue, sizeof (HII_STATEMENT_VALUE)); >=20 > + >=20 > + switch (Value.Type) { >=20 > + case REDFISH_VALUE_TYPE_INTEGER: >=20 > + case REDFISH_VALUE_TYPE_BOOLEAN: >=20 > + Status =3D RedfishNumericToHiiValue (&Value, &NewValue); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to convert Redfish value to Hii > value: %r\n", __FUNCTION__, Status)); >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + break; >=20 > + case REDFISH_VALUE_TYPE_STRING: >=20 > + NewValue.Type =3D EFI_IFR_TYPE_STRING; >=20 > + NewValue.BufferLen =3D (UINT16)AsciiStrSize (Value.Value.Buffer); >=20 > + NewValue.Buffer =3D AllocateCopyPool (NewValue.BufferLen, > Value.Value.Buffer); >=20 > + if (NewValue.Buffer =3D=3D NULL) { >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + break; >=20 > + case REDFISH_VALUE_TYPE_STRING_ARRAY: >=20 > + NewValue.Type =3D EFI_IFR_TYPE_STRING; >=20 > + NewValue.BufferLen =3D (UINT16)Value.ArrayCount; >=20 > + NewValue.Buffer =3D (UINT8 *)Value.Value.StringArray; >=20 > + break; >=20 > + default: >=20 > + ASSERT (FALSE); >=20 > + break; >=20 > + } >=20 > + >=20 > + Status =3D RedfishPlatformConfigSetStatementCommon > (RedfishPlatformConfigPrivate, FullSchema, ConfigureLang, &NewValue); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to set value to statement: %r\n", > __FUNCTION__, Status)); >=20 > + } >=20 > + >=20 > +RELEASE_RESOURCE: >=20 > + >=20 > + if (FullSchema !=3D NULL) { >=20 > + FreePool (FullSchema); >=20 > + } >=20 > + >=20 > + return Status; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get the list of Configure Language from platform configuration by the > given Schema and Pattern. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] Schema The Redfish schema to query. >=20 > + @param[in] Version The Redfish version to query. >=20 > + @param[in] Pattern The target Configure Language pattern= . We can rename Pattern to RegexPattern and have the clear description that m= entions this pattern is used for regular expression. >=20 > + @param[out] ConfigureLangList The list of Configure Language. >=20 > + @param[out] Count The number of Configure Language in > ConfigureLangList. >=20 > + >=20 > + @retval EFI_SUCCESS ConfigureLangList is returned success= fully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigProtocolGetConfigureLang ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN CHAR8 *Schema, >=20 > + IN CHAR8 *Version, >=20 > + IN EFI_STRING Pattern, >=20 > + OUT EFI_STRING **ConfigureLangList, >=20 > + OUT UINTN *Count >=20 > + ) >=20 > +{ >=20 > + REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST StatementList; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF > *StatementRef; >=20 > + LIST_ENTRY *NextLink; >=20 > + EFI_STRING TmpString; >=20 > + EFI_STRING *TmpConfigureLangList; >=20 > + UINTN Index; >=20 > + CHAR8 *FullSchema; >=20 > + >=20 > + if (This =3D=3D NULL || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || Count =3D=3D NULL || ConfigureLangList =3D=3D NULL || > IS_EMPTY_STRING (Pattern)) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + *Count =3D 0; >=20 > + *ConfigureLangList =3D NULL; >=20 > + FullSchema =3D NULL; >=20 > + RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); >=20 > + >=20 > + Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + FullSchema =3D GetFullSchemaString (Schema, Version); >=20 > + if (FullSchema =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + Status =3D GetStatementPrivateByConfigureLangRegex ( >=20 > + RedfishPlatformConfigPrivate->RegularExpressionProtocol, >=20 > + &RedfishPlatformConfigPrivate->FormsetList, >=20 > + FullSchema, >=20 > + Pattern, >=20 > + &StatementList >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, > GetStatementPrivateByConfigureLangRegex failure: %r\n", __FUNCTION__, > Status)); >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + if (!IsListEmpty (&StatementList.StatementList)) { >=20 > + >=20 > + TmpConfigureLangList =3D AllocateZeroPool (sizeof (CHAR16 *) * > StatementList.Count); >=20 > + if (TmpConfigureLangList =3D=3D NULL) { >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto RELEASE_RESOURCE; >=20 > + } >=20 > + >=20 > + Index =3D 0; >=20 > + NextLink =3D GetFirstNode (&StatementList.StatementList); >=20 > + while (!IsNull (&StatementList.StatementList, NextLink)) { >=20 > + StatementRef =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK (NextLink); >=20 > + NextLink =3D GetNextNode (&StatementList.StatementList, NextLink); >=20 > + >=20 > + ASSERT (StatementRef->Statement->Description !=3D 0); >=20 > + if (StatementRef->Statement->Description !=3D 0) { >=20 > + TmpString =3D HiiGetRedfishString (StatementRef->Statement- > >ParentForm->ParentFormset->HiiHandle, FullSchema, StatementRef- > >Statement->Description); >=20 > + ASSERT (TmpString !=3D NULL); >=20 > + if (TmpString !=3D NULL) { >=20 > + TmpConfigureLangList[Index] =3D AllocateCopyPool (StrSize (Tmp= String), > TmpString); >=20 > + ASSERT (TmpConfigureLangList[Index] !=3D NULL); >=20 > + FreePool (TmpString); >=20 > + ++Index; >=20 > + } >=20 > + } >=20 > + } >=20 > + } >=20 > + >=20 > + *Count =3D StatementList.Count; >=20 > + *ConfigureLangList =3D TmpConfigureLangList; >=20 > + >=20 > +RELEASE_RESOURCE: >=20 > + >=20 > + if (FullSchema !=3D NULL) { >=20 > + FreePool (FullSchema); >=20 > + } >=20 > + >=20 > + ReleaseStatementList (&StatementList); >=20 > + >=20 > + return Status; >=20 > +} >=20 > + >=20 > + >=20 > +/** >=20 > + Get the list of supported Redfish schema from paltform configuration o= n > give HII handle. >=20 > + >=20 > + @param[in] This Pointer to > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance. >=20 > + @param[in] HiiHandle The target handle to search. If handl= e is NULL, >=20 > + this function return all schema from = HII database. >=20 > + @param[out] SupportedSchema The supported schema list which is > separated by ';'. >=20 > + The SupportedSchema is allocated by t= he callee. It's > caller's >=20 > + responsibility to free this buffer us= ing FreePool(). >=20 > + >=20 > + @retval EFI_SUCCESS Schema is returned successfully. >=20 > + @retval Others Some error happened. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigProtocolGetSupportedSchema ( >=20 > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, >=20 > + IN EFI_HII_HANDLE HiiHandle, OPTIO= NAL >=20 > + OUT CHAR8 **SupportedSchema >=20 > + ) >=20 > +{ >=20 > + REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; >=20 > + EFI_STATUS Status; >=20 > + LIST_ENTRY *HiiFormsetLink; >=20 > + LIST_ENTRY *HiiFormsetNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; >=20 > + UINTN Index; >=20 > + UINTN StringSize; >=20 > + CHAR8 *StringBuffer; >=20 > + UINTN StringIndex; >=20 > + >=20 > + if (This =3D=3D NULL || SupportedSchema =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + *SupportedSchema =3D NULL; >=20 > + >=20 > + RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); >=20 > + >=20 > + Status =3D ProcessPendingList (&RedfishPlatformConfigPrivate->FormsetL= ist, > &RedfishPlatformConfigPrivate->PendingList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, ProcessPendingList failure: %r\n", > __FUNCTION__, Status)); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&RedfishPlatformConfigPrivate->FormsetList)) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + // >=20 > + // Calculate for string buffer size. >=20 > + // >=20 > + StringSize =3D 0; >=20 > + HiiFormsetLink =3D GetFirstNode (&RedfishPlatformConfigPrivate- > >FormsetList); >=20 > + while (!IsNull (&RedfishPlatformConfigPrivate->FormsetList, > HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (&RedfishPlatformConfigPrivate- > >FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + if (HiiHandle !=3D NULL && HiiHandle !=3D HiiFormsetPrivate->HiiHand= le) { >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + continue; >=20 > + } >=20 > + >=20 > + if (HiiFormsetPrivate->SupportedSchema.Count > 0) { >=20 > + for (Index =3D 0; Index < HiiFormsetPrivate->SupportedSchema.Count= ; > Index++) { >=20 > + StringSize +=3D AsciiStrSize (HiiFormsetPrivate- > >SupportedSchema.SchemaList[Index]); >=20 > + } >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + if (StringSize =3D=3D 0) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + StringBuffer =3D AllocatePool (StringSize); >=20 > + if (StringBuffer =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + StringIndex =3D 0; >=20 > + HiiFormsetLink =3D GetFirstNode (&RedfishPlatformConfigPrivate- > >FormsetList); >=20 > + while (!IsNull (&RedfishPlatformConfigPrivate->FormsetList, > HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (&RedfishPlatformConfigPrivate- > >FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + if (HiiHandle !=3D NULL && HiiHandle !=3D HiiFormsetPrivate->HiiHand= le) { >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + continue; >=20 > + } >=20 > + >=20 > + if (HiiFormsetPrivate->SupportedSchema.Count > 0) { >=20 > + for (Index =3D 0; Index < HiiFormsetPrivate->SupportedSchema.Count= ; > Index++) { >=20 > + AsciiStrCpyS (&StringBuffer[StringIndex], (StringSize - StringIn= dex), > HiiFormsetPrivate->SupportedSchema.SchemaList[Index]); >=20 > + StringIndex +=3D AsciiStrLen (HiiFormsetPrivate- > >SupportedSchema.SchemaList[Index]); >=20 > + StringBuffer[StringIndex] =3D ';'; >=20 > + ++StringIndex; >=20 > + } >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + StringBuffer[--StringIndex] =3D '\0'; >=20 > + >=20 > + *SupportedSchema =3D StringBuffer; >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Functions which are registered to receive notification of >=20 > + database events have this prototype. The actual event is encoded >=20 > + in NotifyType. The following table describes how PackageType, >=20 > + PackageGuid, Handle, and Package are used for each of the >=20 > + notification types. >=20 > + >=20 > + @param[in] PackageType Package type of the notification. >=20 > + @param[in] PackageGuid If PackageType is >=20 > + EFI_HII_PACKAGE_TYPE_GUID, then this is >=20 > + the pointer to the GUID from the Guid >=20 > + field of EFI_HII_PACKAGE_GUID_HEADER. >=20 > + Otherwise, it must be NULL. >=20 > + @param[in] Package Points to the package referred to by the >=20 > + notification Handle The handle of the package >=20 > + list which contains the specified package. >=20 > + @param[in] Handle The HII handle. >=20 > + @param[in] NotifyType The type of change concerning the >=20 > + database. See >=20 > + EFI_HII_DATABASE_NOTIFY_TYPE. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigFormUpdateNotify ( >=20 > + IN UINT8 PackageType, >=20 > + IN CONST EFI_GUID *PackageGuid, >=20 > + IN CONST EFI_HII_PACKAGE_HEADER *Package, >=20 > + IN EFI_HII_HANDLE Handle, >=20 > + IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + if (NotifyType =3D=3D EFI_HII_DATABASE_NOTIFY_NEW_PACK || NotifyType > =3D=3D EFI_HII_DATABASE_NOTIFY_ADD_PACK) { >=20 > + // >=20 > + // HII formset on this handle is updated by driver during run-time. = The > formset needs to be reloaded. >=20 > + // >=20 > + Status =3D NotifyFormsetUpdate (Handle, > &mRedfishPlatformConfigPrivate->PendingList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to notify updated formset of HII > handle: 0x%x\n", __FUNCTION__, Handle)); >=20 > + return Status; >=20 > + } >=20 > + } else if (NotifyType =3D=3D EFI_HII_DATABASE_NOTIFY_REMOVE_PACK) { >=20 > + // >=20 > + // HII resource is removed. The formset is no longer exist. >=20 > + // >=20 > + Status =3D NotifyFormsetDeleted (Handle, > &mRedfishPlatformConfigPrivate->PendingList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to notify deleted formset of HII > handle: 0x%x\n", __FUNCTION__, Handle)); >=20 > + return Status; >=20 > + } >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + This is a EFI_HII_STRING_PROTOCOL notification event handler. >=20 > + >=20 > + Install HII package notification. >=20 > + >=20 > + @param[in] Event Event whose notification function is being invoked= . >=20 > + @param[in] Context Pointer to the notification function's context. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +HiiStringProtocolInstalled ( >=20 > + IN EFI_EVENT Event, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + // >=20 > + // Locate HII database protocol. >=20 > + // >=20 > + Status =3D gBS->LocateProtocol ( >=20 > + &gEfiHiiStringProtocolGuid, >=20 > + NULL, >=20 > + (VOID **)&mRedfishPlatformConfigPrivate->HiiString >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, locate EFI_HII_STRING_PROTOCOL failure: > %r\n", __FUNCTION__, Status)); >=20 > + return; >=20 > + } >=20 > + >=20 > + gBS->CloseEvent (Event); >=20 > + mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent =3D NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + This is a EFI_HII_DATABASE_PROTOCOL notification event handler. >=20 > + >=20 > + Install HII package notification. >=20 > + >=20 > + @param[in] Event Event whose notification function is being invoked= . >=20 > + @param[in] Context Pointer to the notification function's context. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +HiiDatabaseProtocolInstalled ( >=20 > + IN EFI_EVENT Event, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + // >=20 > + // Locate HII database protocol. >=20 > + // >=20 > + Status =3D gBS->LocateProtocol ( >=20 > + &gEfiHiiDatabaseProtocolGuid, >=20 > + NULL, >=20 > + (VOID **)&mRedfishPlatformConfigPrivate->HiiDatabase >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, locate EFI_HII_DATABASE_PROTOCOL > failure: %r\n", __FUNCTION__, Status)); >=20 > + return; >=20 > + } >=20 > + >=20 > + // >=20 > + // Register package notification when new form package is installed. >=20 > + // >=20 > + Status =3D mRedfishPlatformConfigPrivate->HiiDatabase- > >RegisterPackageNotify ( >=20 > + mRedfishPlatformConfigPriva= te->HiiDatabase, >=20 > + EFI_HII_PACKAGE_FORMS, >=20 > + NULL, >=20 > + RedfishPlatformConfigFormUp= dateNotify, >=20 > + EFI_HII_DATABASE_NOTIFY_NEW= _PACK, >=20 > + &mRedfishPlatformConfigPriv= ate->NotifyHandle >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, RegisterPackageNotify for > EFI_HII_DATABASE_NOTIFY_NEW_PACK failure: %r\n", __FUNCTION__, > Status)); >=20 > + } >=20 > + >=20 > + // >=20 > + // Register package notification when new form package is updated. >=20 > + // >=20 > + Status =3D mRedfishPlatformConfigPrivate->HiiDatabase- > >RegisterPackageNotify ( >=20 > + mRedfishPlatformConfigPriva= te->HiiDatabase, >=20 > + EFI_HII_PACKAGE_FORMS, >=20 > + NULL, >=20 > + RedfishPlatformConfigFormUp= dateNotify, >=20 > + EFI_HII_DATABASE_NOTIFY_ADD= _PACK, >=20 > + &mRedfishPlatformConfigPriv= ate->NotifyHandle >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, RegisterPackageNotify for > EFI_HII_DATABASE_NOTIFY_NEW_PACK failure: %r\n", __FUNCTION__, > Status)); >=20 > + } >=20 > + >=20 > +#if REDFISH_PLATFORM_CONFIG_DELETE_EXPIRED_FORMSET The default value is 0 for this macro so can we just remove this code? Or u= se the PCD if this is a configurable variable. Then platform can enable/dis= able this feature in platform DSC file. Abner >=20 > + // >=20 > + // Register package notification when new form package is removed. >=20 > + // >=20 > + Status =3D mRedfishPlatformConfigPrivate->HiiDatabase- > >RegisterPackageNotify ( >=20 > + mRedfishPlatformConfigPriva= te->HiiDatabase, >=20 > + EFI_HII_PACKAGE_FORMS, >=20 > + NULL, >=20 > + RedfishPlatformConfigFormUp= dateNotify, >=20 > + EFI_HII_DATABASE_NOTIFY_REM= OVE_PACK, >=20 > + &mRedfishPlatformConfigPriv= ate->NotifyHandle >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, RegisterPackageNotify for > EFI_HII_DATABASE_NOTIFY_NEW_PACK failure: %r\n", __FUNCTION__, > Status)); >=20 > + } >=20 > +#endif >=20 > + >=20 > + gBS->CloseEvent (Event); >=20 > + mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent =3D NULL; >=20 > + >=20 > +} >=20 > + >=20 > +/** >=20 > + This is a EFI_REGULAR_EXPRESSION_PROTOCOL notification event handler. >=20 > + >=20 > + @param[in] Event Event whose notification function is being invoked= . >=20 > + @param[in] Context Pointer to the notification function's context. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +RegexProtocolInstalled ( >=20 > + IN EFI_EVENT Event, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + // >=20 > + // Locate regular expression protocol. >=20 > + // >=20 > + Status =3D gBS->LocateProtocol ( >=20 > + &gEfiRegularExpressionProtocolGuid, >=20 > + NULL, >=20 > + (VOID **)&mRedfishPlatformConfigPrivate- > >RegularExpressionProtocol >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, locate > EFI_REGULAR_EXPRESSION_PROTOCOL failure: %r\n", __FUNCTION__, > Status)); >=20 > + return; >=20 > + } >=20 > + >=20 > + gBS->CloseEvent (Event); >=20 > + mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent =3D NULL; >=20 > + >=20 > +} >=20 > + >=20 > +/** >=20 > + Unloads an image. >=20 > + >=20 > + @param ImageHandle Handle that identifies the image to be > unloaded. >=20 > + >=20 > + @retval EFI_SUCCESS The image has been unloaded. >=20 > + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image > handle. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigDxeUnload ( >=20 > + IN EFI_HANDLE ImageHandle >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + if (mRedfishPlatformConfigPrivate !=3D NULL) { >=20 > + Status =3D gBS->UninstallProtocolInterface ( >=20 > + mRedfishPlatformConfigPrivate->ImageHandle, >=20 > + &gEdkIIRedfishPlatformConfigProtocolGuid, >=20 > + (VOID*)&mRedfishPlatformConfigPrivate->Protocol >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, can not uninstall > gEdkIIRedfishPlatformConfigProtocolGuid: %r\n", __FUNCTION__, Status)); >=20 > + ASSERT (FALSE); >=20 > + } >=20 > + >=20 > + // >=20 > + // Close events >=20 > + // >=20 > + if (mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent !=3D NU= LL) { >=20 > + gBS->CloseEvent (mRedfishPlatformConfigPrivate- > >HiiDbNotify.ProtocolEvent); >=20 > + } >=20 > + if (mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent != =3D > NULL) { >=20 > + gBS->CloseEvent (mRedfishPlatformConfigPrivate- > >HiiStringNotify.ProtocolEvent); >=20 > + } >=20 > + if (mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent !=3D NU= LL) > { >=20 > + gBS->CloseEvent (mRedfishPlatformConfigPrivate- > >RegexNotify.ProtocolEvent); >=20 > + } >=20 > + >=20 > + // >=20 > + // Unregister package notification. >=20 > + // >=20 > + if (mRedfishPlatformConfigPrivate->NotifyHandle !=3D NULL) { >=20 > + mRedfishPlatformConfigPrivate->HiiDatabase->UnregisterPackageNotif= y > ( >=20 > + mRedfishPlatformConfigPrivate-= >HiiDatabase, >=20 > + mRedfishPlatformConfigPrivate-= >NotifyHandle >=20 > + ); >=20 > + } >=20 > + >=20 > + ReleaseFormsetList (&mRedfishPlatformConfigPrivate->FormsetList); >=20 > + FreePool (mRedfishPlatformConfigPrivate); >=20 > + mRedfishPlatformConfigPrivate =3D NULL; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > + >=20 > +/** >=20 > + This is the declaration of an EFI image entry point. This entry point = is >=20 > + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers incl= uding >=20 > + both device drivers and bus drivers. >=20 > + >=20 > + @param ImageHandle The firmware allocated handle for the UE= FI > image. >=20 > + @param SystemTable A pointer to the EFI System Table. >=20 > + >=20 > + @retval EFI_SUCCESS The operation completed successfully. >=20 > + @retval Others An unexpected error occurred. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RedfishPlatformConfigDxeEntryPoint ( >=20 > + IN EFI_HANDLE ImageHandle, >=20 > + IN EFI_SYSTEM_TABLE *SystemTable >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + mRedfishPlatformConfigPrivate =3D (REDFISH_PLATFORM_CONFIG_PRIVATE > *)AllocateZeroPool (sizeof (REDFISH_PLATFORM_CONFIG_PRIVATE)); >=20 > + if (mRedfishPlatformConfigPrivate =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, can not allocate pool for > REDFISH_PLATFORM_CONFIG_PRIVATE\n", __FUNCTION__)); >=20 > + ASSERT (FALSE); >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + // >=20 > + // Protocol initialization >=20 > + // >=20 > + mRedfishPlatformConfigPrivate->ImageHandle =3D ImageHandle; >=20 > + mRedfishPlatformConfigPrivate->Protocol.GetValue =3D > RedfishPlatformConfigProtocolGetValue; >=20 > + mRedfishPlatformConfigPrivate->Protocol.SetValue =3D > RedfishPlatformConfigProtocolSetValue; >=20 > + mRedfishPlatformConfigPrivate->Protocol.GetConfigureLang =3D > RedfishPlatformConfigProtocolGetConfigureLang; >=20 > + mRedfishPlatformConfigPrivate->Protocol.GetSupportedSchema =3D > RedfishPlatformConfigProtocolGetSupportedSchema; >=20 > + >=20 > + InitializeListHead (&mRedfishPlatformConfigPrivate->FormsetList); >=20 > + InitializeListHead (&mRedfishPlatformConfigPrivate->PendingList); >=20 > + >=20 > + Status =3D gBS->InstallProtocolInterface ( >=20 > + &ImageHandle, >=20 > + &gEdkIIRedfishPlatformConfigProtocolGuid, >=20 > + EFI_NATIVE_INTERFACE, >=20 > + (VOID*)&mRedfishPlatformConfigPrivate->Protocol >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, can not install > gEdkIIRedfishPlatformConfigProtocolGuid: %r\n", __FUNCTION__, Status)); >=20 > + ASSERT (FALSE); >=20 > + } >=20 > + >=20 > + // >=20 > + // Install protocol notification if HII database protocol is installed= . >=20 > + // >=20 > + mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( >=20 > + &gEfiHiiDa= tabaseProtocolGuid, >=20 > + TPL_CALLBA= CK, >=20 > + HiiDatabas= eProtocolInstalled, >=20 > + NULL, >=20 > + &mRedfishP= latformConfigPrivate- > >HiiDbNotify.Registration >=20 > + ); >=20 > + if (mRedfishPlatformConfigPrivate->HiiDbNotify.ProtocolEvent =3D=3D NU= LL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notification for > gEfiHiiDatabaseProtocolGuid\n", __FUNCTION__)); >=20 > + ASSERT (FALSE); >=20 > + } >=20 > + >=20 > + // >=20 > + // Install protocol notification if HII string protocol is installed. >=20 > + // >=20 > + mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( >=20 > + &gEfiH= iiStringProtocolGuid, >=20 > + TPL_CA= LLBACK, >=20 > + HiiStr= ingProtocolInstalled, >=20 > + NULL, >=20 > + &mRedf= ishPlatformConfigPrivate- > >HiiStringNotify.Registration >=20 > + ); >=20 > + if (mRedfishPlatformConfigPrivate->HiiStringNotify.ProtocolEvent =3D= =3D NULL) > { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notification for > gEfiHiiStringProtocolGuid\n", __FUNCTION__)); >=20 > + ASSERT (FALSE); >=20 > + } >=20 > + >=20 > + // >=20 > + // Install protocol notification if regular expression protocol is ins= talled. >=20 > + // >=20 > + mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( >=20 > + &gEfiRegul= arExpressionProtocolGuid, >=20 > + TPL_CALLBA= CK, >=20 > + RegexProto= colInstalled, >=20 > + NULL, >=20 > + &mRedfishP= latformConfigPrivate- > >RegexNotify.Registration >=20 > + ); >=20 > + if (mRedfishPlatformConfigPrivate->RegexNotify.ProtocolEvent =3D=3D NU= LL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notification for > gEfiRegularExpressionProtocolGuid\n", __FUNCTION__)); >=20 > + ASSERT (FALSE); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > index 99a613d229..d3f7af55ad 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > @@ -1,64 +1,64 @@ > -/** @file > - This file defines the EDKII Redfish Platform Config Protocol interface= . > - > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef EDKII_REDFISH_PLATFORM_CONFIG_DXE_H_ > -#define EDKII_REDFISH_PLATFORM_CONFIG_DXE_H_ > - > -#include > - > -// > -// Libraries > -// > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -// > -// Produced Protocols > -// > -#include > -#include > -#include > -#include > - > -// > -// Definition of EDKII_REDFISH_PLATFORM_CONFIG_NOTIFY. > -// > -typedef struct { > - EFI_EVENT ProtocolEvent; // Protocol notification = event. > - VOID *Registration; // Protocol notification = registration. > -} REDFISH_PLATFORM_CONFIG_NOTIFY; > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_PRIVATE. > -// > -typedef struct { > - EFI_HANDLE ImageHandle; = // Driver image handle. > - EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL Protocol; > - REDFISH_PLATFORM_CONFIG_NOTIFY HiiDbNotify; > - EFI_HII_DATABASE_PROTOCOL *HiiDatabase; = // The HII > database protocol. > - REDFISH_PLATFORM_CONFIG_NOTIFY HiiStringNotify; > - EFI_HII_STRING_PROTOCOL *HiiString; = // HII String > Protocol. > - REDFISH_PLATFORM_CONFIG_NOTIFY RegexNotify; > - EFI_REGULAR_EXPRESSION_PROTOCOL *RegularExpressionProtocol; > // Regular Expression Protocol. > - EFI_HANDLE NotifyHandle; = // The notify handle. > - LIST_ENTRY FormsetList; = // The list to keep cached > HII formset. > - LIST_ENTRY PendingList; = // The list to keep updated > HII handle. > -} REDFISH_PLATFORM_CONFIG_PRIVATE; > - > -#define REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS(a) BASE_CR > (a, REDFISH_PLATFORM_CONFIG_PRIVATE, Protocol) > -#define REGULAR_EXPRESSION_INCLUDE_ALL L".*" > -#define CONFIGURE_LANGUAGE_PREFIX "x-uefi-redfish-" > - > -#endif > +/** @file >=20 > + This file defines the EDKII Redfish Platform Config Protocol interface= . >=20 > + >=20 > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
>=20 > + >=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef EDKII_REDFISH_PLATFORM_CONFIG_DXE_H_ >=20 > +#define EDKII_REDFISH_PLATFORM_CONFIG_DXE_H_ >=20 > + >=20 > +#include >=20 > + >=20 > +// >=20 > +// Libraries >=20 > +// >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +// >=20 > +// Produced Protocols >=20 > +// >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +// >=20 > +// Definition of EDKII_REDFISH_PLATFORM_CONFIG_NOTIFY. >=20 > +// >=20 > +typedef struct { >=20 > + EFI_EVENT ProtocolEvent; // Protocol notification = event. >=20 > + VOID *Registration; // Protocol notification = registration. >=20 > +} REDFISH_PLATFORM_CONFIG_NOTIFY; >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_PRIVATE. >=20 > +// >=20 > +typedef struct { >=20 > + EFI_HANDLE ImageHandle; = // Driver image handle. >=20 > + EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL Protocol; >=20 > + REDFISH_PLATFORM_CONFIG_NOTIFY HiiDbNotify; >=20 > + EFI_HII_DATABASE_PROTOCOL *HiiDatabase; = // The HII > database protocol. >=20 > + REDFISH_PLATFORM_CONFIG_NOTIFY HiiStringNotify; >=20 > + EFI_HII_STRING_PROTOCOL *HiiString; = // HII String > Protocol. >=20 > + REDFISH_PLATFORM_CONFIG_NOTIFY RegexNotify; >=20 > + EFI_REGULAR_EXPRESSION_PROTOCOL *RegularExpressionProtocol; > // Regular Expression Protocol. >=20 > + EFI_HANDLE NotifyHandle; = // The notify handle. >=20 > + LIST_ENTRY FormsetList; = // The list to keep cached > HII formset. >=20 > + LIST_ENTRY PendingList; = // The list to keep updated > HII handle. >=20 > +} REDFISH_PLATFORM_CONFIG_PRIVATE; >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS(a) BASE_CR > (a, REDFISH_PLATFORM_CONFIG_PRIVATE, Protocol) >=20 > +#define REGULAR_EXPRESSION_INCLUDE_ALL L".*" >=20 > +#define CONFIGURE_LANGUAGE_PREFIX "x-uefi-redfish-" >=20 > + >=20 > +#endif >=20 > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf > index 16739bef7a..81b22e03c3 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf > @@ -1,53 +1,53 @@ > -## @file > -# Implementation of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > interfaces. > -# > -# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> -# SPDX-License-Identifier: BSD-2-Clause-Patent > -# > -## > - > -[Defines] > - INF_VERSION =3D 0x00010005 > - BASE_NAME =3D RedfishPlatformConfigDxe > - FILE_GUID =3D BEAEFFE1-0633-41B5-913C-9389339C2927 > - MODULE_TYPE =3D DXE_DRIVER > - VERSION_STRING =3D 1.0 > - ENTRY_POINT =3D RedfishPlatformConfigDxeEntryPoint > - UNLOAD_IMAGE =3D RedfishPlatformConfigDxeUnload > - > -[Packages] > - MdePkg/MdePkg.dec > - MdeModulePkg/MdeModulePkg.dec > - RedfishPkg/RedfishPkg.dec > - > -[Sources] > - RedfishPlatformConfigDxe.h > - RedfishPlatformConfigDxe.c > - RedfishPlatformConfigImpl.h > - RedfishPlatformConfigImpl.c > - > -[LibraryClasses] > - BaseLib > - BaseMemoryLib > - DebugLib > - DevicePathLib > - HiiLib > - HiiUtilityLib > - MemoryAllocationLib > - PrintLib > - UefiLib > - UefiBootServicesTableLib > - UefiRuntimeServicesTableLib > - UefiDriverEntryPoint > - > -[Protocols] > - gEdkIIRedfishPlatformConfigProtocolGuid ## PRODUCED > - gEfiHiiDatabaseProtocolGuid ## CONSUMED > - gEfiHiiStringProtocolGuid ## CONSUMED > - gEfiRegularExpressionProtocolGuid ## CONSUMED > - > -[Guids] > - gEfiRegexSyntaxTypePerlGuid ## CONSUMED > - > -[Depex] > +## @file >=20 > +# Implementation of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > interfaces. >=20 > +# >=20 > +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D RedfishPlatformConfigDxe >=20 > + FILE_GUID =3D BEAEFFE1-0633-41B5-913C-9389339C2927 >=20 > + MODULE_TYPE =3D DXE_DRIVER >=20 > + VERSION_STRING =3D 1.0 >=20 > + ENTRY_POINT =3D RedfishPlatformConfigDxeEntryPoint >=20 > + UNLOAD_IMAGE =3D RedfishPlatformConfigDxeUnload >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + RedfishPkg/RedfishPkg.dec >=20 > + >=20 > +[Sources] >=20 > + RedfishPlatformConfigDxe.h >=20 > + RedfishPlatformConfigDxe.c >=20 > + RedfishPlatformConfigImpl.h >=20 > + RedfishPlatformConfigImpl.c >=20 > + >=20 > +[LibraryClasses] >=20 > + BaseLib >=20 > + BaseMemoryLib >=20 > + DebugLib >=20 > + DevicePathLib >=20 > + HiiLib >=20 > + HiiUtilityLib >=20 > + MemoryAllocationLib >=20 > + PrintLib >=20 > + UefiLib >=20 > + UefiBootServicesTableLib >=20 > + UefiRuntimeServicesTableLib >=20 > + UefiDriverEntryPoint >=20 > + >=20 > +[Protocols] >=20 > + gEdkIIRedfishPlatformConfigProtocolGuid ## PRODUCED >=20 > + gEfiHiiDatabaseProtocolGuid ## CONSUMED >=20 > + gEfiHiiStringProtocolGuid ## CONSUMED >=20 > + gEfiRegularExpressionProtocolGuid ## CONSUMED >=20 > + >=20 > +[Guids] >=20 > + gEfiRegexSyntaxTypePerlGuid ## CONSUMED >=20 > + >=20 > +[Depex] >=20 > TRUE > \ No newline at end of file > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > index d9eab6c883..369ebb220c 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > @@ -1,1240 +1,1286 @@ > -/** @file > - > - The implementation of EDKII Redfidh Platform Config Protocol. > - > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > -#include "RedfishPlatformConfigDxe.h" > -#include "RedfishPlatformConfigImpl.h" > - > -extern REDFISH_PLATFORM_CONFIG_PRIVATE > *mRedfishPlatformConfigPrivate; > - > -/** > - Debug dump HII string > - > - @param[in] HiiHandle HII handle instance > - @param[in] StringId HII string to dump > - > - @retval EFI_SUCCESS Dump HII string successfully > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -DumpHiiString ( > - IN EFI_HII_HANDLE HiiHandle, > - IN EFI_STRING_ID StringId > - ) > -{ > - EFI_STRING String; > - > - if (HiiHandle =3D=3D NULL || StringId =3D=3D 0) { > - DEBUG ((DEBUG_INFO, "???")); > - return EFI_INVALID_PARAMETER; > - } > - > - String =3D HiiGetString (HiiHandle, StringId, NULL); > - if (String =3D=3D NULL) { > - return EFI_NOT_FOUND; > - } > - > - DEBUG ((DEBUG_INFO, "%s", String)); > - FreePool (String); > - > - return EFI_SUCCESS; > -} > - > -/** > - Debug dump HII form-set data > - > - @param[in] FormsetPrivate HII form-set private instance. > - > - @retval EFI_SUCCESS Dump form-set successfully > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -DumpFormset ( > - IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate > - ) > -{ > - LIST_ENTRY *HiiFormLink; > - LIST_ENTRY *HiiNextFormLink; > - REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; > - LIST_ENTRY *HiiStatementLink; > - LIST_ENTRY *HiiNextStatementLink; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; > - UINTN Index; > - > - if (FormsetPrivate =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - Index =3D 0; > - HiiFormLink =3D GetFirstNode (&FormsetPrivate->HiiFormList); > - while (!IsNull (&FormsetPrivate->HiiFormList, HiiFormLink)) { > - HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); > - HiiNextFormLink =3D GetNextNode (&FormsetPrivate->HiiFormList, > HiiFormLink); > - > - DEBUG ((DEBUG_INFO, " [%d] form: %d title: ", ++Index, HiiFormPriva= te- > >Id)); > - DumpHiiString (FormsetPrivate->HiiHandle, HiiFormPrivate->Title); > - DEBUG ((DEBUG_INFO, "\n")); > - > - HiiStatementLink =3D GetFirstNode (&HiiFormPrivate->StatementList); > - while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) { > - HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); > - HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate->StatementLi= st, > HiiStatementLink); > - > - DEBUG ((DEBUG_INFO, " QID: 0x%x Prompt: ", HiiStatementPrivate- > >QuestionId)); > - DumpHiiString (FormsetPrivate->HiiHandle, HiiStatementPrivate- > >Description); > - DEBUG ((DEBUG_INFO, "\n")); > - > - HiiStatementLink =3D HiiNextStatementLink; > - } > - > - HiiFormLink =3D HiiNextFormLink; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Debug dump HII form-set list > - > - @param[in] FormsetList Form-set list instance > - > - @retval EFI_SUCCESS Dump list successfully > - @retval Others Errors occur > - > -**/ > -EFI_STATUS > -DumpFormsetList ( > - IN LIST_ENTRY *FormsetList > - ) > -{ > - LIST_ENTRY *HiiFormsetLink; > - LIST_ENTRY *HiiFormsetNextLink; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; > - UINTN Index; > - > - if (FormsetList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (IsListEmpty (FormsetList)) { > - DEBUG ((DEBUG_INFO, "%a, Empty formset list\n", __FUNCTION__)); > - return EFI_SUCCESS; > - } > - > - Index =3D 0; > - HiiFormsetLink =3D GetFirstNode (FormsetList); > - while (!IsNull (FormsetList, HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - DEBUG ((DEBUG_INFO, "[%d] HII Handle: 0x%x formset: %g at %s\n", > ++Index, HiiFormsetPrivate->HiiHandle, &HiiFormsetPrivate->Guid, > HiiFormsetPrivate->DevicePathStr)); > - DumpFormset (HiiFormsetPrivate); > - > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Retrieves a string from a string package in a English language. The > - returned string is allocated using AllocatePool(). The caller is resp= onsible > - for freeing the allocated buffer using FreePool(). > - > - If HiiHandle is NULL, then ASSERT(). > - If StringId is 0, then ASSET. > - > - @param[in] HiiStringProtocol EFI_HII_STRING_PROTOCOL instance. > - @param[in] HiiHandle A handle that was previously registered = in the > HII Database. > - @param[in] StringId The identifier of the string to retrieve= d from the > string > - package associated with HiiHandle. > - > - @retval NULL The string specified by StringId is not present in the = string > package. > - @retval Other The string was returned. > - > -**/ > -EFI_STRING > -HiiGetRedfishString ( > - IN EFI_HII_HANDLE HiiHandle, > - IN CHAR8 *Language, > - IN EFI_STRING_ID StringId > - ) > -{ > - EFI_STATUS Status; > - UINTN StringSize; > - CHAR16 TempString; > - EFI_STRING String; > - > - if (mRedfishPlatformConfigPrivate->HiiString =3D=3D NULL || HiiHandle = =3D=3D NULL > || StringId =3D=3D 0 || IS_EMPTY_STRING (Language)) { > - ASSERT (FALSE); > - return NULL; > - } > - > - // > - // Retrieve the size of the string in the string package for the BestL= anguage > - // > - StringSize =3D 0; > - Status =3D mRedfishPlatformConfigPrivate->HiiString->GetString ( > - mRedfishPlatformConfigPriva= te->HiiString, > - Language, > - HiiHandle, > - StringId, > - &TempString, > - &StringSize, > - NULL > - ); > - // > - // If GetString() returns EFI_SUCCESS for a zero size, > - // then there are no supported languages registered for HiiHandle. If > GetString() > - // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is > not present > - // in the HII Database > - // > - if (Status !=3D EFI_BUFFER_TOO_SMALL) { > - return NULL; > - } > - > - // > - // Allocate a buffer for the return string > - // > - String =3D AllocateZeroPool (StringSize); > - if (String =3D=3D NULL) { > - return NULL; > - } > - > - // > - // Retrieve the string from the string package > - // > - Status =3D mRedfishPlatformConfigPrivate->HiiString->GetString ( > - mRedfishPlatformConfigPriva= te->HiiString, > - Language, > - HiiHandle, > - StringId, > - String, > - &StringSize, > - NULL > - ); > - if (EFI_ERROR (Status)) { > - // > - // Free the buffer and return NULL if the supported languages can no= t be > retrieved. > - // > - FreePool (String); > - String =3D NULL; > - } > - > - // > - // Return the Null-terminated Unicode string > - // > - return String; > -} > - > -/** > - Get string from HII database in English language. > - > - @param[in] HiiHandle A handle that was previously registered = in the > HII Database. > - @param[in] StringId The identifier of the string to retrieve= d from the > string > - package associated with HiiHandle. > - > - @retval NULL The string specified by StringId is not present in the = string > package. > - @retval Other The string was returned. > - > -**/ > -EFI_STRING > -HiiGetEnglishString ( > - IN EFI_HII_HANDLE HiiHandle, > - IN EFI_STRING_ID StringId > - ) > -{ > - return HiiGetRedfishString (HiiHandle, ENGLISH_LANGUAGE_CODE, > StringId); > -} > - > -/** > - Check and see if this is supported schema or not. > - > - @param[in] SupportedSchema The list of supported schema. > - @param[in] Schema Schema string to be checked. > - > - @retval BOOLEAN TRUE if this is supported schema. FALSE > otherwise. > - > -**/ > -BOOLEAN > -CheckSupportedSchema ( > - IN REDFISH_PLATFORM_CONFIG_SCHEMA *SupportedSchema, > - IN CHAR8 *Schema > - ) > -{ > - UINTN Index; > - > - if (SupportedSchema =3D=3D NULL || IS_EMPTY_STRING (Schema)) { > - return FALSE; > - } > - > - if (SupportedSchema->Count =3D=3D 0) { > - return FALSE; > - } > - > - for (Index =3D 0; Index < SupportedSchema->Count; Index++) { > - if (AsciiStrCmp (SupportedSchema->SchemaList[Index], Schema) =3D=3D = 0) { > - return TRUE; > - } > - } > - > - return FALSE; > -} > - > -/** > - Get the list of supported schema from the given HII handle. > - > - @param[in] HiiHandle HII handle instance. > - @param[out] SupportedSchema Supported schema on this HII handle. > - > - @retval EFI_SUCCESS Schema list is returned. > - @retval EFI_INVALID_PARAMETER HiiHandle is NULL or SupportedSchema > is NULL. > - @retval EFI_NOT_FOUND No supported schema found. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -GetSupportedSchema ( > - IN EFI_HII_HANDLE HiiHandle, > - OUT REDFISH_PLATFORM_CONFIG_SCHEMA *SupportedSchema > - ) > -{ > - CHAR8 *SupportedLanguages; > - UINTN Index; > - UINTN LangIndex; > - UINTN Count; > - UINTN StrSize; > - UINTN ListIndex; > - > - if (HiiHandle =3D=3D NULL || SupportedSchema =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - SupportedSchema->Count =3D 0; > - > - SupportedLanguages =3D HiiGetSupportedLanguages (HiiHandle); > - if (SupportedLanguages =3D=3D NULL) { > - return EFI_NOT_FOUND; > - } > - > - Index =3D 0; > - LangIndex =3D 0; > - Count =3D 0; > - while (TRUE) { > - if (SupportedLanguages[Index] =3D=3D ';' || SupportedLanguages[Index= ] =3D=3D > '\0') { > - if (AsciiStrnCmp (&SupportedLanguages[LangIndex], > X_UEFI_SCHEMA_PREFIX, AsciiStrLen (X_UEFI_SCHEMA_PREFIX)) =3D=3D 0) { > - ++Count; > - } > - LangIndex =3D Index + 1; > - } > - > - if (SupportedLanguages[Index] =3D=3D '\0') { > - break; > - } > - > - ++Index; > - } > - > - if (Count =3D=3D 0) { > - return EFI_NOT_FOUND; > - } > - > - SupportedSchema->Count =3D Count; > - SupportedSchema->SchemaList =3D AllocatePool (sizeof (CHAR8 *) * Count= ); > - if (SupportedSchema->SchemaList =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - Index =3D 0; > - LangIndex =3D 0; > - ListIndex =3D 0; > - while (TRUE) { > - > - if (SupportedLanguages[Index] =3D=3D ';' || SupportedLanguages[Index= ] =3D=3D > '\0') { > - if (AsciiStrnCmp (&SupportedLanguages[LangIndex], > X_UEFI_SCHEMA_PREFIX, AsciiStrLen (X_UEFI_SCHEMA_PREFIX)) =3D=3D 0) { > - StrSize =3D Index - LangIndex; > - SupportedSchema->SchemaList[ListIndex] =3D AllocateCopyPool ((St= rSize > + 1), &SupportedLanguages[LangIndex]); > - SupportedSchema->SchemaList[ListIndex][StrSize] =3D '\0'; > - ++ListIndex; > - } > - > - LangIndex =3D Index + 1; > - } > - > - if (SupportedLanguages[Index] =3D=3D '\0') { > - break; > - } > - > - ++Index; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Search and find statement private instance by given regular expression > patthern > - which describes the Configure Language. > - > - @param[in] RegularExpressionProtocol Regular express protocol. > - @param[in] FormsetList Form-set list to search. > - @param[in] Schema Schema to be matched. > - @param[in] Pattern Regular expression pattern. > - @param[out] StatementList Statement list that match abov= e > pattern. > - > - @retval EFI_SUCCESS Statement list is returned. > - @retval EFI_INVALID_PARAMETER Input parameter is NULL. > - @retval EFI_NOT_READY Regular express protocol is NULL. > - @retval EFI_NOT_FOUND No statement is found. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -GetStatementPrivateByConfigureLangRegex ( > - IN EFI_REGULAR_EXPRESSION_PROTOCOL > *RegularExpressionProtocol, > - IN LIST_ENTRY *FormsetList, > - IN CHAR8 *Schema, > - IN EFI_STRING Pattern, > - OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList > - ) > -{ > - LIST_ENTRY *HiiFormsetLink; > - LIST_ENTRY *HiiFormsetNextLink; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; > - LIST_ENTRY *HiiFormLink; > - LIST_ENTRY *HiiNextFormLink; > - REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; > - LIST_ENTRY *HiiStatementLink; > - LIST_ENTRY *HiiNextStatementLink; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; > - EFI_STRING TmpString; > - UINTN CaptureCount; > - BOOLEAN IsMatch; > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF *StatementRef; > - > - if (FormsetList =3D=3D NULL || IS_EMPTY_STRING (Schema) || > IS_EMPTY_STRING (Pattern) || StatementList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (RegularExpressionProtocol =3D=3D NULL) { > - return EFI_NOT_READY; > - } > - > - StatementList->Count =3D 0; > - InitializeListHead (&StatementList->StatementList); > - > - if (IsListEmpty (FormsetList)) { > - return EFI_NOT_FOUND; > - } > - > - HiiFormsetLink =3D GetFirstNode (FormsetList); > - while (!IsNull (FormsetList, HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - // > - // Performance check. > - // If there is no desired Redfish schema found, skip this formset. > - // > - if (!CheckSupportedSchema (&HiiFormsetPrivate->SupportedSchema, > Schema)) { > - HiiFormsetLink =3D HiiFormsetNextLink; > - continue; > - } > - > - HiiFormLink =3D GetFirstNode (&HiiFormsetPrivate->HiiFormList); > - while (!IsNull (&HiiFormsetPrivate->HiiFormList, HiiFormLink)) { > - HiiNextFormLink =3D GetNextNode (&HiiFormsetPrivate->HiiFormList, > HiiFormLink); > - HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); > - > - HiiStatementLink =3DGetFirstNode (&HiiFormPrivate->StatementList); > - while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink))= { > - HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate->Statement= List, > HiiStatementLink); > - HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); > - > - if (HiiStatementPrivate->Description !=3D 0) { > - TmpString =3D HiiGetRedfishString (HiiFormsetPrivate->HiiHandl= e, > Schema, HiiStatementPrivate->Description); > - if (TmpString !=3D NULL) { > - Status =3D RegularExpressionProtocol->MatchString ( > - RegularExpressionProto= col, > - TmpString, > - Pattern, > - &gEfiRegexSyntaxTypePe= rlGuid, > - &IsMatch, > - NULL, > - &CaptureCount > - ); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, MatchString \"%s\" failed: %r\n"= , > __FUNCTION__, Pattern, Status)); > - ASSERT (FALSE); > - return Status; > - } > - > - // > - // Found > - // > - if (IsMatch) { > - StatementRef =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF)); > - if (StatementRef =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - StatementRef->Statement =3D HiiStatementPrivate; > - InsertTailList (&StatementList->StatementList, &StatementR= ef->Link); > - ++StatementList->Count; > - } > - > - FreePool (TmpString); > - } > - } > - > - HiiStatementLink =3D HiiNextStatementLink; > - } > - > - HiiFormLink =3D HiiNextFormLink; > - } > - > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Get statement private instance by the given configure language. > - > - @param[in] FormsetList Form-set list to search. > - @param[in] Schema Schema to be matched. > - @param[in] ConfigureLang Configure language. > - > - @retval REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * Pointer to > statement private instance. > - > -**/ > -REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * > -GetStatementPrivateByConfigureLang ( > - IN LIST_ENTRY *FormsetList, > - IN CHAR8 *Schema, > - IN EFI_STRING ConfigureLang > - ) > -{ > - LIST_ENTRY *HiiFormsetLink; > - LIST_ENTRY *HiiFormsetNextLink; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; > - LIST_ENTRY *HiiFormLink; > - LIST_ENTRY *HiiNextFormLink; > - REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; > - LIST_ENTRY *HiiStatementLink; > - LIST_ENTRY *HiiNextStatementLink; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; > - EFI_STRING TmpString; > - > - if (FormsetList =3D=3D NULL || IS_EMPTY_STRING (Schema) || > IS_EMPTY_STRING (ConfigureLang)) { > - return NULL; > - } > - > - if (IsListEmpty (FormsetList)) { > - return NULL; > - } > - > - HiiFormsetLink =3D GetFirstNode (FormsetList); > - while (!IsNull (FormsetList, HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - // > - // Performance check. > - // If there is no desired Redfish schema found, skip this formset. > - // > - if (!CheckSupportedSchema (&HiiFormsetPrivate->SupportedSchema, > Schema)) { > - HiiFormsetLink =3D HiiFormsetNextLink; > - continue; > - } > - > - HiiFormLink =3D GetFirstNode (&HiiFormsetPrivate->HiiFormList); > - while (!IsNull (&HiiFormsetPrivate->HiiFormList, HiiFormLink)) { > - HiiNextFormLink =3D GetNextNode (&HiiFormsetPrivate->HiiFormList, > HiiFormLink); > - HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); > - > - HiiStatementLink =3DGetFirstNode (&HiiFormPrivate->StatementList); > - while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink))= { > - HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate->Statement= List, > HiiStatementLink); > - HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); > - > - DEBUG_CODE ( > - STATIC UINTN Index =3D 0; > - DEBUG ((DEBUG_INFO, "%a, [%d] search %s in QID: 0x%x form: 0x%= x > formset: %g\n", __FUNCTION__, ++Index, ConfigureLang, > HiiStatementPrivate->QuestionId, HiiFormPrivate->Id, &HiiFormsetPrivate- > >Guid)); > - ); > - > - if (HiiStatementPrivate->Description !=3D 0) { > - TmpString =3D HiiGetRedfishString (HiiFormsetPrivate->HiiHandl= e, > Schema, HiiStatementPrivate->Description); > - if (TmpString !=3D NULL) { > - if (StrCmp (TmpString, ConfigureLang) =3D=3D 0) { > - FreePool (TmpString); > - return HiiStatementPrivate; > - } > - > - FreePool (TmpString); > - } > - } > - > - HiiStatementLink =3D HiiNextStatementLink; > - } > - > - HiiFormLink =3D HiiNextFormLink; > - } > - > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - return NULL; > -} > - > -/** > - Get form-set private instance by the given HII handle. > - > - @param[in] HiiHandle HII handle instance. > - @param[in] FormsetList Form-set list to search. > - > - @retval REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * Pointer to > form-set private instance. > - > -**/ > -REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * > -GetFormsetPrivateByHiiHandle ( > - IN EFI_HII_HANDLE HiiHandle, > - IN LIST_ENTRY *FormsetList > - ) > -{ > - LIST_ENTRY *HiiFormsetLink; > - LIST_ENTRY *HiiFormsetNextLink; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; > - > - if (HiiHandle =3D=3D NULL || FormsetList =3D=3D NULL) { > - return NULL; > - } > - > - if (IsListEmpty (FormsetList)) { > - return NULL; > - } > - > - HiiFormsetLink =3D GetFirstNode (FormsetList); > - while (!IsNull (FormsetList, HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - if (HiiFormsetPrivate->HiiHandle =3D=3D HiiHandle) { > - return HiiFormsetPrivate; > - } > - > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - return NULL; > -} > - > -/** > - Release formset and all the forms and statements that belong to this > formset. > - > - @param[in] FormsetPrivate Pointer to HP_HII_FORM_SET_PRIVATE > - > - @retval EFI_STATUS > - > -**/ > -EFI_STATUS > -ReleaseFormset ( > - IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate > - ) > -{ > - LIST_ENTRY *HiiFormLink; > - LIST_ENTRY *HiiNextFormLink; > - REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; > - LIST_ENTRY *HiiStatementLink; > - LIST_ENTRY *HiiNextStatementLink; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; > - UINTN Index; > - > - if (FormsetPrivate =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - HiiFormLink =3D GetFirstNode (&FormsetPrivate->HiiFormList); > - while (!IsNull (&FormsetPrivate->HiiFormList, HiiFormLink)) { > - HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); > - HiiNextFormLink =3D GetNextNode (&FormsetPrivate->HiiFormList, > HiiFormLink); > - > - HiiStatementLink =3D GetFirstNode (&HiiFormPrivate->StatementList); > - while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) { > - HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); > - HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate->StatementLi= st, > HiiStatementLink); > - > - // > - // HiiStatementPrivate->HiiStatement will be released in > DestroyFormSet(). > - // > - > - if (HiiStatementPrivate->DesStringCache !=3D NULL) { > - FreePool (HiiStatementPrivate->DesStringCache); > - HiiStatementPrivate->DesStringCache =3D NULL; > - } > - > - RemoveEntryList (&HiiStatementPrivate->Link); > - FreePool (HiiStatementPrivate); > - HiiStatementLink =3D HiiNextStatementLink; > - } > - > - // > - // HiiStatementPrivate->HiiForm will be released in DestroyFormSet()= . > - // > - > - RemoveEntryList (&HiiFormPrivate->Link); > - FreePool (HiiFormPrivate); > - HiiFormLink =3D HiiNextFormLink; > - } > - > - if (FormsetPrivate->HiiFormSet !=3D NULL) { > - DestroyFormSet (FormsetPrivate->HiiFormSet); > - FormsetPrivate->HiiFormSet =3D NULL; > - } > - > - FreePool (FormsetPrivate->DevicePathStr); > - > - // > - // Release schema list > - // > - if (FormsetPrivate->SupportedSchema.SchemaList !=3D NULL) { > - for (Index =3D 0; Index < FormsetPrivate->SupportedSchema.Count; > Index++) { > - FreePool (FormsetPrivate->SupportedSchema.SchemaList[Index]); > - } > - > - FreePool (FormsetPrivate->SupportedSchema.SchemaList); > - FormsetPrivate->SupportedSchema.SchemaList =3D NULL; > - FormsetPrivate->SupportedSchema.Count =3D 0; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Create new form-set instance. > - > - @retval REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * Pointer to > newly created form-set private instance. > - > -**/ > -REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * > -NewFormsetPrivate ( > - VOID > - ) > -{ > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *NewFormsetPrivate; > - > - NewFormsetPrivate =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE)); > - if (NewFormsetPrivate =3D=3D NULL) { > - return NULL; > - } > - > - // > - // Initial newly created formset private data. > - // > - InitializeListHead (&NewFormsetPrivate->HiiFormList); > - > - return NewFormsetPrivate; > -} > - > -/** > - Load the HII formset from the given HII handle. > - > - @param[in] HiiHandle Target HII handle to load. > - @param[out] FormsetPrivate The formset private data. > - > - @retval EFI_STATUS > - > -**/ > -EFI_STATUS > -LoadFormset ( > - IN EFI_HII_HANDLE HiiHandle, > - OUT REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate > - ) > -{ > - EFI_STATUS Status; > - HII_FORMSET *HiiFormSet; > - HII_FORM *HiiForm; > - LIST_ENTRY *HiiFormLink; > - REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; > - HII_STATEMENT *HiiStatement; > - LIST_ENTRY *HiiStatementLink; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; > - EFI_GUID ZeroGuid; > - > - if (HiiHandle =3D=3D NULL || FormsetPrivate =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - > - HiiFormSet =3D AllocateZeroPool (sizeof (HII_FORMSET)); > - if (HiiFormSet =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - // > - // Find HII formset by the given HII handle. > - // > - ZeroMem (&ZeroGuid, sizeof (ZeroGuid)); > - Status =3D CreateFormSetFromHiiHandle (HiiHandle, &ZeroGuid, HiiFormSe= t); > - if (EFI_ERROR (Status) || IsListEmpty (&HiiFormSet->FormListHead)) { > - Status =3D EFI_NOT_FOUND; > - goto ErrorExit; > - } > - > - // > - // Initialize formset > - // > - InitializeFormSet (HiiFormSet); > - > - // > - // Initialize formset private data. > - // > - FormsetPrivate->HiiFormSet =3D HiiFormSet; > - FormsetPrivate->HiiHandle =3D HiiHandle; > - CopyGuid (&FormsetPrivate->Guid, &HiiFormSet->Guid); > - FormsetPrivate->DevicePathStr =3D ConvertDevicePathToText (HiiFormSet- > >DevicePath, FALSE, FALSE); > - Status =3D GetSupportedSchema (FormsetPrivate->HiiHandle, > &FormsetPrivate->SupportedSchema); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_WARN, "%a, No schema from HII handle: 0x%x found: > %r\n", __FUNCTION__, FormsetPrivate->HiiHandle, Status)); > - } > - > - HiiFormLink =3D GetFirstNode (&HiiFormSet->FormListHead); > - while (!IsNull (&HiiFormSet->FormListHead, HiiFormLink)) { > - HiiForm =3D HII_FORM_FROM_LINK (HiiFormLink); > - > - HiiFormPrivate =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_FORM_PRIVATE)); > - if (HiiFormPrivate =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto ErrorExit; > - } > - > - // > - // Initialize form private data. > - // > - HiiFormPrivate->HiiForm =3D HiiForm; > - HiiFormPrivate->Id =3D HiiForm->FormId; > - HiiFormPrivate->Title =3D HiiForm->FormTitle; > - HiiFormPrivate->ParentFormset =3D FormsetPrivate; > - InitializeListHead (&HiiFormPrivate->StatementList); > - > - HiiStatementLink =3D GetFirstNode (&HiiForm->StatementListHead); > - while (!IsNull (&HiiForm->StatementListHead, HiiStatementLink)) { > - HiiStatement =3D HII_STATEMENT_FROM_LINK (HiiStatementLink); > - > - HiiStatementPrivate =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE)); > - if (HiiStatementPrivate =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto ErrorExit; > - } > - // > - // Initialize statement private data. > - // > - HiiStatementPrivate->HiiStatement =3D HiiStatement; > - HiiStatementPrivate->QuestionId =3D HiiStatement->QuestionId; > - HiiStatementPrivate->Description =3D HiiStatement->Prompt; > - HiiStatementPrivate->ParentForm =3D HiiFormPrivate; > - > - // > - // Attach to statement list. > - // > - InsertTailList (&HiiFormPrivate->StatementList, &HiiStatementPriva= te- > >Link); > - HiiStatementLink =3D GetNextNode (&HiiForm->StatementListHead, > HiiStatementLink); > - } > - // > - // Attach to form list. > - // > - InsertTailList (&FormsetPrivate->HiiFormList, &HiiFormPrivate->Link)= ; > - HiiFormLink =3D GetNextNode (&HiiFormSet->FormListHead, HiiFormLink)= ; > - } > - > - return EFI_SUCCESS; > - > -ErrorExit: > - > - // > - // Release HiiFormSet if HiiFormSet is not linked to FormsetPrivate ye= t. > - // > - if (HiiFormSet !=3D NULL && FormsetPrivate->HiiFormSet !=3D HiiFormSet= ) { > - DestroyFormSet (HiiFormSet); > - } > - > - // > - // Release resource when error happens. > - // > - ReleaseFormset (FormsetPrivate); > - > - return Status; > -} > - > -/** > - Release formset list and all the forms that belong to this formset. > - > - @param[in] FormsetList Pointer to formst list that needs to be > - released. > - > - @retval EFI_STATUS > - > -**/ > -EFI_STATUS > -LoadFormsetList ( > - IN EFI_HII_HANDLE *HiiHandle, > - OUT LIST_ENTRY *FormsetList > - ) > -{ > - EFI_STATUS Status; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate; > - > - if (HiiHandle =3D=3D NULL || FormsetList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - FormsetPrivate =3D GetFormsetPrivateByHiiHandle (HiiHandle, FormsetLis= t); > - if (FormsetPrivate !=3D NULL) { > - return EFI_ALREADY_STARTED; > - } > - > - FormsetPrivate =3D NewFormsetPrivate (); > - if (FormsetPrivate =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__)); > - return EFI_OUT_OF_RESOURCES; > - } > - > - // > - // Load formset on the given HII handle. > - // > - Status =3D LoadFormset (HiiHandle, FormsetPrivate); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to load formset: %r\n", > __FUNCTION__, Status)); > - FreePool (FormsetPrivate); > - return Status; > - } > - > - // > - // Attach to cache list. > - // > - InsertTailList (FormsetList, &FormsetPrivate->Link); > - > - DEBUG_CODE ( > - DumpFormsetList (FormsetList); > - ); > - > - return EFI_SUCCESS; > -} > - > -/** > - Release formset list and all the forms that belong to this formset. > - > - @param[in] FormsetList Pointer to formst list that needs to be > - released. > - > - @retval EFI_STATUS > - > -**/ > -EFI_STATUS > -ReleaseFormsetList ( > - IN LIST_ENTRY *FormsetList > - ) > -{ > - LIST_ENTRY *HiiFormsetLink; > - LIST_ENTRY *HiiFormsetNextLink; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; > - > - if (FormsetList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (IsListEmpty (FormsetList)) { > - return EFI_SUCCESS; > - } > - > - HiiFormsetLink =3D GetFirstNode (FormsetList); > - while (!IsNull (FormsetList, HiiFormsetLink)) { > - HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); > - HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); > - > - // > - // Detach from list. > - // > - RemoveEntryList (&HiiFormsetPrivate->Link); > - ReleaseFormset (HiiFormsetPrivate); > - FreePool (HiiFormsetPrivate); > - HiiFormsetLink =3D HiiFormsetNextLink; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Get all pending list. > - > - @param[in] HiiHandle HII handle instance. > - @param[in] PendingList Pending list to keep pending data. > - > - @retval REDFISH_PLATFORM_CONFIG_PENDING_LIST * Pointer to > pending list data. > - > -**/ > -REDFISH_PLATFORM_CONFIG_PENDING_LIST * > -GetPendingList ( > - IN EFI_HII_HANDLE *HiiHandle, > - IN LIST_ENTRY *PendingList > - ) > -{ > - LIST_ENTRY *PendingListLink; > - REDFISH_PLATFORM_CONFIG_PENDING_LIST *Target; > - > - if (HiiHandle =3D=3D NULL || PendingList =3D=3D NULL) { > - return NULL; > - } > - > - if (IsListEmpty (PendingList)) { > - return NULL; > - } > - > - PendingListLink =3D GetFirstNode (PendingList); > - while (!IsNull (PendingList, PendingListLink)) { > - Target =3D REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK > (PendingListLink); > - > - if (Target->HiiHandle =3D=3D HiiHandle) { > - return Target; > - } > - > - PendingListLink =3D GetNextNode (PendingList, PendingListLink); > - } > - > - return NULL; > -} > - > -/** > - When HII database is updated. Keep updated HII handle into pending lis= t so > - we can process them later. > - > - @param[in] HiiHandle HII handle instance. > - @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. > - > - @retval EFI_SUCCESS HII handle is saved in pending list. > - @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -NotifyFormsetUpdate ( > - IN EFI_HII_HANDLE *HiiHandle, > - IN LIST_ENTRY *PendingList > - ) > -{ > - REDFISH_PLATFORM_CONFIG_PENDING_LIST *TargetPendingList; > - > - if (HiiHandle =3D=3D NULL || PendingList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - // > - // Check and see if this HII handle is processed already. > - // > - TargetPendingList =3D GetPendingList (HiiHandle, PendingList); > - if (TargetPendingList !=3D NULL) { > - TargetPendingList->IsDeleted =3D FALSE; > - DEBUG_CODE ( > - DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is updated\n", > __FUNCTION__, HiiHandle)); > - ); > - return EFI_SUCCESS; > - } > - > - TargetPendingList=3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_PENDING_LIST)); > - if (TargetPendingList =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - TargetPendingList->HiiHandle =3D HiiHandle; > - TargetPendingList->IsDeleted =3D FALSE; > - > - InsertTailList (PendingList, &TargetPendingList->Link); > - > - DEBUG_CODE ( > - DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is created\n", > __FUNCTION__, HiiHandle)); > - ); > - > - return EFI_SUCCESS; > -} > - > -/** > - When HII database is updated and form-set is deleted. Keep deleted HII > handle into pending list so > - we can process them later. > - > - @param[in] HiiHandle HII handle instance. > - @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. > - > - @retval EFI_SUCCESS HII handle is saved in pending list. > - @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -NotifyFormsetDeleted ( > - IN EFI_HII_HANDLE *HiiHandle, > - IN LIST_ENTRY *PendingList > - ) > -{ > - REDFISH_PLATFORM_CONFIG_PENDING_LIST *TargetPendingList; > - > - if (HiiHandle =3D=3D NULL || PendingList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - // > - // Check and see if this HII handle is processed already. > - // > - TargetPendingList =3D GetPendingList (HiiHandle, PendingList); > - if (TargetPendingList !=3D NULL) { > - TargetPendingList->IsDeleted =3D TRUE; > - DEBUG_CODE ( > - DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is updated and deleted\n= ", > __FUNCTION__, HiiHandle)); > - ); > - return EFI_SUCCESS; > - } > - > - TargetPendingList=3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_PENDING_LIST)); > - if (TargetPendingList =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - TargetPendingList->HiiHandle =3D HiiHandle; > - TargetPendingList->IsDeleted =3D TRUE; > - > - InsertTailList (PendingList, &TargetPendingList->Link); > - > - DEBUG_CODE ( > - DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is deleted\n", > __FUNCTION__, HiiHandle)); > - ); > - > - return EFI_SUCCESS; > -} > - > -/** > - There are HII database update and we need to process them accordingly = so > that we > - won't use stale data. This function will parse updated HII handle agai= n in > order > - to get updated data-set. > - > - @param[in] FormsetList List to keep HII form-set. > - @param[in] PendingList List to keep HII handle that is updated. > - > - @retval EFI_SUCCESS HII handle is saved in pending list. > - @retval EFI_INVALID_PARAMETER FormsetList is NULL or PendingList is > NULL. > - > -**/ > -EFI_STATUS > -ProcessPendingList ( > - IN LIST_ENTRY *FormsetList, > - IN LIST_ENTRY *PendingList > - ) > -{ > - LIST_ENTRY *PendingListLink; > - LIST_ENTRY *PendingListNextLink; > - REDFISH_PLATFORM_CONFIG_PENDING_LIST *Target; > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate; > - EFI_STATUS Status; > - > - > - if (FormsetList =3D=3D NULL || PendingList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (IsListEmpty (PendingList)) { > - return EFI_SUCCESS; > - } > - > - PendingListLink =3D GetFirstNode (PendingList); > - while (!IsNull (PendingList, PendingListLink)) { > - PendingListNextLink =3D GetNextNode (PendingList, PendingListLink); > - Target =3D REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK > (PendingListLink); > - > - if (Target->IsDeleted) { > - // > - // The HII resource on this HII handle is removed. Release the for= mset. > - // > - FormsetPrivate =3D GetFormsetPrivateByHiiHandle (Target->HiiHandle= , > FormsetList); > - if (FormsetPrivate !=3D NULL) { > - DEBUG ((DEBUG_INFO, "%a, formset: %g is removed because driver > release HII resource it already\n", __FUNCTION__, FormsetPrivate->Guid)); > - RemoveEntryList (&FormsetPrivate->Link); > - ReleaseFormset (FormsetPrivate); > - FreePool (FormsetPrivate); > - } else { > - DEBUG ((DEBUG_WARN, "%a, formset on HII handle 0x%x was removed > already\n", __FUNCTION__, Target->HiiHandle)); > - } > - } else { > - // > - // The HII resource on this HII handle is updated/removed. > - // > - FormsetPrivate =3D GetFormsetPrivateByHiiHandle (Target->HiiHandle= , > FormsetList); > - if (FormsetPrivate !=3D NULL) { > - // > - // HII formset already exist, release it and query again. > - // > - DEBUG ((DEBUG_INFO, "%a, formset: %g is updated. Release current > formset\n", __FUNCTION__, &FormsetPrivate->Guid)); > - RemoveEntryList (&FormsetPrivate->Link); > - ReleaseFormset (FormsetPrivate); > - FreePool (FormsetPrivate); > - } > - > - Status =3D LoadFormsetList (Target->HiiHandle, FormsetList); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, load formset from HII handle: 0x%x fai= led: > %r\n", __FUNCTION__, Target->HiiHandle, Status)); > - } > - } > - > - // > - // Detach it from list first. > - // > - RemoveEntryList (&Target->Link); > - FreePool (Target); > - > - PendingListLink =3D PendingListNextLink; > - } > - > - return EFI_SUCCESS; > -} > - > -/** > - Release all resource in statement list. > - > - @param[in] StatementList Statement list to be released. > - > - @retval EFI_SUCCESS All resource are released. > - @retval EFI_INVALID_PARAMETER StatementList is NULL. > - > -**/ > -EFI_STATUS > -ReleaseStatementList ( > - IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList > - ) > -{ > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF *StatementRef; > - LIST_ENTRY *NextLink; > - > - if (StatementList =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (IsListEmpty (&StatementList->StatementList)) { > - return EFI_SUCCESS; > - } > - > - NextLink =3D GetFirstNode (&StatementList->StatementList); > - while (!IsNull (&StatementList->StatementList, NextLink)) { > - StatementRef =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK (NextLink); > - NextLink =3D GetNextNode (&StatementList->StatementList, NextLink); > - > - RemoveEntryList (&StatementRef->Link); > - FreePool (StatementRef); > - } > - > - return EFI_SUCCESS; > -} > +/** @file >=20 > + >=20 > + The implementation of EDKII Redfidh Platform Config Protocol. >=20 > + >=20 > + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > + >=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > +#include "RedfishPlatformConfigDxe.h" >=20 > +#include "RedfishPlatformConfigImpl.h" >=20 > + >=20 > +extern REDFISH_PLATFORM_CONFIG_PRIVATE > *mRedfishPlatformConfigPrivate; >=20 > + >=20 > +/** >=20 > + Debug dump HII string >=20 > + >=20 > + @param[in] HiiHandle HII handle instance >=20 > + @param[in] StringId HII string to dump >=20 > + >=20 > + @retval EFI_SUCCESS Dump HII string successfully >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +DumpHiiString ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN EFI_STRING_ID StringId >=20 > + ) >=20 > +{ >=20 > + EFI_STRING String; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || StringId =3D=3D 0) { >=20 > + DEBUG ((DEBUG_INFO, "???")); >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + String =3D HiiGetString (HiiHandle, StringId, NULL); >=20 > + if (String =3D=3D NULL) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "%s", String)); >=20 > + FreePool (String); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Debug dump HII form-set data >=20 > + >=20 > + @param[in] FormsetPrivate HII form-set private instance. >=20 > + >=20 > + @retval EFI_SUCCESS Dump form-set successfully >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +DumpFormset ( >=20 > + IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormLink; >=20 > + LIST_ENTRY *HiiNextFormLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; >=20 > + LIST_ENTRY *HiiStatementLink; >=20 > + LIST_ENTRY *HiiNextStatementLink; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; >=20 > + UINTN Index; >=20 > + >=20 > + if (FormsetPrivate =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + Index =3D 0; >=20 > + HiiFormLink =3D GetFirstNode (&FormsetPrivate->HiiFormList); >=20 > + while (!IsNull (&FormsetPrivate->HiiFormList, HiiFormLink)) { >=20 > + HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); >=20 > + HiiNextFormLink =3D GetNextNode (&FormsetPrivate->HiiFormList, > HiiFormLink); >=20 > + >=20 > + DEBUG ((DEBUG_INFO, " [%d] form: %d title: ", ++Index, HiiFormPriva= te- > >Id)); >=20 > + DumpHiiString (FormsetPrivate->HiiHandle, HiiFormPrivate->Title); >=20 > + DEBUG ((DEBUG_INFO, "\n")); >=20 > + >=20 > + HiiStatementLink =3D GetFirstNode (&HiiFormPrivate->StatementList); >=20 > + while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) { >=20 > + HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); >=20 > + HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate->StatementLi= st, > HiiStatementLink); >=20 > + >=20 > + DEBUG ((DEBUG_INFO, " QID: 0x%x Prompt: ", HiiStatementPrivate- > >QuestionId)); >=20 > + DumpHiiString (FormsetPrivate->HiiHandle, HiiStatementPrivate- > >Description); >=20 > + DEBUG ((DEBUG_INFO, "\n")); >=20 > + >=20 > + HiiStatementLink =3D HiiNextStatementLink; >=20 > + } >=20 > + >=20 > + HiiFormLink =3D HiiNextFormLink; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Debug dump HII form-set list >=20 > + >=20 > + @param[in] FormsetList Form-set list instance >=20 > + >=20 > + @retval EFI_SUCCESS Dump list successfully >=20 > + @retval Others Errors occur >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +DumpFormsetList ( >=20 > + IN LIST_ENTRY *FormsetList >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormsetLink; >=20 > + LIST_ENTRY *HiiFormsetNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; >=20 > + UINTN Index; >=20 > + >=20 > + if (FormsetList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (FormsetList)) { >=20 > + DEBUG ((DEBUG_INFO, "%a, Empty formset list\n", __FUNCTION__)); >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + Index =3D 0; >=20 > + HiiFormsetLink =3D GetFirstNode (FormsetList); >=20 > + while (!IsNull (FormsetList, HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "[%d] HII Handle: 0x%x formset: %g at %s\n", > ++Index, HiiFormsetPrivate->HiiHandle, &HiiFormsetPrivate->Guid, > HiiFormsetPrivate->DevicePathStr)); >=20 > + DumpFormset (HiiFormsetPrivate); >=20 > + >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Retrieves a string from a string package in a English language. The >=20 > + returned string is allocated using AllocatePool(). The caller is resp= onsible >=20 > + for freeing the allocated buffer using FreePool(). >=20 > + >=20 > + If HiiHandle is NULL, then ASSERT(). >=20 > + If StringId is 0, then ASSET. >=20 > + >=20 > + @param[in] HiiStringProtocol EFI_HII_STRING_PROTOCOL instance. >=20 > + @param[in] HiiHandle A handle that was previously registered = in the > HII Database. >=20 > + @param[in] StringId The identifier of the string to retrieve= d from the > string >=20 > + package associated with HiiHandle. >=20 > + >=20 > + @retval NULL The string specified by StringId is not present in the = string > package. >=20 > + @retval Other The string was returned. >=20 > + >=20 > +**/ >=20 > +EFI_STRING >=20 > +HiiGetRedfishString ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN CHAR8 *Language, >=20 > + IN EFI_STRING_ID StringId >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + UINTN StringSize; >=20 > + CHAR16 TempString; >=20 > + EFI_STRING String; >=20 > + >=20 > + if (mRedfishPlatformConfigPrivate->HiiString =3D=3D NULL || HiiHandle = =3D=3D > NULL || StringId =3D=3D 0 || IS_EMPTY_STRING (Language)) { >=20 > + ASSERT (FALSE); >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + // >=20 > + // Retrieve the size of the string in the string package for the BestL= anguage >=20 > + // >=20 > + StringSize =3D 0; >=20 > + Status =3D mRedfishPlatformConfigPrivate->HiiString->GetString ( >=20 > + mRedfishPlatformConfigPriva= te->HiiString, >=20 > + Language, >=20 > + HiiHandle, >=20 > + StringId, >=20 > + &TempString, >=20 > + &StringSize, >=20 > + NULL >=20 > + ); >=20 > + // >=20 > + // If GetString() returns EFI_SUCCESS for a zero size, >=20 > + // then there are no supported languages registered for HiiHandle. If > GetString() >=20 > + // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is > not present >=20 > + // in the HII Database >=20 > + // >=20 > + if (Status !=3D EFI_BUFFER_TOO_SMALL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + // >=20 > + // Allocate a buffer for the return string >=20 > + // >=20 > + String =3D AllocateZeroPool (StringSize); >=20 > + if (String =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + // >=20 > + // Retrieve the string from the string package >=20 > + // >=20 > + Status =3D mRedfishPlatformConfigPrivate->HiiString->GetString ( >=20 > + mRedfishPlatformConfigPriva= te->HiiString, >=20 > + Language, >=20 > + HiiHandle, >=20 > + StringId, >=20 > + String, >=20 > + &StringSize, >=20 > + NULL >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + // >=20 > + // Free the buffer and return NULL if the supported languages can no= t be > retrieved. >=20 > + // >=20 > + FreePool (String); >=20 > + String =3D NULL; >=20 > + } >=20 > + >=20 > + // >=20 > + // Return the Null-terminated Unicode string >=20 > + // >=20 > + return String; >=20 > +} >=20 > + >=20 > +/** >=20 > + Retrieves a string from a string package in a English language. The >=20 > + returned string is allocated using AllocatePool(). The caller is resp= onsible >=20 > + for freeing the allocated buffer using FreePool(). >=20 > + >=20 > + If HiiHandle is NULL, then ASSERT(). >=20 > + If StringId is 0, then ASSET. >=20 > + >=20 > + @param[in] HiiStringProtocol EFI_HII_STRING_PROTOCOL instance. >=20 > + @param[in] HiiHandle A handle that was previously registered = in the > HII Database. >=20 > + @param[in] StringId The identifier of the string to retrieve= d from the > string >=20 > + package associated with HiiHandle. >=20 > + >=20 > + @retval NULL The string specified by StringId is not present in the = string > package. >=20 > + @retval Other The string was returned. >=20 > + >=20 > +**/ >=20 > +CHAR8 * >=20 > +HiiGetRedfishAsciiString ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN CHAR8 *Language, >=20 > + IN EFI_STRING_ID StringId >=20 > + ) >=20 > +{ >=20 > + EFI_STRING HiiString; >=20 > + UINTN StringSize; >=20 > + CHAR8 *AsciiString; >=20 > + >=20 > + HiiString =3D HiiGetRedfishString (HiiHandle, Language, StringId); >=20 > + if (HiiString =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, Can not find string ID: 0x%x with %a\n", > __FUNCTION__, StringId, Language)); >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + StringSize =3D (StrLen (HiiString) + 1) * sizeof (CHAR8); >=20 > + AsciiString =3D AllocatePool (StringSize); >=20 > + if (AsciiString =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + UnicodeStrToAsciiStrS (HiiString, AsciiString, StringSize); >=20 > + >=20 > + FreePool (HiiString); >=20 > + return AsciiString; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get string from HII database in English language. >=20 > + >=20 > + @param[in] HiiHandle A handle that was previously registered = in the > HII Database. >=20 > + @param[in] StringId The identifier of the string to retrieve= d from the > string >=20 > + package associated with HiiHandle. >=20 > + >=20 > + @retval NULL The string specified by StringId is not present in the = string > package. >=20 > + @retval Other The string was returned. >=20 > + >=20 > +**/ >=20 > +EFI_STRING >=20 > +HiiGetEnglishString ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN EFI_STRING_ID StringId >=20 > + ) >=20 > +{ >=20 > + return HiiGetRedfishString (HiiHandle, ENGLISH_LANGUAGE_CODE, > StringId); >=20 > +} >=20 > + >=20 > +/** >=20 > + Check and see if this is supported schema or not. >=20 > + >=20 > + @param[in] SupportedSchema The list of supported schema. >=20 > + @param[in] Schema Schema string to be checked. >=20 > + >=20 > + @retval BOOLEAN TRUE if this is supported schema. FALSE > otherwise. >=20 > + >=20 > +**/ >=20 > +BOOLEAN >=20 > +CheckSupportedSchema ( >=20 > + IN REDFISH_PLATFORM_CONFIG_SCHEMA *SupportedSchema, >=20 > + IN CHAR8 *Schema >=20 > + ) >=20 > +{ >=20 > + UINTN Index; >=20 > + >=20 > + if (SupportedSchema =3D=3D NULL || IS_EMPTY_STRING (Schema)) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + if (SupportedSchema->Count =3D=3D 0) { >=20 > + return FALSE; >=20 > + } >=20 > + >=20 > + for (Index =3D 0; Index < SupportedSchema->Count; Index++) { >=20 > + if (AsciiStrCmp (SupportedSchema->SchemaList[Index], Schema) =3D=3D = 0) { >=20 > + return TRUE; >=20 > + } >=20 > + } >=20 > + >=20 > + return FALSE; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get the list of supported schema from the given HII handle. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[out] SupportedSchema Supported schema on this HII handle. >=20 > + >=20 > + @retval EFI_SUCCESS Schema list is returned. >=20 > + @retval EFI_INVALID_PARAMETER HiiHandle is NULL or SupportedSchema > is NULL. >=20 > + @retval EFI_NOT_FOUND No supported schema found. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +GetSupportedSchema ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + OUT REDFISH_PLATFORM_CONFIG_SCHEMA *SupportedSchema >=20 > + ) >=20 > +{ >=20 > + CHAR8 *SupportedLanguages; >=20 > + UINTN Index; >=20 > + UINTN LangIndex; >=20 > + UINTN Count; >=20 > + UINTN StrSize; >=20 > + UINTN ListIndex; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || SupportedSchema =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + SupportedSchema->Count =3D 0; >=20 > + >=20 > + SupportedLanguages =3D HiiGetSupportedLanguages (HiiHandle); >=20 > + if (SupportedLanguages =3D=3D NULL) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + Index =3D 0; >=20 > + LangIndex =3D 0; >=20 > + Count =3D 0; >=20 > + while (TRUE) { >=20 > + if (SupportedLanguages[Index] =3D=3D ';' || SupportedLanguages[Index= ] =3D=3D > '\0') { >=20 > + if (AsciiStrnCmp (&SupportedLanguages[LangIndex], > X_UEFI_SCHEMA_PREFIX, AsciiStrLen (X_UEFI_SCHEMA_PREFIX)) =3D=3D 0) { >=20 > + ++Count; >=20 > + } >=20 > + LangIndex =3D Index + 1; >=20 > + } >=20 > + >=20 > + if (SupportedLanguages[Index] =3D=3D '\0') { >=20 > + break; >=20 > + } >=20 > + >=20 > + ++Index; >=20 > + } >=20 > + >=20 > + if (Count =3D=3D 0) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + SupportedSchema->Count =3D Count; >=20 > + SupportedSchema->SchemaList =3D AllocatePool (sizeof (CHAR8 *) * Count= ); >=20 > + if (SupportedSchema->SchemaList =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + Index =3D 0; >=20 > + LangIndex =3D 0; >=20 > + ListIndex =3D 0; >=20 > + while (TRUE) { >=20 > + >=20 > + if (SupportedLanguages[Index] =3D=3D ';' || SupportedLanguages[Index= ] =3D=3D > '\0') { >=20 > + if (AsciiStrnCmp (&SupportedLanguages[LangIndex], > X_UEFI_SCHEMA_PREFIX, AsciiStrLen (X_UEFI_SCHEMA_PREFIX)) =3D=3D 0) { >=20 > + StrSize =3D Index - LangIndex; >=20 > + SupportedSchema->SchemaList[ListIndex] =3D AllocateCopyPool ((St= rSize > + 1), &SupportedLanguages[LangIndex]); >=20 > + SupportedSchema->SchemaList[ListIndex][StrSize] =3D '\0'; >=20 > + ++ListIndex; >=20 > + } >=20 > + >=20 > + LangIndex =3D Index + 1; >=20 > + } >=20 > + >=20 > + if (SupportedLanguages[Index] =3D=3D '\0') { >=20 > + break; >=20 > + } >=20 > + >=20 > + ++Index; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Search and find statement private instance by given regular expression > patthern >=20 > + which describes the Configure Language. >=20 > + >=20 > + @param[in] RegularExpressionProtocol Regular express protocol. >=20 > + @param[in] FormsetList Form-set list to search. >=20 > + @param[in] Schema Schema to be matched. >=20 > + @param[in] Pattern Regular expression pattern. >=20 > + @param[out] StatementList Statement list that match abov= e > pattern. >=20 > + >=20 > + @retval EFI_SUCCESS Statement list is returned. >=20 > + @retval EFI_INVALID_PARAMETER Input parameter is NULL. >=20 > + @retval EFI_NOT_READY Regular express protocol is NULL. >=20 > + @retval EFI_NOT_FOUND No statement is found. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +GetStatementPrivateByConfigureLangRegex ( >=20 > + IN EFI_REGULAR_EXPRESSION_PROTOCOL > *RegularExpressionProtocol, >=20 > + IN LIST_ENTRY *FormsetList, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING Pattern, >=20 > + OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormsetLink; >=20 > + LIST_ENTRY *HiiFormsetNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; >=20 > + LIST_ENTRY *HiiFormLink; >=20 > + LIST_ENTRY *HiiNextFormLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; >=20 > + LIST_ENTRY *HiiStatementLink; >=20 > + LIST_ENTRY *HiiNextStatementLink; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; >=20 > + EFI_STRING TmpString; >=20 > + UINTN CaptureCount; >=20 > + BOOLEAN IsMatch; >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF *StatementRef; >=20 > + >=20 > + if (FormsetList =3D=3D NULL || IS_EMPTY_STRING (Schema) || > IS_EMPTY_STRING (Pattern) || StatementList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (RegularExpressionProtocol =3D=3D NULL) { >=20 > + return EFI_NOT_READY; >=20 > + } >=20 > + >=20 > + StatementList->Count =3D 0; >=20 > + InitializeListHead (&StatementList->StatementList); >=20 > + >=20 > + if (IsListEmpty (FormsetList)) { >=20 > + return EFI_NOT_FOUND; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D GetFirstNode (FormsetList); >=20 > + while (!IsNull (FormsetList, HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + // >=20 > + // Performance check. >=20 > + // If there is no desired Redfish schema found, skip this formset. >=20 > + // >=20 > + if (!CheckSupportedSchema (&HiiFormsetPrivate->SupportedSchema, > Schema)) { >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + continue; >=20 > + } >=20 > + >=20 > + HiiFormLink =3D GetFirstNode (&HiiFormsetPrivate->HiiFormList); >=20 > + while (!IsNull (&HiiFormsetPrivate->HiiFormList, HiiFormLink)) { >=20 > + HiiNextFormLink =3D GetNextNode (&HiiFormsetPrivate->HiiFormList, > HiiFormLink); >=20 > + HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); >=20 > + >=20 > + HiiStatementLink =3DGetFirstNode (&HiiFormPrivate->StatementList); >=20 > + while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink))= { >=20 > + HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate- > >StatementList, HiiStatementLink); >=20 > + HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); >=20 > + >=20 > + if (HiiStatementPrivate->Description !=3D 0) { >=20 > + TmpString =3D HiiGetRedfishString (HiiFormsetPrivate->HiiHandl= e, > Schema, HiiStatementPrivate->Description); >=20 > + if (TmpString !=3D NULL) { >=20 > + Status =3D RegularExpressionProtocol->MatchString ( >=20 > + RegularExpressionProto= col, >=20 > + TmpString, >=20 > + Pattern, >=20 > + &gEfiRegexSyntaxTypePe= rlGuid, >=20 > + &IsMatch, >=20 > + NULL, >=20 > + &CaptureCount >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, MatchString \"%s\" failed: %r\n"= , > __FUNCTION__, Pattern, Status)); >=20 > + ASSERT (FALSE); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + // >=20 > + // Found >=20 > + // >=20 > + if (IsMatch) { >=20 > + StatementRef =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF)); >=20 > + if (StatementRef =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + StatementRef->Statement =3D HiiStatementPrivate; >=20 > + InsertTailList (&StatementList->StatementList, &StatementR= ef- > >Link); >=20 > + ++StatementList->Count; >=20 > + } >=20 > + >=20 > + FreePool (TmpString); >=20 > + } >=20 > + } >=20 > + >=20 > + HiiStatementLink =3D HiiNextStatementLink; >=20 > + } >=20 > + >=20 > + HiiFormLink =3D HiiNextFormLink; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get statement private instance by the given configure language. >=20 > + >=20 > + @param[in] FormsetList Form-set list to search. >=20 > + @param[in] Schema Schema to be matched. >=20 > + @param[in] ConfigureLang Configure language. >=20 > + >=20 > + @retval REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * Pointer > to statement private instance. >=20 > + >=20 > +**/ >=20 > +REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * >=20 > +GetStatementPrivateByConfigureLang ( >=20 > + IN LIST_ENTRY *FormsetList, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING ConfigureLang >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormsetLink; >=20 > + LIST_ENTRY *HiiFormsetNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; >=20 > + LIST_ENTRY *HiiFormLink; >=20 > + LIST_ENTRY *HiiNextFormLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; >=20 > + LIST_ENTRY *HiiStatementLink; >=20 > + LIST_ENTRY *HiiNextStatementLink; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; >=20 > + EFI_STRING TmpString; >=20 > + >=20 > + if (FormsetList =3D=3D NULL || IS_EMPTY_STRING (Schema) || > IS_EMPTY_STRING (ConfigureLang)) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (FormsetList)) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D GetFirstNode (FormsetList); >=20 > + while (!IsNull (FormsetList, HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + // >=20 > + // Performance check. >=20 > + // If there is no desired Redfish schema found, skip this formset. >=20 > + // >=20 > + if (!CheckSupportedSchema (&HiiFormsetPrivate->SupportedSchema, > Schema)) { >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + continue; >=20 > + } >=20 > + >=20 > + HiiFormLink =3D GetFirstNode (&HiiFormsetPrivate->HiiFormList); >=20 > + while (!IsNull (&HiiFormsetPrivate->HiiFormList, HiiFormLink)) { >=20 > + HiiNextFormLink =3D GetNextNode (&HiiFormsetPrivate->HiiFormList, > HiiFormLink); >=20 > + HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); >=20 > + >=20 > + HiiStatementLink =3DGetFirstNode (&HiiFormPrivate->StatementList); >=20 > + while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink))= { >=20 > + HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate- > >StatementList, HiiStatementLink); >=20 > + HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); >=20 > + >=20 > + DEBUG_CODE ( >=20 > + STATIC UINTN Index =3D 0; >=20 > + DEBUG ((DEBUG_INFO, "%a, [%d] search %s in QID: 0x%x form: 0x%= x > formset: %g\n", __FUNCTION__, ++Index, ConfigureLang, > HiiStatementPrivate->QuestionId, HiiFormPrivate->Id, &HiiFormsetPrivate- > >Guid)); >=20 > + ); >=20 > + >=20 > + if (HiiStatementPrivate->Description !=3D 0) { >=20 > + TmpString =3D HiiGetRedfishString (HiiFormsetPrivate->HiiHandl= e, > Schema, HiiStatementPrivate->Description); >=20 > + if (TmpString !=3D NULL) { >=20 > + if (StrCmp (TmpString, ConfigureLang) =3D=3D 0) { >=20 > + FreePool (TmpString); >=20 > + return HiiStatementPrivate; >=20 > + } >=20 > + >=20 > + FreePool (TmpString); >=20 > + } >=20 > + } >=20 > + >=20 > + HiiStatementLink =3D HiiNextStatementLink; >=20 > + } >=20 > + >=20 > + HiiFormLink =3D HiiNextFormLink; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get form-set private instance by the given HII handle. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[in] FormsetList Form-set list to search. >=20 > + >=20 > + @retval REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * Pointer to > form-set private instance. >=20 > + >=20 > +**/ >=20 > +REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * >=20 > +GetFormsetPrivateByHiiHandle ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN LIST_ENTRY *FormsetList >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormsetLink; >=20 > + LIST_ENTRY *HiiFormsetNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || FormsetList =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (FormsetList)) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D GetFirstNode (FormsetList); >=20 > + while (!IsNull (FormsetList, HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + if (HiiFormsetPrivate->HiiHandle =3D=3D HiiHandle) { >=20 > + return HiiFormsetPrivate; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + Release formset and all the forms and statements that belong to this > formset. >=20 > + >=20 > + @param[in] FormsetPrivate Pointer to HP_HII_FORM_SET_PRIVATE >=20 > + >=20 > + @retval EFI_STATUS >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ReleaseFormset ( >=20 > + IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormLink; >=20 > + LIST_ENTRY *HiiNextFormLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; >=20 > + LIST_ENTRY *HiiStatementLink; >=20 > + LIST_ENTRY *HiiNextStatementLink; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; >=20 > + UINTN Index; >=20 > + >=20 > + if (FormsetPrivate =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + HiiFormLink =3D GetFirstNode (&FormsetPrivate->HiiFormList); >=20 > + while (!IsNull (&FormsetPrivate->HiiFormList, HiiFormLink)) { >=20 > + HiiFormPrivate =3D REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK > (HiiFormLink); >=20 > + HiiNextFormLink =3D GetNextNode (&FormsetPrivate->HiiFormList, > HiiFormLink); >=20 > + >=20 > + HiiStatementLink =3D GetFirstNode (&HiiFormPrivate->StatementList); >=20 > + while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) { >=20 > + HiiStatementPrivate =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink); >=20 > + HiiNextStatementLink =3D GetNextNode (&HiiFormPrivate->StatementLi= st, > HiiStatementLink); >=20 > + >=20 > + // >=20 > + // HiiStatementPrivate->HiiStatement will be released in > DestroyFormSet(). >=20 > + // >=20 > + >=20 > + if (HiiStatementPrivate->DesStringCache !=3D NULL) { >=20 > + FreePool (HiiStatementPrivate->DesStringCache); >=20 > + HiiStatementPrivate->DesStringCache =3D NULL; >=20 > + } >=20 > + >=20 > + RemoveEntryList (&HiiStatementPrivate->Link); >=20 > + FreePool (HiiStatementPrivate); >=20 > + HiiStatementLink =3D HiiNextStatementLink; >=20 > + } >=20 > + >=20 > + // >=20 > + // HiiStatementPrivate->HiiForm will be released in DestroyFormSet()= . >=20 > + // >=20 > + >=20 > + RemoveEntryList (&HiiFormPrivate->Link); >=20 > + FreePool (HiiFormPrivate); >=20 > + HiiFormLink =3D HiiNextFormLink; >=20 > + } >=20 > + >=20 > + if (FormsetPrivate->HiiFormSet !=3D NULL) { >=20 > + DestroyFormSet (FormsetPrivate->HiiFormSet); >=20 > + FormsetPrivate->HiiFormSet =3D NULL; >=20 > + } >=20 > + >=20 > + FreePool (FormsetPrivate->DevicePathStr); >=20 > + >=20 > + // >=20 > + // Release schema list >=20 > + // >=20 > + if (FormsetPrivate->SupportedSchema.SchemaList !=3D NULL) { >=20 > + for (Index =3D 0; Index < FormsetPrivate->SupportedSchema.Count; > Index++) { >=20 > + FreePool (FormsetPrivate->SupportedSchema.SchemaList[Index]); >=20 > + } >=20 > + >=20 > + FreePool (FormsetPrivate->SupportedSchema.SchemaList); >=20 > + FormsetPrivate->SupportedSchema.SchemaList =3D NULL; >=20 > + FormsetPrivate->SupportedSchema.Count =3D 0; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Create new form-set instance. >=20 > + >=20 > + @retval REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * Pointer to > newly created form-set private instance. >=20 > + >=20 > +**/ >=20 > +REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE * >=20 > +NewFormsetPrivate ( >=20 > + VOID >=20 > + ) >=20 > +{ >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *NewFormsetPrivate; >=20 > + >=20 > + NewFormsetPrivate =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE)); >=20 > + if (NewFormsetPrivate =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + // >=20 > + // Initial newly created formset private data. >=20 > + // >=20 > + InitializeListHead (&NewFormsetPrivate->HiiFormList); >=20 > + >=20 > + return NewFormsetPrivate; >=20 > +} >=20 > + >=20 > +/** >=20 > + Load the HII formset from the given HII handle. >=20 > + >=20 > + @param[in] HiiHandle Target HII handle to load. >=20 > + @param[out] FormsetPrivate The formset private data. >=20 > + >=20 > + @retval EFI_STATUS >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +LoadFormset ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + OUT REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE > *FormsetPrivate >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + HII_FORMSET *HiiFormSet; >=20 > + HII_FORM *HiiForm; >=20 > + LIST_ENTRY *HiiFormLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *HiiFormPrivate; >=20 > + HII_STATEMENT *HiiStatement; >=20 > + LIST_ENTRY *HiiStatementLink; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > *HiiStatementPrivate; >=20 > + EFI_GUID ZeroGuid; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || FormsetPrivate =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + >=20 > + HiiFormSet =3D AllocateZeroPool (sizeof (HII_FORMSET)); >=20 > + if (HiiFormSet =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + // >=20 > + // Find HII formset by the given HII handle. >=20 > + // >=20 > + ZeroMem (&ZeroGuid, sizeof (ZeroGuid)); >=20 > + Status =3D CreateFormSetFromHiiHandle (HiiHandle, &ZeroGuid, HiiFormSe= t); >=20 > + if (EFI_ERROR (Status) || IsListEmpty (&HiiFormSet->FormListHead)) { >=20 > + Status =3D EFI_NOT_FOUND; >=20 > + goto ErrorExit; >=20 > + } >=20 > + >=20 > + // >=20 > + // Initialize formset >=20 > + // >=20 > + InitializeFormSet (HiiFormSet); >=20 > + >=20 > + // >=20 > + // Initialize formset private data. >=20 > + // >=20 > + FormsetPrivate->HiiFormSet =3D HiiFormSet; >=20 > + FormsetPrivate->HiiHandle =3D HiiHandle; >=20 > + CopyGuid (&FormsetPrivate->Guid, &HiiFormSet->Guid); >=20 > + FormsetPrivate->DevicePathStr =3D ConvertDevicePathToText (HiiFormSet- > >DevicePath, FALSE, FALSE); >=20 > + Status =3D GetSupportedSchema (FormsetPrivate->HiiHandle, > &FormsetPrivate->SupportedSchema); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_WARN, "%a, No schema from HII handle: 0x%x found: > %r\n", __FUNCTION__, FormsetPrivate->HiiHandle, Status)); >=20 > + } >=20 > + >=20 > + HiiFormLink =3D GetFirstNode (&HiiFormSet->FormListHead); >=20 > + while (!IsNull (&HiiFormSet->FormListHead, HiiFormLink)) { >=20 > + HiiForm =3D HII_FORM_FROM_LINK (HiiFormLink); >=20 > + >=20 > + HiiFormPrivate =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_FORM_PRIVATE)); >=20 > + if (HiiFormPrivate =3D=3D NULL) { >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto ErrorExit; >=20 > + } >=20 > + >=20 > + // >=20 > + // Initialize form private data. >=20 > + // >=20 > + HiiFormPrivate->HiiForm =3D HiiForm; >=20 > + HiiFormPrivate->Id =3D HiiForm->FormId; >=20 > + HiiFormPrivate->Title =3D HiiForm->FormTitle; >=20 > + HiiFormPrivate->ParentFormset =3D FormsetPrivate; >=20 > + InitializeListHead (&HiiFormPrivate->StatementList); >=20 > + >=20 > + HiiStatementLink =3D GetFirstNode (&HiiForm->StatementListHead); >=20 > + while (!IsNull (&HiiForm->StatementListHead, HiiStatementLink)) { >=20 > + HiiStatement =3D HII_STATEMENT_FROM_LINK (HiiStatementLink); >=20 > + >=20 > + HiiStatementPrivate =3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE)); >=20 > + if (HiiStatementPrivate =3D=3D NULL) { >=20 > + Status =3D EFI_OUT_OF_RESOURCES; >=20 > + goto ErrorExit; >=20 > + } >=20 > + // >=20 > + // Initialize statement private data. >=20 > + // >=20 > + HiiStatementPrivate->HiiStatement =3D HiiStatement; >=20 > + HiiStatementPrivate->QuestionId =3D HiiStatement->QuestionId; >=20 > + HiiStatementPrivate->Description =3D HiiStatement->Prompt; >=20 > + HiiStatementPrivate->ParentForm =3D HiiFormPrivate; >=20 > + >=20 > + // >=20 > + // Attach to statement list. >=20 > + // >=20 > + InsertTailList (&HiiFormPrivate->StatementList, &HiiStatementPriva= te- > >Link); >=20 > + HiiStatementLink =3D GetNextNode (&HiiForm->StatementListHead, > HiiStatementLink); >=20 > + } >=20 > + // >=20 > + // Attach to form list. >=20 > + // >=20 > + InsertTailList (&FormsetPrivate->HiiFormList, &HiiFormPrivate->Link)= ; >=20 > + HiiFormLink =3D GetNextNode (&HiiFormSet->FormListHead, HiiFormLink)= ; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > + >=20 > +ErrorExit: >=20 > + >=20 > + // >=20 > + // Release HiiFormSet if HiiFormSet is not linked to FormsetPrivate ye= t. >=20 > + // >=20 > + if (HiiFormSet !=3D NULL && FormsetPrivate->HiiFormSet !=3D HiiFormSet= ) { >=20 > + DestroyFormSet (HiiFormSet); >=20 > + } >=20 > + >=20 > + // >=20 > + // Release resource when error happens. >=20 > + // >=20 > + ReleaseFormset (FormsetPrivate); >=20 > + >=20 > + return Status; >=20 > +} >=20 > + >=20 > +/** >=20 > + Release formset list and all the forms that belong to this formset. >=20 > + >=20 > + @param[in] FormsetList Pointer to formst list that needs to be >=20 > + released. >=20 > + >=20 > + @retval EFI_STATUS >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +LoadFormsetList ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + OUT LIST_ENTRY *FormsetList >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || FormsetList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + FormsetPrivate =3D GetFormsetPrivateByHiiHandle (HiiHandle, FormsetLis= t); >=20 > + if (FormsetPrivate !=3D NULL) { >=20 > + return EFI_ALREADY_STARTED; >=20 > + } >=20 > + >=20 > + FormsetPrivate =3D NewFormsetPrivate (); >=20 > + if (FormsetPrivate =3D=3D NULL) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__)); >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + // >=20 > + // Load formset on the given HII handle. >=20 > + // >=20 > + Status =3D LoadFormset (HiiHandle, FormsetPrivate); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, failed to load formset: %r\n", > __FUNCTION__, Status)); >=20 > + FreePool (FormsetPrivate); >=20 > + return Status; >=20 > + } >=20 > + >=20 > + // >=20 > + // Attach to cache list. >=20 > + // >=20 > + InsertTailList (FormsetList, &FormsetPrivate->Link); >=20 > + >=20 > + DEBUG_CODE ( >=20 > + DumpFormsetList (FormsetList); >=20 > + ); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Release formset list and all the forms that belong to this formset. >=20 > + >=20 > + @param[in] FormsetList Pointer to formst list that needs to be >=20 > + released. >=20 > + >=20 > + @retval EFI_STATUS >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ReleaseFormsetList ( >=20 > + IN LIST_ENTRY *FormsetList >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *HiiFormsetLink; >=20 > + LIST_ENTRY *HiiFormsetNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *HiiFormsetPrivate; >=20 > + >=20 > + if (FormsetList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (FormsetList)) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + HiiFormsetLink =3D GetFirstNode (FormsetList); >=20 > + while (!IsNull (FormsetList, HiiFormsetLink)) { >=20 > + HiiFormsetNextLink =3D GetNextNode (FormsetList, HiiFormsetLink); >=20 > + HiiFormsetPrivate =3D > REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink); >=20 > + >=20 > + // >=20 > + // Detach from list. >=20 > + // >=20 > + RemoveEntryList (&HiiFormsetPrivate->Link); >=20 > + ReleaseFormset (HiiFormsetPrivate); >=20 > + FreePool (HiiFormsetPrivate); >=20 > + HiiFormsetLink =3D HiiFormsetNextLink; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get all pending list. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[in] PendingList Pending list to keep pending data. >=20 > + >=20 > + @retval REDFISH_PLATFORM_CONFIG_PENDING_LIST * Pointer to > pending list data. >=20 > + >=20 > +**/ >=20 > +REDFISH_PLATFORM_CONFIG_PENDING_LIST * >=20 > +GetPendingList ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *PendingListLink; >=20 > + REDFISH_PLATFORM_CONFIG_PENDING_LIST *Target; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || PendingList =3D=3D NULL) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (PendingList)) { >=20 > + return NULL; >=20 > + } >=20 > + >=20 > + PendingListLink =3D GetFirstNode (PendingList); >=20 > + while (!IsNull (PendingList, PendingListLink)) { >=20 > + Target =3D REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK > (PendingListLink); >=20 > + >=20 > + if (Target->HiiHandle =3D=3D HiiHandle) { >=20 > + return Target; >=20 > + } >=20 > + >=20 > + PendingListLink =3D GetNextNode (PendingList, PendingListLink); >=20 > + } >=20 > + >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + When HII database is updated. Keep updated HII handle into pending lis= t > so >=20 > + we can process them later. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. >=20 > + >=20 > + @retval EFI_SUCCESS HII handle is saved in pending list. >=20 > + @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +NotifyFormsetUpdate ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ) >=20 > +{ >=20 > + REDFISH_PLATFORM_CONFIG_PENDING_LIST *TargetPendingList; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || PendingList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + // >=20 > + // Check and see if this HII handle is processed already. >=20 > + // >=20 > + TargetPendingList =3D GetPendingList (HiiHandle, PendingList); >=20 > + if (TargetPendingList !=3D NULL) { >=20 > + TargetPendingList->IsDeleted =3D FALSE; >=20 > + DEBUG_CODE ( >=20 > + DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is updated\n", > __FUNCTION__, HiiHandle)); >=20 > + ); >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + TargetPendingList=3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_PENDING_LIST)); >=20 > + if (TargetPendingList =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + TargetPendingList->HiiHandle =3D HiiHandle; >=20 > + TargetPendingList->IsDeleted =3D FALSE; >=20 > + >=20 > + InsertTailList (PendingList, &TargetPendingList->Link); >=20 > + >=20 > + DEBUG_CODE ( >=20 > + DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is created\n", > __FUNCTION__, HiiHandle)); >=20 > + ); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + When HII database is updated and form-set is deleted. Keep deleted HII > handle into pending list so >=20 > + we can process them later. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. >=20 > + >=20 > + @retval EFI_SUCCESS HII handle is saved in pending list. >=20 > + @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +NotifyFormsetDeleted ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ) >=20 > +{ >=20 > + REDFISH_PLATFORM_CONFIG_PENDING_LIST *TargetPendingList; >=20 > + >=20 > + if (HiiHandle =3D=3D NULL || PendingList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + // >=20 > + // Check and see if this HII handle is processed already. >=20 > + // >=20 > + TargetPendingList =3D GetPendingList (HiiHandle, PendingList); >=20 > + if (TargetPendingList !=3D NULL) { >=20 > + TargetPendingList->IsDeleted =3D TRUE; >=20 > + DEBUG_CODE ( >=20 > + DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is updated and deleted\n= ", > __FUNCTION__, HiiHandle)); >=20 > + ); >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + TargetPendingList=3D AllocateZeroPool (sizeof > (REDFISH_PLATFORM_CONFIG_PENDING_LIST)); >=20 > + if (TargetPendingList =3D=3D NULL) { >=20 > + return EFI_OUT_OF_RESOURCES; >=20 > + } >=20 > + >=20 > + TargetPendingList->HiiHandle =3D HiiHandle; >=20 > + TargetPendingList->IsDeleted =3D TRUE; >=20 > + >=20 > + InsertTailList (PendingList, &TargetPendingList->Link); >=20 > + >=20 > + DEBUG_CODE ( >=20 > + DEBUG ((DEBUG_INFO, "%a, HII handle: 0x%x is deleted\n", > __FUNCTION__, HiiHandle)); >=20 > + ); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + There are HII database update and we need to process them accordingly > so that we >=20 > + won't use stale data. This function will parse updated HII handle agai= n in > order >=20 > + to get updated data-set. >=20 > + >=20 > + @param[in] FormsetList List to keep HII form-set. >=20 > + @param[in] PendingList List to keep HII handle that is updated. >=20 > + >=20 > + @retval EFI_SUCCESS HII handle is saved in pending list. >=20 > + @retval EFI_INVALID_PARAMETER FormsetList is NULL or PendingList is > NULL. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ProcessPendingList ( >=20 > + IN LIST_ENTRY *FormsetList, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ) >=20 > +{ >=20 > + LIST_ENTRY *PendingListLink; >=20 > + LIST_ENTRY *PendingListNextLink; >=20 > + REDFISH_PLATFORM_CONFIG_PENDING_LIST *Target; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate; >=20 > + EFI_STATUS Status; >=20 > + >=20 > + >=20 > + if (FormsetList =3D=3D NULL || PendingList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (PendingList)) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + PendingListLink =3D GetFirstNode (PendingList); >=20 > + while (!IsNull (PendingList, PendingListLink)) { >=20 > + PendingListNextLink =3D GetNextNode (PendingList, PendingListLink); >=20 > + Target =3D REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK > (PendingListLink); >=20 > + >=20 > + if (Target->IsDeleted) { >=20 > + // >=20 > + // The HII resource on this HII handle is removed. Release the for= mset. >=20 > + // >=20 > + FormsetPrivate =3D GetFormsetPrivateByHiiHandle (Target->HiiHandle= , > FormsetList); >=20 > + if (FormsetPrivate !=3D NULL) { >=20 > + DEBUG ((DEBUG_INFO, "%a, formset: %g is removed because driver > release HII resource it already\n", __FUNCTION__, FormsetPrivate->Guid)); >=20 > + RemoveEntryList (&FormsetPrivate->Link); >=20 > + ReleaseFormset (FormsetPrivate); >=20 > + FreePool (FormsetPrivate); >=20 > + } else { >=20 > + DEBUG ((DEBUG_WARN, "%a, formset on HII handle 0x%x was > removed already\n", __FUNCTION__, Target->HiiHandle)); >=20 > + } >=20 > + } else { >=20 > + // >=20 > + // The HII resource on this HII handle is updated/removed. >=20 > + // >=20 > + FormsetPrivate =3D GetFormsetPrivateByHiiHandle (Target->HiiHandle= , > FormsetList); >=20 > + if (FormsetPrivate !=3D NULL) { >=20 > + // >=20 > + // HII formset already exist, release it and query again. >=20 > + // >=20 > + DEBUG ((DEBUG_INFO, "%a, formset: %g is updated. Release current > formset\n", __FUNCTION__, &FormsetPrivate->Guid)); >=20 > + RemoveEntryList (&FormsetPrivate->Link); >=20 > + ReleaseFormset (FormsetPrivate); >=20 > + FreePool (FormsetPrivate); >=20 > + } >=20 > + >=20 > + Status =3D LoadFormsetList (Target->HiiHandle, FormsetList); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "%a, load formset from HII handle: 0x%x > failed: %r\n", __FUNCTION__, Target->HiiHandle, Status)); >=20 > + } >=20 > + } >=20 > + >=20 > + // >=20 > + // Detach it from list first. >=20 > + // >=20 > + RemoveEntryList (&Target->Link); >=20 > + FreePool (Target); >=20 > + >=20 > + PendingListLink =3D PendingListNextLink; >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Release all resource in statement list. >=20 > + >=20 > + @param[in] StatementList Statement list to be released. >=20 > + >=20 > + @retval EFI_SUCCESS All resource are released. >=20 > + @retval EFI_INVALID_PARAMETER StatementList is NULL. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ReleaseStatementList ( >=20 > + IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList >=20 > + ) >=20 > +{ >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF *StatementRef; >=20 > + LIST_ENTRY *NextLink; >=20 > + >=20 > + if (StatementList =3D=3D NULL) { >=20 > + return EFI_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (IsListEmpty (&StatementList->StatementList)) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + NextLink =3D GetFirstNode (&StatementList->StatementList); >=20 > + while (!IsNull (&StatementList->StatementList, NextLink)) { >=20 > + StatementRef =3D > REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK (NextLink); >=20 > + NextLink =3D GetNextNode (&StatementList->StatementList, NextLink); >=20 > + >=20 > + RemoveEntryList (&StatementRef->Link); >=20 > + FreePool (StatementRef); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > index e0ba0fb2d3..4ffe52e4da 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > @@ -1,274 +1,298 @@ > -/** @file > - This file defines the EDKII Redfish Platform Config Protocol interface= . > - > - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_ > -#define EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_ > - > -#include > - > -// > -// Libraries > -// > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#define REDFISH_PLATFORM_CONFIG_DELETE_EXPIRED_FORMSET 0x00 > -#define IS_EMPTY_STRING(a) (a =3D=3D NULL = || a[0] =3D=3D L'\0') > -#define ENGLISH_LANGUAGE_CODE "en-US" > -#define X_UEFI_SCHEMA_PREFIX "x-uefi-redfish= -" > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_PRIVATE. > -// > -typedef struct { > - LIST_ENTRY Link; > - EFI_HII_HANDLE HiiHandle; > - BOOLEAN IsDeleted; > -} REDFISH_PLATFORM_CONFIG_PENDING_LIST; > - > -#define REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_PENDING_LIST, Link) > - > -typedef struct { > - UINTN Count; // Number of schema in l= ist > - CHAR8 **SchemaList; // Schema list > -} REDFISH_PLATFORM_CONFIG_SCHEMA; > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE > -// > -typedef struct { > - LIST_ENTRY Link; > - HII_FORMSET *HiiFormSet; // Pointer to HII for= mset data. > - EFI_GUID Guid; // Formset GUID. > - EFI_HII_HANDLE HiiHandle; // Hii Handle of this= formset. > - LIST_ENTRY HiiFormList; // Form list that kee= p form data under > this formset. > - CHAR16 *DevicePathStr; // Device path of thi= s formset. > - REDFISH_PLATFORM_CONFIG_SCHEMA SupportedSchema; // Schema > that is supported in this formset. > -} REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE; > - > -#define REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK(a) BASE_CR > (a, REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE, Link) > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_FORM_PRIVATE > -// > -typedef struct { > - LIST_ENTRY Link; > - UINT16 Id; // Form ID. > - EFI_STRING_ID Title; // String to= ken of form title. > - REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *ParentFormset; > - HII_FORM *HiiForm; // Pointer t= o HII form data. > - LIST_ENTRY StatementList; // Statement= list that keep > statement under this form. > -} REDFISH_PLATFORM_CONFIG_FORM_PRIVATE; > - > -#define REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK(a) BASE_CR (a, > REDFISH_PLATFORM_CONFIG_FORM_PRIVATE, Link) > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE > -// > -typedef struct { > - LIST_ENTRY Link; > - REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *ParentForm; > - HII_STATEMENT *HiiStatement; // Pointer to HI= I statement > data. > - EFI_QUESTION_ID QuestionId; // Question ID o= f this > statement. > - EFI_STRING_ID Description; // String token = of this question. > - EFI_STRING DesStringCache; // The string ca= che for search > function. > -} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE; > - > -#define REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE, Link) > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF > -// > -typedef struct { > - LIST_ENTRY Link; > - REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement; > -} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF; > - > -#define REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF, Link) > - > -// > -// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > -// > -typedef struct { > - LIST_ENTRY StatementList; // List of > REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF > - UINTN Count; > -} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST; > - > -/** > - Release formset list and all the forms that belong to this formset. > - > - @param[in] FormsetList Pointer to formst list that needs to be > - released. > - > - @retval EFI_STATUS > - > -**/ > -EFI_STATUS > -ReleaseFormsetList ( > - IN LIST_ENTRY *FormsetList > - ); > - > -/** > - Release formset list and all the forms that belong to this formset. > - > - @param[in] FormsetList Pointer to formst list that needs to be > - released. > - > - @retval EFI_STATUS > - > -**/ > -EFI_STATUS > -LoadFormsetList ( > - IN EFI_HII_HANDLE *HiiHandle, > - OUT LIST_ENTRY *FormsetList > - ); > - > -/** > - When HII database is updated. Keep updated HII handle into pending lis= t so > - we can process them later. > - > - @param[in] HiiHandle HII handle instance. > - @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. > - > - @retval EFI_SUCCESS HII handle is saved in pending list. > - @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -NotifyFormsetUpdate ( > - IN EFI_HII_HANDLE *HiiHandle, > - IN LIST_ENTRY *PendingList > - ); > - > -/** > - When HII database is updated and form-set is deleted. Keep deleted HII > handle into pending list so > - we can process them later. > - > - @param[in] HiiHandle HII handle instance. > - @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. > - > - @retval EFI_SUCCESS HII handle is saved in pending list. > - @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -NotifyFormsetDeleted ( > - IN EFI_HII_HANDLE *HiiHandle, > - IN LIST_ENTRY *PendingList > - ); > - > -/** > - Get statement private instance by the given configure language. > - > - @param[in] FormsetList Form-set list to search. > - @param[in] Schema Schema to be matched. > - @param[in] ConfigureLang Configure language. > - > - @retval REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * Pointer to > statement private instance. > - > -**/ > -REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * > -GetStatementPrivateByConfigureLang ( > - IN LIST_ENTRY *FormsetList, > - IN CHAR8 *Schema, > - IN EFI_STRING ConfigureLang > - ); > - > -/** > - Search and find statement private instance by given regular expression > patthern > - which describes the Configure Language. > - > - @param[in] RegularExpressionProtocol Regular express protocol. > - @param[in] FormsetList Form-set list to search. > - @param[in] Schema Schema to be matched. > - @param[in] Pattern Regular expression pattern. > - @param[out] StatementList Statement list that match abov= e > pattern. > - > - @retval EFI_SUCCESS Statement list is returned. > - @retval EFI_INVALID_PARAMETER Input parameter is NULL. > - @retval EFI_NOT_READY Regular express protocol is NULL. > - @retval EFI_NOT_FOUND No statement is found. > - @retval EFI_OUT_OF_RESOURCES System is out of memory. > - > -**/ > -EFI_STATUS > -GetStatementPrivateByConfigureLangRegex ( > - IN EFI_REGULAR_EXPRESSION_PROTOCOL > *RegularExpressionProtocol, > - IN LIST_ENTRY *FormsetList, > - IN CHAR8 *Schema, > - IN EFI_STRING Pattern, > - OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList > - ); > - > -/** > - There are HII database update and we need to process them accordingly = so > that we > - won't use stale data. This function will parse updated HII handle agai= n in > order > - to get updated data-set. > - > - @param[in] FormsetList List to keep HII form-set. > - @param[in] PendingList List to keep HII handle that is updated. > - > - @retval EFI_SUCCESS HII handle is saved in pending list. > - @retval EFI_INVALID_PARAMETER FormsetList is NULL or PendingList is > NULL. > - > -**/ > -EFI_STATUS > -ProcessPendingList ( > - IN LIST_ENTRY *FormsetList, > - IN LIST_ENTRY *PendingList > - ); > - > -/** > - Retrieves a string from a string package in a English language. The > - returned string is allocated using AllocatePool(). The caller is resp= onsible > - for freeing the allocated buffer using FreePool(). > - > - If HiiHandle is NULL, then ASSERT(). > - If StringId is 0, then ASSET. > - > - @param[in] HiiStringProtocol EFI_HII_STRING_PROTOCOL instance. > - @param[in] HiiHandle A handle that was previously registered = in the > HII Database. > - @param[in] StringId The identifier of the string to retrieve= d from the > string > - package associated with HiiHandle. > - > - @retval NULL The string specified by StringId is not present in the = string > package. > - @retval Other The string was returned. > - > -**/ > -EFI_STRING > -HiiGetRedfishString ( > - IN EFI_HII_HANDLE HiiHandle, > - IN CHAR8 *Language, > - IN EFI_STRING_ID StringId > - ); > - > -/** > - Release all resource in statement list. > - > - @param[in] StatementList Statement list to be released. > - > - @retval EFI_SUCCESS All resource are released. > - @retval EFI_INVALID_PARAMETER StatementList is NULL. > - > -**/ > -EFI_STATUS > -ReleaseStatementList ( > - IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList > - ); > - > -#endif > +/** @file >=20 > + This file defines the EDKII Redfish Platform Config Protocol interface= . >=20 > + >=20 > + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>=20 > + >=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_ >=20 > +#define EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_ >=20 > + >=20 > +#include >=20 > + >=20 > +// >=20 > +// Libraries >=20 > +// >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_DELETE_EXPIRED_FORMSET 0x00 >=20 > +#define IS_EMPTY_STRING(a) (a =3D=3D NULL = || a[0] =3D=3D L'\0') >=20 > +#define ENGLISH_LANGUAGE_CODE "en-US" >=20 > +#define X_UEFI_SCHEMA_PREFIX "x-uefi-redfish= -" >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_PRIVATE. >=20 > +// >=20 > +typedef struct { >=20 > + LIST_ENTRY Link; >=20 > + EFI_HII_HANDLE HiiHandle; >=20 > + BOOLEAN IsDeleted; >=20 > +} REDFISH_PLATFORM_CONFIG_PENDING_LIST; >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_PENDING_LIST, Link) >=20 > + >=20 > +typedef struct { >=20 > + UINTN Count; // Number of schema in l= ist >=20 > + CHAR8 **SchemaList; // Schema list >=20 > +} REDFISH_PLATFORM_CONFIG_SCHEMA; >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE >=20 > +// >=20 > +typedef struct { >=20 > + LIST_ENTRY Link; >=20 > + HII_FORMSET *HiiFormSet; // Pointer to HII for= mset data. >=20 > + EFI_GUID Guid; // Formset GUID. >=20 > + EFI_HII_HANDLE HiiHandle; // Hii Handle of this= formset. >=20 > + LIST_ENTRY HiiFormList; // Form list that kee= p form data under > this formset. >=20 > + CHAR16 *DevicePathStr; // Device path of thi= s formset. >=20 > + REDFISH_PLATFORM_CONFIG_SCHEMA SupportedSchema; // Schema > that is supported in this formset. >=20 > +} REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE; >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK(a) BASE_CR > (a, REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE, Link) >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_FORM_PRIVATE >=20 > +// >=20 > +typedef struct { >=20 > + LIST_ENTRY Link; >=20 > + UINT16 Id; // Form ID. >=20 > + EFI_STRING_ID Title; // String to= ken of form title. >=20 > + REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *ParentFormset; >=20 > + HII_FORM *HiiForm; // Pointer t= o HII form data. >=20 > + LIST_ENTRY StatementList; // Statement= list that keep > statement under this form. >=20 > +} REDFISH_PLATFORM_CONFIG_FORM_PRIVATE; >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK(a) BASE_CR (a, > REDFISH_PLATFORM_CONFIG_FORM_PRIVATE, Link) >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE >=20 > +// >=20 > +typedef struct { >=20 > + LIST_ENTRY Link; >=20 > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *ParentForm; >=20 > + HII_STATEMENT *HiiStatement; // Pointer to HI= I statement > data. >=20 > + EFI_QUESTION_ID QuestionId; // Question ID o= f this > statement. >=20 > + EFI_STRING_ID Description; // String token = of this question. >=20 > + EFI_STRING DesStringCache; // The string ca= che for search > function. >=20 > +} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE; >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE, Link) >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF >=20 > +// >=20 > +typedef struct { >=20 > + LIST_ENTRY Link; >=20 > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement; >=20 > +} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF; >=20 > + >=20 > +#define REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF, Link) >=20 > + >=20 > +// >=20 > +// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST >=20 > +// >=20 > +typedef struct { >=20 > + LIST_ENTRY StatementList; // List of > REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF >=20 > + UINTN Count; >=20 > +} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST; >=20 > + >=20 > +/** >=20 > + Release formset list and all the forms that belong to this formset. >=20 > + >=20 > + @param[in] FormsetList Pointer to formst list that needs to be >=20 > + released. >=20 > + >=20 > + @retval EFI_STATUS >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ReleaseFormsetList ( >=20 > + IN LIST_ENTRY *FormsetList >=20 > + ); >=20 > + >=20 > +/** >=20 > + Release formset list and all the forms that belong to this formset. >=20 > + >=20 > + @param[in] FormsetList Pointer to formst list that needs to be >=20 > + released. >=20 > + >=20 > + @retval EFI_STATUS >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +LoadFormsetList ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + OUT LIST_ENTRY *FormsetList >=20 > + ); >=20 > + >=20 > +/** >=20 > + When HII database is updated. Keep updated HII handle into pending lis= t > so >=20 > + we can process them later. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. >=20 > + >=20 > + @retval EFI_SUCCESS HII handle is saved in pending list. >=20 > + @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +NotifyFormsetUpdate ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ); >=20 > + >=20 > +/** >=20 > + When HII database is updated and form-set is deleted. Keep deleted HII > handle into pending list so >=20 > + we can process them later. >=20 > + >=20 > + @param[in] HiiHandle HII handle instance. >=20 > + @param[in] PendingList Pending list to keep HII handle which is recen= tly > updated. >=20 > + >=20 > + @retval EFI_SUCCESS HII handle is saved in pending list. >=20 > + @retval EFI_INVALID_PARAMETER HiiHnalde is NULL or PendingList is > NULL. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +NotifyFormsetDeleted ( >=20 > + IN EFI_HII_HANDLE *HiiHandle, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ); >=20 > + >=20 > +/** >=20 > + Get statement private instance by the given configure language. >=20 > + >=20 > + @param[in] FormsetList Form-set list to search. >=20 > + @param[in] Schema Schema to be matched. >=20 > + @param[in] ConfigureLang Configure language. >=20 > + >=20 > + @retval REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * Pointer > to statement private instance. >=20 > + >=20 > +**/ >=20 > +REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * >=20 > +GetStatementPrivateByConfigureLang ( >=20 > + IN LIST_ENTRY *FormsetList, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING ConfigureLang >=20 > + ); >=20 > + >=20 > +/** >=20 > + Search and find statement private instance by given regular expression > patthern >=20 > + which describes the Configure Language. >=20 > + >=20 > + @param[in] RegularExpressionProtocol Regular express protocol. >=20 > + @param[in] FormsetList Form-set list to search. >=20 > + @param[in] Schema Schema to be matched. >=20 > + @param[in] Pattern Regular expression pattern. >=20 > + @param[out] StatementList Statement list that match abov= e > pattern. >=20 > + >=20 > + @retval EFI_SUCCESS Statement list is returned. >=20 > + @retval EFI_INVALID_PARAMETER Input parameter is NULL. >=20 > + @retval EFI_NOT_READY Regular express protocol is NULL. >=20 > + @retval EFI_NOT_FOUND No statement is found. >=20 > + @retval EFI_OUT_OF_RESOURCES System is out of memory. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +GetStatementPrivateByConfigureLangRegex ( >=20 > + IN EFI_REGULAR_EXPRESSION_PROTOCOL > *RegularExpressionProtocol, >=20 > + IN LIST_ENTRY *FormsetList, >=20 > + IN CHAR8 *Schema, >=20 > + IN EFI_STRING Pattern, >=20 > + OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList >=20 > + ); >=20 > + >=20 > +/** >=20 > + There are HII database update and we need to process them accordingly > so that we >=20 > + won't use stale data. This function will parse updated HII handle agai= n in > order >=20 > + to get updated data-set. >=20 > + >=20 > + @param[in] FormsetList List to keep HII form-set. >=20 > + @param[in] PendingList List to keep HII handle that is updated. >=20 > + >=20 > + @retval EFI_SUCCESS HII handle is saved in pending list. >=20 > + @retval EFI_INVALID_PARAMETER FormsetList is NULL or PendingList is > NULL. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ProcessPendingList ( >=20 > + IN LIST_ENTRY *FormsetList, >=20 > + IN LIST_ENTRY *PendingList >=20 > + ); >=20 > + >=20 > +/** >=20 > + Retrieves a string from a string package in a English language. The >=20 > + returned string is allocated using AllocatePool(). The caller is resp= onsible >=20 > + for freeing the allocated buffer using FreePool(). >=20 > + >=20 > + If HiiHandle is NULL, then ASSERT(). >=20 > + If StringId is 0, then ASSET. >=20 > + >=20 > + @param[in] HiiStringProtocol EFI_HII_STRING_PROTOCOL instance. >=20 > + @param[in] HiiHandle A handle that was previously registered = in the > HII Database. >=20 > + @param[in] StringId The identifier of the string to retrieve= d from the > string >=20 > + package associated with HiiHandle. >=20 > + >=20 > + @retval NULL The string specified by StringId is not present in the = string > package. >=20 > + @retval Other The string was returned. >=20 > + >=20 > +**/ >=20 > +EFI_STRING >=20 > +HiiGetRedfishString ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN CHAR8 *Language, >=20 > + IN EFI_STRING_ID StringId >=20 > + ); >=20 > + >=20 > +/** >=20 > + Retrieves a string from a string package in a English language. The >=20 > + returned string is allocated using AllocatePool(). The caller is resp= onsible >=20 > + for freeing the allocated buffer using FreePool(). >=20 > + >=20 > + If HiiHandle is NULL, then ASSERT(). >=20 > + If StringId is 0, then ASSET. >=20 > + >=20 > + @param[in] HiiStringProtocol EFI_HII_STRING_PROTOCOL instance. >=20 > + @param[in] HiiHandle A handle that was previously registered = in the > HII Database. >=20 > + @param[in] StringId The identifier of the string to retrieve= d from the > string >=20 > + package associated with HiiHandle. >=20 > + >=20 > + @retval NULL The string specified by StringId is not present in the = string > package. >=20 > + @retval Other The string was returned. >=20 > + >=20 > +**/ >=20 > +CHAR8 * >=20 > +HiiGetRedfishAsciiString ( >=20 > + IN EFI_HII_HANDLE HiiHandle, >=20 > + IN CHAR8 *Language, >=20 > + IN EFI_STRING_ID StringId >=20 > + ); >=20 > + >=20 > +/** >=20 > + Release all resource in statement list. >=20 > + >=20 > + @param[in] StatementList Statement list to be released. >=20 > + >=20 > + @retval EFI_SUCCESS All resource are released. >=20 > + @retval EFI_INVALID_PARAMETER StatementList is NULL. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +ReleaseStatementList ( >=20 > + IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST > *StatementList >=20 > + ); >=20 > + >=20 > +#endif >=20 > -- > 2.32.0.windows.2