git: 145ef4af15f0 - stable/14 - smbios: Search for v3 (64-bit) entry point first on BIOS boot

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 08 Apr 2025 13:40:48 UTC
The branch stable/14 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=145ef4af15f09aa06d4ae53ea1abd2a281d63f82

commit 145ef4af15f09aa06d4ae53ea1abd2a281d63f82
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-02-28 16:54:42 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-04-08 13:38:23 +0000

    smbios: Search for v3 (64-bit) entry point first on BIOS boot
    
    When booted from BIOS (i.e., not EFI), also search for a 64-bit version
    of the SMBIOS Entry Point.
    
    This allows us to detect and report the proper SMBIOS version with
    BIOSes that only provide the v3 table, as happens on Hetzner virtual
    machines.
    
    For machines that provide both, leverage the v3 table in priority
    consistently with the EFI case.
    
    PR:             284460
    Reviewed by:    markj, imp (both older version)
    MFC after:      2 weeks
    Relnotes:       yes
    Event:          February src bug-busting session
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D49179
    
    (cherry picked from commit bc7f6508363c5cf4544044e00bbaf71de8f0168d)
---
 sys/dev/smbios/smbios.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c
index 9fd37becb43a..7886376523e1 100644
--- a/sys/dev/smbios/smbios.c
+++ b/sys/dev/smbios/smbios.c
@@ -103,9 +103,15 @@ smbios_identify (driver_t *driver, device_t parent)
 #endif
 
 #if defined(__amd64__) || defined(__i386__)
-	if (addr == 0)
-		addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
+	if (addr == 0) {
+		addr = bios_sigsearch(SMBIOS_START, SMBIOS3_SIG, SMBIOS3_LEN,
 		    SMBIOS_STEP, SMBIOS_OFF);
+		if (addr != 0)
+			map_size = sizeof(*eps3);
+		else
+			addr = bios_sigsearch(SMBIOS_START,
+			    SMBIOS_SIG, SMBIOS_LEN, SMBIOS_STEP, SMBIOS_OFF);
+	}
 #endif
 
 	if (addr != 0) {