public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB
@ 2021-10-04 16:22 Rebecca Cran
  2021-10-04 18:00 ` Sami Mujawar
  0 siblings, 1 reply; 4+ messages in thread
From: Rebecca Cran @ 2021-10-04 16:22 UTC (permalink / raw)
  To: devel, Sami Mujawar, Leif Lindholm, Ard Biesheuvel, Nhi Pham; +Cc: Rebecca Cran

According to the SMBIOS specification, the ExtendedBiosSize field should
be zero when the BIOS size is less than 16MB:

"Size (n) where 64K * (n+1) is the size of the
physical device containing the BIOS, in
bytes.
FFh - size is 16MB or greater, see Extended
BIOS ROM Size for actual size."

Fix the code in MiscBiosVendorFunction.c to only populate the
ExtendedBiosSize field if the BIOS size is greater than 16MB.

Fix the code to correctly populate the ExtendedBiosSize field with the
unit bits set to MB if the size is between 16MB and 16GB.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
---
 ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
index 5aea32521bd3..5679ebaac8a5 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
@@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
   SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32 (PcdFdBaseAddress) / SIZE_64KB);
   if (BiosPhysicalSize < SIZE_16MB) {
     SmbiosRecord->BiosSize = Base2ToByteWith64KUnit (BiosPhysicalSize) - 1;
-    SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
-    SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
   } else {
     SmbiosRecord->BiosSize = 0xFF;
-    if (BiosPhysicalSize > 0x3FFF) {
+    if (BiosPhysicalSize < SIZE_16GB) {
+      SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
+      SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
+    } else {
       SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1GB;
       SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB
     }
-- 
2.31.1


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

* Re: [PATCH 1/1] ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB
  2021-10-04 16:22 [PATCH 1/1] ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB Rebecca Cran
@ 2021-10-04 18:00 ` Sami Mujawar
  2021-10-05  3:04   ` Nhi Pham
  0 siblings, 1 reply; 4+ messages in thread
From: Sami Mujawar @ 2021-10-04 18:00 UTC (permalink / raw)
  To: Rebecca Cran, devel, Leif Lindholm, Ard Biesheuvel, Nhi Pham, nd

Hi Rebecca,

Thank you for this patch. These changes look good to me.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 04/10/2021 05:22 PM, Rebecca Cran wrote:
> According to the SMBIOS specification, the ExtendedBiosSize field should
> be zero when the BIOS size is less than 16MB:
>
> "Size (n) where 64K * (n+1) is the size of the
> physical device containing the BIOS, in
> bytes.
> FFh - size is 16MB or greater, see Extended
> BIOS ROM Size for actual size."
>
> Fix the code in MiscBiosVendorFunction.c to only populate the
> ExtendedBiosSize field if the BIOS size is greater than 16MB.
>
> Fix the code to correctly populate the ExtendedBiosSize field with the
> unit bits set to MB if the size is between 16MB and 16GB.
>
> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
> ---
>   ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> index 5aea32521bd3..5679ebaac8a5 100644
> --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> @@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
>     SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32 (PcdFdBaseAddress) / SIZE_64KB);
>     if (BiosPhysicalSize < SIZE_16MB) {
>       SmbiosRecord->BiosSize = Base2ToByteWith64KUnit (BiosPhysicalSize) - 1;
> -    SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
> -    SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
>     } else {
>       SmbiosRecord->BiosSize = 0xFF;
> -    if (BiosPhysicalSize > 0x3FFF) {
> +    if (BiosPhysicalSize < SIZE_16GB) {
> +      SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
> +      SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
> +    } else {
>         SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1GB;
>         SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB
>       }

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH 1/1] ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB
  2021-10-04 18:00 ` Sami Mujawar
