HV: fix bug adapt uart mmio to bdf for HV cmdline
now PCI uart changed from MMIO configure to BDF configure, it need change this interface too; this interface is used to dynamically configure debug uart by HV command line. Tracked-On: #2031 Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
23c2166aa9
commit
b319e654c1
|
@ -17,13 +17,13 @@
|
||||||
static const char * const cmd_list[] = {
|
static const char * const cmd_list[] = {
|
||||||
"uart=disabled", /* to disable uart */
|
"uart=disabled", /* to disable uart */
|
||||||
"uart=port@", /* like uart=port@0x3F8 */
|
"uart=port@", /* like uart=port@0x3F8 */
|
||||||
"uart=mmio@", /*like: uart=mmio@0xFC000000 */
|
"uart=bdf@", /*like: uart=bdf@0:18.2, it is for ttyS2 */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum IDX_CMD {
|
enum IDX_CMD {
|
||||||
IDX_DISABLE_UART,
|
IDX_DISABLE_UART,
|
||||||
IDX_PORT_UART,
|
IDX_PORT_UART,
|
||||||
IDX_MMIO_UART,
|
IDX_PCI_UART,
|
||||||
|
|
||||||
IDX_MAX_CMD,
|
IDX_MAX_CMD,
|
||||||
};
|
};
|
||||||
|
@ -45,19 +45,16 @@ static void handle_cmd(const char *cmd, int32_t len)
|
||||||
if (i == IDX_DISABLE_UART) {
|
if (i == IDX_DISABLE_UART) {
|
||||||
/* set uart disabled*/
|
/* set uart disabled*/
|
||||||
uart16550_set_property(false, false, 0UL);
|
uart16550_set_property(false, false, 0UL);
|
||||||
} else if ((i == IDX_PORT_UART) || (i == IDX_MMIO_UART)) {
|
} else if (i == IDX_PORT_UART) {
|
||||||
uint64_t addr = strtoul_hex(cmd + tmp);
|
uint64_t addr = strtoul_hex(cmd + tmp);
|
||||||
|
if (addr > MAX_PORT) {
|
||||||
dev_dbg(ACRN_DBG_PARSE, "uart addr=0x%llx", addr);
|
addr = DEFAULT_UART_PORT;
|
||||||
|
|
||||||
if (i == IDX_PORT_UART) {
|
|
||||||
if (addr > MAX_PORT)
|
|
||||||
addr = DEFAULT_UART_PORT;
|
|
||||||
|
|
||||||
uart16550_set_property(true, true, addr);
|
|
||||||
} else {
|
|
||||||
uart16550_set_property(true, false, addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uart16550_set_property(true, true, addr);
|
||||||
|
|
||||||
|
} else if (i == IDX_PCI_UART) {
|
||||||
|
uart16550_set_property(true, false, (uint64_t)(cmd+tmp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,13 @@ void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr)
|
||||||
{
|
{
|
||||||
uart_enabled = enabled;
|
uart_enabled = enabled;
|
||||||
serial_port_mapped = port_mapped;
|
serial_port_mapped = port_mapped;
|
||||||
uart_base_address = base_addr;
|
|
||||||
|
if (port_mapped) {
|
||||||
|
uart_base_address = base_addr;
|
||||||
|
} else {
|
||||||
|
const char *bdf = (const char *)base_addr;
|
||||||
|
strncpy_s(pci_bdf_info, MAX_BDF_LEN, bdf, MAX_BDF_LEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_pci_dbg_uart(union pci_bdf bdf_value)
|
bool is_pci_dbg_uart(union pci_bdf bdf_value)
|
||||||
|
|
Loading…
Reference in New Issue