From 2efbc8e2840f6c0b8255a46527f2cdb32ace1bd1 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 24 May 2023 16:34:21 -0600 Subject: [PATCH] stand/efi/smbios: Move detection of smbios earlier. It would be nice to make decisions early in boot, about maybe consoles, based on smbios variables. Set them just after we setup the archsw so we can use them everywhere. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D40219 --- stand/efi/loader/main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index e5f9b40ae55..8419331f7a1 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -930,6 +930,22 @@ main(int argc, CHAR16 *argv[]) archsw.arch_readin = efi_readin; archsw.arch_zfs_probe = efi_zfs_probe; +#if !defined(__arm__) + for (k = 0; k < ST->NumberOfTableEntries; k++) { + guid = &ST->ConfigurationTable[k].VendorGuid; + if (!memcmp(guid, &smbios, sizeof(EFI_GUID)) || + !memcmp(guid, &smbios3, sizeof(EFI_GUID))) { + char buf[40]; + + snprintf(buf, sizeof(buf), "%p", + ST->ConfigurationTable[k].VendorTable); + setenv("hint.smbios.0.mem", buf, 1); + smbios_detect(ST->ConfigurationTable[k].VendorTable); + break; + } + } +#endif + /* Get our loaded image protocol interface structure. */ (void) OpenProtocolByHandle(IH, &imgid, (void **)&boot_img); @@ -1181,22 +1197,6 @@ main(int argc, CHAR16 *argv[]) autoload_font(false); /* Set up the font list for console. */ efi_init_environment(); -#if !defined(__arm__) - for (k = 0; k < ST->NumberOfTableEntries; k++) { - guid = &ST->ConfigurationTable[k].VendorGuid; - if (!memcmp(guid, &smbios, sizeof(EFI_GUID)) || - !memcmp(guid, &smbios3, sizeof(EFI_GUID))) { - char buf[40]; - - snprintf(buf, sizeof(buf), "%p", - ST->ConfigurationTable[k].VendorTable); - setenv("hint.smbios.0.mem", buf, 1); - smbios_detect(ST->ConfigurationTable[k].VendorTable); - break; - } - } -#endif - interact(); /* doesn't return */ return (EFI_SUCCESS); /* keep compiler happy */