mardyk01 | 82389fb | 2023-09-25 16:34:56 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <power_management.h> |
| 8 | #include <sdei.h> |
| 9 | #include <test_helpers.h> |
| 10 | #include <tftf_lib.h> |
| 11 | #include <timer.h> |
| 12 | |
| 13 | #define CMP_SUCCESS 0 |
| 14 | |
| 15 | /* |
| 16 | * Invoke the SMC call based on the function name specified. |
| 17 | */ |
| 18 | void runtestfunction(char *funcstr) |
| 19 | { |
| 20 | if (strcmp(funcstr, "sdei_version") == CMP_SUCCESS) { |
| 21 | long long ret = sdei_version(); |
| 22 | |
| 23 | if (ret != MAKE_SDEI_VERSION(1, 0, 0)) { |
| 24 | tftf_testcase_printf("Unexpected SDEI version: 0x%llx\n", |
| 25 | ret); |
| 26 | } |
| 27 | printf("running %s\n", funcstr); |
| 28 | } |
| 29 | if (strcmp(funcstr, "sdei_pe_unmask") == CMP_SUCCESS) { |
| 30 | long long ret = sdei_pe_unmask(); |
| 31 | |
| 32 | if (ret < 0) { |
| 33 | tftf_testcase_printf("SDEI pe unmask failed: 0x%llx\n", |
| 34 | ret); |
| 35 | } |
| 36 | printf("running %s\n", funcstr); |
| 37 | } |
| 38 | if (strcmp(funcstr, "sdei_pe_mask") == CMP_SUCCESS) { |
| 39 | int64_t ret = sdei_pe_mask(); |
| 40 | |
| 41 | if (ret < 0) { |
| 42 | tftf_testcase_printf("SDEI pe mask failed: 0x%llx\n", ret); |
| 43 | } |
| 44 | printf("running %s\n", funcstr); |
| 45 | } |
| 46 | if (strcmp(funcstr, "sdei_event_status") == CMP_SUCCESS) { |
| 47 | int64_t ret = sdei_event_status(0); |
| 48 | |
| 49 | if (ret < 0) { |
| 50 | tftf_testcase_printf("SDEI event status failed: 0x%llx\n", |
| 51 | ret); |
| 52 | } |
| 53 | printf("running %s\n", funcstr); |
| 54 | } |
| 55 | if (strcmp(funcstr, "sdei_event_signal") == CMP_SUCCESS) { |
| 56 | int64_t ret = sdei_event_signal(0); |
| 57 | |
| 58 | if (ret < 0) { |
| 59 | tftf_testcase_printf("SDEI event signal failed: 0x%llx\n", |
| 60 | ret); |
| 61 | } |
| 62 | printf("running %s\n", funcstr); |
| 63 | } |
| 64 | if (strcmp(funcstr, "sdei_private_reset") == CMP_SUCCESS) { |
| 65 | int64_t ret = sdei_private_reset(); |
| 66 | |
| 67 | if (ret < 0) { |
| 68 | tftf_testcase_printf("SDEI private reset failed: 0x%llx\n", |
| 69 | ret); |
| 70 | } |
| 71 | printf("running %s\n", funcstr); |
| 72 | } |
| 73 | if (strcmp(funcstr, "sdei_shared_reset") == CMP_SUCCESS) { |
| 74 | int64_t ret = sdei_shared_reset(); |
| 75 | |
| 76 | if (ret < 0) { |
| 77 | tftf_testcase_printf("SDEI shared reset failed: 0x%llx\n", |
| 78 | ret); |
| 79 | } |
| 80 | printf("running %s\n", funcstr); |
| 81 | } |
| 82 | } |