From bb941824cad1787c977ef6b7c89b84b96cbbb3e5 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Thu, 19 Feb 2026 08:22:52 -0800 Subject: [PATCH] soc/intel/common/feature/uart: Add common UART device list driver This patch introduces a common UART device list implementation that eliminates duplication across multiple Intel SoC platforms. Instead of maintaining nearly identical uart.c files in each platform directory, this common driver uses platform-specific macros to define UART device function numbers. The common implementation expects each platform to define the following macros in their soc/pci_devs.h header: - PCI_DEVFN_UART0 - PCI_DEVFN_UART1 - PCI_DEVFN_UART2 This approach maintains platform flexibility while reducing code duplication and simplifying maintenance. The driver is compiled across all stages (bootblock, verstage, romstage, postcar, ramstage, smm) to support various UART usage scenarios. Change-Id: Iba82a2fe24dd9ccf704e4a0fadc481b63662b94d Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/91241 Reviewed-by: Kim, Wonkyu Tested-by: build bot (Jenkins) Reviewed-by: Pranava Y N --- src/soc/intel/common/feature/uart/Kconfig | 9 +++++++++ src/soc/intel/common/feature/uart/Makefile.mk | 3 +++ src/soc/intel/common/feature/uart/uart_devices.c | 12 ++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 src/soc/intel/common/feature/uart/Kconfig create mode 100644 src/soc/intel/common/feature/uart/Makefile.mk create mode 100644 src/soc/intel/common/feature/uart/uart_devices.c diff --git a/src/soc/intel/common/feature/uart/Kconfig b/src/soc/intel/common/feature/uart/Kconfig new file mode 100644 index 0000000000..73429af335 --- /dev/null +++ b/src/soc/intel/common/feature/uart/Kconfig @@ -0,0 +1,9 @@ +## SPDX-License-Identifier: GPL-2.0-only + +config SOC_INTEL_COMMON_FEATURE_UART_DEVICES + bool + help + Include common UART device list support. This option eliminates + per-platform duplication of uart.c files by providing a common + implementation. Platforms must define PCI_UART_DEVFN* macro in + their soc/pci_devs.h header. diff --git a/src/soc/intel/common/feature/uart/Makefile.mk b/src/soc/intel/common/feature/uart/Makefile.mk new file mode 100644 index 0000000000..dfc36965ba --- /dev/null +++ b/src/soc/intel/common/feature/uart/Makefile.mk @@ -0,0 +1,3 @@ +## SPDX-License-Identifier: GPL-2.0-only +all-$(CONFIG_SOC_INTEL_COMMON_FEATURE_UART_DEVICES) += uart_devices.c +smm-$(CONFIG_SOC_INTEL_COMMON_FEATURE_UART_DEVICES) += uart_devices.c diff --git a/src/soc/intel/common/feature/uart/uart_devices.c b/src/soc/intel/common/feature/uart/uart_devices.c new file mode 100644 index 0000000000..9f549c5ae8 --- /dev/null +++ b/src/soc/intel/common/feature/uart/uart_devices.c @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +const unsigned int uart_devices[] = { + PCI_DEVFN_UART0, + PCI_DEVFN_UART1, + PCI_DEVFN_UART2, +}; + +const int uart_devices_size = ARRAY_SIZE(uart_devices);