This patch refactors the EFI boot1 and loader components, bringing them more in line with the EFI API. A summary of changes follows:
- An efifs driver is provided which translates the EFI_SIMPLE_FILE_SYSTEM interface into the fs_ops interface. This replaces all existing fs_ops drivers in loader
- The sys/boot/efi/drivers directory is set up to contain files that provide drivers using the EFI API interfaces. The efipart driver is moved from loader into this directory.
- A dual to the efifs driver which translates the fs_ops interface to the EFI_SIMPLE_FILE_SYSTEM interface is provided. This provides support for all existing filesystems through the EFI_SIMPLE_FILE_SYSTEM interface.
- boot1 is converted to use libefi, install the EFI drivers from sys/boot/efi/drivers, and use the EFI_SIMPLE_FILE_SYSTEM interface to load loader.efi. Most of the existing boot1 code including all the boot modules are discarded as they are replaced by the code in sys/boot/efi/drivers.
- Some refactoring of efipart has taken place to make it more closely resemble the EFI driver model. However, EFI drivers support dynamic discovery, and this is currently incompatible with the design of the bcache system, thus it could not be completely converted to the EFI driver model.
This patch is the first component of EFI GELI support and provides necessary refactoring for that work. However, the patch has a rationale as a standalone patch:
- Unification of the boot1 and loader drivers eliminates the need to support two sets of drivers.
- The complexity of boot1 is greatly reduced.
- Drivers are initialized and installed on device handles only once during the execution of both of boot1 and loader. This has benefits now, but becomes particularly important with regard to GELI, where initialization implies asking for passwords.
- Both boot1 and loader now use the EFI_SIMPLE_FILE_SYSTEM interface to load files. This means they can make use of drivers installed by GRUB, coreboot, and other such loaders.
- It should be fairly straightforward to export the existing filesystem drivers as EFI drivers, thereby providing implementations to GRUB and other EFI-based loaders.
- Having loader use the EFI driver-based model provides the foundation for hot-pluggable device support. Note that this is not fully complete, as refactoring of bcache to support dynamic device addition/removal is necessary for this to work.