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)
Fri, Apr 26, 2:34 AM
Unknown Object (File)
Jan 4 2024, 4:39 AM
Unknown Object (File)
Dec 21 2023, 4:41 AM
Unknown Object (File)
Dec 20 2023, 1:42 AM
Unknown Object (File)
Dec 13 2023, 4:10 PM
Unknown Object (File)
Nov 27 2023, 12:37 AM
Unknown Object (File)
Oct 25 2023, 2:10 PM
Unknown Object (File)
Oct 16 2023, 1:51 PM

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #10537)

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

258 ↗(On Diff #10537)

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 ↗(On Diff #10892)

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.