diff --git a/platform/linux/common/transport_raw.c b/platform/linux/common/transport_raw.c index bc53344e061594de57a29184a35b61edc97b8c4a..4f9b2d11894b8798332a5cab1cca5bcd1982dc25 100644 --- a/platform/linux/common/transport_raw.c +++ b/platform/linux/common/transport_raw.c @@ -60,6 +60,42 @@ struct linux_scmi_raw_config { static struct linux_scmi_raw_config *rawc; +static int safe_read(int fd, void *buf, size_t count) +{ + int ret, bytes = 0; + + do { + ret = read(fd, buf + bytes, count - bytes); + if (ret < 0) { + if (errno == -EINTR) + continue; + return ret; + } + bytes += ret; + } while (ret); + + return bytes; +} + +static int safe_write(int fd, const void *buf, size_t count) +{ + int bytes = 0; + + do { + int ret; + + ret = write(fd, buf + bytes, count - bytes); + if (ret < 0) { + if (errno == -EINTR) + continue; + return ret; + } + bytes += ret; + } while (count > bytes); + + return bytes; +} + static int linux_read_integer_from_file(int fd_base, char *filepath, unsigned long *val) { @@ -167,7 +203,7 @@ uint32_t linux_initialize_system(void *info) /* Flush any pending SCMI messages on start...just in case */ val_print(VAL_PRINT_INFO, "\n Resetting SCMI kernel Raw queues."); - write(conf->fd_reset, "Y\n", 3); + safe_write(conf->fd_reset, "Y\n", 3); rawc = conf; atexit(scmi_raw_mode_cleanup); @@ -216,7 +252,7 @@ static int32_t __linux_send_message(uint32_t message_header_send, size_t paramet if (fd_message < 0) return ERROR; - write(fd_message, buffer, + safe_write(fd_message, buffer, sizeof(uint32_t) + parameter_count * sizeof(uint32_t)); /* polling */ @@ -229,7 +265,7 @@ static int32_t __linux_send_message(uint32_t message_header_send, size_t paramet } /* read returned message into the buffer */ - count = read(fd_message, buffer, rawc->max_msg_size); + count = safe_read(fd_message, buffer, rawc->max_msg_size); if (count < 0) { close(fd_message); return ERROR; @@ -316,7 +352,7 @@ int linux_wait_for_response(uint32_t *message_header_rcv, } /* read returned message into the buffer */ - count = read(fd_message, buffer, rawc->max_msg_size); + count = safe_read(fd_message, buffer, rawc->max_msg_size); if (count < 0) { close(fd_message); return ERROR; @@ -375,7 +411,7 @@ int linux_wait_for_notification(uint32_t *message_header_rcv, } /* read returned message into the buffer */ - count = read(fd_message, buffer, rawc->max_msg_size); + count = safe_read(fd_message, buffer, rawc->max_msg_size); if (count < 0) { close(fd_message); return ERROR; diff --git a/platform/linux/juno/include/pal_base_expected.h b/platform/linux/juno/include/pal_base_expected.h index a7ec82a75e496b4b8730fed5604521cd049c83f8..d2d84b69959fdbdfe9df76cdab9f91bb2bfdeeb2 100644 --- a/platform/linux/juno/include/pal_base_expected.h +++ b/platform/linux/juno/include/pal_base_expected.h @@ -38,6 +38,6 @@ static char *agents[] = { static char *vendor_name = "arm"; static char *subvendor_name = "arm"; -static uint32_t implementation_version = VERSION_ENCODE32(2, 10, 0); +static uint32_t implementation_version = VERSION_ENCODE32(2, 15, 0); #endif /* __PAL_BASE_EXPECTED_H__ */ diff --git a/platform/linux/juno/include/pal_clock_expected.h b/platform/linux/juno/include/pal_clock_expected.h index 23be62c7e870768930610e3b39ebe23081444e4b..dfc7b208500243dcccbbc9335cb3e456317b2832 100644 --- a/platform/linux/juno/include/pal_clock_expected.h +++ b/platform/linux/juno/include/pal_clock_expected.h @@ -28,8 +28,8 @@ static uint32_t num_of_clock_rates[] = { 0x5, /* BIG_CLK */ 0x5, /* LITTLE_CLK */ 0x5, /* GPU_CLK */ - 0x1, /* HDLCD_0 */ - 0x1, /* HDLCD_1 */ + 0x3, /* HDLCD_0 */ + 0x3, /* HDLCD_1 */ 0x7 /* I2SCLK */ }; diff --git a/platform/linux/juno/include/pal_powercap_expected.h b/platform/linux/juno/include/pal_powercap_expected.h new file mode 100644 index 0000000000000000000000000000000000000000..a5b64f35956f5a37ee81c5b3ccdc919e8bc3a6f9 --- /dev/null +++ b/platform/linux/juno/include/pal_powercap_expected.h @@ -0,0 +1,30 @@ +/** @file + * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * SPDX-License-Identifier : Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ + +#ifndef __PAL_POWERCAP_EXPECTED_H__ +#define __PAL_POWERCAP_EXPECTED_H__ + +#ifdef POWERCAP_PROTOCOL + +uint32_t num_powercap_domains = 0x01; + +static char *powercap_domain_name[] = { + "DUMMY", +}; +#endif + +#endif /* __PAL_POWERCAP_EXPECTED_H__ */ diff --git a/platform/linux/juno/pal_powercap.c b/platform/linux/juno/pal_powercap.c new file mode 100644 index 0000000000000000000000000000000000000000..034ce0962983789b239b0ea784f44927e929614b --- /dev/null +++ b/platform/linux/juno/pal_powercap.c @@ -0,0 +1,43 @@ +/** @file + * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * SPDX-License-Identifier : Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +**/ + +#ifdef POWERCAP_PROTOCOL + +#include "pal_interface.h" +#include "pal_powercap_expected.h" + +/** + @brief This API is used for checking num of powercap domain + @param none + @return num of powercap domain +**/ +uint32_t pal_powercap_get_expected_num_domains(void) +{ + return num_powercap_domains; +} + +/** + @brief This API is used for checking powercap domain name + @param domain id + @return powercap domain name +**/ +uint8_t *pal_powercap_get_expected_name(uint32_t domain_id) +{ + return (uint8_t *)powercap_domain_name[domain_id]; +} + +#endif diff --git a/test_pool/base/test_b008.c b/test_pool/base/test_b008.c index e89881ab48e4e3d23f6a9fbc17801dbf78e7179c..a10ec29a2849f38410a9b18eb85a2b43a74c6c06 100644 --- a/test_pool/base/test_b008.c +++ b/test_pool/base/test_b008.c @@ -89,11 +89,14 @@ uint32_t base_query_protocol_list(void) val_agent_set_supported_protocol_list(protocol_list); /* DISCOVER_LIST_PROTOCOLS with invalid skip value should return INVALID PARAMETERS status */ + if (!val_protocol_version_checks_are_relaxed()) + skip = (PROTOCOL_MAX - PROTOCOL_BASE) + 1; /* skip value is set > total num of protocols */ + else + skip = total_num_protocols + 1; val_print(VAL_PRINT_TEST, "\n [Check 2] Send invalid skip value : %d", skip); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); param_count++; - skip = (PROTOCOL_MAX - PROTOCOL_BASE) + 1; /* skip value is set > total num of protocols */ cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_BASE, BASE_DISCOVER_LIST_PROTOCOLS, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, &skip, &rsp_msg_hdr, &status, &return_value_count, return_values); diff --git a/test_pool/clock/test_c005.c b/test_pool/clock/test_c005.c index 7dbc353c2ab58ec3ce534c54659284d80cd7d127..4aee5632a944ac0aace8577b389d5b854bec33a6 100644 --- a/test_pool/clock/test_c005.c +++ b/test_pool/clock/test_c005.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,9 +21,9 @@ #define TEST_NUM (SCMI_CLOCK_TEST_NUM_BASE + 5) #define TEST_DESC "Clock attributes check " -uint32_t clock_attributes_check(void) +uint32_t clock_attributes_check(uint32_t version) { - int32_t status; + int32_t status, r_begin, r_end; uint32_t rsp_msg_hdr; uint32_t cmd_msg_hdr; size_t param_count; @@ -37,11 +37,27 @@ uint32_t clock_attributes_check(void) /* Discover clock attributes for all clocks */ num_clocks = val_clock_get_info(NUM_CLOCKS, 0); if (num_clocks == 0) { - val_print(VAL_PRINT_ERR, "\n No Clock found "); + val_print(VAL_PRINT_ERR, "\n No Clock found "); return VAL_STATUS_SKIP; } val_print(VAL_PRINT_DEBUG, "\n NUM CLOCKS : %d", num_clocks); + switch (version) { + case CLOCK_PROTOCOL_VERSION_1: + r_begin = 1; + r_end = 31; + break; + case CLOCK_PROTOCOL_VERSION_2: + r_begin = 1; + r_end = 28; + break; + case CLOCK_PROTOCOL_VERSION_3: + default: + r_begin = 2; + r_end = 26; + break; + } + for (clock_id = 0; clock_id < num_clocks; clock_id++) { val_print(VAL_PRINT_TEST, "\n CLOCK ID: %d", clock_id); @@ -63,14 +79,34 @@ uint32_t clock_attributes_check(void) val_print_return_values(return_value_count, return_values); attributes = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attributes, 1, 31) != + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attributes, r_begin, r_end) != VAL_STATUS_PASS)) return VAL_STATUS_FAIL; val_clock_save_info(CLOCK_ATTRIBUTE, clock_id, attributes); - val_print(VAL_PRINT_INFO, "\n CLOCK_ENABLED: %d", VAL_EXTRACT_BITS(attributes, 0, 0)); - val_print(VAL_PRINT_INFO, "\n CLOCK_NAME: %s ", + + val_print(VAL_PRINT_INFO, "\n CLOCK_ENABLED: %d", + val_get_clock_attributes_flag(attributes, CLOCK_ENABLE)); + + if (version >= CLOCK_PROTOCOL_VERSION_2) { + val_print(VAL_PRINT_INFO, "\n Extended Name Support: %d", + val_get_clock_attributes_flag(attributes, CLOCK_EXTENDED_NAME_SUPPORT)); + val_print(VAL_PRINT_INFO, "\n Rate Change req notify Support: %d", + val_get_clock_attributes_flag(attributes, CLOCK_RATE_CHNG_REQ_NOTI_SUPP)); + val_print(VAL_PRINT_INFO, "\n Rate Change notification Support: %d", + val_get_clock_attributes_flag(attributes, CLOCK_RATE_CHNG_NOTI_SUPP)); + } + + if (version >= CLOCK_PROTOCOL_VERSION_3) { + val_print(VAL_PRINT_INFO, "\n Parent Clock Identifier Support: %d", + val_get_clock_attributes_flag(attributes, CLOCK_PARENT_IDENTIFIER_SUPPORT)); + } + + val_print(VAL_PRINT_INFO, "\n CLOCK_NAME: %s ", (uint8_t *) &return_values[NAME_OFFSET]); + if (version >= CLOCK_PROTOCOL_VERSION_2) + val_print(VAL_PRINT_INFO, "\n CLOCK Enable Delay: %d ", + return_values[ENABLE_DELAY_OFFSET]); } return VAL_STATUS_PASS; diff --git a/test_pool/clock/test_c005_v2.c b/test_pool/clock/test_c005_v2.c deleted file mode 100644 index bc0fc8aca90f6950060871c1a0fb4832ee6da7df..0000000000000000000000000000000000000000 --- a/test_pool/clock/test_c005_v2.c +++ /dev/null @@ -1,88 +0,0 @@ -/** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. - * SPDX-License-Identifier : Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -**/ - -#include "val_interface.h" -#include "val_clock.h" - -#define TEST_NUM (SCMI_CLOCK_TEST_NUM_BASE + 5) -#define TEST_DESC "Clock attributes check " - -uint32_t clock_attributes_check_v2(void) -{ - int32_t status; - uint32_t rsp_msg_hdr; - uint32_t cmd_msg_hdr; - size_t param_count; - size_t return_value_count; - uint32_t return_values[MAX_RETURNS_SIZE]; - uint32_t clock_id, num_clocks, attributes; - - if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) - return VAL_STATUS_SKIP; - - /* Discover clock attributes for all clocks */ - num_clocks = val_clock_get_info(NUM_CLOCKS, 0); - if (num_clocks == 0) { - val_print(VAL_PRINT_ERR, "\n No Clock found "); - return VAL_STATUS_SKIP; - } - val_print(VAL_PRINT_DEBUG, "\n NUM CLOCKS : %d", num_clocks); - - for (clock_id = 0; clock_id < num_clocks; clock_id++) - { - val_print(VAL_PRINT_TEST, "\n CLOCK ID: %d", clock_id); - val_print(VAL_PRINT_TEST, "\n [Check 1] Query clock attribute"); - - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - param_count++; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_ATTRIBUTES, - COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, &clock_id, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - val_print_return_values(return_value_count, return_values); - - attributes = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attributes, 1, 28) != - VAL_STATUS_PASS)) - return VAL_STATUS_FAIL; - - val_clock_save_info(CLOCK_ATTRIBUTE, clock_id, attributes); - - val_print(VAL_PRINT_INFO, "\n CLOCK_ENABLED: %d", - val_get_clock_attributes_flag(attributes, CLOCK_ENABLE)); - val_print(VAL_PRINT_INFO, "\n Extended Name Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_EXTENDED_NAME_SUPPORT)); - val_print(VAL_PRINT_INFO, "\n Rate Change req notify Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_RATE_CHNG_REQ_NOTI_SUPP)); - val_print(VAL_PRINT_INFO, "\n Rate Change notification Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_RATE_CHNG_NOTI_SUPP)); - - val_print(VAL_PRINT_INFO, "\n CLOCK_NAME: %s ", - (uint8_t *) &return_values[NAME_OFFSET]); - val_print(VAL_PRINT_INFO, "\n CLOCK Enable Delay: %d ", - return_values[ENABLE_DELAY_OFFSET]); - } - - return VAL_STATUS_PASS; -} diff --git a/test_pool/clock/test_c005_v3.c b/test_pool/clock/test_c005_v3.c deleted file mode 100644 index 810de706eec064aa97807e421ad6c9b8289d185f..0000000000000000000000000000000000000000 --- a/test_pool/clock/test_c005_v3.c +++ /dev/null @@ -1,93 +0,0 @@ -/** @file - * Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved. - * SPDX-License-Identifier : Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -**/ - -#include "val_interface.h" -#include "val_clock.h" - -#define TEST_NUM (SCMI_CLOCK_TEST_NUM_BASE + 5) -#define TEST_DESC "Clock attributes check " - -uint32_t clock_attributes_check_v3(void) -{ - int32_t status; - uint32_t rsp_msg_hdr; - uint32_t cmd_msg_hdr; - size_t param_count; - size_t return_value_count; - uint32_t return_values[MAX_RETURNS_SIZE]; - uint32_t clock_id, num_clocks, attributes; - - if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) - return VAL_STATUS_SKIP; - - /* Discover clock attributes for all clocks */ - num_clocks = val_clock_get_info(NUM_CLOCKS, 0); - if (num_clocks == 0) { - val_print(VAL_PRINT_ERR, "\n No Clock found "); - return VAL_STATUS_SKIP; - } - val_print(VAL_PRINT_DEBUG, "\n NUM CLOCKS : %d", num_clocks); - - for (clock_id = 0; clock_id < num_clocks; clock_id++) - { - val_print(VAL_PRINT_TEST, "\n CLOCK ID: %d", clock_id); - val_print(VAL_PRINT_TEST, "\n [Check 1] Query clock attribute"); - - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - param_count++; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_ATTRIBUTES, - COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, &clock_id, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - val_print_return_values(return_value_count, return_values); - - attributes = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attributes, 2, 26) != - VAL_STATUS_PASS)) - return VAL_STATUS_FAIL; - - val_clock_save_info(CLOCK_ATTRIBUTE, clock_id, attributes); - - val_print(VAL_PRINT_INFO, "\n CLOCK_ENABLED: %d", - val_get_clock_attributes_flag(attributes, CLOCK_ENABLE)); - val_print(VAL_PRINT_INFO, "\n Extended Name Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_EXTENDED_NAME_SUPPORT)); - val_print(VAL_PRINT_INFO, "\n Rate Change req notify Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_RATE_CHNG_REQ_NOTI_SUPP)); - val_print(VAL_PRINT_INFO, "\n Rate Change notification Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_RATE_CHNG_NOTI_SUPP)); - val_print(VAL_PRINT_INFO, "\n Parent Clock Identifier Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_PARENT_IDENTIFIER_SUPPORT)); - val_print(VAL_PRINT_INFO, "\n Extended Configuration Support: %d", - val_get_clock_attributes_flag(attributes, CLOCK_EXTENDED_CONFIGURATION_SUPPORT)); - val_print(VAL_PRINT_INFO, "\n Restricted Clock: %d", - val_get_clock_attributes_flag(attributes, CLOCK_RESTRICTED)); - val_print(VAL_PRINT_INFO, "\n CLOCK_NAME: %s", - (uint8_t *) &return_values[NAME_OFFSET]); - val_print(VAL_PRINT_INFO, "\n CLOCK Enable Delay: %d", - return_values[ENABLE_DELAY_OFFSET]); - } - - return VAL_STATUS_PASS; -} diff --git a/test_pool/clock/test_c009.c b/test_pool/clock/test_c009.c index d6c1138ce60e0a36187eff0f770ededce8f2b697..d7159f286851e86d4f9b8564381ff883810c7213 100644 --- a/test_pool/clock/test_c009.c +++ b/test_pool/clock/test_c009.c @@ -106,7 +106,7 @@ uint32_t clock_rate_set_sync_check(void) return VAL_STATUS_FAIL; if (val_compare_status(status, SCMI_DENIED) == VAL_STATUS_PASS) - return VAL_STATUS_PASS; + continue; if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; diff --git a/test_pool/clock/test_c010.c b/test_pool/clock/test_c010.c index ef1f1f27bbc329eefe7a126c3312df21b0bdf700..87a8441fadd1e62fe4b4e12a0ee181a94b71137d 100644 --- a/test_pool/clock/test_c010.c +++ b/test_pool/clock/test_c010.c @@ -113,10 +113,13 @@ uint32_t clock_rate_set_async_check(void) val_send_message_async(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) + if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) + if (val_compare_status(status, SCMI_DENIED) == VAL_STATUS_PASS) + continue; + + if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; val_print_return_values(return_value_count, return_values); diff --git a/test_pool/clock/test_c011.c b/test_pool/clock/test_c011.c index df291507315d1ae8809d9f1a7ee9943792e8bd52..d3a9c23951412a88c7028732c64d9eff30a5e8a8 100644 --- a/test_pool/clock/test_c011.c +++ b/test_pool/clock/test_c011.c @@ -70,7 +70,7 @@ uint32_t clock_rate_set_invalid_param_check(void) return VAL_STATUS_FAIL; if (val_compare_status(status, SCMI_DENIED) == VAL_STATUS_PASS) - return VAL_STATUS_PASS; + continue; if (val_compare_status(status, SCMI_INVALID_PARAMETERS) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; diff --git a/test_pool/clock/test_c017.c b/test_pool/clock/test_c017.c index 440d54dd8460ba5916bf9c043caf17a69f43b707..bfb87dcd459cf60743be1f548ae8126ed1b37c05 100644 --- a/test_pool/clock/test_c017.c +++ b/test_pool/clock/test_c017.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020-2023, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2020-2024, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ #define TEST_NUM (SCMI_CLOCK_TEST_NUM_BASE + 17) #define TEST_DESC "Clock config set check " -#define MAX_PARAMETER_SIZE 2 +#define MAX_PARAMETER_SIZE 3 /********* TEST ALGO ******************** * Find a new attribute from previously saved value @@ -30,9 +30,9 @@ * Restore the default attribute *****************************************/ -uint32_t clock_config_set_check(void) +uint32_t clock_config_set_check(uint32_t version) { - int32_t status; + int32_t status, r_begin, r_end; uint32_t rsp_msg_hdr; uint32_t cmd_msg_hdr; size_t param_count; @@ -51,6 +51,22 @@ uint32_t clock_config_set_check(void) } val_print(VAL_PRINT_DEBUG, "\n NUM CLOCKS : %d", num_clocks); + switch (version) { + case CLOCK_PROTOCOL_VERSION_1: + r_begin = 1; + r_end = 31; + break; + case CLOCK_PROTOCOL_VERSION_2: + r_begin = 1; + r_end = 28; + break; + case CLOCK_PROTOCOL_VERSION_3: + default: + r_begin = 2; + r_end = 26; + break; + } + for (clock_id = 0; clock_id < num_clocks; clock_id++) { bool could_be_denied = false; @@ -63,7 +79,7 @@ uint32_t clock_config_set_check(void) run_flag = 1; /* Find new attribute from previously stored value */ attributes = val_clock_get_info(CLOCK_ATTRIBUTE, clock_id); - if (attributes == CONFIG_SET_DISABLE) + if ((attributes & 0x1) == CONFIG_SET_DISABLE) attributes = CONFIG_SET_ENABLE; else attributes = CONFIG_SET_DISABLE; @@ -74,6 +90,8 @@ uint32_t clock_config_set_check(void) VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); parameters[param_count++] = clock_id; parameters[param_count++] = attributes; + if (version >= CLOCK_PROTOCOL_VERSION_3) + parameters[param_count++] = 0; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_CONFIG_SET, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); @@ -109,7 +127,7 @@ uint32_t clock_config_set_check(void) return VAL_STATUS_FAIL; if (val_reserved_bits_check_is_zero( - VAL_EXTRACT_BITS(return_values[ATTRIBUTE_OFFSET], 1, 31) != VAL_STATUS_PASS)) + VAL_EXTRACT_BITS(return_values[ATTRIBUTE_OFFSET], r_begin, r_end) != VAL_STATUS_PASS)) return VAL_STATUS_FAIL; val_print_return_values(return_value_count, return_values); diff --git a/test_pool/clock/test_c017_v3.c b/test_pool/clock/test_c017_v3.c deleted file mode 100644 index 9e9c0886f6aa4dece3791d361620ccafa240cb6b..0000000000000000000000000000000000000000 --- a/test_pool/clock/test_c017_v3.c +++ /dev/null @@ -1,159 +0,0 @@ -/** @file - * Copyright (c) 2023-2024, Arm Limited or its affiliates. All rights reserved. - * SPDX-License-Identifier : Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -**/ - -#include "val_interface.h" -#include "val_clock.h" - -#define TEST_NUM (SCMI_CLOCK_TEST_NUM_BASE + 17) -#define TEST_DESC "Clock config set check " - -#define MAX_PARAMETER_SIZE 3 - -/********* TEST ALGO ******************** - * Check if clock has any restrictions before changing clock state - * Find a new attribute from previously saved value - * Set new attribute - * Get the attribute again and compare with newly set attribute - * Restore the default attribute -*****************************************/ - -uint32_t clock_config_set_check_v3(void) -{ - int32_t status; - uint32_t rsp_msg_hdr; - uint32_t cmd_msg_hdr; - size_t param_count; - size_t return_value_count; - uint32_t return_values[MAX_RETURNS_SIZE], attributes; - uint32_t clock_id, num_clocks, parameters[MAX_PARAMETER_SIZE]; - uint32_t run_flag = 0, clock_state_control = 0; - - if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) - return VAL_STATUS_SKIP; - - num_clocks = val_clock_get_info(NUM_CLOCKS, 0); - if (num_clocks == 0) { - val_print(VAL_PRINT_ERR, "\n No Clock found "); - return VAL_STATUS_SKIP; - } - val_print(VAL_PRINT_DEBUG, "\n NUM CLOCKS : %d", num_clocks); - - for (clock_id = 0; clock_id < num_clocks; clock_id++) - { - val_print(VAL_PRINT_TEST, "\n CLOCK ID: %d", clock_id); - - /* Check if current clock id has any restrictions to change clock config */ - attributes = val_clock_get_info(CLOCK_ATTRIBUTE, clock_id); - if (val_get_clock_attributes_flag(attributes, CLOCK_RESTRICTED)) { - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - param_count++; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_GET_PERMISSIONS, COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, &clock_id, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - clock_state_control = VAL_EXTRACT_BITS(return_values[CLOCK_PERMISSIONS_OFFSET], 31, 31); - } - - run_flag = 1; - /* Find new attribute from previously stored value */ - attributes = val_clock_get_info(CLOCK_ATTRIBUTE, clock_id) & 0x1; - if (attributes == CONFIG_SET_DISABLE) - attributes = CONFIG_SET_ENABLE; - else - attributes = CONFIG_SET_DISABLE; - - /* CLOCK_CONFIG_SET with new attribute */ - val_print(VAL_PRINT_TEST, "\n [Check 1] Set config with attributes :%d", attributes); - - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - parameters[param_count++] = clock_id; - parameters[param_count++] = attributes; - parameters[param_count++] = 0; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_CONFIG_SET, COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if ((!clock_state_control) && - val_compare_status(status, SCMI_DENIED) == VAL_STATUS_PASS) - return VAL_STATUS_PASS; - - if (val_compare_status(status, SCMI_NOT_SUPPORTED) == VAL_STATUS_PASS) - continue; - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - val_print_return_values(return_value_count, return_values); - - /* Get attribute and compare with new value */ - val_print(VAL_PRINT_TEST, "\n [Check 2] Verify the changed attribute"); - - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - param_count++; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_ATTRIBUTES, COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, &clock_id, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_reserved_bits_check_is_zero( - VAL_EXTRACT_BITS(return_values[ATTRIBUTE_OFFSET], 1, 27) != VAL_STATUS_PASS)) - return VAL_STATUS_FAIL; - - val_print_return_values(return_value_count, return_values); - - if (val_compare("CLOCK STATUS ", - VAL_EXTRACT_BITS(return_values[ATTRIBUTE_OFFSET], 0, 0), attributes)) - return VAL_STATUS_FAIL; - - /* Restore the default attribute value*/ - val_print(VAL_PRINT_TEST, "\n [Check 3] Restore the original attributes :%d", - val_clock_get_info(CLOCK_ATTRIBUTE, clock_id)); - - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - parameters[param_count++] = clock_id; - parameters[param_count++] = val_clock_get_info(CLOCK_ATTRIBUTE, clock_id); - parameters[param_count++] = 0; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_CLOCK, CLOCK_CONFIG_SET, COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - val_print_return_values(return_value_count, return_values); - } - if (run_flag == 0) - return VAL_STATUS_SKIP; - - return VAL_STATUS_PASS; -} diff --git a/test_pool/clock/test_c028.c b/test_pool/clock/test_c028.c index 567c6101d7c39d0ee9ebff618e8289fab3abdbd5..9d4408373eb450f0679440ba8ca4751d44847168 100644 --- a/test_pool/clock/test_c028.c +++ b/test_pool/clock/test_c028.c @@ -32,7 +32,7 @@ uint32_t clock_parent_set_invalid_check(void) size_t return_value_count; uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t parameters[MAX_PARAMETER_SIZE]; - uint32_t clock_id, num_clocks, attributes; + uint32_t clock_id = 0, num_clocks, attributes; uint32_t parent_supp, parent_id = 0, clock_state_control = 0; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) diff --git a/test_pool/clock/test_c029.c b/test_pool/clock/test_c029.c index e075bc2a13741b0d7e9fae87b98bc1ab17e2b727..7b5fa2d89d862e975d40a0cda945398d0feff85c 100644 --- a/test_pool/clock/test_c029.c +++ b/test_pool/clock/test_c029.c @@ -32,7 +32,7 @@ uint32_t clock_parent_set_invalid_clock_id_check(void) size_t return_value_count; uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t parameters[MAX_PARAMETER_SIZE]; - uint32_t clock_id, attributes; + uint32_t clock_id = 0, attributes; uint32_t parent_id = 0, clock_state_control = 0; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) diff --git a/test_pool/pin_control/test_pi003.c b/test_pool/pin_control/test_pi003.c index f5658060618c8a9ac7574f71822ab964f8aa0ddd..4db98f7b8a5e3c3b692e4b4e25c15933951d4c6f 100644 --- a/test_pool/pin_control/test_pi003.c +++ b/test_pool/pin_control/test_pi003.c @@ -94,27 +94,6 @@ uint32_t pin_control_query_mandatory_command_support(void) val_print_return_values(return_value_count, return_values); - if (val_reserved_bits_check_is_zero(return_values[ATTRIBUTE_OFFSET]) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - val_print(VAL_PRINT_TEST, "\n [Check 4] PIN CONTROL FUNCTION SELECT support"); - - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - message_id = PIN_CONTROL_FUNCTION_SELECT; - param_count++; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, PIN_CONTROL_PROTOCOL_MESSAGE_ATTRIBUTES, - COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, &message_id, &rsp_msg_hdr, &status, - &return_value_count, return_values); - - if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; - - val_print_return_values(return_value_count, return_values); - if (val_reserved_bits_check_is_zero(return_values[ATTRIBUTE_OFFSET]) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; diff --git a/test_pool/pin_control/test_pi005.c b/test_pool/pin_control/test_pi005.c index 12898d8db02bdfa7f370a6258bc7726749d3974a..e49388bd901705063a58b049e4b8c2b34e4dbc63 100644 --- a/test_pool/pin_control/test_pi005.c +++ b/test_pool/pin_control/test_pi005.c @@ -71,6 +71,7 @@ uint32_t pin_control_attributes_check(void) if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attributes, 18, 30) != VAL_STATUS_PASS)) return VAL_STATUS_FAIL; + /* If flag parameter is set to PIN, then this value should be 1 */ if (VAL_EXTRACT_BITS(attributes, 0, 15) != 1) return VAL_STATUS_FAIL; diff --git a/test_pool/pin_control/test_pi011.c b/test_pool/pin_control/test_pi011.c index 924cdd8739f9788476b542c1b2a871534f9b32db..dd4b6d80e124667375ede1ba3562a63aa188d3b9 100644 --- a/test_pool/pin_control/test_pi011.c +++ b/test_pool/pin_control/test_pi011.c @@ -168,7 +168,6 @@ uint32_t pin_control_query_settings_configure_check(void) entry_1 = pin_configs_array[1]; if (val_compare("New Config Value ", entry_1, new_config_value)) return VAL_STATUS_FAIL; - /* STEP 5 : Set default config value back */ val_print(VAL_PRINT_TEST, "\n [Step 5] Set default config value"); diff --git a/test_pool/pin_control/test_pi012.c b/test_pool/pin_control/test_pi012.c index 5e8caf9c63a938512dcadbe91aa75407e0b1d773..f978152ad50088b414bec6a1b4ab706b569e6abe 100644 --- a/test_pool/pin_control/test_pi012.c +++ b/test_pool/pin_control/test_pi012.c @@ -25,6 +25,7 @@ #define CONFIG_NUM_SET 1 #define CONFIG_ENABLE 1 +#define DEFAULT_CONFIG_TYPE 0 uint32_t pin_control_settings_configure_invalid_param_check(void) { @@ -54,7 +55,7 @@ uint32_t pin_control_settings_configure_invalid_param_check(void) for (pc_id = 0; pc_id < num_pins; pc_id++) { val_print(VAL_PRINT_TEST, "\n PIN CONTROL PIN ID: %d", pc_id); - val_print(VAL_PRINT_TEST, "\n [Check 1] Query with invalid Config Type "); + val_print(VAL_PRINT_TEST, "\n [Check 1] Set with invalid Config Type "); config_type = RESERVED_CONFIG_TYPE; config_value = CONFIG_ENABLE; @@ -86,7 +87,7 @@ uint32_t pin_control_settings_configure_invalid_param_check(void) parameters[param_count++] = pc_id; parameters[param_count++] = function_selected; parameters[param_count++] = PINCTRL_SET_INVALID_ATTIBUTE; - parameters[param_count++] = config_type; + parameters[param_count++] = DEFAULT_CONFIG_TYPE; parameters[param_count++] = config_value; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, PIN_CONTROL_SETTINGS_CONFIGURE, COMMAND_MSG); diff --git a/test_pool/pin_control/test_pi014.c b/test_pool/pin_control/test_pi014.c index 1896fa1a62012c1bf070b455cab77fd1726eff44..5f6d96c6adfabe1d0e5e84103b79e6bdf8bf7b19 100644 --- a/test_pool/pin_control/test_pi014.c +++ b/test_pool/pin_control/test_pi014.c @@ -32,7 +32,7 @@ uint32_t pin_control_query_function_select_check(void) uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t parameters[PARAMETER_SIZE]; uint32_t num_groups = 0, num_pins = 0, num_functions = 0; - uint32_t pc_id = 0, function_id = 0; + uint32_t pc_id = 0, function_id = 0, attributes = 0; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) return VAL_STATUS_SKIP; @@ -63,11 +63,12 @@ uint32_t pin_control_query_function_select_check(void) VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); parameters[param_count++] = pc_id; - parameters[param_count++] = function_id; - parameters[param_count++] = PIN_SELECTOR; + attributes = (GET_NO_CONFIGS << GET_ALL_CONFIGS_LOW) + + (PIN_SELECTOR << SELECTOR_LOW); + parameters[param_count++] = attributes; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, - PIN_CONTROL_FUNCTION_SELECT, COMMAND_MSG); + PIN_CONTROL_SETTINGS_GET, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); @@ -80,6 +81,9 @@ uint32_t pin_control_query_function_select_check(void) return VAL_STATUS_FAIL; val_print_return_values(return_value_count, return_values); + + val_print(VAL_PRINT_DEBUG, "\n SELECTED PIN FUNCTION: %d", + return_values[RET_FUNCTION_SELECTED_OFFSET]); } } } @@ -103,11 +107,12 @@ uint32_t pin_control_query_function_select_check(void) val_print(VAL_PRINT_TEST, "\n [Check 2] Query function select for group ids"); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); parameters[param_count++] = pc_id; - parameters[param_count++] = function_id; - parameters[param_count++] = GROUP_SELECTOR; + attributes = (GET_NO_CONFIGS << GET_ALL_CONFIGS_LOW) + + (GROUP_SELECTOR << SELECTOR_LOW); + parameters[param_count++] = attributes; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, - PIN_CONTROL_FUNCTION_SELECT, COMMAND_MSG); + PIN_CONTROL_SETTINGS_GET, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); @@ -118,6 +123,11 @@ uint32_t pin_control_query_function_select_check(void) if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; + + val_print_return_values(return_value_count, return_values); + + val_print(VAL_PRINT_DEBUG, "\n SELECTED GROUP FUNCTION: %d", + return_values[RET_FUNCTION_SELECTED_OFFSET]); } } } diff --git a/test_pool/pin_control/test_pi015.c b/test_pool/pin_control/test_pi015.c index b469df10b3bb96ef94779f492bbd27cc419b4d6c..d26a690086777c881e6624fbd8438abfa55ed077 100644 --- a/test_pool/pin_control/test_pi015.c +++ b/test_pool/pin_control/test_pi015.c @@ -31,7 +31,7 @@ uint32_t pin_control_query_function_select_invalid_case_check(void) size_t param_count; uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t parameters[PARAMETER_SIZE]; - uint32_t num_pins = 0, num_functions = 0; + uint32_t num_pins = 0, num_functions = 0, attributes = 0; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) return VAL_STATUS_SKIP; @@ -53,11 +53,12 @@ uint32_t pin_control_query_function_select_invalid_case_check(void) VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); /* pins 0 to num_pins - 1 are valid, using num_pins as invalid pin */ parameters[param_count++] = num_pins; - parameters[param_count++] = num_functions - 1; - parameters[param_count++] = PIN_SELECTOR; + attributes = (GET_NO_CONFIGS << GET_ALL_CONFIGS_LOW) + + (PIN_SELECTOR << SELECTOR_LOW); + parameters[param_count++] = attributes; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, - PIN_CONTROL_FUNCTION_SELECT, COMMAND_MSG); + PIN_CONTROL_SETTINGS_GET, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); @@ -68,16 +69,17 @@ uint32_t pin_control_query_function_select_invalid_case_check(void) return VAL_STATUS_FAIL; val_print(VAL_PRINT_TEST, - "\n [Check 2] Query function select for invalid function id"); + "\n [Check 2] Set function select for invalid function id"); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); parameters[param_count++] = num_pins - 1; /* functions 0 to num_functions - 1 are valid, using num_functions as invalid pin */ parameters[param_count++] = num_functions; - parameters[param_count++] = PIN_SELECTOR; + attributes = (SET_FUNCTION << FUNCTION_ID_VALID) + PIN_SELECTOR; + parameters[param_count++] = attributes; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, - PIN_CONTROL_FUNCTION_SELECT, COMMAND_MSG); + PIN_CONTROL_SETTINGS_CONFIGURE, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); @@ -94,10 +96,12 @@ uint32_t pin_control_query_function_select_invalid_case_check(void) parameters[param_count++] = num_pins - 1; parameters[param_count++] = num_functions - 1; /* Making reserved bit as 1 to make invalid flag */ - parameters[param_count++] = PIN_SELECTOR + (1 << FUNCTION_SELECT_FLAGS_RESERVED_LOW); + attributes = (1 << (FUNCTION_ID_VALID + 1)) + + (SET_FUNCTION << FUNCTION_ID_VALID) + PIN_SELECTOR; + parameters[param_count++] = attributes; cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, - PIN_CONTROL_FUNCTION_SELECT, COMMAND_MSG); + PIN_CONTROL_SETTINGS_CONFIGURE, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, &return_value_count, return_values); diff --git a/test_pool/pin_control/test_pi022.c b/test_pool/pin_control/test_pi022.c index 24bf06d25eafbe476ff673abe084b650228ff1df..42ad65f312e31a31654bce2204e1e6c03715617c 100644 --- a/test_pool/pin_control/test_pi022.c +++ b/test_pool/pin_control/test_pi022.c @@ -33,7 +33,7 @@ uint32_t pin_control_set_permission_invalid_param_check(void) size_t return_value_count; uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t parameters[PARAMETER_SIZE]; - uint32_t pc_id = 0; + uint32_t pc_id = 0, message_id; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) return VAL_STATUS_SKIP; @@ -42,6 +42,20 @@ uint32_t pin_control_set_permission_invalid_param_check(void) if (pc_id == 0) { val_print(VAL_PRINT_ERR, "\n No pin control pin identifiers found"); } else { + /* If PINCTRL_SET_PERMISSIONS not supported, skip the test */ + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + message_id = PIN_CONTROL_SET_PERMISSIONS; + param_count = 1; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, + PIN_CONTROL_PROTOCOL_MESSAGE_ATTRIBUTES, + COMMAND_MSG); + val_send_message(cmd_msg_hdr, param_count, &message_id, &rsp_msg_hdr, &status, + &return_value_count, return_values); + + if (status != SCMI_SUCCESS) { + val_print(VAL_PRINT_ERR, "\n PINCTRL SET PERMISSIONS not supported "); + return VAL_STATUS_SKIP; + } val_print(VAL_PRINT_TEST, "\n [Check 1] Query with invalid selector "); diff --git a/test_pool/pin_control/test_pi023.c b/test_pool/pin_control/test_pi023.c index 708434de530b7da9cd1dc90d34139e6c6514b307..56bc67f962a639aaefedbb5587e36724f188f1c4 100644 --- a/test_pool/pin_control/test_pi023.c +++ b/test_pool/pin_control/test_pi023.c @@ -33,7 +33,7 @@ uint32_t pin_control_set_permission_invalid_id_check(void) size_t return_value_count; uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t parameters[PARAMETER_SIZE]; - uint32_t pc_id = 0; + uint32_t pc_id = 0, message_id; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) return VAL_STATUS_SKIP; @@ -42,6 +42,20 @@ uint32_t pin_control_set_permission_invalid_id_check(void) if (pc_id == 0) { val_print(VAL_PRINT_ERR, "\n No pin control pin identifiers found"); } else { + /* If PINCTRL_SET_PERMISSIONS not supported, skip the test */ + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + message_id = PIN_CONTROL_SET_PERMISSIONS; + param_count = 1; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_PIN_CONTROL, + PIN_CONTROL_PROTOCOL_MESSAGE_ATTRIBUTES, + COMMAND_MSG); + val_send_message(cmd_msg_hdr, param_count, &message_id, &rsp_msg_hdr, &status, + &return_value_count, return_values); + + if (status != SCMI_SUCCESS) { + val_print(VAL_PRINT_ERR, "\n PINCTRL SET PERMISSIONS not supported "); + return VAL_STATUS_SKIP; + } val_print(VAL_PRINT_TEST, "\n [Check 1] Query with invalid pin id "); diff --git a/test_pool/power_domain/test_p007.c b/test_pool/power_domain/test_p007.c index 0349c12ec21de88b9d1a8cab43f17b0d8c38c8a5..7a04e0290e28225ee585b8479936439b893c114f 100644 --- a/test_pool/power_domain/test_p007.c +++ b/test_pool/power_domain/test_p007.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,9 @@ #define PARAMETER_SIZE 3 -uint32_t power_domain_set_power_state_check(void) +uint32_t power_domain_set_power_state_check(uint32_t version) { - int32_t status; + int32_t status, r_begin, r_end; uint32_t rsp_msg_hdr; uint32_t cmd_msg_hdr; size_t param_count; @@ -45,6 +45,24 @@ uint32_t power_domain_set_power_state_check(void) } val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + switch (version) { + case POWER_PROTOCOL_VERSION_1: + case POWER_PROTOCOL_VERSION_2: + r_begin = 0; + r_end = 28; + break; + case POWER_PROTOCOL_VERSION_2P1: + r_begin = 0; + r_end = 27; + break; + case POWER_PROTOCOL_VERSION_3: + case POWER_PROTOCOL_VERSION_3P1: + default: + r_begin = 0; + r_end = 26; + break; + } + for (domain_id = 0; domain_id < num_domains; domain_id++) { val_print(VAL_PRINT_TEST, "\n POWER DOMAIN ID: %d", domain_id); @@ -66,7 +84,8 @@ uint32_t power_domain_set_power_state_check(void) val_print_return_values(return_value_count, return_values); attribute = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 28)) != VAL_STATUS_PASS) + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, r_begin, r_end)) != + VAL_STATUS_PASS) return VAL_STATUS_FAIL; set_state_async = VAL_EXTRACT_BITS(attribute, 30, 30); diff --git a/test_pool/power_domain/test_p008.c b/test_pool/power_domain/test_p008.c index 4385b4f33a792c569c5e8567ac23354a31aa03f7..7e0f7345d092f5ed4355efd7ba1a3f49734ca8c9 100644 --- a/test_pool/power_domain/test_p008.c +++ b/test_pool/power_domain/test_p008.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,9 @@ #define PARAMETER_SIZE 3 -uint32_t power_domain_set_power_state_unsupported_domain_check(void) +uint32_t power_domain_set_power_state_unsupported_domain_check(uint32_t version) { - int32_t status; + int32_t status, r_begin, r_end; uint32_t rsp_msg_hdr; uint32_t cmd_msg_hdr; size_t param_count; @@ -45,6 +45,24 @@ uint32_t power_domain_set_power_state_unsupported_domain_check(void) } val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + switch (version) { + case POWER_PROTOCOL_VERSION_1: + case POWER_PROTOCOL_VERSION_2: + r_begin = 0; + r_end = 28; + break; + case POWER_PROTOCOL_VERSION_2P1: + r_begin = 0; + r_end = 27; + break; + case POWER_PROTOCOL_VERSION_3: + case POWER_PROTOCOL_VERSION_3P1: + default: + r_begin = 0; + r_end = 26; + break; + } + for (domain_id = 0; domain_id < num_domains; domain_id++) { val_print(VAL_PRINT_TEST, "\n POWER DOMAIN ID: %d", domain_id); @@ -66,7 +84,8 @@ uint32_t power_domain_set_power_state_unsupported_domain_check(void) val_print_return_values(return_value_count, return_values); attribute = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 28)) != VAL_STATUS_PASS) + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, r_begin, r_end)) != + VAL_STATUS_PASS) return VAL_STATUS_FAIL; set_state_async = VAL_EXTRACT_BITS(attribute, 30, 30); diff --git a/test_pool/power_domain/test_p012.c b/test_pool/power_domain/test_p012.c index a767ea6429ff58a3304bbe0990c73462972072f6..58338a2f523a7d5fdb66bbbd5f68831b894ffc33 100644 --- a/test_pool/power_domain/test_p012.c +++ b/test_pool/power_domain/test_p012.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2020-2024, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,9 @@ #define PARAMETER_SIZE 2 -uint32_t power_domain_power_state_notify_check(void) +uint32_t power_domain_power_state_notify_check(uint32_t version) { - int32_t status; + int32_t status, r_begin, r_end; uint32_t rsp_msg_hdr; uint32_t cmd_msg_hdr; size_t param_count; @@ -60,6 +60,24 @@ uint32_t power_domain_power_state_notify_check(void) } val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + switch (version) { + case POWER_PROTOCOL_VERSION_1: + case POWER_PROTOCOL_VERSION_2: + r_begin = 0; + r_end = 28; + break; + case POWER_PROTOCOL_VERSION_2P1: + r_begin = 0; + r_end = 27; + break; + case POWER_PROTOCOL_VERSION_3: + case POWER_PROTOCOL_VERSION_3P1: + default: + r_begin = 0; + r_end = 26; + break; + } + for (domain_id = 0; domain_id < num_domains; domain_id++) { val_print(VAL_PRINT_TEST, "\n POWER DOMAIN ID: %d", domain_id); @@ -81,7 +99,8 @@ uint32_t power_domain_power_state_notify_check(void) val_print_return_values(return_value_count, return_values); attribute = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 28)) != VAL_STATUS_PASS) + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, r_begin, r_end)) != + VAL_STATUS_PASS) return VAL_STATUS_FAIL; state_change_notify = VAL_EXTRACT_BITS(attribute, 31, 31); diff --git a/test_pool/power_domain/test_p013.c b/test_pool/power_domain/test_p013.c index 54a6281d9f61e9c64cdc9e3f95de2ac377ef7548..00cf5fadde327f55d78f3584316a2f294cf9b6e9 100644 --- a/test_pool/power_domain/test_p013.c +++ b/test_pool/power_domain/test_p013.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2020-2024, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,9 @@ #define PARAMETER_SIZE 2 -uint32_t power_domain_power_state_notify_unspported_domain_check(void) +uint32_t power_domain_power_state_notify_unspported_domain_check(uint32_t version) { - int32_t status; + int32_t status, r_begin, r_end; uint32_t rsp_msg_hdr; uint32_t cmd_msg_hdr; size_t param_count; @@ -60,6 +60,24 @@ uint32_t power_domain_power_state_notify_unspported_domain_check(void) } val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + switch (version) { + case POWER_PROTOCOL_VERSION_1: + case POWER_PROTOCOL_VERSION_2: + r_begin = 0; + r_end = 28; + break; + case POWER_PROTOCOL_VERSION_2P1: + r_begin = 0; + r_end = 27; + break; + case POWER_PROTOCOL_VERSION_3: + case POWER_PROTOCOL_VERSION_3P1: + default: + r_begin = 0; + r_end = 26; + break; + } + for (domain_id = 0; domain_id < num_domains; domain_id++) { val_print(VAL_PRINT_TEST, "\n POWER DOMAIN ID: %d", domain_id); @@ -81,7 +99,8 @@ uint32_t power_domain_power_state_notify_unspported_domain_check(void) val_print_return_values(return_value_count, return_values); attribute = return_values[ATTRIBUTE_OFFSET]; - if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 28)) != VAL_STATUS_PASS) + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, r_begin, r_end)) != + VAL_STATUS_PASS) return VAL_STATUS_FAIL; state_change_notify = VAL_EXTRACT_BITS(attribute, 31, 31); diff --git a/test_pool/power_domain/test_p018.c b/test_pool/power_domain/test_p018.c index 3e851b6e185d25fa881dc2672687fd76d491a9e9..93ab472c4bf92a143a18b10ef19d6fb522b6cb35 100644 --- a/test_pool/power_domain/test_p018.c +++ b/test_pool/power_domain/test_p018.c @@ -38,11 +38,11 @@ uint32_t power_query_ext_domain_name_invalid_domain(void) /* Get Extended name for invalid domain */ domain_id = val_power_domain_get_info(0, NUM_POWER_DOMAIN) + 1; - val_print(VAL_PRINT_TEST, "\n [Check 1] Get extended name for unsupp. domain"); + val_print(VAL_PRINT_TEST, "\n [Check 1] Get extended name for non existent domain %d", domain_id); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); param_count++; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_POWERCAP, POWER_DOMAIN_NAME_GET, COMMAND_MSG); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_POWER_DOMAIN, POWER_DOMAIN_NAME_GET, COMMAND_MSG); val_send_message(cmd_msg_hdr, param_count, &domain_id, &rsp_msg_hdr, &status, &return_value_count, return_values); @@ -81,7 +81,7 @@ uint32_t power_query_ext_domain_name_invalid_domain(void) val_send_message(cmd_msg_hdr, param_count, &domain_id, &rsp_msg_hdr, &status, &return_value_count, return_values); - if (val_compare_status(status, SCMI_NOT_FOUND) != VAL_STATUS_PASS) + if (val_compare_status(status, SCMI_NOT_SUPPORTED) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) diff --git a/test_pool/powercap/test_pc005_v2.c b/test_pool/powercap/test_pc005_v2.c index ee30a4da23c8e23bb8e4deeb26f67941c1011b02..f693d14ef134b17991c7474ee75c5c3461f92678 100644 --- a/test_pool/powercap/test_pc005_v2.c +++ b/test_pool/powercap/test_pc005_v2.c @@ -34,7 +34,7 @@ uint32_t powercap_query_domain_attributes_v2(void) uint32_t power_monitor, powercap_config, power_unit; uint32_t domain_id, num_domains, attributes; uint32_t min_pai, max_pai, pai_step; - uint32_t min_power_cap, max_power_cap, power_cap_step, ext_name_supp; + uint32_t min_power_cap, max_power_cap, power_cap_step; uint32_t sustainable_power, accuracy, parent_id; char *name; @@ -94,7 +94,7 @@ uint32_t powercap_query_domain_attributes_v2(void) val_get_powercap_attributes_flag(attributes, PC_FASTCHANNEL_SUPPORT)); power_monitor = val_get_powercap_attributes_flag(attributes, PC_POWER_MONITOR_SUPP); - powercap_config = val_get_powercap_attributes_flag(attributes, PC_PAI_CONFIG_SUPP); + powercap_config = val_get_powercap_attributes_flag(attributes, PC_CONFIG_SUPP); /* Powercap Monitor and Config both cannot be zero at the same time */ if (powercap_config == 0 && power_monitor == 0) { @@ -110,19 +110,12 @@ uint32_t powercap_query_domain_attributes_v2(void) return VAL_STATUS_FAIL; } - ext_name_supp = val_get_powercap_attributes_flag(attributes, PC_EXTENDED_NAME); name = (char *)val_powercap_get_expected_name(domain_id); /* Domain name */ - if (ext_name_supp) { - if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET] - 16, - name + strnlen(name, SCMI_NAME_STR_SIZE) - 16, SCMI_NAME_STR_SIZE)) - return VAL_STATUS_FAIL; - } else { - if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET], - name, SCMI_NAME_STR_SIZE)) - return VAL_STATUS_FAIL; - } + if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET], + name, SCMI_NAME_STR_SIZE)) + return VAL_STATUS_FAIL; /* PAI values */ min_pai = return_values[MIN_PAI_OFFSET]; diff --git a/test_pool/powercap/test_pc009.c b/test_pool/powercap/test_pc009.c index 040712768677d727e2d7c2b6f102d5835d84de01..b4e8e0a53a4fef9ac5dd4e9b3de74aea19e03a44 100644 --- a/test_pool/powercap/test_pc009.c +++ b/test_pool/powercap/test_pc009.c @@ -59,13 +59,18 @@ uint32_t powercap_set_power_cap_value(void) /* Set Powercap value for valid domain */ for (domain_id = 0; domain_id < num_domains; domain_id++) { + uint32_t attributes; + val_print(VAL_PRINT_TEST, "\n POWERCAP DOMAIN : %d", domain_id); + attributes = val_powercap_get_info(POWERCAP_ATTRIBUTES, domain_id); + /* Step 1 : Set Powercap synchronously and expect delayed response */ val_print(VAL_PRINT_TEST, "\n [Check 1] Set Powercap [Sync + Delay]"); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status) parameters[param_count++] = domain_id; + /* PC_CAP_SET_EXPECT will be ignored by the platform on a non-async request */ parameters[param_count++] = val_get_cap_set_flag(PC_CAP_SET_SYNC, PC_CAP_SET_EXPECT); parameters[param_count++] = val_powercap_get_info(POWERCAP_POWERCAP, domain_id); @@ -85,6 +90,7 @@ uint32_t powercap_set_power_cap_value(void) val_print(VAL_PRINT_TEST, "\n [Check 2] Set Powercap [Sync + Ignore]"); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status) parameters[param_count++] = domain_id; + /* PC_CAP_SET_EXPECT will be ignored by the platform on a non-async request */ parameters[param_count++] = val_get_cap_set_flag(PC_CAP_SET_SYNC, PC_CAP_SET_IGNORE); parameters[param_count++] = val_powercap_get_info(POWERCAP_POWERCAP, domain_id); @@ -100,6 +106,11 @@ uint32_t powercap_set_power_cap_value(void) val_print_return_values(return_value_count, return_values); + if (val_get_powercap_attributes_flag(attributes, PC_ASYNC_PC_SET_SUPP) == 0) { + val_print(VAL_PRINT_TEST, "\n Async PC set NOT supported...skip."); + continue; + } + /* Step 3 : Set Powercap asynchronously and ignore delayed response */ val_print(VAL_PRINT_TEST, "\n [Check 3] Set Powercap [Async + Ignore]"); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status) @@ -119,6 +130,16 @@ uint32_t powercap_set_power_cap_value(void) val_print_return_values(return_value_count, return_values); + /* Expect an error since on PC_CAP_SET_IGNORE the platform should NOT have sent + * any delayed response, and that will result in a timeout. + */ + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + val_receive_delayed_response(&rsp_msg_hdr, &status, &return_value_count, return_values); + if (val_compare_status(status, SCMI_GENERIC_ERROR) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_TEST, "\n DELAYED MSG : NOT received (as expected)"); + /* Step 4 : Set Powercap asynchronously and expect delayed response */ val_print(VAL_PRINT_TEST, "\n [Check 4] Set Powercap [Async + Expect]"); VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status) @@ -127,8 +148,8 @@ uint32_t powercap_set_power_cap_value(void) parameters[param_count++] = val_powercap_get_info(POWERCAP_POWERCAP, domain_id); cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_POWERCAP, POWERCAP_CAP_SET, COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, - &return_value_count, return_values); + val_send_message_async(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, + &return_value_count, return_values); if (val_compare_status(status, SCMI_SUCCESS) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; @@ -144,15 +165,15 @@ uint32_t powercap_set_power_cap_value(void) VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); val_receive_delayed_response(&rsp_msg_hdr, &status, &return_value_count, return_values); - val_print(VAL_PRINT_TEST, "\n NOTIFY MSG HDR : 0x%08x", rsp_msg_hdr); + val_print(VAL_PRINT_TEST, "\n DELAYED MSG HDR : 0x%08x", rsp_msg_hdr); if (val_compare("PROTOCOL ID", VAL_EXTRACT_BITS(rsp_msg_hdr, 10, 17), - PROTOCOL_CLOCK)) + PROTOCOL_POWERCAP)) return VAL_STATUS_FAIL; if (val_compare("MSG TYPE ", VAL_EXTRACT_BITS(rsp_msg_hdr, 8, 9), DELAYED_RESPONSE_MSG)) return VAL_STATUS_FAIL; if (val_compare("MSG ID ", VAL_EXTRACT_BITS(rsp_msg_hdr, 0, 7), - CLOCK_RATE_SET_COMPLETE)) + POWERCAP_CAP_SET_COMPLETE)) return VAL_STATUS_FAIL; val_print_return_values(return_value_count, return_values); diff --git a/test_pool/powercap/test_pc011.c b/test_pool/powercap/test_pc011.c index 43bffda8edeb284b1acb4d714c8bd529847ed1f6..f6647a94e859c1c51324891f4febcf7f1845a98a 100644 --- a/test_pool/powercap/test_pc011.c +++ b/test_pool/powercap/test_pc011.c @@ -23,7 +23,7 @@ #define TEST_NUM (SCMI_POWERCAP_TEST_NUM_BASE + 11) #define TEST_DESC "Powercap set power cap invalid values " -uint32_t powercap_invalid_data_set_power_cap_value(void) +uint32_t powercap_invalid_data_set_power_cap_value(uint32_t version) { size_t param_count; uint32_t rsp_msg_hdr; @@ -45,23 +45,28 @@ uint32_t powercap_invalid_data_set_power_cap_value(void) domain_id = 0; val_print(VAL_PRINT_TEST, "\n [Check 1] Set ZERO power cap for valid domain"); - VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + if (version < POWERCAP_PROTOCOL_VERSION_2) { + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); - parameters[param_count++] = domain_id; - parameters[param_count++] = 0x0; - parameters[param_count++] = 0x0; + parameters[param_count++] = domain_id; + parameters[param_count++] = 0x0; + parameters[param_count++] = 0x0; - cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_POWERCAP, POWERCAP_CAP_SET, COMMAND_MSG); - val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, - &return_value_count, return_values); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_POWERCAP, POWERCAP_CAP_SET, COMMAND_MSG); + val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, + &return_value_count, return_values); - if (val_compare_status(status, SCMI_INVALID_PARAMETERS) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; + if (val_compare_status(status, SCMI_INVALID_PARAMETERS) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; - if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) - return VAL_STATUS_FAIL; + if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; - val_print_return_values(return_value_count, return_values); + val_print_return_values(return_value_count, return_values); + } else { + val_print(VAL_PRINT_TEST, "\n Powercap protocol version >= %d. Skip.\n", + POWERCAP_PROTOCOL_VERSION_2); + } /* Set invalid reserved flags */ domain_id = 0; diff --git a/test_pool/voltage/test_v005_v2.c b/test_pool/voltage/test_v005_v2.c index a6ad379e38f4f2c18209a9a717e71b1e4436641e..02d89901de2b68440b732892fb60f70f5286c183 100644 --- a/test_pool/voltage/test_v005_v2.c +++ b/test_pool/voltage/test_v005_v2.c @@ -31,7 +31,7 @@ uint32_t voltage_query_domain_attributes_v2(void) size_t param_count; size_t return_value_count; uint32_t return_values[MAX_RETURNS_SIZE]; - uint32_t domain_id, num_domains, attribute, ext_name_supp; + uint32_t domain_id, num_domains, attribute; char *name; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) @@ -75,19 +75,12 @@ uint32_t voltage_query_domain_attributes_v2(void) val_print(VAL_PRINT_DEBUG, "\n Extended name supp : %d", val_get_voltage_attributes_flag(attribute, EXTENDED_NAME_SUPP)); - ext_name_supp = val_get_voltage_attributes_flag(attribute, EXTENDED_NAME_SUPP); name = (char *)val_voltage_get_expected_name(domain_id); val_voltage_save_info(VOLTAGE_ATTRIBUTES, domain_id, attribute); - if (ext_name_supp) { - if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET] - 16, - name + strnlen(name, SCMI_NAME_STR_SIZE) - 16, SCMI_NAME_STR_SIZE)) - return VAL_STATUS_FAIL; - } else { - if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET], - name, SCMI_NAME_STR_SIZE)) - return VAL_STATUS_FAIL; - } + if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET], + name, SCMI_NAME_STR_SIZE)) + return VAL_STATUS_FAIL; } return VAL_STATUS_PASS; diff --git a/val/include/val_clock.h b/val/include/val_clock.h index 44dc0e700d244a3de788c443ce8309131a350eaa..457639936b0b6c2f38f8019e215907b3d1adbc8e 100644 --- a/val/include/val_clock.h +++ b/val/include/val_clock.h @@ -77,7 +77,7 @@ uint32_t clock_query_protocol_version(uint32_t *version); uint32_t clock_query_protocol_attributes(void); uint32_t clock_query_mandatory_command_support(void); uint32_t clock_invalid_messageid_call(void); -uint32_t clock_attributes_check(void); +uint32_t clock_attributes_check(uint32_t version); uint32_t clock_attributes_check_invalid_clock_id(void); uint32_t clock_query_describe_rates(void); uint32_t clock_query_describe_rates_invalid_clock_id(void); @@ -89,12 +89,11 @@ uint32_t clock_rate_get_check(void); uint32_t clock_rate_get_invalid_clock_id_check(void); uint32_t clock_config_set_invalid_attr_check(void); uint32_t clock_config_set_invalid_clock_id_check(void); -uint32_t clock_config_set_check(void); +uint32_t clock_config_set_check(uint32_t version); /* V2 Test cases */ uint32_t clock_query_ext_domain_name(void); uint32_t clock_query_domain_ext_name_invalid_domain(void); -uint32_t clock_attributes_check_v2(void); uint32_t clock_rate_notification_query(void); uint32_t clock_rate_notification_invalid_query(void); uint32_t clock_rate_req_notification_query(void); @@ -103,12 +102,10 @@ uint32_t clock_parent_get_invalid_clock_id_check(void); /* V3 Test cases */ uint32_t clock_query_mandatory_command_support_v3(void); -uint32_t clock_config_set_check_v3(void); uint32_t clock_parent_name_support_get_check(void); uint32_t clock_parent_name_support_set_check(void); uint32_t clock_parent_set_invalid_check(void); uint32_t clock_parent_set_invalid_clock_id_check(void); -uint32_t clock_attributes_check_v3(void); uint32_t clock_config_get_check(void); uint32_t clock_config_get_invalid_clock_id_check(void); uint32_t clock_possible_parents_get_check(void); diff --git a/val/include/val_interface.h b/val/include/val_interface.h index fe4f2b2e6aefca2725f7c587feb184e8c7434f83..cd8df8259b457b53e29febe3d90d02c980df6f79 100644 --- a/val/include/val_interface.h +++ b/val/include/val_interface.h @@ -158,6 +158,7 @@ uint32_t val_strcmp(uint8_t *dst_ptr, uint8_t *src_ptr, uint32_t len); uint32_t val_compare_msg_hdr(uint32_t sent_msg_hdr, uint32_t rsp_msg_hdr); bool val_protocol_version_strict(uint32_t version, uint32_t exp_version); bool val_protocol_version_relaxed(uint32_t protocol, uint32_t version, uint32_t exp_version); +bool val_protocol_version_checks_are_relaxed(void); uint32_t val_reserved_bits_check_is_zero(uint32_t reserved_bits); void val_print(uint32_t level, const char *string, ...); void val_memset(void *ptr, int value, size_t length); @@ -618,6 +619,7 @@ typedef enum { POWERCAP_DOMAIN_ATTRIBUTES, POWERCAP_CAP_GET, POWERCAP_CAP_SET, + POWERCAP_CAP_SET_COMPLETE = POWERCAP_CAP_SET, POWERCAP_PAI_GET, POWERCAP_PAI_SET, POWERCAP_DOMAIN_NAME_GET, @@ -698,7 +700,6 @@ typedef enum { PIN_CONTROL_LIST_ASSOCIATIONS, PIN_CONTROL_SETTINGS_GET, PIN_CONTROL_SETTINGS_CONFIGURE, - PIN_CONTROL_FUNCTION_SELECT, PIN_CONTROL_REQUEST, PIN_CONTROL_RELEASE, PIN_CONTROL_NAME_GET, diff --git a/val/include/val_pin_control.h b/val/include/val_pin_control.h index 5d5c55b946e2d153ba7ac869ce002dcb5c0de795..b7a60196daee42ab35091213ae64b0ce30bc4dea 100644 --- a/val/include/val_pin_control.h +++ b/val/include/val_pin_control.h @@ -18,12 +18,13 @@ #ifndef __VAL_PIN_CONTROL_H__ #define __VAL_PIN_CONTROL_H__ -#define MAX_PIN_IDENTIFIERS 5 -#define MAX_GROUP_IDENTIFIERS 10 -#define MAX_FUNCTIONS_IDENTIFIERS 10 +#define MAX_PIN_IDENTIFIERS 128 +#define MAX_GROUP_IDENTIFIERS 128 +#define MAX_FUNCTIONS_IDENTIFIERS 128 #define PIN_SELECTOR 0 #define GROUP_SELECTOR 1 #define FUNCTION_SELECTOR 2 +#define GET_NO_CONFIGS 2 #define GET_ALL_CONFIGS 1 #define NO_FUNCTION_ENABLED 0xFFFFFFFF @@ -46,6 +47,9 @@ #define SELECTOR_LOW 16 #define SKIP_CONFIGS_LOW 8 #define SET_CONFIGS_LOW 2 +#define SET_FUNCTION 1 +#define FUNCTION_ID_VALID 10 +#define FUNCTION_IGNORED 0 #define PINCTRL_ACCESS_DENY 0 #define PINCTRL_ACCESS_ALLOW 1 #define PINCTRL_ACCESS_OFFSET 2 diff --git a/val/include/val_power_domain.h b/val/include/val_power_domain.h index dc5f18f51b9c00b5294f6b984d193500fcf679c2..05389b64627310ec0f8ce4aba797727103a684ba 100644 --- a/val/include/val_power_domain.h +++ b/val/include/val_power_domain.h @@ -56,13 +56,13 @@ uint32_t power_domain_query_mandatory_command_support(void); uint32_t power_domain_invalid_messageid_call(void); uint32_t power_domain_query_domain_attributes(void); uint32_t power_domain_query_domain_attributes_invalid_doamin(void); -uint32_t power_domain_set_power_state_check(void); -uint32_t power_domain_set_power_state_unsupported_domain_check(void); +uint32_t power_domain_set_power_state_check(uint32_t version); +uint32_t power_domain_set_power_state_unsupported_domain_check(uint32_t version); uint32_t power_domain_set_power_state_check_invalid_domain(void); uint32_t power_domain_get_power_state_check(void); uint32_t power_domain_get_power_state_check_invalid_domain(void); -uint32_t power_domain_power_state_notify_check(void); -uint32_t power_domain_power_state_notify_unspported_domain_check(void); +uint32_t power_domain_power_state_notify_check(uint32_t version); +uint32_t power_domain_power_state_notify_unspported_domain_check(uint32_t version); uint32_t power_domain_power_state_notify_invalid_domain_check(void); /* scmi v2 Tests */ diff --git a/val/include/val_powercap.h b/val/include/val_powercap.h index 3336d6a1ad188d27a021882bc0e22b643b92bf8b..6d5ae9a128970c83ae2e041a113ebbce08c48818 100644 --- a/val/include/val_powercap.h +++ b/val/include/val_powercap.h @@ -105,7 +105,7 @@ uint32_t powercap_invalid_data_set_pai_value(void); uint32_t powercap_query_domain_name_invalid_domain(void); uint32_t powercap_cap_notification_invalid_query(void); uint32_t powercap_measurement_notification_invalid_query(void); -uint32_t powercap_invalid_data_set_power_cap_value(void); +uint32_t powercap_invalid_data_set_power_cap_value(uint32_t); /* Version 2 */ uint32_t powercap_query_domain_attributes_v2(void); diff --git a/val/val_clock.c b/val/val_clock.c index e886cd26662720701bb06a4b035fd6abedd7a15a..16cfbf9e47abe469a3c683674fb397e602e73241 100644 --- a/val/val_clock.c +++ b/val/val_clock.c @@ -51,12 +51,7 @@ uint32_t val_clock_execute_tests(void) RUN_TEST(clock_invalid_messageid_call()); - if (version == CLOCK_PROTOCOL_VERSION_1) - RUN_TEST(clock_attributes_check()); - else if (version == CLOCK_PROTOCOL_VERSION_2) - RUN_TEST(clock_attributes_check_v2()); - else - RUN_TEST(clock_attributes_check_v3()); + RUN_TEST(clock_attributes_check(version)); RUN_TEST(clock_attributes_check_invalid_clock_id()); RUN_TEST(clock_query_describe_rates()); @@ -77,10 +72,7 @@ uint32_t val_clock_execute_tests(void) RUN_TEST(clock_config_set_invalid_attr_check()); RUN_TEST(clock_config_set_invalid_clock_id_check()); - if (version >= CLOCK_PROTOCOL_VERSION_3) - RUN_TEST(clock_config_set_check_v3()); - else - RUN_TEST(clock_config_set_check()); + RUN_TEST(clock_config_set_check(version)); if (version >= CLOCK_PROTOCOL_VERSION_2) { RUN_TEST(clock_query_ext_domain_name()); diff --git a/val/val_interface.c b/val/val_interface.c index cda2dc21175cf1ce8d6f6c183032cdeade34338c..8162eb85142b73f78b782786f44a004a1460a611 100644 --- a/val/val_interface.c +++ b/val/val_interface.c @@ -671,3 +671,12 @@ bool val_protocol_version_relaxed(uint32_t protocol, uint32_t version, return version >= exp_version; } + +/** + @brief This API returns a boolean to report if the version checks are configured as relaxed + @return true if version checks are relaxed +**/ +bool val_protocol_version_checks_are_relaxed(void) +{ + return relaxed_version_checks; +} diff --git a/val/val_power_domain.c b/val/val_power_domain.c index 6a17611d0da240509831ae658e2b348585c2f57f..84208778daf9e3690eeea0d5c18b05411e4fdab2 100644 --- a/val/val_power_domain.c +++ b/val/val_power_domain.c @@ -47,33 +47,28 @@ uint32_t val_power_domain_execute_tests(void) RUN_TEST(power_domain_query_mandatory_command_support()); RUN_TEST(power_domain_invalid_messageid_call()); - if ((val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, - POWER_PROTOCOL_VERSION_1)) || - (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, - POWER_PROTOCOL_VERSION_2))) { - RUN_TEST(power_domain_query_domain_attributes()); - } - if (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, - POWER_PROTOCOL_VERSION_2P1)) { - RUN_TEST(power_domain_query_domain_attributes_scmi_v3()); - } - - if ((val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, - POWER_PROTOCOL_VERSION_3)) || - (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, + POWER_PROTOCOL_VERSION_3) || + (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, POWER_PROTOCOL_VERSION_3P1))) { RUN_TEST(power_domain_query_domain_attributes_scmi_v3_1()); - } + RUN_TEST(power_query_ext_domain_name()); + RUN_TEST(power_query_ext_domain_name_invalid_domain()); + } else if (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, + POWER_PROTOCOL_VERSION_2P1)) { + RUN_TEST(power_domain_query_domain_attributes_scmi_v3()); + } else { + RUN_TEST(power_domain_query_domain_attributes()); + } RUN_TEST(power_domain_query_domain_attributes_invalid_doamin()); - RUN_TEST(power_domain_set_power_state_check()); - RUN_TEST(power_domain_set_power_state_unsupported_domain_check()); + RUN_TEST(power_domain_set_power_state_check(version)); + RUN_TEST(power_domain_set_power_state_unsupported_domain_check(version)); RUN_TEST(power_domain_set_power_state_check_invalid_domain()); RUN_TEST(power_domain_get_power_state_check()); RUN_TEST(power_domain_get_power_state_check_invalid_domain()); - RUN_TEST(power_domain_power_state_notify_check()); - RUN_TEST(power_domain_power_state_notify_unspported_domain_check()); + RUN_TEST(power_domain_power_state_notify_check(version)); + RUN_TEST(power_domain_power_state_notify_unspported_domain_check(version)); RUN_TEST(power_domain_power_state_notify_invalid_domain_check()); if ((val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, @@ -88,14 +83,6 @@ uint32_t val_power_domain_execute_tests(void) RUN_TEST(power_domain_power_state_change_requested_notify_invalid_domain_check()); } - if ((val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, - POWER_PROTOCOL_VERSION_3)) || - (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, - POWER_PROTOCOL_VERSION_3P1))) { - RUN_TEST(power_query_ext_domain_name()); - RUN_TEST(power_query_ext_domain_name_invalid_domain()); - } - if (val_protocol_version_relaxed(PROTOCOL_POWER_DOMAIN, version, POWER_PROTOCOL_VERSION_3P1)) { RUN_TEST(power_domain_query_negotiate_protocol_version(&version)); diff --git a/val/val_powercap.c b/val/val_powercap.c index 2530111a5f22f62a56b26d12004165603ca5ec6d..72ec864682b40454587663760b56e912454306e5 100644 --- a/val/val_powercap.c +++ b/val/val_powercap.c @@ -54,7 +54,7 @@ uint32_t val_powercap_execute_tests(void) RUN_TEST(powercap_query_invalid_domain_id()); RUN_TEST(powercap_set_power_cap_value()); RUN_TEST(powercap_invalid_domain_set_power_cap_value()); - RUN_TEST(powercap_invalid_data_set_power_cap_value()); + RUN_TEST(powercap_invalid_data_set_power_cap_value(version)); RUN_TEST(powercap_query_get_pai_value()); RUN_TEST(powercap_query_pai_invalid_domain_id()); RUN_TEST(powercap_set_pai_value());