public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
@ 2023-09-25  2:06 Lien, HoraceX
  2023-09-25  3:07 ` Guo, Gua
  0 siblings, 1 reply; 2+ messages in thread
From: Lien, HoraceX @ 2023-09-25  2:06 UTC (permalink / raw)
  To: devel
  Cc: HoraceX Lien, Zhiguang Liu, Gua Guo, Dandan Bi, Michael D Kinney,
	Star Zeng, Zhichao Gao

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 BCD Revision from SMBIOS memory data,
to ensure that get consistent version value.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@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 | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 1a86e69d3c..2ef7b8e21c 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1072,14 +1072,18 @@ 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);
-    PhysicalAddress                           = 0xffffffff;
-    Status                                    = gBS->AllocatePages (
-                                                       AllocateMaxAddress,
-                                                       EfiRuntimeServicesData,
-                                                       EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
-                                                       &PhysicalAddress
-                                                       );
+    EntryPointStructureData.SmbiosBcdRevision = 0;
+    if ((mPrivateData.Smbios.MajorVersion <= 9) && (mPrivateData.Smbios.MinorVersion <= 9)) {
+      EntryPointStructureData.SmbiosBcdRevision = ((mPrivateData.Smbios.MajorVersion & 0x0f) << 4) | (mPrivateData.Smbios.MinorVersion & 0x0f);
+    }
+
+    PhysicalAddress = 0xffffffff;
+    Status          = gBS->AllocatePages (
+                             AllocateMaxAddress,
+                             EfiRuntimeServicesData,
+                             EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
+                             &PhysicalAddress
+                             );
     if (EFI_ERROR (Status)) {
       DEBUG ((DEBUG_ERROR, "SmbiosCreateTable () could not allocate EntryPointStructure < 4GB\n"));
       Status = gBS->AllocatePages (
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109028): https://edk2.groups.io/g/devel/message/109028
Mute This Topic: https://groups.io/mt/101567470/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [PATCH v2] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
  2023-09-25  2:06 [edk2-devel] [PATCH v2] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version Lien, HoraceX
@ 2023-09-25  3:07 ` Guo, Gua
  0 siblings, 0 replies; 2+ messages in thread
From: Guo, Gua @ 2023-09-25  3:07 UTC (permalink / raw)
  To: Lien, HoraceX, devel@edk2.groups.io
  Cc: Liu, Zhiguang, Bi, Dandan, Kinney, Michael D, Zeng, Star,
	Gao, Zhichao

Reviewed-by: Gua Guo <gua.guo@intel.com>

-----Original Message-----
From: Lien, HoraceX <horacex.lien@intel.com> 
Sent: Monday, September 25, 2023 10:07 AM
To: devel@edk2.groups.io
Cc: Lien, HoraceX <horacex.lien@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Guo, Gua <gua.guo@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Zeng, Star <star.zeng@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: [PATCH v2] 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 BCD Revision from SMBIOS memory data, to ensure that get consistent version value.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@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 | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 1a86e69d3c..2ef7b8e21c 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1072,14 +1072,18 @@ 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);

-    PhysicalAddress                           = 0xffffffff;

-    Status                                    = gBS->AllocatePages (

-                                                       AllocateMaxAddress,

-                                                       EfiRuntimeServicesData,

-                                                       EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),

-                                                       &PhysicalAddress

-                                                       );

+    EntryPointStructureData.SmbiosBcdRevision = 0;

+    if ((mPrivateData.Smbios.MajorVersion <= 9) && 
+ (mPrivateData.Smbios.MinorVersion <= 9)) {

+      EntryPointStructureData.SmbiosBcdRevision = 
+ ((mPrivateData.Smbios.MajorVersion & 0x0f) << 4) | 
+ (mPrivateData.Smbios.MinorVersion & 0x0f);

+    }

+

+    PhysicalAddress = 0xffffffff;

+    Status          = gBS->AllocatePages (

+                             AllocateMaxAddress,

+                             EfiRuntimeServicesData,

+                             EFI_SIZE_TO_PAGES (sizeof 
+ (SMBIOS_TABLE_ENTRY_POINT)),

+                             &PhysicalAddress

+                             );

     if (EFI_ERROR (Status)) {

       DEBUG ((DEBUG_ERROR, "SmbiosCreateTable () could not allocate EntryPointStructure < 4GB\n"));

       Status = gBS->AllocatePages (

--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109031): https://edk2.groups.io/g/devel/message/109031
Mute This Topic: https://groups.io/mt/101567470/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-25  3:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25  2:06 [edk2-devel] [PATCH v2] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version Lien, HoraceX
2023-09-25  3:07 ` Guo, Gua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox