From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.103]) by mx.groups.io with SMTP id smtpd.web12.10066.1631721651496365630 for ; Wed, 15 Sep 2021 09:00:51 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@os.amperecomputing.com header.s=selector2 header.b=LyJW/d3H; spf=pass (domain: os.amperecomputing.com, ip: 40.107.94.103, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hmW67AsXxvgb/bi5Qz32MqiLP3e4EcYxT5I9UE06n4ZKO8kx7TZmzRD+vVr+Fsnq5gTMY48v43ew5U7pImYqc3oftIYHNj9rOQriOXiUCZzCKJFq5O3FNr+mz+Bj7Cdw3e/Iw0+dSTvCIyooOKx0YfpnrP5BDjXK/NGsQ+23esqk0wciczO5flQ9NSMKPMNVpP6YxhK03bnZoCPHMhq6vMG4rKNAUiBcCzSrMg/ZZRqvXOwOcGQhFjTqVXF18ZLg4mKnltGApAnACa5Gl0RYQ2MJVRYaZwwSA3av8uDY9u/53SjpjC7IKJ9SV2HQtNZVQA9Z4uzFWE8K4VJD2cJuuw== 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; bh=VjXGG1ZbdJG6uKTZzesy2iYrOpu7T5z+s21rbfEH2ZE=; b=L+Z2hfhF2OXoDclYwWykkBZsZuzia249t9M1tQq+AMEkilhqJmZDLW9W/U9oe/QmF/pBPPRyInJHiNpqn+5yNl4I161wpMv+SsB3ypE7eG0Q2j6zK5KJSd8uNbKXqTqknPlXTImGz5cRGXw/ENOsRJsy2xviBBTCqLPAI7e5cWLUd1WG6vu4cRFe7oWpZS3LThZi7ETv7CBLamKUI7o2/4m24DCWtbmZIDmvuShfx+qMhSDdtKXA1AFc5wZvloPd5ti3pyr44sxQ/w5kNDvrFNgpvWEm5P921aq7rMTRTAywOtvE8zXrOa4XoaJf0EnBWg6Lz3b+CHg3LVo0VUOITA== 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=VjXGG1ZbdJG6uKTZzesy2iYrOpu7T5z+s21rbfEH2ZE=; b=LyJW/d3Hucy753Wt3iao/UvinWMn+PN1HpL/h1zbFX1QmAVjhbOD09ZZvcHzz+TcUhhpf+Ri14O2Fz8IyW274Dtlb3HBGK1I6a6f6NlKyYzpbte8wbOr0PW9XxLtkSRSbJeUytY+VBDkk2ocMVj9Ja6h9amGcKVZH3CvLoZWzyg= 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 DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:41 +0000 Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:41 +0000 From: "Nhi Pham" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [PATCH v3 22/28] AmpereAltraPkg: Add platform info screen Date: Wed, 15 Sep 2021 22:55:21 +0700 Message-ID: <20210915155527.8176-23-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e394b3e4-609d-474d-5378-08d97861f2cd X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jjIv6NLsJ06S4MdqBLCasqze+CvVYajb2rJvPd3coYOg2Sjc4Zszg1JOIhR+P17E59cs/k0e1hMBSe/FdsLDEfdJoYSq2eBmonDAuAdbsi+igYLUdNRveF/RSUzm5URbpGlnGpSlPPK41B9qe7mxErhvmohFJCSFRnWj0BDtHvtruDAZm8IbWDqQdS8A1nAvnaIzM7xy0biFvgrgmzuy4q3eh8TwHHEmt2ojxcqoneA4aMOFyyepof40/V9HV9cFK5vvPuuGqaUO1rfTLXSUMA3YcHbpRS+sA5nYO3jlR+ksygQsZKwwJp8eCVqE2OAyAE/ZAITrDDPTOI7MYrbbenxNOQ4PU29Cq+UJwbfoAsAL76lm+aL7p9kRbDl1EltgdW7w3ImoOj45AZOUgOsv/SRbEr3hu009Iq7wr8wEtQHAWQQTYWSeIftA06ApfBesxmGA8ePbeLYXDckMOhsddznm3vdNv8pKgYCN8t9eE83mkWwAy+cYs9z4N6WVEAoVSaBiMxTAmJJPExdNiBuj3b7Sz+xU6p4nKOYTu6ua//QgDFXxD8Y8MQxcxi0YmrW/CtmEX/Eg8S5mE8h4bBBKJ1l4+os49yIapA+soQ27WSjJyeL4NaESeGc05uQsC4GYqwfYKBmBT8Va+YCYIk4sWJiiXQm5fUVzUU7ud1JVmIsZPoCOmPHJBNP13XG2yh+VmbJIgNMdqvc2drNKyyc7IuFR7PNt2f38cH66EzTHxtA= 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)(136003)(346002)(396003)(366004)(376002)(39850400004)(2616005)(38100700002)(38350700002)(2906002)(6666004)(6916009)(83380400001)(30864003)(6512007)(26005)(8676002)(4326008)(186003)(8936002)(478600001)(6506007)(5660300002)(52116002)(1076003)(86362001)(316002)(66556008)(54906003)(956004)(6486002)(66476007)(66946007)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NbYnxZFbZQkzWhTqnFXk+JuP87VRnI2pyC7v60I7Tg3FJQYRHs51niu9E7Ry?= =?us-ascii?Q?nbjx/+R5Vp+NUEukWRrSDYX57NbPcN2eY1lT/kqvU+eQXWOOUiBWr8LNv0Mr?= =?us-ascii?Q?6cP+nN53ZhxEpEoJz7xo98vXn7hOrnwtEHrFGzD9E5cCDIEnlkTUbik3cYqW?= =?us-ascii?Q?dhT71+uieBKDjAkKOKHZmwzb38SQ+xT6ThBEHln1g6fpphno9FquHcgMYa6O?= =?us-ascii?Q?/Ux222r1LrQjpAeib708M5pjnrXo/1RtWg8yVoM2qZcFTfSx7q9KVKUILQ81?= =?us-ascii?Q?YWWFpAH2n8or8TlGOXhNZnvCZMSpBpvCdK+KZxMuxbkCo2kXPsG4osD7gsUE?= =?us-ascii?Q?RsBYEB6UCRof69ubqx/Jv+Lqn8GikI3yJMGxV95PoFcPN4rVrK1DWKdvn3dI?= =?us-ascii?Q?9VQtRniyqltKSQAgY+TbjodRi5AV47oiWjTkPhoSF4MNYMb9evUY6vvVusiA?= =?us-ascii?Q?EXuYnL+pHDIoH+Y+cIHiZOx+ShhZjpJzESBi69WjnAX33VDcSIm9NJlHGeEx?= =?us-ascii?Q?BTNMSVd99lsVtKS67W2k8Gi2td2N71BAWn24GKaRY2fTh5J/a+YWVckehxUp?= =?us-ascii?Q?23Y8h9+BNq8yl/yGR1gWIaoeZpEUDDb/8+WaZ/EbB+a64R8o+J6wppmWCZCl?= =?us-ascii?Q?M/6gUjcEZaFH/FPshqXQGWB/2Sx/w4yl5BembP8PAA8JK3HmtZ2GaHFF50wj?= =?us-ascii?Q?oCn8AHP5Y6hk7K98mAI/923+naD9cdiieJNeJUr/weNnO3XTjkKGCMVtR+Mr?= =?us-ascii?Q?NRLrYnSBfSjJaU9FwpZKrGiGM2REbfQI+Vvr9F1NSGs3kR+B/K35SaRcZTBu?= =?us-ascii?Q?A0m9iNtYjPqAgYU8b46GYWvqWt5WrZH1r+/2Z29ayN4Jqw+49Mwnala+WaE2?= =?us-ascii?Q?yQzPK6FXG2Ckdj0urNWl5E0fvhYiOcUKnOCvvKCxmKBnJqJikRAp6grWdocl?= =?us-ascii?Q?Us5ShZnvQLH/ElcWT0Bk/Vp8FfZaRRfYc+u+t2DLVyv1a7eWbHkDuppQOwIC?= =?us-ascii?Q?QlclQDjQzgiDR6cQnAGRDzr569XuvkBVSmTkub84QIZezWM3hzBof4HNg8Oh?= =?us-ascii?Q?Bcle+a3+SCCrbNs8QnoIet4JxcxPKICrob2/9BqYQeFJAlqslwnHceI7Z8YQ?= =?us-ascii?Q?y9tbmXsUBvWPvhjJMuUF53AuDU4NaKFh2CBBIdoKnRdMErtxFEJwGvBzHxrT?= =?us-ascii?Q?OQnuk0FIKnaHH9Mp+YGkNcrCFmlwBcKY60/noApLiVevTj8P8gDgvRUGqJkM?= =?us-ascii?Q?7ciS4Fmr6FQ3wuP0gVtZhW3WXhBBKUj22qIyj0NfCQN5Ue9E+NF0ri3zXTS4?= =?us-ascii?Q?YyW7qOEURL7Xf40+g8qQokCD?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e394b3e4-609d-474d-5378-08d97861f2cd X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:33.3957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z3l4KHnF5KqikVXOyTwkj6SRoaGfrw5IKwTE65Zgtvi2YaxuSEFSyyFe4S71d5oH1iqu4HhbgIy888VcXBa+aKed2w1fTeM1UXIRgaazeOY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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 --- 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/PlatformInfoVfr.vfr = | 112 ++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c = | 391 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.= uni | 56 +++ 7 files changed, 643 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 5b40d552e2e5..f723be6997e6 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -192,3 +192,8 @@ [Components.common] Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf + + # + # HII + # + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.in= f diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 56a54b307f04..c54b46f95ad5 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -351,4 +351,9 @@ [FV.FvMain] INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.in= f INF Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.in= f =20 + # + # HII + # + INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf + !include Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platfor= mInfoDxe.inf new file mode 100644 index 000000000000..a55983dd738e --- /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 =3D 0x0001001B + BASE_NAME =3D PlatformInfoDxe + FILE_GUID =3D 6FDFB3E8-105E-48C4-94AA-3D7646F9B50D + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D 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 + gPlatformHobGuid + +[Protocols] + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoHii.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformI= nfoHii.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/Platform= InfoVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platfor= mInfoVfr.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. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PlatformInfoHii.h" + +formset + guid =3D PLATFORM_INFO_FORMSET_GUID, + title =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM), + help =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + form + formid =3D PLATFORM_INFO_FORM_ID, + title =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM); + subtitle text =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM_HELP); + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_BOARD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_BOARD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_BOARD_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPVER), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPVER), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPVER_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK_VALUE), + flags =3D 0, + key =3D 0; + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformI= nfoDxe.c new file mode 100644 index 000000000000..6308ed4b4f3c --- /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 PlatformInfoVfrBin[]; +extern UINT8 PlatformInfoDxeStrings[]; + +EFI_HANDLE mDriverHandle =3D NULL; +EFI_HII_HANDLE mHiiHandle =3D 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 =3D PLATFORM_INFO_FORMSET_GUID; + +HII_VENDOR_DEVICE_PATH mPlatformInfoHiiVendorDevicePath =3D { + { + { + 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 =3D GetFirstGuidHob (&gPlatformHobGuid); + if (Hob =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + PlatformHob =3D (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, MA= X_STRING_SIZE); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_SCPBUILD_VALUE), + Str, + NULL + ); + + /* CPU Info */ + AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->CpuInfo, Str, MAX_STR= ING_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_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_CPUCLK_VALUE), + Str, + NULL + ); + + /* PCP clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->PcpClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_PCPCLK_VALUE), + Str, + NULL + ); + + /* SOC clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->SocClk / MHZ_SC= ALE_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_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_AHBCLK_VALUE), + Str, + NULL + ); + + /* SYS clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->SysClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_SYSCLK_VALUE), + Str, + NULL + ); + + /* Initialize the container for dynamic opcodes */ + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + /* Create Hii Extend Label OpCode as the start opcode */ + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + ASSERT (StartLabel !=3D NULL); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + /* Create Hii Extend Label OpCode as the end opcode */ + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + ASSERT (EndLabel !=3D NULL); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D 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 !=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformInfoHiiVendorDevicePath, + NULL + ); + mDriverHandle =3D NULL; + } + + if (mHiiHandle !=3D NULL) { + HiiRemovePackages (mHiiHandle); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +PlatformInfoEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformInfoHiiVendorDevicePath, + NULL + ); + ASSERT_EFI_ERROR (Status); + + // + // Publish our HII data + // + mHiiHandle =3D HiiAddPackages ( + &gPlatformInfoFormSetGuid, + mDriverHandle, + PlatformInfoDxeStrings, + PlatformInfoVfrBin, + NULL + ); + if (mHiiHandle =3D=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformInfoHiiVendorDevicePath, + NULL + ); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D 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/Platform= InfoStrings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Pla= tformInfoStrings.uni new file mode 100644 index 000000000000..235d104c217f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStr= ings.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 "Platf= orm Board Information" +#string STR_PLATFORM_INFO_FORM_HELP #language en-US "Platf= orm 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. J= ade" + +#string STR_PLATFORM_INFO_SCPVER #language en-US "SCP F= W Version" +#string STR_PLATFORM_INFO_SCPVER_VALUE #language en-US "0" + +#string STR_PLATFORM_INFO_RCVER #language en-US "Refer= ence Code version" +#string STR_PLATFORM_INFO_RCVER_VALUE #language en-US "0" + +#string STR_PLATFORM_INFO_SCPBUILD #language en-US "SCP F= W 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 C= lock" +#string STR_PLATFORM_INFO_CPUCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_PCPCLK #language en-US "PCP C= lock" +#string STR_PLATFORM_INFO_PCPCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_L1ICACHE #language en-US "L1I C= ACHE" +#string STR_PLATFORM_INFO_L1ICACHE_VALUE #language en-US "0KB" + +#string STR_PLATFORM_INFO_L1DCACHE #language en-US "L1D C= ACHE" +#string STR_PLATFORM_INFO_L1DCACHE_VALUE #language en-US "0KB" + +#string STR_PLATFORM_INFO_L2CACHE #language en-US "L2 CA= CHE" +#string STR_PLATFORM_INFO_L2CACHE_VALUE #language en-US "0KB" + +#string STR_PLATFORM_INFO_SOCCLK #language en-US "SOC C= lock" +#string STR_PLATFORM_INFO_SOCCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_SYSCLK #language en-US "Sys C= lock" +#string STR_PLATFORM_INFO_SYSCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_AHBCLK #language en-US "AHB C= lock" +#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 "" --=20 2.17.1