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
1 changed files with 4 additions and 0 deletions

View File

@ -87,6 +87,7 @@ lpc_device_parse(const char *opts)
if (lpcdev != NULL) { if (lpcdev != NULL) {
for (unit = 0; unit < LPC_UART_NUM; unit++) { for (unit = 0; unit < LPC_UART_NUM; unit++) {
if (strcasecmp(lpcdev, lpc_uart_names[unit]) == 0) { if (strcasecmp(lpcdev, lpc_uart_names[unit]) == 0) {
lpc_uart_vdev[unit].enabled = 1;
lpc_uart_vdev[unit].opts = str; lpc_uart_vdev[unit].opts = str;
error = 0; error = 0;
goto done; goto done;
@ -202,6 +203,9 @@ lpc_init(struct vmctx *ctx)
lpc_uart = &lpc_uart_vdev[unit]; lpc_uart = &lpc_uart_vdev[unit];
name = lpc_uart_names[unit]; name = lpc_uart_names[unit];
if (lpc_uart->enabled == 0)
continue;
if (uart_legacy_alloc(unit, if (uart_legacy_alloc(unit,
&lpc_uart->iobase, &lpc_uart->iobase,
&lpc_uart->irq) != 0) { &lpc_uart->irq) != 0) {