mirror of
https://github.com/opnsense/src.git
synced 2026-02-18 18:20:26 -05:00
loader.efi: smbios: Favor the v3 (64-bit) entry point
Be consistent with what we are now doing with non-EFI boot (but with the difference that EFI runs in 64-bit mode on 64-bit platforms, so there is no restriction that the v3 entry point should be below 4GB). While here, move out the EFI smbios detection code in a separate sub-routine. Reviewed by: imp, markj MFC after: 2 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49292 (cherry picked from commit 96f77576e9ea83b3a5d1a02a24da7d54c06a58a8)
This commit is contained in:
parent
f6b90dc8af
commit
807d51be80
1 changed files with 36 additions and 15 deletions
|
|
@ -946,12 +946,45 @@ acpi_detect(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
efi_smbios_detect(void)
|
||||
{
|
||||
VOID *smbios_v2_ptr = NULL;
|
||||
UINTN k;
|
||||
|
||||
for (k = 0; k < ST->NumberOfTableEntries; k++) {
|
||||
EFI_GUID *guid;
|
||||
VOID *const VT = ST->ConfigurationTable[k].VendorTable;
|
||||
char buf[40];
|
||||
bool is_smbios_v2, is_smbios_v3;
|
||||
|
||||
guid = &ST->ConfigurationTable[k].VendorGuid;
|
||||
is_smbios_v2 = memcmp(guid, &smbios, sizeof(*guid)) == 0;
|
||||
is_smbios_v3 = memcmp(guid, &smbios3, sizeof(*guid)) == 0;
|
||||
|
||||
if (!is_smbios_v2 && !is_smbios_v3)
|
||||
continue;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%p", VT);
|
||||
setenv("hint.smbios.0.mem", buf, 1);
|
||||
if (is_smbios_v2)
|
||||
/*
|
||||
* We will parse a v2 table only if we don't find a v3
|
||||
* table. In the meantime, store the address.
|
||||
*/
|
||||
smbios_v2_ptr = VT;
|
||||
else if (smbios_detect(VT) != NULL)
|
||||
/* v3 parsing succeeded, we are done. */
|
||||
return;
|
||||
}
|
||||
if (smbios_v2_ptr != NULL)
|
||||
(void)smbios_detect(smbios_v2_ptr);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
main(int argc, CHAR16 *argv[])
|
||||
{
|
||||
EFI_GUID *guid;
|
||||
int howto, i, uhowto;
|
||||
UINTN k;
|
||||
bool has_kbd, is_last;
|
||||
char *s;
|
||||
EFI_DEVICE_PATH *imgpath;
|
||||
|
|
@ -974,19 +1007,7 @@ main(int argc, CHAR16 *argv[])
|
|||
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;
|
||||
}
|
||||
}
|
||||
efi_smbios_detect();
|
||||
#endif
|
||||
|
||||
/* Get our loaded image protocol interface structure. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue