mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 21:47:22 +00:00
acrn-config: enhance the board config that has no serial port
There may be no physical serial port in the target board, and it will stop generating board file, the patch add support to handle such case. 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:
parent
658dccfbe3
commit
b332bf84b8
@ -68,9 +68,6 @@ def parse_boot_info():
|
||||
sos_rootfs = board_cfg_lib.get_sub_leaf_tag(board_cfg_lib.SCENARIO_INFO_FILE, "os_config", "rootfs")
|
||||
(err_dic, vuart0_dic, vuart1_dic) = board_cfg_lib.get_board_private_vuart("os_config", "console")
|
||||
|
||||
if err_dic:
|
||||
return (err_dic, sos_cmdlines, sos_rootfs, vuart0_dic, vuart1_dic, vm_types)
|
||||
|
||||
for i in range(board_cfg_lib.VM_COUNT):
|
||||
vm_type = board_cfg_lib.get_order_type_by_vmid(i)
|
||||
vm_types.append(vm_type)
|
||||
@ -99,9 +96,11 @@ def generate_file(config):
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# parse to get poart/base of vuart0/vuart1
|
||||
vuart0_port_base = board_cfg_lib.TTY_CONSOLE[list(vuart0_dic.keys())[0]]
|
||||
vuart0_irq = vuart0_dic[list(vuart0_dic.keys())[0]]
|
||||
if vuart0_dic:
|
||||
# parse to get poart/base of vuart0/vuart1
|
||||
vuart0_port_base = board_cfg_lib.TTY_CONSOLE[list(vuart0_dic.keys())[0]]
|
||||
vuart0_irq = vuart0_dic[list(vuart0_dic.keys())[0]]
|
||||
|
||||
vuart1_port_base = board_cfg_lib.TTY_CONSOLE[list(vuart1_dic.keys())[0]]
|
||||
vuart1_irq = vuart1_dic[list(vuart1_dic.keys())[0]]
|
||||
|
||||
@ -136,7 +135,10 @@ def generate_file(config):
|
||||
print("", file=config)
|
||||
if "SOS_VM" in vm_types:
|
||||
print('#define SOS_ROOTFS\t\t"root={} "'.format(sos_rootfs[0]), file=config)
|
||||
print('#define SOS_CONSOLE\t\t"console={} "'.format(ttys_n), file=config)
|
||||
if ttys_n:
|
||||
print('#define SOS_CONSOLE\t\t"console={} "'.format(ttys_n), file=config)
|
||||
else:
|
||||
print('#define SOS_CONSOLE\t\t" "', file=config)
|
||||
|
||||
# sos com base/irq
|
||||
i_type = 0
|
||||
@ -146,8 +148,13 @@ def generate_file(config):
|
||||
i_type += 1
|
||||
|
||||
if "SOS_VM" in vm_types:
|
||||
print("#define SOS_COM1_BASE\t\t{}U".format(vuart0_port_base), file=config)
|
||||
print("#define SOS_COM1_IRQ\t\t{}U".format(vuart0_irq), file=config)
|
||||
if vuart0_dic:
|
||||
print("#define SOS_COM1_BASE\t\t{}U".format(vuart0_port_base), file=config)
|
||||
print("#define SOS_COM1_IRQ\t\t{}U".format(vuart0_irq), file=config)
|
||||
else:
|
||||
print("#define SOS_COM1_BASE\t\t0U", file=config)
|
||||
print("#define SOS_COM1_IRQ\t\t0U", file=config)
|
||||
|
||||
if vuart1_setting[i_type]['base'] != "INVALID_COM_BASE":
|
||||
print("#define SOS_COM2_BASE\t\t{}U".format(vuart1_port_base), file=config)
|
||||
print("#define SOS_COM2_IRQ\t\t{}U".format(vuart1_irq), file=config)
|
||||
|
@ -336,6 +336,9 @@ def parser_vuart_console():
|
||||
else:
|
||||
ttys = get_sub_leaf_tag(SCENARIO_INFO_FILE, "os_config", "console")
|
||||
|
||||
if not ttys or ttys[0] == None:
|
||||
return (err_dic, ttys_n)
|
||||
|
||||
if ttys and 'BDF' in ttys[0] or '/dev' in ttys[0]:
|
||||
ttys_n = ttys[0].split('/')[2]
|
||||
else:
|
||||
@ -359,20 +362,24 @@ def get_board_private_vuart(branch_tag, tag_console):
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
if not ttys_n or ttys_n not in list(TTY_CONSOLE.keys()):
|
||||
err_dic["board config: ttyS not available"] = "console should be set in scenario.xml of board_private section"
|
||||
return (err_dic, vuart0_console_dic, vuart1_console_dic)
|
||||
if ttys_n:
|
||||
|
||||
(vuart0_valid_console, vuart1_valid_console, show_vuart1) = console_to_show(BOARD_INFO_FILE)
|
||||
if ttys_n not in list(TTY_CONSOLE.keys()):
|
||||
err_dic["board config: ttyS not available"] = "console should be set in scenario.xml of board_private section"
|
||||
return (err_dic, vuart0_console_dic, vuart1_console_dic)
|
||||
|
||||
# VUART0
|
||||
if ttys_n not in list(NATIVE_CONSOLE_DIC.keys()):
|
||||
vuart0_console_dic[ttys_n] = alloc_irq()
|
||||
else:
|
||||
if int(NATIVE_CONSOLE_DIC[ttys_n]) >= 16:
|
||||
(vuart0_valid_console, vuart1_valid_console, show_vuart1) = console_to_show(BOARD_INFO_FILE)
|
||||
|
||||
# VUART0
|
||||
if ttys_n not in list(NATIVE_CONSOLE_DIC.keys()):
|
||||
vuart0_console_dic[ttys_n] = alloc_irq()
|
||||
else:
|
||||
vuart0_console_dic[ttys_n] = NATIVE_CONSOLE_DIC[ttys_n]
|
||||
if int(NATIVE_CONSOLE_DIC[ttys_n]) >= 16:
|
||||
vuart0_console_dic[ttys_n] = alloc_irq()
|
||||
else:
|
||||
vuart0_console_dic[ttys_n] = NATIVE_CONSOLE_DIC[ttys_n]
|
||||
else:
|
||||
vuart1_valid_console = ['ttyS1']
|
||||
|
||||
# VUART1
|
||||
if len(NATIVE_CONSOLE_DIC) >= 2 and 'ttyS1' in NATIVE_CONSOLE_DIC.keys():
|
||||
|
Loading…
Reference in New Issue
Block a user