public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nhi Pham" <nhi@os.amperecomputing.com>
To: devel@edk2.groups.io
Cc: patches@amperecomputing.com, nhi@os.amperecomputing.com,
	vunguyen@os.amperecomputing.com,
	Thang Nguyen <thang@os.amperecomputing.com>,
	Chuong Tran <chuong@os.amperecomputing.com>,
	Phong Vo <phong@os.amperecomputing.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH v4 26/31] AmpereAltraPkg: Add platform info screen
Date: Fri, 22 Oct 2021 13:18:04 +0700	[thread overview]
Message-ID: <20211022061809.31087-27-nhi@os.amperecomputing.com> (raw)
In-Reply-To: <20211022061809.31087-1-nhi@os.amperecomputing.com>

Provide screen menu with basic platform information include:
* Platform name
* SCP firmware info
* System bus clock frequency.

Cc: Thang Nguyen <thang@os.amperecomputing.com>
Cc: Chuong Tran <chuong@os.amperecomputing.com>
Cc: Phong Vo <phong@os.amperecomputing.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 Platform/Ampere/JadePkg/Jade.dsc                                              |   1 +
 Platform/Ampere/JadePkg/Jade.fdf                                              |   1 +
 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf     |  52 +++
 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h       |  22 ++
 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr     | 112 ++++++
 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c       | 390 ++++++++++++++++++++
 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.uni |  56 +++
 7 files changed, 634 insertions(+)

diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc
index 6c4294bef159..deddd3b5fdde 100644
--- a/Platform/Ampere/JadePkg/Jade.dsc
+++ b/Platform/Ampere/JadePkg/Jade.dsc
@@ -186,3 +186,4 @@ [Components.common]
   # HII
   #
   Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.inf
+  Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf
diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf
index 8891bad8f55e..672b594cca0c 100644
--- a/Platform/Ampere/JadePkg/Jade.fdf
+++ b/Platform/Ampere/JadePkg/Jade.fdf
@@ -356,5 +356,6 @@ [FV.FvMain]
   # HII
   #
   INF Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.inf
+  INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf
 
 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf
