From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.117]) by mx.groups.io with SMTP id smtpd.web11.4131.1607505884000861294 for ; Wed, 09 Dec 2020 01:24:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=dpymH07L; spf=pass (domain: os.amperecomputing.com, ip: 40.107.220.117, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IjBy34l6uqJObaCC/HPi3dxXFNrv2634yqjc88NrLW/grUERef4Oq6JXYwBcGPolG88DIDx/2XqIACzviJeZgLWhbY+qiF73QW1RrQREEWxTs6PCxAalniSBtWNRtHEscQ7fGVQAYARWFtx4nAQd5pqhAkgCa06M8zvyuahwn/i3Hkn0bM6UkIBAcwcVv8XiULB89D+kMhTosFs0ZIW13Q7TLfHodExMbNfI+Kgs7XZ+caCZZpRqpvQ/vYFwLQmmOuPS7szhlLYJ26pvdXCfQZJ7cEakI0qqxt06jAri9RJmLD0dkModM8MKAXtbvOx54viC+UDGygJ29UYItd8QpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aisILFKoA1xjEM1uvw94giNOb8kZPkMAO6LqA9+HSlw=; b=mJZ9/4fGUrPNKs+CLP4GQSylE0W1wPPDsFAqK6OsHboI6MfI3KOWx9V4N4TxOkcMCUZGl2KvOVDlsGhnBxiyaUAcoQcK5VONYHzyODr/PiL3+JUDV0eeeCA4KOCeZL4Nl4XjwIIbWv0+o/qAOHr7afrkkdQmoANT2rd20hNB+WSAPKkwJA/fYEgYp/AYzkXkOqxu08bp0t2k3LFgKdxlA+uwD2oO4H7y6kPCSCNAuAtGfC+bob+lwR6oyZb5LC+zLZLsPSl0/1v/118dIEZ1gqTYHjCjITBFkuSooxRmeb81G9sO1XZlNEuv2Rq1glh7pVlbXL2KRBIHGwpVwnhdgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aisILFKoA1xjEM1uvw94giNOb8kZPkMAO6LqA9+HSlw=; b=dpymH07L+wDDRu6W/0k3agO3KJkF+OzYJWjhDYYvezTo2FcDMsQWAQ4u6Y3BjVPytkN+aBd3lnzOUp0IkthqBhFEm+P7ieqSdMi1ttL5vowOk6kI9Gh0w2esbiQ1aiGfjGlWxA00wyYc7U1riJRkWZlUEXFoAzTWfQDJo5LPqIY= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5609.prod.exchangelabs.com (2603:10b6:5:157::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Wed, 9 Dec 2020 09:24:42 +0000 Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::c814:9a08:5c2e:4076]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::c814:9a08:5c2e:4076%5]) with mapi id 15.20.3632.023; Wed, 9 Dec 2020 09:24:42 +0000 From: "Nhi Pham" To: devel@edk2.groups.io Cc: Vu Nguyen Subject: [edk2-platforms][PATCH 21/34] Silicon/Ampere: Add platform info screen Date: Wed, 9 Dec 2020 16:25:18 +0700 Message-Id: <20201209092531.30867-22-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209092531.30867-1-nhi@os.amperecomputing.com> References: <20201209092531.30867-1-nhi@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK0PR01CA0054.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::18) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw004.amperecomputing.com (118.69.219.201) by HK0PR01CA0054.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 9 Dec 2020 09:24:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5320639-8fd8-4481-0b5a-08d89c2442f3 X-MS-TrafficTypeDiagnostic: DM6PR01MB5609: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6poJozpC3Igg26k/o5PswasogSIeWhEljaIxiQXCm9WIbJZz2/5wPabhZZgB2MrJ9m6BAr8rXXqmMozAN6kME8jdl7U8+cWhDGuDEKhEYi+RE85zyDEULeDpPKAT5ndY+vUEL3000qSYbv6aHhbNr5p0PwCYsk0X8lo3ov1hUAe3fezydJilx+sDd7/Q5TwO8aC0LBqS8gsuno3bkg7xYIiR5V8MOFZBanVzx7Psvd55l5V+gZ2VcKmrOqmIKQJyOzTX/EEdzCTdUqFokItB9SKvypRucAK2yQQtJSYZIlFnSSilE210qrKVzzn3kWq1a+/A3A8Mr6QepRMY2v51o967tkfSfZSfQuY3I7iymREEZZBy/BWhuzlvtQreLhsIr9EfGxNa/EsNJ+CzNOgPXg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR01MB5849.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(5660300002)(956004)(508600001)(52116002)(30864003)(66946007)(6916009)(2616005)(1076003)(19627235002)(86362001)(6512007)(66476007)(26005)(8936002)(16526019)(107886003)(6666004)(186003)(6486002)(8676002)(6506007)(83380400001)(2906002)(34490700003)(66556008)(4326008)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?I6u8GtXQhqYlgRDleG5wjzgvJJy6m/SdDwiaID6PoW3vFC2Q7e5UhTvR136N?= =?us-ascii?Q?UZrOj2Q4wCcbeaqpGrc5WuRBq4vD/L9dtMwzcCszzxDRb2SfebBuABSCP1dr?= =?us-ascii?Q?U5BZTYp9RaV0qgbLn14T53NtHNIx0xr+tmCr4tMY8MGLOwiGhG8VSoY6Rq9j?= =?us-ascii?Q?/uavyDxfQdEzjHkFAGE60zi4Fk3Nq2koiSK9cJ9I3BZmp3nJrXPiIzfjI7I7?= =?us-ascii?Q?xWp8U8XZOaGrhLfgISJC6lMV+HSgRyD+jK3FOMDjU2RjYPr9t6tF0OfML2A9?= =?us-ascii?Q?WMpx4FSyumBhevJmsnL6oURN+NtDOmVwt+PfGBsJ+GsJwe8E4ySWPuqAn+2q?= =?us-ascii?Q?5R2OCMhz9og2zN/zwhUZoqR1WRbQMq9cg5DrQI9VzKlTdL/eto9gyqdxz5rb?= =?us-ascii?Q?fwMKh631qt2CNHG5UR2wvlPkksx/5Z2BAHSTFpNacLVhzky03IWntaNHIk4M?= =?us-ascii?Q?PlUzSsj/sk166qyTXn6FRlfW1VDl/kSp6MwOUA6ZmkPQ7FiIDsJqql+DBm+P?= =?us-ascii?Q?hYDwXq4KnMst3oKvoAL8NFY+5cy/YGiTMyfKaA7Q3mXP8UP7NLmbNZj+o5Xi?= =?us-ascii?Q?s62sK30Y4lmgfhddv7u4uxxTw533fY3mwPLTp0OPy3vjnyAWqY+7CtwsgZGe?= =?us-ascii?Q?eoubVjYGSzXSJZ3vdurpiO03f9VR6k4yLY5EMX2QWOCNBu8oJfca68S9bgEH?= =?us-ascii?Q?Tdma0kRvAegg5VcVtWG3to1+H2KxHk77iRIFqeZclTtapblSAJjnG7bfZzuA?= =?us-ascii?Q?0hTEv6kiRkqSgoaezz0Nl/tk1pyU55jSyQRvgjsWjUhhzF30prHyeWDwNlXE?= =?us-ascii?Q?Z2UOCu5Y/qaEWdEaOnONxmmY95IUbe0+6OhxcY7ZLbmZYrFvxcwfIHAhIy8w?= =?us-ascii?Q?tKp0WWq8V4ySDCciHfQqRT434E4M0BpX1+nIOL/6DWx/BxYSQgHkgjSB9q+u?= =?us-ascii?Q?7Y9FlYhunaXEn4cpJ6iyd5FCi2gW1IueVFd0WvNu5Li1IgwNmQczKAd6Xq2i?= =?us-ascii?Q?8dBZ?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2020 09:24:42.7396 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-Network-Message-Id: c5320639-8fd8-4481-0b5a-08d89c2442f3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bBN3w2OmFZuKk0rxBISYdIq8UBubcRZbeW7PCnhTLzFhsp7rjRgx1oUemDKOvLbG2q6WdnbEINuRF6R14219szUlNKkU2HCfgCAAAyzPbLs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5609 Content-Type: text/plain From: Vu Nguyen Provide screen menu with basic platform information include: - Platform name - SCP firmware info - System bus clock frequency. Signed-off-by: Vu Nguyen --- Platform/Ampere/JadePkg/Jade.dsc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 5 + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf | 51 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h | 22 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Vfr.vfr | 112 +++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c | 354 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/VfrStrings.uni | 56 ++++ 7 files changed, 605 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc index bb141cddcc39..fc2b8d8ec13b 100755 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -153,3 +153,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 195ff2322e12..8975f78769a0 100755 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -370,4 +370,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/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..a1a5f79595e4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf @@ -0,0 +1,51 @@ +## @file +# +# Copyright (c) 2020, 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] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Ampere/AmperePkg.dec + Silicon/Ampere/AmpereAltraPkg/Ac01Pkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiBootServicesTableLib + MemoryAllocationLib + BaseMemoryLib + BaseLib + UefiLib + DevicePathLib + DebugLib + HiiLib + DevicePathLib + HobLib + AmpereCpuLib + IoLib + +[Guids] + gPlatformManagerFormsetGuid + gEfiIfrTianoGuid + +[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..1dffd34ec4cd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h @@ -0,0 +1,22 @@ +/** @file + + Copyright (c) 2020, 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..bc74605bd346 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Vfr.vfr @@ -0,0 +1,112 @@ +/** @file + + Copyright (c) 2020, 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..3a5bc53cebcb --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c @@ -0,0 +1,354 @@ +/** @file + + Copyright (c) 2020, 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; + PlatformInfoHob_V2 *PlatformHob; + CONST EFI_GUID PlatformHobGuid = PLATFORM_INFO_HOB_GUID_V2; + 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 (&PlatformHobGuid); + if (Hob == NULL) { + return EFI_DEVICE_ERROR; + } + PlatformHob = (PlatformInfoHob_V2 *) 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 (GetNumberActiveSockets () > 1) { + /* 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..a8800a5e79c2 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/VfrStrings.uni @@ -0,0 +1,56 @@ +// +// Copyright (c) 2020, 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