Some firmware supports an OsIndications variable, with a bit for
boot_to_fw. To support efi-setup, we check if the boot_to_fw bit is
advertised as supported in OsIndicationsSupported, then we set the bit and
issue our standard efi_reboot(). The system then enters into the firmware
menu upon reboot, which is super useful as the time window to hit the menu
normally may be annoyingly small.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 42336 Build 39224: arc lint + arc unit
Event Timeline
I was trying to figure out where I could fit this into userland (maybe as part of reboot(8)?), but everywhere seems awkward... I think this is a good addition, even if i do eventually find a spot in userland.
efi-setup? That's a bit of an odd name. Is there a precedent elsewhere?
efibootmgr calls it --fw-ui or --no-fw-ui (which is likely how to do it in 'reboot' since it's an out-of-band communication to an external component). If you need to put it in reboot(8), you'll need to put it in halt(8), shutdown(8) and maybe one or two others I've forgotten. It's likely best to just use the efibootmgr functionality than to try to gum up the reset(2) system call...
IPMI spells this 'chassis bootdev bios' of all things, but I think sticking with the efibootmgr and calling it 'efi-fw-ui' (possibly with an alias to efi-setup if this code is being upstreamed from a vendor)
stand/efi/libefi/env.c | ||
---|---|---|
1006 | The env variable is supposed to be a UINT64. We should use that standard name. | |
1013 | I couldn't find this documented in the standard. Do you have a better reference? | |
1040 | UEFI defines these as a UINT64. We've generally tried to follow the UEFI typedefs where possible. | |
1051 | Don't we have a routine to map EFI status to an error message? | |
1065 | do you also need to check vsize here? | |
1071 | If it is not found, how do you know the size to use on one of these older systems that stores it as 32-bits? | |
1073 | UEFI v2.6? And 'UEFI v2.6 table 11 specifies its attributes: ' might be a better comment. As would chasing this down to the latest UEFI standard 2.9 where it's table 3-1. |
A-ha! It's not in efibootmgr's usage and I didn't think to check the manpage. I'm fine with that...
IPMI spells this 'chassis bootdev bios' of all things, but I think sticking with the efibootmgr and calling it 'efi-fw-ui' (possibly with an alias to efi-setup if this code is being upstreamed from a vendor)
Not upstreamed, more than happy to change it!
stand/efi/libefi/env.c | ||
---|---|---|
1013 | Nope... my only reference is a little further up in the file, in efi_print_global(). I assume it's a problem with old Macs or something, Maybe @tsoome knows, he seems to have added the comment... | |
1065 | I'm going to (hope) that the 32-bit OsIndicationsSupported thing is just a fluke and that those systems still use 64-bit OsIndications like the standard ended up with, but maybe @tsoome can shed some light here as well. |
stand/efi/libefi/efienv.c | ||
---|---|---|
68 | I guess we can here just specify NV | BS | RT attribute. If some other combination is needed, we can call efi_setenv directly. | |
stand/efi/libefi/env.c | ||
1013 | I think I did notice this in grub or there was some case with some user. Not sure if we actually should pay too much attention on 32-bit variant there - especially as the specification does state 64-bit value. | |
1038 | I was thinking to add flag for reboot command (and/or environment variable check). like 'reboot -f' and "BOOT_TO_FW_UI". Just dropping the idea there:) |