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 <jiaqing.zhao@linux.intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
Jiaqing Zhao 2023-11-13 08:12:07 +00:00 committed by acrnsi-robot
parent c3e40801dc
commit 852f10cc31

View File

@ -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) {