On Sun, Jul 06, 2025 at 07:28:21PM +0000, Ahmad Khalifa wrote: > The branch main has been updated by vexeduxr: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 > > commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 > Author: Ahmad Khalifa <vexed...@freebsd.org> > AuthorDate: 2025-07-06 19:10:25 +0000 > Commit: Ahmad Khalifa <vexed...@freebsd.org> > CommitDate: 2025-07-06 19:26:07 +0000 > > amd64: allow the mapping of other regions for efirt > > Some BIOSes access data outside of regions marked as "runtime" in their > runtime EFI functions. Allow the mapping and preservation of other > regions through a tunable. > > The tunable is a bitmap specifying the regions to map. e.g bit 3 would > be set to map BootServicesCode. > > Currently allowed regions are: > BootServicesCode > BootServicesData > RuntimeServicesCode > RuntimeServicesData > ACPIMemoryNVS > > PR: 287422 > Reviewed by: kib > Approved by: imp (mentor) > Differential Revision: https://reviews.freebsd.org/D51146 > --- > sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- > sys/amd64/amd64/machdep.c | 8 ++++++-- > sys/amd64/include/efi.h | 4 ++++ > 3 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c > index 81a28ebe97ee..75c357f6e3df 100644 > --- a/sys/amd64/amd64/efirt_machdep.c > +++ b/sys/amd64/amd64/efirt_machdep.c > @@ -56,6 +56,15 @@ > #include <vm/vm_pager.h> > #include <vm/vm_radix.h> > > +/* The EFI regions we're allowed to map. */ > +#define EFI_ALLOWED_TYPES_MASK ( \ > + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ > + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ > + 1u << EFI_MD_TYPE_FIRMWARE \ > +) > + > +uint32_t efi_map_regs; > +
Apparently efi_map_regs must be defined in amd64/machdep.c and not in efirt_machdep.c. If efirt is compiled as module, efo_map_regs gets undefined in the kernel.