From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.67]) by mx.groups.io with SMTP id smtpd.web11.13399.1686663521761469268 for ; Tue, 13 Jun 2023 06:38:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=AV//vZ9G; 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.95.67, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jWLMokzF0tgvg7i6AETo9VxoU5dYP4Y5+SWu/VUS88yUlpy2iP90HcZsKyCFu6r2fml/Q6zRptph4fwGMyjYUfA2AjxGNNemsvmuICV/rKaYhcTNh5GDOYxMwt3/aeplOtXFTy2DukIU67XwehfC6tOlIyT3X+9onzrhwElhp5YMiryj07UciEhdokjQ8e+AHkS/0saJ/pcsIMhR3FIlf1h1msDSICLgaHBc2qFzITrLOAWFAbJNOM4Pt9a4eB4fMjP3xnGxd43nxihiUAIK1IkQIlQgrxHvmZLv8yVt+Rs7jtgXrBXFai/MtVIYjcRs/FNC5sioJNMcZM/qTW0u3w== 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=RAE/V5qJMmFC5qVcC6Y+lhoHPPaJzB9fyBJxsThygbE=; b=TmtwlOzr1GRPUZJ5mOsc80wxi9zbmLmEG/zYmpfeclgTbSTv67pBJ+UP5mXh8tKqhUJ8pYQUYx91Eyun2MVhGcSUTTKmnAp4n938vAG+cslGQ5BEc5U1P52zrKnB1o76K4h4OeAMAVgpfQmLNwdMw/Ial0vTRHXsMGFdzIyHQzNsbt/J6RakZm/ugtcK0Z/YDg6o+VT3tOiIthdNpvILLtl+0FsKccE3IVPTHLWDoneZmTw5d5X5izAEuWKpQ2Z4O5Pqn5FV0OYgzX0bi+82bnODE62T+O9vS5N16FXPgJGxE79SU2c+42b+YDp6EhDAtuFMVOf3p1HVh/XFitZVYw== 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=RAE/V5qJMmFC5qVcC6Y+lhoHPPaJzB9fyBJxsThygbE=; b=AV//vZ9GIqsXLN/O6FByDTVPrxfg20qPa8pe2bo1U77Xo36DnxMXWNa/11AhS7cZtgzfm/MfTWTufsydO3E5PwZqowwbCogDfEkaxkCkD7MaEgdCkchlqu6d4YgTqMpzoeYAz+LqYHUvXYhBqkBz7BgPL1T+f+PqbvlDwi5M3exP3/RbT81DaTgwPKt8a+BmSb2V+kXLUTeM84lprMGaLdM2/UivoWG3vrFAjN3LszywNTctIteb5C/GAJqynK+MpLBxbq/yKvklf/47ZfoYByElNDy3EoeCD5MLxvXFiK6JxEGxoSC3viNN9d7myZ8uHSBbg2GdJx3JQPxbfBQHQg== Received: from BN8PR15CA0014.namprd15.prod.outlook.com (2603:10b6:408:c0::27) by BY5PR12MB4226.namprd12.prod.outlook.com (2603:10b6:a03:203::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Tue, 13 Jun 2023 13:38:37 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:c0:cafe::7f) by BN8PR15CA0014.outlook.office365.com (2603:10b6:408:c0::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.35 via Frontend Transport; Tue, 13 Jun 2023 13:38:36 +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 BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) 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:36 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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:22 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) 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:22 -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:21 -0700 From: "Nickle Wang" To: CC: Abner Chang , Igor Kulchytskyy Subject: [edk2-redfish-client][PATCH v2 2/3] RedfishClientPkg: Introduce HiiToRedfishBootDxe driver Date: Tue, 13 Jun 2023 21:38:20 +0800 Message-ID: <20230613133820.23579-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: BN8NAM11FT024:EE_|BY5PR12MB4226:EE_ X-MS-Office365-Filtering-Correlation-Id: e2b6bec9-d56e-455b-ea8d-08db6c137d55 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x6Mssx4AS5DBCitTXroqrDFFcn9Epru/sHnQ6p8ZpDxhH086kL95S3KXGws+pFYYHBE4Tu9ONQrptgRInMfG79mRaf6te49CClR3pGLo6xfKE3izUGhfLwI49ewM/kNYcAq9lH9zvubTxtDO6EhaCtJ7EMbdISPPBRf95odh+YNW7+SbySIw1nglP3f3VcIsIMZD1TCG3N0LLg9YzSM3NC47PP8Ydi9Zo8WbbzTKR2UKgKcoS35rqqkBTVzEhr0HLKxo6zpvcC9fpJAtwgqsXgUs+KyUdKxswWenTrjMQJc1bxjFy8JTnwcC9GZIZOQunIp9OAyMqzT2Iq0lAXekh6IxaKxrsCAyR7VeG5sh9NGBijOdmmblvrBDry0CQfxMhLH3qmy/LEaqI9LStCwas9bVTdQ5EJhW+u/R+MOEdFsuf/KsWRdpOvhII8JGrtMXTuNGVE/BHDQ9IuvYW/p4S+IwhR6OM1sB2P05WNp9ziGoa71u5U1rLJM4znQ5GaudqK23LSvZUBE/sbozRQ0Ms6S5Kzp3fb7i0+0Gbyj3iGSQdjsWsaFWtvO+1d08DOJXZoqPaJBiPZ5ht9ZIoQVcWq5LpeFAszaoGEVeJs7ERDmD5zVNxqLOGmODIdouVxstfkIaS0fsi9V6amgKoqU2g/XD2HGIfKyE/zglkMjLRFKZZixWt711ACPAUDzfQB4yHDq85ZRPQJD2T8Bnxm6N/rxtbk4UihrY318ar5wwHVwRyB3EeC58lG/UpNC/xwNeYlo/oaFXUDq6xBDS22x2DQ== 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)(136003)(39860400002)(376002)(396003)(451199021)(46966006)(36840700001)(40470700004)(54906003)(5660300002)(8936002)(6916009)(4326008)(8676002)(41300700001)(316002)(30864003)(19627235002)(186003)(2906002)(478600001)(70206006)(70586007)(40480700001)(7696005)(40460700003)(26005)(1076003)(82740400003)(7636003)(36860700001)(356005)(83380400001)(426003)(336012)(47076005)(36756003)(66574015)(82310400005)(86362001)(2616005)(579004)(44824005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 13:38:36.4143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2b6bec9-d56e-455b-ea8d-08db6c137d55 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: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4226 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add HiiToRedfishBootDxe 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 + RedfishClientPkg/RedfishClientPkg.dsc | 9 + .../HiiToRedfishBootDxe.inf | 60 ++ .../HiiToRedfishBootData.h | 61 ++ .../HiiToRedfishBootDxe/HiiToRedfishBootDxe.h | 54 ++ .../HiiToRedfishBootVfr.vfr | 84 +++ .../HiiToRedfishBootDxe/HiiToRedfishBootDxe.c | 698 ++++++++++++++++++ .../HiiToRedfishBootDxeMap.uni | 29 + .../HiiToRedfishBootDxeStrings.uni | 42 ++ RedfishClientPkg/RedfishClient.fdf.inc | 1 + 11 files changed, 1040 insertions(+) create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDx= e.inf create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDa= ta.h create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDx= e.h create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootVf= r.vfr create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDx= e.c create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDx= eMap.uni create mode 100644 RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDx= eStrings.uni diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/Redfi= shClientPkg.dec index 1ef32120..3a323bbb 100644 --- a/RedfishClientPkg/RedfishClientPkg.dec +++ b/RedfishClientPkg/RedfishClientPkg.dec @@ -58,6 +58,7 @@ gEfiRedfishClientVariableGuid =3D { 0x91c46a3d, 0xed1a= , 0x477b, { 0xa5, 0x33, 0x87, 0x2d, 0xcd, 0xb0, 0xfc, 0xc1 } } =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 }} =20 [PcdsFixedAtBuild] gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT= 32|0x10000001 diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClie= ntPkg/RedfishClientComponents.dsc.inc index f973e7e8..b53c4a75 100644 --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc @@ -18,6 +18,7 @@ RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf + RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf !endif # # Below two modules should be pulled in by build tool. diff --git a/RedfishClientPkg/RedfishClientPkg.dsc b/RedfishClientPkg/Redfi= shClientPkg.dsc index ac9f8e9d..edc387ac 100644 --- a/RedfishClientPkg/RedfishClientPkg.dsc +++ b/RedfishClientPkg/RedfishClientPkg.dsc @@ -39,6 +39,15 @@ BaseSortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf =20 [LibraryClasses.ARM, LibraryClasses.AARCH64] # diff --git a/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf b= /RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf new file mode 100644 index 00000000..11b3b473 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf @@ -0,0 +1,60 @@ +## @file +# HII-to-Redfish boot 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 HiiToRedfishBootDxe + FILE_GUID =3D F9BA69BD-1EDB-4334-9D57-7E974ADF1361 + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D HiiToRedfishBootDxeDriverEntryPoint + UNLOAD_IMAGE =3D HiiToRedfishBootDxeDriverUnload + +[Sources] + HiiToRedfishBootDxe.c + HiiToRedfishBootDxe.h + HiiToRedfishBootData.h + HiiToRedfishBootVfr.vfr + HiiToRedfishBootDxeStrings.uni + HiiToRedfishBootDxeMap.uni + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishClientPkg/RedfishClientPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + BaseLib + BaseMemoryLib + DebugLib + PcdLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiLib + PrintLib + HiiLib + UefiBootManagerLib + UefiHiiServicesLib + RedfishEventLib + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiHiiConfigAccessProtocolGuid + + +[Guids] + gHiiToRedfishBootFormsetGuid + gEfiIfrTianoGuid + +[Depex] + gEfiHiiDatabaseProtocolGuid + diff --git a/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootData.h b/= RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootData.h new file mode 100644 index 00000000..24f0cd6a --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootData.h @@ -0,0 +1,61 @@ +/** @file + The header file of HII-to-Redfish boot 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_BOOT_DATA_H_ +#define HII_TO_REDFISH_BOOT_DATA_H_ + +#include +#include + +#define HII_TO_REDFISH_BOOT_FORMSET_GUID \ + { \ + 0x8399a787, 0x108e, 0x4e53, { 0x9e, 0xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab= , 0x3b } \ + } + +extern EFI_GUID gHiiToRedfishBootFormsetGuid; + +#define FORM_ID 0x001 +#define QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED 0x100 +#define QUESTION_ID_BOOT_SOURCE_OVERRIDE_MODE 0x101 +#define QUESTION_ID_BOOT_SOURCE_OVERRIDE_TARGET 0x102 +#define LABEL_BOOT_OPTION 0x200 +#define LABEL_BOOT_OPTION_END 0x201 +#define BOOT_ORDER_LIST 0x300 +#define MAX_BOOT_OPTIONS 100 +#define BOOT_OPTION_VAR_STORE_ID 0x800 +// +// VarOffset that will be used to create question +// all these values are computed from the structure +// defined below +// +#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((HII_TO_REDFISH_BOOT_OPTI= ON_VARSTORE_DATA *) 0)->Field))) + +#pragma pack(1) + +// +// Definiton of HII_TO_REDFISH_BOOT_EFI_VARSTORE_DATA +// +typedef struct { + UINT8 BootSourceOverrideEnabled; + UINT8 BootSourceOverrideMode; + UINT8 BootSourceOverrideTarget; + UINT8 Reversed; +} HII_TO_REDFISH_BOOT_EFI_VARSTORE_DATA; + +// +// Definiton of HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA +// +typedef struct { + UINT32 BootOptionOrder[MAX_BOOT_OPTIONS]; +} HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA; + +#pragma pack() + +#endif diff --git a/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.h b/R= edfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.h new file mode 100644 index 00000000..40a41d01 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.h @@ -0,0 +1,54 @@ +/** @file + HII-to-Redfish boot 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_BOOT_DXE_H_ +#define HII_TO_REDFISH_BOOT_DXE_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "HiiToRedfishBootData.h" + +extern UINT8 HiiToRedfishBootVfrBin[]; + +#define COMPUTER_SYSTEM_SCHEMA_VERSION "x-uefi-redfish-ComputerSystem.v1_= 5_0" +#define COMPUTER_SYSTEM_BOOT_BOOTORDER L"/Systems/{1}/Boot/BootOrder" + +#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/HiiToRedfishBootDxe/HiiToRedfishBootVfr.vfr b= /RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootVfr.vfr new file mode 100644 index 00000000..81a13626 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootVfr.vfr @@ -0,0 +1,84 @@ +/** @file + HII-to-Redfish boot 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 "HiiToRedfishBootData.h" + +formset + guid =3D HII_TO_REDFISH_BOOT_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_BOOT_EFI_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLAT= ILE, // EFI variable attribures + name =3D HiiToRedfishBootEfiVar, + guid =3D HII_TO_REDFISH_BOOT_FORMSET_GUID; + + // + // Define a variable Storage for boot order + // + varstore HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA, + varid =3D BOOT_OPTION_VAR_STORE_ID, + name =3D HiiToRedfishBootOptionVar, + guid =3D HII_TO_REDFISH_BOOT_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 HiiToRedfishBootEfiVar.BootSourceOverrideEnabled, + questionid =3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED, + prompt =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_ENABLED), + help =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_ENABLED_HELP), + flags =3D INTERACTIVE | NUMERIC_SIZE_1, + option text =3D STRING_TOKEN(STR_DISABLED), value =3D ST= R_DISABLED, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ONCE), value =3D ST= R_ONCE, flags =3D 0; + option text =3D STRING_TOKEN(STR_CONTINUOUS), value =3D ST= R_CONTINUOUS, flags =3D 0; + endoneof; + + oneof varid =3D HiiToRedfishBootEfiVar.BootSourceOverrideMode, + questionid =3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_MODE, + prompt =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_MODE), + help =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_MODE_HELP), + flags =3D INTERACTIVE | NUMERIC_SIZE_1, + option text =3D STRING_TOKEN(STR_UEFI), value =3D ST= R_UEFI, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_LEGACY), value =3D ST= R_LEGACY, flags =3D 0; + endoneof; + + oneof varid =3D HiiToRedfishBootEfiVar.BootSourceOverrideTarget, + questionid =3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_TARGET, + prompt =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_TARGET), + help =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_TARGET_HELP), + flags =3D INTERACTIVE | NUMERIC_SIZE_1, + option text =3D STRING_TOKEN(STR_TARGET_NONE), value = =3D STR_TARGET_NONE, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_TARGET_PXE), value = =3D STR_TARGET_PXE, flags =3D 0; + option text =3D STRING_TOKEN(STR_TARGET_USB), value = =3D STR_TARGET_USB, flags =3D 0; + option text =3D STRING_TOKEN(STR_TARGET_HDD), value = =3D STR_TARGET_HDD, flags =3D 0; + option text =3D STRING_TOKEN(STR_TARGET_BIOS_SETUP), value = =3D STR_TARGET_BIOS_SETUP, flags =3D 0; + option text =3D STRING_TOKEN(STR_TARGET_UEFI), value = =3D STR_TARGET_UEFI, flags =3D 0; + option text =3D STRING_TOKEN(STR_TARGET_UEFI_HTTP), value = =3D STR_TARGET_UEFI_HTTP, flags =3D 0; + endoneof; + + subtitle text =3D STRING_TOKEN(STR_BOOT_ORDER); + + // + // This is where we will dynamically add choices for the Boot Manager + // + label LABEL_BOOT_OPTION; + label LABEL_BOOT_OPTION_END; + + endform; +endformset; diff --git a/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.c b/R= edfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.c new file mode 100644 index 00000000..6d318640 --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.c @@ -0,0 +1,698 @@ +/** @file + HII-to-Redfish boot 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 "HiiToRedfishBootDxe.h" + +EFI_GUID mHiiToRedfishBootGuid =3D HII_TO_= REDFISH_BOOT_FORMSET_GUID; +EFI_HII_HANDLE mHiiHandle; +EFI_HANDLE mDriverHandle; +EFI_EVENT mEvent =3D NULL; +CHAR16 mHiiToRedfishEfiVar[] =3D L"HiiTo= RedfishBootEfiVar"; +HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA mBootOptionsVarData; + +/// +/// 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_BOOT_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +/** + This function add 'x-uefi-' configuration language to given string ID. + + @param[in] HiiHandle HII handle + @param[in] StringId String token ID + @param[in] ConfigLang Configure language of question + + @retval EFI_STATUS + +**/ +EFI_STATUS +UpdateConfigLanguageToQuestion ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId, + IN EFI_STRING ConfigLang + ) +{ + CHAR16 ConfigLanguage[32]; + + if ((HiiHandle =3D=3D NULL) || (StringId =3D=3D 0) || (ConfigLang =3D=3D= NULL)) { + return EFI_INVALID_LANGUAGE; + } + + UnicodeSPrint (ConfigLanguage, sizeof (ConfigLanguage), ConfigLang); + + DEBUG ((DEBUG_INFO, "%a, add config-language for string(%d): %s\n", __fu= nc__, StringId, ConfigLanguage)); + + HiiSetString ( + HiiHandle, + StringId, + ConfigLanguage, + COMPUTER_SYSTEM_SCHEMA_VERSION + ); + + return EFI_SUCCESS; +} + +/** + This function add 'x-uefi-' configuration language to given string ID. + + @param[in] HiiHandle HII handle + @param[in] StringId String token ID + @param[in] Index The index of boot option + @param[in] BootOption Boot option context + + @retval EFI_STATUS + +**/ +EFI_STATUS +UpdateConfigLanguageToValues ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId, + IN UINTN Index, + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ) +{ + CHAR16 ConfigLanguage[10]; + + if ((HiiHandle =3D=3D NULL) || (StringId =3D=3D 0) || (BootOption =3D=3D= NULL)) { + return EFI_INVALID_LANGUAGE; + } + + UnicodeSPrint (ConfigLanguage, sizeof (ConfigLanguage), L"Boot%04x", Boo= tOption->OptionNumber); + + DEBUG ((DEBUG_INFO, "%a, add config-language for string(%d): %s\n", __fu= nc__, StringId, ConfigLanguage)); + + HiiSetString ( + HiiHandle, + StringId, + ConfigLanguage, + COMPUTER_SYSTEM_SCHEMA_VERSION + ); + + return EFI_SUCCESS; +} + +/** + This function creates boot order with ordered-list op-codes in runtime. + + @retval EFI_STATUS + +**/ +EFI_STATUS +RefreshBootOrderList ( + VOID + ) +{ + UINTN Index; + EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; + UINTN BootOptionCount; + EFI_STRING_ID Token; + VOID *StartOpCodeHandle; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_IFR_GUID_LABEL *EndLabel; + BOOLEAN IsLegacyOption; + VOID *OptionsOpCodeHandle; + UINTN OptionIndex; + + // + // for better user experience + // 1. User changes HD configuration (e.g.: unplug HDD), here we have a c= hance to remove the HDD boot option + // 2. User enables/disables UEFI PXE, here we have a chance to add/remov= e EFI Network boot option + // + EfiBootManagerRefreshAllBootOption (); + + BootOption =3D EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptio= nTypeBoot); + + if (BootOptionCount =3D=3D 0) { + return EFI_NOT_FOUND; + } + + // + // Initial var store + // + ZeroMem (&mBootOptionsVarData, sizeof (HII_TO_REDFISH_BOOT_OPTION_VARSTO= RE_DATA)); + + // + // Allocate space for creation of UpdateData Buffer + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (= StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_BOOT_OPTION; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (En= dOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_BOOT_OPTION_END; + + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + for (Index =3D 0, OptionIndex =3D 0; Index < BootOptionCount; Index++) { + // + // Don't display hidden boot options, but retain inactive ones. + // + if ((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) !=3D 0) { + continue; + } + + // + // Group the legacy boot option in the sub title created dynamically + // + IsLegacyOption =3D (BOOLEAN)( + (DevicePathType (BootOption[Index].FilePath= ) =3D=3D BBS_DEVICE_PATH) && + (DevicePathSubType (BootOption[Index].FileP= ath) =3D=3D BBS_BBS_DP) + ); + + // + // Don't display legacy boot options + // + if (IsLegacyOption) { + continue; + } + + mBootOptionsVarData.BootOptionOrder[OptionIndex++] =3D (UINT32)BootOpt= ion[Index].OptionNumber; + + ASSERT (BootOption[Index].Description !=3D NULL); + + Token =3D HiiSetString (mHiiHandle, 0, BootOption[Index].Description, = NULL); + + // + // Add boot option + // + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + Token, + 0, + EFI_IFR_TYPE_NUM_SIZE_32, + BootOption[Index].OptionNumber + ); + + // + // Add x-uefi configure language for boot options. + // + UpdateConfigLanguageToValues (mHiiHandle, Token, OptionIndex, &BootOpt= ion[Index]); + } + + // + // Create ordered list op-code + // + HiiCreateOrderedListOpCode ( + StartOpCodeHandle, // Container for dynamic cre= ated opcodes + BOOT_ORDER_LIST, // Question ID + BOOT_OPTION_VAR_STORE_ID, // VarStore ID + (UINT16)VAR_OFFSET (BootOptionOrder), // Offset in Buffer Storage + STRING_TOKEN (STR_BOOT_ORDER_LIST), // Question prompt text + STRING_TOKEN (STR_BOOT_ORDER_LIST_HELP), // Question help text + 0, // Question flag + EFI_IFR_UNIQUE_SET, // Ordered list flag, e.g. E= FI_IFR_UNIQUE_SET + EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question val= ue + MAX_BOOT_OPTIONS, // Maximum container + OptionsOpCodeHandle, // Option Opcode list + NULL // Default Opcode is NULL + ); + + // + // Add x-uefi configure language for boot order. + // + UpdateConfigLanguageToQuestion (mHiiHandle, STRING_TOKEN (STR_BOOT_ORDER= _LIST), COMPUTER_SYSTEM_BOOT_BOOTORDER); + + // + // Update HII form + // + HiiUpdateForm ( + mHiiHandle, + &mHiiToRedfishBootGuid, + FORM_ID, + StartOpCodeHandle, + EndOpCodeHandle + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + HiiFreeOpCodeHandle (OptionsOpCodeHandle); + + EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount); + + return EFI_SUCCESS; +} + +/** + This function update the "BootOrder" EFI Variable based on + BMM Formset's NV map. It then refresh BootOptionMenu + with the new "BootOrder" list. + + @param[in] BootOptionVar Boot option NV data + + @retval EFI_SUCCESS The function complete successfully. + @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the functi= on. + @return The EFI variable can not be saved. See gRT->SetVariable for deta= il return information. + +**/ +EFI_STATUS +UpdateBootorderList ( + IN HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA *BootOptionVar + ) +{ + EFI_STATUS Status; + UINT16 Index; + UINT16 OrderIndex; + UINT16 *BootOrder; + UINTN BootOrderSize; + UINT16 OptionNumber; + + if (BootOptionVar =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // First check whether BootOrder is present in current configuration + // + GetEfiGlobalVariable2 (L"BootOrder", (VOID **)&BootOrder, &BootOrderSize= ); + if (BootOrder =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // OptionOrder is subset of BootOrder + // + for (OrderIndex =3D 0; (OrderIndex < MAX_BOOT_OPTIONS) && (BootOptionVar= ->BootOptionOrder[OrderIndex] !=3D 0); OrderIndex++) { + for (Index =3D OrderIndex; Index < BootOrderSize / sizeof (UINT16); In= dex++) { + if ((BootOrder[Index] =3D=3D (UINT16)BootOptionVar->BootOptionOrder[= OrderIndex]) && (OrderIndex !=3D Index)) { + OptionNumber =3D BootOrder[Index]; + CopyMem (&BootOrder[OrderIndex + 1], &BootOrder[OrderIndex], (Inde= x - OrderIndex) * sizeof (UINT16)); + BootOrder[OrderIndex] =3D OptionNumber; + } + } + } + + Status =3D gRT->SetVariable ( + L"BootOrder", + &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_A= CCESS | EFI_VARIABLE_NON_VOLATILE, + BootOrderSize, + BootOrder + ); + FreePool (BootOrder); + + return Status; +} + +/** + 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_BOOT_EFI_VARSTORE_DATA HiiToRedfishBootVar; + + // + // Get Buffer Storage data from EFI variable. + // Try to get the current setting from variable. + // + BufferSize =3D sizeof (HII_TO_REDFISH_BOOT_EFI_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + mHiiToRedfishEfiVar, + &gHiiToRedfishBootFormsetGuid, + NULL, + &BufferSize, + &HiiToRedfishBootVar + ); + if (!EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + // + // Initialization + // + HiiToRedfishBootVar.BootSourceOverrideEnabled =3D STR_DISABLED; + HiiToRedfishBootVar.BootSourceOverrideMode =3D STR_UEFI; + HiiToRedfishBootVar.BootSourceOverrideTarget =3D STR_TARGET_NONE; + HiiToRedfishBootVar.Reversed =3D 0x00; + + Status =3D gRT->SetVariable ( + mHiiToRedfishEfiVar, + &gHiiToRedfishBootFormsetGuid, + VARIABLE_ATTRIBUTE_NV_BS, + BufferSize, + &HiiToRedfishBootVar + ); + + // + // Initial var store + // + ZeroMem (&mBootOptionsVarData, sizeof (HII_TO_REDFISH_BOOT_OPTION_VARSTO= RE_DATA)); + + 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 +HiiToRedfishBootExtractConfig ( + 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; + } + + *Progress =3D Request; + + 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, &gHiiToRedfishBootFormsetGuid, L"HiiTo= RedfishBootEfiVar")) { + return EFI_UNSUPPORTED; + } + + // + // Handle boot order list + // + if (HiiIsConfigHdrMatch (Request, &gHiiToRedfishBootFormsetGuid, L"HiiTo= RedfishBootOptionVar")) { + gHiiConfigRouting->BlockToConfig ( + gHiiConfigRouting, + Request, + (UINT8 *)&mBootOptionsVarData, + sizeof (HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA)= , + Results, + Progress + ); + + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return EFI_SUCCESS; + } + + 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 +HiiToRedfishBootRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA BootOptionsVar; + + *Progress =3D Configuration; + + // + // Check whether request for EFI Varstore. EFI varstore get data + // through hii database, not support in this path. + // + if (HiiIsConfigHdrMatch (Configuration, &gHiiToRedfishBootFormsetGuid, L= "HiiToRedfishBootEfiVar")) { + return EFI_UNSUPPORTED; + } + + // + // Handle boot order list + // + if (HiiIsConfigHdrMatch (Configuration, &gHiiToRedfishBootFormsetGuid, L= "HiiToRedfishBootOptionVar")) { + BufferSize =3D sizeof (HII_TO_REDFISH_BOOT_OPTION_VARSTORE_DATA); + ZeroMem (&BootOptionsVar, sizeof (HII_TO_REDFISH_BOOT_OPTION_VARSTORE_= DATA)); + Status =3D gHiiConfigRouting->ConfigToBlock ( + gHiiConfigRouting, + Configuration, + (UINT8 *)&BootOptionsVar, + &BufferSize, + Progress + ); + + if (CompareMem (BootOptionsVar.BootOptionOrder, mBootOptionsVarData.Bo= otOptionOrder, (sizeof (UINT32) * MAX_BOOT_OPTIONS))) { + Status =3D UpdateBootorderList (&BootOptionsVar); + if (!EFI_ERROR (Status)) { + // + // Boot order update successes. Copy it to local copy. + // + CopyMem (mBootOptionsVarData.BootOptionOrder, BootOptionsVar.BootO= ptionOrder, (sizeof (UINT32) * MAX_BOOT_OPTIONS)); + } + } + + return EFI_SUCCESS; + } + + 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] 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 +HiiToRedfishBootDriverCallback ( + 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)); + + if ((QuestionId =3D=3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED) && (Act= ion =3D=3D EFI_BROWSER_ACTION_FORM_OPEN)) { + RefreshBootOrderList (); + + return EFI_SUCCESS; + } + + return EFI_UNSUPPORTED; +} + +EFI_HII_CONFIG_ACCESS_PROTOCOL mHiiToRedfishConfigAccess =3D { + HiiToRedfishBootExtractConfig, + HiiToRedfishBootRouteConfig, + HiiToRedfishBootDriverCallback +}; + +/** + Callback function executed when the ready-to-provisioning event group is= signaled. + + @param[in] Event Event whose notification function is being invoked= . + @param[out] Context Pointer to the Context buffer + +**/ +VOID +EFIAPI +HiiToRedfishBootReadyToProvisioning ( + IN EFI_EVENT Event, + OUT VOID *Context + ) +{ + // + // Refresh boot order and create configure language + // + RefreshBootOrderList (); +} + +/** + 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 +HiiToRedfishBootDxeDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + mDriverHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mHiiToRedfishConfigAccess, + NULL + ); + + // + // Publish our HII data + // + mHiiHandle =3D HiiAddPackages ( + &mHiiToRedfishBootGuid, + mDriverHandle, + HiiToRedfishBootDxeStrings, + HiiToRedfishBootVfrBin, + 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)); + } + + // + // Register read-to-provisioning event + // + Status =3D CreateReadyToProvisioningEvent ( + HiiToRedfishBootReadyToProvisioning, + NULL, + &mEvent + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, failed to register ready-to-provisioning eve= nt: %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 +HiiToRedfishBootDxeDriverUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + if (mHiiHandle !=3D NULL) { + HiiRemovePackages (mHiiHandle); + } + + if (mEvent !=3D NULL) { + gBS->CloseEvent (mEvent); + } + + return EFI_SUCCESS; +} diff --git a/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxeMap.un= i b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxeMap.uni new file mode 100644 index 00000000..995fa45b --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxeMap.uni @@ -0,0 +1,29 @@ +/** @file + HII-to-Redfish memory 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-ComputerSystem.v1_5_0 "ComputerSystem.v1_5_0" + +#string STR_BOOT_SOURCE_OVERRIDE_ENABLED #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideEnabled" +#string STR_BOOT_SOURCE_OVERRIDE_MODE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideMode" +#string STR_BOOT_SOURCE_OVERRIDE_TARGET #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideTarget" + +#string STR_DISABLED #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Disabled" +#string STR_ONCE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Once" +#string STR_CONTINUOUS #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Continuous" +#string STR_UEFI #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "UEFI" +#string STR_LEGACY #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Legacy" +#string STR_TARGET_NONE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "None" +#string STR_TARGET_PXE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Pxe" +#string STR_TARGET_USB #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Usb" +#string STR_TARGET_HDD #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Hdd" +#string STR_TARGET_BIOS_SETUP #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "BiosSetup" +#string STR_TARGET_UEFI #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "UefiTarget" +#string STR_TARGET_UEFI_HTTP #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "UefiHttp" diff --git a/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxeString= s.uni b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxeStrings.uni new file mode 100644 index 00000000..9e01d5cb --- /dev/null +++ b/RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxeStrings.uni @@ -0,0 +1,42 @@ +/** @file + HII-to-Redfish memory 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 (Boot)" +#string STR_FORM_SET_TITLE_HELP #language en-US "HII to = Redfish (Boot)" +#string STR_FORM_TITLE #language en-US "HII to = Redfish Boot properties" + +#string STR_BOOT_ORDER #language en-US "Boot Or= der" +#string STR_BOOT_ORDER_LIST #language en-US "Boot Or= der List" +#string STR_BOOT_ORDER_LIST_HELP #language en-US "Boot Or= der List" + +#string STR_BOOT_SOURCE_OVERRIDE_ENABLED #language en-US "Boot Sou= rce Override Enabled" +#string STR_BOOT_SOURCE_OVERRIDE_ENABLED_HELP #language en-US "Describe= s the state of the Boot Source Override feature." + +#string STR_BOOT_SOURCE_OVERRIDE_MODE #language en-US "Boot Sou= rce Override Mode" +#string STR_BOOT_SOURCE_OVERRIDE_MODE_HELP #language en-US "The BIOS= Boot Mode (either Legacy or UEFI) to be used when BootSourceOverrideTarget= boot source is booted from." + +#string STR_BOOT_SOURCE_OVERRIDE_TARGET #language en-US "Boot Sou= rce Override Target" +#string STR_BOOT_SOURCE_OVERRIDE_TARGET_HELP #language en-US "The curr= ent boot source to be used at next boot instead of the normal boot device, = if BootSourceOverrideEnabled is true." + +#string STR_DISABLED #language en-US "Disabled= " +#string STR_ONCE #language en-US "Once" +#string STR_CONTINUOUS #language en-US "Continuo= us" +#string STR_UEFI #language en-US "UEFI" +#string STR_LEGACY #language en-US "Legacy" +#string STR_TARGET_NONE #language en-US "None" +#string STR_TARGET_PXE #language en-US "Pxe" +#string STR_TARGET_USB #language en-US "Usb" +#string STR_TARGET_HDD #language en-US "Hdd" +#string STR_TARGET_BIOS_SETUP #language en-US "Bios Set= up Menu" +#string STR_TARGET_UEFI #language en-US "Uefi Tar= get" +#string STR_TARGET_UEFI_HTTP #language en-US "Uefi Htt= p" diff --git a/RedfishClientPkg/RedfishClient.fdf.inc b/RedfishClientPkg/Redf= ishClient.fdf.inc index 7fe7828a..5708f786 100644 --- a/RedfishClientPkg/RedfishClient.fdf.inc +++ b/RedfishClientPkg/RedfishClient.fdf.inc @@ -21,6 +21,7 @@ INF RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystem= CollectionDxe.inf INF RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf INF RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf + INF RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf =20 !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc # --=20 2.17.1