new file mode 100644
index 000000000000..e04422249b76
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf
@@ -0,0 +1,52 @@
+## @file
+#
+# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001B
+  BASE_NAME                      = PlatformInfoDxe
+  FILE_GUID                      = 6FDFB3E8-105E-48C4-94AA-3D7646F9B50D
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = PlatformInfoEntryPoint
+
+[Sources.common]
+  PlatformInfoDxe.c
+  PlatformInfoHii.h
+  PlatformInfoVfr.vfr
+  PlatformInfoStrings.uni
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec
+  Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
+
+[LibraryClasses]
+  AmpereCpuLib
+  BaseLib
+  BaseMemoryLib
+  DebugLib
+  DevicePathLib
+  DevicePathLib
+  HiiLib
+  HobLib
+  IoLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+
+[Guids]
+  gPlatformManagerFormsetGuid
+  gEfiIfrTianoGuid
+  gPlatformInfoHobGuid
+
+[Protocols]
+
+[Depex]
+  TRUE
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h
new file mode 100644
index 000000000000..7f363160afc8
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h
@@ -0,0 +1,22 @@
+/** @file
+
+  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef PLATFORM_INFO_HII_H_
+#define PLATFORM_INFO_HII_H_
+
+#define PLATFORM_INFO_FORMSET_GUID \
+  { \
+    0x8DF0F6FB, 0x65A5, 0x434B, { 0xB2, 0xA6, 0xCE, 0xDF, 0xD2, 0x0A, 0x96, 0x8A } \
+  }
+
+#define LABEL_UPDATE             0x2223
+#define LABEL_END                0x2224
+
+#define PLATFORM_INFO_FORM_ID    0x1
+
+#endif
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr
new file mode 100644
index 000000000000..5dd32a30f0ad
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr
@@ -0,0 +1,112 @@
+/** @file
+
+  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "PlatformInfoHii.h"
+
+formset
+  guid      = PLATFORM_INFO_FORMSET_GUID,
+  title     = STRING_TOKEN(STR_PLATFORM_INFO_FORM),
+  help      = STRING_TOKEN(STR_PLATFORM_INFO_FORM_HELP),
+  classguid = gPlatformManagerFormsetGuid,
+
+  form
+    formid = PLATFORM_INFO_FORM_ID,
+    title  = STRING_TOKEN(STR_PLATFORM_INFO_FORM);
+    subtitle text = STRING_TOKEN(STR_PLATFORM_INFO_FORM_HELP);
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_BOARD),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_BOARD),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_BOARD_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_SCPVER),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SCPVER),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SCPVER_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    text
+      help   = STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK),
+      text   = STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK_VALUE),
+      flags  = 0,
+      key    = 0;
+
+    label LABEL_UPDATE;
+    // dynamic content here
+    label LABEL_END;
+
+  endform;
+
+endformset;
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c
new file mode 100644
index 000000000000..82d2cf131c16
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c
@@ -0,0 +1,390 @@
+/** @file
+
+  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+
+#include <Guid/MdeModuleHii.h>
+#include <Guid/PlatformInfoHob.h>
+#include <Library/AmpereCpuLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/HiiLib.h>
+#include <Library/HobLib.h>
+#include <Library/IoLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+
+#include "PlatformInfoHii.h"
+
+//
+// uni string and Vfr Binary data.
+//
+extern UINT8 PlatformInfoVfrBin[];
+extern UINT8 PlatformInfoDxeStrings[];
+
+EFI_HANDLE     mDriverHandle = NULL;
+EFI_HII_HANDLE mHiiHandle = NULL;
+
+#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()
+
+// PLATFORM_INFO_FORMSET_GUID
+EFI_GUID gPlatformInfoFormSetGuid = PLATFORM_INFO_FORMSET_GUID;
+
+HII_VENDOR_DEVICE_PATH mPlatformInfoHiiVendorDevicePath = {
+  {
+    {
+      HARDWARE_DEVICE_PATH,
+      HW_VENDOR_DP,
+      {
+        (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+        (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+      }
+    },
+    PLATFORM_INFO_FORMSET_GUID
+  },
+  {
+    END_DEVICE_PATH_TYPE,
+    END_ENTIRE_DEVICE_PATH_SUBTYPE,
+    {
+      (UINT8)(END_DEVICE_PATH_LENGTH),
+      (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
+    }
+  }
+};
+
+#define MAX_STRING_SIZE     64
+#define MHZ_SCALE_FACTOR    1000000
+
+STATIC
+CHAR8 *
+GetCCIXLinkSpeed (
+  IN UINTN Speed
+  )
+{
+  switch (Speed) {
+  case 1:
+    return "2.5 GT/s";
+
+  case 2:
+    return "5 GT/s";
+
+  case 3:
+    return "8 GT/s";
+
+  case 4:
+  case 6:
+    return "16 GT/s";
+
+  case 0xa:
+    return "20 GT/s";
+
+  case 0xf:
+    return "25 GT/s";
+  }
+
+  return "Unknown";
+}
+
+STATIC
+EFI_STATUS
+UpdatePlatformInfoScreen (
+  IN EFI_HII_HANDLE *HiiHandle
+  )
+{
+  VOID               *Hob;
+  PLATFORM_INFO_HOB  *PlatformHob;
+  CHAR16             Str[MAX_STRING_SIZE];
+
+  VOID               *StartOpCodeHandle;
+  EFI_IFR_GUID_LABEL *StartLabel;
+  VOID               *EndOpCodeHandle;
+  EFI_IFR_GUID_LABEL *EndLabel;
+
+  /* Get the Platform HOB */
+  Hob = GetFirstGuidHob (&gPlatformInfoHobGuid);
+  if (Hob == NULL) {
+    return EFI_DEVICE_ERROR;
+  }
+  PlatformHob = (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob);
+
+  /* SCP Version */
+  AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->SmPmProVer, Str, MAX_STRING_SIZE);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_SCPVER_VALUE),
+    Str,
+    NULL
+    );
+
+  /* SCP build */
+  AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->SmPmProBuild, Str, MAX_STRING_SIZE);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_SCPBUILD_VALUE),
+    Str,
+    NULL
+    );
+
+  /* CPU Info */
+  AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->CpuInfo, Str, MAX_STRING_SIZE);
+  UnicodeSPrint (Str, sizeof (Str), L"%s", Str);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_CPUINFO_VALUE),
+    Str,
+    NULL
+    );
+
+  /* CPU clock */
+  UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->CpuClk / MHZ_SCALE_FACTOR);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_CPUCLK_VALUE),
+    Str,
+    NULL
+    );
+
+  /* PCP clock */
+  UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->PcpClk / MHZ_SCALE_FACTOR);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_PCPCLK_VALUE),
+    Str,
+    NULL
+    );
+
+  /* SOC clock */
+  UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->SocClk / MHZ_SCALE_FACTOR);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_SOCCLK_VALUE),
+    Str,
+    NULL
+    );
+
+  /* L1 Cache */
+  UnicodeSPrint (Str, sizeof (Str), L"64KB");
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_L1ICACHE_VALUE),
+    Str,
+    NULL
+    );
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_L1DCACHE_VALUE),
+    Str,
+    NULL
+    );
+
+  /* L2 Cache */
+  UnicodeSPrint (Str, sizeof (Str), L"1MB");
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_L2CACHE_VALUE),
+    Str,
+    NULL
+    );
+
+  /* AHB clock */
+  UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->AhbClk / MHZ_SCALE_FACTOR);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_AHBCLK_VALUE),
+    Str,
+    NULL
+    );
+
+  /* SYS clock */
+  UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->SysClk / MHZ_SCALE_FACTOR);
+  HiiSetString (
+    HiiHandle,
+    STRING_TOKEN (STR_PLATFORM_INFO_SYSCLK_VALUE),
+    Str,
+    NULL
+    );
+
+  /* Initialize the container for dynamic opcodes */
+  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)
+                                       );
+  ASSERT (StartLabel != NULL);
+  StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+  StartLabel->Number       = LABEL_UPDATE;
+
+  /* Create Hii Extend Label OpCode as the end opcode */
+  EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
+                                     EndOpCodeHandle,
+                                     &gEfiIfrTianoGuid,
+                                     NULL,
+                                     sizeof (EFI_IFR_GUID_LABEL)
+                                     );
+  ASSERT (EndLabel != NULL);
+  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+  EndLabel->Number       = LABEL_END;
+
+  if (IsSlaveSocketActive ()) {
+    /* Create the inter socket link text string */
+    UnicodeSPrint (
+      Str,
+      sizeof (Str),
+      L"Width x%d / Speed %a",
+      PlatformHob->Link2PWidth[0],
+      GetCCIXLinkSpeed (PlatformHob->Link2PSpeed[0])
+      );
+
+    HiiSetString (
+      mHiiHandle,
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0_VALUE),
+      Str,
+      NULL
+      );
+
+    HiiCreateTextOpCode (
+      StartOpCodeHandle,
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0),
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0),
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0_VALUE)
+      );
+
+    UnicodeSPrint (
+      Str,
+      sizeof (Str),
+      L"Width x%d / Speed %a",
+      PlatformHob->Link2PWidth[1],
+      GetCCIXLinkSpeed (PlatformHob->Link2PSpeed[1])
+      );
+
+    HiiSetString (
+      mHiiHandle,
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1_VALUE),
+      Str,
+      NULL
+      );
+
+    HiiCreateTextOpCode (
+      StartOpCodeHandle,
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1),
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1),
+      STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1_VALUE)
+      );
+  }
+
+  HiiUpdateForm (
+    mHiiHandle,                 // HII handle
+    &gPlatformInfoFormSetGuid,  // Formset GUID
+    PLATFORM_INFO_FORM_ID,      // Form ID
+    StartOpCodeHandle,          // Label for where to insert opcodes
+    EndOpCodeHandle             // Insert data
+    );
+
+  HiiFreeOpCodeHandle (StartOpCodeHandle);
+  HiiFreeOpCodeHandle (EndOpCodeHandle);
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+PlatformInfoUnload (
+  VOID
+  )
+{
+  if (mDriverHandle != NULL) {
+    gBS->UninstallMultipleProtocolInterfaces (
+           mDriverHandle,
+           &gEfiDevicePathProtocolGuid,
+           &mPlatformInfoHiiVendorDevicePath,
+           NULL
+           );
+    mDriverHandle = NULL;
+  }
+
+  if (mHiiHandle != NULL) {
+    HiiRemovePackages (mHiiHandle);
+  }
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+PlatformInfoEntryPoint (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  EFI_STATUS Status;
+
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &mDriverHandle,
+                  &gEfiDevicePathProtocolGuid,
+                  &mPlatformInfoHiiVendorDevicePath,
+                  NULL
+                  );
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Publish our HII data
+  //
+  mHiiHandle = HiiAddPackages (
+                 &gPlatformInfoFormSetGuid,
+                 mDriverHandle,
+                 PlatformInfoDxeStrings,
+                 PlatformInfoVfrBin,
+                 NULL
+                 );
+  if (mHiiHandle == NULL) {
+    gBS->UninstallMultipleProtocolInterfaces (
+           mDriverHandle,
+           &gEfiDevicePathProtocolGuid,
+           &mPlatformInfoHiiVendorDevicePath,
+           NULL
+           );
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  Status = UpdatePlatformInfoScreen (mHiiHandle);
+  if (EFI_ERROR (Status)) {
+    PlatformInfoUnload ();
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a %d Fail to update the platform info screen \n",
+      __FUNCTION__,
+      __LINE__
+      ));
+    return Status;
+  }
+
+  return EFI_SUCCESS;
+}
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.uni
new file mode 100644
index 000000000000..235d104c217f
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.uni
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+
+#langdef en-US  "English"
+
+#string STR_PLATFORM_INFO_FORM                      #language en-US "Platform Board Information"
+#string STR_PLATFORM_INFO_FORM_HELP                 #language en-US "Platform Board Information"
+
+#string STR_PLATFORM_INFO_SEPERATE_LINE             #language en-US ""
+
+#string STR_PLATFORM_INFO_BOARD                     #language en-US "Board"
+#string STR_PLATFORM_INFO_BOARD_VALUE               #language en-US "Mt. Jade"
+
+#string STR_PLATFORM_INFO_SCPVER                    #language en-US "SCP FW Version"
+#string STR_PLATFORM_INFO_SCPVER_VALUE              #language en-US "0"
+
+#string STR_PLATFORM_INFO_RCVER                     #language en-US "Reference Code version"
+#string STR_PLATFORM_INFO_RCVER_VALUE               #language en-US "0"
+
+#string STR_PLATFORM_INFO_SCPBUILD                  #language en-US "SCP FW Build"
+#string STR_PLATFORM_INFO_SCPBUILD_VALUE            #language en-US "0"
+
+#string STR_PLATFORM_INFO_CPUINFO                   #language en-US "CPU"
+#string STR_PLATFORM_INFO_CPUINFO_VALUE             #language en-US " "
+
+#string STR_PLATFORM_INFO_CPUCLK                    #language en-US "CPU Clock"
+#string STR_PLATFORM_INFO_CPUCLK_VALUE              #language en-US "0MHz"
+
+#string STR_PLATFORM_INFO_PCPCLK                    #language en-US "PCP Clock"
+#string STR_PLATFORM_INFO_PCPCLK_VALUE              #language en-US "0MHz"
+
+#string STR_PLATFORM_INFO_L1ICACHE                  #language en-US "L1I CACHE"
+#string STR_PLATFORM_INFO_L1ICACHE_VALUE            #language en-US "0KB"
+
+#string STR_PLATFORM_INFO_L1DCACHE                  #language en-US "L1D CACHE"
+#string STR_PLATFORM_INFO_L1DCACHE_VALUE            #language en-US "0KB"
+
+#string STR_PLATFORM_INFO_L2CACHE                   #language en-US "L2 CACHE"
+#string STR_PLATFORM_INFO_L2CACHE_VALUE             #language en-US "0KB"
+
+#string STR_PLATFORM_INFO_SOCCLK                    #language en-US "SOC Clock"
+#string STR_PLATFORM_INFO_SOCCLK_VALUE              #language en-US "0MHz"
+
+#string STR_PLATFORM_INFO_SYSCLK                    #language en-US "Sys Clock"
+#string STR_PLATFORM_INFO_SYSCLK_VALUE              #language en-US "0MHz"
+
+#string STR_PLATFORM_INFO_AHBCLK                    #language en-US "AHB Clock"
+#string STR_PLATFORM_INFO_AHBCLK_VALUE              #language en-US "0MHz"
+
+#string STR_CPU_FORM_INTER_SOCKET_LINK0             #language en-US "Inter Socket Connection: Link 0"
+#string STR_CPU_FORM_INTER_SOCKET_LINK0_VALUE       #language en-US ""
+#string STR_CPU_FORM_INTER_SOCKET_LINK1             #language en-US "Inter Socket Connection: Link 1"
+#string STR_CPU_FORM_INTER_SOCKET_LINK1_VALUE       #language en-US ""
-- 
2.17.1


  parent reply	other threads:[~2021-10-22  6:20 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  6:17 [edk2-platforms][PATCH v4 00/31] Add new Ampere Mt. Jade platform Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 01/31] Ampere: Initial support for Ampere Altra processor and " Nhi Pham
