From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.52]) by mx.groups.io with SMTP id smtpd.web11.33843.1670813069330163516 for ; Sun, 11 Dec 2022 18:44:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=0af3tXk8; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.220.52, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SCHWKdgxzjLCme9kTOM8FzRNkztTVrO4pM2Ac2lqkax3KCzq/0ccj05YNto/rnhpKokuYji38xJuOmYI9nYDU+Tv+VoSMnx5i/bZGg37y/cGmLKxC71m9ISE9fuPF9VOxWiXELc5TpedCZ5wUTxzb9lw0Wf1F4C9YoxdYfgFBxrxerhsn+Feb4qleWXJXpEsrHr7TeqpLxh9KK8t1TT+j786INjp8Qn97QQpQWucrrGpbn6oilkVCjiCSaVErJ9e0BremAU4AqWVfHVfnesBVvCuYyboJ2rlQqIqvqNKxVSlV3RnQe7iwPz78Fj77QCIhrRvh7A8ZygW4ZOIYAq/lA== 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=O070hyH1eaMiSbELdO9XbqM0ptx88WkK6M26DGIRYSM=; b=JnSDAj6KIpSIcq+OgaOks50rbL9uun3R42HY/4hp/uwkdGt8Xv2zMGMRLGrvtLb6ISjFJSDkznDWef6lysJ2aY5u8zHUOdPk4wD6sG15ZVxqCDjstiruY8gyjQ85GBIcrWaVivRoljD3xn+eDE/fxI7w3EhwA2PXpJNqC5r1DMfQusKcv71tQzxlmfx+NCXZISi0PIFsfAUp+xWNv2s/UMlTu0NutoZZVJY1iMjmXirOGJB3QuyMHodHpomXSrFLtAV070z02O1fp9dZxxMvkX+T03a32kK7dLNQ11Cf6eMQW/w+zNc7CJ+/zMZcnjNOy8ls0rkmKsT9ohqSKnn80w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O070hyH1eaMiSbELdO9XbqM0ptx88WkK6M26DGIRYSM=; b=0af3tXk8+N4PJ7OCs0qPvZmDPs5/z5p2tEZjn9uKLcX5Nx+VYoFanwXd328NS/y7upvQ02OWL+woNPVAVxyybQQvnw8aLiWi5XJ3YKSd5/PO5gIocNaj/jXTSKEM9fK1QvbxJbb6sl6fY3OJTJkXRCFiqTEnc9I9LlPDIF2c+Jw= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by SA1PR12MB7441.namprd12.prod.outlook.com (2603:10b6:806:2b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Mon, 12 Dec 2022 02:44:25 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::ce0a:283e:839:34bd]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::ce0a:283e:839:34bd%3]) with mapi id 15.20.5880.019; Mon, 12 Dec 2022 02:44:24 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-staging][PATCH 2/3] edk2-staging/RedfishPkg: Introduce new interfaces to Redfish protocol Thread-Topic: [edk2-staging][PATCH 2/3] edk2-staging/RedfishPkg: Introduce new interfaces to Redfish protocol Thread-Index: AQHZCkWn+sTaTh49XEipGrfipaJ7uK5pjouQ Date: Mon, 12 Dec 2022 02:44:24 +0000 Message-ID: References: <20221207141007.170-1-nicklew@nvidia.com> In-Reply-To: <20221207141007.170-1-nicklew@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-12-12T02:44:22Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=b1ca74ee-3abb-4bff-9374-b5a5b2117464; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|SA1PR12MB7441:EE_ x-ms-office365-filtering-correlation-id: 3af7fa39-b7ba-4d78-db8d-08dadbeac7cf x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: q79EqeUFKwjnySuu3QGcFTuNZuu+pfnTsXkePHckVv/oA8Jrku3L9HKN/CIswZlntMm+1ppnVO7LKtmH5rWG4uEUJl0SqLgS7dXfWiANRzoIUHst0+tU+ibskQnn5pkOcL+fO9nsSn7b4AlsaAQNqn8Eq343RwpZEattbFjtQhRfBz8/khTa6lhOoSgfMmQh5fwflWtK7yTlHTIZT9z8ox4yoSO+7SJLWCWrh3izxMHVBPHmZMQBME1lMPBOJaYRfKv6mOkuZQfKBQB0jwxK4Bn2+hdmQx3x3JbzDK63yVm+T/q67IiloLUKqAgRhDpdAKY7g225WEdDKORjA4VFUkp1m5SH8KkOV+eTgsel7YS5/LBg8DUYTj/q/qxs7lqcP6OR7z9ZHZDcKZJ3us/u8QhVihZFxn0wjNIax9obQFsdGFwXWVhoCWQ80hVbR61e/o7ozYcYthLjJ266zETEJcIsnX+QfEWOYfSekV6QECt+ivLjCVlQ5Fzo9BXpmZBfNbcDZY/lVsxL4Sj01R83ATOvGAFurhTWRKfHRzFHWcmWCN/e0E7kmX3CmTiHsP5pmvt8gf7XSGK1qfwS/5H/0YwrnEL7c7ePpheHWeOngEixfEGANWCgf69fSBPCmAMnWkfDUO5/Vpfs9G65ZiwAarbYObF3baePEC0by7WombzeYCDogvBsEXgzPE0qriC5mlw+y2cAxKgMlzMxH1orfVxZxkcufMFdsO1psGodqMI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(366004)(136003)(346002)(376002)(451199015)(33656002)(122000001)(86362001)(83380400001)(38100700002)(38070700005)(30864003)(5660300002)(8676002)(2906002)(66556008)(66476007)(66946007)(8936002)(64756008)(66446008)(4326008)(41300700001)(52536014)(76116006)(55016003)(7696005)(9686003)(53546011)(26005)(6506007)(19627235002)(186003)(110136005)(54906003)(316002)(478600001)(966005)(71200400001)(66899015)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VJaaD0Ijy/tQuQvBtXBNOyIcuoT+vup2C7n5mBpWJ1BseAPbGfZQrR28E9CE?= =?us-ascii?Q?JMhFESK4QPzuFI49e+Ymu5ygKpmTkNgQSxofJ24ccedlJX/niGZcgqoxuVF+?= =?us-ascii?Q?UYqEU6ihWMc2hZRutq+0lh2ctHiPgYkh/94gvBQKH2yEpsaVNF/fcSBdVeJi?= =?us-ascii?Q?zXkOjAf1tuwkweLuQQ9iLNXCrZ3RxcCmiBdAWeavef0GmohPAzeY0MwtTgGq?= =?us-ascii?Q?DYy+zr5l8iwZG4i2NyDz7u4kXojj5VUN4rfqJvwpb+zr+DZLb7k9+L8Kn1Zm?= =?us-ascii?Q?6eJe4m3AEquc4NgBOtzFWMP4xN0vZM6yjk48oOiqLq7JBkNUGsVMLCd8IJxJ?= =?us-ascii?Q?ZiW6vdrOnIS1d58Qv1FW7mfVGp3S2V+SS29qj7A9d10UJu0jki/JTTpj6gWe?= =?us-ascii?Q?hwrSicx400ZIjzQwR51vRMNnKP0uYMA63AHhugBU/VDUw31vJh/HH+pNq+oa?= =?us-ascii?Q?J7iojp8AZxdUsvMldsVZe5CDAb9QsZyiKHXFqYblrYHAkV25rCij8itF8xYP?= =?us-ascii?Q?WfR+PaUsd61r/bfpYaJXdyhNVoyhHRxC2bZgGRq96eO4P1TM1ZrjzZ6yD0LZ?= =?us-ascii?Q?cFPPhV9cty0oiK5OvMSgulF8UKKO9BreAQet/zs3lG73s0C3QzvQ9JIWVYFA?= =?us-ascii?Q?+K4DTzHsrl/fATxfEZaD/nvGMaL3d3t97SxXZeLHBYPxZbfD9g+RtNhaWvl/?= =?us-ascii?Q?flSSaglfhAjvR6zB2RA/PTT+Q4dzuRHbQjwmxWx/caSF3nG2iD7TAm9HjDFf?= =?us-ascii?Q?qhXgtlf94mJcJYXvcimZtOlTgs29I/+urvwW8e+de+VIgU1QqrhrtgbatNru?= =?us-ascii?Q?QGgBVNuJlc4I04Qd89kb+iMUaIKzqald/GUH47JPECDcu4C+IfgiZ3prSQmE?= =?us-ascii?Q?6Rh9mF7Llome9KlfZDepPSlEhQClrDxF3f/6b5vniVb5OfCera/Aqjr0hLEU?= =?us-ascii?Q?NASycoBhmynF/OQ8l3Ai8MIIdeMDP3VdZUTfcPzL9JIgYBmz9lHFku+iyqDV?= =?us-ascii?Q?pJmTF0QKdJxDR3PFhZjlrUYIjSKcT6pX7drXKG8BqBPILN+Sue4DxHt50E56?= =?us-ascii?Q?a6xUBtvfVwyvvuvsCtXDl+vdgfoWzaCpX+e12QHmiUE5zXyucDmUVQSBQVmu?= =?us-ascii?Q?JWfaxiC+PQSaT9eCjFAK3uk+FBxrGffVhYuWNvMi57JzmcfAnS7btdBY2xVi?= =?us-ascii?Q?DxywKi0owzwx4njM8dfVCg9xzNNXUw3IfOWhbU6UvlCApbtFUlgiofYI5HTv?= =?us-ascii?Q?IZF2tO0aK8uBiWetgSf+Y/pzcXFyg7DbT/hQlKbQgo8dozvSElvGDGkYnyOu?= =?us-ascii?Q?83F5ivAI0QTNqUyWsk1e/6qqbzXsxbWvUpE/vKljr4CtYA93lbLY3AhYvXKD?= =?us-ascii?Q?YLiiUtBsrzAaAw41ZKot41N1S+nUnZ1gJHzdqtY1wHUmZuUHXoOZfNb0bYg4?= =?us-ascii?Q?PqkPGUvtelE9W64ZgDB3RHn3qvIgQzjKxTGr7zCZYLVA2gEk6u6NPRRK0zt+?= =?us-ascii?Q?QIiYNSOOMadVVg7koIXi3/wOS7jVmseP3nI0MxgQ2pwv5XlTqPlELN4sZK9a?= =?us-ascii?Q?3bTzRKoIzra0kbN0xwJlmNnj2OxMCubgnz5zXoNQ?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3af7fa39-b7ba-4d78-db8d-08dadbeac7cf X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2022 02:44:24.7308 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: iycckZA2uEL6qVOtk+NS/Lfhph2k62bikhjO/ZpWU9bWlE//Vr3Sph5ll4oGmemOSMFo2g0AI36nfU+gL3H9Dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7441 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, December 7, 2022 10:10 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [edk2-staging][PATCH 2/3] edk2-staging/RedfishPkg: Introduce new > interfaces to Redfish protocol >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Add two new iterfaces to Redfish Platform Config Protocol. > GetAttribute() return attribute details and GetDefaultValue() get default > value of attribute. These two interfaces are used to generate BIOS Attrib= ute > Registry >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > .../Protocol/EdkIIRedfishPlatformConfig.h | 105 +++ > .../RedfishPlatformConfigDxe.c | 625 ++++++++++++++---- > .../RedfishPlatformConfigDxe.h | 2 + > .../RedfishPlatformConfigImpl.c | 55 +- > .../RedfishPlatformConfigImpl.h | 44 +- > 5 files changed, 705 insertions(+), 126 deletions(-) Please assign the file order next time when format patch. You can refer to = here: https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-= guide-for-edk2-contributors-and-maintainers#contrib-10 Reviewed-by: Abner Chang >=20 > diff --git a/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > b/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > index bbbab90b03..9be83b5e0b 100644 > --- a/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > +++ b/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h > @@ -2,6 +2,7 @@ > This file defines the EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL > interface. >=20 > (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -38,6 +39,18 @@ typedef enum { > REDFISH_VALUE_TYPE_MAX > } EDKII_REDFISH_VALUE_TYPES; >=20 > +/** > + Definition of EDKII_REDFISH_ATTRIBUTE_TYPES **/ typedef enum { > + REDFISH_ATTRIBUTE_TYPE_UNKNOWN =3D 0, > + REDFISH_ATTRIBUTE_TYPE_ENUMERATION, > + REDFISH_ATTRIBUTE_TYPE_STRING, > + REDFISH_ATTRIBUTE_TYPE_INTEGER, > + REDFISH_ATTRIBUTE_TYPE_BOOLEAN, > + REDFISH_ATTRIBUTE_TYPE_PASSWORD > +} EDKII_REDFISH_ATTRIBUTE_TYPES; > + > /** > Definition of EDKII_REDFISH_VALUE > **/ > @@ -47,6 +60,41 @@ typedef struct { > UINTN ArrayCount; > } EDKII_REDFISH_VALUE; >=20 > +/** > + Definition of EDKII_REDFISH_ATTRIBUTE_VALUE **/ typedef struct { > + CHAR8 *ValueName; > + CHAR8 *ValueDisplayName; > +} EDKII_REDFISH_ATTRIBUTE_VALUE; > + > +/** > + Definition of EDKII_REDFISH_POSSIBLE_VALUES **/ typedef struct { > + UINTN ValueCount; > + EDKII_REDFISH_ATTRIBUTE_VALUE *ValueArray; > +} EDKII_REDFISH_POSSIBLE_VALUES; > + > +/** > + Definition of EDKII_REDFISH_ATTRIBUTE **/ typedef struct { > + CHAR8 *AttributeName; > + CHAR8 *DisplayName; > + CHAR8 *HelpText; > + CHAR8 *MenuPath; > + EDKII_REDFISH_ATTRIBUTE_TYPES Type; > + BOOLEAN ResetRequired; > + BOOLEAN ReadOnly; > + UINT64 NumMaximum; > + UINT64 NumMinimum; > + UINT64 NumStep; > + UINT8 StrMaxSize; > + UINT8 StrMinSize; > + EDKII_REDFISH_POSSIBLE_VALUES Values; > +} EDKII_REDFISH_ATTRIBUTE; > + > /** > Get Redfish value with the given Schema and Configure Language. >=20 > @@ -70,6 +118,37 @@ EFI_STATUS > OUT EDKII_REDFISH_VALUE *Value > ); >=20 > +// > +// Default class standard > +// > +#define EDKII_REDFISH_DEFAULT_CLASS_STANDARD > +EFI_HII_DEFAULT_CLASS_STANDARD > + > +/** > + Get Redfish default 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] DefaultClass The UEFI defined default class. > + Please refer to UEFI spec. 33.2.5.8 "= defaults" for details. > + @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_DEFAULT_VALUE)( > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + IN UINT16 DefaultClass, > + OUT EDKII_REDFISH_VALUE *Value > + ); > + > /** > Set Redfish value with the given Schema and Configure Language. >=20 > @@ -93,6 +172,29 @@ EFI_STATUS > IN EDKII_REDFISH_VALUE Value > ); >=20 > +/** > + Get Redfish attribute value with the given Schema and Configure Langua= ge. > + > + @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] AttributeValue The attribute value. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_ATTRIBUTE)( > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + OUT EDKII_REDFISH_ATTRIBUTE *AttributeValue > + ); > + > /** > Get the list of Configure Language from platform configuration by the = given > Schema and RegexPattern. >=20 > @@ -143,8 +245,11 @@ EFI_STATUS > ); >=20 > struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL { > + UINT64 Revision; > EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE GetValue; > EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE SetValue; > + EDKII_REDFISH_PLATFORM_CONFIG_GET_DEFAULT_VALUE > GetDefaultValue; > + EDKII_REDFISH_PLATFORM_CONFIG_GET_ATTRIBUTE GetAttribute; > EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG > GetConfigureLang; > EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA > GetSupportedSchema; }; diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > index 971035f27d..96b50b201c 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c > @@ -3,6 +3,7 @@ > The implementation of EDKII Redfidh Platform Config Protocol. >=20 > (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -13,6 +14,182 @@ >=20 > REDFISH_PLATFORM_CONFIG_PRIVATE *mRedfishPlatformConfigPrivate =3D > NULL; >=20 > +/** > + Get the attribute name from config language. > + > + For example: /Bios/Attributes/BiosOption1 is config laugnage and > + attribute name is BiosOption1. > + > + @param[in] ConfigLanguage Config language string. > + > + @retval CHAR8 * Attribute name string. > + @retval NULL Can not find attribute name. > + > +**/ > +CHAR8 * > +GetAttributeNameFromConfigLanguage ( > + IN CHAR8 *ConfigLanguage > + ) > +{ > + CHAR8 *attributeName; > + CHAR8 *Pointer; > + UINTN StrLen; > + UINTN Index; > + UINTN AttrStrLen; > + > + if (IS_EMPTY_STRING (ConfigLanguage)) { > + return NULL; > + } > + > + attributeName =3D NULL; > + Pointer =3D NULL; > + AttrStrLen =3D 0; > + StrLen =3D AsciiStrLen (ConfigLanguage); > + > + if (ConfigLanguage[StrLen - 1] =3D=3D '/') { > + // > + // wrong format > + // > + DEBUG ((DEBUG_ERROR, "%a, invalid format: %a\n", __FUNCTION__, > ConfigLanguage)); > + ASSERT (FALSE); > + return NULL; > + } > + > + Index =3D StrLen; > + while (TRUE) { > + Index -=3D 1; > + > + if (ConfigLanguage[Index] =3D=3D '/') { > + Pointer =3D &ConfigLanguage[Index + 1]; > + break; > + } > + > + if (Index =3D=3D 0) { > + break; > + } > + } > + > + // > + // Not found. There is no '/' in input string. > + // > + if (Pointer =3D=3D NULL) { > + return NULL; > + } > + > + AttrStrLen =3D StrLen - Index; > + attributeName =3D AllocateCopyPool (AttrStrLen, Pointer); > + > + return attributeName; > +} > + > +/** > + Convert one-of options to string array in Redfish attribute. > + > + @param[in] HiiHandle HII handle. > + @param[in] SchemaName Schema string. > + @param[in] HiiStatement Target HII statement. > + @param[out] Values Attribute value array. > + > + @retval EFI_SUCCESS Options are converted successfully. > + @retval Other Error occurs. > + > +**/ > +EFI_STATUS > +OneOfStatementToAttributeValues ( > + IN EFI_HII_HANDLE HiiHandle, > + IN CHAR8 *SchemaName, > + IN HII_STATEMENT *HiiStatement, > + OUT EDKII_REDFISH_POSSIBLE_VALUES *Values > + ) > +{ > + LIST_ENTRY *Link; > + HII_QUESTION_OPTION *Option; > + UINTN Index; > + > + if ((HiiHandle =3D=3D NULL) || (HiiStatement =3D=3D NULL) || (Values = =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + if (IsListEmpty (&HiiStatement->OptionListHead)) { > + return EFI_NOT_FOUND; > + } > + > + // > + // Loop through the option to get count // Values->ValueCount =3D 0; > + Link =3D GetFirstNode (&HiiStatement->OptionListHead); > + while (!IsNull (&HiiStatement->OptionListHead, Link)) { > + Values->ValueCount +=3D 1; > + Link =3D GetNextNode (&HiiStatement->OptionListHead, = Link); > + } > + > + Values->ValueArray =3D AllocateZeroPool (sizeof > + (EDKII_REDFISH_ATTRIBUTE_VALUE) * Values->ValueCount); if (Values- > >ValueArray =3D=3D NULL) { > + Values->ValueCount =3D 0; > + return EFI_OUT_OF_RESOURCES; > + } > + > + Index =3D 0; > + Link =3D GetFirstNode (&HiiStatement->OptionListHead); while (!IsNul= l > + (&HiiStatement->OptionListHead, Link)) { > + Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); > + > + if (Option->Text !=3D 0) { > + Values->ValueArray[Index].ValueName =3D HiiGetRedfishAsciiString > (HiiHandle, SchemaName, Option->Text); > + Values->ValueArray[Index].ValueName =3D HiiGetEnglishAsciiString > (HiiHandle, Option->Text); > + } > + > + Index +=3D 1; > + Link =3D GetNextNode (&HiiStatement->OptionListHead, Link); > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + Return Redfish attribute type from given HII statment operand. > + > + @param[in] HiiStatement Target HII statement. > + > + @retval EDKII_REDFISH_ATTRIBUTE_TYPES Attribute type. > + > +**/ > +EDKII_REDFISH_ATTRIBUTE_TYPES > +HiiStatementToAttributeType ( > + IN HII_STATEMENT *HiiStatement > + ) > +{ > + EDKII_REDFISH_ATTRIBUTE_TYPES type; > + > + if (HiiStatement =3D=3D NULL) { > + return REDFISH_ATTRIBUTE_TYPE_UNKNOWN; } > + > + type =3D REDFISH_ATTRIBUTE_TYPE_UNKNOWN; switch > + (HiiStatement->Operand) { > + case EFI_IFR_ONE_OF_OP: > + case EFI_IFR_ORDERED_LIST_OP: > + type =3D REDFISH_ATTRIBUTE_TYPE_ENUMERATION; > + break; > + case EFI_IFR_STRING_OP: > + type =3D REDFISH_ATTRIBUTE_TYPE_STRING; > + break; > + case EFI_IFR_NUMERIC_OP: > + type =3D REDFISH_ATTRIBUTE_TYPE_INTEGER; > + break; > + case EFI_IFR_CHECKBOX_OP: > + type =3D REDFISH_ATTRIBUTE_TYPE_BOOLEAN; > + break; > + case EFI_IFR_DATE_OP: > + case EFI_IFR_TIME_OP: > + default: > + DEBUG ((DEBUG_ERROR, "%a, unsupported operand: 0x%x\n", > __FUNCTION__, HiiStatement->Operand)); > + break; > + } > + > + return type; > +} >=20 > /** > Zero extend integer/boolean to UINT64 for comparing. > @@ -264,7 +441,8 @@ CompareHiiStatementValue ( > /** > Convert HII value to the string in HII one-of opcode. >=20 > - @param[in] Statement Statement private instance > + @param[in] HiiStatement HII Statement private instance > + @param[in] Value HII Statement value >=20 > @retval EFI_STRING_ID The string ID in HII database. > 0 is returned when something goes wrong. > @@ -272,29 +450,34 @@ CompareHiiStatementValue ( **/ EFI_STRING_ID > HiiValueToOneOfOptionStringId ( > - IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement > + IN HII_STATEMENT *HiiStatement, > + IN HII_STATEMENT_VALUE *Value > ) > { > LIST_ENTRY *Link; > HII_QUESTION_OPTION *Option; >=20 > - if (Statement->HiiStatement->Operand !=3D EFI_IFR_ONE_OF_OP) { > + if ((HiiStatement =3D=3D NULL) || (Value =3D=3D NULL)) { > return 0; > } >=20 > - if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { > + if (HiiStatement->Operand !=3D EFI_IFR_ONE_OF_OP) { > return 0; > } >=20 > - Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); > - while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { > + if (IsListEmpty (&HiiStatement->OptionListHead)) { > + return 0; > + } > + > + Link =3D GetFirstNode (&HiiStatement->OptionListHead); while (!IsNull > + (&HiiStatement->OptionListHead, Link)) { > Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > - if (CompareHiiStatementValue (&Statement->HiiStatement->Value, > &Option->Value) =3D=3D 0) { > + if (CompareHiiStatementValue (Value, &Option->Value) =3D=3D 0) { > return Option->Text; > } >=20 > - Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); > + Link =3D GetNextNode (&HiiStatement->OptionListHead, Link); > } >=20 > return 0; > @@ -531,7 +714,7 @@ DumpOrderedListValue ( > Convert HII value to the string in HII ordered list opcode. It's calle= r's > responsibility to free returned buffer using FreePool(). >=20 > - @param[in] Statement Statement private instance > + @param[in] HiiStatement HII Statement private instance > @param[out] ReturnSize The size of returned array >=20 > @retval EFI_STRING_ID The string ID array for options in ordered l= ist. > @@ -539,8 +722,8 @@ DumpOrderedListValue ( **/ EFI_STRING_ID * > HiiValueToOrderedListOptionStringId ( > - IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement, > - OUT UINTN *ReturnSize > + IN HII_STATEMENT *HiiStatement, > + OUT UINTN *ReturnSize > ) > { > LIST_ENTRY *Link; > @@ -550,32 +733,32 @@ HiiValueToOrderedListOptionStringId ( > UINTN Index; > UINT64 Value; >=20 > - if (Statement =3D=3D NULL || ReturnSize =3D=3D NULL) { > + if ((HiiStatement =3D=3D NULL) || (ReturnSize =3D=3D NULL)) { > return NULL; > } >=20 > *ReturnSize =3D 0; >=20 > - if (Statement->HiiStatement->Operand !=3D EFI_IFR_ORDERED_LIST_OP) { > + if (HiiStatement->Operand !=3D EFI_IFR_ORDERED_LIST_OP) { > return NULL; > } >=20 > - if (IsListEmpty (&Statement->HiiStatement->OptionListHead)) { > + if (IsListEmpty (&HiiStatement->OptionListHead)) { > return NULL; > } >=20 > DEBUG_CODE ( > - DumpOrderedListValue (Statement->HiiStatement); > - ); > + DumpOrderedListValue (HiiStatement); > + ); >=20 > OptionCount =3D 0; > - Link =3D GetFirstNode (&Statement->HiiStatement->OptionListHead); > - while (!IsNull (&Statement->HiiStatement->OptionListHead, Link)) { > + Link =3D GetFirstNode (&HiiStatement->OptionListHead); > + while (!IsNull (&HiiStatement->OptionListHead, Link)) { > Option =3D HII_QUESTION_OPTION_FROM_LINK (Link); >=20 > ++OptionCount; >=20 > - Link =3D GetNextNode (&Statement->HiiStatement->OptionListHead, Link= ); > + Link =3D GetNextNode (&HiiStatement->OptionListHead, Link); > } >=20 > *ReturnSize =3D OptionCount; > @@ -587,8 +770,8 @@ HiiValueToOrderedListOptionStringId ( > } >=20 > for (Index =3D 0; Index < OptionCount; Index++) { > - Value =3D OrderedListGetArrayData (Statement->HiiStatement- > >Value.Buffer, Statement->HiiStatement->Value.BufferValueType, Index); > - ReturnedArray[Index] =3D OrderedListOptionValueToStringId (Statement= - > >HiiStatement, Value); > + Value =3D OrderedListGetArrayData (HiiStatement->Valu= e.Buffer, > HiiStatement->Value.BufferValueType, Index); > + ReturnedArray[Index] =3D OrderedListOptionValueToStringId > + (HiiStatement, Value); > } >=20 > return ReturnedArray; > @@ -657,6 +840,126 @@ HiiStringToOrderedListOptionValue ( > return EFI_NOT_FOUND; > } >=20 > +/** > + Convert HII value to Redfish value. > + > + @param[in] HiiHandle HII handle. > + @param[in] FullSchema Schema string. > + @param[in] HiiStatement HII statement. > + @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 > +HiiValueToRedfishValue ( > + IN EFI_HII_HANDLE HiiHandle, > + IN CHAR8 *FullSchema, > + IN HII_STATEMENT *HiiStatement, > + IN HII_STATEMENT_VALUE *Value, > + OUT EDKII_REDFISH_VALUE *RedfishValue > + ) > +{ > + EFI_STATUS Status; > + EFI_STRING_ID StringId; > + UINTN Index; > + UINTN Count; > + EFI_STRING_ID *StringIdArray; > + > + if ((HiiHandle =3D=3D NULL) || (HiiStatement =3D=3D NULL) || (Value = =3D=3D NULL) || > (RedfishValue =3D=3D NULL) || IS_EMPTY_STRING (FullSchema)) { > + return EFI_INVALID_PARAMETER; > + } > + > + StringIdArray =3D NULL; > + Count =3D 0; > + > + switch (HiiStatement->Operand) { > + case EFI_IFR_ONE_OF_OP: > + StringId =3D HiiValueToOneOfOptionStringId (HiiStatement, Value); > + if (StringId =3D=3D 0) { > + ASSERT (FALSE); > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > + RedfishValue->Value.Buffer =3D HiiGetRedfishAsciiString (HiiHandle= , > FullSchema, StringId); > + if (RedfishValue->Value.Buffer =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + break; > + } > + > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_STRING; > + break; > + case EFI_IFR_STRING_OP: > + if (Value->Type !=3D EFI_IFR_TYPE_STRING) { > + ASSERT (FALSE); > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_STRING; > + RedfishValue->Value.Buffer =3D AllocatePool (StrLen ((CHAR16 *)Val= ue- > >Buffer) + 1); > + UnicodeStrToAsciiStrS ((CHAR16 *)Value->Buffer, RedfishValue- > >Value.Buffer, StrLen ((CHAR16 *)Value->Buffer) + 1); > + break; > + case EFI_IFR_CHECKBOX_OP: > + case EFI_IFR_NUMERIC_OP: > + Status =3D HiiValueToRedfishNumeric (Value, RedfishValue); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to convert HII value to Redfish > value: %r\n", __FUNCTION__, Status)); > + break; > + } > + > + break; > + case EFI_IFR_ACTION_OP: > + if (Value->Type !=3D EFI_IFR_TYPE_ACTION) { > + ASSERT (FALSE); > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > + // > + // Action has no value. Just return unknown type. > + // > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; > + break; > + case EFI_IFR_ORDERED_LIST_OP: > + StringIdArray =3D HiiValueToOrderedListOptionStringId (HiiStatemen= t, > &Count); > + if (StringIdArray =3D=3D NULL) { > + ASSERT (FALSE); > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > + RedfishValue->Value.StringArray =3D AllocatePool (sizeof (CHAR8 *)= * > Count); > + if (RedfishValue->Value.StringArray =3D=3D NULL) { > + ASSERT (FALSE); > + Status =3D EFI_OUT_OF_RESOURCES; > + break; > + } > + > + for (Index =3D 0; Index < Count; Index++) { > + ASSERT (StringIdArray[Index] !=3D 0); > + RedfishValue->Value.StringArray[Index] =3D HiiGetRedfishAsciiStr= ing > (HiiHandle, FullSchema, StringIdArray[Index]); > + ASSERT (RedfishValue->Value.StringArray[Index] !=3D NULL); > + } > + > + RedfishValue->ArrayCount =3D Count; > + RedfishValue->Type =3D REDFISH_VALUE_TYPE_STRING_ARRAY; > + > + FreePool (StringIdArray); > + break; > + default: > + DEBUG ((DEBUG_ERROR, "%a, catch unsupported type: 0x%x! Please > contact with author if we need to support this type.\n", __FUNCTION__, > HiiStatement->Operand)); > + ASSERT (FALSE); > + Status =3D EFI_UNSUPPORTED; > + break; > + } > + > + return Status; > +} > + > /** > Convert input ascii string to unicode string. It's caller's > responsibility to free returned buffer using FreePool(). > @@ -825,12 +1128,7 @@ RedfishPlatformConfigProtocolGetValue ( > EFI_STATUS Status; > REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; > - EFI_STRING_ID StringId; > - EFI_STRING_ID *StringIdArray; > CHAR8 *FullSchema; > - EFI_STRING HiiString; > - UINTN Count; > - UINTN Index; >=20 > 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; > @@ -839,10 +1137,7 @@ RedfishPlatformConfigProtocolGetValue ( > RedfishPlatformConfigPrivate =3D > REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); > Value->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; > Value->ArrayCount =3D 0; > - Count =3D 0; > FullSchema =3D NULL; > - HiiString =3D NULL; > - StringIdArray =3D NULL; >=20 > FullSchema =3D GetFullSchemaString (Schema, Version); > if (FullSchema =3D=3D NULL) { > @@ -854,82 +1149,15 @@ RedfishPlatformConfigProtocolGetValue ( > goto RELEASE_RESOURCE; > } >=20 > - 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; > - } > - > - Value->Value.Buffer =3D HiiGetRedfishAsciiString (TargetStatement- > >ParentForm->ParentFormset->HiiHandle, FullSchema, StringId); > - if (Value->Value.Buffer =3D=3D NULL) { > - Status =3D EFI_OUT_OF_RESOURCES; > - goto RELEASE_RESOURCE; > - } > - > - 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 AllocatePool (StrLen ((CHAR16 > *)TargetStatement->HiiStatement->Value.Buffer) + 1); > - UnicodeStrToAsciiStrS ((CHAR16 *)TargetStatement->HiiStatement- > >Value.Buffer, Value->Value.Buffer, StrLen ((CHAR16 *)TargetStatement- > >HiiStatement->Value.Buffer) + 1); > - 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; > - case EFI_IFR_ACTION_OP: > - if (TargetStatement->HiiStatement->Value.Type !=3D > EFI_IFR_TYPE_ACTION) { > - ASSERT (FALSE); > - Status =3D EFI_DEVICE_ERROR; > - goto RELEASE_RESOURCE; > - } > - > - // > - // Action has no value. Just return unknown type. > - // > - Value->Type =3D REDFISH_VALUE_TYPE_UNKNOWN; > - break; > - case EFI_IFR_ORDERED_LIST_OP: > - StringIdArray =3D HiiValueToOrderedListOptionStringId (TargetState= ment, > &Count); > - if (StringIdArray =3D=3D NULL) { > - ASSERT (FALSE); > - Status =3D EFI_DEVICE_ERROR; > - goto RELEASE_RESOURCE; > - } > - > - Value->Value.StringArray =3D AllocatePool (sizeof (CHAR8 *) * Coun= t); > - if (Value->Value.StringArray =3D=3D NULL) { > - ASSERT (FALSE); > - Status =3D EFI_OUT_OF_RESOURCES; > - goto RELEASE_RESOURCE; > - } > - > - for (Index =3D 0; Index < Count; Index++) { > - ASSERT (StringIdArray[Index] !=3D 0); > - Value->Value.StringArray[Index] =3D HiiGetRedfishAsciiString > (TargetStatement->ParentForm->ParentFormset->HiiHandle, FullSchema, > StringIdArray[Index]); > - } > - > - Value->ArrayCount =3D Count; > - Value->Type =3D REDFISH_VALUE_TYPE_STRING_ARRAY; > - 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; > + Status =3D HiiValueToRedfishValue ( > + TargetStatement->ParentForm->ParentFormset->HiiHandle, > + FullSchema, > + TargetStatement->HiiStatement, > + &TargetStatement->HiiStatement->Value, > + Value > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, HiiValueToRedfishValue failed: %r\n", > + __FUNCTION__, Status)); > } >=20 > RELEASE_RESOURCE: > @@ -938,14 +1166,6 @@ RELEASE_RESOURCE: > FreePool (FullSchema); > } >=20 > - if (HiiString !=3D NULL) { > - FreePool (HiiString); > - } > - > - if (StringIdArray !=3D NULL) { > - FreePool (StringIdArray); > - } > - > return Status; > } >=20 > @@ -1433,6 +1653,176 @@ > RedfishPlatformConfigProtocolGetSupportedSchema ( > return EFI_SUCCESS; > } >=20 > +/** > + Get Redfish default 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] DefaultClass The UEFI defined default class. > + Please refer to UEFI spec. 33.2.5.8 "= defaults" for details. > + @param[out] Value The returned value. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigProtocolGetDefaultValue ( > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + IN UINT16 DefaultClass, > + OUT EDKII_REDFISH_VALUE *Value > + ) > +{ > + EFI_STATUS Status; > + REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; > + CHAR8 *FullSchema; > + HII_STATEMENT_VALUE DefaultValue; > + > + 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; > + Value->ArrayCount =3D 0; > + > + FullSchema =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; > + } > + > + Status =3D GetQuestionDefault > + (TargetStatement->ParentForm->ParentFormset->HiiFormSet, > TargetStatement->ParentForm->HiiForm, TargetStatement->HiiStatement, > DefaultClass, &DefaultValue); if (EFI_ERROR (Status)) { > + goto RELEASE_RESOURCE; > + } > + > + Status =3D HiiValueToRedfishValue ( > + TargetStatement->ParentForm->ParentFormset->HiiHandle, > + FullSchema, > + TargetStatement->HiiStatement, > + &DefaultValue, > + Value > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, HiiValueToRedfishValue failed: %r\n", > + __FUNCTION__, Status)); } > + > +RELEASE_RESOURCE: > + > + if (FullSchema !=3D NULL) { > + FreePool (FullSchema); > + } > + > + return Status; > +} > + > +/** > + Get Redfish attribute value with the given Schema and Configure Langua= ge. > + > + @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] AttributeValue The attribute value. > + > + @retval EFI_SUCCESS Value is returned successfully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigProtocolGetAttribute ( > + IN EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This, > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + OUT EDKII_REDFISH_ATTRIBUTE *AttributeValue > + ) > +{ > + EFI_STATUS Status; > + REDFISH_PLATFORM_CONFIG_PRIVATE > *RedfishPlatformConfigPrivate; > + REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *TargetStatement; > + CHAR8 *FullSchema; > + CHAR8 *Buffer; > + > + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING > (Version) || IS_EMPTY_STRING (ConfigureLang) || (AttributeValue =3D=3D NU= LL)) > { > + return EFI_INVALID_PARAMETER; > + } > + > + RedfishPlatformConfigPrivate =3D > + REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS (This); ZeroMem > + (AttributeValue, sizeof (EDKII_REDFISH_ATTRIBUTE)); FullSchema =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; > + } > + > + if (TargetStatement->Description !=3D 0) { > + AttributeValue->AttributeName =3D HiiGetRedfishAsciiString > (TargetStatement->ParentForm->ParentFormset->HiiHandle, FullSchema, > TargetStatement->Description); > + Buffer =3D GetAttributeNameFromConfigLanguage > (AttributeValue->AttributeName); > + if (Buffer !=3D NULL) { > + FreePool (AttributeValue->AttributeName); > + AttributeValue->AttributeName =3D Buffer; > + } > + > + AttributeValue->DisplayName =3D HiiGetEnglishAsciiString > + (TargetStatement->ParentForm->ParentFormset->HiiHandle, > + TargetStatement->Description); } > + > + if (TargetStatement->Help !=3D 0) { > + AttributeValue->HelpText =3D HiiGetEnglishAsciiString > + (TargetStatement->ParentForm->ParentFormset->HiiHandle, > + TargetStatement->Help); } > + > + AttributeValue->ReadOnly =3D ((TargetStatement->Flags & > EFI_IFR_FLAG_READ_ONLY) =3D=3D 0 ? FALSE : TRUE); > + AttributeValue->ResetRequired =3D ((TargetStatement->Flags & > EFI_IFR_FLAG_RESET_REQUIRED) =3D=3D 0 ? FALSE : TRUE); > + AttributeValue->Type =3D HiiStatementToAttributeType > (TargetStatement->HiiStatement); > + > + // > + // Deal with maximum and minimum > + // > + if (AttributeValue->Type =3D=3D REDFISH_ATTRIBUTE_TYPE_STRING) { > + AttributeValue->StrMaxSize =3D TargetStatement- > >StatementData.StrMaxSize; > + AttributeValue->StrMinSize =3D > + TargetStatement->StatementData.StrMinSize; > + } else if (AttributeValue->Type =3D=3D REDFISH_ATTRIBUTE_TYPE_INTEGER)= { > + AttributeValue->NumMaximum =3D TargetStatement- > >StatementData.NumMaximum; > + AttributeValue->NumMinimum =3D TargetStatement- > >StatementData.NumMinimum; > + AttributeValue->NumStep =3D TargetStatement- > >StatementData.NumStep; > + } > + > + // > + // Provide value array if this is enumeration type. > + // > + if (TargetStatement->HiiStatement->Operand =3D=3D EFI_IFR_ONE_OF_OP) { > + Status =3D OneOfStatementToAttributeValues (TargetStatement- > >ParentForm->ParentFormset->HiiHandle, FullSchema, TargetStatement- > >HiiStatement, &AttributeValue->Values); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to convert one-of options to > attribute values: %r\n", __FUNCTION__, Status)); > + } > + } > + > +RELEASE_RESOURCE: > + > + if (FullSchema !=3D NULL) { > + FreePool (FullSchema); > + } > + > + return Status; > +} > + > /** > Functions which are registered to receive notification of > database events have this prototype. The actual event is encoded @@ - > 1715,10 +2105,13 @@ RedfishPlatformConfigDxeEntryPoint ( > // Protocol initialization > // > mRedfishPlatformConfigPrivate->ImageHandle =3D ImageHandle; > - mRedfishPlatformConfigPrivate->Protocol.GetValue =3D > RedfishPlatformConfigProtocolGetValue; > - mRedfishPlatformConfigPrivate->Protocol.SetValue =3D > RedfishPlatformConfigProtocolSetValue; > - mRedfishPlatformConfigPrivate->Protocol.GetConfigureLang =3D > RedfishPlatformConfigProtocolGetConfigureLang; > + mRedfishPlatformConfigPrivate->Protocol.Revision =3D > REDFISH_PLATFORM_CONFIG_VERSION; > + mRedfishPlatformConfigPrivate->Protocol.GetValue =3D > RedfishPlatformConfigProtocolGetValue; > + mRedfishPlatformConfigPrivate->Protocol.SetValue =3D > RedfishPlatformConfigProtocolSetValue; > + mRedfishPlatformConfigPrivate->Protocol.GetConfigureLang =3D > RedfishPlatformConfigProtocolGetConfigureLang; > mRedfishPlatformConfigPrivate->Protocol.GetSupportedSchema =3D > RedfishPlatformConfigProtocolGetSupportedSchema; > + mRedfishPlatformConfigPrivate->Protocol.GetAttribute =3D > RedfishPlatformConfigProtocolGetAttribute; > + mRedfishPlatformConfigPrivate->Protocol.GetDefaultValue =3D > RedfishPlatformConfigProtocolGetDefaultValue; >=20 > InitializeListHead (&mRedfishPlatformConfigPrivate->FormsetList); > InitializeListHead (&mRedfishPlatformConfigPrivate->PendingList); > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > index d3f7af55ad..8155484702 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h > @@ -2,6 +2,7 @@ > This file defines the EDKII Redfish Platform Config Protocol interface= . >=20 > (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -60,5 +61,6 @@ typedef struct { > #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-" > +#define REDFISH_PLATFORM_CONFIG_VERSION 0x00010000 >=20 > #endif > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > index b2bb5f64e4..65a0e5766a 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c > @@ -3,6 +3,7 @@ > The implementation of EDKII Redfish Platform Config Protocol. >=20 > (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -300,6 +301,45 @@ HiiGetEnglishString ( > return HiiGetRedfishString (HiiHandle, ENGLISH_LANGUAGE_CODE, > StringId); } >=20 > +/** > + Get ASCII 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. > + > +**/ > +CHAR8 * > +HiiGetEnglishAsciiString ( > + IN EFI_HII_HANDLE HiiHandle, > + IN EFI_STRING_ID StringId > + ) > +{ > + EFI_STRING HiiString; > + UINTN StringSize; > + CHAR8 *AsciiString; > + > + HiiString =3D HiiGetRedfishString (HiiHandle, ENGLISH_LANGUAGE_CODE, > + StringId); if (HiiString =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a, Can not find string ID: 0x%x with %a\n", > __FUNCTION__, StringId, ENGLISH_LANGUAGE_CODE)); > + return NULL; > + } > + > + StringSize =3D (StrLen (HiiString) + 1) * sizeof (CHAR8); AsciiStrin= g > + =3D AllocatePool (StringSize); if (AsciiString =3D=3D NULL) { > + return NULL; > + } > + > + UnicodeStrToAsciiStrS (HiiString, AsciiString, StringSize); > + > + FreePool (HiiString); > + return AsciiString; > +} > + > /** > Check and see if this is supported schema or not. >=20 > @@ -885,10 +925,17 @@ LoadFormset ( > // > // Initialize statement private data. > // > - HiiStatementPrivate->HiiStatement =3D HiiStatement; > - HiiStatementPrivate->QuestionId =3D HiiStatement->QuestionId; > - HiiStatementPrivate->Description =3D HiiStatement->Prompt; > - HiiStatementPrivate->ParentForm =3D HiiFormPrivate; > + HiiStatementPrivate->HiiStatement =3D HiiStatement; > + HiiStatementPrivate->QuestionId =3D HiiStatement->Qu= estionId; > + HiiStatementPrivate->Description =3D HiiStatement->Pr= ompt; > + HiiStatementPrivate->Help =3D HiiStatement->He= lp; > + HiiStatementPrivate->ParentForm =3D HiiFormPrivate; > + HiiStatementPrivate->Flags =3D HiiStatement->Qu= estionFlags; > + HiiStatementPrivate->StatementData.NumMaximum =3D HiiStatement- > >ExtraData.NumData.Maximum; > + HiiStatementPrivate->StatementData.NumMinimum =3D HiiStatement- > >ExtraData.NumData.Minimum; > + HiiStatementPrivate->StatementData.NumStep =3D HiiStatement- > >ExtraData.NumData.Step; > + HiiStatementPrivate->StatementData.StrMaxSize =3D HiiStatement- > >ExtraData.StrData.MaxSize; > + HiiStatementPrivate->StatementData.StrMinSize =3D > + HiiStatement->ExtraData.StrData.MinSize; >=20 > // > // Attach to statement list. > diff --git > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > index cd7a52aef3..f66f5a8799 100644 > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h > @@ -2,6 +2,7 @@ > This file defines the EDKII Redfish Platform Config Protocol interface= . >=20 > (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -74,16 +75,30 @@ typedef struct { >=20 > #define REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK(a) BASE_CR (a, > REDFISH_PLATFORM_CONFIG_FORM_PRIVATE, Link) >=20 > +// > +// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_DATA > +// > +typedef struct { > + UINT64 NumMinimum; > + UINT64 NumMaximum; > + UINT64 NumStep; > + UINT8 StrMinSize; > + UINT8 StrMaxSize; > +} REDFISH_PLATFORM_CONFIG_STATEMENT_DATA; > + > // > // 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. > + LIST_ENTRY Link; > + REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *ParentForm; > + HII_STATEMENT *HiiStatement; // Pointer t= o HII statement > data. > + EFI_QUESTION_ID QuestionId; // Question = ID of this > statement. > + EFI_STRING_ID Description; // String to= ken of this question. > + EFI_STRING_ID Help; // String to= ken of help message. > + EFI_STRING DesStringCache; // The strin= g cache for search > function. > + UINT8 Flags; // The state= ment flag. > + REDFISH_PLATFORM_CONFIG_STATEMENT_DATA StatementData; // > The max/min for statement value. > } REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE; >=20 > #define REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK(a) > BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE, Link) @@ > -280,6 +295,23 @@ HiiGetRedfishAsciiString ( > IN EFI_STRING_ID StringId > ); >=20 > +/** > + Get ASCII 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. > + > +**/ > +CHAR8 * > +HiiGetEnglishAsciiString ( > + IN EFI_HII_HANDLE HiiHandle, > + IN EFI_STRING_ID StringId > + ); > + > /** > Release all resource in statement list. >=20 > -- > 2.38.1.windows.1