* [PATCH] ShellPkg: Add a condition to print accurate type0 Bios Size in smbiosview. @ 2023-04-21 1:00 tputta 2023-05-04 14:37 ` [edk2-devel] " Nickle Wang 0 siblings, 1 reply; 3+ messages in thread From: tputta @ 2023-04-21 1:00 UTC (permalink / raw) To: devel; +Cc: Ray Ni, Zhichao Gao As per the SMBIOS spec, in smbios type0 table, if the Bios size is greater than 16MB, extended bios size is used to update size information and bios size is set to 0xff. when this data is printed by smbiosview, both bios size and extended bios size is printed if the smbios version is beyond 3.1, which is incorrect as Bios size is set to 0xff when rom size is more than 16MB. To fix this bug, added a condition to print bios size only when it is not set to 0xff or if the smbios version is older than 3.1. Signed-off-by: Thejaswani Putta <tputta@nvidia.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> --- .../Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c index 1811cf0c44..5448abaa22 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -339,7 +339,9 @@ SmbiosPrintStructure ( ShellPrintEx (-1, -1, L"BIOS Version: %a\n", LibGetSmbiosString (Struct, Struct->Type0->BiosVersion)); ShellPrintEx (-1, -1, L"BIOS Starting Address Segment: 0x%x\n", Struct->Type0->BiosSegment); ShellPrintEx (-1, -1, L"BIOS Release Date: %a\n", LibGetSmbiosString (Struct, Struct->Type0->BiosReleaseDate)); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1)); + if ((Struct->Type0->BiosSize != 0xFF) || !(AE_SMBIOS_VERSION (0x3, 0x1))) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1)); + } DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *)(UINTN)&(Struct->Type0->BiosCharacteristics)), Option); -- 2.17.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH] ShellPkg: Add a condition to print accurate type0 Bios Size in smbiosview. 2023-04-21 1:00 [PATCH] ShellPkg: Add a condition to print accurate type0 Bios Size in smbiosview tputta @ 2023-05-04 14:37 ` Nickle Wang 2023-05-09 8:59 ` Gao, Zhichao 0 siblings, 1 reply; 3+ messages in thread From: Nickle Wang @ 2023-05-04 14:37 UTC (permalink / raw) To: devel@edk2.groups.io, Thejaswani Putta, Ray Ni, Zhichao Gao; +Cc: Nick Ramirez [-- Attachment #1: Type: text/plain, Size: 2939 bytes --] Hi @Ray Ni<mailto:ray.ni@intel.com>, @Zhichao Gao<mailto:zhichao.gao@intel.com>, Could you please help to review this change? Thanks, Nickle > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Thejaswani > Putta via groups.io > Sent: Friday, April 21, 2023 9:00 AM > To: devel@edk2.groups.io > Cc: Ray Ni <ray.ni@intel.com>; Zhichao Gao <zhichao.gao@intel.com> > Subject: [edk2-devel] [PATCH] ShellPkg: Add a condition to print accurate type0 > Bios Size in smbiosview. > > External email: Use caution opening links or attachments > > > As per the SMBIOS spec, in smbios type0 table, if the Bios size is greater than > 16MB, extended bios size is used to update size information and bios size is set > to 0xff. when this data is printed by smbiosview, both bios size and extended > bios size is printed if the smbios version is beyond 3.1, which is incorrect as Bios > size is set to 0xff when rom size is more than 16MB. > > To fix this bug, added a condition to print bios size only when it is not set to 0xff > or if the smbios version is older than 3.1. > > Signed-off-by: Thejaswani Putta <tputta@nvidia.com<mailto:tputta@nvidia.com>> > Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> > Cc: Zhichao Gao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>> > --- > .../Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > index 1811cf0c44..5448abaa22 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > @@ -339,7 +339,9 @@ SmbiosPrintStructure ( > ShellPrintEx (-1, -1, L"BIOS Version: %a\n", LibGetSmbiosString (Struct, > Struct->Type0->BiosVersion)); > ShellPrintEx (-1, -1, L"BIOS Starting Address Segment: 0x%x\n", Struct- > >Type0->BiosSegment); > ShellPrintEx (-1, -1, L"BIOS Release Date: %a\n", LibGetSmbiosString (Struct, > Struct->Type0->BiosReleaseDate)); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * > (Struct->Type0->BiosSize + 1)); > + if ((Struct->Type0->BiosSize != 0xFF) || !(AE_SMBIOS_VERSION (0x3, 0x1))) { > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * > (Struct->Type0->BiosSize + 1)); > + } > > DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *)(UINTN)&(Struct- > >Type0->BiosCharacteristics)), Option); > > -- > 2.17.1 > > > > > [-- Attachment #2: Type: text/html, Size: 7552 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH] ShellPkg: Add a condition to print accurate type0 Bios Size in smbiosview. 2023-05-04 14:37 ` [edk2-devel] " Nickle Wang @ 2023-05-09 8:59 ` Gao, Zhichao 0 siblings, 0 replies; 3+ messages in thread From: Gao, Zhichao @ 2023-05-09 8:59 UTC (permalink / raw) To: devel@edk2.groups.io, nicklew@nvidia.com, Thejaswani Putta, Ni, Ray Cc: Nick Ramirez [-- Attachment #1: Type: text/plain, Size: 3594 bytes --] Reviewed-by: Zhichao Gao zhichao.gao@intel.com<mailto:zhichao.gao@intel.com> Thanks, Zhichao From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle Wang via groups.io Sent: Thursday, May 4, 2023 10:37 PM To: devel@edk2.groups.io; Thejaswani Putta <tputta@nvidia.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com> Cc: Nick Ramirez <nramirez@nvidia.com> Subject: Re: [edk2-devel] [PATCH] ShellPkg: Add a condition to print accurate type0 Bios Size in smbiosview. Hi @Ray Ni<mailto:ray.ni@intel.com>, @Zhichao Gao<mailto:zhichao.gao@intel.com>, Could you please help to review this change? Thanks, Nickle > -----Original Message----- > From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Thejaswani > Putta via groups.io > Sent: Friday, April 21, 2023 9:00 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Zhichao Gao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>> > Subject: [edk2-devel] [PATCH] ShellPkg: Add a condition to print accurate type0 > Bios Size in smbiosview. > > External email: Use caution opening links or attachments > > > As per the SMBIOS spec, in smbios type0 table, if the Bios size is greater than > 16MB, extended bios size is used to update size information and bios size is set > to 0xff. when this data is printed by smbiosview, both bios size and extended > bios size is printed if the smbios version is beyond 3.1, which is incorrect as Bios > size is set to 0xff when rom size is more than 16MB. > > To fix this bug, added a condition to print bios size only when it is not set to 0xff > or if the smbios version is older than 3.1. > > Signed-off-by: Thejaswani Putta <tputta@nvidia.com<mailto:tputta@nvidia.com>> > Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> > Cc: Zhichao Gao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>> > --- > .../Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > index 1811cf0c44..5448abaa22 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > @@ -339,7 +339,9 @@ SmbiosPrintStructure ( > ShellPrintEx (-1, -1, L"BIOS Version: %a\n", LibGetSmbiosString (Struct, > Struct->Type0->BiosVersion)); > ShellPrintEx (-1, -1, L"BIOS Starting Address Segment: 0x%x\n", Struct- > >Type0->BiosSegment); > ShellPrintEx (-1, -1, L"BIOS Release Date: %a\n", LibGetSmbiosString (Struct, > Struct->Type0->BiosReleaseDate)); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * > (Struct->Type0->BiosSize + 1)); > + if ((Struct->Type0->BiosSize != 0xFF) || !(AE_SMBIOS_VERSION (0x3, 0x1))) { > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * > (Struct->Type0->BiosSize + 1)); > + } > > DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *)(UINTN)&(Struct- > >Type0->BiosCharacteristics)), Option); > > -- > 2.17.1 > > > > > [-- Attachment #2: Type: text/html, Size: 9961 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-09 9:00 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-04-21 1:00 [PATCH] ShellPkg: Add a condition to print accurate type0 Bios Size in smbiosview tputta 2023-05-04 14:37 ` [edk2-devel] " Nickle Wang 2023-05-09 8:59 ` Gao, Zhichao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox