acrn-config: remove the same parameters and functions from board_cfg_lib

Board config should relay on library/common.py and board_cfg_lib, then
remove the duplicate parameters and functions.

Tracked-On: #3854
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
Wei Liu
2020-03-26 17:07:49 +08:00
committed by wenlingz
parent 78ce220eb9
commit ed8ac484ad
8 changed files with 76 additions and 180 deletions

View File

@@ -6,6 +6,7 @@
import sys
import subprocess
import board_cfg_lib
import common
DESC = """# Board defconfig generated by acrn-config tool
@@ -26,7 +27,7 @@ VM_NUM_MAP_TOTAL_HV_RAM_SIZE = {
7:0x10E00000,
}
MEM_ALIGN = 2 * board_cfg_lib.SIZE_M
MEM_ALIGN = 2 * common.SIZE_M
def find_avl_memory(ram_range, hpa_size, hv_start_offset):
@@ -62,7 +63,7 @@ def get_ram_range():
ram_range = {}
io_mem_lines = board_cfg_lib.get_info(
board_cfg_lib.BOARD_INFO_FILE, "<IOMEM_INFO>", "</IOMEM_INFO>")
common.BOARD_INFO_FILE, "<IOMEM_INFO>", "</IOMEM_INFO>")
for line in io_mem_lines:
if 'System RAM' not in line:
@@ -81,9 +82,9 @@ def get_serial_type():
ttys_value = ''
# Get ttySx information from board config file
ttys_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "<TTYS_INFO>", "</TTYS_INFO>")
ttys_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<TTYS_INFO>", "</TTYS_INFO>")
(err_dic, scenario_name) = board_cfg_lib.get_scenario_name()
(err_dic, scenario_name) = common.get_scenario_name()
if scenario_name == "logical_partition":
ttyn = 'ttyS0'
else:
@@ -112,7 +113,7 @@ def is_rdt_supported():
"""
Returns True if platform supports RDT else False
"""
(rdt_resources, rdt_res_clos_max, _) = board_cfg_lib.clos_info_parser(board_cfg_lib.BOARD_INFO_FILE)
(rdt_resources, rdt_res_clos_max, _) = board_cfg_lib.clos_info_parser(common.BOARD_INFO_FILE)
if len(rdt_resources) == 0 or len(rdt_res_clos_max) == 0:
return False
else:
@@ -127,10 +128,10 @@ def generate_file(config):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}
if board_cfg_lib.VM_COUNT in list(VM_NUM_MAP_TOTAL_HV_RAM_SIZE.keys()):
hv_ram_size = VM_NUM_MAP_TOTAL_HV_RAM_SIZE[board_cfg_lib.VM_COUNT]
if common.VM_COUNT in list(VM_NUM_MAP_TOTAL_HV_RAM_SIZE.keys()):
hv_ram_size = VM_NUM_MAP_TOTAL_HV_RAM_SIZE[common.VM_COUNT]
else:
board_cfg_lib.print_red("VM num should not be greater than 8", err=True)
common.print_red("VM num should not be greater than 8", err=True)
err_dic["board config: total vm number error"] = "VM num should not be greater than 8"
return err_dic
@@ -144,10 +145,10 @@ def generate_file(config):
total_size = reserved_ram + hv_ram_size
avl_start_addr = find_avl_memory(ram_range, str(total_size), hv_start_offset)
hv_start_addr = int(avl_start_addr, 16) + int(hex(reserved_ram), 16)
hv_start_addr = board_cfg_lib.round_up(hv_start_addr, MEM_ALIGN)
hv_start_addr = common.round_up(hv_start_addr, MEM_ALIGN)
# add config scenario name
(err_dic, scenario_name) = board_cfg_lib.get_scenario_name()
(err_dic, scenario_name) = common.get_scenario_name()
print("{}".format(DESC), file=config)
print("CONFIG_{}=y".format(scenario_name.upper()), file=config)