From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.81]) by mx.groups.io with SMTP id smtpd.web11.13401.1686663532911960680 for ; Tue, 13 Jun 2023 06:38:53 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=GXCGRY4h; 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.92.81, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R1EMqkhGHnVjweS7WaGYQ/Aojsk7PzTolXV0P7j7xSJ8B74zhx6AGzi05Ukjqm52Wdfe9Ds3QSowCSJ0IvALNdguxhD5a8CqZfrDzBOAMw0zhDHAmg2o/THg7bM70+6F68SsuLSmvRuhqwx4nlKQ0/KmfkenqkjxtBMZL65BMruM6Cnv4ijGGQN3lTBBjy/ZK9mmGsjwq/ktLI196BCpbyjc7HsIayFK6WkLL5ZL0Vl+sphS34UEoek5bJteVTX2vv74INlU/p5t6gpmnIjtrg8YFjqAV5qZuptbNqhzOoQ2QPbSoHClLenJUwUtVED2bDZsSTyAuTjECrBDMEPJkA== 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=tm9bpktJimK9rWnMxRN2EA5rbMqdks62cyaTSv13jPc=; b=X+fuI41DNazKdTwZF1ENWiUT5AS4liZjF9bUDrj6oc2SAhIPvn9Jzr5DA6FnK4hcJdDoYwT+ZVC/4dD4vZvKo/dIm4J10zI6M4dH37dWxyVaqC0nKVlyovCYVEPiT1k2zVH+I1+vTHUp2O+qkqzAtjT5g0XNYugUsYroU5Q8f6q+d7x9GjYjlzvl2PeacEV/mGciEUWnrId4xEFA3wLV5XA/8sjYoqK/Z/sT6WkkcK2iK+xx1m842r/0X6NPlL5sIK6cUQQvuOaWWLCiyi8AjIzASfJig0B0g593v36/Y/o3QZnTQpGGHWtECGGTtMDwbHIgLx1oMWJhGmEAPSUkvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=tm9bpktJimK9rWnMxRN2EA5rbMqdks62cyaTSv13jPc=; b=GXCGRY4h6R9tWJyqUv75OdGz3eS6lI8GR53mVlbG3FMVzPNB6FQKyveTH0qyeRMb8srFXGMd/sM4EhJEv3/7r09UF85OfS9agqz26gn0YcGL7qZSlyN4DiVPuV7e6jRxU0ccDMb9M0GeHecPuqSJstVGR6W4ibqWQXDpzE8jJ67v8HeGkp6QyaI8hwxk3F/02/G1sPuYprDQW7N0QbgMd0YEe9y7UOuqNq7iSUt0b8H2/Os9UX7pGuOtyKSzkJaAeznnRFxj7NulZtoLNsirkFS1ChuKbdlVDY+PaAs6Yl9+/9NTWtIAA5PhgcCOBByIMGqft+E8bzuHJidgGVmoLQ== Received: from BN1PR13CA0027.namprd13.prod.outlook.com (2603:10b6:408:e2::32) by PH8PR12MB6818.namprd12.prod.outlook.com (2603:10b6:510:1c9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.41; Tue, 13 Jun 2023 13:38:44 +0000 Received: from BN8NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e2:cafe::a0) by BN1PR13CA0027.outlook.office365.com (2603:10b6:408:e2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.23 via Frontend Transport; Tue, 13 Jun 2023 13:38:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT062.mail.protection.outlook.com (10.13.177.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.23 via Frontend Transport; Tue, 13 Jun 2023 13:38:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 13 Jun 2023 06:38:29 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 13 Jun 2023 06:38:28 -0700 Received: from NV-CL38DL3.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 13 Jun 2023 06:38:27 -0700 From: "Nickle Wang" To: CC: Abner Chang , Igor Kulchytskyy Subject: [edk2-redfish-client][PATCH v2 3/3] RedfishClientPkg: Introduce HiiToRedfishBiosDxe driver Date: Tue, 13 Jun 2023 21:38:27 +0800 Message-ID: <20230613133827.23666-1-nicklew@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Return-Path: nicklew@nvidia.com X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT062:EE_|PH8PR12MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: c13f371a-c1be-4976-59dc-08db6c138212 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KtrIP+24Fuf4WeZDj3hyLC1V3VLCl+HVVncDPZu77Hl0hyT63rEbGB6QrSc7E5QVIN7ypCPoV46Lj4X8VfTapDcrBUPWJnLRw3UTaORVK9f1s6noTk1Ejg77wNm5aDR0+83T0Tw4ghJf3phUigfuZjMaXsfCncpUyViCGoP6pSnOYsO0nQ+TeJg0ehD8p6akirWYBUXrBmXj3wT/35xGGIS1VSv+a9CSE9/rT8u7/dgCZCnvjNk38Ff9emv6dI8/LlY7mARZaaKiOAZuvNIIWqQC6ItGzwtweXlOiAHqodx6XlDTNj69ogx83XyMEYGAiRS5W9Ce6c/nJXz8VeLeQnXzHfki6GFjSZL1j4OJkxu2hCO0M7vrPL+mJBWoev3+MYvoYlFjBRqOa+6AE/2UMj/9ZTmR5ROn1ImfZrY+7/Jc98UXJ6bokzHDMPiDiIKLwQxYAc4Iewd3XSzQhlYKJRmArNs4eZluxaT6bIhmu3KCLMtp9Ba3kVm6FJigtiSllFLgkXyaY7l0qe5LMWa34XdAqQCq6ybbHGjSOSXLXWsKNfPM3Ue5Iq546w9CcT9TC/px/jo2R7MDTSBWmW6RwPkZQRiuTmCwdWW9P5Wa2LKQa7bugJr0Wd36kJmdohZOT7zu1CkbMD39vBPTvRd//ez+kVh39wek8DVFB3RaMJOtssJIhhdMj8mYPwrr5pTOerLyzUJZeyek2Ja0Ei9aWo+p2wdOgEamgGIpEpa2BOwlTP0UFUpbzi5mHU/C+1GRWPW6sd0N/H4+L2hoW6eEMg== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(6029001)(4636009)(346002)(39860400002)(396003)(136003)(376002)(451199021)(36840700001)(46966006)(40470700004)(40460700003)(478600001)(70586007)(70206006)(316002)(6916009)(54906003)(4326008)(19627235002)(36756003)(86362001)(83380400001)(47076005)(66574015)(336012)(26005)(186003)(1076003)(41300700001)(7696005)(426003)(36860700001)(5660300002)(8676002)(82310400005)(30864003)(8936002)(2906002)(356005)(40480700001)(82740400003)(7636003)(2616005)(44824005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 13:38:44.3601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c13f371a-c1be-4976-59dc-08db6c138212 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6818 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add HiiToRedfishBiosDxe driver with configure language defined in UNI file in order to demonstrate the use of Redfish Platform Config Protocol. Feature drivers under RedfishClientPkg will work with this driver and provide the REST data to Redfish service. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy --- RedfishClientPkg/RedfishClientPkg.dec | 1 + .../RedfishClientComponents.dsc.inc | 1 + .../HiiToRedfishBiosDxe.inf | 56 ++++ .../HiiToRedfishBiosData.h | 47 +++ .../HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.h | 45 +++ .../HiiToRedfishBiosVfr.vfr | 68 ++++ .../HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.c | 290 ++++++++++++++++++ .../HiiToRedfishBiosDxeMap.uni | 21 ++ .../HiiToRedfishBiosDxeStrings.uni | 31 ++ RedfishClientPkg/RedfishClient.fdf.inc | 1 + 10 files changed, 561 insertions(+) create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDx= e.inf create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDa= ta.h create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDx= e.h create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosVf= r.vfr create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDx= e.c create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDx= eMap.uni create mode 100644 RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDx= eStrings.uni diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/Redfi= shClientPkg.dec index 3a323bbb..eccbc22e 100644 --- a/RedfishClientPkg/RedfishClientPkg.dec +++ b/RedfishClientPkg/RedfishClientPkg.dec @@ -59,6 +59,7 @@ =20 gHiiToRedfishMemoryFormsetGuid =3D { 0XC2BE579E, 0X3C5= 7, 0X499C, { 0XA9, 0XDF, 0XE6, 0X23, 0X8A, 0X49, 0X64, 0XF8 }} gHiiToRedfishBootFormsetGuid =3D { 0x8399a787, 0x108= e, 0x4e53, { 0x9e, 0xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab, 0x3b }} + gHiiToRedfishBiosFormsetGuid =3D { 0xC2724AD1, 0x404= 9, 0x2404, { 0xF8, 0xCE, 0x01, 0xA7, 0x9C, 0xEC, 0x16, 0xF6 }} =20 [PcdsFixedAtBuild] gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT= 32|0x10000001 diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClie= ntPkg/RedfishClientComponents.dsc.inc index b53c4a75..fc54787d 100644 --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc @@ -19,6 +19,7 @@ RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf + RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf !endif # # Below two modules should be pulled in by build tool. diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf b= /RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf new file mode 100644 index 00000000..a5be68f8 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf @@ -0,0 +1,56 @@ +## @file +# HII-to-Redfish BIOS Example driver. +# +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D HiiToRedfishBiosDxe + FILE_GUID =3D 9A7FA287-4038-CB66-DC70-92AE8C0FCF73 + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D HiiToRedfishBiosDxeDriverEntryPoint + UNLOAD_IMAGE =3D HiiToRedfishBiosDxeDriverUnload + +[Sources] + HiiToRedfishBiosDxe.c + HiiToRedfishBiosDxe.h + HiiToRedfishBiosData.h + HiiToRedfishBiosVfr.vfr + HiiToRedfishBiosDxeStrings.uni + HiiToRedfishBiosDxeMap.uni + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishClientPkg/RedfishClientPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + BaseLib + BaseMemoryLib + DebugLib + PcdLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiLib + PrintLib + HiiLib + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiHiiConfigAccessProtocolGuid + + +[Guids] + gHiiToRedfishBiosFormsetGuid + +[Depex] + gEfiHiiDatabaseProtocolGuid + diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosData.h b/= RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosData.h new file mode 100644 index 00000000..7e1bc9ce --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosData.h @@ -0,0 +1,47 @@ +/** @file + The header file of HII-to-Redfish BIOS example driver. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef HII_TO_REDFISH_BIOS_DATA_H_ +#define HII_TO_REDFISH_BIOS_DATA_H_ + +#include +#include + +#define HII_TO_REDFISH_BIOS_FORMSET_GUID \ + { \ + 0xC2724AD1, 0x4049, 0x2404, { 0xF8, 0xCE, 0x01, 0xA7, 0x9C, 0xEC, 0x16= , 0xF6 } \ + } + +extern EFI_GUID gHiiToRedfishBiosFormsetGuid; + +#define FORM_ID 0x001 +#define FROM_ID_BIOS_OPTION_1 0x002 +#define FROM_ID_BIOS_OPTION_2 0x003 +#define FROM_ID_BIOS_OPTION_3 0x004 +#define FROM_ID_BIOS_OPTION_4 0x005 + +#define ID_STRING_MIN 0 +#define ID_STRING_MAX 15 +#define ID_STRING_MAX_WITH_TERMINATOR 16 + +#pragma pack() + +// +// Definiton of HII_TO_REDFISH_BIOS_VARSTORE_DATA +// +typedef struct { + UINT8 RedfishBiosOption1Data; + CHAR16 RedfishBiosOption2Data[ID_STRING_MAX_WITH_TERMINATOR]; + UINT8 RedfishBiosOption3Data; + UINT8 RedfishBiosOption4Data; + UINT8 Reserved; +} HII_TO_REDFISH_BIOS_EFI_VARSTORE_DATA; + +#endif diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.h b/R= edfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.h new file mode 100644 index 00000000..0223083b --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.h @@ -0,0 +1,45 @@ +/** @file + HII-to-Redfish BIOS example driver header file. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef HII_TO_REDFISH_BIOS_DXE_H_ +#define HII_TO_REDFISH_BIOS_DXE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "HiiToRedfishBiosData.h" + +extern UINT8 HiiToRedfishBiosVfrBin[]; + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +#endif diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosVfr.vfr b= /RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosVfr.vfr new file mode 100644 index 00000000..83c3f4e0 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosVfr.vfr @@ -0,0 +1,68 @@ +/** @file + HII-to-Redfish BIOS example driver VFR file. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include "HiiToRedfishBiosData.h" + +formset + guid =3D HII_TO_REDFISH_BIOS_FORMSET_GUID, + title =3D STRING_TOKEN(STR_FORM_SET_TITLE), + help =3D STRING_TOKEN(STR_FORM_SET_TITLE_HELP), + classguid =3D EFI_HII_PLATFORM_SETUP_FORMSET_GUID, + + // + // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI) + // + efivarstore HII_TO_REDFISH_BIOS_EFI_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLAT= ILE, // EFI variable attribures + name =3D HiiToRedfishBiosEfiVar, + guid =3D HII_TO_REDFISH_BIOS_FORMSET_GUID; + + // + // Define a Form (EFI_IFR_FORM) + // + form formid =3D FORM_ID, // Form ID + title =3D STRING_TOKEN(STR_FORM_TITLE); // Form title + + oneof varid =3D HiiToRedfishBiosEfiVar.RedfishBiosOption1Data, + questionid =3D FROM_ID_BIOS_OPTION_1, + prompt =3D STRING_TOKEN(STR_BIOS_OPTION_1_PROMPT), + help =3D STRING_TOKEN(STR_BIOS_OPTION_1_HELP), + flags =3D INTERACTIVE | NUMERIC_SIZE_1, + option text =3D STRING_TOKEN(STR_BIOS_OPTION_1_ITEM_1), va= lue =3D STR_BIOS_OPTION_1_ITEM_1, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_BIOS_OPTION_1_ITEM_2), va= lue =3D STR_BIOS_OPTION_1_ITEM_2, flags =3D 0; + option text =3D STRING_TOKEN(STR_BIOS_OPTION_1_ITEM_3), va= lue =3D STR_BIOS_OPTION_1_ITEM_3, flags =3D 0; + endoneof; + + string varid =3D HiiToRedfishBiosEfiVar.RedfishBiosOption2Data, + prompt =3D STRING_TOKEN(STR_BIOS_OPTION_2_PROMPT), + help =3D STRING_TOKEN(STR_BIOS_OPTION_2_HELP), + flags =3D READ_ONLY, + minsize =3D ID_STRING_MIN, + maxsize =3D ID_STRING_MAX, + endstring; + + numeric varid =3D HiiToRedfishBiosEfiVar.RedfishBiosOption3Data, + prompt =3D STRING_TOKEN(STR_BIOS_OPTION_3_PROMPT), + help =3D STRING_TOKEN(STR_BIOS_OPTION_3_HELP), + minimum =3D 0, + maximum =3D 0xff, + step =3D 1, + default =3D 20, + endnumeric; + + checkbox varid =3D HiiToRedfishBiosEfiVar.RedfishBiosOption4Data, + prompt =3D STRING_TOKEN(STR_BIOS_OPTION_4_PROMPT), + help =3D STRING_TOKEN(STR_BIOS_OPTION_4_PROMPT), + flags =3D CHECKBOX_DEFAULT, + default =3D TRUE, + endcheckbox; + endform; +endformset; diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.c b/R= edfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.c new file mode 100644 index 00000000..cee4c024 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.c @@ -0,0 +1,290 @@ +/** @file + HII-to-Redfish Bios example driver. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "HiiToRedfishBiosDxe.h" + +EFI_GUID mHiiToRedfishBiosGuid =3D HII_TO_REDFISH_BIOS_FORMSET_GUID= ; +EFI_HII_HANDLE mHiiHandle; +EFI_HANDLE DriverHandle; +CHAR16 HiiToRedfishEfiVar[] =3D L"HiiToRedfishBiosEfiVar"; + +/// +/// HII specific Vendor Device Path definition. +/// +HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + HII_TO_REDFISH_BIOS_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +/** + Initial HII variable if it does not exist. + + @retval EFI_SUCCESS HII variable is initialized. + +**/ +EFI_STATUS +InitialHiiVariable ( + VOID + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + HII_TO_REDFISH_BIOS_EFI_VARSTORE_DATA HiiToRedfishBiosVar; + + // + // Get Buffer Storage data from EFI variable. + // Try to get the current setting from variable. + // + BufferSize =3D sizeof (HII_TO_REDFISH_BIOS_EFI_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + HiiToRedfishEfiVar, + &gHiiToRedfishBiosFormsetGuid, + NULL, + &BufferSize, + &HiiToRedfishBiosVar + ); + if (!EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + // + // Initialization + // + HiiToRedfishBiosVar.RedfishBiosOption1Data =3D STR_BIOS_OPTION_1_ITEM_1; + StrCpyS (HiiToRedfishBiosVar.RedfishBiosOption2Data, ID_STRING_MAX_WITH_= TERMINATOR, L"Default"); + HiiToRedfishBiosVar.RedfishBiosOption3Data =3D 5; + HiiToRedfishBiosVar.RedfishBiosOption4Data =3D TRUE; + + Status =3D gRT->SetVariable ( + HiiToRedfishEfiVar, + &gHiiToRedfishBiosFormsetGuid, + VARIABLE_ATTRIBUTE_NV_BS, + BufferSize, + &HiiToRedfishBiosVar + ); + + return Status; +} + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param[in] Request A null-terminated Unicode string in + format. + @param[out] Progress On return, points to a character in the R= equest + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param[out] Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +HiiToRedfishBiosExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + if ((Progress =3D=3D NULL) || (Results =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + if (Request =3D=3D NULL) { + return EFI_UNSUPPORTED; + } + + // + // Check whether request for EFI Varstore. EFI varstore get data + // through hii database, not support in this path. + // + if (HiiIsConfigHdrMatch (Request, &gHiiToRedfishBiosFormsetGuid, L"HiiTo= RedfishBiosEfiVar")) { + return EFI_UNSUPPORTED; + } + + return EFI_NOT_FOUND; +} + +/** + This function processes the results of changes in configuration. + + @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param[in] Configuration A null-terminated Unicode string in + format. + @param[out] Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +HiiToRedfishBiosRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + DEBUG ((DEBUG_INFO, "%a, unsupported\n", __func__)); + + return EFI_UNSUPPORTED; +} + +/** + This function processes the results of changes in configuration. + + @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param[in] Action Specifies the type of action taken by the= browser. + @param[in] QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param[in] Type The type of value for the question. + @param[in] Value A pointer to the data being sent to the o= riginal + exporting driver. + @param[out] ActionRequest On return, points to the action requested= by the + callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold t= he + variable and its data. + @retval EFI_DEVICE_ERROR The variable could not be saved. + @retval EFI_UNSUPPORTED The specified Action is not supported by = the + callback. + +**/ +EFI_STATUS +EFIAPI +HiiToRedfishBiosDriverCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + DEBUG ((DEBUG_INFO, "%a, action: 0x%x QID: 0x%x\n", __func__, Action, Qu= estionId)); + + return EFI_UNSUPPORTED; +} + +EFI_HII_CONFIG_ACCESS_PROTOCOL mHiiToRedfishConfigAccess =3D { + HiiToRedfishBiosExtractConfig, + HiiToRedfishBiosRouteConfig, + HiiToRedfishBiosDriverCallback +}; + +/** + Main entry for this driver. + + @param[in] ImageHandle Image handle this driver. + @param[in] SystemTable Pointer to SystemTable. + + @retval EFI_SUCCESS This function always complete successfully. + +**/ +EFI_STATUS +EFIAPI +HiiToRedfishBiosDxeDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + DriverHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &DriverHandle, + &gEfiDevicePathProtocolGuid, + &mHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mHiiToRedfishConfigAccess, + NULL + ); + + // + // Publish our HII data + // + mHiiHandle =3D HiiAddPackages ( + &mHiiToRedfishBiosGuid, + DriverHandle, + HiiToRedfishBiosDxeStrings, + HiiToRedfishBiosVfrBin, + NULL + ); + if (mHiiHandle =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Status =3D InitialHiiVariable (); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, failed to initial variable: %r\n", __func__,= Status)); + } + + return EFI_SUCCESS; +} + +/** + Unloads the application and its installed protocol. + + @param[in] ImageHandle Handle that identifies the image to be unl= oaded. + + @retval EFI_SUCCESS The image has been unloaded. +**/ +EFI_STATUS +EFIAPI +HiiToRedfishBiosDxeDriverUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + if (mHiiHandle !=3D NULL) { + HiiRemovePackages (mHiiHandle); + } + + return EFI_SUCCESS; +} diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxeMap.un= i b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxeMap.uni new file mode 100644 index 00000000..a41c65fe --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxeMap.uni @@ -0,0 +1,21 @@ +/** @file + HII-to-Redfish BIOS example driver. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# +#langdef x-uefi-redfish-Bios.v1_0_9 "Bios.v1_0_9" + +#string STR_BIOS_OPTION_1_PROMPT #language x-uefi-redfish-Bios.v1_0= _9 "/Bios/Attributes/BiosOption1" +#string STR_BIOS_OPTION_2_PROMPT #language x-uefi-redfish-Bios.v1_0= _9 "/Bios/Attributes/BiosOption2" +#string STR_BIOS_OPTION_3_PROMPT #language x-uefi-redfish-Bios.v1_0= _9 "/Bios/Attributes/BiosOption3" +#string STR_BIOS_OPTION_4_PROMPT #language x-uefi-redfish-Bios.v1_0= _9 "/Bios/Attributes/BiosOption4" + +#string STR_BIOS_OPTION_1_ITEM_1 #language x-uefi-redfish-Bios.v1_0= _9 "Item #1" +#string STR_BIOS_OPTION_1_ITEM_2 #language x-uefi-redfish-Bios.v1_0= _9 "Item #2" +#string STR_BIOS_OPTION_1_ITEM_3 #language x-uefi-redfish-Bios.v1_0= _9 "Item #3" diff --git a/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxeString= s.uni b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxeStrings.uni new file mode 100644 index 00000000..539abd07 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxeStrings.uni @@ -0,0 +1,31 @@ +#string /** @file + HII-to-Redfish BIOS example driver. + + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# +#langdef en-US "English" + +#string STR_FORM_SET_TITLE #language en-US "HII to = Redfish (BIOS)" +#string STR_FORM_SET_TITLE_HELP #language en-US "HII to = Redfish (BIOS)" +#string STR_FORM_TITLE #language en-US "HII to = Redfish BIOS properties" + +#string STR_BIOS_OPTION_1_PROMPT #language en-US "HII Red= fish BIOS Option 1" +#string STR_BIOS_OPTION_2_PROMPT #language en-US "HII Red= fish BIOS Option 2" +#string STR_BIOS_OPTION_3_PROMPT #language en-US "HII Red= fish BIOS Option 3" +#string STR_BIOS_OPTION_4_PROMPT #language en-US "HII Red= fish BIOS Option 4" + +#string STR_BIOS_OPTION_1_HELP #language en-US "HII Red= fish BIOS Option 1" +#string STR_BIOS_OPTION_2_HELP #language en-US "HII Red= fish BIOS Option 2" +#string STR_BIOS_OPTION_3_HELP #language en-US "HII Red= fish BIOS Option 3" +#string STR_BIOS_OPTION_4_HELP #language en-US "HII Red= fish BIOS Option 4" + +#string STR_BIOS_OPTION_1_ITEM_1 #language en-US "Item #1= " +#string STR_BIOS_OPTION_1_ITEM_2 #language en-US "Item #2= " +#string STR_BIOS_OPTION_1_ITEM_3 #language en-US "Item #3= " + diff --git a/RedfishClientPkg/RedfishClient.fdf.inc b/RedfishClientPkg/Redf= ishClient.fdf.inc index 5708f786..afa6555a 100644 --- a/RedfishClientPkg/RedfishClient.fdf.inc +++ b/RedfishClientPkg/RedfishClient.fdf.inc @@ -22,6 +22,7 @@ INF RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf INF RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf INF RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf + INF RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf =20 !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc # --=20 2.17.1