summaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorJarmo Jaakkola <jarmo.jaakkola@roskakori.fi>2026-01-07 22:14:56 -0700
committerWarner Losh <imp@FreeBSD.org>2026-01-07 22:28:44 -0700
commitd82698ac68c23d856716dc9f6524b9ef363d7eba (patch)
tree6a022e5801947feb3202e8c44b43030196332659 /stand
parente2bedc7d69926426a710d035df51e0a0812d38b1 (diff)
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
Diffstat (limited to 'stand')
-rw-r--r--stand/efi/loader/main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index b731136fca4b..22dbd10a0f37 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -867,10 +867,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
@@ -886,8 +886,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 */