Page MenuHomeFreeBSD

amd64: allow the mapping of other regions for efirt
ClosedPublic

Authored by vexeduxr on Thu, Jul 3, 1:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jul 10, 5:00 PM
Unknown Object (File)
Tue, Jul 8, 3:08 AM
Unknown Object (File)
Mon, Jul 7, 6:29 PM
Unknown Object (File)
Mon, Jul 7, 6:29 PM
Unknown Object (File)
Mon, Jul 7, 4:01 PM
Unknown Object (File)
Mon, Jul 7, 3:36 AM
Unknown Object (File)
Sun, Jul 6, 7:54 PM
Subscribers
None

Details

Summary

Some BIOSes access data outside of regions marked as "runtime" in their
runtime EFI functios. 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

Test Plan

A combination of machdep.efirt.regs=0x10 and D51147 fixes EFI poweroff on a dell latitude e7440.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 65187
Build 62070: arc lint + arc unit

Event Timeline

vexeduxr created this revision.
sys/amd64/amd64/machdep.c
801

What's this trying to do? Just avoid using it if we've flagged it as something to be mapped? Why not always do this?

sys/amd64/amd64/efirt_machdep.c
219

I would add a macro like

#define EFI_MAP_BOOTTYPE_ALLOWED(type) ((efi_map_regs >> (type)) & 1) != 0)

and used it there and in machdep.c.

sys/amd64/amd64/machdep.c
801

Because this memory otherwise can be usefully utilized by OS. It might be off limits severely impacting the available memory to the host.

sys/amd64/include/efi.h
57

Does this var need to be 64bit? Wouldn't uint32 enough?

sys/amd64/include/efi.h
57

Yes, but there's no TUNABLE_UINT_FETCH. Although, an int32_t would work too; we only need the first 14 bits.

Change efi_map_regs to an int32_t.

Create a EFI_MAP_BOOTTYPE_ALLOWED macro, and use it in efirt_machdep.c and machdep.c.

sys/amd64/include/efi.h
57

'>>' works better with unsigned. Would the change compile with efi_map_regs declared as uint32_t?

sys/amd64/include/efi.h
57

Yes, it compiles.

This revision is now accepted and ready to land.Fri, Jul 4, 7:53 PM