[SeaBIOS] [PATCH v2 5/6] bios_version: Remove misinterpreted version string

Sam Eiderman posted 6 patches 5 years, 3 months ago
[SeaBIOS] [PATCH v2 5/6] bios_version: Remove misinterpreted version string
Posted by Sam Eiderman 5 years, 3 months ago
From: Liran Alon <liran.alon@oracle.com>

This is a workaround for the Windows kernel wrongly extracting
SystemBiosVersion.

Windows kernel extracts various BIOS information at boot-time.
The method it use to extract SystemBiosVersion is very hueristic.
It is done by nt!CmpGetBiosVersion().

nt!CmpGetBiosVersion() works by scanning all BIOS memory
from 0xF0000 to 0xFFFFF in search for a string of the form x.y
where x & y are digits. When it finds such a string, it goes
a bunch of characters backwards until an unknown character is reached,
checks whether the string contains any of "v 0", "v 1", "Rev ", etc...
if it does - a match was found. It then continues to find the next
matches.

In our case, this lead to a debug-print string
"Intel IGD BDSM enabled at 0x%08x, size %lldMB, dev 00:02.0"
to be treated as BIOS version (Because of "2.0" at the end, and the
"v 0" contained in it).

This can be seen by:
    * Typing "wmic bios get biosversion" in CMD
    * Reading "HKLM\HARDWARE\DESCRIPTION\System" "SystemBiosVersion"

Therefore, this commit solves the issue by just creating the "00:02.0"
string dynamically, like in the rest of the file.

For reference implementation of nt!CmpGetBiosVersion(), see ReactOS:
https://doxygen.reactos.org/d5/dd2/i386_2cmhardwr_8c.html

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 src/fw/pciinit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index c0634bcb..5b934d10 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -328,7 +328,8 @@ static void intel_igd_setup(struct pci_device *dev, void *arg)
         pci_config_writel(bdf, 0x5C, cpu_to_le32((u32)addr));
 
         dprintf(1, "Intel IGD BDSM enabled at 0x%08x, size %lldMB, dev "
-                "00:02.0\n", (u32)addr, bdsm_size >> 20);
+                "%02x:%02x.%x\n", (u32)addr, bdsm_size >> 20,
+                0, 2, 0);
     }
 }
 
-- 
2.13.3
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org