From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8D88A740032 for ; Fri, 12 Jul 2024 09:24:27 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KPWbdkkVqB5mNXsJJk9MfbFPyRMXcMo5JmuWNEl9Wik=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1720776267; v=1; b=wX9Kzgg+FaBPXbeVmeyZ75qUEiM2pWvCh3hrJtnWHyxRSSebaW031vmbAGIPYJhQm+Nej8e0 YsnIG0IvTNk3BqVshzHqywKQg1ktVFoxPsXYWzWHmrqCCD7aKjwhq04t49S+utM1oBcug9V3ryz gSB+oaidaFZx+ybLT4C9+CTTA2rOv17iOVZOJPfbuIbhoYywqI9WS05RrdjMH2zyV2aMUpGYTbY ujvGv1XwOww9T+uN/htpfsyIbEcQlnzkyaQ6NfUEK7xzrdvXhw2CsWdxJakvmdfIAB6zB58fBvU tzSrs7aX0mu1uyplWpFIpt3YKr4oZJyHH7/LN8s8Qry8Q== X-Received: by 127.0.0.2 with SMTP id y2QXYY7687511xrELwN0EFEl; Fri, 12 Jul 2024 02:24:21 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.3889.1720776260418328897 for ; Fri, 12 Jul 2024 02:24:20 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id E9F1926005A; Fri, 12 Jul 2024 11:24:17 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id 6fL8WSo3gYie; Fri, 12 Jul 2024 11:24:16 +0200 (CEST) X-Received: from applejack.lan (83.8.74.165.ipv4.supernova.orange.pl [83.8.74.165]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id B5162260CD4; Fri, 12 Jul 2024 11:24:15 +0200 (CEST) From: "Marcin Juszkiewicz" To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Sami Mujawar , Marcin Juszkiewicz Subject: [edk2-devel] [PATCH edk2-platforms 2/2] SbsaQemu: set CPU model in SMBIOS Date: Fri, 12 Jul 2024 11:23:56 +0200 Message-ID: <20240712092356.517074-3-marcin.juszkiewicz@linaro.org> In-Reply-To: <20240712092356.517074-1-marcin.juszkiewicz@linaro.org> References: <20240712092356.517074-1-marcin.juszkiewicz@linaro.org> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 12 Jul 2024 02:24:20 -0700 Resent-From: marcin.juszkiewicz@linaro.org Reply-To: devel@edk2.groups.io,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: y9KrdzXnsXwD233duwDeWfe2x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=wX9Kzgg+; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linaro.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io SbsaQemu platform have several cpu models available. Since start it reported "arm-virt" one in SMBIOS instead of real one. This change replaces it with the real cpu model like Cortex-A57, Neoverse-N2 etc. Requires change in EDK2 to make PcdProcessorVersion dynamic. Signed-off-by: Marcin Juszkiewicz --- Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 2 +- .../SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf | 2 + .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 50 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu= /SbsaQemu.dsc index e78f1d71998a..a823a2967525 100644 --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc @@ -485,7 +485,6 @@ [PcdsFixedAtBuild.common] # These values are fixed for now, but should be configurable via # something like an emulated SCP. gArmTokenSpaceGuid.PcdProcessorManufacturer|L"QEMU" - gArmTokenSpaceGuid.PcdProcessorVersion|L"arm-virt" gArmTokenSpaceGuid.PcdProcessorSerialNumber|L"SN0000" gArmTokenSpaceGuid.PcdProcessorAssetTag|L"AT0000" gArmTokenSpaceGuid.PcdProcessorPartNumber|L"PN0000" @@ -495,6 +494,7 @@ [PcdsFixedAtBuild.common] =20 [PcdsDynamicDefault.common] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3 + gArmTokenSpaceGuid.PcdProcessorVersion|L" = " =20 # Core and Cluster Count gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdCoreCount|1 diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDx= e.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf index 727c8e82d16e..616296f5a485 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf @@ -53,6 +53,8 @@ [Pcd] gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSmmuBase =20 + gArmTokenSpaceGuid.PcdProcessorVersion + [Depex] gEfiAcpiTableProtocolGuid ## CONSUMES =20 diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDx= e.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c index e0eef54ff907..b19edf5a4ff8 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c @@ -845,6 +845,51 @@ DisableXhciOnOlderPlatVer ( return Status; } =20 +EFI_STATUS +UpdateCpuNameInSmbios ( + ) +{ + EFI_STATUS Status; + UINT64 ProcessorId; + UINT16 PartNum; + UINTN CpuLen; + CHAR16 CpuName[16]; + + ProcessorId =3D ArmReadMidr (); + PartNum =3D (UINT16)((ProcessorId >> 4) & 0xFFF); + + switch (PartNum) { + case 0x51: + StrCpyS (CpuName, 16, L"QEMU Max"); + break; + case 0xd07: + StrCpyS (CpuName, 16, L"Arm Cortex-A57"); + break; + case 0xd08: + StrCpyS (CpuName, 16, L"Arm Cortex-A72"); + break; + case 0xd0c: + StrCpyS (CpuName, 16, L"Arm Neoverse-N1"); + break; + case 0xd40: + StrCpyS (CpuName, 16, L"Arm Neoverse-V1"); + break; + case 0xd49: + StrCpyS (CpuName, 16, L"Arm Neoverse-N2"); + break; + default: + StrCpyS (CpuName, 16, L"virtual cpu"); + break; + } + + CpuLen =3D sizeof (CHAR16) * StrLen (CpuName); + + Status =3D PcdSetPtrS (PcdProcessorVersion, &CpuLen, CpuName); + ASSERT_EFI_ERROR (Status); + + return Status; +} + EFI_STATUS EFIAPI InitializeSbsaQemuAcpiDxe ( @@ -907,5 +952,10 @@ InitializeSbsaQemuAcpiDxe ( DEBUG ((DEBUG_ERROR, "Failed to handle XHCI enablement\n")); } =20 + Status =3D UpdateCpuNameInSmbios (); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to set CPU name in SMBIOS\n")); + } + return EFI_SUCCESS; } -- 2.45.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119908): https://edk2.groups.io/g/devel/message/119908 Mute This Topic: https://groups.io/mt/107179083/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-