Page MenuHomeFreeBSD

LinuxKPI: Implement efi_enabled(EFI_BOOT)
ClosedPublic

Authored by wulf on Dec 6 2021, 11:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 26, 1:43 PM
Unknown Object (File)
Apr 10 2025, 4:57 PM
Unknown Object (File)
Apr 10 2025, 1:39 PM
Unknown Object (File)
Feb 28 2025, 12:07 PM
Unknown Object (File)
Feb 20 2025, 9:14 PM
Unknown Object (File)
Feb 11 2025, 1:59 PM
Unknown Object (File)
Feb 11 2025, 1:36 PM
Unknown Object (File)
Feb 11 2025, 1:18 PM

Details

Summary

efi_enabled(EFI_BOOT) returns true if machine was booted from EFI
Used by drm-kmod and some unported drm drivers like hyperv

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wulf requested review of this revision.Dec 6 2021, 11:59 AM
sys/compat/linuxkpi/common/include/linux/efi.h
59

Is it possible to catch this compile time with a static assert, CTASSERT() or _Static_assert() ?

Add _Static_assert wrapper for compile-time argument checking

This revision is now accepted and ready to land.Dec 6 2021, 12:55 PM
sys/compat/linuxkpi/common/include/linux/efi.h
56

I thought we had a more direct EFI enabled variable these days....

bool efi_boot;

in machdep.c. Is there some reason that wasn't used? We use the above to search it out early in boot, why not use the cached result?

bz added inline comments.
sys/compat/linuxkpi/common/include/linux/efi.h
30

_BSD_LKPI_ is a new one to me; can that be _LINUXKPI_ ?

sys/compat/linuxkpi/common/include/linux/efi.h
30

It must be _LINUX_EFI_H_. I will fix it.

56

efi_boot is defined on amd64 only while MODINFOMD_EFI_MAP exists on every platform which is able to boot from EFI

Use cached efi_boot value on amd64

This revision now requires review to proceed.Dec 6 2021, 10:48 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 10 2022, 7:51 PM
This revision was automatically updated to reflect the committed changes.