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.123]) by mx.groups.io with SMTP id smtpd.web10.1189.1684888868854927589 for ; Tue, 23 May 2023 17:41:08 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@os.amperecomputing.com header.s=selector2 header.b=O4elkL/C; spf=pass (domain: os.amperecomputing.com, ip: 40.107.244.123, mailfrom: minhnguyen1@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mCuaAZhO4HeUHJiTlm+cCUDm4npvWHz07xbM/mtbNcd+QLvbzOknXhRGPyJUyvOUlwXasUkKUOEqW4jwrtxUYhQ6O7j5CJrBImUodqAQTnwdByBfSp0Dd0QfGn3UVG36cGcaU09A37GDaXRztWSs1cZ4HfSyooziGepDUy0mHg2RRhyqoqHLeKSJlRa88xFIzbORvBCpF4GYMVxrwVhXRXYdAYP7oiy7Gln2tPUrq6WILIhhHTJb4j6xdBqwDBy9GfkjR9WllY+ZxPyquf+B+fMMKaT1aEyD8yPICylOrS2g3JWA1PjpY14L90p8i/1fEc/gLH1ou8FE5LCn/fjKdw== 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=ud/eI3SF7Ujw2QBzPj1kZh74vzJBys+m5uw7ppRlOXk=; b=VMJ1S9VgEpLbmRWTjt1aev6UyWxjRfp0VvMdrDN8w0xXLuFXAzPsVXuUUOfj+3DmDM4pNGCJV8vrNnF/RG3Y4EPZyG65dwnM/e14IA0v8nsr7FIXtUtEwS8A/GiSdJ72L0E2rjqpF18+iAe1MpwbU2gh/iL2rd1OPEvBWaG6RL3S9OUYB3LyqBGk1rmJ92jxdat+Xc1VHuNQATcXKg92sEcT6IuEpxVLvKca8zRzbhfS9ZEJXw+bBYwTA09G036ygL/csXmYtUO9rUBN8PWtNavgWxchH4kCpXve83M6SLQca0Thn8TDiar3Z8hKu1EXxxQgdHKU4s1xUjWePScZLA== 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=ud/eI3SF7Ujw2QBzPj1kZh74vzJBys+m5uw7ppRlOXk=; b=O4elkL/CYaO7AM/Lk6SyYA9Ea49whfcYrEN7ZQADEQm1Tjix2ZzSRGI7ASi+GYbRxuidMRVF6EbvPOjDg42OI84NQo8gjonVCsW8afTTQJoqlc02V0vUNQ2/zzFps/gRlGD2VIfs1crvgmgFn0XRlsq1sXy7gW9k2qf7zLypQ4w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB8048.prod.exchangelabs.com (2603:10b6:510:280::7) by MW6PR01MB8270.prod.exchangelabs.com (2603:10b6:303:241::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Wed, 24 May 2023 00:41:03 +0000 Received: from PH0PR01MB8048.prod.exchangelabs.com ([fe80::bbdb:b58c:140e:c4e1]) by PH0PR01MB8048.prod.exchangelabs.com ([fe80::bbdb:b58c:140e:c4e1%6]) with mapi id 15.20.6411.019; Wed, 24 May 2023 00:41:03 +0000 From: Minh Nguyen To: devel@edk2.groups.io CC: patches@amperecomputing.com, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, nhi@os.amperecomputing.com, minhnguyen1@os.amperecomputing.com Subject: [edk2-platforms][PATCH 2/4] JadePkg: Leverage ArmPkg/Smbios (Type 0, 1, 2, 3, 13, 32) Date: Wed, 24 May 2023 07:40:35 +0700 Message-ID: <20230524004037.39269-3-minhnguyen1@os.amperecomputing.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230524004037.39269-1-minhnguyen1@os.amperecomputing.com> References: <20230524004037.39269-1-minhnguyen1@os.amperecomputing.com> X-ClientProxiedBy: SI2P153CA0021.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::20) To PH0PR01MB8048.prod.exchangelabs.com (2603:10b6:510:280::7) Return-Path: minhnguyen1@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB8048:EE_|MW6PR01MB8270:EE_ X-MS-Office365-Filtering-Correlation-Id: a630f222-9a5b-493e-09c7-08db5bef8d30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WUq2bLWfK7bFPZFU2mTWjQqnyhzx73aBdmS3eU1Fg/rYS+cTuTJiWyW33fhCwzFNksc4yjvruzlPU5nH/dxI/lzT/gxnm32DYNsjCNhhNdfYyQePutxdwlxJ3EmbluHDuDcH2xvRgc2XJpOMPJJqIB8KOTdf+jlR/uHZ/Nr7bTlwbc+ifj9jY2bma3IxfGkTkO82yhPVp6ovSn1IEIVnis/YjmS0gqMOCA4UVsbM4AKtvFORFrk/o+E+fkBdCBXXD16WWvMdzWzlkMEdMptIjrqmalNJ8/E1HBfqjHDNuU3d3E+ebCUPf4rdGzdUmn92LEgepx0mz8zG5Cb9gJSJ/debz/P/2ef0wJDg73mAbuVQMECmk8AeckOyil+NxSijTMOpAlD0c03hmBOmmkdFY8mqVYsIA/suneFw9OHMrfgU8WBwCBZn2119919kI1EymvSnAnnyGScYnLrKkXWnkj76U8o7u9mr0fNqCijoZPrKUFB31lO9A6/IkxoLDtHF+2YdhyVMVQzRyhTRGZjBfJoQkwj63AgZtqzD16YLgxXa/YLfa7qQ2lPx3HWYh4x5EoJTS/VGW7bAE7KmLqlzx6upj3wuda9zKFMfxtGS3BM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB8048.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(39850400004)(346002)(396003)(366004)(136003)(451199021)(38350700002)(30864003)(83380400001)(41300700001)(2906002)(8676002)(6666004)(6486002)(52116002)(8936002)(5660300002)(38100700002)(2616005)(86362001)(26005)(186003)(1076003)(478600001)(6506007)(6512007)(19627235002)(107886003)(66556008)(66476007)(66946007)(6916009)(4326008)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?u7BdpbaQAxL1RN7yKhWZ6PU4INfvCQT62GQgyqHTJb+ERWf0fofZ1cEK9+mf?= =?us-ascii?Q?XFdMafuHjmJi6+TSbF6rgQ6nln5cBqW+FsbFfRSRiB0uc8EvMs2zdI3l/Hg0?= =?us-ascii?Q?N5lSN32viN0ZCfbqL9MnTN6PY3cIilRPFE82U5pu975dTGFSKnb1BDPQvqYV?= =?us-ascii?Q?NlBmLYrUVYq/c+z8takvHA9H6Vlg+katEJHDMAjo7zVyPmwTTdjQaKqXArHK?= =?us-ascii?Q?ymnnSWdP4tkEIqpO28+Gjen5Pnvgo11N4kpTz2ObH/pcjReo2yqSC3JT0EVH?= =?us-ascii?Q?QyWl5+PO6qB0xPuiGjSkiz2JD4BxVESe9BrXPZoWS0YB6AFOthdkZtprpzeJ?= =?us-ascii?Q?mMr/RibRDjV2xQfe/PHTn2IF/bha8CNJBpJV4EGzC3poCm1l7GBgH6FJwLCG?= =?us-ascii?Q?pznKMfxO7Dyod6QU36OILM/jUCWdEKFV/oS0yr8ul3f9NNA8m2VOpM8qgZys?= =?us-ascii?Q?HKy7jvFvhAEQkeERJ+VzsGtKMhCgkMLLeWTkjwjtX/kGLVJBW8tDIE0KUPcL?= =?us-ascii?Q?R7eQgyENz8iLbU0f3wNXgE3m4YjRUd6oL1i2i2i9bql0EHwZE7Rmij1eY0UI?= =?us-ascii?Q?YHKIhq0H/meIhrxewaCAujlEPkqGfhj+c1xrEcK7vFX5sib/unVS3RasDxim?= =?us-ascii?Q?TRyr8bsbYE1gwMi8fKi+VCOzi+mEwqmdunu8Wy8op0axLgxXPuK9BBzIcZSp?= =?us-ascii?Q?xJ1N7vXGrWD/qKgXzGhh6GpSfTNJU63ayBK2f8DK6D2u9tJFVzW2bJdRIgxu?= =?us-ascii?Q?/XKwQAhma1nLntDAREPzZt1XgRAor4yq5akc2yjNF8LqlexTpyeoxr+8K1PH?= =?us-ascii?Q?Gwyto2jtVC2ydMJp4NtfbA/BpeIgmNBJK+pzA6BUdQdrzSwVzPq7V3CdsNA2?= =?us-ascii?Q?o03HLBMFpaBxowjk8b50/bLUFeExaME1VAbnMpVa1zAzGJT4+wvjJoe9zV+0?= =?us-ascii?Q?l3J7aq+uLfqDX7/Xz80wJ5H1MsFODFulFt5cjpDPNw3homnzUx1j8vdttX0B?= =?us-ascii?Q?pPKGsnfuJR/teia3QWks1uYcpRcue4nnP8WcqbyDn52mZqYREQIW/bjKexF0?= =?us-ascii?Q?aTCJsipFV5RWEvhCEOXqV1ODYVHPRE+LW1m3Uz1lbtxmVL4WUet8KZGec4lh?= =?us-ascii?Q?tZXqYXtPSY6vUA9/wqPex/sZormeVQFxmCK+dA/JCxrgdykpU7b/SyA3eA+W?= =?us-ascii?Q?2KVMSMVR9eupk56HndtsnxQ2OIpjiGpCT8h7NUCqiNgyynOZoJxuBOk8eKw4?= =?us-ascii?Q?zjdwVbTAxNKHoS7ghMNs0EKcofe267h/zgWPS441BStGfRvyIfvSpqPYCwKp?= =?us-ascii?Q?EWRQBKtOJuQrRfXfdMT4MgnQLzHvF/euST0KxjDyVHqm1YnuBcHGOwk+xK6W?= =?us-ascii?Q?iP2CCQjgqWjImjHOc3tswnOpPfBqcekNd3gFd7XfL0xpTPX6dokDO1ZDh05+?= =?us-ascii?Q?gqAFMvydfX2nw4XOcoZeCnHYM3TT12u/vU6ZiqOp1lYkv+enPKf481X+mM+l?= =?us-ascii?Q?oSxAAgIZJ3CRSCQDm702H3ORJu5yX3Vk2XER1SbB7S8MKirZgTYrKkeotjBa?= =?us-ascii?Q?dTmpVFK7Zr+dmu0ZhDy//UojmnWG/lLPKvvEbn1PekYzY/N2kol87eYzrUYt?= =?us-ascii?Q?j1gt87fV9VYqy6yDeK9R5cUixRM3hslNuIfYfy6dBLh1?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a630f222-9a5b-493e-09c7-08db5bef8d30 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB8048.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 00:41:03.1144 (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: sGiCXxFHTtY6scJuiZsgtPjeM0+/Z62H0D5/z0Mp7J/bGmeysWnQyKymbXUOnE18tGA+MB3tbNyM0J7hzgv72aa2HsRlVXMyrePm2ITKKaCEPS8ocyLRgwCHhUx7tvla X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR01MB8270 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This implementation helps SMBIOS Table (Type 0, 1, 2, 3, 13, 32) of Altra and AltraMax platform to utilize framework from ArmPkg. Signed-off-by: Minh Nguyen --- Platform/Ampere/JadePkg/Jade.dsc | = 7 +- Platform/Ampere/JadePkg/Jade.fdf | = 1 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | = 10 - Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf | = 15 +- Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h | = 22 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 470 -------------------- Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c | = 246 +++++++++- Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c | = 42 ++ 8 files changed, 326 insertions(+), 487 deletions(-) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index f14d286cdfb8..2f530740140d 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -117,8 +117,8 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdProcessorManufacturer|L"Ampere(R)" gArmTokenSpaceGuid.PcdProcessorVersion|L"Ampere(R) Altra(R) Processor" =20 - gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion|$(MAJOR_VER) - gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion|$(MINOR_VER) + gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion|$(MAJOR_VER) + gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion|$(MINOR_VER) =20 # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry po= int, # if the entry point version is >=3D 3.0. AARCH64 OSes cannot assume the @@ -137,8 +137,6 @@ [PcdsFixedAtBuild.common] !endif =20 [PcdsDynamicDefault.common.DEFAULT] - # SMBIOS Type 0 - BIOS Information - gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/YYYY" =20 [PcdsPatchableInModule] # @@ -181,6 +179,7 @@ [Components.common] MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf =20 # diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index a578d05330ec..7795f0e11115 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -347,6 +347,7 @@ [FV.FvMain] INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.= inf INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.in= f + INF ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf INF Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.in= f =20 # diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatfo= rmDxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatfor= mDxe.inf index 77148b417b0f..549aa38b1774 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.i= nf +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.i= nf @@ -28,7 +28,6 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib - HobLib MemoryAllocationLib UefiBootServicesTableLib UefiDriverEntryPoint @@ -38,16 +37,7 @@ [Protocols] gEfiSmbiosProtocolGuid ## CONSUMED =20 [Pcd] - # Type 0 - gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate - gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion - gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion - gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString - gArmTokenSpaceGuid.PcdFdSize =20 -[Guids] - gPlatformInfoHobGuid - [Depex] gEfiSmbiosProtocolGuid diff --git a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf b/Pl= atform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf index b67ce01fb27f..9d1a0b7e9e06 100644 --- a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf +++ b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf @@ -1,7 +1,7 @@ #/** @file # OemMiscLib.inf # -# Copyright (c) 2021, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2021 - 2023, Ampere Computing LLC. All rights reserved. # Copyright (c) 2021, NUVIA Inc. All rights reserved. # Copyright (c) 2018, Hisilicon Limited. All rights reserved. # Copyright (c) 2018, Linaro Limited. All rights reserved. @@ -27,6 +27,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec =20 [LibraryClasses] AmpereCpuLib @@ -34,3 +35,15 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion + gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + +[Guids] + gZeroGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h b= /Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h index 94944cbe3abe..c425ed4431da 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h @@ -160,6 +160,28 @@ GetNumberOfConfiguredCPMs ( UINT8 SocketId ); =20 +/** + Get version of SCP. + + @param[out] ScpVer Pointer to contain version of SCP value. +**/ +VOID +EFIAPI +GetScpVersion ( + UINT8 **ScpVer + ); + +/** + Get date of build release for SCP. + + @param[out] ScpBuild Pointer to contain date of build release for SC= P. +**/ +VOID +EFIAPI +GetScpBuild ( + UINT8 **ScpBuild + ); + /** Set the number of configured CPM per socket. =20 diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatfo= rmDxe.c b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformD= xe.c index 32735496ecdc..448912f146ec 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -8,63 +8,19 @@ =20 #include =20 -#include #include #include #include #include -#include #include #include #include #include =20 -// Type0 Data -#define VENDOR_TEMPLATE "Ampere(R)\0" -#define BIOS_VERSION_TEMPLATE "TianoCore 0.00.00000000 (SYS: 0.00.00000000= )\0" -#define RELEASE_DATE_TEMPLATE "MM/DD/YYYY\0" - -#define TYPE0_ADDITIONAL_STRINGS \ - VENDOR_TEMPLATE /* Vendor */ \ - BIOS_VERSION_TEMPLATE /* BiosVersion */ \ - RELEASE_DATE_TEMPLATE /* BiosReleaseDate */ - -// Type1 Data -#define MANUFACTURER_TEMPLATE "Ampere(R)\0" -#define PRODUCT_NAME_TEMPLATE "Mt. Jade\0" -#define SYS_VERSION_TEMPLATE "PR010\0" -#define SERIAL_TEMPLATE "123456789ABCDEFF123456789ABCDEFF\0" -#define SKU_TEMPLATE "FEDCBA9876543211FEDCBA9876543211\0" -#define FAMILY_TEMPLATE "Altra\0" - -#define TYPE1_ADDITIONAL_STRINGS \ - MANUFACTURER_TEMPLATE /* Manufacturer */ \ - PRODUCT_NAME_TEMPLATE /* Product Name */ \ - SYS_VERSION_TEMPLATE /* Version */ \ - SERIAL_TEMPLATE /* Serial Number */ \ - SKU_TEMPLATE /* SKU Number */ \ - FAMILY_TEMPLATE /* Family */ - -#define TYPE2_ADDITIONAL_STRINGS \ - MANUFACTURER_TEMPLATE /* Manufacturer */ \ - PRODUCT_NAME_TEMPLATE /* Product Name */ \ - "EVT2\0" /* Version */ \ - "Serial Not Set\0" /* Serial */ \ - "Base of Chassis\0" /* board location */ \ - "FF\0" /* Version */ \ - "FF\0" /* Version */ - #define CHASSIS_VERSION_TEMPLATE "None \0" #define CHASSIS_SERIAL_TEMPLATE "Serial Not Set \0" #define CHASSIS_ASSET_TAG_TEMPLATE "Asset Tag Not Set \0" =20 -#define TYPE3_ADDITIONAL_STRINGS \ - MANUFACTURER_TEMPLATE /* Manufacturer */ \ - CHASSIS_VERSION_TEMPLATE /* Version */ \ - CHASSIS_SERIAL_TEMPLATE /* Serial */ \ - CHASSIS_ASSET_TAG_TEMPLATE /* Asset Tag */ \ - SKU_TEMPLATE /* SKU Number */ - #define TYPE8_ADDITIONAL_STRINGS \ "VGA1 - Rear VGA Connector\0" \ "DB-15 Male (VGA) \0" @@ -75,9 +31,6 @@ #define TYPE11_ADDITIONAL_STRINGS \ "www.amperecomputing.com\0" =20 -#define TYPE13_ADDITIONAL_STRINGS \ - "en|US|iso8859-1\0" - #define TYPE41_ADDITIONAL_STRINGS \ "Onboard VGA\0" =20 @@ -94,26 +47,6 @@ // the SMBIOS specification (section 6.2, version 3.0) // #pragma pack(1) -typedef struct { - SMBIOS_TABLE_TYPE0 Base; - CHAR8 Strings[sizeof (TYPE0_ADDITIONAL_STRINGS)]; -} ARM_TYPE0; - -typedef struct { - SMBIOS_TABLE_TYPE1 Base; - CHAR8 Strings[sizeof (TYPE1_ADDITIONAL_STRINGS)]; -} ARM_TYPE1; - -typedef struct { - SMBIOS_TABLE_TYPE2 Base; - CHAR8 Strings[sizeof (TYPE2_ADDITIONAL_STRINGS)]; -} ARM_TYPE2; - -typedef struct { - SMBIOS_TABLE_TYPE3 Base; - CHAR8 Strings[sizeof (TYPE3_ADDITIONAL_STRINGS)]; -} ARM_TYPE3; - typedef struct { SMBIOS_TABLE_TYPE8 Base; CHAR8 Strings[sizeof (TYPE8_ADDITIONAL_STRINGS)]; @@ -129,11 +62,6 @@ typedef struct { CHAR8 Strings[sizeof (TYPE11_ADDITIONAL_STRINGS)]; } ARM_TYPE11; =20 -typedef struct { - SMBIOS_TABLE_TYPE13 Base; - CHAR8 Strings[sizeof (TYPE13_ADDITIONAL_STRINGS)]; -} ARM_TYPE13; - typedef struct { SMBIOS_TABLE_TYPE41 Base; CHAR8 Strings[sizeof (TYPE41_ADDITIONAL_STRINGS)]; @@ -141,125 +69,6 @@ typedef struct { =20 #pragma pack() =20 -// Type 0 BIOS information -STATIC ARM_TYPE0 mArmDefaultType0 =3D { - { - { // Header - EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type - sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length, The length of the= structure's string-set is not included. - SMBIOS_HANDLE_PI_RESERVED, - }, - - ADDITIONAL_STR_INDEX_1, // SMBIOS_TABLE_STRING Vendor - ADDITIONAL_STR_INDEX_2, // SMBIOS_TABLE_STRING BiosVersion - 0, // UINT16 BiosSegment - ADDITIONAL_STR_INDEX_3, // SMBIOS_TABLE_STRING BiosReleaseDa= te - 0, // UINT8 BiosSize - - // MISC_BIOS_CHARACTERISTICS BiosCharacteristics - { - 0,0,0,0,0,0, - 1, // PCI supported - 0, - 1, // PNP supported - 0, - 1, // BIOS upgradable - 0, 0, 0, - 0, // Boot from CD - 1, // selectable boot - }, - - // BIOSCharacteristicsExtensionBytes[2] - { - 0, - 0, - }, - - 0, // UINT8 SystemBiosMajorRelease - 0, // UINT8 SystemBiosMinorRelease - - // If the system does not have field upgradeable embedded controller - // firmware, the value is 0FFh - 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRel= ease - 0xFF // UINT8 EmbeddedControllerFirmwareMinorRel= ease - }, - - // Text strings (unformatted area) - TYPE0_ADDITIONAL_STRINGS -}; - -// Type 1 System information -STATIC ARM_TYPE1 mArmDefaultType1 =3D { - { - { // Header - EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, - sizeof (SMBIOS_TABLE_TYPE1), - SMBIOS_HANDLE_PI_RESERVED, - }, - - ADDITIONAL_STR_INDEX_1, = // Manufacturer - ADDITIONAL_STR_INDEX_2, = // Product Name - ADDITIONAL_STR_INDEX_3, = // Version - ADDITIONAL_STR_INDEX_4, = // Serial Number - { 0x12345678, 0x9ABC, 0xDEFF, { 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF= F }}, // UUID - SystemWakeupTypePowerSwitch, = // Wakeup type - ADDITIONAL_STR_INDEX_5, = // SKU Number - ADDITIONAL_STR_INDEX_6, = // Family - }, - - // Text strings (unformatted) - TYPE1_ADDITIONAL_STRINGS -}; - -// Type 2 Baseboard -STATIC ARM_TYPE2 mArmDefaultType2 =3D { - { - { // SMBIOS_STRUCTURE Hdr - EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION, // UINT8 Type - sizeof (SMBIOS_TABLE_TYPE2), // UINT8 Length - SMBIOS_HANDLE_PI_RESERVED, - }, - ADDITIONAL_STR_INDEX_1, // Manufacturer - ADDITIONAL_STR_INDEX_2, // Product Name - ADDITIONAL_STR_INDEX_3, // Version - ADDITIONAL_STR_INDEX_4, // Serial - 0, // Asset tag - {1}, // motherboard, not replaceable - ADDITIONAL_STR_INDEX_5, // location of board - 0xFFFF, // chassis handle - BaseBoardTypeMotherBoard, - 0, - {0}, - }, - TYPE2_ADDITIONAL_STRINGS -}; - -// Type 3 Enclosure -STATIC CONST ARM_TYPE3 mArmDefaultType3 =3D { - { - { // SMBIOS_STRUCTURE Hdr - EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // UINT8 Type - sizeof (SMBIOS_TABLE_TYPE3), // UINT8 Length - SMBIOS_HANDLE_PI_RESERVED, - }, - ADDITIONAL_STR_INDEX_1, // Manufacturer - MiscChassisTypeRackMountChassis, // Rack-mounted chassis - ADDITIONAL_STR_INDEX_2, // version - ADDITIONAL_STR_INDEX_3, // serial - ADDITIONAL_STR_INDEX_4, // asset tag - ChassisStateUnknown, // boot chassis state - ChassisStateSafe, // power supply state - ChassisStateSafe, // thermal state - ChassisSecurityStatusNone, // security state - {0,0,0,0}, // OEM defined - 2, // 2U height - 2, // number of power cords - 0, // no contained elements - 3, // ContainedElementRecordLength; - }, - TYPE3_ADDITIONAL_STRINGS -}; - // Type 8 Port Connector Information STATIC CONST ARM_TYPE8 mArmDefaultType8Vga =3D { { @@ -611,22 +420,6 @@ STATIC ARM_TYPE11 mArmDefaultType11 =3D { TYPE11_ADDITIONAL_STRINGS }; =20 -// Type 13 BIOS Language Information -STATIC ARM_TYPE13 mArmDefaultType13 =3D { - { - { // SMBIOS_STRUCTURE Hdr - EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION, // UINT8 Type - sizeof (SMBIOS_TABLE_TYPE13), // UINT8 Length - SMBIOS_HANDLE_PI_RESERVED, - }, - 1, - 0, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - 1, - }, - TYPE13_ADDITIONAL_STRINGS -}; - // Type 24 Hardware Security STATIC SMBIOS_TABLE_TYPE24 mArmDefaultType24 =3D { { // SMBIOS_STRUCTURE Hdr @@ -637,17 +430,6 @@ STATIC SMBIOS_TABLE_TYPE24 mArmDefaultType24 =3D { 0 }; =20 -// Type 32 System Boot Information -STATIC SMBIOS_TABLE_TYPE32 mArmDefaultType32 =3D { - { // SMBIOS_STRUCTURE Hdr - EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, // UINT8 Type - sizeof (SMBIOS_TABLE_TYPE32), // UINT8 Length - SMBIOS_HANDLE_PI_RESERVED, - }, - {0, 0, 0, 0, 0, 0}, - 0 -}; - // Type 38 IPMI Device Information STATIC SMBIOS_TABLE_TYPE38 mArmDefaultType38 =3D { { // SMBIOS_STRUCTURE Hdr @@ -694,9 +476,6 @@ STATIC SMBIOS_TABLE_TYPE42 mArmDefaultType42 =3D { =20 STATIC CONST VOID *DefaultCommonTables[] =3D { - &mArmDefaultType0, - &mArmDefaultType1, - &mArmDefaultType2, &mArmDefaultType8Vga, &mArmDefaultType8USBFront, &mArmDefaultType8USBRear, @@ -714,9 +493,7 @@ STATIC CONST VOID *DefaultCommonTables[] =3D &mArmDefaultType9Sk1NvmeM2Slot1, &mArmDefaultType9Sk1NvmeM2Slot2, &mArmDefaultType11, - &mArmDefaultType13, &mArmDefaultType24, - &mArmDefaultType32, &mArmDefaultType38, &mArmDefaultType41, &mArmDefaultType42, @@ -728,80 +505,6 @@ typedef struct { CHAR8 DigitStr[3]; // example "01", Smbios date format, month } MonthStringDig; =20 -STATIC MonthStringDig MonthMatch[12] =3D { - { "Jan", "01" }, - { "Feb", "02" }, - { "Mar", "03" }, - { "Apr", "04" }, - { "May", "05" }, - { "Jun", "06" }, - { "Jul", "07" }, - { "Aug", "08" }, - { "Sep", "09" }, - { "Oct", "10" }, - { "Nov", "11" }, - { "Dec", "12" } -}; - -STATIC -VOID -ConstructBuildDate ( - OUT CHAR8 *DateBuf - ) -{ - UINTN i; - - // GCC __DATE__ format is "Feb 2 1996" - // If the day of the month is less than 10, it is padded with a space on= the left - CHAR8 *BuildDate =3D __DATE__; - - // SMBIOS spec date string: MM/DD/YYYY - CHAR8 SmbiosDateStr[sizeof (RELEASE_DATE_TEMPLATE)] =3D { 0 }; - - SmbiosDateStr[sizeof (RELEASE_DATE_TEMPLATE) - 1] =3D '\0'; - - SmbiosDateStr[2] =3D '/'; - SmbiosDateStr[5] =3D '/'; - - // Month - for (i =3D 0; i < sizeof (MonthMatch) / sizeof (MonthMatch[0]); i++) { - if (AsciiStrnCmp (&BuildDate[0], MonthMatch[i].MonthNameStr, AsciiStrL= en (MonthMatch[i].MonthNameStr)) =3D=3D 0) { - CopyMem (&SmbiosDateStr[0], MonthMatch[i].DigitStr, AsciiStrLen (Mon= thMatch[i].DigitStr)); - break; - } - } - - // Day - CopyMem (&SmbiosDateStr[3], &BuildDate[4], 2); - if (BuildDate[4] =3D=3D ' ') { - // day is less then 10, SAPCE filed by compiler, SMBIOS requires 0 - SmbiosDateStr[3] =3D '0'; - } - - // Year - CopyMem (&SmbiosDateStr[6], &BuildDate[7], 4); - - CopyMem (DateBuf, SmbiosDateStr, AsciiStrLen (RELEASE_DATE_TEMPLATE)); -} - -STATIC -UINT8 -GetBiosVerMajor ( - VOID - ) -{ - return (PcdGet8 (PcdSmbiosTables0MajorVersion)); -} - -STATIC -UINT8 -GetBiosVerMinor ( - VOID - ) -{ - return (PcdGet8 (PcdSmbiosTables0MinorVersion)); -} - STATIC UINTN GetStringPackSize ( @@ -881,148 +584,6 @@ UpdateStringPack ( return EFI_SUCCESS; } =20 -STATIC -EFI_STATUS -UpdateSmbiosType0 ( - PLATFORM_INFO_HOB *PlatformHob - ) -{ - EFI_STATUS Status =3D EFI_SUCCESS; - MISC_BIOS_CHARACTERISTICS_EXTENSION *MiscExt =3D NULL; - CHAR8 *ReleaseDateBuf =3D NULL; - CHAR8 *PcdReleaseDate =3D NULL; - CHAR8 AsciiVersion[32]; - UINTN Index; - CHAR8 BiosVersionStr[128]; - CHAR8 *StringPack; - CHAR8 SizeOfFirmwareVer; - UINT16 *FirmwareVersionPcdPtr; - - // - // Update Type0 information - // - - ReleaseDateBuf =3D &mArmDefaultType0.Strings[0] - + sizeof (VENDOR_TEMPLATE) - 1 - + sizeof (BIOS_VERSION_TEMPLATE) - 1; - PcdReleaseDate =3D (CHAR8 *)PcdGetPtr (PcdSmbiosTables0BiosReleaseDate); - - if (AsciiStrnCmp (PcdReleaseDate, RELEASE_DATE_TEMPLATE, AsciiStrLen (RE= LEASE_DATE_TEMPLATE)) =3D=3D 0) { - // If PCD is still template date MM/DD/YYYY, use compiler date - ConstructBuildDate (ReleaseDateBuf); - } else { - // PCD is updated somehow, use PCD date - CopyMem (ReleaseDateBuf, PcdReleaseDate, AsciiStrLen (PcdReleaseDate))= ; - } - - if (PcdGet32 (PcdFdSize) < SIZE_16MB) { - mArmDefaultType0.Base.BiosSize =3D (PcdGet32 (PcdFdSize) / SIZE_64KB) = - 1; - - mArmDefaultType0.Base.ExtendedBiosSize.Size =3D 0; - mArmDefaultType0.Base.ExtendedBiosSize.Unit =3D 0; - } else { - // Need to update Extended BIOS ROM Size - mArmDefaultType0.Base.BiosSize =3D 0xFF; - - // As a reminder - ASSERT (FALSE); - } - - // Type0 BIOS Characteristics Extension Byte 1 - MiscExt =3D (MISC_BIOS_CHARACTERISTICS_EXTENSION *)&(mArmDefaultType0.Ba= se.BIOSCharacteristicsExtensionBytes); - - MiscExt->BiosReserved.AcpiIsSupported =3D 1; - - // Type0 BIOS Characteristics Extension Byte 2 - MiscExt->SystemReserved.BiosBootSpecIsSupported =3D 1; - MiscExt->SystemReserved.FunctionKeyNetworkBootIsSupported =3D 1; - MiscExt->SystemReserved.UefiSpecificationSupported =3D 1; - - // Type0 BIOS Release - // Decide another way: If the system does not support the use of this - // field, the value is 0FFh - mArmDefaultType0.Base.SystemBiosMajorRelease =3D GetBiosVerMajor (); - mArmDefaultType0.Base.SystemBiosMinorRelease =3D GetBiosVerMinor (); - - // - // Format of PcdFirmwareVersionString is - // "(MAJOR_VER).(MINOR_VER).(BUILD) Build YYYY.MM.DD", we only need - // "(MAJOR_VER).(MINOR_VER).(BUILD)" showed in Bios version. Using - // space character to determine this string. Another case uses null - // character to end while loop. - // - SizeOfFirmwareVer =3D 0; - FirmwareVersionPcdPtr =3D (UINT16 *)PcdGetPtr (PcdFirmwareVersionString)= ; - while (*FirmwareVersionPcdPtr !=3D ' ' && *FirmwareVersionPcdPtr !=3D '\= 0') { - SizeOfFirmwareVer++; - FirmwareVersionPcdPtr++; - } - - AsciiSPrint ( - BiosVersionStr, - sizeof (BiosVersionStr), - "TianoCore %.*s (SYS: %a.%a)", - SizeOfFirmwareVer, - PcdGetPtr (PcdFirmwareVersionString), - PlatformHob->SmPmProVer, - PlatformHob->SmPmProBuild - ); - StringPack =3D mArmDefaultType0.Strings; - - UpdateStringPack (StringPack, BiosVersionStr, ADDITIONAL_STR_INDEX_2); - - /* Update SMBIOS Type 0 EC Info */ - CopyMem ( - (VOID *)&AsciiVersion, - (VOID *)&PlatformHob->SmPmProVer, - sizeof (PlatformHob->SmPmProVer) - ); - /* The AsciiVersion is formated as "major.minor" */ - for (Index =3D 0; Index < (UINTN)AsciiStrLen (AsciiVersion); Index++) { - if (AsciiVersion[Index] =3D=3D '.') { - AsciiVersion[Index] =3D '\0'; - break; - } - } - - mArmDefaultType0.Base.EmbeddedControllerFirmwareMajorRelease =3D - (UINT8)AsciiStrDecimalToUintn (AsciiVersion); - mArmDefaultType0.Base.EmbeddedControllerFirmwareMinorRelease =3D - (UINT8)AsciiStrDecimalToUintn (AsciiVersion + Index + 1); - - return Status; -} - -STATIC -EFI_STATUS -InstallType3Structure ( - IN EFI_SMBIOS_PROTOCOL *Smbios - ) -{ - EFI_STATUS Status =3D EFI_SUCCESS; - EFI_SMBIOS_HANDLE SmbiosHandle; - - ASSERT (Smbios !=3D NULL); - - SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER*) &mArmDefaultType3)->Handle; - Status =3D Smbios->Add ( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *)&mArmDefaultType3 - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "adding SMBIOS type 3 failed\n")); - // stop adding rather than continuing - return Status; - } - - // Save this handle to type 2 table - mArmDefaultType2.Base.ChassisHandle =3D SmbiosHandle; - - return Status; -} - /** Install a whole table worth of structures =20 @@ -1060,31 +621,6 @@ InstallStructures ( return EFI_SUCCESS; } =20 -STATIC -VOID -UpdateSmbiosInfo ( - VOID - ) -{ - VOID *Hob; - PLATFORM_INFO_HOB *PlatformHob; - - /* Get the Platform HOB */ - Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); - ASSERT (Hob !=3D NULL); - if (Hob =3D=3D NULL) { - return; - } - - PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); - - // - // Update Type0 information - // - UpdateSmbiosType0 (PlatformHob); - -} - /** Install all structures from the DefaultTables structure =20 @@ -1100,12 +636,6 @@ InstallAllStructures ( =20 ASSERT (Smbios !=3D NULL); =20 - // Update SMBIOS Tables - UpdateSmbiosInfo (); - - // Install Type 3 table - InstallType3Structure (Smbios); - // Install Tables Status =3D InstallStructures (Smbios, DefaultCommonTables); ASSERT_EFI_ERROR (Status); diff --git a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c b/Plat= form/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c index 6f5869b1ef1c..0604bf351c89 100644 --- a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c +++ b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c @@ -1,7 +1,7 @@ /** @file * OemMiscLib.c * -* Copyright (c) 2021, Ampere Computing LLC. All rights reserved. +* Copyright (c) 2021 - 2023, Ampere Computing LLC. All rights reserved. * Copyright (c) 2021, NUVIA Inc. All rights reserved. * Copyright (c) 2018, Hisilicon Limited. All rights reserved. * Copyright (c) 2018, Linaro Limited. All rights reserved. @@ -10,6 +10,7 @@ * **/ =20 +#include #include #include #include @@ -17,10 +18,21 @@ #include #include #include +#include +#include #include +#include +#include + +#define PROCESSOR_VERSION_ALTRA L"Ampere(R) Altra(R) Processor" +#define PROCESSOR_VERSION_ALTRA_MAX L"Ampere(R) Altra(R) Max Processor" =20 #define MHZ_SCALE_FACTOR 1000000 =20 +#define SCP_VERSION_STRING_MAX_LENGTH 32 + +#define OEM_DEFAULT_INFORMATION L"To Be Filled By O.E.M." + UINT32 GetCacheConfig ( IN UINT32 CacheLevel, @@ -216,6 +228,74 @@ OemIsProcessorPresent ( return FALSE; } =20 +/** + Update the firmware version in SMBIOS Type 0. + This is the combination of UEFI and Ampere system firmware version. + +**/ +VOID +UpdateFirmwareVersionString ( + OUT CHAR16 *Version + ) +{ + UINT8 UnicodeStrLen; + UINT8 FirmwareVersionStrLen; + UINT8 FirmwareVersionStrSize; + UINT8 *ScpVersion; + UINT8 *ScpBuild; + CHAR16 UnicodeStr[SMBIOS_STRING_MAX_LENGTH * sizeof (CHAR16)]; + CHAR16 *FirmwareVersionPcdPtr; + + FirmwareVersionStrLen =3D 0; + ZeroMem (UnicodeStr, sizeof (UnicodeStr)); + FirmwareVersionPcdPtr =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionS= tring); + FirmwareVersionStrSize =3D SMBIOS_STRING_MAX_LENGTH * sizeof (CHAR16); + + // + // Format of PcdFirmwareVersionString is + // "(MAJOR_VER).(MINOR_VER).(BUILD) Build YYYY.MM.DD", we only need + // "(MAJOR_VER).(MINOR_VER).(BUILD)" showed in BIOS version. Using + // space character to determine this string. Another case uses null + // character to end while loop. + // + while (*FirmwareVersionPcdPtr !=3D ' ' && *FirmwareVersionPcdPtr !=3D '\= 0') { + FirmwareVersionStrLen++; + FirmwareVersionPcdPtr++; + } + + FirmwareVersionPcdPtr =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionSt= ring); + UnicodeStrLen =3D FirmwareVersionStrLen * sizeof (CHAR16); + CopyMem (UnicodeStr, FirmwareVersionPcdPtr, UnicodeStrLen); + + GetScpVersion (&ScpVersion); + GetScpBuild (&ScpBuild); + if ((ScpVersion =3D=3D NULL) || (ScpBuild =3D=3D NULL)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d: Fail to get SMpro/PMpro information\n", + __func__, + __LINE__ + )); + UnicodeSPrint ( + Version, + FirmwareVersionStrSize, + L"TianoCore %.*s (SYS: 0.00.00000000)", + FirmwareVersionStrLen, + (UINT16 *)UnicodeStr + ); + } else { + UnicodeSPrint ( + Version, + FirmwareVersionStrSize, + L"TianoCore %.*s (SYS: %a.%a)", + FirmwareVersionStrLen, + (UINT16 *)UnicodeStr, + ScpVersion, + ScpBuild + ); + } +} + /** Updates the HII string for the specified field. =20 @param HiiHandle The HII handle. @@ -230,7 +310,91 @@ OemUpdateSmbiosInfo ( IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field ) { - return; + EFI_STRING UnicodeString; + UINT8 StringLength; + + StringLength =3D SMBIOS_STRING_MAX_LENGTH * sizeof (CHAR16); + UnicodeString =3D AllocatePool (StringLength); + if (UnicodeString =3D=3D NULL) { + DEBUG (( + DEBUG_ERROR, + "%a:%d: There is not enough memory remaining to satisfy the request\= n", + __func__, + __LINE__)); + + goto Exit; + } + + switch (Field) { + case ProductNameType01: + case SystemManufacturerType01: + case VersionType01: + case SerialNumType01: + case SkuNumberType01: + UnicodeSPrint ( + UnicodeString, + StringLength, + OEM_DEFAULT_INFORMATION + ); + break; + + case FamilyType01: + UnicodeSPrint ( + UnicodeString, + StringLength, + IsAc01Processor () ? L"Altra\0" : L"Altra Max\0" + ); + break; + + case ProductNameType02: + case AssetTagType02: + case VersionType02: + case SerialNumberType02: + case BoardManufacturerType02: + UnicodeSPrint ( + UnicodeString, + StringLength, + OEM_DEFAULT_INFORMATION + ); + break; + + case ChassisLocationType02: + UnicodeSPrint ( + UnicodeString, + StringLength, + L"Base of Chassis" + ); + break; + + case SerialNumberType03: + case VersionType03: + case ManufacturerType03: + case AssetTagType03: + case SkuNumberType03: + UnicodeSPrint ( + UnicodeString, + StringLength, + OEM_DEFAULT_INFORMATION + ); + break; + + case BiosVersionType00: + UpdateFirmwareVersionString (UnicodeString); + break; + + default: + UnicodeSPrint ( + UnicodeString, + StringLength, + L"Not Specified" + ); + } + + // Update string value for respective token. + HiiSetString (HiiHandle, TokenToUpdate, UnicodeString, NULL); + +Exit: + FreePool (UnicodeString); } =20 /** Fetches the Type 32 boot information status. @@ -323,3 +487,81 @@ OemGetChassisNumPowerCords ( { return 2; } + +/** Fetches the BIOS release. + + @return The BIOS release. +**/ +UINT16 +EFIAPI +OemGetBiosRelease ( + VOID + ) +{ + UINT16 BiosRelease; + + BiosRelease =3D (UINT16)(((PcdGet8 (PcdSmbiosTables0MajorVersion)) << 8) + | PcdGet8 (PcdSmbiosTables0MinorVersion)); + + return BiosRelease; +} + +/** + Fetches the embedded controller firmware release. + + @return UINT16 The embedded controller firmware release. +**/ +UINT16 +EFIAPI +OemGetEmbeddedControllerFirmwareRelease ( + VOID + ) +{ + CHAR8 AsciiScpVer[SCP_VERSION_STRING_MAX_LENGTH]; + UINT8 *ScpVer =3D NULL; + UINT8 Index; + UINT16 FirmwareRelease; + + GetScpVersion (&ScpVer); + if (ScpVer =3D=3D NULL) { + DEBUG (( + DEBUG_ERROR, + "%a:%d: Fail to get SMpro/PMpro information\n", + __func__, + __LINE__)); + + return 0xFFFF; + } + + CopyMem ((VOID *)AsciiScpVer, (VOID *)ScpVer, AsciiStrLen ((CHAR8 *)ScpV= er)); + /* The AsciiVersion is formated as "major.minor" */ + for (Index =3D 0; Index < (UINTN)AsciiStrLen (AsciiScpVer); Index++) { + if (AsciiScpVer[Index] =3D=3D '.') { + AsciiScpVer[Index] =3D '\0'; + break; + } + } + + FirmwareRelease =3D ((UINT8)AsciiStrDecimalToUintn (AsciiScpVer) << 8) + + (UINT8)AsciiStrDecimalToUintn (AsciiScpVer + Index += 1); + + return FirmwareRelease; +} + +/** + Fetches the system UUID. + + @param[out] SystemUuid The pointer to the buffer to store the System= UUID. +**/ +VOID +EFIAPI +OemGetSystemUuid ( + OUT GUID *SystemUuid + ) +{ + if (SystemUuid =3D=3D NULL) { + return; + } + + CopyGuid (SystemUuid, &gZeroGuid); +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLi= bCommon.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib= Common.c index 919d9d77b25c..853ab5543f11 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon= .c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon= .c @@ -513,6 +513,48 @@ GetNumberOfConfiguredCPMs ( return Count; } =20 +/** + Get version of SCP. + + @param[out] ScpVer Pointer to contain version of SCP value. +**/ +VOID +EFIAPI +GetScpVersion ( + UINT8 **ScpVer + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob !=3D NULL) { + *ScpVer =3D (UINT8 *)PlatformHob->SmPmProVer; + } else { + *ScpVer =3D NULL; + } +} + +/** + Get date of build release for SCP. + + @param[out] ScpBuild Pointer to contain date of build release for SC= P. +**/ +VOID +EFIAPI +GetScpBuild ( + UINT8 **ScpBuild + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob !=3D NULL) { + *ScpBuild =3D (UINT8 *)PlatformHob->SmPmProBuild; + } else { + *ScpBuild =3D NULL; + } +} + /** Set the number of configured CPM per socket. =20 --=20 2.39.0