]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB
authorRebecca Cran <rebecca@nuviainc.com>
Mon, 4 Oct 2021 16:22:33 +0000 (10:22 -0600)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Oct 2021 09:25:52 +0000 (09:25 +0000)
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>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c

index 5aea32521bd3c774bafa6ed9ff4ba5824ac42a79..5679ebaac8a54b4fb18edaf843f0ca9b93936332 100644 (file)
@@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
   SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32 (PcdFdBaseAddress) / SIZE_64KB);\r
   if (BiosPhysicalSize < SIZE_16MB) {\r
     SmbiosRecord->BiosSize = Base2ToByteWith64KUnit (BiosPhysicalSize) - 1;\r
-    SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;\r
-    SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB\r
   } else {\r
     SmbiosRecord->BiosSize = 0xFF;\r
-    if (BiosPhysicalSize > 0x3FFF) {\r
+    if (BiosPhysicalSize < SIZE_16GB) {\r
+      SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;\r
+      SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB\r
+    } else {\r
       SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1GB;\r
       SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB\r
     }\r