From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.67]) by mx.groups.io with SMTP id smtpd.web11.30970.1681882463722348201 for ; Tue, 18 Apr 2023 22:34:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=n2R6tn8D; 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.237.67, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dVaoXIPqUeeiy1gjf/2fNcDV9gtqrALwfjNhFgE2xxdz6Smlj2eVrZ6Y1SmMink7V4/gubpO/QdYAQpF27LGbjhLpoRilzGjsixqtVnWgWohSdOWyJnXynq3CJ9Mu3bO9zVb+NgSyIRg8ZYaxp9AfdjSF0Af/V4FNDC4v3IqwMgt82dGoUqoKAiPiKDPVxBb8qfry4BxMZgkavfPywdkNeErC1r6T6xaSzcRq57s88zQ/iZvRvrzdC8vyI+Q1Vff/3LPCeo3npi6r7ZRyQQcGKApBr74Zw4a1gmrbsnV0U9Vu9EEqN3UIl0y38uDxnJM5Ub2SJRsu173gI6P4zPkQA== 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=97accRaIrYSIxYZNZDtbM1ftXMZSJPPR4eMcWhD1Lrk=; b=ekC7Wx19E31cnE97TonvbNB/N6VMbWwFKHD3YxG8+I1iVVzNrrkBTi99AaGq2jhctaoTZ3BzBzalcuarWw3UY6A1DDOM12Lb5Wbl21zf2uo0nhiNn+5AKAYq74TZW6I6Tb0kHkc2KUoSMREcW1o9NFwYHIrsg3wJl1zjI29f+61etMRJGWhZ7MVhROppTv401quRVc1RiCVbalLNhjX7oHJrLdcqikCL8QvrCEPimj2kqfGVnkXLQkiFBONpxSawrwzP4qhgZuL+LC2ZJQ2H9ZzbtJbr5ObL+8EmCZlKbbUInCKOsiI1ToYuE1TZ4kLHiS7tl0WyuuBSPQaNhhDhXA== 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=97accRaIrYSIxYZNZDtbM1ftXMZSJPPR4eMcWhD1Lrk=; b=n2R6tn8DZzvS6P/KZFNHI13x7ZIALBzpGDRjxXerqzils7q67d+qA5QXwWHpkP9JAdMzeM4E4B0SVfKkj8HK0wDFMpAx4KhHOKsdnsRRPHXzDdOIaFBOw0BlvgMyomAT0+3x9Lt+xfecXp7IakfEXXepKasgkldegM7iFM6RHdo= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by DS7PR12MB6262.namprd12.prod.outlook.com (2603:10b6:8:96::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Wed, 19 Apr 2023 05:34:19 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3%3]) with mapi id 15.20.6319.020; Wed, 19 Apr 2023 05:34:19 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [PATCH v2 4/5] RedfishPkg: Helper library of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL Thread-Topic: [PATCH v2 4/5] RedfishPkg: Helper library of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL Thread-Index: AQHZcmRqvzNI8cdO5kOKLxFEvhb/Aq8yHFtg Date: Wed, 19 Apr 2023 05:34:19 +0000 Message-ID: References: <20230419021215.6012-1-nicklew@nvidia.com> In-Reply-To: <20230419021215.6012-1-nicklew@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-04-19T05:34:17Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=ad0b5863-0d29-4031-985a-7b857279bd55; 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_|DS7PR12MB6262:EE_ x-ms-office365-filtering-correlation-id: 5b9b7e8e-fdec-4b11-6ab6-08db4097b93b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: luC0Dgqxv04QyYaqv6FEht18QHvg4DTh2Q5MbzpYQa23nZn7ruJRZ3jTYKj1KSrq58KRxnSzfQ4l7Y+JBlq7LXUN5/753bVjCJG78blixEBzCcMEF7+Z6TvHlRkL5Z02OepzTvukDQRHBg1nqgnjYRcPMTkPn9ErIQBx/w9GkfEu11MyzwJqZilXVEnbCiBxtvyB5lh25EcuCRP2yYISNjmTACeBQXAGBBFUg4YyCX9QExd67WBE1fCMKGiRNXumBLeUbVQaIzirWDZzwL+/5oyhHHbeuDQOouL7s0AyT3EG/Ix2PTX/Qg7ah2jNcdX8gIMWQcEguLNKQdXJPaQQvvgd4ijFhmv3EzQyDGu+fvPB66KVQHqie4LuyeFaE5oqLPoCCtMyyW/cjMEwyiBFM8ZkjbJe8O3l6Khrycha33odylde2pxCuFb18RkXRjtb9FfMItXJ9m85TOOrSOwg1N/rWtKChuX3+EqbnihGU8shwXP4fxIRMo8NjBWZutR+M9+fmSPazN7MYVV3qQtaOjJX66Hp9mnPlbL7jc+hb/i5jpklLDBHlH7X3revJ4MgymbI76Gnxa68cAniUobkr1sYjhDJr2RYVA5UK0ejaSskjkNPw3MT2zSKD5aUv1qN x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(451199021)(30864003)(2906002)(478600001)(71200400001)(86362001)(26005)(33656002)(53546011)(6506007)(9686003)(7696005)(186003)(38070700005)(55016003)(41300700001)(122000001)(54906003)(38100700002)(8676002)(8936002)(4326008)(66446008)(66556008)(66476007)(110136005)(83380400001)(66946007)(64756008)(76116006)(316002)(52536014)(5660300002)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?d+CqRHsD7a3qHCeczm6ZxZkpH0eIuGiUWYeUZqW6p5IYY4TUvcpN04k1KTBy?= =?us-ascii?Q?twcSfaElshfPg9jxiA6FtZS8ieJ38+6M4SBS/KsoACRGII1Z1o7ZNAZfsyRH?= =?us-ascii?Q?yDGqvKZB+iqZly0koHYNIyctKm4LYqVgoVb4oaBxJuw24tOdRTVunzbBxSP/?= =?us-ascii?Q?P7f5zlZZF9Vabkg26jUaWNEqSpkTPLWxUNIV4eTOF9l7ssn9s7cJgl7kkhH7?= =?us-ascii?Q?ceaxmiR83drpp9jGy341rg3liq3mH7oZ6HUftOaDW2EbkqRxOlHDKKHU6Wey?= =?us-ascii?Q?k4LJXdLxhVfKNVfXDO0GDBZ8g4B7Hj2ZUqcnAC4Hcg3fzXLM9cnLTc+fWowU?= =?us-ascii?Q?FdYkB2dtmWmeiX5Zd9mVH49k7YWzxeHDaFpNmMhESeCTPpjrrWhjwT9xGgRe?= =?us-ascii?Q?J9f90VnGEZzFdXfL3AVQzSY9TUkn5YqbQA4zYSyWIsC/wAaxyIXEELhzQ2xD?= =?us-ascii?Q?ARn23Aw9PKlxLsOG6qeOGM/mUhBYqa05hgSxNw8hGOpFv1srj1vnl4vPY6bM?= =?us-ascii?Q?vZG2DddhHi2sE4KaTAVlfLLY0WdbSIe/lMjhRYHlZS9i1xp9xpw7qPMhL/O2?= =?us-ascii?Q?1KIN97kUDB+rUK+79mzkNDSGJC1TRnBoIhuQPmk3VqwzXVoUGvDuAmRiGQHw?= =?us-ascii?Q?wOl8aZuns5j3YwtbVNCX4ARLfHBsaDgdOXZf1TjK5ivYMSs9ege5f0i2Mdn5?= =?us-ascii?Q?cIMn9pLMtj64x/UvjE3Gbze73AAGj/yo0WbsKnyNtVm/cbYlcFqlpO2K9oRu?= =?us-ascii?Q?tokEQ78cxGJTXRDHyeDl3ZY/AR+tGgDzW7ZyczwFTbx1M8kXK7KBztmmUpNU?= =?us-ascii?Q?BHxSNYJnKUmY9uX20uCtos3zTm2NimGmY7Eo4lXLndUk3ffGdnYaWudxhZz0?= =?us-ascii?Q?mSD4FBl9Kf/sMYwyOFZc8Q0Q3W92sLmRc+fXBQE0RAYQ6vy1vQk+O3/4NRdl?= =?us-ascii?Q?F/DhxYOTtlZbFC6rHYC/VO94tyZxKJb5f4As+hZqUaov4IvRb3HEhRU0ugB5?= =?us-ascii?Q?QSjQjiZdQgtgoEQ6eSmnyQ4xDYDXFpgXqX+ZeZNEZk9p5iFXLssfRz/D0KdL?= =?us-ascii?Q?8fr/JGfyBedQ7YLPPGBQe91f7wrta+LdM12DUmADGebsurY9P8YyS3IU69nB?= =?us-ascii?Q?MxbkCnPO6desVoVycsW0C0Of/5yaED7W/t2f5Dy4XEr4xzTtzMo+vCLShJOc?= =?us-ascii?Q?g+6WREmcuxlFZ8Jg3r2cYCEhrDhYFxhgJHdP+jCXaJm4wGsdytbp9UQqJBOw?= =?us-ascii?Q?8AkUB4asAiuT2f+N9e1787oYhL5TGDbM33qUjD/SjtsOke5GGusv/DUm1O2m?= =?us-ascii?Q?+DJ9PB8ADA3S6fexj9LNnNCf5O3hmMKe+4JQf9+snk6j2Gm948g+iXje88j3?= =?us-ascii?Q?UX6s3xUZX+J1HSI4WOfPcmu1i6mYMuCGzECLjPhCLYdcjLbdkppQBqfuaAgU?= =?us-ascii?Q?PhQVmZwb7Vo1pbUKeNLxIr0BSwjprNFse2in1gh2CtO1WU7cszf16DJt4YFo?= =?us-ascii?Q?UHqJsEdJTyvvWQkiQYLVPLPpH37HC+wpA+zMvKdVCCRLFl3wldBCqFcM5vTw?= =?us-ascii?Q?RZjJxN7n1uhdVBFPJfJyuiXwOp+lxm6svNSbFNPC?= 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: 5b9b7e8e-fdec-4b11-6ab6-08db4097b93b X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2023 05:34:19.4831 (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: z019SjQxZ4lTshfMj+Y4HkROu1l7X1wIPOjW4Ip9GOj6vhOvSrKZWE4ol79IhhId/eIrj8oVqg0QAeqja/nGww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6262 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, April 19, 2023 10:12 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [PATCH v2 4/5] RedfishPkg: Helper library of > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > This is the helper library for using > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > RedfishPkg/RedfishPkg.dec | 5 + > .../RedfishPlatformConfigLib.inf | 41 +++ > .../Library/RedfishPlatformConfigLib.h | 143 ++++++++ > .../RedfishPlatformConfigInternal.h | 35 ++ > .../RedfishPlatformConfigLib.c | 310 ++++++++++++++++++ > 5 files changed, 534 insertions(+) > create mode 100644 > RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf > create mode 100644 RedfishPkg/Include/Library/RedfishPlatformConfigLib.h > create mode 100644 > RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInternal > .h > create mode 100644 > RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c >=20 > diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index > e2892ce9cec1..cdb1528cedc9 100644 > --- a/RedfishPkg/RedfishPkg.dec > +++ b/RedfishPkg/RedfishPkg.dec > @@ -64,6 +64,11 @@ > # > HiiUtilityLib|Include/Library/HiiUtilityLib.h >=20 > + ## @libraryclass Provides the library functions to access Redfish Pl= atform > + # Config protocol. > + # > + RedfishPlatformConfigLib|Include/Library/RedfishPlatformConfigLib.h > + > [LibraryClasses.Common.Private] > ## @libraryclass Provides the private C runtime library functions. > # CRT library is currently used by edk2 JsonLib (open source > diff --git > a/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.in= f > b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.in > f > new file mode 100644 > index 000000000000..2258609a1c91 > --- /dev/null > +++ b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigL > +++ ib.inf > @@ -0,0 +1,41 @@ > +## @file > +# Library for Redfish Platform Config Protocol > +# > +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D RedfishPlatformConfigLib > + FILE_GUID =3D C920FD62-21AC-4638-B9F5-9612942290F= 6 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D RedfishPlatformConfigLib| DXE_DRIVE= R > DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER > + CONSTRUCTOR =3D RedfishPlatformConfigLibConstructor > + DESTRUCTOR =3D RedfishPlatformConfigLibDestructor > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC RISCV64 > +# > + > +[Sources] > + RedfishPlatformConfigLib.c > + RedfishPlatformConfigInternal.h > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + RedfishPkg/RedfishPkg.dec > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + MemoryAllocationLib > + UefiBootServicesTableLib > + UefiLib > + > +[Protocols] > + gEdkIIRedfishPlatformConfigProtocolGuid > diff --git a/RedfishPkg/Include/Library/RedfishPlatformConfigLib.h > b/RedfishPkg/Include/Library/RedfishPlatformConfigLib.h > new file mode 100644 > index 000000000000..51a186163994 > --- /dev/null > +++ b/RedfishPkg/Include/Library/RedfishPlatformConfigLib.h > @@ -0,0 +1,143 @@ > +/** @file > + Definitions of RedfishPlatformConfigLib > + > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_PLATFORM_CONFIG_LIB_H_ > +#define REDFISH_PLATFORM_CONFIG_LIB_H_ > + > +#include > + > +/** > + Get Redfish value with the given Schema and Configure Language. > + > + @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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigGetValue ( > + 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] 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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigSetValue ( > + 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] 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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigGetConfigureLang ( > + 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. > + > + @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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPlatformConfigGetSupportedSchema ( > + OUT CHAR8 **SupportedSchema > + ); > + > +/** > + Get Redfish attribute value with the given Schema and Configure Langua= ge. > + > + @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 > +RedfishPlatformConfigGetAttribute ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + OUT EDKII_REDFISH_ATTRIBUTE *AttributeValue > + ); > + > +/** > + Get Redfish default value with the given Schema and Configure Language= . > + > + @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 > +RedfishPlatformConfigGetDefaultValue ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + IN UINT16 DefaultClass, > + OUT EDKII_REDFISH_VALUE *Value > + ); > + > +#endif > diff --git > a/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInter > nal.h > b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInter > nal.h > new file mode 100644 > index 000000000000..061e7f4a453c > --- /dev/null > +++ b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigI > +++ nternal.h > @@ -0,0 +1,35 @@ > +/** @file > + Internal function header for Redfish Platform Config Library. > + > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_PLATFORM_CONFIG_H_ > +#define REDFISH_PLATFORM_CONFIG_H_ > + > +#include > + > +#include > +#include > +#include > +#include #include > + > +#include > +#include > + > +#include > + > +/// > +/// Definition of REDFISH_PLATFORM_CONFIG_LIB_PRIVATE > +/// > +typedef struct { > + EFI_EVENT ProtocolEvent; ///< Protocol= notification event. > + VOID *Registration; ///< Protocol= notification > registration. > + EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *Protocol; > +} REDFISH_PLATFORM_CONFIG_LIB_PRIVATE; > + > +#endif > diff --git > a/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c > b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c > new file mode 100644 > index 000000000000..3500b6aa8fb4 > --- /dev/null > +++ b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigL > +++ ib.c > @@ -0,0 +1,310 @@ > +/** @file > + Wrapper function to support Redfish Platform Config protocol. > + > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "RedfishPlatformConfigInternal.h" > + > +REDFISH_PLATFORM_CONFIG_LIB_PRIVATE > mRedfishPlatformConfigLibPrivate; > + > +/** > + Get Redfish value with the given Schema and Configure Language. > + > + @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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigGetValue ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + OUT EDKII_REDFISH_VALUE *Value > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.Protocol =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + return mRedfishPlatformConfigLibPrivate.Protocol->GetValue ( > + mRedfishPlatformCo= nfigLibPrivate.Protocol, > + Schema, > + Version, > + ConfigureLang, > + Value > + ); } > + > +/** > + Get Redfish attribute value with the given Schema and Configure Langua= ge. > + > + @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 > +RedfishPlatformConfigGetAttribute ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + OUT EDKII_REDFISH_ATTRIBUTE *AttributeValue > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.Protocol =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + return mRedfishPlatformConfigLibPrivate.Protocol->GetAttribute ( > + mRedfishPlatformCo= nfigLibPrivate.Protocol, > + Schema, > + Version, > + ConfigureLang, > + AttributeValue > + ); } > + > +/** > + Get Redfish default value with the given Schema and Configure Language= . > + > + @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 > +RedfishPlatformConfigGetDefaultValue ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + IN UINT16 DefaultClass, > + OUT EDKII_REDFISH_VALUE *Value > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.Protocol =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + return mRedfishPlatformConfigLibPrivate.Protocol->GetDefaultValue ( > + mRedfishPlatformCo= nfigLibPrivate.Protocol, > + Schema, > + Version, > + ConfigureLang, > + DefaultClass, > + Value > + ); } > + > +/** > + Set Redfish value with the given Schema and Configure Language. > + > + @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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigSetValue ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING ConfigureLang, > + IN EDKII_REDFISH_VALUE Value > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.Protocol =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + return mRedfishPlatformConfigLibPrivate.Protocol->SetValue ( > + mRedfishPlatformCo= nfigLibPrivate.Protocol, > + Schema, > + Version, > + ConfigureLang, > + Value > + ); } > + > +/** > + Get the list of Configure Language from platform configuration by the > given Schema and Pattern. > + > + @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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +RedfishPlatformConfigGetConfigureLang ( > + IN CHAR8 *Schema, > + IN CHAR8 *Version, > + IN EFI_STRING Pattern, > + OUT EFI_STRING **ConfigureLangList, > + OUT UINTN *Count > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.Protocol =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + return mRedfishPlatformConfigLibPrivate.Protocol->GetConfigureLang ( > + mRedfishPlatformCo= nfigLibPrivate.Protocol, > + Schema, > + Version, > + Pattern, > + ConfigureLangList, > + Count > + ); } > + > +/** > + Get the list of supported Redfish schema from platform configuration. > + > + @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 EFI_NOT_READY Redfish Platform Config protocol is n= ot > ready. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPlatformConfigGetSupportedSchema ( > + OUT CHAR8 **SupportedSchema > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.Protocol =3D=3D NULL) { > + return EFI_NOT_READY; > + } > + > + return mRedfishPlatformConfigLibPrivate.Protocol->GetSupportedSchema > ( > + mRedfishPlatformCo= nfigLibPrivate.Protocol, > + SupportedSchema > + ); } > + > +/** > + This is a EFI_REDFISH_PLATFORM_CONFIG_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 > +RedfishPlatformConfigProtocolInstalled ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + > + // > + // Locate EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL. > + // > + Status =3D gBS->LocateProtocol ( > + &gEdkIIRedfishPlatformConfigProtocolGuid, > + NULL, > + (VOID **)&mRedfishPlatformConfigLibPrivate.Protocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: locate > EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL failure: %r\n", __func__, > Status)); > + return; > + } > + > + gBS->CloseEvent (Event); > + mRedfishPlatformConfigLibPrivate.ProtocolEvent =3D NULL; } > + > +/** > + > + Create protocol listener and wait for Redfish Platform Config protocol= . > + > + @param ImageHandle The image handle. > + @param SystemTable The system table. > + > + @retval EFI_SUCCESS Protocol listener is registered successfully. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPlatformConfigLibConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + ZeroMem (&mRedfishPlatformConfigLibPrivate, sizeof > +(REDFISH_PLATFORM_CONFIG_LIB_PRIVATE)); > + mRedfishPlatformConfigLibPrivate.ProtocolEvent =3D > EfiCreateProtocolNotifyEvent ( > + &gEdkIIRedfishPlatf= ormConfigProtocolGuid, > + TPL_CALLBACK, > + RedfishPlatformConf= igProtocolInstalled, > + NULL, > + &mRedfishPlatformCo= nfigLibPrivate.Registration > + ); > + if (mRedfishPlatformConfigLibPrivate.ProtocolEvent =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: failed to create protocol notify > +event\n", __func__)); > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + Unloads the application and its installed protocol. > + > + @param ImageHandle Handle that identifies the image to be unload= ed. > + @param SystemTable The system table. > + > + @retval EFI_SUCCESS The image has been unloaded. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPlatformConfigLibDestructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + if (mRedfishPlatformConfigLibPrivate.ProtocolEvent !=3D NULL) { > + gBS->CloseEvent (mRedfishPlatformConfigLibPrivate.ProtocolEvent); > + mRedfishPlatformConfigLibPrivate.ProtocolEvent =3D NULL; > + } > + > + mRedfishPlatformConfigLibPrivate.Protocol =3D NULL; > + > + return EFI_SUCCESS; > +} > -- > 2.17.1