Index: stand/efi/loader/bootinfo.c =================================================================== --- stand/efi/loader/bootinfo.c +++ stand/efi/loader/bootinfo.c @@ -119,6 +119,14 @@ NULL, NULL); } } + if (getenv("efi_com_mmio") != NULL && + getenv("efi_com_speed") != NULL && /* verifies uart mode */ + getenv("hw.uart.console") == NULL) { + snprintf(buf, sizeof(buf), "mm:%s,rs:2", + getenv("efi_com_mmio")); + env_setenv("hw.uart.console", EV_VOLATILE, buf, NULL, + NULL); + } #endif } Index: stand/efi/loader/main.c =================================================================== --- stand/efi/loader/main.c +++ stand/efi/loader/main.c @@ -736,6 +736,15 @@ setenv(key, buf, 1); } +static void +setenv_addr(const char *key, uint64_t addr) +{ + char buf[30]; + + snprintf(buf, sizeof(buf), "0x%llx", addr); + setenv(key, buf, 1); +} + /* * Parse ConOut (the list of consoles active) and see if we can find a * serial port and/or a video port. It would be nice to also walk the @@ -752,6 +761,7 @@ EFI_DEVICE_PATH *node; ACPI_HID_DEVICE_PATH *acpi; UART_DEVICE_PATH *uart; + VENDOR_DEVICE_PATH *hw; bool pci_pending; how = 0; @@ -801,6 +811,14 @@ * so only match it if it's last. */ pci_pending = true; + } else if (DevicePathType(node) == HARDWARE_DEVICE_PATH && + DevicePathSubType(node) == HW_VENDOR_DP) { + hw = (void *)node; + + if (DevicePathNodeLength(&hw->Header) == + sizeof(*hw) + sizeof(uint64_t)) { + setenv_addr("efi_com_mmio", *(uint64_t *)(hw + 1)); + } } node = NextDevicePathNode(node); }