From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web12.5254.1623107405880511777 for ; Mon, 07 Jun 2021 16:10:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=N29wFcv2; spf=pass (domain: nuviainc.com, ip: 209.85.128.54, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f54.google.com with SMTP id p13-20020a05600c358db029019f44afc845so625017wmq.3 for ; Mon, 07 Jun 2021 16:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pdSngdGgfMiCg4erBho3029xqsHviwyk+XOKDZW0bYw=; b=N29wFcv2BEoH9kwpnT435g3qn/yenkRoGYthtF1oZmEZQejy29jpvp1mcKFdjLhg2Y KZsxM/Iz0afnBWKWAYgi5/7UTmkMkWCbvIOs4Hoj/Wd9NoSPQi9ydVFkPvewKkrKC/E3 1KOgOAlGsHm2HaXRTe2QuyMdQfL73oq7ukbXNLj+eSGQcM/8BbNLEvdXw8LMbWtDNf5p LOoZxDs6mc5oQkkbwnYpxH+bWxOpoTlITGjjdqJwHKjpkMZyUrLp85+4ujUgMNNxA5ql wAQu0hvgX/BQWihPmwuKYYso9dNmKbmnIMY0F4ReO5ljx9qc+sYZ4/HKW41CDTA5OVYG /wkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pdSngdGgfMiCg4erBho3029xqsHviwyk+XOKDZW0bYw=; b=VkYpnmrq690HYwMbzhsnKz0u2LbU+WpIXqMgWY6E+q3chVnijtTQu1oicFdFDMM/At z2J17QjbZt2wXCDY7Xp464iup6vU/QM+b3Yetafs3p9t1puWQt/F+PIQUZ7KRJHByANt Lj7pg2yx9V6H52JJulWgpZzBc2+3VTrWKvJ05iQ2tzWekD7oZa1hwFC56mAu6Q1wdSZC wFTY2R3X8NJgiLHMD2LBZHc5CW+Bhq4nqJlN7qjXD2UwUwRRi5jSmZ4F4/entcqIv+6K 4oYOidmmEnoZVxKlMDz1CQtXn3lgFXf2fSY1ATBAiXQgQCnriGaDMm897VXDz1zLpeyT w93g== X-Gm-Message-State: AOAM5301Bj+2B5OlythZXaAxx2hqwoc+Fkny6yRrOgXlNHAbEe5djcxw 5QgD47CyUVxP0pYmdyFHsw6feQ== X-Google-Smtp-Source: ABdhPJymeJpkRZSPEAJuWW62C0VQRlnevmnNkfpQjcyJrQDBDdXS2SMh1juzB8NAHOCANVVAOjNHjQ== X-Received: by 2002:a05:600c:1c28:: with SMTP id j40mr1247230wms.102.1623107404343; Mon, 07 Jun 2021 16:10:04 -0700 (PDT) Return-Path: Received: from leviathan (cpc1-cmbg19-2-0-cust915.5-4.cable.virginm.net. [82.27.183.148]) by smtp.gmail.com with ESMTPSA id o11sm2265136wmq.1.2021.06.07.16.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 16:10:03 -0700 (PDT) Date: Tue, 8 Jun 2021 00:10:02 +0100 From: "Leif Lindholm" To: Nhi Pham Cc: devel@edk2.groups.io, Vu Nguyen , Thang Nguyen , Chuong Tran , Phong Vo , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: Re: [edk2-platforms][PATCH v2 22/32] AmpereAltraPkg: Add platform info screen Message-ID: <20210607231002.hkwtbkndilffwr47@leviathan> References: <20210526100724.5359-1-nhi@os.amperecomputing.com> <20210526100724.5359-24-nhi@os.amperecomputing.com> MIME-Version: 1.0 In-Reply-To: <20210526100724.5359-24-nhi@os.amperecomputing.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 26, 2021 at 17:07:14 +0700, Nhi Pham wrote: > From: Vu Nguyen > > Provide screen menu with basic platform information include: > * Platform name > * SCP firmware info > * System bus clock frequency. > > Cc: Thang Nguyen > Cc: Chuong Tran > Cc: Phong Vo > Cc: Leif Lindholm > Cc: Michael D Kinney > Cc: Ard Biesheuvel > Cc: Nate DeSimone > > Signed-off-by: Vu Nguyen Reviewed-by: Leif Lindholm / Leif > --- > Platform/Ampere/JadePkg/Jade.dsc | 5 + > Platform/Ampere/JadePkg/Jade.fdf | 5 + > Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf | 52 +++ > Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h | 22 ++ > Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Vfr.vfr | 112 ++++++ > Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c | 391 ++++++++++++++++++++ > Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/VfrStrings.uni | 56 +++ > 7 files changed, 643 insertions(+) > > diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc > index 9c7d7cad4915..b5edb673abba 100755 > --- a/Platform/Ampere/JadePkg/Jade.dsc > +++ b/Platform/Ampere/JadePkg/Jade.dsc > @@ -174,3 +174,8 @@ [Components.common] > Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf > Platform/Ampere/JadePkg/Drivers/SmbiosCpuDxe/SmbiosCpuDxe.inf > Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf > + > + # > + # HII > + # > + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf > diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf > index 8c09e2a49089..6dd759322d9d 100755 > --- a/Platform/Ampere/JadePkg/Jade.fdf > +++ b/Platform/Ampere/JadePkg/Jade.fdf > @@ -350,4 +350,9 @@ [FV.FvMain] > INF Platform/Ampere/JadePkg/Drivers/SmbiosCpuDxe/SmbiosCpuDxe.inf > INF Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf > > + # > + # HII > + # > + INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf > + > !include Platform/Ampere/AmperePlatformPkg/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..09de87915510 > --- /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.
> +# > +# 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 > + Vfr.vfr > + VfrStrings.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 > + gPlatformHobGuid > + > +[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.
> + > + 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/Vfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Vfr.vfr > new file mode 100644 > index 000000000000..5dd32a30f0ad > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Vfr.vfr > @@ -0,0 +1,112 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + 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..a55d0e9da9e7 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c > @@ -0,0 +1,391 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "PlatformInfoHii.h" > + > +// > +// uni string and Vfr Binary data. > +// > +extern UINT8 VfrBin[]; > +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 (&gPlatformHobGuid); > + 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, > + VfrBin, > + 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/VfrStrings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/VfrStrings.uni > new file mode 100644 > index 000000000000..235d104c217f > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/VfrStrings.uni > @@ -0,0 +1,56 @@ > +// > +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> +// > +// 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 >