From nobody Mon Feb 9 15:11:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48702+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48702+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1570686161; cv=none; d=zoho.com; s=zohoarc; b=f1aeHQ4Auvtqc+oksOB/OiwBP3nJ83Se5ACd9M3mw1SX1SxjfYcKU6lp9FTg0wO9unBkhgt3L18AlLTeOS5PyTkCJQyv8mBVIb3b7qMt0ZE5WgZt24wl9CZxHIXni8hGttQX9bTxJBe9jNgbStUJO5b3BBb+Tg4ngAGR353Wo8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570686161; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=EpOMb48UWn/RLsl8AXztgsG1NTmgWhkeIAlzZK8knfA=; b=PwY0/oR0ZspyEubGKidcNtfv09mdGg1HyWFMcTSr/4boqG03Is65Vk3h2tEStiqis5xdIabnluQI/ljs3tU5H8hk35GG3uTRThX5DP6YUReW/9aWXVz2TTrpn3kMOfSLthcafiO5u05aXBkFw2P3wTFHJL5tJN6q35qnLyTS3eE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48702+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15706861612151016.624216847536; Wed, 9 Oct 2019 22:42:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Wed, 09 Oct 2019 22:42:40 -0700 X-Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by mx.groups.io with SMTP id smtpd.web10.2530.1570686159869148185 for ; Wed, 09 Oct 2019 22:42:40 -0700 X-Received: by mail-lj1-f195.google.com with SMTP id n14so4817226ljj.10 for ; Wed, 09 Oct 2019 22:42:39 -0700 (PDT) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqz/Zsobkt5tShxD8SSTejqjO7IUArV5l4yqt0XAIZo5yUSu9AZSK5hM3b9WRFMys6UTkQ5KsQ== X-Received: by 2002:a2e:9e85:: with SMTP id f5mr5063291ljk.203.1570686157823; Wed, 09 Oct 2019 22:42:37 -0700 (PDT) X-Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p27sm1001481lfo.95.2019.10.09.22.42.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Oct 2019 22:42:37 -0700 (PDT) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com, Patryk Duda Subject: [edk2-devel] [edk2-platforms: PATCH v3 8/9] Marvell/Drivers: SmbiosPlatformDxe: Load SMBIOS strings from PCD Date: Thu, 10 Oct 2019 07:42:18 +0200 Message-Id: <1570686139-25182-9-git-send-email-mw@semihalf.com> In-Reply-To: <1570686139-25182-1-git-send-email-mw@semihalf.com> References: <1570686139-25182-1-git-send-email-mw@semihalf.com> Precedence: Bulk List-Unsubscribe: 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,mw@semihalf.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1570686160; bh=KomZTacLu1bOLwpa6xe920wR/EdAm5uQi/s5bSO/QC0=; h=Cc:Date:From:Reply-To:Subject:To; b=PBdxyNz1SfaFUuArARkdrZuM22kLw9cW40vfmFTJPGglYDYZvYgij8NslHr0yJl3a+W d9WJJNqndhq770ISk/CNZ2WeqysCcYkfo3UZBGNt8TQUB+1yqSd9pAp0Fuh7ikD5rs4jI xVZWJjAYEXQnbNTqz90ObDe++r4mMicZfpA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Patryk Duda This patch implements convenient way of changing strings included in SMBIOS Table1, Table2, Table3. Strings can be altered by defining following PCDs: gMarvellTokenSpaceGuid.PcdProductManufacturer gMarvellTokenSpaceGuid.PcdProductPlatformName gMarvellTokenSpaceGuid.PcdProductVersion gMarvellTokenSpaceGuid.PcdProductSerial This patch adds also limit for length of string which can be increased if necessary in future. Signed-off-by: Patryk Duda --- Silicon/Marvell/Marvell.dec | 6 ++ Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 4 + Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 79 +++++= ++++++++++++--- 3 files changed, 78 insertions(+), 11 deletions(-) diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec index d337d3e..a84b056 100644 --- a/Silicon/Marvell/Marvell.dec +++ b/Silicon/Marvell/Marvell.dec @@ -169,6 +169,12 @@ gMarvellTokenSpaceGuid.PcdPciEAhci|{ 0x0 }|VOID*|0x3000034 gMarvellTokenSpaceGuid.PcdPciESdhci|{ 0x0 }|VOID*|0x3000035 =20 +#Platform description + gMarvellTokenSpaceGuid.PcdProductManufacturer|"Marvell = \0"|VOID*|0x50000100 + gMarvellTokenSpaceGuid.PcdProductPlatformName|"Marvell Development Board= \0"|VOID*|0x50000101 + gMarvellTokenSpaceGuid.PcdProductSerial|"Serial Not Set = \0"|VOID*|0x50000103 + gMarvellTokenSpaceGuid.PcdProductVersion|"Revision unknown = \0"|VOID*|0x50000102 + #RTC gMarvellTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT64|0x40000052 =20 diff --git a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.in= f b/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 8b4586c..7722146 100644 --- a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -36,6 +36,10 @@ =20 [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision + gMarvellTokenSpaceGuid.PcdProductManufacturer + gMarvellTokenSpaceGuid.PcdProductPlatformName + gMarvellTokenSpaceGuid.PcdProductSerial + gMarvellTokenSpaceGuid.PcdProductVersion =20 [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED diff --git a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = b/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 08f4fa7..c5b1d77 100644 --- a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -21,6 +21,22 @@ #include =20 // +// SMBIOS specification indicates that there is no limit for string size. +// However, some strings are printed in UEFI and OS. Printing very big str= ing +// can lead to unexpected behaviour. Second reason of string size definiti= on +// is that static buffers can be used instead of dynamic ones. +// +// Nevertheless, this value can be increased if necessary +// + +#define MV_SMBIOS_STRING_MAX_SIZE 32 + +STATIC CHAR8 mSysInfoManufacturer[MV_SMBIOS_STRING_MAX_SIZE]; +STATIC CHAR8 mSysInfoProductName[MV_SMBIOS_STRING_MAX_SIZE]; +STATIC CHAR8 mSysInfoVersion[MV_SMBIOS_STRING_MAX_SIZE]; +STATIC CHAR8 mSysInfoSerial[MV_SMBIOS_STRING_MAX_SIZE]; + +// // SMBIOS tables often reference each other using // fixed constants, define a list of these constants // for our hardcoded tables @@ -101,10 +117,10 @@ STATIC SMBIOS_TABLE_TYPE1 mArmadaDefaultType1 =3D { }; =20 STATIC CHAR8 CONST *mArmadaDefaultType1Strings[] =3D { - "Marvell \0",/* Manufacturer */ - "Armada 7k/8k Family Board \0",/* Product Name placeholder*/ - "Revision unknown \0",/* Version placeholder */ - " \0",/* 32 character buffer */ + mSysInfoManufacturer, + mSysInfoProductName, + mSysInfoVersion, + mSysInfoSerial, NULL }; =20 @@ -129,10 +145,10 @@ STATIC SMBIOS_TABLE_TYPE2 mArmadaDefaultType2 =3D { }; =20 STATIC CHAR8 CONST *mArmadaDefaultType2Strings[] =3D { - "Marvell \0",/* Manufacturer */ - "Armada 7k/8k Family Board \0",/* Product Name placeholder*/ - "Revision unknown \0",/* Version placeholder */ - "Serial Not Set \0",/* Serial */ + mSysInfoManufacturer, + mSysInfoProductName, + mSysInfoVersion, + mSysInfoSerial, "Base of Chassis \0",/* Board location */ NULL }; @@ -160,9 +176,9 @@ STATIC SMBIOS_TABLE_TYPE3 mArmadaDefaultType3 =3D { }; =20 STATIC CHAR8 CONST *mArmadaDefaultType3Strings[] =3D { - "Marvell \0",/* Manufacturer placeholder */ - "Revision unknown \0",/* Version placeholder */ - "Serial Not Set \0",/* Serial placeholder */ + mSysInfoManufacturer, + mSysInfoVersion, + mSysInfoSerial, NULL }; =20 @@ -743,6 +759,45 @@ SmbiosMemoryInstall ( } =20 /** + Copy Type1, Type2, Type3 strings form PCD +**/ + +STATIC +VOID +MvSmbiosCopyStrings ( + VOID + ) +{ + EFI_STATUS Status; + + ASSERT (AsciiStrnLenS ((CHAR8 *)PcdGetPtr (PcdProductManufacturer), + MV_SMBIOS_STRING_MAX_SIZE) < MV_SMBIOS_STRING_MAX_SIZE); + ASSERT (AsciiStrnLenS ((CHAR8 *)PcdGetPtr (PcdProductPlatformName), + MV_SMBIOS_STRING_MAX_SIZE) < MV_SMBIOS_STRING_MAX_SIZE); + ASSERT (AsciiStrnLenS ((CHAR8 *)PcdGetPtr (PcdProductVersion), + MV_SMBIOS_STRING_MAX_SIZE) < MV_SMBIOS_STRING_MAX_SIZE); + ASSERT (AsciiStrnLenS ((CHAR8 *)PcdGetPtr (PcdProductSerial), + MV_SMBIOS_STRING_MAX_SIZE) < MV_SMBIOS_STRING_MAX_SIZE); + + Status =3D AsciiStrCpyS (mSysInfoManufacturer, + MV_SMBIOS_STRING_MAX_SIZE, + (CHAR8 *)PcdGetPtr (PcdProductManufacturer)); + ASSERT_EFI_ERROR (Status); + Status =3D AsciiStrCpyS (mSysInfoProductName, + MV_SMBIOS_STRING_MAX_SIZE, + (CHAR8 *)PcdGetPtr (PcdProductPlatformName)); + ASSERT_EFI_ERROR (Status); + Status =3D AsciiStrCpyS (mSysInfoVersion, + MV_SMBIOS_STRING_MAX_SIZE, + (CHAR8 *)PcdGetPtr (PcdProductVersion)); + ASSERT_EFI_ERROR (Status); + Status =3D AsciiStrCpyS (mSysInfoSerial, + MV_SMBIOS_STRING_MAX_SIZE, + (CHAR8 *)PcdGetPtr (PcdProductSerial)); + ASSERT_EFI_ERROR (Status); +} + +/** Install all structures from the DefaultTables structure =20 @param Smbios SMBIOS protocol @@ -760,6 +815,8 @@ SmbiosInstallAllStructures ( FirmwareMajorRevisionNumber =3D (PcdGet32 (PcdFirmwareRevision) >> 16) &= 0xFF; FirmwareMinorRevisionNumber =3D PcdGet32 (PcdFirmwareRevision) & 0xFF; =20 + MvSmbiosCopyStrings(); + // // Update Firmware Revision, CPU and DRAM frequencies. // --=20 2.7.4 -=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 (#48702): https://edk2.groups.io/g/devel/message/48702 Mute This Topic: https://groups.io/mt/34471905/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-