acrn-config: Set defaults on empty leaf for generated <board>.xml file
This patch sets defaults similar to generic platform configuration when leaf features like PM_INFO, S3_INFO, S5_INFO, DRHD_INFO, CPU_BRAND, CX_INFO, PX_INFO, MMCFG_BASE_INFO are not generated via either target offline tool or user supplies empty field in case of emulation. Tracked-On: #3198 Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
6c05af8ded
commit
2175c17c97
|
@ -91,10 +91,18 @@ def multi_info_parser(config, default_platform, msg_s, msg_e):
|
|||
pm_ac_sz = OverridAccessSize()
|
||||
multi_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, msg_s, msg_e)
|
||||
|
||||
msg_name = msg_s.split('_')[0].strip('<')
|
||||
|
||||
# Set defaults for PM1A registers if not present in target xml file
|
||||
if not multi_lines and msg_name in ("PM1A"):
|
||||
print("#define PM1A_EVT_ACCESS_SIZE\t0U", file=config)
|
||||
print("#define PM1A_EVT_ADDRESS\t0UL", file=config)
|
||||
print("#define PM1A_CNT_ADDRESS\t0UL", file=config)
|
||||
return
|
||||
|
||||
# S3/S5 not supported by BIOS
|
||||
sx_name = msg_s.split('_')[0].strip('<')
|
||||
if not multi_lines and sx_name in ("S3", "S5"):
|
||||
print("/* {} is not supported by BIOS */".format(sx_name), file=config)
|
||||
if not multi_lines and msg_name in ("S3", "S5"):
|
||||
print("/* {} is not supported by BIOS */".format(msg_name), file=config)
|
||||
return
|
||||
|
||||
for s_line in multi_lines:
|
||||
|
@ -131,6 +139,23 @@ def write_direct_info_parser(config, msg_s, msg_e):
|
|||
:param msg_e: it is a pattern of key stings what end to match from board information
|
||||
"""
|
||||
vector_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, msg_s, msg_e)
|
||||
msg_name = msg_s.split('_')[0].strip('<')
|
||||
|
||||
# Set defaults if not present in target xml file
|
||||
if not vector_lines and msg_name in ("WAKE"):
|
||||
print("\n#define WAKE_VECTOR_32\t\t0UL", file=config)
|
||||
print("#define WAKE_VECTOR_64\t\t0UL", file=config)
|
||||
return
|
||||
|
||||
if not vector_lines and msg_name in ("RESET"):
|
||||
print("\n#define RESET_REGISTER_ADDRESS\t0UL", file=config)
|
||||
print("#define RESET_REGISTER_VALUE\t0UL", file=config)
|
||||
print("#define RESET_REGISTER_SPACE_ID\t0UL", file=config)
|
||||
return
|
||||
|
||||
if not vector_lines and msg_name in ("MMCFG"):
|
||||
print("\n#define DEFAULT_PCI_MMCFG_BASE\t0UL", file=config)
|
||||
return
|
||||
|
||||
for vector in vector_lines:
|
||||
print("{}".format(vector.strip()), file=config)
|
||||
|
@ -150,6 +175,11 @@ def drhd_info_parser(config):
|
|||
|
||||
# write DRHD
|
||||
print("/* DRHD of DMAR */", file=config)
|
||||
|
||||
if not drhd_lines:
|
||||
print("\n#define DRHD_COUNT\t\t8U", file=config)
|
||||
return
|
||||
|
||||
for drhd in drhd_lines:
|
||||
print(drhd.strip(), file=config)
|
||||
|
||||
|
|
|
@ -34,6 +34,15 @@ def gen_dmar_structure(config):
|
|||
drhd_dev_scope_cnt = []
|
||||
dev_scope_type = []
|
||||
|
||||
if not dmar_info_lines:
|
||||
print("\n#ifndef CONFIG_ACPI_PARSE_ENABLED", file=config)
|
||||
print("#error \"DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \\", file=config)
|
||||
print("\tOr use acrn-config tool to generate platform DMAR info.\"", file=config)
|
||||
print("#endif\n", file=config)
|
||||
|
||||
print("struct dmar_info plat_dmar_info;\n", file=config)
|
||||
return
|
||||
|
||||
# parse to get DRHD count and dev scope count
|
||||
for dmar_line in dmar_info_lines:
|
||||
if "DRHD_COUNT" in dmar_line and not drhd_cnt:
|
||||
|
@ -180,6 +189,10 @@ def gen_single_data(data_lines, domain_str, config):
|
|||
line_i = 0
|
||||
data_statues = True
|
||||
data_len = len(data_lines)
|
||||
|
||||
if data_len == 0:
|
||||
return
|
||||
|
||||
for data_l in data_lines:
|
||||
if line_i == 0:
|
||||
if "not available" in data_l:
|
||||
|
@ -209,6 +222,10 @@ def gen_px_cx(config):
|
|||
gen_single_data(cx_lines, 'c', config)
|
||||
gen_single_data(px_lines, 'p', config)
|
||||
|
||||
if not cpu_brand_lines:
|
||||
print("\nconst struct cpu_state_table board_cpu_state_tbl;\n", file=config)
|
||||
return
|
||||
|
||||
for brand_line in cpu_brand_lines:
|
||||
cpu_brand = brand_line
|
||||
|
||||
|
|
Loading…
Reference in New Issue