From c3e40801dc4bb545df2cf4f57559bfa70dd6ce8e Mon Sep 17 00:00:00 2001 From: Jiaqing Zhao Date: Mon, 13 Nov 2023 08:06:25 +0000 Subject: [PATCH] dm: lpc: support emulating UART COM3 and COM4 Extend the devicemodel lpc uart emulation support to COM4. Since COM1 is usually used for hv console and COM2 is taken by S5 feature, only COM1 and COM2 is not enough. Tracked-On: #8537 Signed-off-by: Jiaqing Zhao Reviewed-by: Jian Jun Chen --- devicemodel/hw/pci/lpc.c | 4 ++-- devicemodel/hw/uart_core.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/devicemodel/hw/pci/lpc.c b/devicemodel/hw/pci/lpc.c index bbd5afe86..3ef92117c 100644 --- a/devicemodel/hw/pci/lpc.c +++ b/devicemodel/hw/pci/lpc.c @@ -59,7 +59,7 @@ SYSRES_IO(NMISC_PORT, 1); static struct pci_vdev *lpc_bridge; -#define LPC_UART_NUM 2 +#define LPC_UART_NUM 4 static struct lpc_uart_vdev { struct uart_vdev *uart; const char *opts; @@ -68,7 +68,7 @@ static struct lpc_uart_vdev { int enabled; } lpc_uart_vdev[LPC_UART_NUM]; -static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2" }; +static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2", "COM3", "COM4" }; /* * LPC device configuration is in the following form: diff --git a/devicemodel/hw/uart_core.c b/devicemodel/hw/uart_core.c index 21679f135..e119beaa1 100644 --- a/devicemodel/hw/uart_core.c +++ b/devicemodel/hw/uart_core.c @@ -52,6 +52,10 @@ #define COM1_IRQ 4 #define COM2_BASE 0x2F8 #define COM2_IRQ 3 +#define COM3_BASE 0x3E8 +#define COM3_IRQ 6 +#define COM4_BASE 0x2E8 +#define COM4_IRQ 7 #define DEFAULT_RCLK 1843200 #define DEFAULT_BAUD 9600 @@ -83,6 +87,8 @@ static struct { } uart_lres[] = { { COM1_BASE, COM1_IRQ, false}, { COM2_BASE, COM2_IRQ, false}, + { COM3_BASE, COM3_IRQ, false}, + { COM4_BASE, COM4_IRQ, false}, }; #define UART_NLDEVS (ARRAY_SIZE(uart_lres))