Opened 3 years ago

Last modified 3 years ago

#17663 new bug

Convert x86 EFI bootloader to gUART via acpi?

Reported by: kallisti5 Owned by:
Priority: normal Milestone: Unscheduled
Component: System/Boot Loader/EFI Version: R1/beta3
Keywords: uart Cc:
Blocked By: Blocking:
Platform: x86-64

Description (last modified by kallisti5)

On x86 EFI, we currently hard-code sSerialBasePort on x86 and use it directly.

To assist in supporting alternative serial ports, we should likely only choose sSerialBasePort / 0x3f8 when no other options are available on x86.

To accomplish this, x86 should likely follow the design used from non-x86 platforms.

  • src/system/boot/platform/efi/serial.cpp uses gUART if not NULL
  • src/system/boot/platform/efi/dtb.cpp assigns gUART based on the optional dtb
  • src/system/boot/platform/efi/acpi.cpp should also assign gUART based on the configured ports?
  • src/system/kernel/arch/generic/debug_uart_8250.cpp could be used for x86? (even a fixed 0x3f8 fallback?)

Change History (3)

comment:1 by kallisti5, 3 years ago

Description: modified (diff)
Summary: Convert x86 EFI bootloader to gUARTConvert x86 EFI bootloader to gUART via acpi?

comment:2 by kallisti5, 3 years ago

ACPI - DSDT identifies serial ports via _DDN.COM1 , _DDN.COM2. This is likely a good place to start.

comment:3 by pulkomandy, 3 years ago

sSerialBasePort is set in system/kernel/arch/x86/arch_debug_console.cpp for x86. It is initially hardcoded to 0x3f8 but can be set to other values using the kernel setting serial_debug_port in arch_debug_console_init_settings(). The value in the settings file can be either an hardcoded address, or an index into platform_args.serial_base_ports.

This function can be extended to search for serial ports in any other desirable way, for example, recognizing PCI devices declaring themselves as serial ports, ACPI, ...

Possibly it could be moved from "arch" to "platform" too?

For other platforms (non-x86) it probably makes sense to have no hardcoded address and use platform_args.serial_base_ports[0] by default. It seems riscv64 and ARM already do something similar, but instead of platform_args they get it from arch_args.uart, and they don't allow any customization or search besides the UART specified there by the bootloader.

Note: See TracTickets for help on using tickets.