From: "Leif Lindholm" <leif@nuviainc.com>
To: Nhi Pham <nhi@os.amperecomputing.com>
Cc: devel@edk2.groups.io, Vu Nguyen <vunguyen@os.amperecomputing.com>,
Thang Nguyen <thang@os.amperecomputing.com>,
Chuong Tran <chuong@os.amperecomputing.com>,
Phong Vo <phong@os.amperecomputing.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Nate DeSimone <nathaniel.l.desimone@intel.com>
Subject: Re: [edk2-platforms][PATCH v2 10/32] AmpereSiliconPkg: Add PlatformManagerUiLib library instance
Date: Sat, 5 Jun 2021 00:37:19 +0100 [thread overview]
Message-ID: <20210604233719.qfz3c3waqqaqaxpv@leviathan> (raw)
In-Reply-To: <20210526100724.5359-12-nhi@os.amperecomputing.com>
On Wed, May 26, 2021 at 17:07:02 +0700, Nhi Pham wrote:
> From: Vu Nguyen <vunguyen@os.amperecomputing.com>
>
> The idea came from DeviceManagerUiLib that all related menu settings can be
> placed under a common entry. This change intends to provide a central point
> for all platform menus by creating a Platform Manager entry located under
> Device Manager entry of UiApp.
>
> New classuuid called gPlatformManagerFormsetGuid was introduced for
> platform menus which want to be reached through this Platform Manager.
>
> 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: Vu Nguyen <vunguyen@os.amperecomputing.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
/
Leif
> ---
> Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | 19 ++
> Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 1 +
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.inf | 47 +++
> Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h | 31 ++
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.h | 51 +++
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.h | 28 ++
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.c | 354 ++++++++++++++++++++
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerStrings.uni | 21 ++
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.uni | 13 +
> Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.Vfr | 29 ++
> 10 files changed, 594 insertions(+)
>
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
> index 26e020715290..a72205aa5316 100755
> --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
> +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
> @@ -22,12 +22,31 @@ [Defines]
> #
> ################################################################################
> [Includes.common]
> + Include # Root include for the package
>
> [LibraryClasses]
>
> [Guids]
> gAmpereTokenSpaceGuid = { 0xdbd4436e, 0x89cb, 0x44dc, { 0xb5, 0xc0, 0x49, 0xc3, 0x91, 0x35, 0xbf, 0xdf } }
>
> + #
> + # Platform Manager formset UUID
> + #
> + ## Include/Guid/PlatformManagerHii.h
> + gPlatformManagerFormsetGuid = { 0x83ABD546, 0x7AD9, 0x4DE7, { 0xBD, 0x52, 0x12, 0x23, 0xF6, 0xE8, 0xFD, 0x4B } }
> +
> + #
> + # Platform Manager entry UUID
> + #
> + ## Include/Guid/PlatformManagerHii.h
> + gPlatformManagerEntryEventGuid = { 0x28A4731E, 0x14A9, 0x488A, { 0xA8, 0x19, 0xFF, 0x27, 0x80, 0x6E, 0xDB, 0x0E } }
> +
> + #
> + # Platform Manager exit UUID
> + #
> + ## Include/Guid/PlatformManagerHii.h
> + gPlatformManagerExitEventGuid = { 0xE8887242, 0x4EFF, 0x4323, { 0x81, 0xF4, 0xC9, 0x5F, 0xD5, 0x8D, 0x80, 0xD5 } }
> +
> [Ppis]
>
> [PcdsFixedAtBuild]
> diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
> index 65973569a41d..3c47099b8edc 100755
> --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
> +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
> @@ -649,6 +649,7 @@ [Components.common]
> MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> MdeModulePkg/Application/UiApp/UiApp.inf {
> <LibraryClasses>
> + NULL|Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.inf
> NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
> NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.inf b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.inf
> new file mode 100644
> index 000000000000..1cc5788bcebb
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.inf
> @@ -0,0 +1,47 @@
> +## @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 = PlatformManagerUiLib
> + MODULE_UNI_FILE = PlatformManagerUiLib.uni
> + FILE_GUID = 9264993E-2E15-478A-8928-14573E34C606
> + MODULE_TYPE = DXE_DRIVER
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION
> + CONSTRUCTOR = PlatformManagerUiLibConstructor
> + DESTRUCTOR = PlatformManagerUiLibDestructor
> +
> +[Sources]
> + PlatformManager.h
> + PlatformManagerVfr.Vfr
> + PlatformManagerStrings.uni
> + PlatformManager.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
> +
> +[LibraryClasses]
> + DevicePathLib
> + BaseLib
> + MemoryAllocationLib
> + UefiBootServicesTableLib
> + BaseMemoryLib
> + DebugLib
> + HiiLib
> + UefiLib
> + UefiHiiServicesLib
> +
> +[Guids]
> + gPlatformManagerFormsetGuid ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)
> + gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode)
> + gEfiIfrFrontPageGuid ## CONSUMES ## GUID (Indicate the formset in this library need to display in which page)
> + gPlatformManagerEntryEventGuid ## CONSUMES ## GUID (Indicate enter PlatformManager)
> + gPlatformManagerExitEventGuid ## CONSUMES ## GUID (Indicate exit PlatformManager)
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h b/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h
> new file mode 100644
> index 000000000000..ee3ca13ddeb1
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h
> @@ -0,0 +1,31 @@
> +/** @file
> +
> + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef PLATFORM_MANAGER_HII_GUID_H_
> +#define PLATFORM_MANAGER_HII_GUID_H_
> +
> +#define PLATFORM_MANAGER_FORMSET_GUID \
> + { \
> + 0x83ABD546, 0x7AD9, 0x4DE7, { 0xBD, 0x52, 0x12, 0x23, 0xF6, 0xE8, 0xFD, 0x4B } \
> + }
> +
> +#define PLATFORM_MANAGER_ENTRY_EVENT_GUID \
> + { \
> + 0x28A4731E, 0x14A9, 0x488A, { 0xA8, 0x19, 0xFF, 0x27, 0x80, 0x6E, 0xDB, 0x0E } \
> + }
> +
> +#define PLATFORM_MANAGER_EXIT_EVENT_GUID \
> + { \
> + 0xE8887242, 0x4EFF, 0x4323, { 0x81, 0xF4, 0xC9, 0x5F, 0xD5, 0x8D, 0x80, 0xD5 } \
> + }
> +
> +extern EFI_GUID gPlatformManagerFormsetGuid;
> +extern EFI_GUID gPlatformManagerEntryEventGuid;
> +extern EFI_GUID gPlatformManagerExitEventGuid;
> +
> +#endif
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.h b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.h
> new file mode 100644
> index 000000000000..49157e0cea47
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.h
> @@ -0,0 +1,51 @@
> +/** @file
> +
> + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef PLATFORM_MANAGER_H_
> +#define PLATFORM_MANAGER_H_
> +
> +#include <Uefi.h>
> +
> +#include <Guid/MdeModuleHii.h>
> +#include <Guid/PlatformManagerHii.h>
> +#include <Library/BaseLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/DevicePathLib.h>
> +#include <Library/HiiLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiHiiServicesLib.h>
> +#include <Library/UefiLib.h>
> +
> +#include "PlatformManagerVfr.h"
> +
> +//
> +// These are the VFR compiler generated data representing our VFR data.
> +//
> +extern UINT8 PlatformManagerVfrBin[];
> +extern UINT8 PlatformManagerUiLibStrings[];
> +
> +///
> +/// HII specific Vendor Device Path definition.
> +///
> +typedef struct {
> + VENDOR_DEVICE_PATH VendorDevicePath;
> + EFI_DEVICE_PATH_PROTOCOL End;
> +} HII_VENDOR_DEVICE_PATH;
> +
> +typedef struct {
> + ///
> + /// Platform Manager HII relative handles
> + ///
> + EFI_HII_HANDLE HiiHandle;
> + EFI_HANDLE DriverHandle;
> +
> +} PLATFORM_MANAGER_CALLBACK_DATA;
> +
> +#endif
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.h b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.h
> new file mode 100644
> index 000000000000..205907d3777a
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.h
> @@ -0,0 +1,28 @@
> +/** @file
> +
> + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef PLATFORM_MANAGER_VFR_H_
> +#define PLATFORM_MANAGER_VFR_H_
> +
> +#define FORMSET_GUID \
> + { \
> + 0x6E7233C5, 0x2B79, 0x4383, { 0x81, 0x46, 0xD8, 0x6A, 0x9F, 0x0A, 0x0B, 0x99 } \
> + }
> +
> +//
> +// These are defined as the same with vfr file
> +//
> +#define LABEL_FORM_ID_OFFSET 0x0100
> +#define ENTRY_KEY_OFFSET 0x4000
> +
> +#define PLATFORM_MANAGER_FORM_ID 0x1000
> +
> +#define LABEL_ENTRY_LIST 0x1100
> +#define LABEL_END 0xffff
> +
> +#endif /* PLATFORM_MANAGER_VFR_H_ */
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.c b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.c
> new file mode 100644
> index 000000000000..1872aa80ed18
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.c
> @@ -0,0 +1,354 @@
> +/** @file
> +
> + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "PlatformManager.h"
> +
> +PLATFORM_MANAGER_CALLBACK_DATA gPlatformManagerPrivate = {
> + NULL,
> + NULL
> +};
> +
> +EFI_GUID mPlatformManagerGuid = FORMSET_GUID;
> +
> +HII_VENDOR_DEVICE_PATH mPlatformManagerHiiVendorDevicePath = {
> + {
> + {
> + HARDWARE_DEVICE_PATH,
> + HW_VENDOR_DP,
> + {
> + (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
> + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
> + }
> + },
> + //
> + // {FC587265-0750-44D1-B68D-D1DDD3F29B0B}
> + //
> + { 0xFC587265, 0x0750, 0x44D1, {0xB6, 0x8D, 0xD1, 0xDD, 0xD3, 0xF2, 0x9B, 0x0B} }
> + },
> + {
> + END_DEVICE_PATH_TYPE,
> + END_ENTIRE_DEVICE_PATH_SUBTYPE,
> + {
> + (UINT8)(END_DEVICE_PATH_LENGTH),
> + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
> + }
> + }
> +};
> +
> +/**
> + Extract device path for given HII handle and class guid.
> +
> + @param Handle The HII handle.
> +
> + @retval NULL Fail to get the device path string.
> + @return PathString Get the device path string.
> +
> +**/
> +CHAR16 *
> +PmExtractDevicePathFromHiiHandle (
> + IN EFI_HII_HANDLE Handle
> + )
> +{
> + EFI_STATUS Status;
> + EFI_HANDLE DriverHandle;
> +
> + ASSERT (Handle != NULL);
> +
> + if (Handle == NULL) {
> + return NULL;
> + }
> +
> + Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);
> + if (EFI_ERROR (Status)) {
> + return NULL;
> + }
> + //
> + // Get device path string.
> + //
> + return ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FALSE, FALSE);
> +}
> +
> +/**
> + Dynamic create Hii information for Platform Manager.
> +
> + @param NextShowFormId The FormId which need to be show.
> +
> +**/
> +VOID
> +CreatePlatformManagerForm (
> + IN EFI_FORM_ID NextShowFormId
> + )
> +{
> + UINTN Index;
> + EFI_STRING String;
> + EFI_STRING_ID Token;
> + EFI_STRING_ID TokenHelp;
> + EFI_HII_HANDLE *HiiHandles;
> + EFI_HII_HANDLE HiiHandle;
> + EFI_GUID FormSetGuid;
> + VOID *StartOpCodeHandle;
> + VOID *EndOpCodeHandle;
> + EFI_IFR_GUID_LABEL *StartLabel;
> + EFI_IFR_GUID_LABEL *EndLabel;
> + CHAR16 *DevicePathStr;
> + EFI_STRING_ID DevicePathId;
> + EFI_IFR_FORM_SET *Buffer;
> + UINTN BufferSize;
> + UINT8 ClassGuidNum;
> + EFI_GUID *ClassGuid;
> + UINTN TempSize;
> + UINT8 *Ptr;
> + EFI_STATUS Status;
> +
> + TempSize = 0;
> + BufferSize = 0;
> + Buffer = NULL;
> +
> + HiiHandle = gPlatformManagerPrivate.HiiHandle;
> +
> + //
> + // 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)
> + );
> + ASSERT (StartLabel != NULL);
> + StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
> + //
> + // According to the next show Form id(mNextShowFormId) to decide which form need to update.
> + //
> + StartLabel->Number = (UINT16)(LABEL_FORM_ID_OFFSET + NextShowFormId);
> +
> + //
> + // 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;
> +
> + //
> + // Get all the Hii handles
> + //
> + HiiHandles = HiiGetHiiHandles (NULL);
> + ASSERT (HiiHandles != NULL);
> +
> + //
> + // Search for formset of each class type
> + //
> + for (Index = 0; HiiHandles[Index] != NULL; Index++) {
> + Status = HiiGetFormSetFromHiiHandle (HiiHandles[Index], &Buffer,&BufferSize);
> + if (EFI_ERROR (Status)) {
> + continue;
> + }
> +
> + Ptr = (UINT8 *)Buffer;
> +
> + while(TempSize < BufferSize) {
> + TempSize += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
> + if (((EFI_IFR_OP_HEADER *)Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
> + Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
> + continue;
> + }
> +
> + ClassGuidNum = (UINT8)(((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
> + ClassGuid = (EFI_GUID *)(VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));
> + while (ClassGuidNum-- > 0) {
> + if (CompareGuid (&gPlatformManagerFormsetGuid, ClassGuid)== 0) {
> + ClassGuid++;
> + continue;
> + }
> +
> + String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL);
> + if (String == NULL) {
> + String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
> + ASSERT (String != NULL);
> + }
> + Token = HiiSetString (HiiHandle, 0, String, NULL);
> + FreePool (String);
> +
> + String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL);
> + if (String == NULL) {
> + String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
> + ASSERT (String != NULL);
> + }
> + TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
> + FreePool (String);
> +
> + CopyMem (&FormSetGuid, &((EFI_IFR_FORM_SET *)Ptr)->Guid, sizeof (EFI_GUID));
> +
> + if (NextShowFormId == PLATFORM_MANAGER_FORM_ID) {
> + DevicePathStr = PmExtractDevicePathFromHiiHandle (HiiHandles[Index]);
> + DevicePathId = 0;
> + if (DevicePathStr != NULL) {
> + DevicePathId = HiiSetString (HiiHandle, 0, DevicePathStr, NULL);
> + FreePool (DevicePathStr);
> + }
> +
> + HiiCreateGotoExOpCode (
> + StartOpCodeHandle,
> + 0,
> + Token,
> + TokenHelp,
> + 0,
> + (EFI_QUESTION_ID)(Index + ENTRY_KEY_OFFSET),
> + 0,
> + &FormSetGuid,
> + DevicePathId
> + );
> + }
> + break;
> + }
> +
> + Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
> + }
> +
> + FreePool (Buffer);
> + Buffer = NULL;
> + TempSize = 0;
> + BufferSize = 0;
> + }
> +
> + HiiUpdateForm (
> + HiiHandle,
> + &mPlatformManagerGuid,
> + NextShowFormId,
> + StartOpCodeHandle,
> + EndOpCodeHandle
> + );
> +
> + HiiFreeOpCodeHandle (StartOpCodeHandle);
> + HiiFreeOpCodeHandle (EndOpCodeHandle);
> + FreePool (HiiHandles);
> +}
> +
> +/**
> + Install Boot Manager Menu driver.
> +
> + @param ImageHandle The image handle.
> + @param SystemTable The system table.
> +
> + @retval EFI_SUCEESS Install Boot manager menu success.
> + @retval Other Return error status.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +PlatformManagerUiLibConstructor (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> + EFI_EVENT PlatformUiEntryEvent;
> +
> + gPlatformManagerPrivate.DriverHandle = NULL;
> + Status = gBS->InstallMultipleProtocolInterfaces (
> + &gPlatformManagerPrivate.DriverHandle,
> + &gEfiDevicePathProtocolGuid,
> + &mPlatformManagerHiiVendorDevicePath,
> + NULL
> + );
> + ASSERT_EFI_ERROR (Status);
> +
> + //
> + // Publish our HII data.
> + //
> + gPlatformManagerPrivate.HiiHandle = HiiAddPackages (
> + &mPlatformManagerGuid,
> + gPlatformManagerPrivate.DriverHandle,
> + PlatformManagerVfrBin,
> + PlatformManagerUiLibStrings,
> + NULL
> + );
> + if (gPlatformManagerPrivate.HiiHandle != NULL) {
> + //
> + // Update platform manager page
> + //
> + CreatePlatformManagerForm (PLATFORM_MANAGER_FORM_ID);
> + } else {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to add Hii package\n", __FUNCTION__));
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + // Signal Entry event
> + Status = gBS->CreateEventEx (
> + EVT_NOTIFY_SIGNAL,
> + TPL_CALLBACK,
> + EfiEventEmptyFunction,
> + NULL,
> + &gPlatformManagerEntryEventGuid,
> + &PlatformUiEntryEvent
> + );
> + ASSERT_EFI_ERROR (Status);
> + gBS->SignalEvent (PlatformUiEntryEvent);
> + gBS->CloseEvent (PlatformUiEntryEvent);
> +
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Unloads the application and its installed protocol.
> +
> + @param ImageHandle Handle that identifies the image to be unloaded.
> + @param SystemTable The system table.
> +
> + @retval EFI_SUCCESS The image has been unloaded.
> +**/
> +EFI_STATUS
> +EFIAPI
> +PlatformManagerUiLibDestructor (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> + EFI_EVENT PlatformUiExitEvent;
> +
> + Status = gBS->UninstallMultipleProtocolInterfaces (
> + gPlatformManagerPrivate.DriverHandle,
> + &gEfiDevicePathProtocolGuid,
> + &mPlatformManagerHiiVendorDevicePath,
> + NULL
> + );
> + ASSERT_EFI_ERROR (Status);
> +
> + HiiRemovePackages (gPlatformManagerPrivate.HiiHandle);
> +
> + // Signal Exit event
> + Status = gBS->CreateEventEx (
> + EVT_NOTIFY_SIGNAL,
> + TPL_CALLBACK,
> + EfiEventEmptyFunction,
> + NULL,
> + &gPlatformManagerExitEventGuid,
> + &PlatformUiExitEvent
> + );
> + ASSERT_EFI_ERROR (Status);
> + gBS->SignalEvent (PlatformUiExitEvent);
> + gBS->CloseEvent (PlatformUiExitEvent);
> +
> + return EFI_SUCCESS;
> +}
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerStrings.uni b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerStrings.uni
> new file mode 100644
> index 000000000000..3bb39413bc4b
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerStrings.uni
> @@ -0,0 +1,21 @@
> +//
> +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +
> +/=#
> +
> +#langdef en-US "English"
> +
> +#string STR_EDKII_MENU_TITLE #language en-US "Platform Manager"
> +#string STR_EDKII_MENU_HELP #language en-US "This selection will take you to the Platform Manager"
> +#string STR_PLATFORM_LIST #language en-US "Platform Configuration"
> +#string STR_MISSING_STRING #language en-US "Missing String"
> +#string STR_EMPTY_STRING #language en-US ""
> +#string STR_EXIT_STRING #language en-US "Press ESC to exit."
> +//
> +// Ensure that this is the last string. We are using it programmatically
> +// to do string token re-usage settings for the Device Manager since we are
> +// constantly recreating this page based on HII population.
> +////
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.uni b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.uni
> new file mode 100644
> index 000000000000..217a7e999dab
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.uni
> @@ -0,0 +1,13 @@
> +//
> +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +
> +#string STR_MODULE_ABSTRACT
> +#language en-US
> +"Platform Manager Library used by UiApp"
> +
> +#string STR_MODULE_DESCRIPTION
> +#language en-US
> +"Platform Manager Library used by UiApp"
> diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.Vfr b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.Vfr
> new file mode 100644
> index 000000000000..bfda75319416
> --- /dev/null
> +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.Vfr
> @@ -0,0 +1,29 @@
> +/** @file
> +
> + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Guid/HiiPlatformSetupFormset.h>
> +#include "PlatformManagerVfr.h"
> +
> +formset
> + guid = FORMSET_GUID,
> + title = STRING_TOKEN(STR_EDKII_MENU_TITLE),
> + help = STRING_TOKEN(STR_EDKII_MENU_HELP),
> + classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
> +
> + form formid = PLATFORM_MANAGER_FORM_ID,
> + title = STRING_TOKEN(STR_EDKII_MENU_TITLE);
> + subtitle text = STRING_TOKEN(STR_PLATFORM_LIST);
> +
> + label LABEL_ENTRY_LIST;
> + label LABEL_END;
> +
> + subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
> + subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
> + subtitle text = STRING_TOKEN(STR_EXIT_STRING);
> + endform;
> +endformset;
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-06-04 23:37 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 10:06 [edk2-platforms][PATCH v2 00/32] Add new Ampere Mt. Jade platform Nhi Pham
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 01/32] Ampere: Initial support for Ampere Altra processor and " Nhi Pham
2021-06-04 23:04 ` Leif Lindholm
2021-06-09 4:50 ` Nhi Pham
2021-06-09 12:40 ` Leif Lindholm
2021-06-15 16:46 ` Nhi Pham
2021-05-26 10:06 ` [PATCH 1/1] UsbCdcNetDxe: Remove reading connection status in SNP GetStatus Nhi Pham
2021-05-26 10:23 ` [edk2-devel] " Nhi Pham
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 02/32] AmpereAltraPkg: Add MmCommunication modules Nhi Pham
2021-06-04 23:05 ` Leif Lindholm
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 03/32] AmperePlatformPkg: Implement FailSafe library Nhi Pham
2021-06-04 23:07 ` Leif Lindholm
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 04/32] AmperePlatformPkg: Add FailSafe and WDT support Nhi Pham
2021-06-04 23:12 ` Leif Lindholm
2021-06-15 16:47 ` Nhi Pham
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 05/32] AmpereAltraPkg: Add DwI2cLib library Nhi Pham
2021-06-04 23:21 ` Leif Lindholm
2021-06-15 16:47 ` Nhi Pham
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 06/32] AmpereAltraPkg: Add DwGpioLib library Nhi Pham
2021-06-04 23:22 ` Leif Lindholm
2021-05-26 10:06 ` [edk2-platforms][PATCH v2 07/32] JadePkg: Implement RealTimeClockLib for PCF85063 Nhi Pham
2021-06-04 23:26 ` Leif Lindholm
2021-06-15 16:48 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 08/32] AmpereAltraPkg: Add BootProgress support Nhi Pham
2021-06-04 23:27 ` Leif Lindholm
2021-06-15 16:48 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 09/32] AmpereAltraPkg: Support non-volatile variables Nhi Pham
2021-06-04 23:36 ` Leif Lindholm
2021-06-15 16:48 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 10/32] AmpereSiliconPkg: Add PlatformManagerUiLib library instance Nhi Pham
2021-06-04 23:37 ` Leif Lindholm [this message]
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 11/32] AmperePlatformPkg: Add AcpiPccLib to support ACPI PCCT Table Nhi Pham
2021-06-04 23:44 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 12/32] AmperePlatformPkg: Add AcpiHelperLib to update ACPI DSDT table Nhi Pham
2021-06-04 23:47 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 13/32] AmpereAltraPkg, JadePkg: Add ACPI support Nhi Pham
2021-06-04 23:50 ` Leif Lindholm
2021-06-15 16:49 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 14/32] AmpereAltraPkg: Add PcieCoreLib library instance Nhi Pham
2021-06-05 0:05 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 15/32] JadePkg: Add PcieBoardLib " Nhi Pham
2021-06-07 22:45 ` Leif Lindholm
2021-06-15 16:50 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 16/32] AmpereAltraPkg: Add PciHostBridge driver Nhi Pham
2021-06-08 22:26 ` Leif Lindholm
2021-06-09 5:29 ` Ard Biesheuvel
2021-06-15 15:54 ` Nhi Pham
2021-06-16 14:20 ` Ard Biesheuvel
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 17/32] JadePkg: Enable PCIe-related libraries and device drivers Nhi Pham
2021-06-07 22:51 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 18/32] JadePkg: Add ASpeed GOP driver Nhi Pham
2021-06-07 22:51 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 19/32] AmpereAltraPkg: Add Random Number Generator Support Nhi Pham
2021-06-08 11:13 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 20/32] JadePkg: Add SMBIOS tables support Nhi Pham
2021-06-07 23:00 ` Leif Lindholm
2021-06-15 16:51 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 21/32] AmpereAltraPkg: Add DebugInfoPei module Nhi Pham
2021-06-07 23:08 ` Leif Lindholm
2021-06-15 16:51 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 22/32] AmpereAltraPkg: Add platform info screen Nhi Pham
2021-06-07 23:10 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 23/32] AmpereAltraPkg: Add configuration screen for memory Nhi Pham
2021-06-07 23:14 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 24/32] AmpereAltraPkg: Add configuration screen for CPU Nhi Pham
2021-06-07 23:15 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 25/32] AmpereAltraPkg: Add configuration screen for ACPI Nhi Pham
2021-06-07 23:20 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 26/32] AmpereAltraPkg: Add configuration screen for RAS Nhi Pham
2021-06-07 23:22 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 27/32] AmpereAltraPkg: Add configuration screen for Watchdog timer Nhi Pham
2021-06-07 23:24 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 28/32] AmpereAltraPkg: Add configuration screen for Pcie Devices Nhi Pham
2021-06-07 23:34 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 29/32] JadePkg: Recover boot options when NVRAM cleared Nhi Pham
2021-06-07 23:46 ` Leif Lindholm
2021-06-15 16:52 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 30/32] AmpereSiliconPkg: Implement PlatformBootManagerLib for LinuxBoot Nhi Pham
2021-06-07 23:50 ` Leif Lindholm
2021-06-09 15:21 ` Nhi Pham
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 31/32] Platform/Ampere: Introduce the LinuxBootPkg Nhi Pham
2021-06-07 23:51 ` Leif Lindholm
2021-05-26 10:07 ` [edk2-platforms][PATCH v2 32/32] AmpereAltraPkg,JadePkg: Support LinuxBoot DSC/FDF build for Jade platform Nhi Pham
2021-06-07 23:58 ` Leif Lindholm
2021-06-09 15:20 ` Nhi Pham
2021-05-27 12:56 ` [edk2-platforms][PATCH v2 00/32] Add new Ampere Mt. " Leif Lindholm
2021-06-04 13:54 ` Leif Lindholm
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=20210604233719.qfz3c3waqqaqaxpv@leviathan \
--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