acrn-config: by-pass acpi_idle/acpi_cpufreq for parsing target board
Current board parse logic would be broken if acpi_idle/acpi-cpufreq driver is not loaded by native kernel. This patch would just leave a warning to user and continue to parse other information in this case. Tracked-On: #4082 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
631c461314
commit
cdd086a81d
|
@ -112,6 +112,26 @@ def gen_cat(config):
|
|||
return err_dic
|
||||
|
||||
|
||||
def gen_single_data(data_lines, domain_str, config):
|
||||
line_i = 0
|
||||
data_statues = True
|
||||
data_len = len(data_lines)
|
||||
for data_l in data_lines:
|
||||
if line_i == 0:
|
||||
if "not available" in data_l:
|
||||
print(data_l.strip(), file=config)
|
||||
print("static const struct cpu_{}x_data board_cpu_{}x[0];".format(domain_str, domain_str), file=config)
|
||||
print("", file=config)
|
||||
data_statues = False
|
||||
break
|
||||
else:
|
||||
print("static const struct cpu_{}x_data board_cpu_{}x[{}] = {{".format(domain_str, domain_str, data_len), file=config)
|
||||
print("\t{0}".format(data_l.strip()), file=config)
|
||||
line_i += 1
|
||||
if data_statues:
|
||||
print("};\n", file=config)
|
||||
|
||||
|
||||
def gen_px_cx(config):
|
||||
"""
|
||||
Get Px/Cx and store them to board.c
|
||||
|
@ -122,18 +142,8 @@ def gen_px_cx(config):
|
|||
cx_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "<CX_INFO>", "</CX_INFO>")
|
||||
px_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "<PX_INFO>", "</PX_INFO>")
|
||||
|
||||
cx_len = len(cx_lines)
|
||||
px_len = len(px_lines)
|
||||
#print("#ifdef CONFIG_CPU_POWER_STATES_SUPPORT", file=config)
|
||||
print("static const struct cpu_cx_data board_cpu_cx[%s] = {"%str(cx_len), file=config)
|
||||
for cx_l in cx_lines:
|
||||
print("\t{0}".format(cx_l.strip()), file=config)
|
||||
print("};\n", file=config)
|
||||
|
||||
print("static const struct cpu_px_data board_cpu_px[%s] = {"%str(px_len), file=config)
|
||||
for px_l in px_lines:
|
||||
print("\t{0}".format(px_l.strip()), file=config)
|
||||
print("};\n", file=config)
|
||||
gen_single_data(cx_lines, 'c', config)
|
||||
gen_single_data(px_lines, 'p', config)
|
||||
|
||||
for brand_line in cpu_brand_lines:
|
||||
cpu_brand = brand_line
|
||||
|
@ -143,7 +153,6 @@ def gen_px_cx(config):
|
|||
print("\t{(uint8_t)ARRAY_SIZE(board_cpu_px), board_cpu_px,", file=config)
|
||||
print("\t(uint8_t)ARRAY_SIZE(board_cpu_cx), board_cpu_cx}", file=config)
|
||||
print("};", file=config)
|
||||
#print("#endif", file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
|
|
|
@ -433,13 +433,15 @@ def store_cx_data(sysnode1, sysnode2, config):
|
|||
idle_driver = acpi_idle.read(32)
|
||||
|
||||
if idle_driver.find("acpi_idle") == -1:
|
||||
parser_lib.print_yel("The Cx data for ACRN relies on " +\
|
||||
"acpi_idle driver but it is not found, ", warn=True, end=False)
|
||||
if idle_driver.find("intel_idle") == 0:
|
||||
parser_lib.print_red("The tool need to run with acpi_idle driver, " +
|
||||
"please add intel_idle.max_cstate=0 in kernel " +
|
||||
"cmdline to fall back to acpi_idle driver", err=True)
|
||||
print("please add idle=nomwait in kernel " +\
|
||||
"cmdline to fall back to acpi_idle driver")
|
||||
else:
|
||||
parser_lib.print_red("acpi_idle driver is not found.", err=True)
|
||||
sys.exit(1)
|
||||
parser_lib.print_yel("please make sure ACPI Cstate is enabled in BIOS.", warn=True)
|
||||
print("\t/* Cx data is not available */", file=config)
|
||||
return
|
||||
|
||||
files = os.listdir(sysnode2)
|
||||
for d_path in files:
|
||||
|
@ -499,13 +501,15 @@ def store_px_data(sysnode, config):
|
|||
with open(sysnode+'cpu0/cpufreq/scaling_driver', 'r') as f_node:
|
||||
freq_driver = f_node.read()
|
||||
if freq_driver.find("acpi-cpufreq") == -1:
|
||||
parser_lib.print_yel("The Px data for ACRN relies on " +\
|
||||
"acpi-cpufreq driver but it is not found, ", warn=True, end=False)
|
||||
if freq_driver.find("intel_pstate") == 0:
|
||||
parser_lib.print_red("The tool need to run with acpi_cpufreq driver, " +
|
||||
"please add intel_pstate=disable in kernel cmdline " +
|
||||
"to fall back to acpi-cpufreq driver.", err=True)
|
||||
print("please add intel_pstate=disable in kernel " +\
|
||||
"cmdline to fall back to acpi-cpufreq driver")
|
||||
else:
|
||||
parser_lib.print_red("acpi-cpufreq driver is not found.", err=True)
|
||||
sys.exit(1)
|
||||
parser_lib.print_yel("please make sure ACPI Pstate is enabled in BIOS.", warn=True)
|
||||
print("\t/* Px data is not available */", file=config)
|
||||
return
|
||||
|
||||
try:
|
||||
with open(sysnode+'cpufreq/boost', 'r') as f_node:
|
||||
|
|
|
@ -16,15 +16,22 @@ def check_dmi():
|
|||
return os.path.exists("/sys/firmware/dmi")
|
||||
|
||||
|
||||
def print_yel(msg, warn=False):
|
||||
def print_yel(msg, warn=False, end=True):
|
||||
"""Output the message with the color of yellow
|
||||
:param msg: the stings which will be output to STDOUT
|
||||
:param warn: the condition if needs to be output the color of yellow with 'Warning'
|
||||
:param end: The flag of it needs to combine with the next line for stdout
|
||||
"""
|
||||
if warn:
|
||||
if end:
|
||||
print("\033[1;33mWarning\033[0m:"+msg)
|
||||
else:
|
||||
print("\033[1;33m{0}\033[0m".format(msg))
|
||||
print("\033[1;33mWarning\033[0m:"+msg, end="")
|
||||
else:
|
||||
if end:
|
||||
print("\033[1;33m{}\033[0m".format(msg))
|
||||
else:
|
||||
print("\033[1;33m{}\033[0m".format(msg), end="")
|
||||
|
||||
|
||||
def print_red(msg, err=False):
|
||||
|
|
Loading…
Reference in New Issue