public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <leif.lindholm@linaro.org>
To: Marcin Wojtas <mw@semihalf.com>
Cc: devel@edk2.groups.io, ard.biesheuvel@linaro.org,
	jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com,
	Patryk Duda <pdk@semihalf.com>
Subject: Re: [edk2-platforms: PATCH v4 8/9] Marvell/Drivers: SmbiosPlatformDxe: Load SMBIOS strings from PCD
Date: Mon, 14 Oct 2019 09:43:07 +0100	[thread overview]
Message-ID: <20191014084306.GA25504@bivouac.eciton.net> (raw)
In-Reply-To: <1570807231-4155-9-git-send-email-mw@semihalf.com>

On Fri, Oct 11, 2019 at 05:20:30PM +0200, Marcin Wojtas wrote:
> From: Patryk Duda <pdk@semihalf.com>
> 
> 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.PcdProductSerial
>   gMarvellTokenSpaceGuid.PcdProductVersion
> 
> Signed-off-by: Patryk Duda <pdk@semihalf.com>
> ---
>  Silicon/Marvell/Marvell.dec                                     |  6 ++++++
>  Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf |  4 ++++
>  Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c   | 22 ++++++++++----------
>  3 files changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec
> index d337d3e..cdf8154 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
>  
> +#Platform description
> +  gMarvellTokenSpaceGuid.PcdProductManufacturer|"Marvell"|VOID*|0x50000100
> +  gMarvellTokenSpaceGuid.PcdProductPlatformName|"Marvell Development Board"|VOID*|0x50000101
> +  gMarvellTokenSpaceGuid.PcdProductSerial|"Serial Not Set"|VOID*|0x50000103
> +  gMarvellTokenSpaceGuid.PcdProductVersion|"Revision unknown"|VOID*|0x50000102
> +
>  #RTC
>    gMarvellTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT64|0x40000052
>  
> diff --git a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf 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 @@
>  
>  [FixedPcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision
> +  gMarvellTokenSpaceGuid.PcdProductManufacturer
> +  gMarvellTokenSpaceGuid.PcdProductPlatformName
> +  gMarvellTokenSpaceGuid.PcdProductSerial
> +  gMarvellTokenSpaceGuid.PcdProductVersion
>  
>  [Protocols]
>    gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED
> diff --git a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
> index 08f4fa7..d29478c 100644
> --- a/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
> +++ b/Silicon/Marvell/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
> @@ -101,10 +101,10 @@ STATIC SMBIOS_TABLE_TYPE1 mArmadaDefaultType1 = {
>  };
>  
>  STATIC CHAR8 CONST *mArmadaDefaultType1Strings[] = {
> -  "Marvell                        \0",/* Manufacturer */
> -  "Armada 7k/8k Family Board      \0",/* Product Name placeholder*/
> -  "Revision unknown               \0",/* Version placeholder */
> -  "                               \0",/* 32 character buffer */
> +  (CHAR8 *)PcdGetPtr (PcdProductManufacturer),
> +  (CHAR8 *)PcdGetPtr (PcdProductPlatformName),
> +  (CHAR8 *)PcdGetPtr (PcdProductVersion),
> +  (CHAR8 *)PcdGetPtr (PcdProductSerial),

These really ought to be (CONST CHAR8 *), as the compiler informs you
if dropping the cast altogether:
pointer targets in initialization of ‘const CHAR8 *’ {aka ‘const char
*’} from ‘const UINT8 *’ {aka ‘const unsigned char *’} differ in signedness

The build error without the cast is related to the type the pointer is
pointing to (UINT8), not the const attribute.

This would fail if we started building with clang -Weverything, or
ecplicitly with -Wcast-qual:
error: cast from 'const unsigned char *' to 'char *' drops const
qualifier [-Werror,-Wcast-qual]

Could you resubmit a version of this patch addressing only this
concern, throughout?

Best Regards,

Leif


>    NULL
>  };
>  
> @@ -129,10 +129,10 @@ STATIC SMBIOS_TABLE_TYPE2 mArmadaDefaultType2 = {
>  };
>  
>  STATIC CHAR8 CONST *mArmadaDefaultType2Strings[] = {
> -  "Marvell                        \0",/* Manufacturer */
> -  "Armada 7k/8k Family Board      \0",/* Product Name placeholder*/
> -  "Revision unknown               \0",/* Version placeholder */
> -  "Serial Not Set                 \0",/* Serial */
> +  (CHAR8 *)PcdGetPtr (PcdProductManufacturer),
> +  (CHAR8 *)PcdGetPtr (PcdProductPlatformName),
> +  (CHAR8 *)PcdGetPtr (PcdProductVersion),
> +  (CHAR8 *)PcdGetPtr (PcdProductSerial),
>    "Base of Chassis                \0",/* Board location */
>    NULL
>  };
> @@ -160,9 +160,9 @@ STATIC SMBIOS_TABLE_TYPE3 mArmadaDefaultType3 = {
>  };
>  
>  STATIC CHAR8 CONST *mArmadaDefaultType3Strings[] = {
> -  "Marvell                        \0",/* Manufacturer placeholder */
> -  "Revision unknown               \0",/* Version placeholder */
> -  "Serial Not Set                 \0",/* Serial placeholder */
> +  (CHAR8 *)PcdGetPtr (PcdProductManufacturer),
> +  (CHAR8 *)PcdGetPtr (PcdProductVersion),
> +  (CHAR8 *)PcdGetPtr (PcdProductSerial),
>    NULL
>  };
>  
> -- 
> 2.7.4
> 

  reply	other threads:[~2019-10-14  8:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 15:20 [edk2-platforms: PATCH v4 0/9] Marvell Octeon CN913X SoC family support Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 1/9] Marvell/Armada7k8k: Fix 32-bit compilation Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 2/9] Marvell/Cn9130Db: Add ACPI tables Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 3/9] Marvell/Cn9130Db: Introduce board support Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 4/9] Marvell/Library: ArmadaSoCDescLib/MppLib: Extend Xenon information Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 5/9] Marvell/Library: IcuLib: Fix debug information Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 6/9] Marvell/Cn9131Db: Introduce board support Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 7/9] Marvell/Cn9132Db: " Marcin Wojtas
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 8/9] Marvell/Drivers: SmbiosPlatformDxe: Load SMBIOS strings from PCD Marcin Wojtas
2019-10-14  8:43   ` Leif Lindholm [this message]
2019-10-11 15:20 ` [edk2-platforms: PATCH v4 9/9] Marvell: Customize per-board SBMIOS strings Marcin Wojtas
2019-10-14  8:44   ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191014084306.GA25504@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox