Page MenuHomeFreeBSD

smbios: support getting address from EFI

Authored by on Mar 15 2021, 8:53 PM.
Referenced Files
Unknown Object (File)
Mon, Feb 19, 10:28 AM
Unknown Object (File)
Mon, Feb 12, 4:03 PM
Unknown Object (File)
Sun, Jan 28, 7:35 PM
Unknown Object (File)
Sat, Jan 27, 1:55 PM
Unknown Object (File)
Sat, Jan 27, 9:17 AM
Unknown Object (File)
Jan 24 2024, 10:45 AM
Unknown Object (File)
Dec 29 2023, 1:20 AM
Unknown Object (File)
Dec 29 2023, 1:20 AM



On some systems (e.g. Lenovo ThinkPad X240, Apple MacBookPro12,1) the SMBIOS entry point is not found in the <0xFFFFF space.

Follow the SMBIOS spec and use the EFI Configuration Table for locating the entry point on EFI systems.

I'm not sure if I need any other conditionals to like, exclude kernels built without EFI support… (if anyone cares about that)

Test Plan

Boot on various systems that didn't attach smbios before, observe smbios attaching with fancy high addresses.


[17] smbios0: <System Management BIOS> at iomem 0xbcd3d000-0xbcd3d01e
[17] smbios0: Version: 2.7, BCD Revision: 2.7


[91] smbios0: <System Management BIOS> at iomem 0x8afad000-0x8afad01e
[91] smbios0: Version: 2.7

Diff Detail

rG FreeBSD src repository
Lint Skipped
Tests Skipped

Event Timeline created this revision.

oops, forgot efi.h change

41 ↗(On Diff #85795)

These don't seem to be used anywhere in the tree.

This looks grossly correct to me, but it's been a long time since I've thought about this stuff. IIRC @ambrisko did some stuff with SMBIOS a ways back; Doug?

Has this been testing on systems without UEFI BIOS? I'm not sure what happens if efirt is loaded on a non-UEFI system? Please include testing on non UEFI system and UEFI system. QEMU can be used to test in legacy BIOS mode. Please include testing results from both environments. FYI, the loader should set hint.smbios.0.mem in UEFI mode so that can be used a quick check on the address. It is good to verify the address is not in the BIOS range when testing. Some UEFI systems have a combined legacy and UEFI env.

I'm not sure what happens if efirt is loaded on a non-UEFI system?

options EFIRT is in GENERIC.


It would be nice to spell this #if ARCH_MAY_USE_EFI so this condition doesn't proliferate. Every arch already has <machine/efi.h>, so it would be easy to add.


I would prefer to put this on the stack instead of permanently wasting 16 bytes.


This should go under the same #if as efi_smbios.

Looks pretty good. I would agree that it should be tested on a LEGACY (non-UEFI) BIOS.



  • options EFIRT is not in MINIMAL, so now device smbios can't be either, so kldload smbios would be the way to go in MINIMAL
  • address feedback
vangyzen added inline comments.

<sys/efi.h> already includes <machine/efi.h>, so this is not needed.

This revision is now accepted and ready to land.Mar 31 2021, 10:11 PM

oops, thought I did remove that include, but somehow didn't

This revision now requires review to proceed.Apr 1 2021, 1:29 PM Please look back over the comments from @ambrisko . In particular, I'd like to see testing on a non-UEFI system.

@rpokala or @ambrisko Would you like to take another look?

This revision is now accepted and ready to land.Apr 2 2021, 3:24 PM

Code LGTM. ==@ambrisko WRT testing on legacy BIOS platforms.

smbios still attaches on a bhyve VM running FreeBSD main plus this change, booting in Legacy BIOS mode. The device address did not change, of course.

smbios0: <System Management BIOS> at iomem 0xf1000-0xf101e
smbios0: Version: 2.6, BCD Revision: 2.6
This revision was automatically updated to reflect the committed changes.