[edk2-staging][PATCH v2 2/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBiosDxe driver


Nickle Wang
 

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@...>
Cc: Andrew Fish <afish@...>
Cc: Ray Ni <ray.ni@...>
Cc: Abner Chang <abner.chang@...>
Cc: Yang Atom <Atom.Yang@...>
Cc: Nick Ramirez <nramirez@...>
---
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

Join devel@edk2.groups.io to automatically receive all group messages.