acrn-config: unify get_vuart_info_id api in config tool

1. unify get_vuart_info_id/get_vuart_id api in board/scenario/launch
config tool.
2. if vm use 'vuart1(tty)' method to power off, make sure this vm have
select the vuart1 'SOS_COM2_BASE'.

Tracked-On: #3854
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu
2019-12-09 14:33:49 +08:00
committed by wenlingz
parent 212d030b9a
commit deb5ed1f76
6 changed files with 70 additions and 95 deletions

View File

@@ -384,29 +384,6 @@ def get_board_private_vuart(branch_tag, tag_console):
return (err_dic, vuart0_console_dic, vuart1_console_dic)
def get_vuart_id(tmp_vuart, leaf_tag, leaf_text):
"""
Get all vuart id member of class
:param leaf_tag: key pattern of item tag
:param tmp_vuart: a dictionary to store member:value
:param leaf_text: key pattern of item tag's value
:return: a dictionary to which stored member:value
"""
if leaf_tag == "type":
tmp_vuart['type'] = leaf_text
if leaf_tag == "base":
tmp_vuart['base'] = leaf_text
if leaf_tag == "irq":
tmp_vuart['irq'] = leaf_text
if leaf_tag == "target_vm_id":
tmp_vuart['target_vm_id'] = leaf_text
if leaf_tag == "target_uart_id":
tmp_vuart['target_uart_id'] = leaf_text
return tmp_vuart
def get_vuart_info_id(config_file, idx):
"""
Get vuart information by vuart id indexx
@@ -414,24 +391,7 @@ def get_vuart_info_id(config_file, idx):
:param idx: vuart index in range: [0,1]
:return: dictionary which stored the vuart-id
"""
tmp_tag = []
vm_id = 0
root = common.get_config_root(config_file)
for item in root:
for sub in item:
tmp_vuart = {}
for leaf in sub:
if sub.tag == "vuart" and int(sub.attrib['id']) == idx:
tmp_vuart = get_vuart_id(tmp_vuart, leaf.tag, leaf.text)
# append vuart for each vm
if tmp_vuart and sub.tag == "vuart":
#tmp_vuart[vm_id] = tmp_vuart
tmp_tag.append(tmp_vuart)
if item.tag == "vm":
vm_id += 1
tmp_tag = common.get_vuart_info_id(config_file, idx)
return tmp_tag