Compare commits

...

2 Commits

Author SHA1 Message Date
Leah Rowe fdbdf0449b Re-enable U-Boot x86 on real mainboards
The previous stability issues were resolved, thanks to
the previous revision which added a fix courtesy Simon Glass.

This reverts commit eba73c778a.
2024-11-19 22:48:21 +00:00
Leah Rowe b549d1e5f3 u-boot x86 serial/ns16550: disable UART as needed
U-Boot was hanging on hardware, but not Qemu. This is because on
the machines tested, namely the X200 and E6230 laptops supported
in Libreboot, the UART was disabled from coreboot.

This U-Boot patch from Simon Glass works around the issue by
silently disabling the UART when it isn't there. Instead,
output is sent to the display and U-Boot no longer hangs.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-11-19 22:46:29 +00:00
87 changed files with 345 additions and 30 deletions

View File

@ -6,5 +6,6 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="xhci"
vcfg="3050micro"
build_depend="seabios/default grub/xhci memtest86plus"
build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot"
IFD_platform="sklkbl"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="nvme"
vcfg="t1650"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -5,4 +5,5 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="nvme ahci ata"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -5,4 +5,5 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="nvme ahci ata"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -5,4 +5,5 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="nvme ahci ata"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -5,4 +5,5 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="nvme ahci ata"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="xhci"
vcfg="haswell"
build_depend="seabios/default grub/xhci memtest86plus"
build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="xhci"
vcfg="haswell"
build_depend="seabios/default grub/xhci memtest86plus"
build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,5 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="e6400"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="e6400"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_memtest="y"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,4 +4,5 @@ payload_seabios="y"
payload_memtest="y"
release="n"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp2170p"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp2560p"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp2570p"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="nvme"
vcfg="hp8200sff"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="nvme"
vcfg="hp8200sff"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -7,4 +7,5 @@ release="n"
grub_scan_disk="nvme ahci"
grubtree="xhci"
vcfg="hp820g2"
build_depend="seabios/default grub/xhci memtest86plus"
build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="nvme"
vcfg="ivybridge"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp8460pintel"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp8470pintel"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp8560w"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="hp9470m"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
xlang="c"
grub_scan_disk="nvme ahci"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
xlang="c"
grub_scan_disk="nvme ahci"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_memtest="y"
xlang="c"
build_depend="seabios/default memtest86plus"
build_depend="seabios/default memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
xlang="c"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
xlang="c"
grub_scan_disk="nvme ahci"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
xlang="c"
grub_scan_disk="nvme ahci"
grubtree="nvme"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
grub_scan_disk="ahci"
build_depend="seabios/default grub/default"
build_depend="seabios/default grub/default u-boot/i386coreboot"
payload_uboot_i386="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
scan_scan_disk="ahci"
build_depend="seabios/default grub/default"
build_depend="seabios/default grub/default u-boot/i386coreboot"
payload_uboot_i386="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -3,5 +3,4 @@ xarch="i386-elf"
payload_grub="y"
payload_seabios="y"
payload_memtest="y"
build_depend="seabios/default grub/default memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -3,3 +3,4 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
payload_memtest="y"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="nvme"
vcfg="t1650"
build_depend="seabios/default grub/nvme memtest86plus"
build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="xhci"
vcfg="haswell"
build_depend="seabios/default grub/xhci memtest86plus"
build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
grub_scan_disk="ahci"
build_depend="seabios/default grub/default"
build_depend="seabios/default grub/default u-boot/i386coreboot"
payload_uboot_i386="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
grub_scan_disk="ahci"
build_depend="seabios/default grub/default"
build_depend="seabios/default grub/default u-boot/i386coreboot"
payload_uboot_i386="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -6,4 +6,5 @@ payload_memtest="y"
grub_scan_disk="nvme ahci"
grubtree="xhci"
vcfg="haswell"
build_depend="seabios/default grub/xhci memtest86plus"
build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -4,3 +4,4 @@ payload_seabios="y"
payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="sandybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
grub_scan_disk="ahci"
vcfg="ivybridge"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
release="n"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
release="n"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -5,3 +5,4 @@ payload_grub="y"
payload_memtest="y"
release="n"
grub_scan_disk="ahci"
payload_uboot_amd64="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
grub_scan_disk="ahci"
build_depend="seabios/default grub/default"
build_depend="seabios/default grub/default u-boot/i386coreboot"
payload_uboot_i386="y"

