diff --git a/test_pool/base/test_b008.c b/test_pool/base/test_b008.c index fce56935d91fd4bd8282250d28f4cc8d8255cd21..28c7e6edd89752eee8a6f91046706701256953b1 100644 --- a/test_pool/base/test_b008.c +++ b/test_pool/base/test_b008.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-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"); @@ -72,8 +72,14 @@ uint32_t base_query_protocol_list(void) protocols = &return_values[PROTOCOL_LIST_OFFSET]; for (i = 0; i < num_protocols_returned; i++) { prot = (uint8_t)(protocols[i/4] >> ((i % 4) * 8)); - /* Add to protocol list */ - protocol_list |= (1 << prot); + if ((prot >= PROTOCOL_BASE) && (prot < PROTOCOL_MAX)) + /* Add to protocol list */ + protocol_list |= (1 << prot); + else if (prot >= 0x80) + val_print(VAL_PRINT_ERR, + "\n Platform-Specific Protocol received Skipping : 0x%08x ", prot); + else + val_print(VAL_PRINT_ERR, "\n Reserved Protocol received : 0x%08x ", prot); skip++; } } while (skip < total_num_protocols); diff --git a/test_pool/clock/test_c002.c b/test_pool/clock/test_c002.c index a78f52f74cf746857018a3a6636bd5e23d389363..03f7b827761218f142de8ed0e0882cafd3678113 100644 --- a/test_pool/clock/test_c002.c +++ b/test_pool/clock/test_c002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-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"); @@ -64,6 +64,13 @@ uint32_t clock_query_protocol_attributes(void) if (val_compare("MAX PENDING ASYNC CMD", max_async, val_clock_get_expected_max_async_cmd())) return VAL_STATUS_FAIL; + if (num_clocks > MAX_NUM_OF_CLOCKS) { + val_print(VAL_PRINT_WARN, "\n Total clocks exceed max num of supported clocks"); + val_print(VAL_PRINT_WARN, "\n Clock count is changed to max supported limit %d", + MAX_NUM_OF_CLOCKS); + num_clocks = MAX_NUM_OF_CLOCKS; + } + /* Save the number of clocks */ val_clock_save_info(NUM_CLOCKS, 0, num_clocks); diff --git a/test_pool/performance/test_d002.c b/test_pool/performance/test_d002.c index 9fd589043201eb3e9f523953ca115b1a62763d06..8b0980e207e409467803b42017e22f0e3fae7cce 100644 --- a/test_pool/performance/test_d002.c +++ b/test_pool/performance/test_d002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-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"); @@ -65,7 +65,15 @@ uint32_t performance_query_protocol_attributes(void) if (val_compare("NUM PERF DOMAINS", num_perf_domains, val_performance_get_expected_num_domains())) return VAL_STATUS_FAIL; - val_performance_save_info(NUM_PERF_DOMAINS, 0x00, VAL_EXTRACT_BITS(attributes, 0, 15)); + + if (num_perf_domains > MAX_PERFORMANCE_LEVELS) { + val_print(VAL_PRINT_WARN, "\n performance domains exceed max num of supported doamins"); + val_print(VAL_PRINT_WARN, "\n Domain count is changed to max supported limit: %d", + MAX_PERFORMANCE_LEVELS); + num_perf_domains = MAX_PERFORMANCE_LEVELS; + } + + val_performance_save_info(NUM_PERF_DOMAINS, 0x00, num_perf_domains); /* Compare & save the performance statistics memory lower address */ stats_addr_low = return_values[STATS_ADDR_LOW_OFFSET]; diff --git a/test_pool/pin_control/test_pi002.c b/test_pool/pin_control/test_pi002.c index eae382e4ceafb20cabfe5da17368dc3dc6cda1f9..6566e55f076b3dbc282eb80c10ec9170590de937 100644 --- a/test_pool/pin_control/test_pi002.c +++ b/test_pool/pin_control/test_pi002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2023, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -59,10 +59,22 @@ uint32_t pin_control_query_protocol_attributes(void) num_pins = VAL_EXTRACT_BITS(attributes_low, 0, 15); if (val_compare("NUM PINS", num_pins, val_pin_control_get_expected_num_pins())) return VAL_STATUS_FAIL; + if (num_pins > MAX_PIN_IDENTIFIERS) { + val_print(VAL_PRINT_WARN, "\n Num of pins exceed max num of supported pins"); + val_print(VAL_PRINT_WARN, "\n Pins count is changed to max supported limit: %d", + MAX_PIN_IDENTIFIERS); + num_pins = MAX_PIN_IDENTIFIERS; + } num_groups = VAL_EXTRACT_BITS(attributes_low, 16, 31); if (val_compare("NUM GROUPS", num_groups, val_pin_control_get_expected_num_groups())) return VAL_STATUS_FAIL; + if (num_groups > MAX_GROUP_IDENTIFIERS) { + val_print(VAL_PRINT_WARN, "\n Num of groups exceed max num of supported groups"); + val_print(VAL_PRINT_WARN, "\n Groups count is changed to max supported limit: %d", + MAX_GROUP_IDENTIFIERS); + num_groups = MAX_GROUP_IDENTIFIERS; + } attributes_high = return_values[ATTRIBUTES_HIGH_OFFSET]; if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attributes_high, @@ -72,6 +84,12 @@ uint32_t pin_control_query_protocol_attributes(void) num_functions = VAL_EXTRACT_BITS(attributes_high, 0, 15); if (val_compare("NUM FUNCTIONS", num_functions, val_pin_control_get_expected_num_functions())) return VAL_STATUS_FAIL; + if (num_functions > MAX_FUNCTIONS_IDENTIFIERS) { + val_print(VAL_PRINT_WARN, "\n Num of functions exceed max num of supported functions"); + val_print(VAL_PRINT_WARN, "\n Functions count is changed to max supported limit: %d", + MAX_FUNCTIONS_IDENTIFIERS); + num_functions = MAX_FUNCTIONS_IDENTIFIERS; + } /* Save the number of pins */ val_pin_control_save_info(PC_NUM_PINS, 0, num_pins); diff --git a/test_pool/power_domain/test_p002.c b/test_pool/power_domain/test_p002.c index 6fb05b9b489c12413136372fbe686f7bf9cae7ab..5cd6da2c4e51cf8247f25883ba594413936dc832 100644 --- a/test_pool/power_domain/test_p002.c +++ b/test_pool/power_domain/test_p002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-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"); @@ -61,6 +61,14 @@ uint32_t power_domain_query_protocol_attributes(void) num_domains = VAL_EXTRACT_BITS(attributes, 0, 15); if (val_compare("NUM POWER DOMAINS", num_domains, val_power_get_expected_num_domains())) return VAL_STATUS_FAIL; + + if (num_domains > MAX_POWER_DOMAINS) { + val_print(VAL_PRINT_WARN, "\n Power domains exceed max num of supported power domains"); + val_print(VAL_PRINT_WARN, "\n Domain count is changed to max supported limit: %d", + MAX_POWER_DOMAINS); + num_domains = MAX_POWER_DOMAINS; + } + val_power_domain_save_info(NUM_POWER_DOMAIN, 0x00, num_domains); /* Save the power domain shared memory low address */ diff --git a/test_pool/powercap/test_pc002.c b/test_pool/powercap/test_pc002.c index 8c6f6372f3ed48dfb4716a21a1983447b7ce42c4..1b19008cd1195c59ae566c2d10b1578270da3edf 100644 --- a/test_pool/powercap/test_pc002.c +++ b/test_pool/powercap/test_pc002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2021, 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"); @@ -68,6 +68,14 @@ uint32_t powercap_query_protocol_attributes(void) if (val_compare("NUM DOMAINS", num_domains, val_powercap_get_expected_num_domains())) return VAL_STATUS_FAIL; + if (num_domains > MAX_NUM_OF_POWERCAP_DOMAINS) { + val_print(VAL_PRINT_WARN, + "\n Powercap domains exceed max num of supported powercap domains"); + val_print(VAL_PRINT_WARN, "\n Domain count is changed to max supported limit: %d", + MAX_NUM_OF_POWERCAP_DOMAINS); + num_domains = MAX_NUM_OF_POWERCAP_DOMAINS; + } + val_powercap_save_info(NUM_POWERCAP_DOMAINS, 0x0, num_domains); return VAL_STATUS_PASS; diff --git a/test_pool/reset/test_r002.c b/test_pool/reset/test_r002.c index 7a1546dc2aaf29f275463a467a598ee33b755783..c5a1a994080fac87e98ea99b9742fddf2b285d9b 100644 --- a/test_pool/reset/test_r002.c +++ b/test_pool/reset/test_r002.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"); @@ -66,6 +66,13 @@ uint32_t reset_query_protocol_attributes(void) if (val_compare("NUM DOMAINS", num_domains, val_reset_get_expected_num_domains())) return VAL_STATUS_FAIL; + if (num_domains > MAX_NUM_OF_DOMAINS) { + val_print(VAL_PRINT_WARN, "\n Reset domains exceed max num of supported reset domains"); + val_print(VAL_PRINT_WARN, "\n Domain count is changed to max supported limit: %d", + MAX_NUM_OF_DOMAINS); + num_domains = MAX_NUM_OF_DOMAINS; + } + val_reset_save_info(NUM_RESET_DOMAINS, 0x0, num_domains); return VAL_STATUS_PASS; diff --git a/test_pool/sensor/test_m002.c b/test_pool/sensor/test_m002.c index 785818670db7ca711a118bd014a07c82846438bb..13c78f15d6136653a98b174b80b23ee917dd4ab0 100644 --- a/test_pool/sensor/test_m002.c +++ b/test_pool/sensor/test_m002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-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"); @@ -61,6 +61,14 @@ uint32_t sensor_query_protocol_attributes(void) num_sensors = VAL_EXTRACT_BITS(attributes, 0, 15); if (val_compare("NUM SENSORS", num_sensors, val_sensor_get_expected_num_sensors())) return VAL_STATUS_FAIL; + + if (num_sensors > MAX_NUM_OF_SENSORS) { + val_print(VAL_PRINT_WARN, "\n Total sensors exceed max num of supported sensors"); + val_print(VAL_PRINT_WARN, "\n Sensors count is changed to max supported limit %d", + MAX_NUM_OF_SENSORS); + num_sensors = MAX_NUM_OF_SENSORS; + } + val_sensor_save_info(NUM_SENSORS, num_sensors); /* Save the sensor shared memory low address */ diff --git a/test_pool/voltage/test_v002.c b/test_pool/voltage/test_v002.c index 8078c8b639dfa2578e3a9f4cd8a28a85b7718248..970d05c9968ac02a11310ccf81d66e6f13e2fc49 100644 --- a/test_pool/voltage/test_v002.c +++ b/test_pool/voltage/test_v002.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2021, 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"); @@ -68,6 +68,14 @@ uint32_t voltage_query_protocol_attributes(void) if (val_compare("NUM DOMAINS", num_domains, val_voltage_get_expected_num_domains())) return VAL_STATUS_FAIL; + if (num_domains > MAX_NUM_OF_VOLTAGE_DOMAINS) { + val_print(VAL_PRINT_WARN, + "\n Voltage domains exceed max num of supported voltage domains"); + val_print(VAL_PRINT_WARN, "\n Domain count is changed to max supported limit: %d", + MAX_NUM_OF_VOLTAGE_DOMAINS); + num_domains = MAX_NUM_OF_VOLTAGE_DOMAINS; + } + val_voltage_save_info(NUM_VOLTAGE_DOMAINS, 0x0, num_domains); return VAL_STATUS_PASS; diff --git a/test_pool/voltage/test_v007.c b/test_pool/voltage/test_v007.c index e787a199b984c4ca53f1d00fe4d33adf129cd9ca..ab6bdadf0f02fef83c35880e83e1084f2377c2b7 100644 --- a/test_pool/voltage/test_v007.c +++ b/test_pool/voltage/test_v007.c @@ -36,6 +36,7 @@ uint32_t voltage_query_describe_levels(void) uint32_t levels_flag, levels_return_format; uint32_t num_remaining_levels, num_levels_retured, level_index, voltage_index; uint32_t *voltage_array, start_voltage, end_voltage, step_size, voltage; + uint32_t num_levels_supported; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) return VAL_STATUS_SKIP; @@ -94,6 +95,7 @@ uint32_t voltage_query_describe_levels(void) num_levels_retured = VAL_EXTRACT_BITS(levels_flag, 0, 11); val_print(VAL_PRINT_DEBUG, "\n LEVELS RETURN : %d", num_levels_retured); + num_levels_supported = num_levels_retured; /* Level array/triplet starts from return_values[1]*/ voltage_array = &return_values[LEVEL_ARRAY_OFFSET]; @@ -122,7 +124,17 @@ uint32_t voltage_query_describe_levels(void) /* Save voltage level arrays */ else { - for (i = 0; i < num_levels_retured; i++) + if ((num_levels_retured + level_index) > MAX_NUMBER_VOLTAGE_LEVELS) { + val_print(VAL_PRINT_WARN, + "\n Voltage levels exceed max num of supported voltage levels"); + val_print(VAL_PRINT_WARN, + "\n Levels count is changed to max supported limit %d", + MAX_NUMBER_VOLTAGE_LEVELS); + num_levels_supported = MAX_NUMBER_VOLTAGE_LEVELS - level_index; + num_remaining_levels = 0; + } + + for (i = 0; i < num_levels_supported; i++) { val_print(VAL_PRINT_DEBUG, "\n Voltage Index : %d", voltage_index);