From efdd0425d83b53433ac723abc32586970dd4287a Mon Sep 17 00:00:00 2001 From: Nitin Sharma Date: Mon, 20 Dec 2021 15:32:14 +0000 Subject: [PATCH 1/3] Added SCMI v3 Tests. Signed-off-by: Nitin Sharma --- baremetal_app/app.c | 9 +- docs/scmi_testlist.md | 23 ++ linux_app/app.c | 7 +- mocker_app/app.c | 7 +- platform/baremetal/include/pal_platform.h | 2 +- .../baremetal/include/pal_voltage_expected.h | 53 +++++ platform/baremetal/pal_base.c | 2 +- platform/baremetal/pal_platform.c | 10 +- platform/baremetal/pal_voltage.c | 68 ++++++ platform/linux/sgm776/include/pal_platform.h | 3 +- .../sgm776/include/pal_voltage_expected.h | 30 +++ platform/linux/sgm776/pal_voltage.c | 43 ++++ .../linux/tc/include/pal_voltage_expected.h | 30 +++ platform/linux/tc/pal_voltage.c | 43 ++++ platform/mocker/include/pal_base_expected.h | 3 +- platform/mocker/include/pal_platform.h | 7 + platform/mocker/include/pal_sensor_expected.h | 73 +++++- .../mocker/include/pal_voltage_expected.h | 27 +++ .../mocker/mocker/include/sensor_common.h | 198 ++++++++++++++-- .../mocker/mocker/include/sensor_protocol.h | 21 +- .../mocker/mocker/include/voltage_common.h | 30 +++ .../mocker/mocker/include/voltage_protocol.h | 62 +++++ platform/mocker/mocker/transport_sensor.c | 187 ++++++++++++++- platform/mocker/mocker/transport_voltage.c | 48 ++++ platform/mocker/pal_platform.c | 7 +- platform/mocker/pal_sensor.c | 45 ++++ platform/mocker/pal_voltage.c | 39 ++++ test_pool/clock/test_c007.c | 17 +- test_pool/performance/test_d028.c | 2 +- test_pool/power_domain/test_p005_v3.c | 83 +++++++ test_pool/reset/test_r005_v3.c | 104 +++++++++ test_pool/sensor/test_m005_v3.c | 215 ++++++++++++++++++ test_pool/sensor/test_m016.c | 168 ++++++++++++++ test_pool/sensor/test_m017.c | 58 +++++ test_pool/sensor/test_m018.c | 188 +++++++++++++++ test_pool/sensor/test_m019.c | 59 +++++ test_pool/sensor/test_m020.c | 90 ++++++++ test_pool/sensor/test_m021.c | 57 +++++ test_pool/sensor/test_m022.c | 152 +++++++++++++ test_pool/sensor/test_m023.c | 59 +++++ test_pool/sensor/test_m024.c | 112 +++++++++ test_pool/sensor/test_m025.c | 64 ++++++ test_pool/voltage/Makefile | 18 ++ test_pool/voltage/test_v001.c | 63 +++++ test_pool/voltage/test_v002.c | 74 ++++++ test_pool/voltage/test_v003.c | 82 +++++++ test_pool/voltage/test_v004.c | 75 ++++++ test_pool/voltage/test_v005.c | 77 +++++++ test_pool/voltage/test_v006.c | 56 +++++ test_pool/voltage/test_v007.c | 163 +++++++++++++ test_pool/voltage/test_v008.c | 58 +++++ test_pool/voltage/test_v009.c | 79 +++++++ test_pool/voltage/test_v010.c | 81 +++++++ test_pool/voltage/test_v011.c | 105 +++++++++ test_pool/voltage/test_v012.c | 171 ++++++++++++++ test_pool/voltage/test_v013.c | 72 ++++++ test_pool/voltage/test_v014.c | 130 +++++++++++ test_pool/voltage/test_v015.c | 92 ++++++++ val/include/pal_interface.h | 7 +- val/include/val_clock.h | 2 +- val/include/val_interface.h | 70 +++++- val/include/val_power_domain.h | 7 +- val/include/val_reset.h | 5 +- val/include/val_sensor.h | 43 +++- val/include/val_voltage.h | 77 +++++++ val/val_base.c | 8 +- val/val_clock.c | 2 +- val/val_performance.c | 10 +- val/val_power_domain.c | 7 +- val/val_reset.c | 6 +- val/val_sensor.c | 127 ++++++++++- val/val_voltage.c | 197 ++++++++++++++++ 72 files changed, 4396 insertions(+), 73 deletions(-) create mode 100755 platform/baremetal/include/pal_voltage_expected.h create mode 100755 platform/baremetal/pal_voltage.c create mode 100755 platform/linux/sgm776/include/pal_voltage_expected.h create mode 100755 platform/linux/sgm776/pal_voltage.c create mode 100755 platform/linux/tc/include/pal_voltage_expected.h create mode 100755 platform/linux/tc/pal_voltage.c create mode 100755 platform/mocker/include/pal_voltage_expected.h create mode 100755 platform/mocker/mocker/include/voltage_common.h create mode 100755 platform/mocker/mocker/include/voltage_protocol.h create mode 100755 platform/mocker/mocker/transport_voltage.c create mode 100755 platform/mocker/pal_voltage.c create mode 100755 test_pool/power_domain/test_p005_v3.c create mode 100755 test_pool/reset/test_r005_v3.c create mode 100755 test_pool/sensor/test_m005_v3.c create mode 100755 test_pool/sensor/test_m016.c create mode 100755 test_pool/sensor/test_m017.c create mode 100755 test_pool/sensor/test_m018.c create mode 100755 test_pool/sensor/test_m019.c create mode 100755 test_pool/sensor/test_m020.c create mode 100755 test_pool/sensor/test_m021.c create mode 100755 test_pool/sensor/test_m022.c create mode 100755 test_pool/sensor/test_m023.c create mode 100755 test_pool/sensor/test_m024.c create mode 100755 test_pool/sensor/test_m025.c create mode 100755 test_pool/voltage/Makefile create mode 100755 test_pool/voltage/test_v001.c create mode 100755 test_pool/voltage/test_v002.c create mode 100755 test_pool/voltage/test_v003.c create mode 100755 test_pool/voltage/test_v004.c create mode 100755 test_pool/voltage/test_v005.c create mode 100755 test_pool/voltage/test_v006.c create mode 100755 test_pool/voltage/test_v007.c create mode 100755 test_pool/voltage/test_v008.c create mode 100755 test_pool/voltage/test_v009.c create mode 100755 test_pool/voltage/test_v010.c create mode 100755 test_pool/voltage/test_v011.c create mode 100755 test_pool/voltage/test_v012.c create mode 100755 test_pool/voltage/test_v013.c create mode 100755 test_pool/voltage/test_v014.c create mode 100755 test_pool/voltage/test_v015.c create mode 100755 val/include/val_voltage.h create mode 100755 val/val_voltage.c diff --git a/baremetal_app/app.c b/baremetal_app/app.c index 6bd1fb6..e80e9ee 100644 --- a/baremetal_app/app.c +++ b/baremetal_app/app.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -53,7 +53,7 @@ void arm_scmi_agent_execute(void *agent_info) #ifdef PERFORMANCE_PROTOCOL val_print(VAL_PRINT_ERR, "\n\n *** Starting PERFORMANCE tests *** "); - val_performance_execute_tests(); + //val_performance_execute_tests(); NO COMMIT #endif #ifdef CLOCK_PROTOCOL @@ -71,6 +71,11 @@ void arm_scmi_agent_execute(void *agent_info) val_reset_execute_tests(); #endif +#ifdef VOLTAGE_PROTOCOL + val_print(VAL_PRINT_ERR, "\n\n *** Starting VOLTAGE tests *** "); + val_voltage_execute_tests(); +#endif + num_pass = val_get_test_passed(); num_fail = val_get_test_failed(); num_skip = val_get_test_skipped(); diff --git a/docs/scmi_testlist.md b/docs/scmi_testlist.md index 8e3f19b..bf91da2 100644 --- a/docs/scmi_testlist.md +++ b/docs/scmi_testlist.md @@ -11,6 +11,7 @@ Table of Contents: - [Clock Management Protocol Tests](#clock-management-protocol-tests) - [Sensor Management Protocol Tests](#sensor-management-protocol-tests) - [Reset Management Protocol Tests](#reset-management-protocol-tests) +- [Voltage Management Protocol Tests](#voltage-management-protocol-tests) Introduction ------- @@ -205,6 +206,28 @@ This section outlines the test specification for SCMI Reset Management Protocol. | test_r010 | Pre-Condition: RESET\_PROTOCOL\_NOTIFY support.
Query reset protocol notify with invalid domain id. | Check NOT\_FOUND status is returned. | RESET\_PROTOCOL\_NOTIFY | | test_r011 | Pre-Condition: RESET\_PROTOCOL\_NOTIFY support.
Query reset protocol notify with invalid notify enable. | Check INVALID\_PARAMETERS status is returned. | RESET\_PROTOCOL\_NOTIFY | +Voltage Management Protocol Tests +--------- +This section outlines the test specification for SCMI Voltage Management Protocol. + +| Test ID | Test Intent | Verification Step | Comments/Commands Used | +| ---------- | --------------------- | ------------------ | ----------------------- | +| test\_v001 | Query the protocol version information. | Check Version against expected value. | PROTOCOL\_VERSION | +| test\_v002 | Query the protocol attributes. | Check num of voltage domains against expected value. | PROTOCOL\_ATTRIBUTES | +| test\_v003 | Query for mandatory command availability. | Check command implementation status. | PROTOCOL\_MESSAGE\_ATTRIBUTES | +| test\_v004 | 1. Send invalid command id for voltage protocol.
2. Query the protocol message attributes with invalid msg\_id. | Check NOT\_FOUND status is returned. | PROTOCOL\_MESSAGE\_ATTRIBUTES | +| test\_v005 | Query Voltage domain attributes. | Check attributes values against expected values. | VOLTAGE\_DOMAIN\_ATTRIBUTES +| test\_v006 | Query voltage domain attributes with invalid domain id. | Check NOT\_FOUND status is returned. | VOLTAGE\_DOMAIN\_ATTRIBUTES +| test\_v007 | 1. Query Voltage describe level for valid domains and valid index.
2.Query Voltage describe level for valid domains but invalid index | 1. Check SUCCESS status is returned.
2. Check OUT\_OF\_RANGE status is returned. | VOLTAGE\_DESCRIBE\_LEVELS +| test\_v008 | Query Voltage describe levels for non valid voltage domain IDs. | Check NOT\_FOUND status is returned. | VOLTAGE\_DESCRIBE\_LEVELS +| test\_v009 | 1. Set Architectural Operating mode of voltage domains
2. Set IMPLEMENTATION defined Operating mode of voltage domains | 1. Check SUCCESS status is returned
2. Check SUCCESS status is returned | VOLTAGE\_CONFIG\_SET +| test\_v010 | Set operating mode for invalid voltage domain | Check NOT\_FOUND status is returned | VOLTAGE\_CONFIG\_SET +| test\_v011 | 1. Get Operating mode for valid voltage domain
2. Get operating mode for invalid voltage domain | 1. Check SUCCESS status returned
2. Check NOT\_FOUND status returned | VOLTAGE\_CONFIG\_GET +| test\_v012 | Set Voltage level of valid voltage domain | Check SUCCESS status is returned | VOLTAGE\_LEVEL\_SET +| test\_v013 | Set Voltage level of an invalid voltage domain | Check NOT\_FOUND status is returned | VOLTAGE\_LEVEL\_SET +| test\_v014 | 1. Set Invalid voltage level to voltage domain
2. Set voltage with invalid flag | 1. Check INVALID\_PARAMETERS status is returned
2. Check INVALID\_PARAMETERS status is returned| VOLTAGE\_LEVEL\_SET +| test\_v015 | 1. Get Voltage level for valid domain
2.Get Voltage level for invalid domain | 1. Check SUCCESS is returned
2.Check NOT\_FOUND is returned | VOLTAGE\_LEVEL\_GET - - - - - - - - - - - - - - - - - - - - _Copyright (c) 2019-2020, Arm Limited and Contributors. All rights reserved._ + diff --git a/linux_app/app.c b/linux_app/app.c index 49d1a40..e23f23f 100644 --- a/linux_app/app.c +++ b/linux_app/app.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -71,6 +71,11 @@ int main(int argc, char *argv[]) val_reset_execute_tests(); #endif +#ifdef VOLTAGE_PROTOCOL + val_print(VAL_PRINT_ERR, "\n\n *** Starting VOLTAGE tests *** "); + val_voltage_execute_tests(); +#endif + num_pass = val_get_test_passed(); num_fail = val_get_test_failed(); num_skip = val_get_test_skipped(); diff --git a/mocker_app/app.c b/mocker_app/app.c index 48a6f9f..e23f23f 100644 --- a/mocker_app/app.c +++ b/mocker_app/app.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -71,6 +71,11 @@ int main(int argc, char *argv[]) val_reset_execute_tests(); #endif +#ifdef VOLTAGE_PROTOCOL + val_print(VAL_PRINT_ERR, "\n\n *** Starting VOLTAGE tests *** "); + val_voltage_execute_tests(); +#endif + num_pass = val_get_test_passed(); num_fail = val_get_test_failed(); num_skip = val_get_test_skipped(); diff --git a/platform/baremetal/include/pal_platform.h b/platform/baremetal/include/pal_platform.h index edc4e0d..540ccc1 100644 --- a/platform/baremetal/include/pal_platform.h +++ b/platform/baremetal/include/pal_platform.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2017-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/baremetal/include/pal_voltage_expected.h b/platform/baremetal/include/pal_voltage_expected.h new file mode 100755 index 0000000..9b6901c --- /dev/null +++ b/platform/baremetal/include/pal_voltage_expected.h @@ -0,0 +1,53 @@ +/** @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_VOLTAGE_EXPECTED_H__ +#define __PAL_VOLTAGE_EXPECTED_H__ + +struct arm_scmi_voltage_expected { + /* + * This enum is to specify the flag_mask and have to be ensured that + * it is in the same order as the below structure elements after + * flags_mask member. + */ + enum { + VOLTAGE_DOMAIN_PROTOCOL_VERSION = 1, + VOLTAGE_NUMBER_DOMAINS, + VOLTAGE_DOMAIN_NAME + } FLAGS; + /* + * The expectation is that there is no more + * than 32 elements specified via this expected results data structure. + * This mask is used to indicate which of the structure members hold valid + * data. + */ + uint32_t flags_mask; + uint32_t protocol_version; + + uint32_t number_domains; + + int32_t voltage_level; + + int32_t invalid_voltage_level; + /* + * This should have the names of the domains in this platform bounded by the + * number of domains descriptors. + */ + char **voltage_domain_name; +}; + +#endif /* __PAL_VOLTAGE_EXPECTED_H__ */ diff --git a/platform/baremetal/pal_base.c b/platform/baremetal/pal_base.c index b278a29..cb731a8 100644 --- a/platform/baremetal/pal_base.c +++ b/platform/baremetal/pal_base.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/baremetal/pal_platform.c b/platform/baremetal/pal_platform.c index b71a221..0b23318 100644 --- a/platform/baremetal/pal_platform.c +++ b/platform/baremetal/pal_platform.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -37,6 +37,9 @@ extern void pal_performance_set_expected(const void *); #ifdef RESET_PROTOCOL extern void pal_reset_set_expected(const void *); #endif +#ifdef VOLTAGE_PROTOCOL +extern void pal_voltage_set_expected(const void *); +#endif /** @brief This API is used to call platform function to send command @@ -137,6 +140,11 @@ uint32_t pal_initialize_system(void *info) case 0x16: pal_reset_set_expected(protocol_info->expected_return_values); break; +#endif +#ifdef VOLTAGE_PROTOCOL + case 0x17: + pal_voltage_set_expected(protocol_info->expected_return_values); + break; #endif } protocol_info++; index++; diff --git a/platform/baremetal/pal_voltage.c b/platform/baremetal/pal_voltage.c new file mode 100755 index 0000000..5861b5d --- /dev/null +++ b/platform/baremetal/pal_voltage.c @@ -0,0 +1,68 @@ +/** @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 VOLTAGE_PROTOCOL + +#include "pal_interface.h" +#include "pal_voltage_expected.h" + +extern void pal_voltage_set_expected(const void *); +static struct arm_scmi_voltage_expected *g_voltage_info; + + +/** + @brief Sets voltage domain protocol info + @param platform voltage domain protocol info + @return none +**/ +void pal_voltage_set_expected(const void *info) +{ + if (info == NULL) + return; + + g_voltage_info = (struct arm_scmi_voltage_expected *)info; +} + +/*----------- Common PAL API's across platforms ----------*/ + +/** + @brief This API is used for checking num of voltage domain + @param none + @return num of voltage domain +**/ +uint32_t pal_voltage_get_expected_num_domains(void) +{ + if (g_voltage_info == NULL) + return 0; + + return g_voltage_info->number_domains; +} + +/** + @brief This API is used for checking voltage domain name + @param domain id + @return voltage domain name +**/ +uint8_t *pal_voltage_get_expected_name(uint32_t domain_id) +{ + if (g_voltage_info == NULL) + return NULL; + + return (uint8_t *)g_voltage_info->voltage_domain_name[domain_id]; +} + +#endif diff --git a/platform/linux/sgm776/include/pal_platform.h b/platform/linux/sgm776/include/pal_platform.h index 7212d09..9ecaf25 100644 --- a/platform/linux/sgm776/include/pal_platform.h +++ b/platform/linux/sgm776/include/pal_platform.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -34,6 +34,7 @@ #define CLOCK_PROTOCOL_ID 0x14 #define SENSOR_PROTOCOL_ID 0x15 #define RESET_PROTOCOL_ID 0x16 +#define VOLTAGE_PROTOCOL_ID 0x17 #define APCORE_PROTOCOL_ID 0x09 #define TIMEOUT 100 diff --git a/platform/linux/sgm776/include/pal_voltage_expected.h b/platform/linux/sgm776/include/pal_voltage_expected.h new file mode 100755 index 0000000..8114048 --- /dev/null +++ b/platform/linux/sgm776/include/pal_voltage_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_VOLTAGE_EXPECTED_H__ +#define __PAL_VOLTAGE_EXPECTED_H__ + +#ifdef VOLTAGE_PROTOCOL + +uint32_t num_voltage_domains = 0x01; + +static char *voltage_domain_names[] = { + "USB", +}; +#endif + +#endif /* __PAL_VOLTAGE_EXPECTED_H__ */ diff --git a/platform/linux/sgm776/pal_voltage.c b/platform/linux/sgm776/pal_voltage.c new file mode 100755 index 0000000..4652744 --- /dev/null +++ b/platform/linux/sgm776/pal_voltage.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 VOLTAGE_PROTOCOL + +#include "pal_interface.h" +#include "pal_voltage_expected.h" + +/** + @brief This API is used for checking num of voltage domain + @param none + @return num of voltage domain +**/ +uint32_t pal_voltage_get_expected_num_domains(void) +{ + return num_voltage_domains; +} + +/** + @brief This API is used for checking voltage domain name + @param domain id + @return voltage domain name +**/ +uint8_t *pal_voltage_get_expected_name(uint32_t domain_id) +{ + return (uint8_t *)voltage_domain_names[domain_id]; +} + +#endif diff --git a/platform/linux/tc/include/pal_voltage_expected.h b/platform/linux/tc/include/pal_voltage_expected.h new file mode 100755 index 0000000..8114048 --- /dev/null +++ b/platform/linux/tc/include/pal_voltage_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_VOLTAGE_EXPECTED_H__ +#define __PAL_VOLTAGE_EXPECTED_H__ + +#ifdef VOLTAGE_PROTOCOL + +uint32_t num_voltage_domains = 0x01; + +static char *voltage_domain_names[] = { + "USB", +}; +#endif + +#endif /* __PAL_VOLTAGE_EXPECTED_H__ */ diff --git a/platform/linux/tc/pal_voltage.c b/platform/linux/tc/pal_voltage.c new file mode 100755 index 0000000..4652744 --- /dev/null +++ b/platform/linux/tc/pal_voltage.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 VOLTAGE_PROTOCOL + +#include "pal_interface.h" +#include "pal_voltage_expected.h" + +/** + @brief This API is used for checking num of voltage domain + @param none + @return num of voltage domain +**/ +uint32_t pal_voltage_get_expected_num_domains(void) +{ + return num_voltage_domains; +} + +/** + @brief This API is used for checking voltage domain name + @param domain id + @return voltage domain name +**/ +uint8_t *pal_voltage_get_expected_name(uint32_t domain_id) +{ + return (uint8_t *)voltage_domain_names[domain_id]; +} + +#endif diff --git a/platform/mocker/include/pal_base_expected.h b/platform/mocker/include/pal_base_expected.h index 73be99f..8a39cbe 100644 --- a/platform/mocker/include/pal_base_expected.h +++ b/platform/mocker/include/pal_base_expected.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -27,6 +27,7 @@ static uint8_t supported_protocols[] = { CLOCK_PROTOCOL_ID, SENSOR_PROTOCOL_ID, RESET_PROTOCOL_ID, + VOLTAGE_PROTOCOL_ID, }; /* Expected BASE parameters */ diff --git a/platform/mocker/include/pal_platform.h b/platform/mocker/include/pal_platform.h index 9860bad..3e766c9 100644 --- a/platform/mocker/include/pal_platform.h +++ b/platform/mocker/include/pal_platform.h @@ -29,6 +29,7 @@ #define CLOCK_PROTOCOL_ID 0x14 #define SENSOR_PROTOCOL_ID 0x15 #define RESET_PROTOCOL_ID 0x16 +#define VOLTAGE_PROTOCOL_ID 0x17 enum BITS_HEADER { RESERVED_LOW = 28, @@ -84,11 +85,17 @@ void reset_send_message(uint32_t message_id, uint32_t parameter_count, const uint32_t *parameters, int32_t *status, size_t *return_values_count, uint32_t *return_values); +void voltage_send_message(uint32_t message_id, uint32_t parameter_count, + const uint32_t *parameters, int32_t *status, + size_t *return_values_count, uint32_t *return_values); + + void fill_base_protocol(void); void fill_power_protocol(void); void fill_clock_protocol(void); void fill_sensor_protocol(void); void fill_performance_protocol(void); void fill_reset_protocol(void); +void fill_voltage_protocol(void); #endif /*__PAL_PLATFORM__*/ diff --git a/platform/mocker/include/pal_sensor_expected.h b/platform/mocker/include/pal_sensor_expected.h index 2b5c6e6..f534610 100644 --- a/platform/mocker/include/pal_sensor_expected.h +++ b/platform/mocker/include/pal_sensor_expected.h @@ -19,9 +19,17 @@ #define __PAL_SENSOR_EXPECTED_H__ /* Expected SENSOR parameters */ -#define NUM_OF_SENSORS_SUPPORTED 2 -#define SENOR_ASYNC_READ_SUPPORTED 1 -#define SENOR_ASYNC_READ_NOT_SUPPORTED 0 +#define NUM_OF_SENSORS_SUPPORTED 2 +#define SENOR_ASYNC_READ_SUPPORTED 1 +#define SENOR_ASYNC_READ_NOT_SUPPORTED 0 +#define SENSOR_CONT_NOTI_UPD_SUPPORTED 1 +#define SENSOR_CONT_NOTI_UPD_NOT_SUPPORTED 0 +#define SENSOR_TIMESTAMP_SUPPORTED 1 +#define SENSOR_TIMESTAMP_NOT_SUPPORTED 0 +#define SENSOR_EXT_ATTR_SUPPORTED 1 +#define SENSOR_EXT_ATTR_NOT_SUPPORTED 0 +#define SENSOR_AXIS_SUPPORTED 1 +#define SENSOR_AXIS_NOT_SUPPORTED 0 /* * This should have the Asynchronous sensor read support in this platform * bounded by the number of sensor descriptors. @@ -29,9 +37,66 @@ static uint8_t async_sensor_read_support[] = { SENOR_ASYNC_READ_NOT_SUPPORTED, - SENOR_ASYNC_READ_NOT_SUPPORTED + SENOR_ASYNC_READ_SUPPORTED }; +/* + * This should have the continuous update notifications in this platform + * bounded by the number of sensor descriptors. + */ +static uint8_t continous_sensor_update_notification_support[] = +{ + SENSOR_CONT_NOTI_UPD_NOT_SUPPORTED, + SENSOR_CONT_NOTI_UPD_SUPPORTED +}; + +static uint8_t sensor_timestamp_support[] = +{ + SENSOR_TIMESTAMP_SUPPORTED, + SENSOR_TIMESTAMP_NOT_SUPPORTED +}; + +static uint8_t sensor_extended_attributes_support[] = +{ + SENSOR_EXT_ATTR_SUPPORTED, + SENSOR_EXT_ATTR_SUPPORTED +}; + +static uint8_t sensor_axis_supported[] = +{ + SENSOR_AXIS_SUPPORTED, + SENSOR_AXIS_NOT_SUPPORTED +}; + +static uint8_t number_of_axis_supported[] = +{ + 2, + 1 +}; + +static uint8_t sensor_powers[] = +{ + 5, + 6 +}; + +static uint8_t sensor_resolutions[] = +{ + 7, + 8 +}; + +static uint8_t sensor_update_interval_count[] = +{ + 1, + 2 +}; + +static uint8_t sensor_update_intervals[] = +{ + 100, + 200 +}; /* * This should have the Number of trip points supported in this platform * bounded by the number of sensor descriptors. diff --git a/platform/mocker/include/pal_voltage_expected.h b/platform/mocker/include/pal_voltage_expected.h new file mode 100755 index 0000000..63cc1a7 --- /dev/null +++ b/platform/mocker/include/pal_voltage_expected.h @@ -0,0 +1,27 @@ +/** @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_VOLTAGE_EXPECTED_H__ +#define __PAL_VOLTAGE_EXPECTED_H__ + +static uint32_t num_voltage_domains = 0x01; + +static char *voltage_domain_names[] = { + "USB", +}; + +#endif /* __PAL_VOLTAGE_EXPECTED_H__ */ diff --git a/platform/mocker/mocker/include/sensor_common.h b/platform/mocker/mocker/include/sensor_common.h index 4a2f0f5..13cd7d5 100644 --- a/platform/mocker/mocker/include/sensor_common.h +++ b/platform/mocker/mocker/include/sensor_common.h @@ -71,35 +71,141 @@ struct arm_scmi_sensor_description_get { SNR_NUMBER_REMAIN_SNR_DESC_HIGH = 31 }num_sensor_flags_bits; }; + /*sensor descriptor struct and enums*/ struct arm_scmi_sensor_descriptor { uint32_t sensor_id; uint32_t sensor_attributes_low; uint32_t sensor_attributes_high; uint8_t sensor_name[SCMI_NAME_STR_SIZE]; + uint32_t sensor_power; + uint32_t sensor_resolution; + uint32_t sensor_min_range_low; + uint32_t sensor_min_range_high; + uint32_t sensor_max_range_low; + uint32_t sensor_max_range_high; enum { SNR_DESC_ATTRLOW_NUM_TRIPPOINT_SPRT_LOW = 0, SNR_DESC_ATTRLOW_NUM_TRIPPOINT_SPRT_HIGH = 7, - SNR_DESC_ATTRLOW_RESV_LOW = 8, - SNR_DESC_ATTRLOW_RESV_HIGH = 30, + SNR_DESC_ATTRLOW_EXT_ATTR_SUPPORT = 8, + SNR_DESC_ATTRLOW_TIMESTAMP_SUPPORT = 9, + SNR_DESC_ATTRLOW_TIMESTAMP_EXP_LOW = 10, + SNR_DESC_ATTRLOW_TIMESTAMP_EXP_HIGH = 14, + SNR_DESC_ATTRLOW_RESV_LOW = 15, + SNR_DESC_ATTRLOW_RESV_HIGH = 29, + SNR_DESC_ATTRLOW_CNT_SNR_UPDATE_NOT = 30, SNR_DESC_ATTRLOW_ASYNC_READ_SUPPORT = 31 } sensor_attributes_low_bits; enum { - SNR_DESC_ATTRHIGH_SNR_TYPE_LOW = 0, - SNR_DESC_ATTRHIGH_SNR_TYPE_HIGH = 7, - SNR_DESC_ATTRHIGH_RESV_LOWER_LOW = 8, - SNR_DESC_ATTRHIGH_RESV_LOWER_HIGH = 10, - SNR_DESC_ATTRHIGH_MULTIPLIER_LOW = 11, - SNR_DESC_ATTRHIGH_MULTIPLIER_HIGH = 15, - SNR_DESC_ATTRHIGH_RESV_UPPER_LOW = 16, - SNR_DESC_ATTRHIGH_RESV_UPPER_HIGH = 21, - SNR_DESC_ATTRHIGH_UPDATE_INTERVAL_MULT_LOW = 22, - SNR_DESC_ATTRHIGH_UPDATE_INTERVAL_MULT_HIGH = 26, - SNR_DESC_ATTRHIGH_UPDATE_INTERVAL_SEC_LOW = 27, - SNR_DESC_ATTRHIGH_UPDATE_INTERVAL_SEC_HIGH = 31 + SNR_DESC_ATTRHIGH_SENSOR_TYPE_LOW = 0, + SNR_DESC_ATTRHIGH_SENSOR_TYPE_HIGH = 7, + SNR_DESC_ATTRHIGH_AXIS_SUPPORT = 8, + SNR_DESC_ATTRHIGH_RESV_UPPER_LOW = 9, + SNR_DESC_ATTRHIGH_RESV_UPPER_HIGH = 10, + SNR_DESC_ATTRHIGH_EXPONENT_LOW = 11, + SNR_DESC_ATTRHIGH_EXPONENT_HIGH = 15, + SNR_DESC_ATTRHIGH_NUM_AXES_LOW = 16, + SNR_DESC_ATTRHIGH_NUM_AXES_HIGH = 21, + SNR_DESC_ATTRHIGH_RESV_LOW = 22, + SNR_DESC_ATTRHIGH_RESV_HIGH = 31 } sensor_attributes_high_bits; + + enum { + SNR_RESOLUTION_SENSOR_RESOL_LOW = 0, + SNR_RESOLUTION_SENSOR_RESOL_HIGH = 26, + SNR_RESOLUTION_EXPONENT_LOW = 27, + SNR_RESOLUTION_EXPONENT_HIGH = 31 + } sensor_resolution_bits; +}; + +struct arm_scmi_sensor_axis_description_get { + struct { + uint32_t sensor_id; + uint32_t axis_desc_index; + } parameters; + struct { + uint32_t num_axis_flags; + uint32_t sensor_axis_descriptors; + }returns; + /*enum for num_axis_flags*/ + enum { + AXIS_NUM_FLAGS_AXIS_DESC_RET_LOW = 0, + AXIS_NUM_FLAGS_AXIS_DESC_RET_HIGH = 5, + AXIS_NUM_FLAGS_RESV_LOW = 6, + AXIS_NUM_FLAGS_RESV_HIGH = 25, + AXIS_NUM_FLAGS_REMAIN_AXIS_DESC_LOW = 26, + AXIS_NUM_FLAGS_REMAIN_AXIS_DESC_HIGH = 31 + }num_axis_flags_bits; +}; +/* sensor axis description struct and enums */ +struct arm_scmi_sensor_axis_descriptor { + uint32_t axis_id; + uint32_t axis_attributes_low; + uint32_t axis_attributes_high; + uint8_t name[SCMI_NAME_STR_SIZE]; + uint32_t axis_resolution; + uint32_t axis_min_range_low; + uint32_t axis_min_range_high; + uint32_t axis_max_range_low; + uint32_t axis_max_range_high; + + enum { + AXIS_ATTR_LOW_RESV_LOW = 0, + AXIS_ATTR_LOW_RESV_HIGH = 7, + AXIS_ATTR_LOW_EXT_ATTR_SUPPORT = 8, + AXIS_ATTR_LOW_RESV_UPPER_LOW = 9, + AXIS_ATTR_LOW_RESV_UPPER_HIGH = 31 + } axis_attributes_low_bits; + + enum { + AXIS_ATTR_HIGH_SENSOR_TYPE_LOW = 0, + AXIS_ATTR_HIGH_SENSOR_TYPE_HIGH = 7, + AXIS_ATTR_HIGH_RESV_LOW = 8, + AXIS_ATTR_HIGH_RESV_HIGH = 10, + AXIS_ATTR_HIGH_EXP_LOW = 11, + AXIS_ATTR_HIGH_EXP_HIGH = 15, + AXIS_ATTR_HIGH_RESV_UPPER_LOW = 16, + AXIS_ATTR_HIGH_RESV_UPPER_HIGH = 31 + } axis_attributes_high_bits; + + enum { + AXIS_RESOLUTION_LOW = 0, + AXIS_RESOLUTION_HIGH = 26, + AXIS_RESOLUTION_EXP_LOW = 27, + AXIS_RESOLUTION_EXP_HIGH = 31 + } axis_resolution_bits; +}; + +struct arm_scmi_sensor_list_update_intervals { + struct { + uint32_t sensor_id; + uint32_t update_int_index; + } parameters; + struct { + uint32_t update_intervals_flags; + uint32_t intervals; + } returns; + + enum { + UPDT_INT_NUM_RET_INTERVALS_LOW = 0, + UPDT_INT_NUM_RET_INTERVALS_HIGH = 11, + UPDT_INT_RET_FORMAT = 12, + UPDT_INT_RESV_LOW = 13, + UPDT_INT_RESV_HIGH = 15, + UPDT_INT_REMAIN_INTERVALS_LOW = 16, + UPDT_INT_REMAIN_INTERVALS_HIGH = 31 + } update_intervals_flags_bits; + + enum { + INTERVAL_EXP_LOW = 0, + INTERVAL_EXP_HIGH = 4, + INTERVAL_SECS_LOW = 5, + INTERVAL_SECS_HIGH = 20, + INTERVAL_RESV_LOW = 21, + INTERVAL_RESV_HIGH = 31 + } intervals_bits; }; struct arm_scmi_sensor_trip_point_notify { @@ -122,6 +228,7 @@ struct arm_scmi_sensor_trip_point_config { uint32_t trip_point_val_low; uint32_t trip_point_val_high; } parameters; + enum { SNR_TRIP_POINT_EV_CTRL_BITS_LOW = 0, SNR_TRIP_POINT_EV_CTRL_BITS_HIGH = 1, @@ -134,14 +241,51 @@ struct arm_scmi_sensor_trip_point_config { }trip_point_ev_ctrl_bits; }; +struct arm_scmi_config_get { + struct { + uint32_t sensor_id; + } parameters; + struct { + uint32_t sensor_config; + } returns; + + enum { + SNR_CFG_SENSOR_STATE = 0, + SNR_CFG_TIMESTAMP_REPORTING = 1, + SNR_CFGT_RESV_LOW = 2, + SNR_CFG_RESV_HIGH = 10, + SNR_CFG_UPDATE_INT_EXP_LOW = 11, + SNR_CFG_UPDATE_INT_EXP_HIGH = 15, + SNR_CFG_UPDATE_INT_SEC_LOW = 16, + SNR_CFG_UPDATE_INT_SEC_HIGH = 31 + } sensor_config_get_bits; +}; + +struct arm_scmi_config_set { + struct { + uint32_t sensor_id; + uint32_t sensor_config; + } parameters; + + enum { + SNR_CFG_SET_SENSOR_STATE = 0, + SNR_CFG_SET_TIMESTAMP_REPORTING = 1, + SNR_CFG_SET_RESV_LOW = 2, + SNR_CFG_SET_RESV_HIGH = 8, + SNR_CFG_SET_ROUND_LOW = 9, + SNR_CFG_SET_ROUND_HIGH = 10, + SNR_CFG_SET_UPD_INT_LOW = 16, + SNR_CFG_SET_UPD_INT_HIGH = 31 + } sensor_config_set_bits; +}; + struct arm_scmi_sensor_reading_get { struct { uint32_t sensor_id; - uint32_t flags; + uint32_t sensor_reading_flags; } parameters; struct { - uint32_t sensor_value_low; - uint32_t sensor_value_high; + uint32_t sensor_readings; } returns; enum { SNR_READING_FLAG_SYNC_ASYNC = 0, @@ -150,4 +294,24 @@ struct arm_scmi_sensor_reading_get { }sensor_reading_flags_bits; }; +struct arm_scmi_sensor_reading { + uint32_t sensor_value_low; + uint32_t sensor_value_high; + uint32_t timestamp_low; + uint32_t timestamp_high; +}; + +struct arm_scmi_cont_update_notify { + struct { + uint32_t sensor_id; + uint32_t notify_enable; + } parameters; + + enum { + SNR_NTF_ENB_NOTIFY_ENABLE = 0, + SNR_NTF_ENB_RESV_LOW = 1, + SNR_NTF_ENB_RESV_HIGH = 31 + } sensor_notify_enable_bits; +}; + #endif /* SENSOR_COMMON_H_ */ diff --git a/platform/mocker/mocker/include/sensor_protocol.h b/platform/mocker/mocker/include/sensor_protocol.h index fcc1ae3..81ca9f5 100644 --- a/platform/mocker/mocker/include/sensor_protocol.h +++ b/platform/mocker/mocker/include/sensor_protocol.h @@ -21,9 +21,10 @@ #include #include -#define SENSOR_VERSION 0x00010000 +#define SENSOR_VERSION 0x00020000 #define SNSR_PROTO_ID 0x15 + #define SNSR_PROTO_VER_MSG_ID 0x0 #define SNSR_PROTO_ATTRIB_MSG_ID 0x1 #define SNSR_PROTO_MSG_ATTRIB_MSG_ID 0x2 @@ -31,6 +32,11 @@ #define SNSR_TRIP_POINT_NOTIFY_ID 0x4 #define SNSR_TRIP_POINT_CONFIG_ID 0x5 #define SNSR_READING_GET_MSG_ID 0x6 +#define SNSR_AXIS_DESC_GET_MSG_ID 0x7 +#define SNSR_LIST_UPDATE_INTERVALS_MSG_ID 0x8 +#define SNSR_CONFIG_GET_MSG_ID 0x9 +#define SNSR_CONFIG_SET_MSG_ID 0xA +#define SNSR_CNT_UPDATE_NOTIFY_MSG_ID 0xB #define MAX_NUMBER_SENSOR 32 #define SENSOR_ASYNC 1 @@ -44,7 +50,7 @@ struct arm_scmi_sensor_protocol { * flags_mask member. */ enum { - SENSOR_PROTOCOL_VERSION = 1, + SENSOR_PROTOCOL_VERSION = 2, NUMBER_SENSORS, MAX_NUM_PENDING_ASYNC_CMDS_SUPPORTED, SENSOR_REG_ADDRESS_LOW, @@ -81,6 +87,17 @@ struct arm_scmi_sensor_protocol { */ uint8_t *asynchronous_sensor_read_support; + /* + * This should have the continuous update notifications in this platform + * bounded by the number of sensor descriptors. + */ + uint8_t *cont_update_notify_support; + + uint8_t *timestamp_support; + uint8_t *extended_attributes_support; + + uint8_t *axis_supported; + /* * This should have the Number of trip points supported in this platform * bounded by the number of sensor descriptors. diff --git a/platform/mocker/mocker/include/voltage_common.h b/platform/mocker/mocker/include/voltage_common.h new file mode 100755 index 0000000..a5d6636 --- /dev/null +++ b/platform/mocker/mocker/include/voltage_common.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 VOLTAGE_COMMON_H_ +#define VOLTAGE_COMMON_H_ + +#include + +/* Structure for voltage protocol version*/ +struct arm_scmi_voltage_protocol_version { + struct { + uint32_t version; + } returns; +}; + +#endif /* VOLTAGE_COMMON_H_ */ diff --git a/platform/mocker/mocker/include/voltage_protocol.h b/platform/mocker/mocker/include/voltage_protocol.h new file mode 100755 index 0000000..862ae21 --- /dev/null +++ b/platform/mocker/mocker/include/voltage_protocol.h @@ -0,0 +1,62 @@ +/** @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 VOLTAGE_PROTOCOL_H_ +#define VOLTAGE_PROTOCOL_H_ + +#include +#include + +#define VOLTAGE_VERSION 0x00010000 + +#define VOLTAGE_PROTO_ID 0x17 +#define VOLTAGE_PROTO_VER_MSG_ID 0x0 + + +struct arm_scmi_voltage_protocol { + /* + * This enum is to specify the flag_mask and have to be ensured that + * it is in the same order as the below structure elements after + * flags_mask member. + */ + enum { + VOLTAGE_DOMAIN_PROTOCOL_VERSION = 1, + VOLTAGE_NUMBER_DOMAINS, + VOLTAGE_DOMAIN_NAME + } FLAGS; + /* + * The expectation is that there is no more + * than 32 elements specified via this expected results data structure. + * This mask is used to indicate which of the structure members hold valid + * data. + */ + uint32_t flags_mask; + uint32_t protocol_version; + + uint32_t number_domains; + + int32_t voltage_level; + + int32_t invalid_voltage_level; + /* + * This should have the names of the domains in this platform bounded by the + * number of domains descriptors. + */ + char **voltage_domain_name; +}; + +#endif /* VOLTAGE_PROTOCOL_H_ */ diff --git a/platform/mocker/mocker/transport_sensor.c b/platform/mocker/mocker/transport_sensor.c index 669e334..dcc3e5a 100644 --- a/platform/mocker/mocker/transport_sensor.c +++ b/platform/mocker/mocker/transport_sensor.c @@ -20,7 +20,8 @@ #include struct arm_scmi_sensor_protocol sensor_protocol; -#define SENSOR_DESC_LEN 7 +#define SENSOR_DESC_LEN 13 +#define SENSOR_AXIS_DESC_LEN 12 void fill_sensor_protocol() { @@ -34,8 +35,14 @@ void fill_sensor_protocol() sensor_protocol.sensor_reg_address_low + sensor_protocol.sensor_reg_length; sensor_protocol.asynchronous_sensor_read_support = async_sensor_read_support; + sensor_protocol.cont_update_notify_support = + continous_sensor_update_notification_support; + sensor_protocol.timestamp_support = sensor_timestamp_support; + sensor_protocol.extended_attributes_support = + sensor_extended_attributes_support; sensor_protocol.number_of_trip_points_supported = number_of_trip_points_supported; + sensor_protocol.axis_supported = sensor_axis_supported; } void sensor_send_message(uint32_t message_id, uint32_t parameter_count, @@ -43,7 +50,7 @@ void sensor_send_message(uint32_t message_id, uint32_t parameter_count, size_t *return_values_count, uint32_t *return_values) { - uint32_t parameter_idx, return_idx; + uint32_t parameter_idx, return_idx, sensor_id, sensor_cfg; char * str; int i; @@ -110,16 +117,49 @@ void sensor_send_message(uint32_t message_id, uint32_t parameter_count, sensor_descriptors) + (SENSOR_DESC_LEN * i) + 1] = (sensor_protocol.asynchronous_sensor_read_support[i] << SNR_DESC_ATTRLOW_ASYNC_READ_SUPPORT) | - (sensor_protocol.number_of_trip_points_supported[i] << - SNR_DESC_ATTRLOW_NUM_TRIPPOINT_SPRT_LOW); + (sensor_protocol.cont_update_notify_support[i] << + SNR_DESC_ATTRLOW_CNT_SNR_UPDATE_NOT) | + (sensor_protocol.timestamp_support[i] << + SNR_DESC_ATTRLOW_TIMESTAMP_SUPPORT) | + (sensor_protocol.extended_attributes_support[i] << + SNR_DESC_ATTRLOW_EXT_ATTR_SUPPORT) | + (sensor_protocol.number_of_trip_points_supported[i] << + SNR_DESC_ATTRLOW_NUM_TRIPPOINT_SPRT_LOW); return_values[OFFSET_RET( struct arm_scmi_sensor_description_get, - sensor_descriptors) + (SENSOR_DESC_LEN * i) + 2] = 0; + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 2] = + (number_of_axis_supported[i] << + SNR_DESC_ATTRHIGH_NUM_AXES_LOW) | + (sensor_protocol.axis_supported[i] << + SNR_DESC_ATTRHIGH_AXIS_SUPPORT); + str = (char *) (&return_values[OFFSET_RET( struct arm_scmi_sensor_description_get, sensor_descriptors) + (SENSOR_DESC_LEN * i) + 3]); sprintf(str, "SENSOR_%d", i); + + return_values[OFFSET_RET( + struct arm_scmi_sensor_description_get, + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 7] = + sensor_powers[i]; + return_values[OFFSET_RET( + struct arm_scmi_sensor_description_get, + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 8] = + sensor_resolutions[i] << + SNR_RESOLUTION_SENSOR_RESOL_LOW; + return_values[OFFSET_RET( + struct arm_scmi_sensor_description_get, + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 9] = 9; + return_values[OFFSET_RET( + struct arm_scmi_sensor_description_get, + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 10] = 8; + return_values[OFFSET_RET( + struct arm_scmi_sensor_description_get, + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 11] = 7; + return_values[OFFSET_RET( + struct arm_scmi_sensor_description_get, + sensor_descriptors) + (SENSOR_DESC_LEN * i) + 12] = 6; } *status = SCMI_STATUS_SUCCESS; *return_values_count = 1 + @@ -134,8 +174,7 @@ void sensor_send_message(uint32_t message_id, uint32_t parameter_count, break; } if (parameters[OFFSET_PARAM( - struct arm_scmi_sensor_trip_point_notify, sensor_event_control)] > - 1) + struct arm_scmi_sensor_trip_point_notify, sensor_event_control)] > 1) { *status = SCMI_STATUS_INVALID_PARAMETERS; break; @@ -178,13 +217,13 @@ void sensor_send_message(uint32_t message_id, uint32_t parameter_count, break; } if (parameters[OFFSET_PARAM( - struct arm_scmi_sensor_reading_get, flags)] > 1) + struct arm_scmi_sensor_reading_get, sensor_reading_flags)] > 1) { *status = SCMI_STATUS_INVALID_PARAMETERS; break; } if( (parameters[OFFSET_PARAM( - struct arm_scmi_sensor_reading_get, flags)] == 1) && + struct arm_scmi_sensor_reading_get, sensor_reading_flags)] == 1) && ((sensor_protocol.asynchronous_sensor_read_support[ parameters[OFFSET_PARAM( struct arm_scmi_sensor_reading_get, sensor_id)]]) == 0)) @@ -195,6 +234,136 @@ void sensor_send_message(uint32_t message_id, uint32_t parameter_count, *status = SCMI_STATUS_SUCCESS; *return_values_count = 2; break; + case SNSR_AXIS_DESC_GET_MSG_ID: + sensor_id = parameters[OFFSET_PARAM(struct arm_scmi_sensor_axis_description_get, sensor_id)]; + if (sensor_id >= sensor_protocol.number_sensors) { + *status = SCMI_STATUS_NOT_FOUND; + break; + } + if (parameters[OFFSET_PARAM(struct arm_scmi_sensor_axis_description_get, axis_desc_index)] >= + number_of_axis_supported[sensor_id]) + { + *status = SCMI_STATUS_OUT_OF_RANGE; + break; + } + *status = SCMI_STATUS_SUCCESS; + + return_values[OFFSET_RET(struct arm_scmi_sensor_axis_description_get, num_axis_flags)] = + (number_of_axis_supported[sensor_id]) << + AXIS_NUM_FLAGS_AXIS_DESC_RET_LOW; + + for (i = 0; i < number_of_axis_supported[sensor_id]; ++i) { + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + SENSOR_AXIS_DESC_LEN * i] = i; + + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 1] = + 1 << AXIS_ATTR_LOW_EXT_ATTR_SUPPORT; + + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 2] = + (2 << AXIS_ATTR_HIGH_EXP_LOW) | + (3 << AXIS_ATTR_HIGH_SENSOR_TYPE_LOW); + + str = (char *)(&return_values[OFFSET_RET(struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 3]); + sprintf(str, "SENSOR_%d_AXIS%d", sensor_id, i); + + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 7] = + 4 << AXIS_RESOLUTION_LOW; + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 8] = 9; + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 9] = 8; + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 10] = 7; + return_values[OFFSET_RET( + struct arm_scmi_sensor_axis_description_get, + sensor_axis_descriptors) + (SENSOR_AXIS_DESC_LEN * i) + 11] = 6; + } + *return_values_count = 1 + + (number_of_axis_supported[sensor_id] * SENSOR_AXIS_DESC_LEN); + *status = SCMI_STATUS_SUCCESS; + break; + case SNSR_LIST_UPDATE_INTERVALS_MSG_ID: + sensor_id = parameters[OFFSET_PARAM(struct arm_scmi_sensor_list_update_intervals, sensor_id)]; + if (sensor_id >= sensor_protocol.number_sensors) { + *status = SCMI_STATUS_NOT_FOUND; + break; + } + int update_int; + update_int = parameters[OFFSET_PARAM(struct arm_scmi_sensor_list_update_intervals, update_int_index)]; + if ( update_int >= + sensor_update_interval_count[sensor_id]) + { + *status = SCMI_STATUS_OUT_OF_RANGE; + break; + } + return_values[OFFSET_RET(struct arm_scmi_sensor_list_update_intervals, update_intervals_flags)] = + sensor_update_interval_count[sensor_id] << + UPDT_INT_NUM_RET_INTERVALS_LOW; + for (i = 0; i < sensor_update_interval_count[sensor_id] ; i++) + { + return_values[OFFSET_RET(struct arm_scmi_sensor_list_update_intervals, intervals) + i] = + (1 << INTERVAL_EXP_LOW) | + (1 << INTERVAL_SECS_LOW); + } + *status = SCMI_STATUS_SUCCESS; + *return_values_count = 1 + (sensor_update_interval_count[sensor_id]); + break; + case SNSR_CONFIG_GET_MSG_ID: + sensor_id = parameters[OFFSET_PARAM(struct arm_scmi_config_get, sensor_id)]; + if (sensor_id >= sensor_protocol.number_sensors) { + *status = SCMI_STATUS_NOT_FOUND; + break; + } + return_values[OFFSET_RET(struct arm_scmi_config_get, sensor_config)] = + (sensor_update_intervals[sensor_id] << SNR_CFG_UPDATE_INT_SEC_LOW) | + (1 << SNR_CFG_UPDATE_INT_EXP_LOW) | + (RESERVED << SNR_CFG_SET_RESV_LOW) | + (1 << SNR_CFG_SET_TIMESTAMP_REPORTING) | + (1 << SNR_CFG_SET_SENSOR_STATE); + *status = SCMI_STATUS_SUCCESS; + *return_values_count = 1; + break; + case SNSR_CONFIG_SET_MSG_ID: + sensor_id = parameters[OFFSET_PARAM(struct arm_scmi_config_set, sensor_id)]; + if (sensor_id >= sensor_protocol.number_sensors) { + *status = SCMI_STATUS_NOT_FOUND; + break; + } + sensor_cfg = parameters[OFFSET_PARAM(struct arm_scmi_config_set, sensor_config)]; + + *status = SCMI_STATUS_SUCCESS; + break; + case SNSR_CNT_UPDATE_NOTIFY_MSG_ID: + sensor_id = parameters[OFFSET_PARAM(struct arm_scmi_cont_update_notify, sensor_id)]; + if (sensor_id >= sensor_protocol.number_sensors) { + *status = SCMI_STATUS_NOT_FOUND; + break; + } + if ( sensor_protocol.cont_update_notify_support[sensor_id] == + SENSOR_CONT_NOTI_UPD_NOT_SUPPORTED ) + { + *status = SCMI_STATUS_NOT_SUPPORTED; + break; + } + sensor_cfg = parameters[OFFSET_PARAM(struct arm_scmi_cont_update_notify, notify_enable)]; + if ( sensor_cfg >> SNR_NTF_ENB_RESV_LOW ) + { + *status = SCMI_STATUS_INVALID_PARAMETERS; + break; + } + *status = SCMI_STATUS_SUCCESS; + break; default: *status = SCMI_STATUS_NOT_FOUND; } diff --git a/platform/mocker/mocker/transport_voltage.c b/platform/mocker/mocker/transport_voltage.c new file mode 100755 index 0000000..a41be07 --- /dev/null +++ b/platform/mocker/mocker/transport_voltage.c @@ -0,0 +1,48 @@ +/** @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. +**/ +#include +#include +#include + +struct arm_scmi_voltage_protocol voltage_protocol; + +void fill_voltage_protocol() +{ + voltage_protocol.protocol_version = VOLTAGE_VERSION; + voltage_protocol.number_domains = num_voltage_domains; + voltage_protocol.voltage_domain_name = voltage_domain_names; +} + +void voltage_send_message(uint32_t message_id, uint32_t parameter_count, + const uint32_t *parameters, int32_t *status, + size_t *return_values_count, uint32_t *return_values) +{ + + switch(message_id) + { + case VOLTAGE_PROTO_VER_MSG_ID: + *status = SCMI_STATUS_SUCCESS; + *return_values_count = 1; + return_values[0] = voltage_protocol.protocol_version; + break; + /* Other Message IDs pending implementation */ + + default: + *status = SCMI_STATUS_NOT_FOUND; + break; + } +} diff --git a/platform/mocker/pal_platform.c b/platform/mocker/pal_platform.c index 3b9b0dd..97bedea 100644 --- a/platform/mocker/pal_platform.c +++ b/platform/mocker/pal_platform.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -61,6 +61,10 @@ void pal_send_message(uint32_t message_header_send, size_t parameter_count, reset_send_message(message_id, parameter_count, parameters, status, return_values_count, return_values); break; + case VOLTAGE_PROTOCOL_ID: + voltage_send_message(message_id, parameter_count, parameters, status, + return_values_count, return_values); + break; default: printf("\nProtocol: %d\n", message_id); assert(!"\nUnknown protocol id\n"); @@ -88,6 +92,7 @@ uint32_t pal_initialize_system(void *info) fill_sensor_protocol(); fill_clock_protocol(); fill_reset_protocol(); + fill_voltage_protocol(); return PAL_STATUS_PASS; } diff --git a/platform/mocker/pal_sensor.c b/platform/mocker/pal_sensor.c index ac1cda2..021de79 100644 --- a/platform/mocker/pal_sensor.c +++ b/platform/mocker/pal_sensor.c @@ -49,3 +49,48 @@ uint8_t pal_sensor_get_expected_trip_points(uint32_t sensor_id) { return number_of_trip_points_supported[sensor_id]; } + +uint8_t pal_sensor_get_sensor_resolutions(uint32_t sensor_id) +{ + return sensor_resolutions[sensor_id]; +} + +uint8_t pal_sensor_get_sensor_powers(uint32_t sensor_id) +{ + return sensor_powers[sensor_id]; +} + +uint8_t pal_sensor_get_number_of_axis_supported(uint32_t sensor_id) +{ + return number_of_axis_supported[sensor_id]; +} + +uint8_t pal_sensor_get_sensor_axis_supported(uint32_t sensor_id) +{ + return sensor_axis_supported[sensor_id]; +} + +uint8_t pal_sensor_get_sensor_extended_attributes_support(uint32_t sensor_id) +{ + return sensor_extended_attributes_support[sensor_id]; +} + +uint8_t pal_sensor_get_sensor_timestamp_support(uint32_t sensor_id) +{ + return sensor_timestamp_support[sensor_id]; +} + +uint8_t pal_sensor_get_continous_sensor_update_notification_support(uint32_t sensor_id) +{ + return continous_sensor_update_notification_support[sensor_id]; +} + +uint8_t pal_sensor_get_sensor_update_intervals(uint32_t sensor_id) +{ + return sensor_update_interval_count[sensor_id]; +} + +uint8_t pal_sensor_get_sensor_update_interval(uint32_t sensor_id) +{ + return sensor_update_intervals[sensor_id]; +} diff --git a/platform/mocker/pal_voltage.c b/platform/mocker/pal_voltage.c new file mode 100755 index 0000000..38c43ce --- /dev/null +++ b/platform/mocker/pal_voltage.c @@ -0,0 +1,39 @@ +/** @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. +**/ + +#include +#include + +/** + @brief This API is used for checking num of voltage domain + @param none + @return num of voltage domain +**/ +uint32_t pal_voltage_get_expected_num_domains(void) +{ + return num_voltage_domains; +} + +/** + @brief This API is used for checking voltage domain name + @param domain id + @return voltage domain name +**/ +uint8_t *pal_voltage_get_expected_name(uint32_t domain_id) +{ + return (uint8_t *)voltage_domain_names[domain_id]; +} diff --git a/test_pool/clock/test_c007.c b/test_pool/clock/test_c007.c index 35aa659..7e30e79 100644 --- a/test_pool/clock/test_c007.c +++ b/test_pool/clock/test_c007.c @@ -46,7 +46,7 @@ uint32_t clock_query_describe_rates(void) val_print(VAL_PRINT_ERR, "\n No Clock found "); return VAL_STATUS_SKIP; } - val_print(VAL_PRINT_DEBUG, "\n NUM CLOCKS : %d", num_clocks); + val_print(VAL_PRINT_TEST, "\n NUM CLOCKS : %d", num_clocks); /* Check Clock describe rate for valid clocks */ @@ -82,31 +82,31 @@ uint32_t clock_query_describe_rates(void) num_rate_flag = return_values[RATE_FLAG_OFFSET]; num_remaining_rates = VAL_EXTRACT_BITS(num_rate_flag, 16, 31); - val_print(VAL_PRINT_DEBUG, "\n NUM OF REMAINING RATES : %d", num_remaining_rates); + val_print(VAL_PRINT_TEST, "\n NUM OF REMAINING RATES : %d", num_remaining_rates); if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(num_rate_flag, 13, 15)) != VAL_STATUS_PASS) return VAL_STATUS_FAIL; return_format = VAL_EXTRACT_BITS(num_rate_flag, 12, 12); - val_print(VAL_PRINT_DEBUG, "\n Return format : %d", return_format); + val_print(VAL_PRINT_TEST, "\n Return format : %d", return_format); num_rates_retured = VAL_EXTRACT_BITS(num_rate_flag, 0, 11); - val_print(VAL_PRINT_DEBUG, "\n NUM OF RATES RETURNED : %d", num_rates_retured); + val_print(VAL_PRINT_TEST, "\n NUM OF RATES RETURNED : %d", num_rates_retured); /* Rate array starts from return_values[1]*/ rate_array = &return_values[RATES_OFFSET]; for (i = 0; i < num_rates_retured; i++) { - val_print(VAL_PRINT_DEBUG, "\n Rate Index : %d", rate_index + i); + val_print(VAL_PRINT_TEST, "\n Rate Index : %d", rate_index + i); if (return_format == CLOCK_RATE_FMT_ARRAY) { lower_word = rate_array[i * 2]; upper_word = rate_array[1 + i * 2]; clock_rate = VAL_GET_64BIT_DATA(upper_word, lower_word); - val_print(VAL_PRINT_DEBUG, "\n CLOCK RATE : 0x%llX", + val_print(VAL_PRINT_TEST, "\n CLOCK RATE : 0x%llX", clock_rate); /* Save first & last value*/ if (i == 0) { @@ -119,6 +119,11 @@ uint32_t clock_query_describe_rates(void) clock_id, clock_rate); } } else { + /* Verify remaining rates for triplet format */ + val_print(VAL_PRINT_TEST, "\n [Check 3] Verify triplet return format"); + if (num_rates_retured != 3 || num_remaining_rates != 0) + return VAL_STATUS_FAIL; + /* Find lowest clock rate from rate array */ lower_word = rate_array[i * 6]; upper_word = rate_array[1 + i * 6]; diff --git a/test_pool/performance/test_d028.c b/test_pool/performance/test_d028.c index 111b270..f9eff31 100644 --- a/test_pool/performance/test_d028.c +++ b/test_pool/performance/test_d028.c @@ -70,7 +70,7 @@ uint32_t performance_level_get_fast_channel(void) if (val_performance_get_info(PERF_DOMAIN_FAST_CH_SUPPORT, domain_id) == 0) continue; - val_print(VAL_PRINT_TEST, "\n FAST CHANNEL supported for DOMAIN: %d",domain_id); + val_print(VAL_PRINT_TEST, "\n FAST CHANNEL supported for DOMAIN: %d", domain_id); message_id = PERFORMANCE_LEVEL_GET; /* if perf level get doesn't support fastchannel, skip */ diff --git a/test_pool/power_domain/test_p005_v3.c b/test_pool/power_domain/test_p005_v3.c new file mode 100755 index 0000000..2ebcb6d --- /dev/null +++ b/test_pool/power_domain/test_p005_v3.c @@ -0,0 +1,83 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_power_domain.h" + +#define TEST_NUM (SCMI_POWER_DOMAIN_TEST_NUM_BASE + 5) +#define TEST_DESC "Power domain attributes check " + +uint32_t power_domain_query_domain_attributes_scmi_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 domain_id, num_domains, attribute; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_power_domain_get_info(0, NUM_POWER_DOMAIN); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No power domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + /* Check power domain attributes for valid domain */ + val_print(VAL_PRINT_TEST, "\n POWER DOMAIN ID: %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Query power domain attribute"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_POWER_DOMAIN, POWER_DOMAIN_ATTRIBUTES, + COMMAND_MSG); + 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_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); + + attribute = return_values[ATTRIBUTE_OFFSET]; + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 28)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n POWER STATE CHANGE NOTIFICATIONS SUPPORT: %d", + VAL_EXTRACT_BITS(attribute, 31, 31)); + val_print(VAL_PRINT_DEBUG, "\n POWER ASYNCHRONOUS SUPPORT: %d", + VAL_EXTRACT_BITS(attribute, 30, 30)); + val_print(VAL_PRINT_DEBUG, "\n POWER SYNCHRONOUS SUPPORT: %d", + VAL_EXTRACT_BITS(attribute, 29, 29)); + val_print(VAL_PRINT_DEBUG, "\n POWER STATE CHANGE REQUESTED NOTIFICATIONS SUPPORT: %d", + VAL_EXTRACT_BITS(attribute, 28, 28)); + val_print(VAL_PRINT_DEBUG, "\n DOMAIN NAME: %s", + (uint8_t *)&return_values[DOMAIN_NAME_OFFSET]); + } + + return VAL_STATUS_PASS; + +} diff --git a/test_pool/reset/test_r005_v3.c b/test_pool/reset/test_r005_v3.c new file mode 100755 index 0000000..a8152f6 --- /dev/null +++ b/test_pool/reset/test_r005_v3.c @@ -0,0 +1,104 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_reset.h" + +#define TEST_NUM (SCMI_RESET_TEST_NUM_BASE + 5) +#define TEST_DESC "Reset domain attributes check " + +uint32_t reset_query_domain_attributes_scmi_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 domain_id, num_domains, attribute; + uint32_t latency, async_support, notification_support; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Skip if no domains found*/ + num_domains = val_reset_get_info(NUM_RESET_DOMAINS, 0x0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No reset domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + + /* Verify the reset IDs are starting from value 0 */ + domain_id = 0; + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_RESET, RESET_DOMAIN_ATTRIBUTES, COMMAND_MSG); + val_send_message(cmd_msg_hdr, param_count, &domain_id, &rsp_msg_hdr, &status, + &return_value_count, return_values); + + val_print(VAL_PRINT_TEST, "\n [Check 2] Verify Domain IDs begin from 0"); + if (val_compare_status(status, SCMI_NOT_FOUND) == VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + /* Check reset domain attributes for valid domain */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + val_print(VAL_PRINT_TEST, "\n RESET DOMAIN ID: %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Query attributes"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_RESET, RESET_DOMAIN_ATTRIBUTES, COMMAND_MSG); + 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_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); + + attribute = return_values[ATTRIBUTE_OFFSET]; + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 29)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + async_support = VAL_EXTRACT_BITS(attribute, 31, 31); + notification_support = VAL_EXTRACT_BITS(attribute, 30, 30); + latency = return_values[LATANCY_OFFSET]; + + val_print(VAL_PRINT_DEBUG, "\n Async reset support : %d", + async_support); + val_print(VAL_PRINT_DEBUG, "\n Reset notifications support : %d", + notification_support); + val_print(VAL_PRINT_DEBUG, "\n Latency : %d", + latency); + + /* Save info for further tests*/ + val_reset_save_info(RESET_ASYNC_SUPPORT, domain_id, async_support); + val_reset_save_info(RESET_NOTIFY_SUPPORT, domain_id, notification_support); + + if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET], + (char *)val_reset_get_expected_name(domain_id), SCMI_NAME_STR_SIZE)) + return VAL_STATUS_FAIL; + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m005_v3.c b/test_pool/sensor/test_m005_v3.c new file mode 100755 index 0000000..d064520 --- /dev/null +++ b/test_pool/sensor/test_m005_v3.c @@ -0,0 +1,215 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 5) +#define TEST_DESC "Sensor description get check " + +#define SENSOR_DESC_LEN 13 +#define START_SENSOR_ID 0 +#define EXTENDED_ATTR_SUPPORTED 1 + +uint32_t sensor_query_description_get_scmi_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 num_remaining_desc, num_desc_retured = 0; + uint32_t total_sensors = 0; + uint32_t i, desc_index = 0, sensor_id; + uint32_t async_support, num_trip_points, cont_update_notify_support; + uint32_t timestamp_support, ext_attr_support; + uint32_t *sensor_desc, num_sensor_flag; + uint32_t num_axis, unit_exponent, axis_support; + uint32_t sensor_type; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + val_print(VAL_PRINT_TEST, "\n [Check 1] Query sensor description "); + + /* Reading sensor description repeatedly until all sensor details received*/ + do + { + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + desc_index += num_desc_retured; + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_DESCRIPTION_GET, COMMAND_MSG); + val_send_message(cmd_msg_hdr, param_count, &desc_index, &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); + + /* Check flag values */ + num_sensor_flag = return_values[NUM_SENSOR_FLAG_OFFSET]; + num_remaining_desc = VAL_EXTRACT_BITS(num_sensor_flag, 16, 31); + val_print(VAL_PRINT_DEBUG, "\n NUM OF REMAINING DESC : %d", num_remaining_desc); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(num_sensor_flag, 12, 15)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + num_desc_retured = VAL_EXTRACT_BITS(num_sensor_flag, 0, 11); + val_print(VAL_PRINT_DEBUG, "\n NUM OF DESC RETURNED : %d", num_desc_retured); + + /* Sensor desc start from return_values[1] */ + sensor_desc = &return_values[DESC_OFFSET]; + for (i = 0; i < num_desc_retured; i++) + { + val_print(VAL_PRINT_TEST, "\n Sensor description "); + + sensor_id = sensor_desc[i * SENSOR_DESC_LEN]; + val_print(VAL_PRINT_DEBUG, "\n Sensor id : %d", sensor_id); + + /* sensor_attributes_low */ + async_support = VAL_EXTRACT_BITS(sensor_desc[1 + (i * SENSOR_DESC_LEN)], 31, 31); + val_print(VAL_PRINT_DEBUG, "\n Async read support : %d", async_support); + + cont_update_notify_support = VAL_EXTRACT_BITS(sensor_desc[1 + (i * SENSOR_DESC_LEN)], 30, 30); + val_print(VAL_PRINT_DEBUG, "\n Cont Update Notify Sup : %d", cont_update_notify_support); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_desc[1 + (i * SENSOR_DESC_LEN)], 15, 29)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n Timestamp exponent : %d", + VAL_EXTRACT_BITS(sensor_desc[1 + (i * SENSOR_DESC_LEN)], 10, 14)); + + timestamp_support = VAL_EXTRACT_BITS(sensor_desc[1 + (i * SENSOR_DESC_LEN)], 9, 9); + val_print(VAL_PRINT_DEBUG, "\n Time stamp support : %d", timestamp_support); + + ext_attr_support = VAL_EXTRACT_BITS(sensor_desc[1 + (i * SENSOR_DESC_LEN)], 8, 8); + val_print(VAL_PRINT_DEBUG, "\n Extended Attr Support : %d", ext_attr_support); + + num_trip_points = VAL_EXTRACT_BITS(sensor_desc[1 + (i * SENSOR_DESC_LEN)], 0, 7); + val_print(VAL_PRINT_DEBUG, "\n Number of trip points : %d", num_trip_points); + + val_print(VAL_PRINT_TEST, "\n [Check 2] Check Extended attributes from Sensors"); + if (val_compare("Extended Attr Support ", ext_attr_support, EXTENDED_ATTR_SUPPORTED)) + return VAL_STATUS_FAIL; + + /* sensor_attributes_high */ + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_desc[2 + (i * SENSOR_DESC_LEN)], 22, 31)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + num_axis = VAL_EXTRACT_BITS(sensor_desc[2 + (i * SENSOR_DESC_LEN)], 16, 21); + val_print(VAL_PRINT_DEBUG, "\n Number of Axis : %d", num_axis); + + unit_exponent = VAL_EXTRACT_BITS(sensor_desc[2 + (i * SENSOR_DESC_LEN)], 11, 15); + val_print(VAL_PRINT_DEBUG, "\n Sensor Unit Exponent : %d", unit_exponent); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_desc[2 + (i * SENSOR_DESC_LEN)], 9, 10)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + axis_support = VAL_EXTRACT_BITS(sensor_desc[2 + (i * SENSOR_DESC_LEN)], 8, 8); + val_print(VAL_PRINT_DEBUG, "\n Sensor Axis Support : %d", axis_support); + + sensor_type = VAL_EXTRACT_BITS(sensor_desc[2 + (i * SENSOR_DESC_LEN)], 0, 7); + val_print(VAL_PRINT_DEBUG, "\n Sensor Type : %d", sensor_type); + + /* Sensor Name */ + val_print(VAL_PRINT_DEBUG, "\n Sensor name : %s", + &sensor_desc[3 + (i * SENSOR_DESC_LEN)]); + + /* Sensor Power */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Power : %d", + sensor_desc[7 + (i * SENSOR_DESC_LEN)]); + + /* sensor resolution */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Resolution exp : %d", + VAL_EXTRACT_BITS(sensor_desc[8 + (i * SENSOR_DESC_LEN)], 27, 31)); + + val_print(VAL_PRINT_DEBUG, "\n Sensor Resolution : %d", + VAL_EXTRACT_BITS(sensor_desc[8 + (i * SENSOR_DESC_LEN)], 0, 26)); + + /* Sensor Min Range */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Min Range Low : %d", + sensor_desc[9 + (i * SENSOR_DESC_LEN)]); + val_print(VAL_PRINT_DEBUG, "\n Sensor Min Range High : %d", + sensor_desc[10 + (i * SENSOR_DESC_LEN)]); + + /* Sensor Max Range */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Max Range Low : %d", + sensor_desc[11 + (i * SENSOR_DESC_LEN)]); + val_print(VAL_PRINT_DEBUG, "\n Sensor Max Range High : %d", + sensor_desc[12 + (i * SENSOR_DESC_LEN)]); + + /* Save sensor information */ + val_sensor_save_desc_info(SENSOR_NUM_OF_TRIP_POINTS, sensor_id, num_trip_points); + val_sensor_save_desc_info(SENSOR_ASYNC_READ_SUPPORT, sensor_id, async_support); + + /* Save extended sensor information */ + val_sensor_ext_save_desc_info(SENSOR_CONT_NOTIFY_UPDATE_SUPPORT, + sensor_id, cont_update_notify_support); + val_sensor_ext_save_desc_info(SENSOR_TIMESTAMP_SUPPORT, + sensor_id, timestamp_support); + val_sensor_ext_save_desc_info(SENSOR_NUM_OF_AXIS, sensor_id, num_axis); + val_sensor_ext_save_desc_info(SENSOR_AXIS_SUPPORT, sensor_id, axis_support); + + /* Ensure sensor description indicates sensor identifiers start from 0 and are sequential*/ + val_print(VAL_PRINT_TEST, "\n [Check 3] Ensure sensor IDs start from 0"); + + /* Get sensor ID for first returned sensor.*/ + if (total_sensors == 0 && i == 0) + { + if (val_compare("START SENSOR ID ", sensor_id, START_SENSOR_ID)) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n Start Sensor : %s, has ID 0", + &sensor_desc[3 + (i * SENSOR_DESC_LEN)]); + } + /* Check sensor IDs are sequential. */ + if (val_compare("SENSOR ID SEQUENCE", sensor_id, i+total_sensors)) + return VAL_STATUS_FAIL; + } + total_sensors += num_desc_retured; + } while (num_remaining_desc > 0); + + if (val_compare("NUM OF DESC ", total_sensors, val_sensor_get_expected_num_sensors())) + return VAL_STATUS_FAIL; + + /* Sensor get desc for invalid descriptor index */ + desc_index = total_sensors + 1; + val_print(VAL_PRINT_TEST, "\n [Check 4] Query with invalid desc_index : %d", desc_index); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_DESCRIPTION_GET, COMMAND_MSG); + val_send_message(cmd_msg_hdr, param_count, &desc_index, &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_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m016.c b/test_pool/sensor/test_m016.c new file mode 100755 index 0000000..4a333fd --- /dev/null +++ b/test_pool/sensor/test_m016.c @@ -0,0 +1,168 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 16) +#define TEST_DESC "Sensor axis description check " + +#define MAX_PARAMETER_SIZE 2 +#define SENSOR_AXIS_DESC_LEN 12 +#define EXTENDED_ATTR_SUPPORTED 1 + +uint32_t sensor_axis_description_check(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 parameters[MAX_PARAMETER_SIZE]; + uint32_t sensor_id, num_sensors, num_axis_flag; + uint32_t axis_desc_index = 0; + uint32_t num_desc_retured = 0; + uint32_t *sensor_axis_desc; + uint32_t axis_id, i; + uint32_t ext_attr_support; + uint32_t num_remaining_desc; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_sensors = val_sensor_get_info(NUM_SENSORS); + if (num_sensors == 0) { + val_print(VAL_PRINT_ERR, "\n No Sensor found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM SENSORS : %d", num_sensors); + + /* Reading sensor axis properties for all sensors. */ + for (sensor_id = 0; sensor_id < num_sensors; sensor_id++) + { + val_print(VAL_PRINT_TEST, "\n SENSOR ID: %d", sensor_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Get sensor axis properties"); + + axis_desc_index = 0; + num_desc_retured = 0; + + do{ + axis_desc_index += num_desc_retured; + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = axis_desc_index; + + cmd_msg_hdr = val_msg_hdr_create( + PROTOCOL_SENSOR, SENSOR_AXIS_DESCRIPTION_GET, 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); + + /* Check num_axis_flag values */ + num_axis_flag = return_values[NUM_AXIS_FLAG_OFFSET]; + num_remaining_desc = VAL_EXTRACT_BITS(num_axis_flag, 26, 31); + val_print(VAL_PRINT_DEBUG, "\n NUM OF REMAIN AXIS DESC: %d", + num_remaining_desc); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(num_axis_flag, 6, 25)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + num_desc_retured = VAL_EXTRACT_BITS(num_axis_flag, 0, 5); + val_print(VAL_PRINT_DEBUG, "\n NUM OF AXIS DESC RETURN: %d", + num_desc_retured); + + /* Get sensor Axis details */ + sensor_axis_desc = &return_values[SENSOR_AXIS_DESC_OFFSET]; + for (i = 0; i < num_desc_retured; i++) + { + axis_id = sensor_axis_desc[i * SENSOR_AXIS_DESC_LEN]; + val_print(VAL_PRINT_DEBUG, "\n Axis id : %d", axis_id); + + /* Sensor axis_attributes_low */ + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_axis_desc[1 + (i * SENSOR_AXIS_DESC_LEN)], 9, 31)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + ext_attr_support = VAL_EXTRACT_BITS( + sensor_axis_desc[1 + (i * SENSOR_AXIS_DESC_LEN)], 8, 8); + val_print(VAL_PRINT_TEST, "\n [Check 2] Check extended attr supported"); + val_print(VAL_PRINT_TEST, "\n Extended Attr Support : %d", + ext_attr_support); + + if (val_compare("Extended Attr Support ", + ext_attr_support, EXTENDED_ATTR_SUPPORTED)) + return VAL_STATUS_FAIL; + + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_axis_desc[1 + (i * SENSOR_AXIS_DESC_LEN)], 0, 7)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + /* Sensor axis_attributes_high */ + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_axis_desc[2 + (i * SENSOR_AXIS_DESC_LEN)], 16, 31)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n Sensor Unit Exponent : %d", + VAL_EXTRACT_BITS(sensor_axis_desc[2 + (i * SENSOR_AXIS_DESC_LEN)], 11, 15)); + + val_print(VAL_PRINT_DEBUG, "\n Sensor Type : %d", + VAL_EXTRACT_BITS(sensor_axis_desc[2 + (i * SENSOR_AXIS_DESC_LEN)], 0, 7)); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS( + sensor_axis_desc[2 + (i * SENSOR_AXIS_DESC_LEN)], 8, 10)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + /* Sensor Axis name */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Axis name : %s", + &sensor_axis_desc[3 + (i * SENSOR_AXIS_DESC_LEN)]); + + /* Sensor axis_resolution */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Resolution exp : %d", + VAL_EXTRACT_BITS(sensor_axis_desc[7 + (i * SENSOR_AXIS_DESC_LEN)], 27, 31)); + + val_print(VAL_PRINT_DEBUG, "\n Sensor Resolution : %d", + VAL_EXTRACT_BITS(sensor_axis_desc[7 + (i * SENSOR_AXIS_DESC_LEN)], 0, 26)); + + /* Sensor Axis Min Range */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Axis Min Range Low : %d", + sensor_axis_desc[8 + (i * SENSOR_AXIS_DESC_LEN)]); + val_print(VAL_PRINT_DEBUG, "\n Sensor Axis Min Range High : %d", + sensor_axis_desc[9 + (i * SENSOR_AXIS_DESC_LEN)]); + + /* Sensor Axis Max Range */ + val_print(VAL_PRINT_DEBUG, "\n Sensor Axis Max Range Low : %d", + sensor_axis_desc[10 + (i * SENSOR_AXIS_DESC_LEN)]); + val_print(VAL_PRINT_DEBUG, "\n Sensor Axis Max Range High : %d", + sensor_axis_desc[11 + (i * SENSOR_AXIS_DESC_LEN)]); + } + + } while (num_remaining_desc > 0); + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m017.c b/test_pool/sensor/test_m017.c new file mode 100755 index 0000000..2c063eb --- /dev/null +++ b/test_pool/sensor/test_m017.c @@ -0,0 +1,58 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 17) +#define TEST_DESC "Sensor get axis description for invalid sensor ID" + +#define MAX_PARAMETER_SIZE 2 + +uint32_t sensor_axis_desc_invalid_id_check(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 parameters[MAX_PARAMETER_SIZE], sensor_id; + uint32_t axis_desc_index = 0; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Reading sensor value for invalid sensor should fail */ + sensor_id = val_sensor_get_info(NUM_SENSORS) + 1; + val_print(VAL_PRINT_TEST, "\n [Check 1] Send invalid sensor id : %d", sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = axis_desc_index; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_AXIS_DESCRIPTION_GET, 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_NOT_FOUND) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m018.c b/test_pool/sensor/test_m018.c new file mode 100755 index 0000000..61e9490 --- /dev/null +++ b/test_pool/sensor/test_m018.c @@ -0,0 +1,188 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 18) +#define TEST_DESC "Sensor Get supported update intervals check " + +#define MAX_PARAMETER_SIZE 2 + +uint32_t sensor_supported_update_intervals_check(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 parameters[MAX_PARAMETER_SIZE]; + uint32_t sensor_id, num_sensors; + uint32_t update_interval_index; + uint32_t num_interval_retured, num_remaining_interval; + uint32_t interval_flag, interval_format; + uint32_t start_interval, end_interval, step_size; + uint32_t *intervals_array, interval, i; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_sensors = val_sensor_get_info(NUM_SENSORS); + if (num_sensors == 0) { + val_print(VAL_PRINT_ERR, "\n No Sensor found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM SENSORS : %d", num_sensors); + + /* Reading sensor value with incorrect flags */ + for (sensor_id = 0; sensor_id < num_sensors; sensor_id++) + { + val_print(VAL_PRINT_TEST, "\n SENSOR ID: %d", sensor_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Get Sensor supported update intervals "); + + num_remaining_interval = 0; + num_interval_retured = 0; + update_interval_index = 0; + + do { + update_interval_index += num_interval_retured; + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = update_interval_index; + cmd_msg_hdr = val_msg_hdr_create( + PROTOCOL_SENSOR, SENSOR_LIST_UPDATE_INTERVALS, 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; + + /* Check update intervals flags */ + interval_flag = return_values[UPDATE_INTERVAL_FLAG_OFFSET]; + + num_remaining_interval = VAL_EXTRACT_BITS(interval_flag, 16, 31); + val_print(VAL_PRINT_DEBUG, "\n NUMBER OF INTERVALS : %d", + num_remaining_interval); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(interval_flag, 13, 15)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + interval_format = VAL_EXTRACT_BITS(interval_flag, 12, 12); + val_print(VAL_PRINT_DEBUG, "\n Update interval format : %d", + interval_format); + + num_interval_retured = VAL_EXTRACT_BITS(interval_flag, 0, 11); + val_print(VAL_PRINT_DEBUG, "\n NUM OF INTERVALS RETURN: %d", + num_interval_retured); + + intervals_array = &return_values[LEVEL_ARRAY_OFFSET]; + + /* Verify only 3 values are returned in case interva; return format is triplet */ + if (interval_format == LEVEL_FORMAT_TRIPLET) + { + val_print(VAL_PRINT_TEST, "\n [Check 2] Verify triplet return format", + sensor_id); + if(num_interval_retured != 3 || num_remaining_interval != 0) + return VAL_STATUS_FAIL; + + /* Check Start Interval */ + start_interval = intervals_array[INTERVAL_START_OFFSET]; + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(start_interval, 21, 31)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n start interval seconds : %d", + VAL_EXTRACT_BITS(start_interval, 5, 20)); + val_print(VAL_PRINT_DEBUG, "\n start interval exponent: %d", + VAL_EXTRACT_BITS(start_interval, 0, 4)); + + /* Check End interval */ + end_interval = intervals_array[INTERVAL_START_OFFSET]; + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(end_interval, 21, 31)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n end interval seconds : %d", + VAL_EXTRACT_BITS(end_interval, 5, 20)); + val_print(VAL_PRINT_DEBUG, "\n end interval exponent : %d", + VAL_EXTRACT_BITS(end_interval, 0, 4)); + + /* Step interval Size check */ + step_size = intervals_array[INTERVAL_START_OFFSET]; + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(step_size, 21, 31)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n step interval seconds : %d", + VAL_EXTRACT_BITS(step_size, 5, 20)); + val_print(VAL_PRINT_DEBUG, "\n step interval exponent : %d", + VAL_EXTRACT_BITS(step_size, 0, 4)); + } + /* Update interval array check */ + else + { + for (i = 0; i < num_interval_retured; i++) + { + val_print(VAL_PRINT_DEBUG, "\n Interval Index : %d", + (update_interval_index+i)); + + interval = intervals_array[(update_interval_index+i)]; + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(interval, 21, 31)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n interval seconds : %d", + VAL_EXTRACT_BITS(interval, 5, 20)); + val_print(VAL_PRINT_DEBUG, "\n interval exponent : %d", + VAL_EXTRACT_BITS(interval, 0, 4)); + } + } + } while (num_remaining_interval > 0); + + /* Check Sensor Update interval for invalid index values. */ + if (interval_format == LEVEL_FORMAT_TRIPLET) { + continue; /* Ignore index for triplet return values */ + } + + update_interval_index = update_interval_index + num_interval_retured + 1; + val_print(VAL_PRINT_TEST, "\n [Check 3] Query with invalid index: %d", + update_interval_index); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = update_interval_index; /*Invalid interval index*/ + cmd_msg_hdr = val_msg_hdr_create( + PROTOCOL_SENSOR, SENSOR_LIST_UPDATE_INTERVALS, 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_OUT_OF_RANGE) != 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; + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m019.c b/test_pool/sensor/test_m019.c new file mode 100755 index 0000000..c934326 --- /dev/null +++ b/test_pool/sensor/test_m019.c @@ -0,0 +1,59 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 19) +#define TEST_DESC "Sensor get update interval invalid sensor ID" + +#define MAX_PARAMETER_SIZE 2 + +uint32_t sensor_update_interval_invalid_id_check(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 parameters[MAX_PARAMETER_SIZE], sensor_id; + uint32_t update_interval_index = 0; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Reading sensor value for invalid sensor should fail */ + sensor_id = val_sensor_get_info(NUM_SENSORS) + 1; + val_print(VAL_PRINT_TEST, "\n [Check 1] Send invalid sensor id : %d", sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = update_interval_index; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_LIST_UPDATE_INTERVALS, 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_NOT_FOUND) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m020.c b/test_pool/sensor/test_m020.c new file mode 100755 index 0000000..c7f7cac --- /dev/null +++ b/test_pool/sensor/test_m020.c @@ -0,0 +1,90 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 20) +#define TEST_DESC "Sensor read configuration check " + +#define MAX_PARAMETER_SIZE 1 + +uint32_t sensor_read_configuration_check(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 parameters[MAX_PARAMETER_SIZE]; + uint32_t sensor_id, num_sensors; + uint32_t sensor_config; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_sensors = val_sensor_get_info(NUM_SENSORS); + if (num_sensors == 0) { + val_print(VAL_PRINT_ERR, "\n No Sensor found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM SENSORS : %d", num_sensors); + + /* Reading sensor configuration */ + for (sensor_id = 0; sensor_id < num_sensors; sensor_id++) + { + val_print(VAL_PRINT_TEST, "\n SENSOR ID: %d", sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONFIG_GET, 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; + + /* Check sensor config values */ + sensor_config = return_values[SENSOR_CONFIG_OFFSET]; + + val_print(VAL_PRINT_DEBUG, "\n Sensor Update Interval in Seconds : %d", + VAL_EXTRACT_BITS(sensor_config, 16, 31)); + + val_print(VAL_PRINT_DEBUG, "\n Sensor Update Interval exponent : %d", + VAL_EXTRACT_BITS(sensor_config, 11, 15)); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(sensor_config, 2, 10)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print(VAL_PRINT_DEBUG, "\n Sensor Timestamp Report: %d", + VAL_EXTRACT_BITS(sensor_config, 1, 1)); + + val_print(VAL_PRINT_DEBUG, "\n Sensor State : %d", + VAL_EXTRACT_BITS(sensor_config, 0, 0)); + val_sensor_ext_save_desc_info(SENSOR_STATE, sensor_id, + VAL_EXTRACT_BITS(sensor_config, 0, 0)); + + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m021.c b/test_pool/sensor/test_m021.c new file mode 100755 index 0000000..c369026 --- /dev/null +++ b/test_pool/sensor/test_m021.c @@ -0,0 +1,57 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 21) +#define TEST_DESC "Sensor read configuration for invalid sensor ID" + +#define MAX_PARAMETER_SIZE 1 + +uint32_t sensor_read_configuration_invalid_id_check(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 parameters[MAX_PARAMETER_SIZE], sensor_id; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Reading sensor value for invalid sensor should fail */ + sensor_id = val_sensor_get_info(NUM_SENSORS) + 1; + val_print(VAL_PRINT_TEST, "\n [Check 1] Send invalid sensor id : %d", sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONFIG_GET, 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_NOT_FOUND) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m022.c b/test_pool/sensor/test_m022.c new file mode 100755 index 0000000..daab56b --- /dev/null +++ b/test_pool/sensor/test_m022.c @@ -0,0 +1,152 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 22) +#define TEST_DESC "Sensor configuration setting check " + +#define MAX_PARAMETER_SIZE 2 + +/************ TEST ALGO ****************** + * Get current sensor State + * Choose a different state for sensor + * Set new state in sensor + * Check new state has been set. + * Restore the default state for sensor. +*****************************************/ + +uint32_t sensor_set_configuration_check(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 parameters[MAX_PARAMETER_SIZE]; + uint32_t sensor_id, num_sensors; + uint32_t default_sensor_config, new_sensor_config; + uint32_t default_sensor_state, sensor_state, new_sensor_state; + uint32_t update_interval, update_interval_exp; + uint32_t timestamp_reporting, round_up_down; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_sensors = val_sensor_get_info(NUM_SENSORS); + if (num_sensors == 0) { + val_print(VAL_PRINT_ERR, "\n No Sensor found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM SENSORS : %d", num_sensors); + + for (sensor_id = 0; sensor_id < num_sensors; sensor_id++) + { + /* STEP 1: Reading sensor configuration */ + val_print(VAL_PRINT_TEST, "\n [Step 1] Get Operational sensor state "); + val_print(VAL_PRINT_TEST, "\n SENSOR ID: %d", sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONFIG_GET, 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; + + default_sensor_config = return_values[SENSOR_CONFIG_OFFSET]; + + /* Save the default sensor state */ + update_interval = VAL_EXTRACT_BITS(default_sensor_config, 16, 31); + update_interval_exp = VAL_EXTRACT_BITS(default_sensor_config, 11, 15); + round_up_down = VAL_EXTRACT_BITS(default_sensor_config, 9, 10); + timestamp_reporting = VAL_EXTRACT_BITS(default_sensor_config, 1, 1); + + default_sensor_state = VAL_EXTRACT_BITS(default_sensor_config, 0, 0); + val_print(VAL_PRINT_DEBUG, "\n Default Sensor State : %d", default_sensor_state); + + /* STEP 2: Set a sensor config with modified state. */ + val_print(VAL_PRINT_TEST, "\n [Step 2] Choose another state for sensor"); + new_sensor_state = (default_sensor_state == DISABLED) ? ENABLED : DISABLED; + + new_sensor_config = val_sensor_set_config(update_interval, update_interval_exp, + round_up_down, timestamp_reporting, + new_sensor_state); + + /* STEP 3 : Set new state for sensor */ + val_print(VAL_PRINT_TEST, "\n [Step 3] Set new sensor state"); + val_print(VAL_PRINT_DEBUG, "\n New Sensor State : %d", new_sensor_state); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = new_sensor_config; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_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; + + /* STEP 4 : Verify new state has been set */ + val_print(VAL_PRINT_TEST, "\n [Step 4] Verify newly set sensor state "); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONFIG_GET, 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; + + new_sensor_config = return_values[SENSOR_CONFIG_OFFSET]; + sensor_state = VAL_EXTRACT_BITS(new_sensor_config, 0, 0); + if (val_compare("Updated sensor state ", sensor_state, new_sensor_state)) + return VAL_STATUS_FAIL; + + /* STEP 5 : Set default sensor state back */ + val_print(VAL_PRINT_TEST, "\n [Step 3] Set new sensor state"); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = default_sensor_config; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_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; + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m023.c b/test_pool/sensor/test_m023.c new file mode 100755 index 0000000..407efb6 --- /dev/null +++ b/test_pool/sensor/test_m023.c @@ -0,0 +1,59 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 21) +#define TEST_DESC "Sensor set configuration for invalid sensor ID" + +#define MAX_PARAMETER_SIZE 1 + +uint32_t sensor_set_configuration_invalid_id_check(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 parameters[MAX_PARAMETER_SIZE], sensor_id; + uint32_t sensor_config = 0; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Setting sensor value for invalid sensor should fail */ + sensor_id = val_sensor_get_info(NUM_SENSORS) + 1; + val_print(VAL_PRINT_TEST, "\n [Check 1] Send invalid sensor id : %d", sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = sensor_id; + parameters[param_count++] = sensor_config; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_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_NOT_FOUND) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m024.c b/test_pool/sensor/test_m024.c new file mode 100755 index 0000000..1df2c19 --- /dev/null +++ b/test_pool/sensor/test_m024.c @@ -0,0 +1,112 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 24) +#define TEST_DESC "Sensor request sensor update notification check" + +#define MAX_PARAMETER_SIZE 1 + +uint32_t sensor_request_sensor_notification_check(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 parameters[MAX_PARAMETER_SIZE], sensor_id; + uint32_t notification_support; + uint32_t notify_enable; + uint32_t num_sensors, sensor_state; + + num_sensors = val_sensor_get_info(NUM_SENSORS); + if (num_sensors == 0) { + val_print(VAL_PRINT_ERR, "\n No Sensor found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM SENSORS : %d", num_sensors); + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Request sensor notification update if supported */ + for (sensor_id = 0; sensor_id < num_sensors; sensor_id++) + { + val_print(VAL_PRINT_DEBUG, "\n Sensor id : %d", sensor_id); + + /* Check sensor update notification is supported. */ + notification_support = val_sensor_ext_get_desc_info(SENSOR_CONT_NOTIFY_UPDATE_SUPPORT, + sensor_id); + if (val_compare("Sensor notification support enabled", notification_support, ENABLED) + == VAL_STATUS_FAIL) + { + val_print(VAL_PRINT_TEST, "\n [Check 2] Notification for unsupported sensor"); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONTINUOUS_UPDATE_NOTIFY, + COMMAND_MSG); + + parameters[param_count++] = sensor_id; + notify_enable = val_get_notify_enable_config(ENABLED); + parameters[param_count++] = notify_enable; + + val_send_message(cmd_msg_hdr, param_count, parameters, &rsp_msg_hdr, &status, + &return_value_count, return_values); + + 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) + return VAL_STATUS_FAIL; + + val_print_return_values(return_value_count, return_values); + + continue; + } + + /* Check sensor state is enabled */ + sensor_state = val_sensor_ext_get_desc_info(SENSOR_STATE, sensor_id); + if (val_compare("Sensor state enabled", sensor_state, ENABLED) + == VAL_STATUS_FAIL) + continue; + + val_print(VAL_PRINT_TEST, "\n [Check 1] Sensor request update notification"); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONTINUOUS_UPDATE_NOTIFY, + COMMAND_MSG); + + parameters[param_count++] = sensor_id; + notify_enable = val_get_notify_enable_config(ENABLED); + parameters[param_count++] = notify_enable; + + val_send_message(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; + + 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); + + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/sensor/test_m025.c b/test_pool/sensor/test_m025.c new file mode 100755 index 0000000..f2b7984 --- /dev/null +++ b/test_pool/sensor/test_m025.c @@ -0,0 +1,64 @@ +/** @file + * Copyright (c) 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_sensor.h" + +#define TEST_NUM (SCMI_SENSOR_TEST_NUM_BASE + 19) +#define TEST_DESC "Sensor request update notification for invalid sensor ID" + +#define MAX_PARAMETER_SIZE 2 + +uint32_t sensor_request_notification_invalid_id_check(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 parameters[MAX_PARAMETER_SIZE], sensor_id; + uint32_t notify_enable; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Reading sensor value for invalid sensor should fail */ + sensor_id = val_sensor_get_info(NUM_SENSORS) + 1; + val_print(VAL_PRINT_TEST, "\n [Check 1] Send request for invalid sensor id : %d", + sensor_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_SENSOR, SENSOR_CONTINUOUS_UPDATE_NOTIFY, + COMMAND_MSG); + + parameters[param_count++] = sensor_id; + notify_enable = val_get_notify_enable_config(ENABLED); + parameters[param_count++] = notify_enable; + + 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_NOT_FOUND) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/Makefile b/test_pool/voltage/Makefile new file mode 100755 index 0000000..4d2124d --- /dev/null +++ b/test_pool/voltage/Makefile @@ -0,0 +1,18 @@ +#/** @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. +#**/ + +include ${TOP}/test_pool/build_protocol.mk diff --git a/test_pool/voltage/test_v001.c b/test_pool/voltage/test_v001.c new file mode 100755 index 0000000..ed0c6e4 --- /dev/null +++ b/test_pool/voltage/test_v001.c @@ -0,0 +1,63 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_base.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 1) +#define TEST_DESC "Voltage protocol version check " +#define RETURN_VALUE_COUNT 1 + +uint32_t voltage_query_protocol_version(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 *parameters; + uint32_t version; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Query the implemented protocol version of voltage protocol */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Query protocol version"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters = NULL; /* No parameters for this command */ + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_PROTOCOL_VERSION, 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_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 (return_value_count != RETURN_VALUE_COUNT) + return VAL_STATUS_FAIL; + + version = return_values[VERSION_OFFSET]; + val_print(VAL_PRINT_ERR, "\n PROTOCOL VERSION : 0x%08x ", version); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v002.c b/test_pool/voltage/test_v002.c new file mode 100755 index 0000000..8078c8b --- /dev/null +++ b/test_pool/voltage/test_v002.c @@ -0,0 +1,74 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 2) +#define TEST_DESC "Voltage protocol attributes check " + +#define RETURN_VALUE_COUNT 1 + +uint32_t voltage_query_protocol_attributes(void) +{ + size_t param_count; + uint32_t rsp_msg_hdr; + uint32_t cmd_msg_hdr; + size_t return_value_count; + int32_t status; + uint32_t *parameters; + uint32_t return_values[MAX_RETURNS_SIZE]; + uint32_t attributes, num_domains; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Query Voltage protocol and check for number of domains */ + val_print(VAL_PRINT_TEST, "\n [Check1] Query Protocol attributes"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters = NULL; /* No parameters for this command */ + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_PROTOCOL_ATTRIBUTES, 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_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, 16, 31) != VAL_STATUS_PASS)) + return VAL_STATUS_FAIL; + + if (val_compare_return_count(return_value_count, RETURN_VALUE_COUNT)) + return VAL_STATUS_FAIL; + + /* Save the number of returned voltaged domains. */ + num_domains = VAL_EXTRACT_BITS(attributes, 0, 15); + + if (val_compare("NUM DOMAINS", num_domains, val_voltage_get_expected_num_domains())) + return VAL_STATUS_FAIL; + + val_voltage_save_info(NUM_VOLTAGE_DOMAINS, 0x0, num_domains); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v003.c b/test_pool/voltage/test_v003.c new file mode 100755 index 0000000..0a449f8 --- /dev/null +++ b/test_pool/voltage/test_v003.c @@ -0,0 +1,82 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 3) +#define TEST_DESC "Voltage msg attributes mandatory cmd check " + +uint32_t voltage_query_mandatory_command_support(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 message_id; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Mandatory cmd VOLTAGE_DOMAIN_ATTRIBUTES should be supported */ + val_print(VAL_PRINT_TEST, "\n [Check 1] VOLTAGE DOMAIN ATTRIBUTES support"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + message_id = VOLTAGE_DOMAIN_ATTRIBUTES; + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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; + + /* Mandatory cmd voltage describe levels should be supported */ + val_print(VAL_PRINT_TEST, "\n [Check 2] VOLTAGE Describe levels support"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + message_id = VOLTAGE_DESCRIBE_LEVELS; + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v004.c b/test_pool/voltage/test_v004.c new file mode 100755 index 0000000..ac5033a --- /dev/null +++ b/test_pool/voltage/test_v004.c @@ -0,0 +1,75 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 4) +#define TEST_DESC "Voltage msg attributes invalid msg id check " + +uint32_t voltage_invalid_messageid_call(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 *parameters; + uint32_t message_id; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Sending invalid voltage protocol cmd should fail */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Invalid command invocation"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters = NULL; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_INVALID_COMMAND, 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_NOT_FOUND) != 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); + + /* Query support for invalid voltage protocol command should return status NOT_FOUND */ + val_print(VAL_PRINT_TEST, "\n [Check 2] Query undefined command support"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + message_id = VOLTAGE_INVALID_COMMAND; + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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_NOT_FOUND) != 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); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v005.c b/test_pool/voltage/test_v005.c new file mode 100755 index 0000000..aff9d34 --- /dev/null +++ b/test_pool/voltage/test_v005.c @@ -0,0 +1,77 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define NAME_OFFSET 1 + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 5) +#define TEST_DESC "Voltage domain attributes check " + +uint32_t voltage_query_domain_attributes(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 domain_id, num_domains, attribute; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Skip if no domains found*/ + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0x0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n NUM DOMAINS : %d", num_domains); + + /* Check voltage domain attributes for valid domain */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + val_print(VAL_PRINT_TEST, "\n VOLTAGE DOMAIN : %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Query attributes"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + param_count++; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_DOMAIN_ATTRIBUTES, COMMAND_MSG); + 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_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); + + attribute = return_values[ATTRIBUTE_OFFSET]; + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(attribute, 0, 31)) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + if (val_compare_str("DOMAIN NAME", (char *)&return_values[NAME_OFFSET], + (char *)val_voltage_get_expected_name(domain_id), SCMI_NAME_STR_SIZE)) + return VAL_STATUS_FAIL; + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v006.c b/test_pool/voltage/test_v006.c new file mode 100755 index 0000000..251ae4f --- /dev/null +++ b/test_pool/voltage/test_v006.c @@ -0,0 +1,56 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 6) +#define TEST_DESC "Domain attributes invalid domain id check " + +uint32_t voltage_query_domain_attributes_invalid_id(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 domain_id; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + domain_id = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0x0) + 1; + + /* Check voltage domain attributes for invalid domain */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Query attributes for invalid domain_id: %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_VOLTAGE, VOLTAGE_DOMAIN_ATTRIBUTES, COMMAND_MSG); + 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) + return VAL_STATUS_FAIL; + + if (val_compare_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v007.c b/test_pool/voltage/test_v007.c new file mode 100755 index 0000000..4498bfa --- /dev/null +++ b/test_pool/voltage/test_v007.c @@ -0,0 +1,163 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 7) +#define TEST_DESC "Voltage describe levels check " + +#define PARAMETER_SIZE 2 + +uint32_t voltage_query_describe_levels(void) +{ + int32_t status, i; + uint32_t rsp_msg_hdr; + uint32_t cmd_msg_hdr; + size_t param_count; + uint32_t parameters[PARAMETER_SIZE]; + size_t return_value_count; + uint32_t return_values[MAX_RETURNS_SIZE]; + uint32_t num_domains, domain_id; + 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; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage Domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n Voltage Domains: %d", num_domains); + + /* Check Voltage describe level for valid voltage domains */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + num_remaining_levels = 0; + level_index = 0; + voltage_index = 0; + + val_print(VAL_PRINT_TEST, "\n Voltage Domain : %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Query Voltage levels"); + + /* Get level of voltage supported by domain until, all voltage level + details are received */ + do { + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_DESCRIBE_LEVELS, + COMMAND_MSG); + + parameters[param_count++] = domain_id; + level_index += num_remaining_levels; + parameters[param_count++] = level_index; + + val_send_message(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; + + 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); + + levels_flag = return_values[LEVEL_FLAG_OFFSET]; + + num_remaining_levels = VAL_EXTRACT_BITS(levels_flag, 16, 31); + val_print(VAL_PRINT_DEBUG, "\n Remain Levels : %d", num_remaining_levels); + + if (val_reserved_bits_check_is_zero(VAL_EXTRACT_BITS(levels_flag, 13, 15)) != + VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + levels_return_format = VAL_EXTRACT_BITS(levels_flag, 12, 12); + val_print(VAL_PRINT_DEBUG, "\n Return format : %d", levels_return_format); + val_voltage_save_info(VOLTAGE_LEVEL_FORMAT, domain_id, levels_return_format); + + num_levels_retured = VAL_EXTRACT_BITS(levels_flag, 0, 11); + val_print(VAL_PRINT_DEBUG, "\n LEVELS RETURN : %d", num_levels_retured); + + /* Level array/triplet starts from return_values[1]*/ + voltage_array = &return_values[LEVEL_ARRAY_OFFSET]; + + /* Verify only 3 values are returned in case level return format is triplet */ + if (levels_return_format == LEVEL_FORMAT_TRIPLET) + { + val_print(VAL_PRINT_TEST, "\n [Check 2] Verify triplet return format", + domain_id); + if (num_levels_retured != 3 || num_remaining_levels != 0) + return VAL_STATUS_FAIL; + + start_voltage = voltage_array[LEVEL_START_OFFSET]; + val_voltage_save_info(VOLTAGE_LEVEL_START, domain_id, start_voltage); + val_print(VAL_PRINT_DEBUG, "\n START VOLTAGE : 0x%08X", start_voltage); + + end_voltage = voltage_array[LEVEL_END_OFFSET]; + val_voltage_save_info(VOLTAGE_LEVEL_END, domain_id, end_voltage); + val_print(VAL_PRINT_DEBUG, "\n END VOLTAGE : 0x%08X", end_voltage); + + step_size = voltage_array[LEVEL_STEP_OFFSET]; + val_voltage_save_info(VOLTAGE_STEP_SIZE, domain_id, step_size); + val_print(VAL_PRINT_DEBUG, "\n STEP SIZE : 0x%08X ", + step_size); + } + /* Save voltage level arrays */ + else + { + for (i = 0; i < num_levels_retured; i++) + { + val_print(VAL_PRINT_DEBUG, "\n Voltage Index : %d", voltage_index); + + voltage = voltage_array[i]; + voltage_index++; + val_voltage_save_level(domain_id, voltage_index, voltage); + val_print(VAL_PRINT_DEBUG, "\n Voltage : %d ", + voltage); + } + } + + } while (num_remaining_levels > 0); + + /* Check Voltage levels for invalid index values. */ + + if (levels_return_format == LEVEL_FORMAT_TRIPLET) + continue; /* Ignore index for triplet return values */ + + /* Voltage describe level for invalid level index */ + level_index = level_index + num_levels_retured + 1; + val_print(VAL_PRINT_TEST, "\n [Check 3] Query with invalid index: %d", level_index); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + parameters[param_count++] = level_index; /*Invalid level index*/ + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_DESCRIBE_LEVELS, 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_OUT_OF_RANGE) != 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; + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v008.c b/test_pool/voltage/test_v008.c new file mode 100755 index 0000000..56d1618 --- /dev/null +++ b/test_pool/voltage/test_v008.c @@ -0,0 +1,58 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 8) +#define TEST_DESC "Voltage describe level invalid domain id check " + +#define PARAMETER_SIZE 2 + +uint32_t voltage_query_describe_level_invalid_voltage_id(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 voltage_id; + uint32_t parameters[PARAMETER_SIZE]; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Check Voltage describe rate for invalid clocks */ + voltage_id = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0) + 1; + val_print(VAL_PRINT_TEST, "\n [Check 1] Query with invalid voltage id: %d", voltage_id); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = voltage_id; + parameters[param_count++] = 0; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_DESCRIBE_LEVELS, 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_NOT_FOUND) != 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; + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v009.c b/test_pool/voltage/test_v009.c new file mode 100755 index 0000000..90ef022 --- /dev/null +++ b/test_pool/voltage/test_v009.c @@ -0,0 +1,79 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 9) +#define TEST_DESC "Voltage set operating mode " + +#define PARAMETER_SIZE 2 + +uint32_t voltage_set_operating_mode(void) +{ + size_t param_count; + uint32_t rsp_msg_hdr; + uint32_t cmd_msg_hdr; + size_t return_value_count; + int32_t status; + uint32_t parameters[PARAMETER_SIZE]; + uint32_t return_values[MAX_RETURNS_SIZE]; + uint32_t domain_id = 0; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + /* Set Architectural operating mode for valid voltage domain */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Set architectural operating mode"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + parameters[param_count++] = val_voltage_operating_mode_create(ARCHITECTURAL_MODE, 0); + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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_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); + + /* Set Implementation defined operating mode for valid voltage domain */ + val_print(VAL_PRINT_TEST, "\n [Check 2] Set implementation operating mode"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + parameters[param_count++] = val_voltage_operating_mode_create(IMPLEMENTATION_DEFINED, 0); + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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_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); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v010.c b/test_pool/voltage/test_v010.c new file mode 100755 index 0000000..eb716ae --- /dev/null +++ b/test_pool/voltage/test_v010.c @@ -0,0 +1,81 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define PARAMETER_SIZE 3 + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 10) +#define TEST_DESC "Voltage set operating mode invalid id " + +uint32_t voltage_invalid_domain_set_operating_mode(void) +{ + size_t param_count; + uint32_t rsp_msg_hdr; + uint32_t cmd_msg_hdr; + size_t return_value_count; + int32_t status; + uint32_t parameters[PARAMETER_SIZE]; + uint32_t return_values[MAX_RETURNS_SIZE]; + uint32_t domain_id; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + domain_id = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0) + 1; + + /* Set Architectural operating mode for valid voltage domain */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Set architectural operating mode"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + parameters[param_count++] = val_voltage_operating_mode_create(ARCHITECTURAL_MODE, 0); + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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_status(status, SCMI_NOT_FOUND) != 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); + + /* Set Implementation defined operating mode for valid voltage domain */ + val_print(VAL_PRINT_TEST, "\n [Check 2] Set implementation operating mode"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + parameters[param_count++] = val_voltage_operating_mode_create(IMPLEMENTATION_DEFINED, 0); + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_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_status(status, SCMI_NOT_FOUND) != 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); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v011.c b/test_pool/voltage/test_v011.c new file mode 100755 index 0000000..44f4ce4 --- /dev/null +++ b/test_pool/voltage/test_v011.c @@ -0,0 +1,105 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 11) +#define TEST_DESC "Voltage get operating mode " + +#define RETURN_VALUE_COUNT 1 +#define PARAMETER_SIZE 2 + +uint32_t voltage_query_config_operating_mode(void) +{ + size_t param_count; + uint32_t rsp_msg_hdr; + uint32_t cmd_msg_hdr; + size_t return_value_count; + int32_t status; + uint32_t parameters[PARAMETER_SIZE]; + uint32_t return_values[MAX_RETURNS_SIZE]; + uint32_t attributes, num_domains, domain_id, voltage_config; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage Domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n Voltage Domains: %d", num_domains); + + /* Check Voltage config for valid voltage domains */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + /* Query Configuration of a voltage domain */ + val_print(VAL_PRINT_TEST, "\n Voltage ID : %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Check1] Query voltage config set"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_CONFIG_GET, 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_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, 4, 31) != VAL_STATUS_PASS)) + return VAL_STATUS_FAIL; + + if (val_compare_return_count(return_value_count, RETURN_VALUE_COUNT)) + return VAL_STATUS_FAIL; + + /* Get the voltage configuration set for domain ID */ + voltage_config = VAL_EXTRACT_BITS(attributes, 0, 3); + val_print(VAL_PRINT_TEST, "\n Voltage config : %d", voltage_config); + + val_voltage_save_info(VOLTAGE_DOMAIN_CONFIG, domain_id, voltage_config); + } + + /* Check voltage config for non valid domains */ + domain_id = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0) + 2; + + val_print(VAL_PRINT_TEST, "\n [Check 2] Query Voltage config for invalid domains"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_CONFIG_GET, 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_NOT_FOUND) != 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); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v012.c b/test_pool/voltage/test_v012.c new file mode 100755 index 0000000..4c064c1 --- /dev/null +++ b/test_pool/voltage/test_v012.c @@ -0,0 +1,171 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 12) +#define TEST_DESC "Voltage set new voltage level " + +#define RETURN_VALUE_COUNT 1 +#define PARAMETER_SIZE 3 + +/********* TEST ALGO ******************** + * Get the current voltage level + * Find a new level from previously saved voltage levels for domain + * Set new level in voltage domain + * Get the voltge level and compare with set voltage value + * Restore the default voltage level +*****************************************/ + +uint32_t voltage_set_voltage_level(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 parameters[PARAMETER_SIZE]; + uint32_t num_domains, domain_id; + uint32_t level_index = 0, flags = 0; + uint32_t *voltage_array, start_voltage, default_voltage, voltage; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage Domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n Voltage Domains: %d", num_domains); + + /* Check Voltage describe level for valid voltage domains */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + /* STEP 1 : Get currently operational voltage. */ + val_print(VAL_PRINT_TEST, "\n Voltage ID : %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Step 1] Get Operational Voltage "); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_GET, 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_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); + + default_voltage = return_values[ATTRIBUTE_OFFSET]; + val_print(VAL_PRINT_TEST, "\n Voltage : 0x%08X", default_voltage); + + /* STEP 2 : Get first voltage level for domain. */ + val_print(VAL_PRINT_TEST, "\n [Step 2] Get allowed Voltage levels"); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_DESCRIBE_LEVELS, COMMAND_MSG); + + parameters[param_count++] = domain_id; + parameters[param_count++] = level_index; + + val_send_message(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; + + 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); + voltage_array = &return_values[LEVEL_ARRAY_OFFSET]; + start_voltage = voltage_array[LEVEL_START_OFFSET]; + val_print(VAL_PRINT_DEBUG, "\n START VOLTAGE : 0x%08X", start_voltage); + + /* STEP 3 : Set new voltage level for domain. */ + val_print(VAL_PRINT_TEST, "\n [Step 3] Set allowed Voltage levels"); + val_print(VAL_PRINT_TEST, "\n [Check 1] Set new voltage level in domain"); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_SET, COMMAND_MSG); + + parameters[param_count++] = domain_id; + parameters[param_count++] = flags; + parameters[param_count++] = start_voltage; + + val_send_message(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; + + 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); + + /* STEP 4 : query newly set voltage level for domain */ + val_print(VAL_PRINT_TEST, "\n [Step 4] Get newly set Voltage "); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_GET, 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_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); + + voltage = return_values[ATTRIBUTE_OFFSET]; + val_print(VAL_PRINT_TEST, "\n Voltage : 0x%08X", voltage); + + /* Check this is voltage we set in step 3. */ + if (val_compare("Voltage Level", voltage, start_voltage)) + return VAL_STATUS_FAIL; + + /* STEP 5 : Set default voltage level for domain */ + val_print(VAL_PRINT_TEST, "\n [Step 5] Set default Voltage levels"); + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_SET, COMMAND_MSG); + + parameters[param_count++] = domain_id; + parameters[param_count++] = flags; + parameters[param_count++] = default_voltage; + + val_send_message(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; + + 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); + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v013.c b/test_pool/voltage/test_v013.c new file mode 100755 index 0000000..43f898e --- /dev/null +++ b/test_pool/voltage/test_v013.c @@ -0,0 +1,72 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 13) +#define TEST_DESC "Voltage set voltage for invalid domain " + +#define RETURN_VALUE_COUNT 1 +#define PARAMETER_SIZE 3 + +uint32_t voltage_set_voltage_invalid_domain(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 num_domains; + uint32_t flags = 0; + uint32_t start_voltage = 0; + uint32_t parameters[PARAMETER_SIZE]; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage Domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n Voltage Domains: %d", num_domains); + + /* Set Voltage level for invalid voltage domains */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Set Voltage for invalid domain "); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + + /* Set invalid domain ID */ + parameters[param_count++] = num_domains + 1; + parameters[param_count++] = flags; + parameters[param_count++] = start_voltage; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_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_NOT_FOUND) != 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); + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v014.c b/test_pool/voltage/test_v014.c new file mode 100755 index 0000000..385a5e0 --- /dev/null +++ b/test_pool/voltage/test_v014.c @@ -0,0 +1,130 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 14) +#define TEST_DESC "Voltage set invalid voltage level " + +#define RETURN_VALUE_COUNT 1 +#define PARAMETER_SIZE 3 + +uint32_t voltage_set_invalid_voltage_level(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 parameters[PARAMETER_SIZE]; + uint32_t num_domains, domain_id, flags; + uint32_t levels_return_format; + uint32_t voltage_start, step_size, voltage_second; + uint32_t invalid_voltage; + + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage Domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n Voltage Domains: %d", num_domains); + + /* Get current Voltage level for valid voltage domains */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + /* Set Voltage level for invalid voltage domains */ + val_print(VAL_PRINT_TEST, "\n [Check 1] Set Voltage for invalid domain "); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + + /* Set domain ID */ + parameters[param_count++] = domain_id; + + /* Set flag values for voltage level */ + flags = 0; + parameters[param_count++] = flags; + + /* Set invalid voltage level in command */ + levels_return_format = val_voltage_get_info(VOLTAGE_LEVEL_FORMAT, domain_id); + + if (levels_return_format == LEVEL_FORMAT_TRIPLET) + { + voltage_start = val_voltage_get_info(VOLTAGE_LEVEL_START, domain_id); + step_size = val_voltage_get_info(VOLTAGE_STEP_SIZE, domain_id); + invalid_voltage = voltage_start - step_size; + } + /* Levels were in array format. */ + else + { + voltage_start = val_voltage_get_level(domain_id, START_LEVEL_INDEX); + voltage_second = val_voltage_get_level(domain_id, SECOND_LEVEL_INDEX); + + step_size = voltage_second - voltage_start; + invalid_voltage = voltage_start - step_size; + } + + val_print(VAL_PRINT_TEST, "\n Setting voltage values : 0x%08X", invalid_voltage); + parameters[param_count++] = invalid_voltage; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_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_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print_return_values(return_value_count, return_values); + + /* Set Voltage level for invalid flag */ + val_print(VAL_PRINT_TEST, "\n [Check 2] Set Voltage with invalid flag"); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + + /* Set domain ID */ + parameters[param_count++] = domain_id; + + /* Set flag values for voltage level */ + flags = 1; + parameters[param_count++] = flags; + + val_print(VAL_PRINT_TEST, "\n Setting voltage values : 0x%08X", invalid_voltage); + parameters[param_count++] = voltage_start; + + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_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_msg_hdr(cmd_msg_hdr, rsp_msg_hdr) != VAL_STATUS_PASS) + return VAL_STATUS_FAIL; + + val_print_return_values(return_value_count, return_values); + } + + return VAL_STATUS_PASS; +} diff --git a/test_pool/voltage/test_v015.c b/test_pool/voltage/test_v015.c new file mode 100755 index 0000000..1ff8cca --- /dev/null +++ b/test_pool/voltage/test_v015.c @@ -0,0 +1,92 @@ +/** @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. +**/ + +#include "val_interface.h" +#include "val_voltage.h" + +#define PARAMETER_SIZE 2 + +#define TEST_NUM (SCMI_VOLTAGE_TEST_NUM_BASE + 15) +#define TEST_DESC "Voltage get current level " + +#define RETURN_VALUE_COUNT 1 + +uint32_t voltage_query_current_level(void) +{ + size_t param_count; + uint32_t rsp_msg_hdr; + uint32_t cmd_msg_hdr; + size_t return_value_count; + int32_t status; + uint32_t parameters[PARAMETER_SIZE]; + uint32_t return_values[MAX_RETURNS_SIZE]; + uint32_t num_domains, domain_id, voltage; + + if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) + return VAL_STATUS_SKIP; + + num_domains = val_voltage_get_info(NUM_VOLTAGE_DOMAINS, 0); + if (num_domains == 0) { + val_print(VAL_PRINT_ERR, "\n No Voltage Domains found "); + return VAL_STATUS_SKIP; + } + val_print(VAL_PRINT_DEBUG, "\n Voltage Domains: %d", num_domains); + + /* Get current Voltage level for valid voltage domains */ + for (domain_id = 0; domain_id < num_domains; domain_id++) + { + val_print(VAL_PRINT_TEST, "\n Voltage ID : %d", domain_id); + val_print(VAL_PRINT_TEST, "\n [Check 1] Get Operational Voltage "); + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_GET, 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_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); + + voltage = return_values[ATTRIBUTE_OFFSET]; + val_print(VAL_PRINT_TEST, "\n Voltage : 0x%08X", voltage); + val_voltage_save_info(OPERATIONAL_VOLTAGE, domain_id, voltage); + } + + /* Check for invalid domain IDs. */ + val_print(VAL_PRINT_TEST, "\n [Check 2] Get Voltage for Invalid Domain "); + domain_id = num_domains + 1; + + VAL_INIT_TEST_PARAM(param_count, rsp_msg_hdr, return_value_count, status); + parameters[param_count++] = domain_id; + cmd_msg_hdr = val_msg_hdr_create(PROTOCOL_VOLTAGE, VOLTAGE_LEVEL_GET, 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_NOT_FOUND) != 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; + + return VAL_STATUS_PASS; +} diff --git a/val/include/pal_interface.h b/val/include/pal_interface.h index be7ef2e..f6de16d 100644 --- a/val/include/pal_interface.h +++ b/val/include/pal_interface.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -109,4 +109,9 @@ uint32_t pal_reset_get_expected_num_domains(void); uint8_t *pal_reset_get_expected_name(uint32_t domain_id); #endif +#ifdef VOLTAGE_PROTOCOL +uint32_t pal_voltage_get_expected_num_domains(void); +uint8_t *pal_voltage_get_expected_name(uint32_t domain_id); +#endif + #endif diff --git a/val/include/val_clock.h b/val/include/val_clock.h index b2efaca..0a9bca4 100644 --- a/val/include/val_clock.h +++ b/val/include/val_clock.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/val/include/val_interface.h b/val/include/val_interface.h index c6bf9e2..84d2dca 100644 --- a/val/include/val_interface.h +++ b/val/include/val_interface.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -24,6 +24,7 @@ #define PROTOCOL_VERSION_1 0x00010000 #define PROTOCOL_VERSION_2 0x00020000 +#define PROTOCOL_VERSION_3 0x00030000 #define SCMI_BASE_TEST_NUM_BASE 100 #define SCMI_POWER_DOMAIN_TEST_NUM_BASE 200 @@ -32,6 +33,21 @@ #define SCMI_CLOCK_TEST_NUM_BASE 500 #define SCMI_SENSOR_TEST_NUM_BASE 600 #define SCMI_RESET_TEST_NUM_BASE 700 +#define SCMI_VOLTAGE_TEST_NUM_BASE 800 + +#define BASE_PROTOCOL_VERSION_1 0x00010000 +#define BASE_PROTOCOL_VERSION_2 0x00020000 + +#define PERFORMANCE_PROTOCOL_VERSION_1 0x00010000 +#define PERFORMANCE_PROTOCOL_VERSION_2 0x00020000 + +#define RESET_PROTOCOL_VERSION_2 0x00020000 + +#define POWER_PROTOCOL_VERSION_2 0x00020000 +#define POWER_PROTOCOL_VERSION_2_1 0x00021000 + +#define SENSOR_PROTOCOL_VERSION_1 0x10000 +#define SENSOR_PROTOCOL_VERSION_2 0x20000 /* set PRINT_LEVEL to one of the below values in your application entry to control the verbosity of the prints */ @@ -87,6 +103,7 @@ typedef enum { PROTOCOL_CLOCK, PROTOCOL_SENSOR, PROTOCOL_RESET, + PROTOCOL_VOLTAGE, PROTOCOL_MAX } PROTOCOL_IDENTIFIER; @@ -318,7 +335,12 @@ typedef enum { SENSOR_TRIP_POINT_NOTIFY, SENSOR_TRIP_POINT_CONFIG, SENSOR_READING_GET, - SENSOR_INVALID_COMMAND + SENSOR_AXIS_DESCRIPTION_GET, + SENSOR_LIST_UPDATE_INTERVALS, + SENSOR_CONFIG_GET, + SENSOR_CONFIG_SET, + SENSOR_CONTINUOUS_UPDATE_NOTIFY, + SENSOR_INVALID_COMMAND, } SENSOR_COMMANDS; typedef enum { @@ -335,7 +357,12 @@ typedef enum { SENSOR_STATS_ADDR_HIGH, SENSOR_STATS_ADDR_LEN, SENSOR_NUM_OF_TRIP_POINTS, - SENSOR_ASYNC_READ_SUPPORT + SENSOR_ASYNC_READ_SUPPORT, + SENSOR_CONT_NOTIFY_UPDATE_SUPPORT, + SENSOR_TIMESTAMP_SUPPORT, + SENSOR_NUM_OF_AXIS, + SENSOR_AXIS_SUPPORT, + SENSOR_STATE, } SENSOR_INFO; void val_sensor_save_info(uint32_t param_identifier, uint32_t param_value); @@ -344,6 +371,11 @@ void val_sensor_save_desc_info(uint32_t param_identifier, uint32_t sensor_id, uint32_t param_value); uint32_t val_sensor_get_desc_info(uint32_t param_identifier, uint32_t sensor_id); uint32_t val_sensor_execute_tests(void); +void val_sensor_ext_save_desc_info(uint32_t param_identifier, uint32_t sensor_id, + uint32_t param_value); +uint32_t val_sensor_ext_get_desc_info(uint32_t param_identifier, uint32_t sensor_id); +uint32_t val_sensor_set_config(uint32_t update_interval, uint32_t update_interval_exp, + uint32_t round_up_down, uint32_t timestamp_reporting, uint32_t sensor_state); /* Reset protocol defines & APIs*/ @@ -375,4 +407,36 @@ void val_reset_save_info(uint32_t param_identifier, uint32_t domain_id, uint32_t uint32_t val_reset_get_info(uint32_t param_identifier, uint32_t domain_id); uint32_t val_reset_execute_tests(void); +/* VOLTAGE VAL APIs */ + +typedef enum { + VOLTAGE_PROTOCOL_VERSION = 0x0, + VOLTAGE_PROTOCOL_ATTRIBUTES, + VOLTAGE_PROTOCOL_MESSAGE_ATTRIBUTES, + VOLTAGE_DOMAIN_ATTRIBUTES, + VOLTAGE_DESCRIBE_LEVELS, + VOLTAGE_CONFIG_SET, + VOLTAGE_CONFIG_GET, + VOLTAGE_LEVEL_SET, + VOLTAGE_LEVEL_GET, + VOLTAGE_INVALID_COMMAND +} VOLTAGE_COMMANDS; + +typedef enum { + NUM_VOLTAGE_DOMAINS, + VOLTAGE_DOMAIN_CONFIG, + VOLTAGE_LEVEL_FORMAT, + VOLTAGE_LEVEL_START, + VOLTAGE_LEVEL_END, + VOLTAGE_STEP_SIZE, + OPERATIONAL_VOLTAGE +} VOLTAGE_INFO; + +uint32_t val_voltage_execute_tests(void); +void val_voltage_save_info(uint32_t param_identifier, uint32_t domain_id, uint32_t param_value); +void val_voltage_save_level(uint32_t domain_id, uint32_t level_index, uint32_t voltage); +uint32_t val_voltage_get_level(uint32_t domain_id, uint32_t level_index); +uint32_t val_voltage_get_info(uint32_t param_identifier, uint32_t domain_id); +uint32_t val_voltage_operating_mode_create(uint32_t mode_type, uint32_t mode_id); + #endif diff --git a/val/include/val_power_domain.h b/val/include/val_power_domain.h index 33d788d..7557be9 100644 --- a/val/include/val_power_domain.h +++ b/val/include/val_power_domain.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -63,10 +63,13 @@ 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_invalid_domain_check(void); -/* v2 Tests */ +/* scmi v2 Tests */ uint32_t power_domain_power_state_change_requested_notify_check(void); uint32_t power_domain_power_state_change_requested_notify_invalid_domain_check(void); +/* scmi v3 Tests */ +uint32_t power_domain_query_domain_attributes_scmi_v3(void); + uint32_t val_power_get_expected_num_domains(void); uint32_t val_power_get_expected_stats_addr_low(void); uint32_t val_power_get_expected_stats_addr_high(void); diff --git a/val/include/val_reset.h b/val/include/val_reset.h index 39c5acc..2f4d02c 100644 --- a/val/include/val_reset.h +++ b/val/include/val_reset.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -60,6 +60,9 @@ uint32_t reset_query_reset_command_invalid_reset_state(void); uint32_t reset_query_notify_invalid_id(void); uint32_t reset_query_invalid_notify_enable(void); +/* scmi v3 Tests */ +uint32_t reset_query_domain_attributes_scmi_v3(void); + uint32_t val_reset_get_expected_num_domains(void); uint8_t *val_reset_get_expected_name(uint32_t domain_id); diff --git a/val/include/val_sensor.h b/val/include/val_sensor.h index 586c84e..8e18038 100644 --- a/val/include/val_sensor.h +++ b/val/include/val_sensor.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -29,6 +29,15 @@ #define DESC_OFFSET 1 #define SENSOR_VAL_LOW_OFFSET 0 #define SENSOR_VAL_HIGH_OFFSET 1 +#define NUM_AXIS_FLAG_OFFSET 0 +#define SENSOR_AXIS_DESC_OFFSET 1 +#define UPDATE_INTERVAL_FLAG_OFFSET 0 +#define INTERVAL_START_OFFSET 0 +#define INTERVAL_END_OFFSET 1 +#define INTERVAL_STEP_OFFSET 2 +#define LEVEL_ARRAY_OFFSET 1 +#define SENSOR_CONFIG_OFFSET 1 +#define SENSOR_STATE_OFFSET 0 #define DELAYED_RESP_SENSOR_ID_OFFSET 0 #define DELAYED_RESP_SENSOR_VAL_LOW_OFFSET 1 @@ -48,17 +57,36 @@ #define TRIP_POINT_CROSSED_EITHER_DIR 0x3 #define TRIP_POINT_ID_LOW 0x4 +typedef enum{ + LEVEL_FORMAT_ARRAY, + LEVEL_FORMAT_TRIPLET, +} SENSOR_UPDATE_INTERVAL_FORMAT; + +typedef enum{ + DISABLED, + ENABLED, +} SENSOR_STATES; + typedef struct { uint32_t num_trip_points; uint32_t async_read_support; } SENSOR_DESC_INFO_s; +typedef struct { + uint32_t cont_update_notify_support; + uint32_t timestamp_support; + uint32_t num_axis; + uint32_t axis_support; + uint32_t sensor_state; +} SENSOR_EXTEND_INFO_s; + typedef struct { uint32_t num_sensors; uint32_t sensor_stats_addr_low; uint8_t sensor_stats_addr_high; uint8_t sensor_stats_addr_len; SENSOR_DESC_INFO_s desc_info[MAX_NUM_OF_SENSORS]; + SENSOR_EXTEND_INFO_s ext_desc_info[MAX_NUM_OF_SENSORS]; } SENSOR_INFO_s; /* Common Tests */ @@ -77,10 +105,23 @@ uint32_t sensor_reading_get_invalid_id_check(void); uint32_t sensor_reading_get_sync_mode(void); uint32_t sensor_reading_get_async_mode(void); uint32_t sensor_reading_get_async_mode_not_supported(void); +uint32_t sensor_axis_description_check(void); +uint32_t sensor_axis_desc_invalid_id_check(void); +uint32_t sensor_supported_update_intervals_check(void); +uint32_t sensor_update_interval_invalid_id_check(void); +uint32_t sensor_read_configuration_check(void); +uint32_t sensor_read_configuration_invalid_id_check(void); +uint32_t sensor_set_configuration_check(void); +uint32_t sensor_set_configuration_invalid_id_check(void); +uint32_t sensor_request_sensor_notification_check(void); +uint32_t sensor_request_notification_invalid_id_check(void); + +uint32_t sensor_query_description_get_scmi_v3(void); uint32_t val_sensor_get_expected_num_sensors(void); uint32_t val_sensor_get_expected_stats_addr_low(void); uint32_t val_sensor_get_expected_stats_addr_high(void); uint32_t val_sensor_get_expected_stats_addr_len(void); +uint32_t val_get_notify_enable_config(uint32_t notify_enable_flag); #endif diff --git a/val/include/val_voltage.h b/val/include/val_voltage.h new file mode 100755 index 0000000..bff4bbc --- /dev/null +++ b/val/include/val_voltage.h @@ -0,0 +1,77 @@ +/** @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 __VAL_VOLTAGE_H__ +#define __VAL_VOLTAGE_H__ + +#define ATTRIBUTE_OFFSET 0 +#define LEVEL_FLAG_OFFSET 0 +#define LEVEL_ARRAY_OFFSET 1 +#define LEVEL_START_OFFSET 0 +#define LEVEL_END_OFFSET 1 +#define LEVEL_STEP_OFFSET 2 +#define START_LEVEL_INDEX 0 +#define SECOND_LEVEL_INDEX 1 + +#define MAX_NUM_OF_VOLTAGE_DOMAINS 32 +#define MAX_NUMBER_VOLTAGE_LEVELS 32 + +typedef enum { + ARCHITECTURAL_MODE, + IMPLEMENTATION_DEFINED +} VOLTAGE_OPERATING_MODE_TYPE; + +typedef enum{ + LEVEL_FORMAT_ARRAY, + LEVEL_FORMAT_TRIPLET +} VOLTAGE_LEVEL_RETURN_FORMAT; + +typedef struct { + uint32_t config; + uint32_t voltage_level_format; + uint32_t lowest_voltage_level; + uint32_t highest_voltage_level; + uint32_t step_voltage_level; + uint32_t voltage_array[MAX_NUMBER_VOLTAGE_LEVELS]; + uint32_t operational_voltage; +} VOLTAGE_DOMAIN_INFO_s; + +typedef struct { + uint32_t num_domains; + VOLTAGE_DOMAIN_INFO_s domain_info[MAX_NUM_OF_VOLTAGE_DOMAINS]; +} VOLTAGE_INFO_s; + +/* Common Tests */ +uint32_t voltage_query_protocol_version(void); +uint32_t voltage_query_protocol_attributes(void); +uint32_t voltage_query_mandatory_command_support(void); +uint32_t voltage_invalid_messageid_call(void); +uint32_t voltage_query_domain_attributes(void); +uint32_t voltage_query_domain_attributes_invalid_id(void); +uint32_t voltage_query_describe_levels(void); +uint32_t voltage_query_describe_level_invalid_voltage_id(void); +uint32_t voltage_set_operating_mode(void); +uint32_t voltage_invalid_domain_set_operating_mode(void); +uint32_t voltage_query_config_operating_mode(void); +uint32_t voltage_set_voltage_level(void); +uint32_t voltage_set_voltage_invalid_domain(void); +uint32_t voltage_set_invalid_voltage_level(void); +uint32_t voltage_query_current_level(void); + +uint32_t val_voltage_get_expected_num_domains(void); +uint8_t *val_voltage_get_expected_name(uint32_t domain_id); +#endif diff --git a/val/val_base.c b/val/val_base.c index 9e618f3..2a9e225 100644 --- a/val/val_base.c +++ b/val/val_base.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -41,15 +41,15 @@ uint32_t val_base_execute_tests(void) RUN_TEST(base_query_subvendor_info()); RUN_TEST(base_query_implementation_version()); RUN_TEST(base_query_protocol_list()); - if (version == PROTOCOL_VERSION_1) { + if (version == BASE_PROTOCOL_VERSION_1) { RUN_TEST(base_discover_agent_v1()); } - if (version == PROTOCOL_VERSION_2) { + if (version == BASE_PROTOCOL_VERSION_2) { RUN_TEST(base_discover_agent()); } RUN_TEST(base_query_notify_error_support()); - if (version == PROTOCOL_VERSION_2) { + if (version == BASE_PROTOCOL_VERSION_2) { RUN_TEST(base_set_device_permissions_check()); RUN_TEST(base_deny_restore_device_access()); RUN_TEST(base_set_protocol_permissions_check()); diff --git a/val/val_clock.c b/val/val_clock.c index 06741d0..7f561ae 100644 --- a/val/val_clock.c +++ b/val/val_clock.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/val/val_performance.c b/val/val_performance.c index a1a2154..dfe2d81 100644 --- a/val/val_performance.c +++ b/val/val_performance.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -38,13 +38,13 @@ uint32_t val_performance_execute_tests(void) RUN_TEST(performance_query_protocol_attributes()); - if (version == PROTOCOL_VERSION_1) { + if (version == PERFORMANCE_PROTOCOL_VERSION_1) { RUN_TEST(performance_query_mandatory_command_support_v1()); RUN_TEST(performance_invalid_messageid_call()); RUN_TEST(performance_query_domain_attributes_v1()); } - if (version == PROTOCOL_VERSION_2) { + if (version == PERFORMANCE_PROTOCOL_VERSION_2) { RUN_TEST(performance_query_mandatory_command_support()); RUN_TEST(performance_invalid_messageid_call()); RUN_TEST(performance_query_domain_attributes()); @@ -65,7 +65,7 @@ uint32_t val_performance_execute_tests(void) RUN_TEST(performance_query_notify_level_invalid_parameters()); RUN_TEST(performance_query_notify_level_invalid_domain()); - if (version == PROTOCOL_VERSION_2) { + if (version == PERFORMANCE_PROTOCOL_VERSION_2) { RUN_TEST(performance_query_describe_fast_channel()); RUN_TEST(performance_query_describe_fast_channel_invalid_domain()); RUN_TEST(performance_query_describe_fast_channel_invalid_message()); @@ -75,7 +75,7 @@ uint32_t val_performance_execute_tests(void) RUN_TEST(performance_limit_set_async()); RUN_TEST(performance_level_set_async()); - if (version == PROTOCOL_VERSION_2) { + if (version == PERFORMANCE_PROTOCOL_VERSION_2) { RUN_TEST(performance_level_get_fast_channel()); RUN_TEST(performance_limits_get_fast_channel()); } diff --git a/val/val_power_domain.c b/val/val_power_domain.c index c503f00..6a26cb7 100644 --- a/val/val_power_domain.c +++ b/val/val_power_domain.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -50,10 +50,13 @@ uint32_t val_power_domain_execute_tests(void) RUN_TEST(power_domain_power_state_notify_unspported_domain_check()); RUN_TEST(power_domain_power_state_notify_invalid_domain_check()); - if (version == PROTOCOL_VERSION_2) { + if (version == POWER_PROTOCOL_VERSION_2) { RUN_TEST(power_domain_power_state_change_requested_notify_check()); RUN_TEST(power_domain_power_state_change_requested_notify_invalid_domain_check()); } + if (version == POWER_PROTOCOL_VERSION_2_1) { + RUN_TEST(power_domain_query_domain_attributes_scmi_v3()); + } } else val_print(VAL_PRINT_ERR, "\n Calling agent have no access to POWER DOMAIN protocol"); diff --git a/val/val_reset.c b/val/val_reset.c index 2a418fd..8cd11fb 100644 --- a/val/val_reset.c +++ b/val/val_reset.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -46,6 +46,10 @@ uint32_t val_reset_execute_tests(void) RUN_TEST(reset_query_reset_command_invalid_reset_state()); RUN_TEST(reset_query_notify_invalid_id()); RUN_TEST(reset_query_invalid_notify_enable()); + + if (version == RESET_PROTOCOL_VERSION_2) { + RUN_TEST(reset_query_domain_attributes_scmi_v3()); + } } else val_print(VAL_PRINT_ERR, "\n Calling agent have no access to RESET protocol"); diff --git a/val/val_sensor.c b/val/val_sensor.c index 8e5ce18..cb21373 100644 --- a/val/val_sensor.c +++ b/val/val_sensor.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -39,7 +39,6 @@ uint32_t val_sensor_execute_tests(void) RUN_TEST(sensor_query_protocol_attributes()); RUN_TEST(sensor_query_mandatory_command_support()); RUN_TEST(sensor_invalid_messageid_call()); - RUN_TEST(sensor_query_description_get()); RUN_TEST(sensor_trip_point_nfy_event_ctrl_check()); RUN_TEST(sensor_trip_point_nfy_invalid_id_check()); RUN_TEST(sensor_trip_point_config_invalid_param_check()); @@ -50,6 +49,23 @@ uint32_t val_sensor_execute_tests(void) RUN_TEST(sensor_reading_get_sync_mode()); RUN_TEST(sensor_reading_get_async_mode()); RUN_TEST(sensor_reading_get_async_mode_not_supported()); + + if (version == SENSOR_PROTOCOL_VERSION_1) + RUN_TEST(sensor_query_description_get()); + + if (version == SENSOR_PROTOCOL_VERSION_2) { + RUN_TEST(sensor_query_description_get_scmi_v3()); + RUN_TEST(sensor_axis_description_check()); + RUN_TEST(sensor_axis_desc_invalid_id_check()); + RUN_TEST(sensor_supported_update_intervals_check()); + RUN_TEST(sensor_update_interval_invalid_id_check()); + RUN_TEST(sensor_read_configuration_check()); + RUN_TEST(sensor_read_configuration_invalid_id_check()); + RUN_TEST(sensor_set_configuration_check()); + RUN_TEST(sensor_set_configuration_invalid_id_check()); + RUN_TEST(sensor_request_sensor_notification_check()); + RUN_TEST(sensor_request_notification_invalid_id_check()); + } } else val_print(VAL_PRINT_ERR, "\n Calling agent have no access to SENSOR protocol"); @@ -210,4 +226,111 @@ uint32_t val_sensor_get_expected_stats_addr_len(void) return pal_sensor_get_expected_stats_addr_len(); } +/** + @brief This API is used to set extended sensor protocol info + 1. Caller - Test Suite. + 2. Prerequisite - Sensor protocol info table. + @param param_identifier id of parameter which will be set + @param sensor_id Sensor id + @param param_value value of parameter + @return none +**/ +void val_sensor_ext_save_desc_info(uint32_t param_identifier, uint32_t sensor_id, uint32_t param_value) +{ + switch (param_identifier) + { + case SENSOR_CONT_NOTIFY_UPDATE_SUPPORT: + g_sensor_info_table.ext_desc_info[sensor_id].cont_update_notify_support = param_value; + break; + case SENSOR_TIMESTAMP_SUPPORT: + g_sensor_info_table.ext_desc_info[sensor_id].timestamp_support = param_value; + break; + case SENSOR_NUM_OF_AXIS: + g_sensor_info_table.ext_desc_info[sensor_id].num_axis = param_value; + break; + case SENSOR_AXIS_SUPPORT: + g_sensor_info_table.ext_desc_info[sensor_id].axis_support = param_value; + break; + case SENSOR_STATE: + g_sensor_info_table.ext_desc_info[sensor_id].sensor_state = param_value; + break; + default: + val_print(VAL_PRINT_ERR, "\nUnidentified parameter %d", param_identifier); + } +} + +/** + @brief This API is used to get extended sensor protocol info + 1. Caller - Test Suite. + 2. Prerequisite - Sensor protocol info table. + @param param_identifier id of parameter which will be set + @param sensor_id Sensor id + @return param_value value of the parameter +**/ +uint32_t val_sensor_ext_get_desc_info(uint32_t param_identifier, uint32_t sensor_id) +{ + uint32_t param_value = 0; + switch (param_identifier) + { + case SENSOR_CONT_NOTIFY_UPDATE_SUPPORT: + param_value = g_sensor_info_table.ext_desc_info[sensor_id].cont_update_notify_support; + break; + case SENSOR_TIMESTAMP_SUPPORT: + param_value = g_sensor_info_table.ext_desc_info[sensor_id].timestamp_support; + break; + case SENSOR_NUM_OF_AXIS: + param_value = g_sensor_info_table.ext_desc_info[sensor_id].num_axis; + break; + case SENSOR_AXIS_SUPPORT: + param_value = g_sensor_info_table.ext_desc_info[sensor_id].axis_support; + break; + case SENSOR_STATE: + param_value = g_sensor_info_table.ext_desc_info[sensor_id].sensor_state; + break; + default: + val_print(VAL_PRINT_ERR, "\nUnidentified parameter %d", param_identifier); + } + + return param_value; +} + +/** + @brief This API is used to get sensor state + 1. Caller - Test Suite. + @param update_interval Sensor update interval + @param update_interval_exp Sensor update interval exponent + @param round_up_down round up/down config + @param timestamp_reporting Sensor timestamp reporting config + @param sensor_state sensor state + @return param_value sensor configuration +**/ +uint32_t val_sensor_set_config(uint32_t update_interval, uint32_t update_interval_exp, + uint32_t round_up_down, uint32_t timestamp_reporting, + uint32_t sensor_state) +{ + uint32_t sensor_config = 0; + sensor_config = sensor_config | (update_interval << 16); + sensor_config = sensor_config | (update_interval_exp << 11); + sensor_config = sensor_config | (round_up_down << 9); + + sensor_config = sensor_config | (timestamp_reporting << 1); + sensor_config = sensor_config | (sensor_state); + + return sensor_config; +} + +/** + @brief This API is used to get notify enable config + 1. Caller - Test Suite. + @param enable config flag Enable config flag value + @return enable config Enable config +**/ +uint32_t val_get_notify_enable_config(uint32_t notify_enable_flag) +{ + uint32_t notify_enable_config = 0; + notify_enable_config = notify_enable_config | notify_enable_flag; + + return notify_enable_config; +} + #endif diff --git a/val/val_voltage.c b/val/val_voltage.c new file mode 100755 index 0000000..9bb19fa --- /dev/null +++ b/val/val_voltage.c @@ -0,0 +1,197 @@ +/** @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 VOLTAGE_PROTOCOL + +#include "val_interface.h" +#include "val_voltage.h" + +static VOLTAGE_INFO_s g_voltage_info_table; + +/** + @brief This API is called from app layer to execute voltage tests + @param none + @return test execution result +**/ +uint32_t val_voltage_execute_tests(void) +{ + if (val_agent_check_protocol_support(PROTOCOL_VOLTAGE)) { + if (RUN_TEST(voltage_query_protocol_version())) + return VAL_STATUS_FAIL; + + RUN_TEST(voltage_query_protocol_attributes()); + RUN_TEST(voltage_query_mandatory_command_support()); + RUN_TEST(voltage_invalid_messageid_call()); + RUN_TEST(voltage_query_domain_attributes()); + RUN_TEST(voltage_query_domain_attributes_invalid_id()); + RUN_TEST(voltage_query_describe_levels()); + RUN_TEST(voltage_query_describe_level_invalid_voltage_id()); + RUN_TEST(voltage_set_operating_mode()); + RUN_TEST(voltage_invalid_domain_set_operating_mode()); + RUN_TEST(voltage_query_config_operating_mode()); + RUN_TEST(voltage_set_voltage_level()); + RUN_TEST(voltage_set_voltage_invalid_domain()); + RUN_TEST(voltage_set_invalid_voltage_level()); + RUN_TEST(voltage_query_current_level()); + + } + else + val_print(VAL_PRINT_ERR, "\n Calling agent have no access to Voltage protocol"); + + return VAL_STATUS_PASS; +} + + +/** + @brief This API is used for checking num of voltage domain + @param none + @return num of voltage domain +**/ +uint32_t val_voltage_get_expected_num_domains(void) +{ + return pal_voltage_get_expected_num_domains(); +} + +/** + @brief This API is used to set voltage protocol info + 1. Caller - Test Suite. + 2. Prerequisite - Voltage protocol info table. + @param param_identifier id of parameter which will be set + @param domain_id voltage domain ID. + @param param_value value of parameter + @return none +**/ +void val_voltage_save_info(uint32_t param_identifier, uint32_t domain_id, uint32_t param_value) +{ + switch (param_identifier) + { + case NUM_VOLTAGE_DOMAINS: + g_voltage_info_table.num_domains = param_value; + break; + case VOLTAGE_DOMAIN_CONFIG: + g_voltage_info_table.domain_info[domain_id].config = param_value; + break; + case VOLTAGE_LEVEL_FORMAT: + g_voltage_info_table.domain_info[domain_id].voltage_level_format = param_value; + break; + case VOLTAGE_LEVEL_START: + g_voltage_info_table.domain_info[domain_id].lowest_voltage_level = param_value; + break; + case VOLTAGE_LEVEL_END: + g_voltage_info_table.domain_info[domain_id].highest_voltage_level = param_value; + break; + case VOLTAGE_STEP_SIZE: + g_voltage_info_table.domain_info[domain_id].highest_voltage_level = param_value; + break; + case OPERATIONAL_VOLTAGE: + g_voltage_info_table.domain_info[domain_id].operational_voltage = param_value; + break; + default: + val_print(VAL_PRINT_ERR, "\nUnidentified parameter %d", param_identifier); + } +} + +/** + @brief This API is used to save voltage levels for + particular domain voltage ID. + @param domain_id voltage domain ID + @param level_index voltage level Index + @return none +**/ +void val_voltage_save_level(uint32_t domain_id, uint32_t level_index, uint32_t voltage) +{ + g_voltage_info_table.domain_info[domain_id].voltage_array[level_index] = voltage; +} + + +/** + @brief This API is used to get voltage levels for + particular domain voltage ID. + @param domain_id voltage domain ID + @param level_index voltage level Index + @return none +**/ +uint32_t val_voltage_get_level(uint32_t domain_id, uint32_t level_index) +{ + return g_voltage_info_table.domain_info[domain_id].voltage_array[level_index]; +} + + +/** + @brief This API is used to get voltage protocol info + 1. Caller - Test Suite. + 2. Prerequisite - Voltage protocol info table. + @param param_identifier id of parameter which will be set + @return param_value value of the parameter +**/ +uint32_t val_voltage_get_info(uint32_t param_identifier, uint32_t domain_id) +{ + uint32_t param_value = 0; + + switch (param_identifier) + { + case NUM_VOLTAGE_DOMAINS: + param_value = g_voltage_info_table.num_domains; + break; + case VOLTAGE_DOMAIN_CONFIG: + param_value = g_voltage_info_table.domain_info[domain_id].config; + break; + case VOLTAGE_LEVEL_FORMAT: + param_value = g_voltage_info_table.domain_info[domain_id].voltage_level_format; + break; + case VOLTAGE_LEVEL_START: + param_value = g_voltage_info_table.domain_info[domain_id].lowest_voltage_level; + break; + case VOLTAGE_LEVEL_END: + param_value = g_voltage_info_table.domain_info[domain_id].highest_voltage_level; + break; + case VOLTAGE_STEP_SIZE: + param_value = g_voltage_info_table.domain_info[domain_id].highest_voltage_level; + break; + default: + val_print(VAL_PRINT_ERR, "\nUnidentified parameter %d", param_identifier); + } + + return param_value; +} + +/** + @brief This API is used for checking voltage domain name + @param domain id + @return voltage domain name +**/ +uint8_t *val_voltage_get_expected_name(uint32_t domain_id) +{ + return pal_voltage_get_expected_name(domain_id); +} + +/** + @brief This function forms Voltage Operating mode config + @param mode_type voltage domain mode type + @param mode_id voltage domain mode ID + @return 32 bit voltage operating mode +**/ +uint32_t val_voltage_operating_mode_create(uint32_t mode_type, uint32_t mode_id) +{ + uint32_t config = 0; + + config = config | (mode_type << 3); + config = config | mode_id; + + return config; +} +#endif -- GitLab From 40dfcd27024b7ab42264b13f18bb9c981498d7f0 Mon Sep 17 00:00:00 2001 From: Nitin Sharma Date: Tue, 21 Dec 2021 16:16:57 +0000 Subject: [PATCH 2/3] Addressed failing issues, review comments. Signed-off-by: Nitin Sharma --- baremetal_app/app.c | 2 +- docs/scmi_testlist.md | 35 ++++++++++++------- platform/baremetal/include/pal_platform.h | 2 +- platform/baremetal/pal_base.c | 2 +- platform/linux/sgm776/include/pal_platform.h | 1 + platform/mocker/include/pal_platform.h | 2 +- platform/mocker/include/pal_sensor_expected.h | 2 +- .../mocker/mocker/include/sensor_common.h | 2 +- .../mocker/mocker/include/sensor_protocol.h | 2 +- platform/mocker/mocker/transport_sensor.c | 5 ++- platform/mocker/pal_sensor.c | 2 +- test_pool/clock/test_c007.c | 2 +- test_pool/voltage/test_v001.c | 5 ++- val/include/val_clock.h | 2 +- val/include/val_interface.h | 4 +-- val/include/val_voltage.h | 2 +- val/val_voltage.c | 4 ++- 17 files changed, 43 insertions(+), 33 deletions(-) diff --git a/baremetal_app/app.c b/baremetal_app/app.c index e80e9ee..2c2c82e 100644 --- a/baremetal_app/app.c +++ b/baremetal_app/app.c @@ -53,7 +53,7 @@ void arm_scmi_agent_execute(void *agent_info) #ifdef PERFORMANCE_PROTOCOL val_print(VAL_PRINT_ERR, "\n\n *** Starting PERFORMANCE tests *** "); - //val_performance_execute_tests(); NO COMMIT + val_performance_execute_tests(); #endif #ifdef CLOCK_PROTOCOL diff --git a/docs/scmi_testlist.md b/docs/scmi_testlist.md index bf91da2..872ff97 100644 --- a/docs/scmi_testlist.md +++ b/docs/scmi_testlist.md @@ -187,6 +187,16 @@ This section outlines the test specification for SCMI Sensor Management Protocol | test_m013 | Read sensor data in sync mode. | Check SUCCESS status is returned. | SENSOR\_READING\_GET | | test_m014 | Pre-Condition: Sensor should support async read.
Read sensor data in async mode. | 1. Check SUCCESS status is returned.
2. Wait for delayed response | SENSOR\_READING\_GET | | test_m015 | Read sensor data in async mode for unsupported sensors. | Check NOT\_SUPPORTED status is returned. | SENSOR\_READING\_GET | +| test_m016 | Discover the sensor axis properties. | Verify SUCCESS is returned and Check sensor axis data returned for supported sensor. | SENSOR\_AXIS\_DESCRIPTION\_GET | +| test_m017 | Discover sensor axis for non-existent sensor. | Verify NOT_FOUND is returned. | SENSOR\_AXIS\_DESCRIPTION\_GET | +| test_m018 | 1. Get update intervals supported by sensor.
2.Get invalid update interval array values for supported sensor. | 1. Verify SUCCESS is returned and interval data is sent.
2.Verify OUT_OF_INDEX is returned | SENSOR\_LIST\_UPDATE\_INTERVALS | +| test_m019 | Get update intervals for non-existent sensor. | Verify NOT_FOUND is returned. | SENSOR\_LIST\_UPDATE\_INTERVALS | +| test_m020 | Read sensor configuration information.| Verify SUCCESS is returned and read sensor configuration data. | SENSOR\_CONFIG\_GET | +| test_m021 | Read sensor configuration for non-existent sensor. | NOT\_FOUND is returned in response. | SENSOR\_CONFIG\_GET | +| test_m022 | Set up sensor configuration. | SUCCESS response is returned after applying configurations. | SENSOR\_CONFIG\_SET | +| test_m023 | Set up configurations for an invalid sensor. | NOT\_FOUND is returned in response. | SENSOR\_CONFIG\_SET | +| test_m024 | Set up sensor continous update notification request | SUCCESS response is returned after enabling notification. | SENSOR\_CONTINUOUS\_UPDATE\_NOTIFY | +| test_m023 | Set up continous update notification for invalid sensor. | NOT\_FOUND is returned in response. | SENSOR\_CONTINUOUS\_UPDATE\_NOTIFY | Reset Management Protocol Tests --------- @@ -216,18 +226,17 @@ This section outlines the test specification for SCMI Voltage Management Protoco | test\_v002 | Query the protocol attributes. | Check num of voltage domains against expected value. | PROTOCOL\_ATTRIBUTES | | test\_v003 | Query for mandatory command availability. | Check command implementation status. | PROTOCOL\_MESSAGE\_ATTRIBUTES | | test\_v004 | 1. Send invalid command id for voltage protocol.
2. Query the protocol message attributes with invalid msg\_id. | Check NOT\_FOUND status is returned. | PROTOCOL\_MESSAGE\_ATTRIBUTES | -| test\_v005 | Query Voltage domain attributes. | Check attributes values against expected values. | VOLTAGE\_DOMAIN\_ATTRIBUTES -| test\_v006 | Query voltage domain attributes with invalid domain id. | Check NOT\_FOUND status is returned. | VOLTAGE\_DOMAIN\_ATTRIBUTES -| test\_v007 | 1. Query Voltage describe level for valid domains and valid index.
2.Query Voltage describe level for valid domains but invalid index | 1. Check SUCCESS status is returned.
2. Check OUT\_OF\_RANGE status is returned. | VOLTAGE\_DESCRIBE\_LEVELS -| test\_v008 | Query Voltage describe levels for non valid voltage domain IDs. | Check NOT\_FOUND status is returned. | VOLTAGE\_DESCRIBE\_LEVELS -| test\_v009 | 1. Set Architectural Operating mode of voltage domains
2. Set IMPLEMENTATION defined Operating mode of voltage domains | 1. Check SUCCESS status is returned
2. Check SUCCESS status is returned | VOLTAGE\_CONFIG\_SET -| test\_v010 | Set operating mode for invalid voltage domain | Check NOT\_FOUND status is returned | VOLTAGE\_CONFIG\_SET -| test\_v011 | 1. Get Operating mode for valid voltage domain
2. Get operating mode for invalid voltage domain | 1. Check SUCCESS status returned
2. Check NOT\_FOUND status returned | VOLTAGE\_CONFIG\_GET -| test\_v012 | Set Voltage level of valid voltage domain | Check SUCCESS status is returned | VOLTAGE\_LEVEL\_SET -| test\_v013 | Set Voltage level of an invalid voltage domain | Check NOT\_FOUND status is returned | VOLTAGE\_LEVEL\_SET -| test\_v014 | 1. Set Invalid voltage level to voltage domain
2. Set voltage with invalid flag | 1. Check INVALID\_PARAMETERS status is returned
2. Check INVALID\_PARAMETERS status is returned| VOLTAGE\_LEVEL\_SET -| test\_v015 | 1. Get Voltage level for valid domain
2.Get Voltage level for invalid domain | 1. Check SUCCESS is returned
2.Check NOT\_FOUND is returned | VOLTAGE\_LEVEL\_GET +| test\_v005 | Query Voltage domain attributes. | Check attributes values against expected values. | VOLTAGE\_DOMAIN\_ATTRIBUTES | +| test\_v006 | Query voltage domain attributes with invalid domain id. | Check NOT\_FOUND status is returned. | VOLTAGE\_DOMAIN\_ATTRIBUTES | +| test\_v007 | 1. Query Voltage describe level for valid domains and valid index.
2.Query Voltage describe level for valid domains but invalid index | 1. Check SUCCESS status is returned.
2. Check OUT\_OF\_RANGE status is returned. | VOLTAGE\_DESCRIBE\_LEVELS | +| test\_v008 | Query Voltage describe levels for non valid voltage domain IDs. | Check NOT\_FOUND status is returned. | VOLTAGE\_DESCRIBE\_LEVELS | +| test\_v009 | 1. Set Architectural Operating mode of voltage domains
2. Set IMPLEMENTATION defined Operating mode of voltage domains | 1. Check SUCCESS status is returned
2. Check SUCCESS status is returned | VOLTAGE\_CONFIG\_SET | +| test\_v010 | Set operating mode for invalid voltage domain | Check NOT\_FOUND status is returned | VOLTAGE\_CONFIG\_SET | +| test\_v011 | 1. Get Operating mode for valid voltage domain
2. Get operating mode for invalid voltage domain | 1. Check SUCCESS status returned
2. Check NOT\_FOUND status returned | VOLTAGE\_CONFIG\_GET | +| test\_v012 | Set Voltage level of valid voltage domain | Check SUCCESS status is returned | VOLTAGE\_LEVEL\_SET | +| test\_v013 | Set Voltage level of an invalid voltage domain | Check NOT\_FOUND status is returned | VOLTAGE\_LEVEL\_SET | +| test\_v014 | 1. Set Invalid voltage level to voltage domain
2. Set voltage with invalid flag | 1. Check INVALID\_PARAMETERS status is returned
2. Check INVALID\_PARAMETERS status is returned| VOLTAGE\_LEVEL\_SET | +| test\_v015 | 1. Get Voltage level for valid domain
2. Get Voltage level for invalid domain | 1. Check SUCCESS is returned
2. Check NOT\_FOUND is returned | VOLTAGE\_LEVEL\_GET | - - - - - - - - - - - - - - - - - - - - -_Copyright (c) 2019-2020, Arm Limited and Contributors. All rights reserved._ - +_Copyright (c) 2021, Arm Limited and Contributors. All rights reserved._ diff --git a/platform/baremetal/include/pal_platform.h b/platform/baremetal/include/pal_platform.h index 540ccc1..edc4e0d 100644 --- a/platform/baremetal/include/pal_platform.h +++ b/platform/baremetal/include/pal_platform.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2017-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"); diff --git a/platform/baremetal/pal_base.c b/platform/baremetal/pal_base.c index cb731a8..b278a29 100644 --- a/platform/baremetal/pal_base.c +++ b/platform/baremetal/pal_base.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/linux/sgm776/include/pal_platform.h b/platform/linux/sgm776/include/pal_platform.h index 9ecaf25..3242113 100644 --- a/platform/linux/sgm776/include/pal_platform.h +++ b/platform/linux/sgm776/include/pal_platform.h @@ -35,6 +35,7 @@ #define SENSOR_PROTOCOL_ID 0x15 #define RESET_PROTOCOL_ID 0x16 #define VOLTAGE_PROTOCOL_ID 0x17 + #define APCORE_PROTOCOL_ID 0x09 #define TIMEOUT 100 diff --git a/platform/mocker/include/pal_platform.h b/platform/mocker/include/pal_platform.h index 3e766c9..2ac10f1 100644 --- a/platform/mocker/include/pal_platform.h +++ b/platform/mocker/include/pal_platform.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/mocker/include/pal_sensor_expected.h b/platform/mocker/include/pal_sensor_expected.h index f534610..283302a 100644 --- a/platform/mocker/include/pal_sensor_expected.h +++ b/platform/mocker/include/pal_sensor_expected.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/mocker/mocker/include/sensor_common.h b/platform/mocker/mocker/include/sensor_common.h index 13cd7d5..5ab4f73 100644 --- a/platform/mocker/mocker/include/sensor_common.h +++ b/platform/mocker/mocker/include/sensor_common.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/mocker/mocker/include/sensor_protocol.h b/platform/mocker/mocker/include/sensor_protocol.h index 81ca9f5..af5237f 100644 --- a/platform/mocker/mocker/include/sensor_protocol.h +++ b/platform/mocker/mocker/include/sensor_protocol.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/platform/mocker/mocker/transport_sensor.c b/platform/mocker/mocker/transport_sensor.c index dcc3e5a..4c40c30 100644 --- a/platform/mocker/mocker/transport_sensor.c +++ b/platform/mocker/mocker/transport_sensor.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); @@ -301,8 +301,7 @@ void sensor_send_message(uint32_t message_id, uint32_t parameter_count, } int update_int; update_int = parameters[OFFSET_PARAM(struct arm_scmi_sensor_list_update_intervals, update_int_index)]; - if ( update_int >= - sensor_update_interval_count[sensor_id]) + if ( update_int >= sensor_update_interval_count[sensor_id]) { *status = SCMI_STATUS_OUT_OF_RANGE; break; diff --git a/platform/mocker/pal_sensor.c b/platform/mocker/pal_sensor.c index 021de79..cd14b37 100644 --- a/platform/mocker/pal_sensor.c +++ b/platform/mocker/pal_sensor.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/test_pool/clock/test_c007.c b/test_pool/clock/test_c007.c index 7e30e79..afcfb5b 100644 --- a/test_pool/clock/test_c007.c +++ b/test_pool/clock/test_c007.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/test_pool/voltage/test_v001.c b/test_pool/voltage/test_v001.c index ed0c6e4..cfec42d 100755 --- a/test_pool/voltage/test_v001.c +++ b/test_pool/voltage/test_v001.c @@ -22,7 +22,7 @@ #define TEST_DESC "Voltage protocol version check " #define RETURN_VALUE_COUNT 1 -uint32_t voltage_query_protocol_version(void) +uint32_t voltage_query_protocol_version(uint32_t *version) { int32_t status; uint32_t rsp_msg_hdr; @@ -31,7 +31,6 @@ uint32_t voltage_query_protocol_version(void) size_t return_value_count; uint32_t return_values[MAX_RETURNS_SIZE]; uint32_t *parameters; - uint32_t version; if (val_test_initialize(TEST_NUM, TEST_DESC) != VAL_STATUS_PASS) return VAL_STATUS_SKIP; @@ -56,7 +55,7 @@ uint32_t voltage_query_protocol_version(void) if (return_value_count != RETURN_VALUE_COUNT) return VAL_STATUS_FAIL; - version = return_values[VERSION_OFFSET]; + *version = return_values[VERSION_OFFSET]; val_print(VAL_PRINT_ERR, "\n PROTOCOL VERSION : 0x%08x ", version); return VAL_STATUS_PASS; diff --git a/val/include/val_clock.h b/val/include/val_clock.h index 0a9bca4..b2efaca 100644 --- a/val/include/val_clock.h +++ b/val/include/val_clock.h @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. + * 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"); diff --git a/val/include/val_interface.h b/val/include/val_interface.h index 84d2dca..5b7b7e6 100644 --- a/val/include/val_interface.h +++ b/val/include/val_interface.h @@ -46,8 +46,8 @@ #define POWER_PROTOCOL_VERSION_2 0x00020000 #define POWER_PROTOCOL_VERSION_2_1 0x00021000 -#define SENSOR_PROTOCOL_VERSION_1 0x10000 -#define SENSOR_PROTOCOL_VERSION_2 0x20000 +#define SENSOR_PROTOCOL_VERSION_1 0x00010000 +#define SENSOR_PROTOCOL_VERSION_2 0x00020000 /* set PRINT_LEVEL to one of the below values in your application entry to control the verbosity of the prints */ diff --git a/val/include/val_voltage.h b/val/include/val_voltage.h index bff4bbc..f9bba9b 100755 --- a/val/include/val_voltage.h +++ b/val/include/val_voltage.h @@ -56,7 +56,7 @@ typedef struct { } VOLTAGE_INFO_s; /* Common Tests */ -uint32_t voltage_query_protocol_version(void); +uint32_t voltage_query_protocol_version(uint32_t *version); uint32_t voltage_query_protocol_attributes(void); uint32_t voltage_query_mandatory_command_support(void); uint32_t voltage_invalid_messageid_call(void); diff --git a/val/val_voltage.c b/val/val_voltage.c index 9bb19fa..100b920 100755 --- a/val/val_voltage.c +++ b/val/val_voltage.c @@ -29,8 +29,10 @@ static VOLTAGE_INFO_s g_voltage_info_table; **/ uint32_t val_voltage_execute_tests(void) { + uint32_t version = 0; + if (val_agent_check_protocol_support(PROTOCOL_VOLTAGE)) { - if (RUN_TEST(voltage_query_protocol_version())) + if (RUN_TEST(voltage_query_protocol_version(&version))) return VAL_STATUS_FAIL; RUN_TEST(voltage_query_protocol_attributes()); -- GitLab From 9157e2f452c5696d5e4844e6f04e88f8c3395695 Mon Sep 17 00:00:00 2001 From: Nitin Sharma Date: Fri, 24 Dec 2021 13:09:10 +0000 Subject: [PATCH 3/3] Update scmi_testlist.md with test_m025 --- docs/scmi_testlist.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/scmi_testlist.md b/docs/scmi_testlist.md index 872ff97..3612070 100644 --- a/docs/scmi_testlist.md +++ b/docs/scmi_testlist.md @@ -1,4 +1,3 @@ - **SCMI Tests - Scenario document** =================================== Table of Contents: @@ -196,7 +195,7 @@ This section outlines the test specification for SCMI Sensor Management Protocol | test_m022 | Set up sensor configuration. | SUCCESS response is returned after applying configurations. | SENSOR\_CONFIG\_SET | | test_m023 | Set up configurations for an invalid sensor. | NOT\_FOUND is returned in response. | SENSOR\_CONFIG\_SET | | test_m024 | Set up sensor continous update notification request | SUCCESS response is returned after enabling notification. | SENSOR\_CONTINUOUS\_UPDATE\_NOTIFY | -| test_m023 | Set up continous update notification for invalid sensor. | NOT\_FOUND is returned in response. | SENSOR\_CONTINUOUS\_UPDATE\_NOTIFY | +| test_m025 | Set up continous update notification for invalid sensor. | NOT\_FOUND is returned in response. | SENSOR\_CONTINUOUS\_UPDATE\_NOTIFY | Reset Management Protocol Tests --------- -- GitLab