[edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version

horacex.lien@intel.com posted 1 patch 8 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
Posted by horacex.lien@intel.com 8 months ago
From: HoraceX Lien <horacex.lien@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4544

These value of Major/Minor version are updated from SMBIOS memory data,
but BCD Revision is updated from PCD PcdSmbiosVersion.
We should also update PCD PcdSmbiosVersion from SMBIOS memory data,
to ensure that get consistent version value.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: HoraceX Lien <horacex.lien@intel.com>
---
 MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 1a86e69d3c..e3f6215033 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1072,7 +1072,7 @@ SmbiosCreateTable (
     DEBUG ((DEBUG_INFO, "SmbiosCreateTable: Initialize 32-bit entry point structure\n"));
     EntryPointStructureData.MajorVersion      = mPrivateData.Smbios.MajorVersion;
     EntryPointStructureData.MinorVersion      = mPrivateData.Smbios.MinorVersion;
-    EntryPointStructureData.SmbiosBcdRevision = (UINT8)((PcdGet16 (PcdSmbiosVersion) >> 4) & 0xf0) | (UINT8)(PcdGet16 (PcdSmbiosVersion) & 0x0f);
+    EntryPointStructureData.SmbiosBcdRevision = (mPrivateData.Smbios.MajorVersion << 4) | mPrivateData.Smbios.MinorVersion;
     PhysicalAddress                           = 0xffffffff;
     Status                                    = gBS->AllocatePages (
                                                        AllocateMaxAddress,
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108150): https://edk2.groups.io/g/devel/message/108150
Mute This Topic: https://groups.io/mt/101057293/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
Posted by Michael D Kinney 8 months ago
Are mPrivateData.Smbios.MajorVersion and mPrivateData.Smbios.MinorVersion
guaranteed to be in range 0..9?

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> horacex.lien@intel.com
> Sent: Wednesday, August 30, 2023 2:13 AM
> To: devel@edk2.groups.io
> Cc: Lien, HoraceX <horacex.lien@intel.com>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not
> match with SMBIOS version
> 
> From: HoraceX Lien <horacex.lien@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4544
> 
> These value of Major/Minor version are updated from SMBIOS memory data,
> but BCD Revision is updated from PCD PcdSmbiosVersion.
> We should also update PCD PcdSmbiosVersion from SMBIOS memory data,
> to ensure that get consistent version value.
> 
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: HoraceX Lien <horacex.lien@intel.com>
> ---
>  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> index 1a86e69d3c..e3f6215033 100644
> --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> @@ -1072,7 +1072,7 @@ SmbiosCreateTable (
>      DEBUG ((DEBUG_INFO, "SmbiosCreateTable: Initialize 32-bit entry point
> structure\n"));
> 
>      EntryPointStructureData.MajorVersion      =
> mPrivateData.Smbios.MajorVersion;
> 
>      EntryPointStructureData.MinorVersion      =
> mPrivateData.Smbios.MinorVersion;
> 
> -    EntryPointStructureData.SmbiosBcdRevision = (UINT8)((PcdGet16
> (PcdSmbiosVersion) >> 4) & 0xf0) | (UINT8)(PcdGet16 (PcdSmbiosVersion) &
> 0x0f);
> 
> +    EntryPointStructureData.SmbiosBcdRevision =
> (mPrivateData.Smbios.MajorVersion << 4) | mPrivateData.Smbios.MinorVersion;
> 
>      PhysicalAddress                           = 0xffffffff;
> 
>      Status                                    = gBS->AllocatePages (
> 
>                                                         AllocateMaxAddress,
> 
> --
> 2.31.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#108150): https://edk2.groups.io/g/devel/message/108150
> Mute This Topic: https://groups.io/mt/101057293/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108195): https://edk2.groups.io/g/devel/message/108195
Mute This Topic: https://groups.io/mt/101057293/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
Posted by Lien, HoraceX 8 months ago
Hi Mike,

I have change code to 
EntryPointStructureData.SmbiosBcdRevision = ((mPrivateData.Smbios.MajorVersion & 0x0f) << 4) | (mPrivateData.Smbios.MinorVersion & 0x0f);
Add &0x0F to mask upper nibble bit, do we still need to guarantee that range is between 0-9? Because the old code only filtered 4 bits, instead of accurately filtering the number range 0-9.

Thanks,
Horace Lien

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@intel.com> 
Sent: Thursday, August 31, 2023 11:56 PM
To: devel@edk2.groups.io; Lien, HoraceX <horacex.lien@intel.com>
Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Zeng, Star <star.zeng@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version

Are mPrivateData.Smbios.MajorVersion and mPrivateData.Smbios.MinorVersion guaranteed to be in range 0..9?

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of 
> horacex.lien@intel.com
> Sent: Wednesday, August 30, 2023 2:13 AM
> To: devel@edk2.groups.io
> Cc: Lien, HoraceX <horacex.lien@intel.com>; Liu, Zhiguang 
> <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Zeng, Star 
> <star.zeng@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/SmbiosDxe: Fix BcdRevision 
> is not match with SMBIOS version
> 
> From: HoraceX Lien <horacex.lien@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4544
> 
> These value of Major/Minor version are updated from SMBIOS memory 
> data, but BCD Revision is updated from PCD PcdSmbiosVersion.
> We should also update PCD PcdSmbiosVersion from SMBIOS memory data, to 
> ensure that get consistent version value.
> 
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: HoraceX Lien <horacex.lien@intel.com>
> ---
>  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> index 1a86e69d3c..e3f6215033 100644
> --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
> @@ -1072,7 +1072,7 @@ SmbiosCreateTable (
>      DEBUG ((DEBUG_INFO, "SmbiosCreateTable: Initialize 32-bit entry 
> point structure\n"));
> 
>      EntryPointStructureData.MajorVersion      =
> mPrivateData.Smbios.MajorVersion;
> 
>      EntryPointStructureData.MinorVersion      =
> mPrivateData.Smbios.MinorVersion;
> 
> -    EntryPointStructureData.SmbiosBcdRevision = (UINT8)((PcdGet16
> (PcdSmbiosVersion) >> 4) & 0xf0) | (UINT8)(PcdGet16 (PcdSmbiosVersion) 
> & 0x0f);
> 
> +    EntryPointStructureData.SmbiosBcdRevision =
> (mPrivateData.Smbios.MajorVersion << 4) | 
> mPrivateData.Smbios.MinorVersion;
> 
>      PhysicalAddress                           = 0xffffffff;
> 
>      Status                                    = gBS->AllocatePages (
> 
>                                                         
> AllocateMaxAddress,
> 
> --
> 2.31.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#108150): 
> https://edk2.groups.io/g/devel/message/108150
> Mute This Topic: https://groups.io/mt/101057293/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108227): https://edk2.groups.io/g/devel/message/108227
Mute This Topic: https://groups.io/mt/101057293/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-