From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.55]) by mx.groups.io with SMTP id smtpd.web11.33267.1683640780636685102 for ; Tue, 09 May 2023 06:59:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=ko+6f3by; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.243.55, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7+CPuLuKsa8/gqs1DINOTIZ8jTIoMxTSeosIsWrk4UbcRzUUCtFPLdyT0XilgQ1no32RUmueAxegVY7uCQHwNA+Td60aaVnfK1H6/7Kacv8R3pinJiWLz4H9LB02w1svmGpNwgVINrbFFaWBG2vANZDv/qUmR+oywP26ODrNZzqpZGEDKKxPTYDzYv81joUvIZ8UpOgYLw8G1rKeDlHWoMe7gXGpZQk/OUOPooq33fzJoM/9IPqd5fzkvswSUsTkKnGRy3Fa6PncSgMx5BehNAZrUWPu0O+DThbH2IBIh82G5xAXg1+cnvPnS6WbyzYBeGiVAfF7AzimLv/JSc2og== 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=+Q2vXer0lMeC8+niGSl9doCfaUkcvfcRJfGeKaIQnxc=; b=ZaLWiswGv8g9a0UYALg1RcHQjSyBtUbGpHsG5zTGBVNS7xI/sfbHlrwACsV0860InOviJnTTZiPQsti9gD60HxWYOIRSeNPhxVKa5OB6XwdVXF7SexzGwlZHGDhxdgkqxscneGKEoyjIAmZCgsqKyehNf9GNJA/vOZpcKEn2iBWX21q++0oX31W2FIqAVgplGF5OSpevg6o48zOZ4qOQFA40ZRdleAyS5vdYX43TccyV3BIL4baGjgd3Sa0GGMoJE96nor60+R/PkzaaH52mi5AmOrfOa1QE5xcRqlHLsIRQXzL44QBfqztfrs9fYcPZHOzoRzmaooXoEjMs6vl2TQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+Q2vXer0lMeC8+niGSl9doCfaUkcvfcRJfGeKaIQnxc=; b=ko+6f3by+SETQPwo+6N7nivbKB7CgqagM+iw6SEGZfzSIdyas01yZog8vH2CkGOI2CFImmP+68BHb/tL//8O4Z0Ngq9P1ExW8xBd+X7HyiibVHHmB3p68iGYtCr8VW/JoGGGdLq/XMF3lEgR/85WYns3HDR+C+PPrN0P9bbYJPP2fkr38mRQ/NPLTCesYvNo5eOURQtkMuYrHK4acCfMN3lnKnI2Rc3s2aJI64LiUq4fvtJbPgL+Sw9JwjRCq0WmVlfRbEm1BMMSGak7bzFWjt/PynIB2mTpIS9BfkLZkT47upAqAhnx3H5uZ1fIWiAkTnS38MVBwPY13saiY+sk5Q== Received: from BN9PR03CA0034.namprd03.prod.outlook.com (2603:10b6:408:fb::9) by DS0PR12MB8788.namprd12.prod.outlook.com (2603:10b6:8:14f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Tue, 9 May 2023 13:59:32 +0000 Received: from BN8NAM11FT082.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fb:cafe::b) by BN9PR03CA0034.outlook.office365.com (2603:10b6:408:fb::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33 via Frontend Transport; Tue, 9 May 2023 13:59:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN8NAM11FT082.mail.protection.outlook.com (10.13.176.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33 via Frontend Transport; Tue, 9 May 2023 13:59:31 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 9 May 2023 06:59:21 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 9 May 2023 06:59:21 -0700 Received: from NV-CL38DL3.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 9 May 2023 06:59:20 -0700 From: "Nickle Wang" To: CC: Abner Chang , Igor Kulchytskyy Subject: [edk2-redfish-client][PATCH 6/6] RedfishClientPkg: Introduce RedfishConfigLangMap driver Date: Tue, 9 May 2023 21:59:20 +0800 Message-ID: <20230509135920.7313-1-nicklew@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Return-Path: nicklew@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT082:EE_|DS0PR12MB8788:EE_ X-MS-Office365-Filtering-Correlation-Id: 4930a20f-1fdf-43ce-3a10-08db50959d16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: srXOokqG1F/OuLeYKUJLUg0Vm4az3vbrskTl+luTZ4whs5cvAuol6oqm1RaJqD88ASj8N8jHO7iR32c0wxUUwwxN+o5cS7IpPCWy6Xqy32P994mcvhL01qxbEiU53NeVcH/5hbKsl/xy9jcwHX+OwLP/2uxR0SnpMgag+FJVtBvPOpUQS6C6Mc81AJhxbq63iV5155L26+cRrL2p7cv4129Jg4KiAAMa/SGp+16E6DFN84ULYwjdhG321jYz09mAXV2Ui745Jek6z8oGCRfMmVH552PmtPCNBWa1ErGUHRo1FnI3EpEIlFiqnxViOmOthLoagdcVwUYeQumBQePZZIOB72lpAPsYPQW55EENUKrjXZ0712jvhIwlDy3TCMddkUO3u5Ijfgt6LRReDcs9ls/grvW4o7wiyJvKVApD4dwkmfysraGZCWLw6xaZM2z9djSrmMIKIyCTRa2VJ7VPiGyBdqCIdnYxzzjO1csFAlNUcrzfeU9oxpfY5anJhiU7Pc1ouvRWTBvj/SvI9pDolyVeZNoxqHiU/+fsWyVkuqSKn7q5nI9rApNt7IYjYSp/U2j3JL9BN0VWlxvJaLQXa9SQqiOOBgw4UUqeOIlq0dNgIM5iImwyu9abn/rVzT3+qvbkbdnlSCMw0z7d2w+kDG4ZkOiapv0ihZHqhXYDfvtO5o0AWIWEvnwE0AvhrJMXCj2mji02xA3tGR6g0TDpnQ== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(376002)(396003)(136003)(451199021)(46966006)(40470700004)(36840700001)(7696005)(1076003)(26005)(83380400001)(336012)(426003)(36756003)(47076005)(36860700001)(2616005)(7636003)(86362001)(40480700001)(82310400005)(356005)(82740400003)(186003)(40460700003)(54906003)(316002)(478600001)(2906002)(6916009)(30864003)(5660300002)(70586007)(70206006)(4326008)(8676002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2023 13:59:31.6854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4930a20f-1fdf-43ce-3a10-08db50959d16 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT082.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8788 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Introduce Redfish configure language map driver. This driver keeps the mapping between configure language and Redfish URI for internal use. This saves the communication time between feature drivers and Redfish service. It also provides the history records so that feature drivers can do provisioning, consuming and updating efficiently. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy --- RedfishClientPkg/RedfishClientPkg.dec | 2 + .../RedfishClientComponents.dsc.inc | 1 + .../RedfishConfigLangMapDxe.inf | 46 + .../EdkIIRedfishConfigLangMapProtocol.h | 88 ++ .../RedfishConfigLangMapDxe.h | 71 ++ .../RedfishConfigLangMapDxe.c | 809 ++++++++++++++++++ RedfishClientPkg/RedfishClient.fdf.inc | 3 +- 7 files changed, 1019 insertions(+), 1 deletion(-) create mode 100644 RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigL= angMapDxe.inf create mode 100644 RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLan= gMapProtocol.h create mode 100644 RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigL= angMapDxe.h create mode 100644 RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigL= angMapDxe.c diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/Redfi= shClientPkg.dec index c61c5812..7bdab5be 100644 --- a/RedfishClientPkg/RedfishClientPkg.dec +++ b/RedfishClientPkg/RedfishClientPkg.dec @@ -38,6 +38,8 @@ gEdkIIRedfishResourceConfigProtocolGuid =3D { 0x6f164c68, 0xfb09, 0x4646= , { 0xa8, 0xd3, 0x24, 0x11, 0x5d, 0xab, 0x3e, 0xe7 } } ## Include/Protocol/EdkiiRedfishETagProtocol.h gEdkIIRedfishETagProtocolGuid =3D { 0x5706d368, 0xaf66, 0x48f5= , { 0x89, 0xfc, 0xa6, 0x61, 0xce, 0xb5, 0xa6, 0xa9 } } + ## Include/Protocol/EdkIIRedfishConfigLangMapProtocol.h + gEdkIIRedfishConfigLangMapProtocolGuid =3D { 0x1d9ba9fe, 0x5d5a, 0x4b= 66, {0x83, 0x5b, 0xe2, 0x5d, 0x13, 0x93, 0x4a, 0x9c } } ## Include/Protocol/EdkIIRedfishInterchangeData.h gEdkIIRedfishFeatureInterchangeDataProtocolGuid =3D { 0x4B8FF71C, 0x4A7B= , 0x9478, { 0xB7, 0x81, 0x35, 0x9B, 0x0A, 0xF2, 0x00, 0x91 } } =20 diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClie= ntPkg/RedfishClientComponents.dsc.inc index b89df12c..ee4602fe 100644 --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc @@ -15,6 +15,7 @@ !if $(REDFISH_CLIENT) =3D=3D TRUE RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf + RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf # # Below two modules should be pulled in by build tool. # diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapD= xe.inf b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.i= nf new file mode 100644 index 00000000..9f195338 --- /dev/null +++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf @@ -0,0 +1,46 @@ +## @file +# +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001000b + BASE_NAME =3D RedfishConfigLangMapDxe + FILE_GUID =3D F4121E32-454D-4E51-AB4B-DAA577833E95 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RedfishConfigLangMapDriverEntryPoint + UNLOAD_IMAGE =3D RedfishConfigLangMapDriverUnload + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishPkg/RedfishPkg.dec + RedfishClientPkg/RedfishClientPkg.dec + +[Sources] + RedfishConfigLangMapDxe.h + RedfishConfigLangMapDxe.c + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiDriverEntryPoint + RedfishEventLib + +[Protocols] + gEdkIIRedfishConfigLangMapProtocolGuid ## PRODUCED ## + +[Guids] + gEfiEventExitBootServicesGuid ## CONSUMED ## + +[Depex] + TRUE diff --git a/RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapPro= tocol.h b/RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapProtoc= ol.h new file mode 100644 index 00000000..89846d06 --- /dev/null +++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapProtocol.h @@ -0,0 +1,88 @@ +/** @file + This file defines the EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL interface. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_H_ +#define EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_H_ + +typedef struct _EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL EDKII_REDFISH_CONFI= G_LANG_MAP_PROTOCOL; + +/** + Definition of REDFISH_CONFIG_LANG_MAP_GET_TYPE + **/ +typedef enum { + RedfishGetTypeUri =3D 0, + RedfishGetTypeConfigLang, + RedfishGetTypeMax +} REDFISH_CONFIG_LANG_MAP_GET_TYPE; + +/** + Get string in database by given query string. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_LAN= G_MAP_PROTOCOL instance. + @param[in] QueryStringType The type of given QueryString. + @param[in] QueryString Query string. + @param[out] ResultString Returned string mapping to give que= ry string. + + @retval EFI_SUCCESS The result is found successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter is given. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_GET)( + IN EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *This, + IN REDFISH_CONFIG_LANG_MAP_GET_TYPE QueryStringType, + IN EFI_STRING QueryString, + OUT EFI_STRING *ResultString + ); + +/** + Save URI string which maps to given ConfigLang. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_LANG_MA= P_PROTOCOL instance. + @param[in] ConfigLang Config language to set + @param[in] Uri Uri which is mapping to give ConfigLang= . If Uri is NULL, + the record will be removed. + + @retval EFI_SUCCESS Uri is saved successfully. + @retval Others Some error happened. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_SET)( + IN EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *This, + IN EFI_STRING ConfigLang, + IN EFI_STRING Uri OPTIONAL + ); + +/** + Refresh the resource map database and save database to variable. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_LANG_MA= P_PROTOCOL instance. + + @retval EFI_SUCCESS database is saved successfully. + @retval Others Some error happened. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_FLUSH)( + IN EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *This + ); + +struct _EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL { + EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_GET Get; + EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_SET Set; + EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_FLUSH Flush; +}; + +extern EFI_GUID gEdkIIRedfishConfigLangMapProtocolGuid; + +#endif diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapD= xe.h b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h new file mode 100644 index 00000000..efa27d4d --- /dev/null +++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h @@ -0,0 +1,71 @@ +/** @file + Common header file for RedfishConfigLangMapDxe driver. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef REDFISH_CONFIG_LANG_MAP_DXE_H_ +#define REDFISH_CONFIG_LANG_MAP_DXE_H_ + +#include +#include + +// +// Libraries +// +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CONFIG_LANG_MAP_VARIABLE_NAME L"RedfishConfigLangMap" +#define CONFIG_LANG_MAP_DEBUG_ENABLED 0x00 + +// +// Definition of REDFISH_CONFIG_LANG_MAP_RECORD +// +typedef struct { + LIST_ENTRY List; + EFI_STRING Uri; + EFI_STRING ConfigLang; + UINTN Size; +} REDFISH_CONFIG_LANG_MAP_RECORD; + +#define REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST(a) BASE_CR (a, REDFISH_C= ONFIG_LANG_MAP_RECORD, List) + +// +// Definition of REDFISH_CONFIG_LANG_MAP_LIST +// +typedef struct { + LIST_ENTRY Listheader; + UINTN TotalSize; + UINTN Count; +} REDFISH_CONFIG_LANG_MAP_LIST; + +// +// Definition of REDFISH_CONFIG_LANG_MAP_PRIVATE_DATA +// +typedef struct { + EFI_HANDLE ImageHandle; + REDFISH_CONFIG_LANG_MAP_LIST ConfigLangList; + EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL Protocol; + EFI_STRING VariableName; + EFI_EVENT ExitBootEvent; + EFI_EVENT ProvisionEvent; +} REDFISH_CONFIG_LANG_MAP_PRIVATE_DATA; + +#define REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS(a) BASE_CR (a, REDFISH_= CONFIG_LANG_MAP_PRIVATE_DATA, Protocol) + +#endif diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapD= xe.c b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c new file mode 100644 index 00000000..cea61f90 --- /dev/null +++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c @@ -0,0 +1,809 @@ +/** @file + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "RedfishConfigLangMapDxe.h" + +REDFISH_CONFIG_LANG_MAP_PRIVATE_DATA *mRedfishConfigLangMapPrivate =3D NU= LL; + +/** + Release REDFISH_CONFIG_LANG_MAP_RECORD resource + + @param[in] Record Pointer to REDFISH_CONFIG_LANG_MAP_RECORD instan= ce + + @retval EFI_SUCCESS REDFISH_CONFIG_LANG_MAP_RECORD is releas= ed successfully. + @retval EFI_INVALID_PARAMETER Record is NULL + +**/ +EFI_STATUS +ReleaseConfigLangMapRecord ( + IN REDFISH_CONFIG_LANG_MAP_RECORD *Record + ) +{ + if (Record =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Record->Uri !=3D NULL) { + FreePool (Record->Uri); + } + + if (Record->ConfigLang !=3D NULL) { + FreePool (Record->ConfigLang); + } + + FreePool (Record); + + return EFI_SUCCESS; +} + +/** + Create new resource map resource. + + @param[in] Uri The URI string matching to this ConfigLang. + @param[in] ConfigLang ConfigLang string. + + @retval REDFISH_CONFIG_LANG_MAP_RECORD * Pointer to newly created confi= g language map. + @retval NULL No memory available. + +**/ +REDFISH_CONFIG_LANG_MAP_RECORD * +NewConfigLangMapRecord ( + IN EFI_STRING Uri, + IN EFI_STRING ConfigLang + ) +{ + REDFISH_CONFIG_LANG_MAP_RECORD *NewRecord; + UINTN Size; + + if (IS_EMPTY_STRING (Uri) || IS_EMPTY_STRING (ConfigLang)) { + return NULL; + } + + NewRecord =3D AllocateZeroPool (sizeof (REDFISH_CONFIG_LANG_MAP_RECORD))= ; + if (NewRecord =3D=3D NULL) { + return NULL; + } + + Size =3D StrSize (Uri); + NewRecord->Uri =3D AllocateCopyPool (Size, Uri); + if (NewRecord->Uri =3D=3D NULL) { + goto ON_ERROR; + } + + NewRecord->Size =3D Size; + Size =3D StrSize (ConfigLang); + NewRecord->ConfigLang =3D AllocateCopyPool (Size, ConfigLang); + if (NewRecord->ConfigLang =3D=3D NULL) { + goto ON_ERROR; + } + + NewRecord->Size +=3D Size; + return NewRecord; + +ON_ERROR: + + if (NewRecord !=3D NULL) { + ReleaseConfigLangMapRecord (NewRecord); + } + + return NULL; +} + +/** + Add new config language map by given URI and ConfigLang string to specif= y List. + + @param[in] List Target config language map list to add. + @param[in] Uri The URI string matching to this ConfigLang. + @param[in] ConfigLang ConfigLang string. + + @retval EFI_SUCCESS config language map recourd is added. + @retval Others Fail to add config language map. + +**/ +EFI_STATUS +AddConfigLangMapRecord ( + IN REDFISH_CONFIG_LANG_MAP_LIST *List, + IN EFI_STRING Uri, + IN EFI_STRING ConfigLang + ) +{ + REDFISH_CONFIG_LANG_MAP_RECORD *NewRecord; + + if ((List =3D=3D NULL) || IS_EMPTY_STRING (Uri) || IS_EMPTY_STRING (Conf= igLang)) { + return EFI_INVALID_PARAMETER; + } + + NewRecord =3D NewConfigLangMapRecord (Uri, ConfigLang); + if (NewConfigLangMapRecord =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + InsertTailList (&List->Listheader, &NewRecord->List); + ++List->Count; + List->TotalSize +=3D NewRecord->Size; + + return EFI_SUCCESS; +} + +/** + Delete an config language map by given config language map instance. + + @param[in] List Target config language map list to be removed. + @param[in] Record Pointer to the instance to be deleted. + + @retval EFI_SUCCESS config language map recourd is removed. + @retval Others Fail to add config language map. + +**/ +EFI_STATUS +DeleteConfigLangMapRecord ( + IN REDFISH_CONFIG_LANG_MAP_LIST *List, + IN REDFISH_CONFIG_LANG_MAP_RECORD *Record + ) +{ + if ((List =3D=3D NULL) || (Record =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + RemoveEntryList (&Record->List); + --List->Count; + List->TotalSize -=3D Record->Size; + + return ReleaseConfigLangMapRecord (Record); +} + +/** + Search on given ListHeader for given ConfigLang string. + + @param[in] ListHeader Target list to search. + @param[in] Query Target string to search. + @param[in] QueryIsUri Query string is URI string or not + + @retval REDFISH_CONFIG_LANG_MAP_RECORD Target in map is found. + @retval NULL No target in map with given quer= y is found. + +**/ +REDFISH_CONFIG_LANG_MAP_RECORD * +FindConfigLangMapRecord ( + IN LIST_ENTRY *ListHeader, + IN EFI_STRING Query, + IN BOOLEAN QueryIsUri + ) +{ + LIST_ENTRY *List; + REDFISH_CONFIG_LANG_MAP_RECORD *Record; + + if (IsListEmpty (ListHeader)) { + return NULL; + } + + if (IS_EMPTY_STRING (Query)) { + return NULL; + } + + Record =3D NULL; + List =3D GetFirstNode (ListHeader); + while (!IsNull (ListHeader, List)) { + Record =3D REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List); + + if (QueryIsUri) { + if (StrCmp (Record->Uri, Query) =3D=3D 0) { + return Record; + } + } else { + if (StrCmp (Record->ConfigLang, Query) =3D=3D 0) { + return Record; + } + } + + List =3D GetNextNode (ListHeader, List); + } + + return NULL; +} + +#if CONFIG_LANG_MAP_DEBUG_ENABLED + +/** + Debug output the config language map list. + + @param[in] ConfigLangMapList Target list to dump + @param[in] Msg Debug message string. + + @retval EFI_SUCCESS Debug dump finished. + @retval EFI_INVALID_PARAMETER ConfigLangMapList is NULL. + +**/ +EFI_STATUS +DumpConfigLangMapList ( + IN REDFISH_CONFIG_LANG_MAP_LIST *ConfigLangMapList, + IN EFI_STRING Msg + ) +{ + LIST_ENTRY *List; + REDFISH_CONFIG_LANG_MAP_RECORD *Record; + + if (ConfigLangMapList =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (!IS_EMPTY_STRING (Msg)) { + DEBUG ((DEBUG_ERROR, "%s\n", Msg)); + } + + if (IsListEmpty (&ConfigLangMapList->Listheader)) { + DEBUG ((DEBUG_INFO, "ConfigLangMap list is empty\n")); + return EFI_NOT_FOUND; + } + + DEBUG ((DEBUG_INFO, "Count: %d Total Size: %d\n", ConfigLangMapList->Cou= nt, ConfigLangMapList->TotalSize)); + Record =3D NULL; + List =3D GetFirstNode (&ConfigLangMapList->Listheader); + while (!IsNull (&ConfigLangMapList->Listheader, List)) { + Record =3D REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List); + + DEBUG ((DEBUG_INFO, "ConfigLang: %s Uri: %s Size: %d\n", Record->Confi= gLang, Record->Uri, Record->Size)); + + List =3D GetNextNode (&ConfigLangMapList->Listheader, List); + } + + return EFI_SUCCESS; +} + +/** + Debug output raw data buffer. + + @param[in] Buffer Debug output data buffer. + @param[in] BufferSize The size of Buffer in byte. + + @retval EFI_SUCCESS Debug dump finished. + @retval EFI_INVALID_PARAMETER Buffer is NULL. + +**/ +EFI_STATUS +DumpRawBuffer ( + IN UINT8 *Buffer, + IN UINTN BufferSize + ) +{ + UINTN Index; + CHAR16 *Seeker; + + if (Buffer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Index =3D 0; + Seeker =3D (CHAR16 *)Buffer; + DEBUG ((DEBUG_ERROR, "Buffer size: %d\n", BufferSize)); + while (Seeker[Index] !=3D '\0') { + DEBUG ((DEBUG_ERROR, "(%d) %c ", (Index + 1), Seeker[Index])); + + ++Index; + } + + DEBUG ((DEBUG_ERROR, "\n")); + + return EFI_SUCCESS; +} + +#endif + +/** + Release all ConfigLangMap from list. + + @param[in] ConfigLangMapList The list to be released. + + @retval EFI_SUCCESS All config lang is released. + @retval EFI_INVALID_PARAMETER ConfigLangMapList is NULL. + +**/ +EFI_STATUS +ReleaseConfigLangMapList ( + IN REDFISH_CONFIG_LANG_MAP_LIST *ConfigLangMapList + ) +{ + LIST_ENTRY *List; + LIST_ENTRY *Next; + REDFISH_CONFIG_LANG_MAP_RECORD *Record; + + if (ConfigLangMapList =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (IsListEmpty (&ConfigLangMapList->Listheader)) { + return EFI_SUCCESS; + } + + Record =3D NULL; + Next =3D NULL; + List =3D GetFirstNode (&ConfigLangMapList->Listheader); + while (!IsNull (&ConfigLangMapList->Listheader, List)) { + Record =3D REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List); + Next =3D GetNextNode (&ConfigLangMapList->Listheader, List); + + DeleteConfigLangMapRecord (ConfigLangMapList, Record); + + List =3D Next; + } + + return EFI_SUCCESS; +} + +/** + Save config lang in list to UEFI variable. + + @param[in] ConfigLangMapList The list to be saved. + @param[in] VariableName The UEFI variable name. + + @retval EFI_SUCCESS All config lang is saved. + @retval EFI_INVALID_PARAMETER VariableName or ConfigLangMapList is NUL= L. + +**/ +EFI_STATUS +SaveConfigLangMapList ( + IN REDFISH_CONFIG_LANG_MAP_LIST *ConfigLangMapList, + IN EFI_STRING VariableName + ) +{ + LIST_ENTRY *List; + REDFISH_CONFIG_LANG_MAP_RECORD *Record; + UINT8 *VarData; + VOID *Data; + EFI_STRING Seeker; + UINTN VarSize; + UINTN StringSize; + EFI_STATUS Status; + + if ((ConfigLangMapList =3D=3D NULL) || IS_EMPTY_STRING (VariableName)) { + return EFI_INVALID_PARAMETER; + } + + if (IsListEmpty (&ConfigLangMapList->Listheader)) { + return EFI_SUCCESS; + } + + // + // Caculate the total size we need to keep ConfigLangMap list. + // + VarSize =3D ConfigLangMapList->TotalSize + sizeof (CHAR16); // terminato= r character + VarData =3D AllocateZeroPool (VarSize); + if (VarData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Seeker =3D (EFI_STRING)VarData; + Record =3D NULL; + List =3D GetFirstNode (&ConfigLangMapList->Listheader); + while (!IsNull (&ConfigLangMapList->Listheader, List)) { + Record =3D REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List); + + StringSize =3D StrSize (Record->Uri); + CopyMem (Seeker, Record->Uri, StringSize); + + Seeker +=3D (StringSize / sizeof (CHAR16) - 1); + *Seeker =3D '|'; + ++Seeker; + + StringSize =3D StrSize (Record->ConfigLang); + CopyMem (Seeker, Record->ConfigLang, StringSize); + + Seeker +=3D (StringSize / sizeof (CHAR16) - 1); + *Seeker =3D '\n'; + + ++Seeker; + + List =3D GetNextNode (&ConfigLangMapList->Listheader, List); + } + + *Seeker =3D '\0'; + + #if CONFIG_LANG_MAP_DEBUG_ENABLED + DumpRawBuffer (VarData, VarSize); + #endif + + ASSERT (((UINTN)Seeker - (UINTN)VarData + sizeof (CHAR16)) =3D=3D VarSiz= e); + + // + // Check if variable exists already. If yes, remove it first. + // + Status =3D GetVariable2 ( + VariableName, + &mRedfishVariableGuid, + (VOID *)&Data, + NULL + ); + if (!EFI_ERROR (Status)) { + FreePool (Data); + gRT->SetVariable (VariableName, &mRedfishVariableGuid, VARIABLE_ATTRIB= UTE_NV_BS, 0, NULL); + } + + return gRT->SetVariable (VariableName, &mRedfishVariableGuid, VARIABLE_A= TTRIBUTE_NV_BS, VarSize, (VOID *)VarData); +} + +/** + Read config lang map from UEFI variable if it exists. + + @param[in] ConfigLangMapList The list to be loaded. + @param[in] VariableName The UEFI variable name. + + @retval EFI_SUCCESS All config lang is read successfully. + @retval EFI_INVALID_PARAMETER VariableName or ConfigLangMapList is NUL= L. + @retval EFI_NOT_FOUND No config lang is found on UEFI variable= . + +**/ +EFI_STATUS +InitialConfigLangMapList ( + IN REDFISH_CONFIG_LANG_MAP_LIST *ConfigLangMapList, + IN EFI_STRING VariableName + ) +{ + UINT8 *VarData; + EFI_STRING UriPointer; + EFI_STRING ConfigLangPointer; + EFI_STRING Seeker; + UINTN VariableSize; + EFI_STATUS Status; + + if ((ConfigLangMapList =3D=3D NULL) || IS_EMPTY_STRING (VariableName)) { + return EFI_INVALID_PARAMETER; + } + + // + // Check if variable exists already. + // + Status =3D GetVariable2 ( + VariableName, + &mRedfishVariableGuid, + (VOID *)&VarData, + &VariableSize + ); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + Seeker =3D (EFI_STRING)VarData; + UriPointer =3D (EFI_STRING)VarData; + ConfigLangPointer =3D (EFI_STRING)VarData; + while (*Seeker !=3D '\0') { + // + // Find URI + // + Seeker =3D StrStr (UriPointer, L"|"); + if (Seeker =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a, data corrupted\n", __FUNCTION__)); + Status =3D EFI_DEVICE_ERROR; + goto ON_ERROR; + } + + *Seeker =3D '\0'; + ConfigLangPointer =3D ++Seeker; + + // + // Find config language map + // + Seeker =3D StrStr (ConfigLangPointer, L"\n"); + if (Seeker =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a, data corrupted\n", __FUNCTION__)); + Status =3D EFI_DEVICE_ERROR; + goto ON_ERROR; + } + + *Seeker =3D '\0'; + + AddConfigLangMapRecord (ConfigLangMapList, UriPointer, ConfigLangPoint= er); + + UriPointer =3D ++Seeker; + } + + #if CONFIG_LANG_MAP_DEBUG_ENABLED + DumpConfigLangMapList (ConfigLangMapList, L"Initial ConfigLangMap List f= rom Variable"); + #endif + + Status =3D EFI_SUCCESS; + +ON_ERROR: + + FreePool (VarData); + + return Status; +} + +/** + Get string in database by given query string. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_LAN= G_MAP_PROTOCOL instance. + @param[in] QueryStringType The type of given QueryString. + @param[in] QueryString Query string. + @param[out] ResultString Returned string mapping to give que= ry string. + + @retval EFI_SUCCESS The result is found successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter is given. + +**/ +EFI_STATUS +RedfishConfigLangMapGet ( + IN EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *This, + IN REDFISH_CONFIG_LANG_MAP_GET_TYPE QueryStringType, + IN EFI_STRING QueryString, + OUT EFI_STRING *ResultString + ) +{ + REDFISH_CONFIG_LANG_MAP_RECORD *Target; + REDFISH_CONFIG_LANG_MAP_PRIVATE_DATA *Private; + EFI_STRING Result; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (QueryString) || (ResultString= =3D=3D NULL) || (QueryStringType >=3D RedfishGetTypeMax)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This); + + *ResultString =3D NULL; + + Target =3D FindConfigLangMapRecord (&Private->ConfigLangList.Listheader,= QueryString, (QueryStringType =3D=3D RedfishGetTypeUri)); + if (Target =3D=3D NULL) { + #if CONFIG_LANG_MAP_DEBUG_ENABLED + DumpConfigLangMapList (&Private->ConfigLangList, L"EFI_NOT_FOUND"); + #endif + return EFI_NOT_FOUND; + } + + Result =3D (QueryStringType =3D=3D RedfishGetTypeUri ? Target->Co= nfigLang : Target->Uri); + *ResultString =3D AllocateCopyPool (StrSize (Result), Result); + if (*ResultString =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + return EFI_SUCCESS; +} + +/** + Save URI string which maps to given ConfigLang. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_LANG_MA= P_PROTOCOL instance. + @param[in] ConfigLang Config language to set + @param[in] Uri Uri which is mapping to give ConfigLang= . If Uri is NULL, + the record will be removed. + + @retval EFI_SUCCESS Uri is saved successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishConfigLangMapSet ( + IN EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *This, + IN EFI_STRING ConfigLang, + IN EFI_STRING Uri OPTIONAL + ) +{ + REDFISH_CONFIG_LANG_MAP_RECORD *Target; + REDFISH_CONFIG_LANG_MAP_PRIVATE_DATA *Private; + EFI_STATUS Status; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (ConfigLang)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This); + + Status =3D EFI_NOT_FOUND; + Target =3D FindConfigLangMapRecord (&Private->ConfigLangList.Listheader,= ConfigLang, FALSE); + if (Target !=3D NULL) { + // + // Remove old one and create new one. + // + Status =3D DeleteConfigLangMapRecord (&Private->ConfigLangList, Target= ); + } + + // + // When Uri is NULL, it means that we want to remov this record. + // + if (Uri =3D=3D NULL) { + return Status; + } + + return AddConfigLangMapRecord (&Private->ConfigLangList, Uri, ConfigLang= ); +} + +/** + Refresh the resource map database and save database to variable. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_LANG_MA= P_PROTOCOL instance. + + @retval EFI_SUCCESS This handler has been stoped successful= ly. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishConfigLangMapFlush ( + IN EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *This + ) +{ + REDFISH_CONFIG_LANG_MAP_PRIVATE_DATA *Private; + EFI_STATUS Status; + + if (This =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This); + + Status =3D SaveConfigLangMapList (&Private->ConfigLangList, Private->Var= iableName); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, save ConfigLangMap list to variable: %s fail= ed: %r\n", __FUNCTION__, Private->VariableName, Status)); + } + + return Status; +} + +/** + Callback function executed when the ExitBootService event group is signa= led. + + @param[in] Event Event whose notification function is being invoked= . + @param[out] Context Pointer to the Context buffer + +**/ +VOID +EFIAPI +RedfishConfigLangMapOnExitBootService ( + IN EFI_EVENT Event, + OUT VOID *Context + ) +{ + // + // Memory is about to be released. Keep list into variable. + // + RedfishConfigLangMapFlush (&mRedfishConfigLangMapPrivate->Protocol); +} + +/** + Unloads an image. + + @param[in] 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 +RedfishConfigLangMapDriverUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + + if (mRedfishConfigLangMapPrivate !=3D NULL) { + Status =3D gBS->UninstallProtocolInterface ( + mRedfishConfigLangMapPrivate->ImageHandle, + &gEdkIIRedfishConfigLangMapProtocolGuid, + (VOID *)&mRedfishConfigLangMapPrivate->Protocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, can not uninstall gEdkIIRedfishConfigLangM= apProtocolGuid: %r\n", __FUNCTION__, Status)); + ASSERT (FALSE); + } + + ReleaseConfigLangMapList (&mRedfishConfigLangMapPrivate->ConfigLangLis= t); + + if (mRedfishConfigLangMapPrivate->VariableName !=3D NULL) { + FreePool (mRedfishConfigLangMapPrivate->VariableName); + } + + if (mRedfishConfigLangMapPrivate->ExitBootEvent !=3D NULL) { + gBS->CloseEvent (mRedfishConfigLangMapPrivate->ExitBootEvent); + } + + if (mRedfishConfigLangMapPrivate->ProvisionEvent !=3D NULL) { + gBS->CloseEvent (mRedfishConfigLangMapPrivate->ProvisionEvent); + } + + FreePool (mRedfishConfigLangMapPrivate); + mRedfishConfigLangMapPrivate =3D NULL; + } + + return EFI_SUCCESS; +} + +// +// EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL. +// +EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL mRedfishConfigLangMapProtocol =3D = { + RedfishConfigLangMapGet, + RedfishConfigLangMapSet, + RedfishConfigLangMapFlush +}; + +/** + 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 includ= ing + both device drivers and bus drivers. + + @param[in] ImageHandle The firmware allocated handle for the UEFI= image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The operation completed successfully. + @retval Others An unexpected error occurred. +**/ +EFI_STATUS +EFIAPI +RedfishConfigLangMapDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + mRedfishConfigLangMapPrivate =3D AllocateZeroPool (sizeof (REDFISH_CONFI= G_LANG_MAP_PRIVATE_DATA)); + if (mRedfishConfigLangMapPrivate =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + InitializeListHead (&mRedfishConfigLangMapPrivate->ConfigLangList.Listhe= ader); + mRedfishConfigLangMapPrivate->VariableName =3D AllocateCopyPool (StrSize= (CONFIG_LANG_MAP_VARIABLE_NAME), CONFIG_LANG_MAP_VARIABLE_NAME); + if (mRedfishConfigLangMapPrivate->VariableName =3D=3D NULL) { + goto ON_ERROR; + } + + mRedfishConfigLangMapPrivate->ImageHandle =3D ImageHandle; + CopyMem (&mRedfishConfigLangMapPrivate->Protocol, &mRedfishConfigLangMap= Protocol, sizeof (EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL)); + + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkIIRedfishConfigLangMapProtocolGuid, + EFI_NATIVE_INTERFACE, + (VOID *)&mRedfishConfigLangMapPrivate->Protocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, can not install gEdkIIRedfishConfigLangMapPr= otocolGuid: %r\n", __FUNCTION__, Status)); + ASSERT (FALSE); + goto ON_ERROR; + } + + // + // Create Exit Boot Service event. + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + RedfishConfigLangMapOnExitBootService, + NULL, + &gEfiEventExitBootServicesGuid, + &mRedfishConfigLangMapPrivate->ExitBootEvent + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Fail to register Exit Boot Service event.", = __FUNCTION__)); + goto ON_ERROR; + } + + // + // Read existing record from variable. + // + Status =3D InitialConfigLangMapList (&mRedfishConfigLangMapPrivate->Conf= igLangList, mRedfishConfigLangMapPrivate->VariableName); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a, Initial ConfigLangMap List: %r\n", __FUNCTION= __, Status)); + } + + // + // Register after provisioning event + // + Status =3D CreateAfterProvisioningEvent ( + RedfishConfigLangMapOnExitBootService, + NULL, + &mRedfishConfigLangMapPrivate->ProvisionEvent + ); + + return EFI_SUCCESS; + +ON_ERROR: + + RedfishConfigLangMapDriverUnload (ImageHandle); + + return Status; +} diff --git a/RedfishClientPkg/RedfishClient.fdf.inc b/RedfishClientPkg/Redf= ishClient.fdf.inc index d5d04e4c..6292de4e 100644 --- a/RedfishClientPkg/RedfishClient.fdf.inc +++ b/RedfishClientPkg/RedfishClient.fdf.inc @@ -5,7 +5,7 @@ # by using "!include RedfishClientPkg/RedfisClientLibs.fdf.inc" to specify= the module instances # to be built in the firmware volume. # -# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -13,6 +13,7 @@ !if $(REDFISH_CLIENT) =3D=3D TRUE INF RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf INF RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf + INF RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf INF RedfishClientPkg/Features/Memory/V1_7_1/Dxe/RedfishMemoryDxe.inf INF RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryCo= llectionDxe.inf =20 --=20 2.17.1