From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.106]) by mx.groups.io with SMTP id smtpd.web12.9721.1637167857639626033 for ; Wed, 17 Nov 2021 08:50:57 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@os.amperecomputing.com header.s=selector2 header.b=CaZ0Rrao; spf=pass (domain: os.amperecomputing.com, ip: 40.107.244.106, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NvODhNo1Ped4hY8rbjuv+dHjW3KIJPvS5k4E1xaYhGFG7dAir9jDQ9I6Zln995/20QeRWnJlWOI96T36c3ZxgxnB9WTw6wyQcQNSkTJTmfw5VOrQMd7XxPRdadmbtWXhoFQhgf/0IXo0ymz921rPZ4PFtTK08R0LjUVtJ0v/J5X9jo3bAe1F/d4Ks3RtmNL80WOlYEEsdDHaUShSlrAQjBMgYNtRcacT4TUaSw+04R+loruEV+A0OmovE9F6emwoFqiYY9UP+YTeVyhtiQ1BTvpjv3Xk9VGGuvtGvM2ksbjJojEuyNQUh8X/MxSvaX9/GZ/wrcI9mDkQrpnsJ4wcyA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YgmFyp8rHTwjXAQG4mdxKlUkKizuq49vHG9QWF+xMR8=; b=OyV9A6v4l0NCqgD7fEFpdrCeGZh6O7wDkB650NX5qTXSU3RwhesaQmKJIOc3IapVfcylhJBbBYREq1XrjX+G4gtdGlx5k3SvjAM5AWPLb/OVDoNb2RpnlzHhO54w9lFqqPdQkJG4rI5iBk7OQeTCYk7TKojaptV+GNtJtUN73N/cG8k5ZNPzVFFCM1VU0eszvLQ13UOO3bFv1kyVHaLUmfr+lt57M2WEHpc4DV60zuzLTI/UYQLyeAmhDHiWWzZuiHe7K/3I9hpZEl72ZXKKZatWcTvojRn7ARBl1/WAILBswyRsbycAEwIVAKFh7Ivb0Jwq6mGSe7USkdW0Pz/SBg== 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=YgmFyp8rHTwjXAQG4mdxKlUkKizuq49vHG9QWF+xMR8=; b=CaZ0RraoyXJfEpFfPBuLnRqdzyw8LCcvEQE6EjLlL8KUjdU7ADCZ2MyovA30Jx+BlcEEEyarHck5rAVtMuNTGyKbRzdxw5wJSxwFTJ5Pf7rbKksgKI1SyVqLmNw1k8x7AuYOGRhU60FvpQoZdveSNmIDlE5ev+w1HZaRtyRjKc0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:56 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:56 +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: [edk2-platforms][PATCH v5 25/30] AmpereAltraPkg: Add platform info screen Date: Wed, 17 Nov 2021 23:47:22 +0700 Message-ID: <20211117164727.10922-26-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de788acf-b6b6-409c-d26d-08d9a9ea6ca1 X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: 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: /ZPJISiWSUb/cMu0fyS74VwXFvEnn81bX4V61LGjT88X5T8dqfzojVAtOAcn2BzuGyBVBCFNy5VKktD3jaioGlwqmZnfcV9/zPwyQ+LYT3t/Md97DDHWUVdfKnEIssjib05IdmpvN2p4287lADbEOh5INLWJ0abAyytPQQ6++zhQKyYrnMvQoGr73B6WbcOBg0/zKacZ/u/7Htzdfr5tsI0IysXQjaIhfpQlvK+huG74yZ4pwySQ628aseiwZcKcVZamO/4PnJ7S3RdXlQ7HujBf/V9WWVilkK16cLLvtFZZEEa3wwxe8NDab0Ec75uEMI14xklszOE/KbVTuaZayONW4/LLgvCNMUVcU6S3Sr4e4MwmDFfRlot6YaXyNJbLc9WG+CrXDO8K13zfbBY4vT/OJomCFcNacWFEjbo6sJbqZihFR2RxZNFGnlvBGcGLlHDu9rq91RiJPxUpPt3H5s2I04YkL3/zBosatbP8aOoY7Vtxlu1EKKpDNRQ/XbcUXUMy6Y+bvtFu0p+HiKHTxhCTNPnYQzMEzvdxxnGUQJ8/t/AQKmvcXbxmnlnVO5QK5Vkhe0qvPN33ZbPNXyc+cMhdJYdyhVeHPIPAUK1JnI/Q3ZPFlYBw3w4YEVo53p/pD+eUJ+Wac9XugEvRV2t0cDcpUoHDHjDgBdX5wIxbsdL5E9cADddGcd+MOEglSj2b3c+cBaYTNMZtBwIBmexecWIijR53ScNItSRMeA73s7A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(54906003)(316002)(1076003)(8676002)(6506007)(4326008)(52116002)(86362001)(186003)(6512007)(6916009)(66556008)(2906002)(83380400001)(66476007)(956004)(38100700002)(8936002)(2616005)(38350700002)(6666004)(5660300002)(66946007)(30864003)(6486002)(508600001)(26005)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yXZZ7JfnBuVxkq14TrQ9c5YUJuD2fETGL86vogl9RhJG9TzW8mO4lJxtfveR?= =?us-ascii?Q?yonNNV/3TJRzEjagQAIw5USC1gvkoLsbxgcb34lTQ5nKQJMcAnExGvi70JcJ?= =?us-ascii?Q?2McZd2yqyM/X1qz2tnl8h6EwyW7C26mtaiCHb3A/NUKV5rAds0DAPqEHWzm/?= =?us-ascii?Q?5gIl1/lZJJzUYKQWnRjK0C8g0qoRMPpxkFW1P4QAH3iZ8P50ncbqarV06KWz?= =?us-ascii?Q?XabC8WZd6fDpnhES4wp/tPeJNWONqmMhhIiQJtGKcdwfIpiYIVesU+/F+vyZ?= =?us-ascii?Q?yM90M+LMRf8M4z3V+IuiG0TZYBa93Uw7eR6dQIi7LkeBPTrrKZ21KpgmPaTS?= =?us-ascii?Q?43m2Ch1808B3G6Sq6a0VTiS6r7AzGlgYMyWfc1oeqzjMjEwV205dzgroOmUu?= =?us-ascii?Q?DI1sbuK3SsdE7n3ismDDm/ae0INc86A12TvanBpXjVd089alxCLwBbO17UyE?= =?us-ascii?Q?ZTtK6yBzt7ER3IbHqqBJz4RMkylUAPy7usddiVYyM7r8j7mb/viseeXqFoEE?= =?us-ascii?Q?SVFlUTu8tiDEVcxdLhLp37JOvoBSy6ge73UlhGA6hvr0wsumorEoZAQi0bu6?= =?us-ascii?Q?hBgfYEVtVmYLhKN6qLDnJl0McYsoeuvbGgx6E+QQwLp+fQvcr4RdEuTcGTq1?= =?us-ascii?Q?4CdNV+S0TcwP1ywIRMF+fXzaxC3g4nNsOM+FA/XsqmyLRuYW9tKieeh3aF/Y?= =?us-ascii?Q?2hqCS0jz6AYdKNubEjnL+IeQ/nnTFCGEuJ7xmBY9qNhl7CDhfjso0vUOpC9R?= =?us-ascii?Q?bxqiTHtz6BTiqyeYSXlqG1EaQaMG29W87c/RWd9Aw4c2q+VAUn1YCFlN9wsA?= =?us-ascii?Q?OQvu9TB2xtRP6Q5hO4T0z+TsqU98dWWfHlC1P7BukFJEbrOfgrv9hZ4MvyXa?= =?us-ascii?Q?eo8luo0iXjp1PEAFAy8z7WIK9ndvSJm7cFADDoXjRyfjpBEojhyjI6JFN7iR?= =?us-ascii?Q?99gcNtVqFdDQSLOug/1UG1UaPRSL3EKZH0iIXPKQkMUJpOb+FzyXRItlX7Eo?= =?us-ascii?Q?Z6BIRZpFSPY69umAq03SnjDxKZYaXDZE+Z6H5KCbuaUEfU84VDSW5asQbuYv?= =?us-ascii?Q?7nHBkD4V55hjOLCKkR+bmK3m+rosJyJQYmR4rTPfRBEKkIegHosFXageOgXI?= =?us-ascii?Q?RuZ/yqAB223tWDyyldiZ0QL0sWQaC7n4D/tYrJv31gh5oK4ZzCkCqGHFQpwC?= =?us-ascii?Q?3DzU9UD7pfMVt3diA6UJ/FHu3SO/MqMYAOd2fjpKWjDK1Hz9vwM75/UN3/vd?= =?us-ascii?Q?UyOxGgyODtDnYmJzVIOOq174dYaQjeG8OlxmzswFAgqvf+3cJV7yOs+X0da/?= =?us-ascii?Q?45LWaqUshye6DlEwpQk53AN4BaUNanYLQLnOe82JaG84cTnCvRhVC0h7bl0V?= =?us-ascii?Q?c2m5SNX68k6XlB3/QxyEuQ3bfM7agrUy4VGMtNpS4FCwTQhl1/o1eOBI/Cf4?= =?us-ascii?Q?RFZ6KHsAZPxWVeGroB7N+b5siIEkzggh7xVr8xkb/OPOsF6iQ2CxSnF9zYHj?= =?us-ascii?Q?EQX9qFZucjrbhQmILaAPYttoEYi1D7zlflSUwli3hjAz6WP6GDWdwTsGQSQL?= =?us-ascii?Q?x1POnrjDi2tqCXr50IY6zLFiMUPhcF6Hbrufo5nlNKetsae11P/uqRbvPHew?= =?us-ascii?Q?Sru8zdXKq+ruyK/v5lVszs5ZL0C/0shlSXesx5ibT3lQJc7rBvm9XKDe6fdR?= =?us-ascii?Q?IefZ6FFLTur/6rHYcB1GyA/DarI=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: de788acf-b6b6-409c-d26d-08d9a9ea6ca1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:56.2100 (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: kmTA7M5mICsKYwftHfFsXQgEYRjQwBRVxMz0khez/Y9WEmwImJuveCOLLAdqFrdsafsmYAUy04/xw0Tx7Q9Fm/Y81fiLoJizvbt9z8Wchhk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf = | 52 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h = | 22 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr = | 112 ++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c = | 390 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.= uni | 56 +++ 7 files changed, 634 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 6c4294bef159..deddd3b5fdde 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -186,3 +186,4 @@ [Components.common] # HII # Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexCo= nfigDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.in= f diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index f7ef95247f79..3109bc225f5d 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -352,5 +352,6 @@ [FV.FvMain] # HII # INF Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootCompl= exConfigDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/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..e04422249b76 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe= .inf @@ -0,0 +1,52 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +# +# 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 + gPlatformInfoHobGuid + +[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..82d2cf131c16 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe= .c @@ -0,0 +1,390 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (&gPlatformInfoHobGuid); + 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