From 9ea7a85ca529a98495f787791861a7540449ff6a Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 23 Oct 2019 15:08:43 +0800 Subject: [PATCH] acrn-config: set default package value for _S3 and _S5 Some BIOS does not support s3/s5, so there might be no _S3 or _S5 package in host ACPI table, previous code did not handle this, so the build would be failed with the generated board file. Set default s3/s5 package value to 0 for such case. Tracked-On: #3854 Signed-off-by: Wei Liu Acked-by: Victor Sun --- misc/acrn-config/board_config/acpi_platform_h.py | 5 +++++ misc/acrn-config/target/acpi.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/misc/acrn-config/board_config/acpi_platform_h.py b/misc/acrn-config/board_config/acpi_platform_h.py index 6a087acd4..7c5af2d98 100644 --- a/misc/acrn-config/board_config/acpi_platform_h.py +++ b/misc/acrn-config/board_config/acpi_platform_h.py @@ -91,6 +91,11 @@ def multi_info_parser(config, default_platform, msg_s, msg_e): multi_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, msg_s, msg_e) for s_line in multi_lines: + # parse the commend line + if '/*' in s_line: + print("{}".format(s_line), file=config) + continue + if s_line.split()[1] in write_direct: if "PM1A_CNT" in s_line.split()[1] and int(s_line.split()[2].strip('UL'), 16) == 0: pm_ac_sz.pm1a_cnt_ac_sz = False diff --git a/misc/acrn-config/target/acpi.py b/misc/acrn-config/target/acpi.py index 2bffce669..60be0ba30 100644 --- a/misc/acrn-config/target/acpi.py +++ b/misc/acrn-config/target/acpi.py @@ -343,6 +343,13 @@ def decode_sx_pkg(pkg_len, f_node): return (pkg_val_pm1a, pkg_val_pm1b, pkg_val_resv, need_break) +def set_default_sx_value(sx_name, config): + print("\t/* {} is not supported by BIOS */".format(sx_name), file=config) + print("\t#define {}_PKG_VAL_PM1A 0x0U".format(sx_name), file=config) + print("\t#define {}_PKG_VAL_PM1B 0x0U".format(sx_name), file=config) + print("\t#define {}_PKG_RESERVED 0x0U".format(sx_name), file=config) + + def read_pm_sdata(sysnode, sx_name, config): """This will read pm Sx state of power :param sysnode: the system node of Sx power state, like:/sys/firmware/acpi/tables/DSDT @@ -358,6 +365,14 @@ def read_pm_sdata(sysnode, sx_name, config): (need_break, need_continue, pkg_len) = read_sx_locate(sx_name, f_node) if need_break: + # BIOS dose not support for SX, set it to default value + s_name = '' + if 'S3' in sx_name: + s_name = 'S3' + else: + s_name = 'S5' + + set_default_sx_value(s_name, config) break if need_continue: continue