Page MenuHomeFreeBSD

UEFI: combine GetMemoryMap and ExitBootServices and retry on error
ClosedPublic

Authored by emaste on Nov 27 2015, 2:06 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 12, 6:15 AM
Unknown Object (File)
Mon, Dec 2, 3:09 PM
Unknown Object (File)
Thu, Nov 28, 8:49 PM
Unknown Object (File)
Thu, Nov 28, 8:15 PM
Unknown Object (File)
Nov 12 2024, 7:28 AM
Unknown Object (File)
Nov 5 2024, 2:57 PM
Unknown Object (File)
Nov 2 2024, 6:10 PM
Unknown Object (File)
Oct 30 2024, 2:54 AM

Details

Summary

Glue together calls to GetMemoryMap(), ExitBootServices() and storage of (now up-to-date) MODINFOMD_EFI_MAP metadata within a single function.

That new function -bi_add_efi_data_and_exit()- uses space previously allocated in bi_load_efi_data() to store the memory map (it will fail if that space is too short). It handles re-calling GetMemoryMap() once to update the map key if necessary. Finally, if ExitBootServices() is successful, it stores the memory map and its header as MODINFOMD_EFI_MAP metadata.

ExitBootServices() calls are now done earlier, from within arch-independent bi_load() code. The patch has only been tested on amd64 ; tests on other archs are welcome ! I have not modified i386 code as it seems to have its own bi_load() and separate code, but it may be good to make it benefit from supporting map key re-fetching if ExitBootServices() fails.

Submitted by: Ganael LAPLANCHE
PR: 202455

With minor style(9) whitespace tweaks

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste retitled this revision from to UEFI: combine GetMemoryMap and ExitBootServices and retry on error.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added reviewers: andrew, jhb.
emaste added subscribers: benno, imp.
kib added inline comments.
sys/boot/efi/loader/bootinfo.c
245

Space after if before (, excessive ()s. But why this check at all ?

258

May be, print 'Try %d: ExitBootServices() returned %d\n", i, ...);' to make it more clean to user that this is transient.

sys/boot/efi/loader/bootinfo.c
258

I moved the printf out of the loop completely, since it's not an error or warning case.

kib added a reviewer: kib.
This revision is now accepted and ready to land.Dec 7 2015, 8:58 PM

I think this is OK. I have some patches I need to get into the tree that let you use runtime services, but that's more of a need to communicate the memory map to UEFI...

This revision was automatically updated to reflect the committed changes.