Bug 292206 - loader generates invalid hw.uart.console value when serial console redirection is disabled, preventing system from booting
Summary: loader generates invalid hw.uart.console value when serial console redirectio...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 15.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-05 20:42 UTC by Jarmo Jaakkola
Modified: 2026-07-19 09:19 UTC (History)
10 users (show)

See Also:
imp: mfc-stable15?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarmo Jaakkola 2026-01-05 20:42:54 UTC
FreeBSD 15.0 fails to boot with UEFI on a Dell PowerEdge T310 when serial console redirection is off.  EFI framebuffer information is printed and the system them reboots before any kernel messages are printed.

When serial console redirection is off on this system, loader sets hw.uart.console to

    OK show hw.uart.console
    db:8,dt:ns8250,mm:0,rs:-4,rw:1,pa:none,br:0,xo=0

Notice mm of 0 and rs of -4.  This value causes system to reboot.  For comparison, when serial console redirection to COM1 is on, the value is

    OK show hw.uart.console
    db:8,dt:ns8250,io:0x3f8,pa:none,br=115200,xo=0

Unsetting the invalid value or setting it to a valid one (e.g. COM1 one) allows the system to boot.

The problem is that check_acpi_spcr() fails to account for an ACPI SPCR entry for disabled serial console redirection, i.e. one where the "Base Address" field (SerialPort in the struct) is zero.  The invalid value is set if the table of disabled redircetion presents a non-PCI device (vendor ID and device ID are 0xffff).

https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table

Here is what ACPI SPCR contains on the system when serial console redirection is off:

    # acpidump -T SPCR
    /*
      SPCR: Length=80, Revision=1, Checksum=235,
            OEMID=DELL, OEM Table ID=PE_SC3, OEM Revision=0x1,
            Creator ID=DELL, Creator Revision=0x1
            InterfaceType=0 (Fully 16550-compatible)
            SerialPort=0x0000000000000000:0[0] (Memory)
            InterruptType=0x3 (PC/AT IRQ,I/O APIC)
            PcInterrupt=4 (Valid)
            Interrupt=4
            BaudRate=0 (0)
            Parity=0
            StopBits=1
            FlowControl=2
            TerminalType=1 (Extended VT100)
            PciDeviceId=0xffff
            PciVendorId=0xffff
            PciBus=0
            PciDevice=0
            PciFunction=0
            PciFlags=0
            PciSegment=0
     */

Note that on some systems disabling console redirection removes the ACPI SPCR table instead of presenting a disabled one (e.g. Lenovo ThinkStation P500).

I have prepared a patch, for which I will shortly create a GitHub pull request and link it here.
Comment 1 Jarmo Jaakkola 2026-01-05 21:04:20 UTC
GitHub PR:

https://github.com/freebsd/freebsd-src/pull/1948
Comment 2 Jarmo Jaakkola 2026-01-05 21:27:15 UTC
I did not fully investigate what exactly causes the system to reboot, only the conditions for triggering it.  My wild guess is that the kernel does not properly validate the hw.uart.console value and then tries to use 0x0 as memory mapped I/O address and -4 as register shift.

If my hunch is correct, I'd suppose that in addition to my suggested fix that prevents loader from generating the invalid value, the kernel should also try to validate the values it receives in hw.uart.console.
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-01-08 05:29:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d82698ac68c23d856716dc9f6524b9ef363d7eba

commit d82698ac68c23d856716dc9f6524b9ef363d7eba
Author:     Jarmo Jaakkola <jarmo.jaakkola@roskakori.fi>
AuthorDate: 2026-01-08 05:14:56 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-01-08 05:28:44 +0000

    loader.efi: Only use SPCR if enabled.

    SerialPort in the SPCR is zeroed when serial redirection is disabled,
    rather than the SPCR being omitted from the ACPI tables ony many
    systems. Check to see that SerialPort.Address is non-zero before using.

    FreeBSD would fail to boot on systems that could have a serial port
    redireciton, but don't have it enabled because the loader would create a
    bogus hw.uart.console. While one could unset this value to boot, you
    couldn't do that automatically very easily. Instead, don't even look
    at the SPCR table if the SerialPort is zero'd.

    PR: 292206
    MFC After: 3 days
    Sponsored by: Netflix
    Co-authored-by: Warner Losh <imp@FreeBSD.org>
    Closes:  https://github.com/freebsd/freebsd-src/pull/1948

 stand/efi/loader/main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
Comment 4 Warner Losh freebsd_committer freebsd_triage 2026-01-08 05:29:59 UTC
great catch! thanks for the PR patch! I wound up tweaking the comments in a different way, but keeping the rest.
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-01-13 17:48:25 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=34c94bee0cee0cbf67e14d47809acc751fca8da5

commit 34c94bee0cee0cbf67e14d47809acc751fca8da5
Author:     Jarmo Jaakkola <jarmo.jaakkola@roskakori.fi>
AuthorDate: 2026-01-08 05:14:56 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-01-13 17:30:21 +0000

    loader.efi: Only use SPCR if enabled.

    SerialPort in the SPCR is zeroed when serial redirection is disabled,
    rather than the SPCR being omitted from the ACPI tables ony many
    systems. Check to see that SerialPort.Address is non-zero before using.

    FreeBSD would fail to boot on systems that could have a serial port
    redireciton, but don't have it enabled because the loader would create a
    bogus hw.uart.console. While one could unset this value to boot, you
    couldn't do that automatically very easily. Instead, don't even look
    at the SPCR table if the SerialPort is zero'd.

    PR: 292206
    MFC After: 3 days
    Sponsored by: Netflix
    Co-authored-by: Warner Losh <imp@FreeBSD.org>
    Closes:  https://github.com/freebsd/freebsd-src/pull/1948

    (cherry picked from commit d82698ac68c23d856716dc9f6524b9ef363d7eba)

 stand/efi/loader/main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
Comment 6 Michael Dexter freebsd_triage 2026-01-17 07:54:31 UTC
If this PR is indeed a duplicate of 291461 (or vice versa), in testing DCH's patched 15.0-RELEASE memstick and the most recent 16.0-CURRENT snapshot, the HPE DL325 Gen 10 EPYC boots and this issue appears to be resolved. I did not experiment with the serial-related aspect of it, but the non-booting system is now booting as expected.

Thank you for attending to it!