@ 2021-10-05  3:04   ` Nhi Pham
  2021-10-05  9:31     ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Nhi Pham @ 2021-10-05  3:04 UTC (permalink / raw)
  To: Rebecca Cran; +Cc: Sami Mujawar, devel, Leif Lindholm, Ard Biesheuvel, nd

Thanks, Rebecca for the patch.

Acked-by: Nhi Pham <nhi@os.amperecomputing.com>

Best regards,
Nhi

On 05/10/2021 01:00, Sami Mujawar wrote:
> Hi Rebecca,
>
> Thank you for this patch. These changes look good to me.
>
> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
>
> Regards,
>
> Sami Mujawar
>
> On 04/10/2021 05:22 PM, Rebecca Cran wrote:
>> According to the SMBIOS specification, the ExtendedBiosSize field should
>> be zero when the BIOS size is less than 16MB:
>>
>> "Size (n) where 64K * (n+1) is the size of the
>> physical device containing the BIOS, in
>> bytes.
>> FFh - size is 16MB or greater, see Extended
>> BIOS ROM Size for actual size."
>>
>> Fix the code in MiscBiosVendorFunction.c to only populate the
>> ExtendedBiosSize field if the BIOS size is greater than 16MB.
>>
>> Fix the code to correctly populate the ExtendedBiosSize field with the
>> unit bits set to MB if the size is between 16MB and 16GB.
>>
>> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
>> ---
>> ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c 
>> | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git 
>> a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c 
>> b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
>> index 5aea32521bd3..5679ebaac8a5 100644
>> --- 
>> a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
>> +++ 
>> b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
>> @@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
>>     SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32 
>> (PcdFdBaseAddress) / SIZE_64KB);
>>     if (BiosPhysicalSize < SIZE_16MB) {
>>       SmbiosRecord->BiosSize = Base2ToByteWith64KUnit 
>> (BiosPhysicalSize) - 1;
>> -    SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
>> -    SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
>>     } else {
>>       SmbiosRecord->BiosSize = 0xFF;
>> -    if (BiosPhysicalSize > 0x3FFF) {
>> +    if (BiosPhysicalSize < SIZE_16GB) {
>> +      SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / 
>> SIZE_1MB;
>> +      SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
>> +    } else {
>>         SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / 
>> SIZE_1GB;
>>         SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB
>>       }
>
> IMPORTANT NOTICE: The contents of this email and any attachments are 
> confidential and may also be privileged. If you are not the intended 
> recipient, please notify the sender immediately and do not disclose 
> the contents to any other person, use it for any purpose, or store or 
> copy the information in any medium. Thank you.

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

* Re: [PATCH 1/1] ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB
  2021-10-05  3:04   ` Nhi Pham
@ 2021-10-05  9:31     ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2021-10-05  9:31 UTC (permalink / raw)
  To: Nhi Pham
  Cc: Rebecca Cran, Sami Mujawar, edk2-devel-groups-io, Leif Lindholm,
	Ard Biesheuvel, nd

On Tue, 5 Oct 2021 at 05:05, Nhi Pham <nhi@os.amperecomputing.com> wrote:
>
> Thanks, Rebecca for the patch.
>
> Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
>

Merged as #2040

Thanks,


> Best regards,
> Nhi
>
> On 05/10/2021 01:00, Sami Mujawar wrote:
> > Hi Rebecca,
> >
> > Thank you for this patch. These changes look good to me.
> >
> > Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
> >
> > Regards,
> >
> > Sami Mujawar
> >
> > On 04/10/2021 05:22 PM, Rebecca Cran wrote:
> >> According to the SMBIOS specification, the ExtendedBiosSize field should
> >> be zero when the BIOS size is less than 16MB:
> >>
> >> "Size (n) where 64K * (n+1) is the size of the
> >> physical device containing the BIOS, in
> >> bytes.
> >> FFh - size is 16MB or greater, see Extended
> >> BIOS ROM Size for actual size."
> >>
> >> Fix the code in MiscBiosVendorFunction.c to only populate the
> >> ExtendedBiosSize field if the BIOS size is greater than 16MB.
> >>
> >> Fix the code to correctly populate the ExtendedBiosSize field with the
> >> unit bits set to MB if the size is between 16MB and 16GB.
> >>
> >> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
> >> ---
> >> ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> >> | 7 ++++---
> >>   1 file changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git
> >> a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> >> b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> >> index 5aea32521bd3..5679ebaac8a5 100644
> >> ---
> >> a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> >> +++
> >> b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> >> @@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
> >>     SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32
> >> (PcdFdBaseAddress) / SIZE_64KB);
> >>     if (BiosPhysicalSize < SIZE_16MB) {
> >>       SmbiosRecord->BiosSize = Base2ToByteWith64KUnit
> >> (BiosPhysicalSize) - 1;
> >> -    SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
> >> -    SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
> >>     } else {
> >>       SmbiosRecord->BiosSize = 0xFF;
> >> -    if (BiosPhysicalSize > 0x3FFF) {
> >> +    if (BiosPhysicalSize < SIZE_16GB) {
> >> +      SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize /
> >> SIZE_1MB;
> >> +      SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
> >> +    } else {
> >>         SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize /
> >> SIZE_1GB;
> >>         SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB
> >>       }
> >
> > IMPORTANT NOTICE: The contents of this email and any attachments are
> > confidential and may also be privileged. If you are not the intended
> > recipient, please notify the sender immediately and do not disclose
> > the contents to any other person, use it for any purpose, or store or
> > copy the information in any medium. Thank you.

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

end of thread, other threads:[~2021-10-05  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-04 16:22 [PATCH 1/1] ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB Rebecca Cran
2021-10-04 18:00 ` Sami Mujawar
2021-10-05  3:04   ` Nhi Pham
2021-10-05  9:31     ` Ard Biesheuvel

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