U-Boot running as a coreboot payload obtains serial console
information either from the coreboot table or from the ACPI DBG2
table.

When serial console support is disabled in coreboot, the coreboot
table does not contain serial information. In this case U-Boot falls
back to parsing the DBG2 table.

Some AMD platforms or any other platforms that uses memory-mapped I/O
advertise the debug UART using DBG2 subtype 0x0012 ("16550-compatible
with parameters defined in Generic Address Structure"). U-Boot
currently accepts only subtype 0x0000, causing DBG2 UART detection to
fail and leaving no console output.

Accept subtype 0x0012 as well and keep the existing handling logic.

Signed-off-by: Desapogu Jayaramudu <[email protected]>
---
v3:
- Change subject prefix to "serial: coreboot:"
- Shorten commit subject
- Remove extra From: line by fixing git author identity
- Rework commit message formatting and wrapping
- Rename subtype constant to ACPI_DBG2_16550_WITH_GAS
- Add comment describing DBG2 subtype 0x12
- Keep subtype definitions sorted by value
- Wrap long conditional to stay within 80 columns

 drivers/serial/serial_coreboot.c | 3 ++-
 include/acpi/acpi_table.h        | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c
index b1f69f6998cfa1..cb07173a80c0cc 100644
--- a/drivers/serial/serial_coreboot.c
+++ b/drivers/serial/serial_coreboot.c
@@ -59,7 +59,8 @@ static int read_dbg2(struct ns16550_plat *plat)
                log_debug("Not a serial port\n");
                return -EPROTOTYPE;
        }
-       if (dbg->port_subtype != ACPI_DBG2_16550_COMPATIBLE) {
+       if (dbg->port_subtype != ACPI_DBG2_16550_COMPATIBLE &&
+            dbg->port_subtype != ACPI_DBG2_16550_WITH_GAS) {
                log_debug("Incompatible serial port\n");
                return -EPROTOTYPE;
        }
diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h
index 4895366a6188ec..825652798166a4 100644
--- a/include/acpi/acpi_table.h
+++ b/include/acpi/acpi_table.h
@@ -674,6 +674,7 @@ struct __packed acpi_dmar {
 #define ACPI_DBG2_ARM_SBSA_GENERIC     0x000E
 #define ACPI_DBG2_ARM_DCC              0x000F
 #define ACPI_DBG2_BCM2835              0x0010
+#define ACPI_DBG2_WITH_GAS             0x0012 /* 16550-compatible UART with 
GAS */
 
 #define ACPI_DBG2_1394_STANDARD                0x0000
 
-- 
2.25.1

Reply via email to