From nobody Tue Feb 10 01:34:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75150+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75150+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157375; cv=none; d=zohomail.com; s=zohoarc; b=ir/9Yko5nkvf8GVwefXrs3OSEvQ/eFUbBPbad2/JfCH8ruELp03oRnpws6hxXtc5uMDfJjOyMdgoK48RM7lzs+icXSNdZn+DyE+q6yJLyM7XSa/UhspxBb1HK3yMLInc2bOzkcReqfRyqVskWdOANXd5QYSJzn+f2GSqDEC7iRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157375; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=orTd6E106SPkJiythWkAWUwTP6xKJrm/p3sh9dXb5dU=; b=e9jlUglmzOThGXRcxGj3U12C3PjWo9lzZk+XWj/BOD8PqJcGO6t1ijl58WHeZqW0a7C8rJ/ovDu1ydGHqZ27LINeDeD4gUeMrDnLCYl1Qf5QZVMzYLkcGOepQcAiQz7rBGoE88+IvbB0wMHjgOQUP0XEOgTMF7ENB4VNHLUGYuY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75150+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621157375409624.0388553751764; Sun, 16 May 2021 02:29:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JC9yYY1788612xlc5vvdRyOX; Sun, 16 May 2021 02:29:34 -0700 X-Received: from foss.arm.com (foss.arm.com []) by mx.groups.io with SMTP id smtpd.web08.4132.1621157372359591793 for ; Sun, 16 May 2021 02:29:34 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A579A1063; Sun, 16 May 2021 02:29:33 -0700 (PDT) X-Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7A4A73F73B; Sun, 16 May 2021 02:29:32 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 06/11] Platform/Sgi: Add SMBIOS Type4 Table Date: Sun, 16 May 2021 14:59:12 +0530 Message-Id: <20210516092917.21124-7-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: jT3MoomzLqLXr8v4pbGlRoi8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157374; bh=W1QWZHT7yP1Mue9qLIlkybtlL5UNF+/WDHG2T03Hkgw=; h=Cc:Date:From:Reply-To:Subject:To; b=mWYJ5dYTEUX3dibMAxhPBBO5pIUZ5XSxS/FgpolenVx3+9cn8n8mUNh9L6I2JdebIEM 8gLZoRn7inn1WPTT+Z1Z4Ktqnd3WHf7HHEV05NSeNU1WHPMiMPazbft6YZuD6aCR5+5U2 SeWumNShqUZ47dTBc56wonXSRC/y2wKmCuA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 4 table (Processor Information) that includes information about manufacture, family, processor id, maximum operating frequency, and other information related to the processor. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 6 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 12 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformation.c = | 209 ++++++++++++++++++++ 5 files changed, 229 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index a0f217f5107c..091de0c99c74 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -56,6 +56,7 @@ HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf =20 [LibraryClasses.common.DXE_DRIVER] FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index b3c1619ddc66..4652a9c62b88 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -18,6 +18,7 @@ Type0BiosInformation.c Type1SystemInformation.c Type3SystemEnclosure.c + Type4ProcessorInformation.c =20 [Packages] ArmPkg/ArmPkg.dec @@ -27,9 +28,11 @@ Platform/ARM/SgiPkg/SgiPlatform.dec =20 [LibraryClasses] + ArmLib ArmPlatformLib DebugLib HobLib + PrintLib UefiDriverEntryPoint =20 [Guids] @@ -37,6 +40,9 @@ gArmSgiPlatformIdDescriptorGuid =20 [FixedPcd] + gArmPlatformTokenSpaceGuid.PcdClusterCount + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmSgiTokenSpaceGuid.PcdChipCount gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision =20 [Protocols] diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 4a6f8be2a2c2..8a9be0cfc4c8 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -29,8 +29,20 @@ InstallSystemEnclosure ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallProcessorInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, + SMBIOS_HANDLE_CLUSTER1, + SMBIOS_HANDLE_L1I_CACHE, + SMBIOS_HANDLE_L1D_CACHE, + SMBIOS_HANDLE_L2_CACHE, + SMBIOS_HANDLE_L3_CACHE, + SMBIOS_HANDLE_L4_CACHE, }; =20 #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 5f4b833dc9fe..269bd0f9d843 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -29,6 +29,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallBiosInformation, &InstallSystemInformation, &InstallSystemEnclosure, + &InstallProcessorInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorIn= formation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorI= nformation.c new file mode 100644 index 000000000000..fda532b558af --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformati= on.c @@ -0,0 +1,209 @@ +/** @file + SMBIOS Type 4 (Processor information) table for ARM RD platforms. + + This file installs SMBIOS Type 4 (Processor information) Table for Arm's + Reference Design platforms. It includes information about manufacture, + family, processor id, maximum operating frequency, and other information + related to the processor. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.5 +**/ + +#include +#include +#include +#include +#include + +#include "SgiPlatform.h" +#include "SmbiosPlatformDxe.h" + +#define NEOVERSE_E1_THREADS_PER_CORE 2 + +#define SOCKET_TYPE_BASE 3 +#define SOCKET_TYPE_NUM 1 +#define PROCESSOR_VERSION_BASE (SOCKET_TYPE_BASE + SOCKET_TYPE_NUM) +#define PROCESSOR_VERSION_NUM 8 +#define SERIAL_NUMBER_BASE (PROCESSOR_VERSION_BASE + PROCESSOR_VERSIO= N_NUM) +#define TYPE4_STRINGS \ + "0x000\0" /* Part Number */ \ + "ARM LTD\0" /* manufactuer */ \ + "Other\0" /* socket type */ \ + "Unknown\0" /* Processor Version */ \ + "Cortex-A75\0" \ + "Neoverse-N1\0" \ + "Neoverse-N1\0" \ + "Neoverse-E1\0" \ + "Neoverse-V1\0" \ + "Neoverse-V1\0" \ + "Neoverse-N2\0" \ + "000-0\0" /* Serial number */ \ + "783-3\0" \ + "786-1\0" \ + "786-1\0" \ + "786-2\0" \ + "78A-1\0" \ + "78A-2\0" \ + "7B7-1\0" + +/* SMBIOS Type4 structure */ +#pragma pack(1) +struct ArmRdSmbiosType4 { + SMBIOS_TABLE_TYPE4 Base; + UINT8 Strings[sizeof (TYPE4_STRINGS)]; +} ARM_TYPE4; +#pragma pack() + +/* Processor information */ +static struct ArmRdSmbiosType4 mArmRdSmbiosType4 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, // Type 4 + sizeof (SMBIOS_TABLE_TYPE4), // Length + SMBIOS_HANDLE_CLUSTER1, // handle number + }, + SOCKET_TYPE_BASE, // Socket type + CentralProcessor, // Processor type + ProcessorFamilyIndicatorFamily2, + // Use Processor Family 2 field + 2, // Manufacturer string number + {{0}, {0}}, // Processor id, update dynamically + PROCESSOR_VERSION_BASE, // Processor version, update dynamically + {0, 0, 0, 0, 0, 1}, // Non legacy mode for processor voltage + 0, // External clock frequency unknown + 2600, // Max speed in MHz + 2600, // Current speed in MHz + ( // Status + (1 << 6) | // CPU Socket Populated + (1 << 0) // CPU Enabled + ), + ProcessorUpgradeOther, // Processor Upgrade + SMBIOS_HANDLE_L1I_CACHE, // L1 Cache handle + SMBIOS_HANDLE_L2_CACHE, // L2 Cache handle + SMBIOS_HANDLE_L3_CACHE, // L3 Cache handle + 0, // Processor serial number not set + 0, // Processor asset tag not set + 1, // Part number, update dynamically + 0, // Core count, update dynamically + 0, // Enabled core count, update dynamically + 0, // Thread per socket count + ( // Processor characteristics + (1 << 2) | // 64-bit Capable + (1 << 3) | // Multi-Core + (1 << 5) | // Execute Protection + (1 << 6) | // Enhanced Virtualization + (1 << 7) // Power/Performance Control + ), + ProcessorFamilyARM // Processor Family 2 + }, + TYPE4_STRINGS +}; + +/** + Update the part-number string. + + Get the part number from ProcessorId and update TYPE4_STRINGS + + @param ProcessorId The processor Id read from MIDR register +**/ +STATIC +VOID +UpdatePartNumber ( + IN UINT64 ProcessorId + ) +{ + CHAR8 PartNumber[4] =3D {0}; + UINT16 PartNum; + + PartNum =3D (UINT16)((ProcessorId >> 4) & 0xFFF); + + /* Convert 3 digit hexadecimal partnumber to ASCII and update TYPE4_STRI= NGS */ + AsciiSPrint(PartNumber, sizeof (PartNumber), "%03x", PartNum); + CopyMem (&mArmRdSmbiosType4.Strings[2], PartNumber, sizeof (PartNumber)); +} + +/** + Install SMBIOS Processor information Table + + Install the SMBIOS Processor information (type 4) table for Arm's Refere= nce + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in u= se. +**/ +EFI_STATUS +InstallProcessorInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT32 CoreCount; + UINT64 *ProcessorId =3D (UINT64 *)&(mArmRdSmbiosType4.Base.ProcessorId); + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType4)->Handle; + CoreCount =3D (FixedPcdGet32 (PcdCoreCount) * FixedPcdGet32 (PcdClusterC= ount)); + + /* Set the core count and processor speed for all platforms */ + switch (SgiGetProductId ()) { + case Sgi575: + case RdN1Edge: + case RdV1: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + break; + case RdN2: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + mArmRdSmbiosType4.Base.MaxSpeed =3D 3200; // Frequency in MHz + mArmRdSmbiosType4.Base.CurrentSpeed =3D 3200; // Frequency in MHz + break; + case RdN1EdgeX2: + case RdV1Mc: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount * FixedPcdGet32 (PcdChi= pCount); + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount * FixedPcdGet32 = (PcdChipCount); + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount * FixedPcdGet32 (PcdC= hipCount); + break; + case RdE1Edge: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount / NEOVERSE_E1_THREADS_P= ER_CORE; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount / NEOVERSE_E1_TH= READS_PER_CORE; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + mArmRdSmbiosType4.Base.MaxSpeed =3D 2300; // Frequency in MHz + mArmRdSmbiosType4.Base.CurrentSpeed =3D 2300; // Frequency in MHz + break; + } + + mArmRdSmbiosType4.Base.ProcessorVersion =3D PROCESSOR_VERSION_BASE + Sgi= GetProductId (); + mArmRdSmbiosType4.Base.SerialNumber =3D SERIAL_NUMBER_BASE + SgiGetProdu= ctId (); + + /* Update processor-id and part number */ + *ProcessorId =3D ArmReadMidr(); + UpdatePartNumber (*ProcessorId); + + /* Install type 4 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType4 + ); + if (Status !=3D EFI_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type4 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75150): https://edk2.groups.io/g/devel/message/75150 Mute This Topic: https://groups.io/mt/82861602/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-