2021-10-26 11:14   ` Leif Lindholm
2021-11-03  9:31     ` Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 02/31] AmpereAltraPkg: Add FlashLib library instance Nhi Pham
2021-10-26 11:25   ` Leif Lindholm
2021-11-03  9:32     ` Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 03/31] AmpereAltraPkg: Add FailSafe and WDT support Nhi Pham
2021-10-26 12:15   ` Leif Lindholm
2021-11-03  9:35     ` Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 04/31] AmpereAltraPkg: Add DwI2cLib library instance Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 05/31] AmpereAltraPkg: Add DwGpioLib " Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 06/31] JadePkg: Implement RealTimeClockLib for PCF85063 Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 07/31] AmpereAltraPkg: Add BootProgress support Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 08/31] AmpereAltraPkg: Support UEFI non-volatile variable Nhi Pham
2021-10-26 12:21   ` Leif Lindholm
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 09/31] AmpereSiliconPkg: Add PlatformManagerUiLib library instance Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 10/31] AmpereAltraPkg, JadePkg: Add ACPI support Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 11/31] AmpereAltraPkg: Add Root Complex HOB data structures Nhi Pham
2021-10-26 12:23   ` Leif Lindholm
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 12/31] AmpereAltraPkg: Add Ac01PcieLib library instance Nhi Pham
2021-10-26 12:45   ` Leif Lindholm
2021-11-03  9:33     ` Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 13/31] JadePkg: Add BoardPcieLib " Nhi Pham
2021-10-26 12:46   ` Leif Lindholm
2021-11-03  9:33     ` Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 14/31] AmpereAltraPkg: Add driver to initialize PCIe Root Complex Nhi Pham
2021-10-26 12:49   ` Leif Lindholm
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 15/31] AmpereAltraPkg: Add PciHostBridgeLib library instance Nhi Pham
2021-10-26 12:49   ` Leif Lindholm
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 16/31] AmpereAltraPkg: Add PciSegmentLib " Nhi Pham
2021-10-26 12:53   ` Leif Lindholm
2021-11-03  9:35     ` Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 17/31] JadePkg: Enable PciHostBridgeDxe driver Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 18/31] JadePkg: Add PciPlatformDxe driver Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 19/31] JadePkg: Add ACPI tables to support PCIe Nhi Pham
2021-10-26 12:54   ` Leif Lindholm
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 20/31] JadePkg: Add ASpeed GOP driver Nhi Pham
2021-10-22  6:17 ` [edk2-platforms][PATCH v4 21/31] AmpereAltraPkg: Add Random Number Generator Support Nhi Pham
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 22/31] JadePkg: Add SMBIOS tables support Nhi Pham
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 23/31] AmpereAltraPkg: Add DebugInfoPei module Nhi Pham
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 24/31] AmpereAltraPkg: Add configuration screen for PCIe Nhi Pham
2021-10-26 12:56   ` Leif Lindholm
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 25/31] Ampere: Utilize the PCIe User setting Nhi Pham
2021-10-26 12:57   ` Leif Lindholm
2021-10-22  6:18 ` Nhi Pham [this message]
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 27/31] AmpereAltraPkg: Add configuration screen for Memory Nhi Pham
2021-10-26 12:58   ` Leif Lindholm
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 28/31] AmpereAltraPkg: Add configuration screen for CPU Nhi Pham
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 29/31] AmpereAltraPkg: Add configuration screen for ACPI Nhi Pham
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 30/31] AmpereAltraPkg: Add configuration screen for RAS Nhi Pham
2021-10-22  6:18 ` [edk2-platforms][PATCH v4 31/31] AmpereAltraPkg: Add configuration screen for Watchdog timer Nhi Pham
2021-10-26 13:03   ` Leif Lindholm
2021-11-03  9:36     ` Nhi Pham
2021-10-26 13:08 ` [edk2-platforms][PATCH v4 00/31] Add new Ampere Mt. Jade platform Leif Lindholm
2021-11-03  9:37   ` Nhi Pham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211022061809.31087-27-nhi@os.amperecomputing.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox