public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-redfish-client][PATCH 3/3] RedfishClientPkg: Introduce Hii2RedfishBiosDxe driver
@ 2023-06-06 13:38 Nickle Wang
  0 siblings, 0 replies; only message in thread
From: Nickle Wang @ 2023-06-06 13:38 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Igor Kulchytskyy

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 <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
 RedfishClientPkg/RedfishClientPkg.dec         |   1 +
 .../RedfishClientComponents.dsc.inc           |   1 +
 .../Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf |  55 ++++
 .../Hii2RedfishBiosDxe/Hii2RedfishBiosData.h  |  46 +++
 .../Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h   |  44 +++
 .../Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr |  67 ++++
 .../Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c   | 289 ++++++++++++++++++
 .../Hii2RedfishBiosDxeMap.uni                 |  20 ++
 .../Hii2RedfishBiosDxeStrings.uni             |  30 ++
 RedfishClientPkg/RedfishClient.fdf.inc        |   1 +
 10 files changed, 554 insertions(+)
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni
 create mode 100644 RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni

diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/RedfishClientPkg.dec
index 055c1924..77e04894 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -59,6 +59,7 @@
 
   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 }}
 
 [PcdsFixedAtBuild]
   gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT32|0x10000001
diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClientPkg/RedfishClientComponents.dsc.inc
index 4633e962..858bd381 100644
--- a/RedfishClientPkg/RedfishClientComponents.dsc.inc
+++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc
@@ -19,6 +19,7 @@
   RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf
   RedfishClientPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf
   RedfishClientPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
+  RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
 !endif
   #
   # Below two modules should be pulled in by build tool.
diff --git a/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
new file mode 100644
index 00000000..06080113
--- /dev/null
+++ b/RedfishClientPkg/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/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosData.h
new file mode 100644
index 00000000..24f2fd7c
--- /dev/null
+++ b/RedfishClientPkg/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/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.h
new file mode 100644
index 00000000..f5859043
--- /dev/null
+++ b/RedfishClientPkg/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/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosVfr.vfr
new file mode 100644
index 00000000..896feda5
--- /dev/null
+++ b/RedfishClientPkg/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;
diff --git a/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c
new file mode 100644
index 00000000..1bf4b152
--- /dev/null
+++ b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.c
@@ -0,0 +1,289 @@
+/** @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", __func__));
+
+  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", __func__, 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", __func__, 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/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeMap.uni
new file mode 100644
index 00000000..51d6d7ec
--- /dev/null
+++ b/RedfishClientPkg/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/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni b/RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxeStrings.uni
new file mode 100644
index 00000000..84311e72
--- /dev/null
+++ b/RedfishClientPkg/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/RedfishClientPkg/RedfishClient.fdf.inc b/RedfishClientPkg/RedfishClient.fdf.inc
index 95c1eb3e..f05c7895 100644
--- a/RedfishClientPkg/RedfishClient.fdf.inc
+++ b/RedfishClientPkg/RedfishClient.fdf.inc
@@ -22,6 +22,7 @@
   INF RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf
   INF RedfishClientPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf
   INF RedfishClientPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf
+  INF RedfishClientPkg/Hii2RedfishBiosDxe/Hii2RedfishBiosDxe.inf
 
   !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc
   #
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-06 13:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06 13:38 [edk2-redfish-client][PATCH 3/3] RedfishClientPkg: 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