Skip to content

Commit

Permalink
Refactor Default and PCRC config
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mxu9 authored and jyao1 committed May 17, 2024
1 parent 1bc6a43 commit ffbce4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
31 changes: 12 additions & 19 deletions teeio-validator/teeio_validator/test_config/test_config_pcrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit ffbce4e

Please sign in to comment.