Bug #16475


loader.efi: replace comconsole with efiserialio

Added by Toomas Soome about 1 month ago. Updated about 1 month ago.

In Progress
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:
External Bug:


Current serial port support in UEFI version is implemented using BIOS comconsole driver. comconsole is implemented by performing IO port reads and writes.

The problem with this approach is, it is only usable on x86 platform and even on x86, there are implementations, which do not allow such approach (Hyper-V 2).

We need to implement serial port support by using UEFI provided Serial IO protocol. However, the Serial IO protocol is abstraction created on top of implementation specific IO protocol (Super IO, IsaIO to name two currently known), and is unfortunately lacking good option to identify serial port. So we need to use help from Device Path. To do that, there is two options; first one is to walk device path from right to left (towards root) and try to identify each path component. Second option is to query for known serial port implementation protocols, get respective device path and see if this path is parent for our serial io protocol device path. The first option does not allow us to identify IO protocol to read protocol specific attributes, and second option is limited by our knowledge about possible IO protocols.

Fortunately, it appears there are two common protocols we can use right now - Super IO Protocol and ISA IO Protocol, checking those two should allow us to identify most ports.

While UEFI API does provide Serial IO protocol, some implementations do not allow to change serial port attributes (such as baudrate) - doing this can end up hung system (HyperV on aarch64 is one such case). Also, apparently the Serial IO protocol may be missing but IO ports still available (HyperV on Windows 11), or accessing IO ports directly can cause VM to hung (azure).

Still need to determine the best approach to handle exceptions for attribute change (probably the best option would be to remove ttyX entries from /boot/solaris/bootenv.rc and maybe use VM type detection), to implement fallback to IO port mechanism on x86, I have used implementation based on IsaIO protocol and creating "fake" io protocol instances in case we do not have serial ports detected otherwise.

Testing done so far: used vmware fusion vm, qemu, UTM (qemu), and Oeacle X6-2 and supermicro X10SAE physical systems. All mentioned are providing Serial IO. To test IsaIO and IO ports, I did disable efiserialio implementation in loader config and used only efiisaio implementation. Systems where serial port access is implemented via IsaIO were able to use serial ports using IsaIO protocol, and systems with Super IO did fall back on IO port based approach as expected.

Actions #1

Updated by Electric Monk about 1 month ago

  • Gerrit CR set to 3422

Also available in: Atom PDF