* [edk2-staging][PATCH 1/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBootDxe driver
@ 2022-07-12 12:19 Nickle Wang
2022-07-12 12:19 ` [edk2-staging][PATCH 2/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBiosDxe driver Nickle Wang
0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang @ 2022-07-12 12:19 UTC (permalink / raw)
To: devel; +Cc: Andrew Fish, Ray Ni, Abner Chang, Yang Atom, Nick Ramirez
Add Hii2RedfishBootDxe 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 <nickle.wang@hpe.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Yang Atom <Atom.Yang@amd.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
EmulatorPkg/EmulatorPkg.dec | 5 +-
EmulatorPkg/EmulatorPkg.dsc | 3 +-
EmulatorPkg/EmulatorPkg.fdf | 3 +-
.../Hii2RedfishBootDxe/Hii2RedfishBootData.h | 60 ++
.../Hii2RedfishBootDxe/Hii2RedfishBootDxe.c | 702 ++++++++++++++++++
.../Hii2RedfishBootDxe/Hii2RedfishBootDxe.h | 53 ++
.../Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf | 60 ++
.../Hii2RedfishBootDxeMap.uni | 28 +
.../Hii2RedfishBootDxeStrings.uni | 41 +
.../Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr | 83 +++
10 files changed, 1034 insertions(+), 4 deletions(-)
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni
create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr
diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
index 9e87b50afc..52a62c09c9 100644
--- a/EmulatorPkg/EmulatorPkg.dec
+++ b/EmulatorPkg/EmulatorPkg.dec
@@ -4,7 +4,7 @@
#
# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-# (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP<BR>
+# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -47,7 +47,8 @@
gEmuVirtualDisksGuid = { 0xf2ba331a, 0x8985, 0x11db, { 0xa4, 0x06, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
gEmuPhysicalDisksGuid = { 0xf2bdcc96, 0x8985, 0x11db, { 0x87, 0x19, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
gEmuRedfishServiceGuid = { 0x3fb208ac, 0x2185, 0x498c, { 0xbf, 0x46, 0xdc, 0x23, 0xda, 0x58, 0x7b, 0x55 } }
- gHii2RedfishMemoryFormsetGuid = { 0XC2BE579E, 0X3C57, 0X499C, { 0XA9, 0XDF, 0XE6, 0X23, 0X8A, 0X49, 0X64, 0XF8 }}
+ gHii2RedfishMemoryFormsetGuid = { 0xC2BE579E, 0x3C57, 0x499C, { 0xA9, 0xDF, 0xE6, 0x23, 0x8A, 0x49, 0x64, 0xF8 }}
+ gHii2RedfishBootFormsetGuid = { 0x8399a787, 0x108e, 0x4e53, { 0x9e, 0xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab, 0x3b }}
[PcdsFeatureFlag]
## If TRUE, if symbols only load on breakpoints and gdb entry
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index e5cb3c3d8d..1d59b4a1dd 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -7,7 +7,7 @@
# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.
-# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -490,6 +490,7 @@
!if $(REDFISH_ENABLE) == TRUE
EmulatorPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf
+ EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
!endif
!include RedfishPkg/Redfish.dsc.inc
!include RedfishClientPkg/RedfishClient.dsc.inc
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 5e770af186..f9ff4320d9 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -3,7 +3,7 @@
#
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2009 - 2011, Apple Inc. All rights reserved.<BR>
-# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -214,6 +214,7 @@ INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
#
!if $(REDFISH_ENABLE) == TRUE
INF EmulatorPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf
+ INF EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
!endif
!include RedfishPkg/Redfish.fdf.inc
!include RedfishClientPkg/RedfishClient.fdf.inc
diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h
new file mode 100644
index 0000000000..0da28a5032
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h
@@ -0,0 +1,60 @@
+/** @file
+ The header file of HII-to-Redfish boot driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef HII_2_REDFISH_BOOT_DATA_H_
+#define HII_2_REDFISH_BOOT_DATA_H_
+
+#include <Uefi/UefiMultiPhase.h>
+#include <Guid/HiiPlatformSetupFormset.h>
+
+#define HII_2_REDFISH_BOOT_FORMSET_GUID \
+ { \
+ 0x8399a787, 0x108e, 0x4e53, { 0x9e, 0xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab, 0x3b } \
+ }
+
+extern EFI_GUID gHii2RedfishBootFormsetGuid;
+
+#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_2_REDFISH_BOOT_OPTION_VARSTORE_DATA *) 0)->Field)))
+
+#pragma pack(1)
+
+//
+// Definiton of HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA
+//
+typedef struct {
+ UINT8 BootSourceOverrideEnabled;
+ UINT8 BootSourceOverrideMode;
+ UINT8 BootSourceOverrideTarget;
+ UINT8 Reversed;
+} HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA;
+
+//
+// Definiton of HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA
+//
+typedef struct {
+ UINT32 BootOptionOrder[MAX_BOOT_OPTIONS];
+} HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA;
+
+#pragma pack()
+
+#endif
diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c
new file mode 100644
index 0000000000..203fd8e1ef
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c
@@ -0,0 +1,702 @@
+/** @file
+ HII-to-Redfish boot driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Hii2RedfishBootDxe.h"
+
+EFI_GUID mHii2RedfishBootGuid = HII_2_REDFISH_BOOT_FORMSET_GUID;
+EFI_HII_HANDLE mHiiHandle;
+EFI_HANDLE mDriverHandle;
+EFI_EVENT mEvent = NULL;
+CHAR16 mHii2RedfishEfiVar[] = L"Hii2RedfishBootEfiVar";
+HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA mBootOptionsVarData;
+
+///
+/// HII specific Vendor Device Path definition.
+///
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ HII_2_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 == NULL || StringId == 0 || ConfigLang == NULL) {
+ return EFI_INVALID_LANGUAGE;
+ }
+
+ UnicodeSPrint (ConfigLanguage, sizeof (ConfigLanguage), ConfigLang);
+
+ DEBUG ((DEBUG_INFO, "%a, add config-language for string(%d): %s\n", __FUNCTION__, StringId, ConfigLanguage));
+
+ HiiSetString (
+ HiiHandle,
+ StringId,
+ ConfigLanguage,
+ COMPUTER_SYSTEM_SECHEMA_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 == NULL || StringId == 0 || BootOption == NULL) {
+ return EFI_INVALID_LANGUAGE;
+ }
+
+ UnicodeSPrint (ConfigLanguage, sizeof (ConfigLanguage), L"Boot%04x", BootOption->OptionNumber);
+
+ DEBUG ((DEBUG_INFO, "%a, add config-language for string(%d): %s\n", __FUNCTION__, StringId, ConfigLanguage));
+
+ HiiSetString (
+ HiiHandle,
+ StringId,
+ ConfigLanguage,
+ COMPUTER_SYSTEM_SECHEMA_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 chance to remove the HDD boot option
+ // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option
+ //
+ EfiBootManagerRefreshAllBootOption ();
+
+ BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
+
+ if (BootOptionCount == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // Initial var store
+ //
+ ZeroMem (&mBootOptionsVarData, sizeof (HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA));
+
+ //
+ // Allocate space for creation of UpdateData Buffer
+ //
+ StartOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (StartOpCodeHandle != NULL);
+
+ EndOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (EndOpCodeHandle != NULL);
+
+ //
+ // Create Hii Extend Label OpCode as the start opcode
+ //
+ StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ StartLabel->Number = LABEL_BOOT_OPTION;
+
+ //
+ // Create Hii Extend Label OpCode as the end opcode
+ //
+ EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ EndLabel->Number = LABEL_BOOT_OPTION_END;
+
+
+ OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (OptionsOpCodeHandle != NULL);
+
+ for (Index = 0, OptionIndex = 0; Index < BootOptionCount; Index++) {
+ //
+ // Don't display hidden boot options, but retain inactive ones.
+ //
+ if ((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) {
+ continue;
+ }
+
+ //
+ // Group the legacy boot option in the sub title created dynamically
+ //
+ IsLegacyOption = (BOOLEAN) (
+ (DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) &&
+ (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP)
+ );
+
+ //
+ // Don't display legacy boot options
+ //
+ if (IsLegacyOption) {
+ continue;
+ }
+
+ mBootOptionsVarData.BootOptionOrder[OptionIndex++] = (UINT32)BootOption[Index].OptionNumber;
+
+ ASSERT (BootOption[Index].Description != NULL);
+
+ Token = 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, &BootOption[Index]);
+ }
+
+ //
+ // Create ordered list op-code
+ //
+ HiiCreateOrderedListOpCode (
+ StartOpCodeHandle, // Container for dynamic created 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. EFI_IFR_UNIQUE_SET
+ EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question value
+ 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,
+ &mHii2RedfishBootGuid,
+ 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 function.
+ @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
+
+**/
+EFI_STATUS
+UpdateBootorderList (
+ IN HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA *BootOptionVar
+ )
+{
+ EFI_STATUS Status;
+ UINT16 Index;
+ UINT16 OrderIndex;
+ UINT16 *BootOrder;
+ UINTN BootOrderSize;
+ UINT16 OptionNumber;
+
+ if (BootOptionVar == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // First check whether BootOrder is present in current configuration
+ //
+ GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize);
+ if (BootOrder == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // OptionOrder is subset of BootOrder
+ //
+ for (OrderIndex = 0; (OrderIndex < MAX_BOOT_OPTIONS) && (BootOptionVar->BootOptionOrder[OrderIndex] != 0); OrderIndex++) {
+ for (Index = OrderIndex; Index < BootOrderSize / sizeof (UINT16); Index++) {
+ if ((BootOrder[Index] == (UINT16)BootOptionVar->BootOptionOrder[OrderIndex]) && (OrderIndex != Index)) {
+ OptionNumber = BootOrder[Index];
+ CopyMem (&BootOrder[OrderIndex + 1], &BootOrder[OrderIndex], (Index - OrderIndex) * sizeof (UINT16));
+ BootOrder[OrderIndex] = OptionNumber;
+ }
+ }
+ }
+
+ Status = gRT->SetVariable (
+ L"BootOrder",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ BootOrderSize,
+ BootOrder
+ );
+ FreePool (BootOrder);
+
+ return Status;
+}
+
+/**
+ Initial HII variable if it does not exist.
+
+ @retval EFI_SUCESS HII variable is initialized.
+
+**/
+EFI_STATUS
+InitialHiiVairable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA Hii2RedfishBootVar;
+
+ //
+ // Get Buffer Storage data from EFI variable.
+ // Try to get the current setting from variable.
+ //
+ BufferSize = sizeof (HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA);
+ Status = gRT->GetVariable (
+ mHii2RedfishEfiVar,
+ &gHii2RedfishBootFormsetGuid,
+ NULL,
+ &BufferSize,
+ &Hii2RedfishBootVar
+ );
+ if (!EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Initialization
+ //
+ Hii2RedfishBootVar.BootSourceOverrideEnabled = STR_DISABLED;
+ Hii2RedfishBootVar.BootSourceOverrideMode = STR_UEFI;
+ Hii2RedfishBootVar.BootSourceOverrideTarget = STR_TARGET_NONE;
+ Hii2RedfishBootVar.Reversed = 0x00;
+
+ Status = gRT->SetVariable (
+ mHii2RedfishEfiVar,
+ &gHii2RedfishBootFormsetGuid,
+ VARIABLE_ATTRIBUTE_NV_BS,
+ BufferSize,
+ &Hii2RedfishBootVar
+ );
+
+ //
+ // Initial var store
+ //
+ ZeroMem (&mBootOptionsVarData, sizeof (HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA));
+
+ return Status;
+}
+
+/**
+ This function allows a caller to extract the current configuration for one
+ or more named elements from the target driver.
+
+ @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param[in] Request A null-terminated Unicode string in
+ <ConfigRequest> format.
+ @param[out] Progress On return, points to a character in the Request
+ string. Points to the string's null terminator if
+ request was successful. Points to the most recent
+ '&' before the first failing name/value pair (or
+ the beginning of the string if the failure is in
+ the first name/value pair) if the request was not
+ successful.
+ @param[out] Results A null-terminated Unicode string in
+ <ConfigAltResp> format which has all values filled
+ in for the names in the Request string. String 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 name.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+Hii2RedfishBootExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ EFI_STATUS Status;
+
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Progress = Request;
+
+ if (Request == 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, &gHii2RedfishBootFormsetGuid, L"Hii2RedfishBootEfiVar")) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Handle boot order list
+ //
+ if (HiiIsConfigHdrMatch(Request, &gHii2RedfishBootFormsetGuid, L"Hii2RedfishBootOptionVar")) {
+ Status = gHiiConfigRouting->BlockToConfig (
+ gHiiConfigRouting,
+ Request,
+ (UINT8 *) &mBootOptionsVarData,
+ sizeof (HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA),
+ Results,
+ Progress
+ );
+
+ //
+ // Set Progress string to the original request string.
+ //
+ if (Request == NULL) {
+ *Progress = NULL;
+ } else if (StrStr (Request, L"OFFSET") == NULL) {
+ *Progress = 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_PROTOCOL.
+ @param[in] Configuration A null-terminated Unicode string in <ConfigResp>
+ format.
+ @param[out] Progress A pointer to a string filled in with the offset of
+ the most recent '&' before the first failing
+ name/value pair (or the beginning of the string if
+ the failure is in the first name/value pair) or
+ the terminating NULL if all was successful.
+
+ @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
+Hii2RedfishBootRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA BootOptionsVar;
+
+ *Progress = Configuration;
+
+ //
+ // Check whether request for EFI Varstore. EFI varstore get data
+ // through hii database, not support in this path.
+ //
+ if (HiiIsConfigHdrMatch(Configuration, &gHii2RedfishBootFormsetGuid, L"Hii2RedfishBootEfiVar")) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Handle boot order list
+ //
+ if (HiiIsConfigHdrMatch(Configuration, &gHii2RedfishBootFormsetGuid, L"Hii2RedfishBootOptionVar")) {
+ BufferSize = sizeof(HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA);
+ ZeroMem (&BootOptionsVar, sizeof(HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA));
+ Status = gHiiConfigRouting->ConfigToBlock (
+ gHiiConfigRouting,
+ Configuration,
+ (UINT8 *)&BootOptionsVar,
+ &BufferSize,
+ Progress
+ );
+
+ if (CompareMem (BootOptionsVar.BootOptionOrder, mBootOptionsVarData.BootOptionOrder, (sizeof (UINT32) * MAX_BOOT_OPTIONS))) {
+ Status = UpdateBootorderList (&BootOptionsVar);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Boot order update successed. Copy it to local copy.
+ //
+ CopyMem (mBootOptionsVarData.BootOptionOrder, BootOptionsVar.BootOptionOrder, (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_PROTOCOL.
+ @param[in] Action Specifies the type of action taken by the browser.
+ @param[in] QuestionId A unique value which is sent to the original
+ 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 original
+ exporting driver.
+ @param[out] ActionRequest On return, points to the action requested by the
+ callback function.
+
+ @retval EFI_SUCCESS The callback successfully handled the action.
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
+ 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
+Hii2RedfishBootDriverCallback (
+ 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", __FUNCTION__, Action, QuestionId));
+
+ if (QuestionId == QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED && Action == EFI_BROWSER_ACTION_FORM_OPEN) {
+ RefreshBootOrderList ();
+
+ return EFI_SUCCESS;
+ }
+
+ return EFI_UNSUPPORTED;
+}
+
+EFI_HII_CONFIG_ACCESS_PROTOCOL mHii2RedfishConfigAccess = {
+ Hii2RedfishBootExtractConfig,
+ Hii2RedfishBootRouteConfig,
+ Hii2RedfishBootDriverCallback
+};
+
+/**
+ 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
+Hii2RedfishBootReadyToProvisioning (
+ 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_SUCESS This function always complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+Hii2RedfishBootDxeDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ mDriverHandle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mHii2RedfishConfigAccess,
+ NULL
+ );
+
+ //
+ // Publish our HII data
+ //
+ mHiiHandle = HiiAddPackages (
+ &mHii2RedfishBootGuid,
+ mDriverHandle,
+ Hii2RedfishBootDxeStrings,
+ Hii2RedfishBootVfrBin,
+ NULL
+ );
+ if (mHiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = InitialHiiVairable ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to initial variable: %r\n", __FUNCTION__, Status));
+ }
+
+ //
+ // Register read-to-provisioning event
+ //
+ Status = CreateReadyToProvisioningEvent (
+ Hii2RedfishBootReadyToProvisioning,
+ NULL,
+ &mEvent
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to register ready-to-provisioning event: %r\n", __FUNCTION__, Status));
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+Hii2RedfishBootDxeDriverUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ if (mHiiHandle != NULL) {
+ HiiRemovePackages (mHiiHandle);
+ }
+
+ if (mEvent != NULL) {
+ gBS->CloseEvent (mEvent);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h
new file mode 100644
index 0000000000..58e6d33f0f
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h
@@ -0,0 +1,53 @@
+/** @file
+ HII-to-Redfish memory driver header file.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef HII_2_REDFISH_BOOT_DXE_H_
+#define HII_2_REDFISH_BOOT_DXE_H_
+
+#include <Uefi.h>
+
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/PrintLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/UefiBootManagerLib.h>
+#include <Library/UefiHiiServicesLib.h>
+#include <Library/RedfishEventLib.h>
+
+#include <Protocol/HiiConfigAccess.h>
+
+#include <Guid/VariableFormat.h>
+#include <Guid/MdeModuleHii.h>
+
+#include "Hii2RedfishBootData.h"
+
+extern UINT8 Hii2RedfishBootVfrBin[];
+
+#define COMPUTER_SYSTEM_SECHEMA_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/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
new file mode 100644
index 0000000000..8d40885904
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
@@ -0,0 +1,60 @@
+## @file
+# HII-to-Redfish boot driver.
+#
+# (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Hii2RedfishBootDxe
+ FILE_GUID = F9BA69BD-1EDB-4334-9D57-7E974ADF1361
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = Hii2RedfishBootDxeDriverEntryPoint
+ UNLOAD_IMAGE = Hii2RedfishBootDxeDriverUnload
+
+[Sources]
+ Hii2RedfishBootDxe.c
+ Hii2RedfishBootDxe.h
+ Hii2RedfishBootData.h
+ Hii2RedfishBootVfr.vfr
+ Hii2RedfishBootDxeStrings.uni
+ Hii2RedfishBootDxeMap.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ EmulatorPkg/EmulatorPkg.dec
+ RedfishClientPkg/RedfishClientPkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ PcdLib
+ MemoryAllocationLib
+ UefiBootServicesTableLib
+ UefiRuntimeServicesTableLib
+ UefiLib
+ PrintLib
+ HiiLib
+ UefiBootManagerLib
+ UefiHiiServicesLib
+ RedfishEventLib
+
+[Protocols]
+ gEfiDevicePathProtocolGuid
+ gEfiHiiConfigAccessProtocolGuid
+
+
+[Guids]
+ gHii2RedfishBootFormsetGuid
+ gEfiIfrTianoGuid
+
+[Depex]
+ gEfiHiiDatabaseProtocolGuid
+
diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni
new file mode 100644
index 0000000000..0589c90df5
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni
@@ -0,0 +1,28 @@
+/** @file
+ HII-to-Redfish memory driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/=#
+#langdef x-uefi-redfish-ComputerSystem.v1_5_0 "ComputerSystem.v1_5_0"
+
+#string STR_BOOT_SOURCE_OVERRIDE_ENABLED #language x-uefi-redfish-ComputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideEnabled"
+#string STR_BOOT_SOURCE_OVERRIDE_MODE #language x-uefi-redfish-ComputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideMode"
+#string STR_BOOT_SOURCE_OVERRIDE_TARGET #language x-uefi-redfish-ComputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideTarget"
+
+#string STR_DISABLED #language x-uefi-redfish-ComputerSystem.v1_5_0 "Disabled"
+#string STR_ONCE #language x-uefi-redfish-ComputerSystem.v1_5_0 "Once"
+#string STR_CONTINUOUS #language x-uefi-redfish-ComputerSystem.v1_5_0 "Continuous"
+#string STR_UEFI #language x-uefi-redfish-ComputerSystem.v1_5_0 "UEFI"
+#string STR_LEGACY #language x-uefi-redfish-ComputerSystem.v1_5_0 "Legacy"
+#string STR_TARGET_NONE #language x-uefi-redfish-ComputerSystem.v1_5_0 "None"
+#string STR_TARGET_PXE #language x-uefi-redfish-ComputerSystem.v1_5_0 "Pxe"
+#string STR_TARGET_USB #language x-uefi-redfish-ComputerSystem.v1_5_0 "Usb"
+#string STR_TARGET_HDD #language x-uefi-redfish-ComputerSystem.v1_5_0 "Hdd"
+#string STR_TARGET_BIOS_SETUP #language x-uefi-redfish-ComputerSystem.v1_5_0 "BiosSetup"
+#string STR_TARGET_UEFI #language x-uefi-redfish-ComputerSystem.v1_5_0 "UefiTarget"
+#string STR_TARGET_UEFI_HTTP #language x-uefi-redfish-ComputerSystem.v1_5_0 "UefiHttp"
diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni
new file mode 100644
index 0000000000..c2057633c2
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni
@@ -0,0 +1,41 @@
+/** @file
+ HII-to-Redfish memory driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/=#
+#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 Order"
+#string STR_BOOT_ORDER_LIST #language en-US "Boot Order List"
+#string STR_BOOT_ORDER_LIST_HELP #language en-US "Boot Order List"
+
+#string STR_BOOT_SOURCE_OVERRIDE_ENABLED #language en-US "Boot Source Override Enabled"
+#string STR_BOOT_SOURCE_OVERRIDE_ENABLED_HELP #language en-US "Describes the state of the Boot Source Override feature."
+
+#string STR_BOOT_SOURCE_OVERRIDE_MODE #language en-US "Boot Source 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 Source Override Target"
+#string STR_BOOT_SOURCE_OVERRIDE_TARGET_HELP #language en-US "The current 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 "Continuous"
+#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 Setup Menu"
+#string STR_TARGET_UEFI #language en-US "Uefi Target"
+#string STR_TARGET_UEFI_HTTP #language en-US "Uefi Http"
diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr
new file mode 100644
index 0000000000..3758de6bfd
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr
@@ -0,0 +1,83 @@
+/** @file
+ HII-to-Redfish boot driver VFR file.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include "Hii2RedfishBootData.h"
+
+formset
+ guid = HII_2_REDFISH_BOOT_FORMSET_GUID,
+ title = STRING_TOKEN(STR_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
+ classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
+
+ //
+ // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
+ //
+ efivarstore HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA,
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
+ name = Hii2RedfishBootEfiVar,
+ guid = HII_2_REDFISH_BOOT_FORMSET_GUID;
+
+ //
+ // Define a variable Storage for boot order
+ //
+ varstore HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA,
+ varid = BOOT_OPTION_VAR_STORE_ID,
+ name = Hii2RedfishBootOptionVar,
+ guid = HII_2_REDFISH_BOOT_FORMSET_GUID;
+
+ //
+ // Define a Form (EFI_IFR_FORM)
+ //
+ form formid = FORM_ID, // Form ID
+ title = STRING_TOKEN(STR_FORM_TITLE); // Form title
+
+ oneof varid = Hii2RedfishBootEfiVar.BootSourceOverrideEnabled,
+ questionid = QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED,
+ prompt = STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_ENABLED),
+ help = STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_ENABLED_HELP),
+ flags = INTERACTIVE | NUMERIC_SIZE_1,
+ option text = STRING_TOKEN(STR_DISABLED), value = STR_DISABLED, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_ONCE), value = STR_ONCE, flags = 0;
+ option text = STRING_TOKEN(STR_CONTINUOUS), value = STR_CONTINUOUS, flags = 0;
+ endoneof;
+
+ oneof varid = Hii2RedfishBootEfiVar.BootSourceOverrideMode,
+ questionid = QUESTION_ID_BOOT_SOURCE_OVERRIDE_MODE,
+ prompt = STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_MODE),
+ help = STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_MODE_HELP),
+ flags = INTERACTIVE | NUMERIC_SIZE_1,
+ option text = STRING_TOKEN(STR_UEFI), value = STR_UEFI, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_LEGACY), value = STR_LEGACY, flags = 0;
+ endoneof;
+
+ oneof varid = Hii2RedfishBootEfiVar.BootSourceOverrideTarget,
+ questionid = QUESTION_ID_BOOT_SOURCE_OVERRIDE_TARGET,
+ prompt = STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_TARGET),
+ help = STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_TARGET_HELP),
+ flags = INTERACTIVE | NUMERIC_SIZE_1,
+ option text = STRING_TOKEN(STR_TARGET_NONE), value = STR_TARGET_NONE, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_TARGET_PXE), value = STR_TARGET_PXE, flags = 0;
+ option text = STRING_TOKEN(STR_TARGET_USB), value = STR_TARGET_USB, flags = 0;
+ option text = STRING_TOKEN(STR_TARGET_HDD), value = STR_TARGET_HDD, flags = 0;
+ option text = STRING_TOKEN(STR_TARGET_BIOS_SETUP), value = STR_TARGET_BIOS_SETUP, flags = 0;
+ option text = STRING_TOKEN(STR_TARGET_UEFI), value = STR_TARGET_UEFI, flags = 0;
+ option text = STRING_TOKEN(STR_TARGET_UEFI_HTTP), value = STR_TARGET_UEFI_HTTP, flags = 0;
+ endoneof;
+
+ subtitle text = 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;
--
2.32.0.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [edk2-staging][PATCH 2/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBiosDxe driver
2022-07-12 12:19 [edk2-staging][PATCH 1/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBootDxe driver Nickle Wang
@ 2022-07-12 12:19 ` Nickle Wang
0 siblings, 0 replies; 2+ messages in thread
From: Nickle Wang @ 2022-07-12 12:19 UTC (permalink / raw)
To: devel; +Cc: Andrew Fish, Ray Ni, Abner Chang, Yang Atom, Nick Ramirez
Add Hii2RedfishBiosDxe 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 <nickle.wang@hpe.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Yang Atom <Atom.Yang@amd.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
EmulatorPkg/EmulatorPkg.dec | 1 +
EmulatorPkg/EmulatorPkg.dsc | 1 +
EmulatorPkg/EmulatorPkg.fdf | 1 +
.../Hii2RedfishBiosDxe/Hii2RedfishBiosData.h | 46 +++
.../Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c | 291 ++++++++++++++++++
.../Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h | 44 +++
.../Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf | 55 ++++
.../Hii2RedfishBiosDxeMap.uni | 20 ++
.../Hii2RedfishBiosDxeStrings.uni | 30 ++
.../Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr | 67 ++++
10 files changed, 556 insertions(+)
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni
create mode 100644 EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr
diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
index 52a62c09c9..e782b15266 100644
--- a/EmulatorPkg/EmulatorPkg.dec
+++ b/EmulatorPkg/EmulatorPkg.dec
@@ -49,6 +49,7 @@
gEmuRedfishServiceGuid = { 0x3fb208ac, 0x2185, 0x498c, { 0xbf, 0x46, 0xdc, 0x23, 0xda, 0x58, 0x7b, 0x55 } }
gHii2RedfishMemoryFormsetGuid = { 0xC2BE579E, 0x3C57, 0x499C, { 0xA9, 0xDF, 0xE6, 0x23, 0x8A, 0x49, 0x64, 0xF8 }}
gHii2RedfishBootFormsetGuid = { 0x8399a787, 0x108e, 0x4e53, { 0x9e, 0xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab, 0x3b }}
+ gHii2RedfishBiosFormsetGuid = { 0xC2724AD1, 0x4049, 0x2404, { 0xF8, 0xCE, 0x01, 0xA7, 0x9C, 0xEC, 0x16, 0xF6 }}
[PcdsFeatureFlag]
## If TRUE, if symbols only load on breakpoints and gdb entry
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 1d59b4a1dd..dd1d9ef9ec 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -491,6 +491,7 @@
!if $(REDFISH_ENABLE) == TRUE
EmulatorPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf
EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
+ EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
!endif
!include RedfishPkg/Redfish.dsc.inc
!include RedfishClientPkg/RedfishClient.dsc.inc
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index f9ff4320d9..9e594533d8 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -215,6 +215,7 @@ INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
!if $(REDFISH_ENABLE) == TRUE
INF EmulatorPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf
INF EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
+ INF EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
!endif
!include RedfishPkg/Redfish.fdf.inc
!include RedfishClientPkg/RedfishClient.fdf.inc
diff --git a/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h
new file mode 100644
index 0000000000..1b27dfd168
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h
@@ -0,0 +1,46 @@
+/** @file
+ The header file of HII-to-Redfish BIOS example driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef HII_2_REDFISH_BIOS_DATA_H_
+#define HII_2_REDFISH_BIOS_DATA_H_
+
+#include <Uefi/UefiMultiPhase.h>
+#include <Guid/HiiPlatformSetupFormset.h>
+
+#define HII_2_REDFISH_BIOS_FORMSET_GUID \
+ { \
+ 0xC2724AD1, 0x4049, 0x2404, { 0xF8, 0xCE, 0x01, 0xA7, 0x9C, 0xEC, 0x16, 0xF6 } \
+ }
+
+extern EFI_GUID gHii2RedfishBiosFormsetGuid;
+
+#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_2_REDFISH_BIOS_VARSTORE_DATA
+//
+typedef struct {
+ UINT8 RefishBiosOption1Data;
+ CHAR16 RefishBiosOption2Data [ID_STRING_MAX_WITH_TERMINATOR];
+ UINT8 RefishBiosOption3Data;
+ UINT8 RefishBiosOption4Data;
+ UINT8 Reserved;
+} HII_2_REDFISH_BIOS_EFI_VARSTORE_DATA;
+
+#endif
diff --git a/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c
new file mode 100644
index 0000000000..0d4c90c335
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c
@@ -0,0 +1,291 @@
+/** @file
+ HII-to-Redfish Bios example driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Hii2RedfishBiosDxe.h"
+
+EFI_GUID mHii2RedfishBiosGuid = HII_2_REDFISH_BIOS_FORMSET_GUID;
+EFI_HII_HANDLE mHiiHandle;
+EFI_HANDLE DriverHandle;
+CHAR16 Hii2RedfishEfiVar[] = L"Hii2RedfishBiosEfiVar";
+
+///
+/// HII specific Vendor Device Path definition.
+///
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ HII_2_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_SUCESS HII variable is initialized.
+
+**/
+EFI_STATUS
+InitialHiiVairable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ HII_2_REDFISH_BIOS_EFI_VARSTORE_DATA Hii2RedfishBiosVar;
+
+ //
+ // Get Buffer Storage data from EFI variable.
+ // Try to get the current setting from variable.
+ //
+ BufferSize = sizeof (HII_2_REDFISH_BIOS_EFI_VARSTORE_DATA);
+ Status = gRT->GetVariable (
+ Hii2RedfishEfiVar,
+ &gHii2RedfishBiosFormsetGuid,
+ NULL,
+ &BufferSize,
+ &Hii2RedfishBiosVar
+ );
+ if (!EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Initialization
+ //
+ Hii2RedfishBiosVar.RefishBiosOption1Data = STR_BIOS_OPTION_1_ITEM_1;
+ StrCpyS (Hii2RedfishBiosVar.RefishBiosOption2Data, ID_STRING_MAX_WITH_TERMINATOR, L"Default");
+ Hii2RedfishBiosVar.RefishBiosOption3Data = 5;
+ Hii2RedfishBiosVar.RefishBiosOption4Data = TRUE;
+
+ Status = gRT->SetVariable (
+ Hii2RedfishEfiVar,
+ &gHii2RedfishBiosFormsetGuid,
+ VARIABLE_ATTRIBUTE_NV_BS,
+ BufferSize,
+ &Hii2RedfishBiosVar
+ );
+
+ return Status;
+}
+
+/**
+ This function allows a caller to extract the current configuration for one
+ or more named elements from the target driver.
+
+ @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param[in] Request A null-terminated Unicode string in
+ <ConfigRequest> format.
+ @param[out] Progress On return, points to a character in the Request
+ string. Points to the string's null terminator if
+ request was successful. Points to the most recent
+ '&' before the first failing name/value pair (or
+ the beginning of the string if the failure is in
+ the first name/value pair) if the request was not
+ successful.
+ @param[out] Results A null-terminated Unicode string in
+ <ConfigAltResp> format which has all values filled
+ in for the names in the Request string. String 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 name.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+Hii2RedfishBiosExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Request == 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, &gHii2RedfishBiosFormsetGuid, L"Hii2RedfishBiosEfiVar")) {
+ 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_PROTOCOL.
+ @param[in] Configuration A null-terminated Unicode string in <ConfigResp>
+ format.
+ @param[out] Progress A pointer to a string filled in with the offset of
+ the most recent '&' before the first failing
+ name/value pair (or the beginning of the string if
+ the failure is in the first name/value pair) or
+ the terminating NULL if all was successful.
+
+ @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
+Hii2RedfishBiosRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ DEBUG ((DEBUG_INFO, "%a, unsupported\n", __FUNCTION__));
+
+ return EFI_UNSUPPORTED;
+}
+
+
+/**
+ This function processes the results of changes in configuration.
+
+ @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param[in] Action Specifies the type of action taken by the browser.
+ @param[in] QuestionId A unique value which is sent to the original
+ 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 original
+ exporting driver.
+ @param[out] ActionRequest On return, points to the action requested by the
+ callback function.
+
+ @retval EFI_SUCCESS The callback successfully handled the action.
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
+ 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
+Hii2RedfishBiosDriverCallback (
+ 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", __FUNCTION__, Action, QuestionId));
+
+ return EFI_UNSUPPORTED;
+}
+
+EFI_HII_CONFIG_ACCESS_PROTOCOL mHii2RedfishConfigAccess = {
+ Hii2RedfishBiosExtractConfig,
+ Hii2RedfishBiosRouteConfig,
+ Hii2RedfishBiosDriverCallback
+};
+
+/**
+ Main entry for this driver.
+
+ @param[in] ImageHandle Image handle this driver.
+ @param[in] SystemTable Pointer to SystemTable.
+
+ @retval EFI_SUCESS This function always complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+Hii2RedfishBiosDxeDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ DriverHandle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mHii2RedfishConfigAccess,
+ NULL
+ );
+
+ //
+ // Publish our HII data
+ //
+ mHiiHandle = HiiAddPackages (
+ &mHii2RedfishBiosGuid,
+ DriverHandle,
+ Hii2RedfishBiosDxeStrings,
+ Hii2RedfishBiosVfrBin,
+ NULL
+ );
+ if (mHiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = InitialHiiVairable ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to initial variable: %r\n", __FUNCTION__, Status));
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+Hii2RedfishBiosDxeDriverUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ if (mHiiHandle != NULL) {
+ HiiRemovePackages (mHiiHandle);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h
new file mode 100644
index 0000000000..b7f9aceeb0
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h
@@ -0,0 +1,44 @@
+/** @file
+ HII-to-Redfish BIOS example driver header file.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef HII_2_REDFISH_BIOS_DXE_H_
+#define HII_2_REDFISH_BIOS_DXE_H_
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/PrintLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+
+#include <Protocol/HiiConfigAccess.h>
+#include <Guid/VariableFormat.h>
+
+#include "Hii2RedfishBiosData.h"
+
+extern UINT8 Hii2RedfishBiosVfrBin[];
+
+#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/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
new file mode 100644
index 0000000000..06080113a1
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
@@ -0,0 +1,55 @@
+## @file
+# HII-to-Redfish BIOS Example driver.
+#
+# (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Hii2RedfishBiosDxe
+ FILE_GUID = 9A7FA287-4038-CB66-DC70-92AE8C0FCF73
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = Hii2RedfishBiosDxeDriverEntryPoint
+ UNLOAD_IMAGE = Hii2RedfishBiosDxeDriverUnload
+
+[Sources]
+ Hii2RedfishBiosDxe.c
+ Hii2RedfishBiosDxe.h
+ Hii2RedfishBiosData.h
+ Hii2RedfishBiosVfr.vfr
+ Hii2RedfishBiosDxeStrings.uni
+ Hii2RedfishBiosDxeMap.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ EmulatorPkg/EmulatorPkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ PcdLib
+ MemoryAllocationLib
+ UefiBootServicesTableLib
+ UefiRuntimeServicesTableLib
+ UefiLib
+ PrintLib
+ HiiLib
+
+[Protocols]
+ gEfiDevicePathProtocolGuid
+ gEfiHiiConfigAccessProtocolGuid
+
+
+[Guids]
+ gHii2RedfishBiosFormsetGuid
+
+[Depex]
+ gEfiHiiDatabaseProtocolGuid
+
diff --git a/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni
new file mode 100644
index 0000000000..51d6d7ecb8
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni
@@ -0,0 +1,20 @@
+/** @file
+ HII-to-Redfish BIOS example driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/=#
+#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/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni
new file mode 100644
index 0000000000..84311e72a4
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni
@@ -0,0 +1,30 @@
+#string /** @file
+ HII-to-Redfish BIOS example driver.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/=#
+#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 Redfish BIOS Option 1"
+#string STR_BIOS_OPTION_2_PROMPT #language en-US "HII Redfish BIOS Option 2"
+#string STR_BIOS_OPTION_3_PROMPT #language en-US "HII Redfish BIOS Option 3"
+#string STR_BIOS_OPTION_4_PROMPT #language en-US "HII Redfish BIOS Option 4"
+
+#string STR_BIOS_OPTION_1_HELP #language en-US "HII Redfish BIOS Option 1"
+#string STR_BIOS_OPTION_2_HELP #language en-US "HII Redfish BIOS Option 2"
+#string STR_BIOS_OPTION_3_HELP #language en-US "HII Redfish BIOS Option 3"
+#string STR_BIOS_OPTION_4_HELP #language en-US "HII Redfish 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/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr
new file mode 100644
index 0000000000..896feda541
--- /dev/null
+++ b/EmulatorPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr
@@ -0,0 +1,67 @@
+/** @file
+ HII-to-Redfish BIOS example driver VFR file.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include "Hii2RedfishBiosData.h"
+
+formset
+ guid = HII_2_REDFISH_BIOS_FORMSET_GUID,
+ title = STRING_TOKEN(STR_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
+ classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
+
+ //
+ // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
+ //
+ efivarstore HII_2_REDFISH_BIOS_EFI_VARSTORE_DATA,
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
+ name = Hii2RedfishBiosEfiVar,
+ guid = HII_2_REDFISH_BIOS_FORMSET_GUID;
+
+ //
+ // Define a Form (EFI_IFR_FORM)
+ //
+ form formid = FORM_ID, // Form ID
+ title = STRING_TOKEN(STR_FORM_TITLE); // Form title
+
+ oneof varid = Hii2RedfishBiosEfiVar.RefishBiosOption1Data,
+ questionid = FROM_ID_BIOS_OPTION_1,
+ prompt = STRING_TOKEN(STR_BIOS_OPTION_1_PROMPT),
+ help = STRING_TOKEN(STR_BIOS_OPTION_1_HELP),
+ flags = INTERACTIVE | NUMERIC_SIZE_1,
+ option text = STRING_TOKEN(STR_BIOS_OPTION_1_ITEM_1), value = STR_BIOS_OPTION_1_ITEM_1, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_BIOS_OPTION_1_ITEM_2), value = STR_BIOS_OPTION_1_ITEM_2, flags = 0;
+ option text = STRING_TOKEN(STR_BIOS_OPTION_1_ITEM_3), value = STR_BIOS_OPTION_1_ITEM_3, flags = 0;
+ endoneof;
+
+ string varid = Hii2RedfishBiosEfiVar.RefishBiosOption2Data,
+ prompt = STRING_TOKEN(STR_BIOS_OPTION_2_PROMPT),
+ help = STRING_TOKEN(STR_BIOS_OPTION_2_HELP),
+ flags = READ_ONLY,
+ minsize = ID_STRING_MIN,
+ maxsize = ID_STRING_MAX,
+ endstring;
+
+ numeric varid = Hii2RedfishBiosEfiVar.RefishBiosOption3Data,
+ prompt = STRING_TOKEN(STR_BIOS_OPTION_3_PROMPT),
+ help = STRING_TOKEN(STR_BIOS_OPTION_3_HELP),
+ minimum = 0,
+ maximum = 0xff,
+ step = 1,
+ default = 20,
+ endnumeric;
+
+ checkbox varid = Hii2RedfishBiosEfiVar.RefishBiosOption4Data,
+ prompt = STRING_TOKEN(STR_BIOS_OPTION_4_PROMPT),
+ help = STRING_TOKEN(STR_BIOS_OPTION_4_PROMPT),
+ flags = CHECKBOX_DEFAULT,
+ default = TRUE,
+ endcheckbox;
+ endform;
+endformset;
--
2.32.0.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-12 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-12 12:19 [edk2-staging][PATCH 1/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBootDxe driver Nickle Wang
2022-07-12 12:19 ` [edk2-staging][PATCH 2/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBiosDxe driver Nickle Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox