mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-18 23:40:11 +00:00
HV: add API to change vuart base & irq config
1. add an API to support vuart COM base and irq configured; 2. add the HV cmd to be parsed for vuart COM base & irq. Tracked-On: #2170 Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -18,12 +18,19 @@ 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=bdf@", /*like: uart=bdf@0:18.2, it is for ttyS2 */
|
"uart=bdf@", /*like: uart=bdf@0:18.2, it is for ttyS2 */
|
||||||
|
|
||||||
|
/* format: vuart=ttySx@irqN, like vuart=ttyS1@irq6; better to unify
|
||||||
|
* uart & vuart & SOS console the same one, and irq same with the native.
|
||||||
|
* ttySx range (0-3), irqN (0-255)
|
||||||
|
*/
|
||||||
|
"vuart=ttyS",
|
||||||
};
|
};
|
||||||
|
|
||||||
enum IDX_CMD {
|
enum IDX_CMD {
|
||||||
IDX_DISABLE_UART,
|
IDX_DISABLE_UART,
|
||||||
IDX_PORT_UART,
|
IDX_PORT_UART,
|
||||||
IDX_PCI_UART,
|
IDX_PCI_UART,
|
||||||
|
IDX_SET_VUART,
|
||||||
|
|
||||||
IDX_MAX_CMD,
|
IDX_MAX_CMD,
|
||||||
};
|
};
|
||||||
@@ -55,6 +62,8 @@ static void handle_cmd(const char *cmd, int32_t len)
|
|||||||
|
|
||||||
} else if (i == IDX_PCI_UART) {
|
} else if (i == IDX_PCI_UART) {
|
||||||
uart16550_set_property(true, false, (uint64_t)(cmd+tmp));
|
uart16550_set_property(true, false, (uint64_t)(cmd+tmp));
|
||||||
|
} else if (i == IDX_SET_VUART) {
|
||||||
|
vuart_set_property(cmd+tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -411,3 +411,19 @@ bool hv_used_dbg_intx(uint8_t intx_pin)
|
|||||||
{
|
{
|
||||||
return is_dbg_uart_enabled() && (intx_pin == vuart_com_irq);
|
return is_dbg_uart_enabled() && (intx_pin == vuart_com_irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vuart=ttySx@irqN, like vuart=ttyS1@irq6 head "vuart=ttyS" is parsed */
|
||||||
|
void vuart_set_property(const char *vuart_info)
|
||||||
|
{
|
||||||
|
const uint16_t com_map[4] = {0x3f8, 0x2F8, 0x3E8, 0x2E8}; /* map to ttyS0-ttyS3 */
|
||||||
|
uint8_t com_idx;
|
||||||
|
|
||||||
|
com_idx = (uint8_t)(vuart_info[0] - '0');
|
||||||
|
if (com_idx < 4) {
|
||||||
|
vuart_com_base = com_map[com_idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(vuart_info + 1, "@irq", 4) == 0) {
|
||||||
|
vuart_com_irq = (uint8_t)strtol_deci(vuart_info + 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -76,4 +76,5 @@ void vuart_console_tx_chars(struct acrn_vuart *vu);
|
|||||||
void vuart_console_rx_chars(struct acrn_vuart *vu);
|
void vuart_console_rx_chars(struct acrn_vuart *vu);
|
||||||
|
|
||||||
bool hv_used_dbg_intx(uint8_t intx_pin);
|
bool hv_used_dbg_intx(uint8_t intx_pin);
|
||||||
|
void vuart_set_property(const char *vuart_info);
|
||||||
#endif /* VUART_H */
|
#endif /* VUART_H */
|
||||||
|
@@ -20,3 +20,5 @@ bool hv_used_dbg_intx(__unused uint8_t intx_pin)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vuart_set_property(__unused const char *vuart_info) {}
|
||||||
|
Reference in New Issue
Block a user