From ffbce4e7ae9ebc4c3bf4cf0be3369699160012fe Mon Sep 17 00:00:00 2001 From: Min M Xu Date: Wed, 24 Apr 2024 23:56:47 -0400 Subject: [PATCH] Refactor Default and PCRC config Previously Configurations are tested one by one. So each Configuration calls common functions (such as common_support, common_enable, common_disable, etc) before calling Configuration specific functions. After implementing the configuration combination, the common functions are called in do_run_test_config_xxx. So this patch removes the common calls in Default and PCRC config codes. Signed-off-by: Min Xu --- .../test_config/test_config_default.c | 7 ++--- .../test_config/test_config_pcrc.c | 31 +++++++------------ 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/teeio-validator/teeio_validator/test_config/test_config_default.c b/teeio-validator/teeio_validator/test_config/test_config_default.c index e634a64..197dd2b 100644 --- a/teeio-validator/teeio_validator/test_config/test_config_default.c +++ b/teeio-validator/teeio_validator/test_config/test_config_default.c @@ -21,8 +21,7 @@ bool test_config_support_common(void *test_context); // test selective_ide and link_ide with default config bool test_config_default_enable_common(void *test_context) { - // reset ide registers - return test_config_enable_common(test_context); + return true; } bool test_config_default_disable_common(void *test_context) @@ -32,12 +31,12 @@ bool test_config_default_disable_common(void *test_context) bool test_config_default_support_common(void *test_context) { - return test_config_support_common(test_context); + return true; } bool test_config_default_check_common(void *test_context) { - return test_config_check_common(test_context, "Default Config Assertion"); + return true; } // test selective_and_link_ide with default config diff --git a/teeio-validator/teeio_validator/test_config/test_config_pcrc.c b/teeio-validator/teeio_validator/test_config/test_config_pcrc.c index d1da55e..50373bd 100644 --- a/teeio-validator/teeio_validator/test_config/test_config_pcrc.c +++ b/teeio-validator/teeio_validator/test_config/test_config_pcrc.c @@ -19,9 +19,8 @@ bool set_pcrc_in_ecap( uint8_t ide_id, uint32_t ide_ecap_offset, bool enable ); -bool test_config_enable_common(void *test_context); -bool test_config_check_common(void *test_context, const char* assertion_msg); -bool test_config_support_common(void *test_context); + +extern const char *m_ide_test_topology_name[]; // set pcrc for selective_ide and link_ide. static bool test_config_set_pcrc_common(void *test_context, bool enable) @@ -41,6 +40,8 @@ static bool test_config_set_pcrc_common(void *test_context, bool enable) NOT_IMPLEMENTED("selective_and_link_ide topology"); } + TEEIO_DEBUG((TEEIO_DEBUG_INFO, "%s pcrc for %s\n", enable ? "enable" : "disable", m_ide_test_topology_name[top->type])); + ide_common_test_port_context_t *port_context = &group_context->upper_port; set_pcrc_in_ecap(port_context->cfg_space_fd, ide_type, port_context->ide_id, port_context->ecap_offset, enable); port_context = &group_context->lower_port; @@ -60,21 +61,19 @@ static bool test_config_check_pcrc_support_common(void *test_context) PCIE_IDE_CAP *host_cap = &group_context->upper_port.ide_cap; PCIE_IDE_CAP *dev_cap = &group_context->lower_port.ide_cap; if(!host_cap->pcrc_supported || !dev_cap->pcrc_supported) { + TEEIO_DEBUG((TEEIO_DEBUG_WARN, "check pcrc and it is NOT supported. host=%d, device=%d\n", host_cap->pcrc_supported, dev_cap->pcrc_supported)); return false; } + TEEIO_DEBUG((TEEIO_DEBUG_INFO, "check pcrc and it is supported.\n")); + return true; } // selective_ide test pcrc bool test_config_pcrc_enable_sel(void *test_context) { - bool res = test_config_enable_common(test_context); - if(res) { - res = test_config_set_pcrc_common(test_context, true); - } - - return res; + return test_config_set_pcrc_common(test_context, true); } bool test_config_pcrc_disable_sel(void *test_context) @@ -84,24 +83,18 @@ bool test_config_pcrc_disable_sel(void *test_context) bool test_config_pcrc_support_sel(void *test_context) { - return test_config_support_common(test_context) && - test_config_check_pcrc_support_common(test_context); + return test_config_check_pcrc_support_common(test_context); } bool test_config_pcrc_check_sel(void *test_context) { - return test_config_check_common(test_context, "PCRC Config Assertion"); + return true; } // link_ide test pcrc bool test_config_pcrc_enable_link(void *test_context) { - bool res = test_config_enable_common(test_context); - if(res) { - res = test_config_set_pcrc_common(test_context, true); - } - - return res; + return test_config_set_pcrc_common(test_context, true); } bool test_config_pcrc_disable_link(void *test_context) @@ -116,7 +109,7 @@ bool test_config_pcrc_support_link(void *test_context) bool test_config_pcrc_check_link(void *test_context) { - return test_config_check_common(test_context, "PCRC Config Assertion"); + return true; } // selective_and_link_ide test pcrc