From 852f10cc31bdca60dfb269b524dfeecd68d4bbe9 Mon Sep 17 00:00:00 2001 From: Jiaqing Zhao Date: Mon, 13 Nov 2023 08:12:07 +0000 Subject: [PATCH] dm: lpc: only emulate COM ports specified in command line Currently lpc emulates all the supported COM ports no matter it is configured or not in command line. Change the behavior to only emulate those specified in command line. Tracked-On: #8537 Signed-off-by: Jiaqing Zhao Reviewed-by: Jian Jun Chen --- devicemodel/hw/pci/lpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devicemodel/hw/pci/lpc.c b/devicemodel/hw/pci/lpc.c index 3ef92117c..7ddd5391b 100644 --- a/devicemodel/hw/pci/lpc.c +++ b/devicemodel/hw/pci/lpc.c @@ -87,6 +87,7 @@ lpc_device_parse(const char *opts) if (lpcdev != NULL) { for (unit = 0; unit < LPC_UART_NUM; unit++) { if (strcasecmp(lpcdev, lpc_uart_names[unit]) == 0) { + lpc_uart_vdev[unit].enabled = 1; lpc_uart_vdev[unit].opts = str; error = 0; goto done; @@ -202,6 +203,9 @@ lpc_init(struct vmctx *ctx) lpc_uart = &lpc_uart_vdev[unit]; name = lpc_uart_names[unit]; + if (lpc_uart->enabled == 0) + continue; + if (uart_legacy_alloc(unit, &lpc_uart->iobase, &lpc_uart->irq) != 0) {