View File

@ -3,4 +3,5 @@ xarch="i386-elf"
payload_seabios="y"
payload_grub="y"
grub_scan_disk="ahci"
build_depend="seabios/default grub/default"
build_depend="seabios/default grub/default u-boot/i386coreboot"
payload_uboot_i386="y"

View File

@ -1,7 +1,7 @@
. "include/rom.sh"
makeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
build_depend="seabios/default grub/default memtest86plus"
build_depend="seabios/default grub/default memtest86plus u-boot/amd64coreboot"
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"

View File

@ -0,0 +1,116 @@
From 13263cb35e8fc82f15aad2c1091f2b05342fbe0f Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Wed, 1 Nov 2023 12:04:42 -0600
Subject: [PATCH 1/1] x86: serial: ns16550: Allow the UART to be silently
disabled
U-Boot normally requires a UART. When booting from coreboot it is
sometimes just not available, e.g. when no sysinfo or DBG2 information
is provided.
In this case we need to continue running, since the display can be used.
Add a flag to disable serial for this case.
This allows U-Boot to start up and operation from the display, instead
of hanging on start-up.
This could perhaps be hidden behind a Kconfig option to reduce code
size.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/serial/ns16550.c | 17 +++++++++++++++--
drivers/serial/serial_coreboot.c | 1 +
include/ns16550.h | 1 +
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 6fcb5b523a..891124fc62 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -384,6 +384,8 @@ static int ns16550_serial_putc(struct udevice *dev, const char ch)
{
struct ns16550 *const com_port = dev_get_priv(dev);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
if (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
return -EAGAIN;
serial_out(ch, &com_port->thr);
@@ -404,6 +406,9 @@ static int ns16550_serial_pending(struct udevice *dev, bool input)
{
struct ns16550 *const com_port = dev_get_priv(dev);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
+
if (input)
return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0;
else
@@ -414,6 +419,9 @@ static int ns16550_serial_getc(struct udevice *dev)
{
struct ns16550 *const com_port = dev_get_priv(dev);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
+
if (!(serial_in(&com_port->lsr) & UART_LSR_DR))
return -EAGAIN;
@@ -428,7 +436,8 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)
clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate);
- ns16550_setbrg(com_port, clock_divisor);
+ if (!(plat->flags & NS16550_FLAG_DISABLE))
+ ns16550_setbrg(com_port, clock_divisor);
return 0;
}
@@ -441,6 +450,9 @@ static int ns16550_serial_setconfig(struct udevice *dev, uint serial_config)
uint bits = SERIAL_GET_BITS(serial_config);
uint stop = SERIAL_GET_STOP(serial_config);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
+
/*
* only parity config is implemented, check if other serial settings
* are the default one.
@@ -533,7 +545,8 @@ int ns16550_serial_probe(struct udevice *dev)
reset_deassert_bulk(&reset_bulk);
com_port->plat = dev_get_plat(dev);
- ns16550_init(com_port, -1);
+ if (!(plat->flags & NS16550_FLAG_DISABLE))
+ ns16550_init(com_port, -1);
return 0;
}
diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c
index b1f69f6998..a885809abd 100644
--- a/drivers/serial/serial_coreboot.c
+++ b/drivers/serial/serial_coreboot.c
@@ -119,6 +119,7 @@ static int coreboot_of_to_plat(struct udevice *dev)
* there is no UART, which may panic. So stay silent and
* pray that the video console will work.
*/
+ plat->flags |= NS16550_FLAG_DISABLE;
log_debug("Cannot detect UART\n");
}
diff --git a/include/ns16550.h b/include/ns16550.h
index 7f48130008..3c4f3e7539 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -52,6 +52,7 @@ enum ns16550_flags {
NS16550_FLAG_IO = 1 << 0, /* Use I/O access (else mem-mapped) */
NS16550_FLAG_ENDIAN = 1 << 1, /* Use out_le/be_32() */
NS16550_FLAG_BE = 1 << 2, /* Big-endian access (else little) */
+ NS16550_FLAG_DISABLE = BIT(3), /* No output or input */
};
/**
--
2.39.5

View File

@ -0,0 +1,116 @@
From 13263cb35e8fc82f15aad2c1091f2b05342fbe0f Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Wed, 1 Nov 2023 12:04:42 -0600
Subject: [PATCH 1/1] x86: serial: ns16550: Allow the UART to be silently
disabled
U-Boot normally requires a UART. When booting from coreboot it is
sometimes just not available, e.g. when no sysinfo or DBG2 information
is provided.
In this case we need to continue running, since the display can be used.
Add a flag to disable serial for this case.
This allows U-Boot to start up and operation from the display, instead
of hanging on start-up.
This could perhaps be hidden behind a Kconfig option to reduce code
size.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/serial/ns16550.c | 17 +++++++++++++++--
drivers/serial/serial_coreboot.c | 1 +
include/ns16550.h | 1 +
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 6fcb5b523a..891124fc62 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -384,6 +384,8 @@ static int ns16550_serial_putc(struct udevice *dev, const char ch)
{
struct ns16550 *const com_port = dev_get_priv(dev);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
if (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
return -EAGAIN;
serial_out(ch, &com_port->thr);
@@ -404,6 +406,9 @@ static int ns16550_serial_pending(struct udevice *dev, bool input)
{
struct ns16550 *const com_port = dev_get_priv(dev);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
+
if (input)
return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0;
else
@@ -414,6 +419,9 @@ static int ns16550_serial_getc(struct udevice *dev)
{
struct ns16550 *const com_port = dev_get_priv(dev);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
+
if (!(serial_in(&com_port->lsr) & UART_LSR_DR))
return -EAGAIN;
@@ -428,7 +436,8 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)
clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate);
- ns16550_setbrg(com_port, clock_divisor);
+ if (!(plat->flags & NS16550_FLAG_DISABLE))
+ ns16550_setbrg(com_port, clock_divisor);
return 0;
}
@@ -441,6 +450,9 @@ static int ns16550_serial_setconfig(struct udevice *dev, uint serial_config)
uint bits = SERIAL_GET_BITS(serial_config);
uint stop = SERIAL_GET_STOP(serial_config);
+ if (com_port->plat->flags & NS16550_FLAG_DISABLE)
+ return 0;
+
/*
* only parity config is implemented, check if other serial settings
* are the default one.
@@ -533,7 +545,8 @@ int ns16550_serial_probe(struct udevice *dev)
reset_deassert_bulk(&reset_bulk);
com_port->plat = dev_get_plat(dev);
- ns16550_init(com_port, -1);
+ if (!(plat->flags & NS16550_FLAG_DISABLE))
+ ns16550_init(com_port, -1);
return 0;
}
diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c
index b1f69f6998..a885809abd 100644
--- a/drivers/serial/serial_coreboot.c
+++ b/drivers/serial/serial_coreboot.c
@@ -119,6 +119,7 @@ static int coreboot_of_to_plat(struct udevice *dev)
* there is no UART, which may panic. So stay silent and
* pray that the video console will work.
*/
+ plat->flags |= NS16550_FLAG_DISABLE;
log_debug("Cannot detect UART\n");
}
diff --git a/include/ns16550.h b/include/ns16550.h
index 7f48130008..3c4f3e7539 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -52,6 +52,7 @@ enum ns16550_flags {
NS16550_FLAG_IO = 1 << 0, /* Use I/O access (else mem-mapped) */
NS16550_FLAG_ENDIAN = 1 << 1, /* Use out_le/be_32() */
NS16550_FLAG_BE = 1 << 2, /* Big-endian access (else little) */
+ NS16550_FLAG_DISABLE = BIT(3), /* No output or input */
};
/**
--
2.39.5