git: 34c94bee0cee - stable/15 - loader.efi: Only use SPCR if enabled.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Jan 2026 17:48:05 UTC
The branch stable/15 has been updated by imp:
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(-)
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 436676368447..607d765a3245 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -850,10 +850,10 @@ acpi_uart_parity(UINT8 p)
}
/*
- * See if we can find a SPCR ACPI table in the static tables. If so, then it
- * describes the serial console that's been redirected to, so we know that at
- * least there's a serial console. this is most important for embedded systems
- * that don't have traidtional PC serial ports.
+ * See if we can find an enabled SPCR ACPI table in the static tables. If so,
+ * then it describes the serial console that's been redirected to, so we know
+ * that at least there's a serial console. This is most important for embedded
+ * systems that don't have traidtional PC serial ports.
*
* All the two letter variables in this function correspond to their usage in
* the uart(4) console string. We use io == -1 to select between I/O ports and
@@ -869,8 +869,12 @@ check_acpi_spcr(void)
const char *dt, *pa;
char *val = NULL;
+ /*
+ * The SPCR is enabled when SerialPort is non-zero. Address being zero
+ * should suffice to see if it's disabled.
+ */
spcr = acpi_find_table(ACPI_SIG_SPCR);
- if (spcr == NULL)
+ if (spcr == NULL || spcr->SerialPort.Address == 0)
return (0);
dt = acpi_uart_type(spcr->InterfaceType);
if (dt == NULL) { /* Kernel can't use unknown types */