Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1 | Revert "peripheral test 3 updated for multiple uarts" |
| 2 | |
| 3 | This reverts commit 037be14cc1f149cdb25e754358de7b9066581d1c. |
| 4 | |
| 5 | Working around issue in the latest GCC of: |
| 6 | ShellPkg/Application/sbsa-acs/test_pool/peripherals/test_d003.c:172:18: error: storing the address of local variable 'exception_taken' in 'branch_to_test' [-Werror=dangling-pointer=] |
| 7 | |
| 8 | Upstream-Status: Inappropriate [Problem reported, https://github.com/ARM-software/sbsa-acs/issues/245] |
| 9 | Signed-off-by: Jon Mason <jon.mason@arm.com> |
| 10 | |
| 11 | diff --git a/test_pool/peripherals/test_d003.c b/test_pool/peripherals/test_d003.c |
| 12 | index 68902ad..4858049 100755 |
| 13 | --- a/test_pool/peripherals/test_d003.c |
| 14 | +++ b/test_pool/peripherals/test_d003.c |
| 15 | @@ -17,7 +17,6 @@ |
| 16 | |
| 17 | #include "val/include/sbsa_avs_val.h" |
| 18 | #include "val/include/val_interface.h" |
| 19 | -#include "val/include/sbsa_avs_pe.h" |
| 20 | |
| 21 | #include "val/include/sbsa_avs_peripherals.h" |
| 22 | #include "val/include/sbsa_avs_gic.h" |
| 23 | @@ -25,26 +24,11 @@ |
| 24 | #define TEST_NUM (AVS_PER_TEST_NUM_BASE + 3) |
| 25 | /*one space character is removed from TEST_DESC, to nullify a space written as part of the test */ |
| 26 | #define TEST_DESC "Check SBSA UART register offsets " |
| 27 | -#define TEST_NUM1 (AVS_PER_TEST_NUM_BASE + 4) |
| 28 | +#define TEST_NUM2 (AVS_PER_TEST_NUM_BASE + 4) |
| 29 | #define TEST_DESC1 "Check Generic UART Interrupt " |
| 30 | |
| 31 | -static uint64_t l_uart_base; |
| 32 | +uint64_t l_uart_base; |
| 33 | static uint32_t int_id; |
| 34 | -static void *branch_to_test; |
| 35 | -static uint32_t test_fail; |
| 36 | - |
| 37 | -static |
| 38 | -void |
| 39 | -esr(uint64_t interrupt_type, void *context) |
| 40 | -{ |
| 41 | - uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid()); |
| 42 | - |
| 43 | - /* Update the ELR to point to next instrcution */ |
| 44 | - val_pe_update_elr(context, (uint64_t)branch_to_test); |
| 45 | - |
| 46 | - val_print(AVS_PRINT_ERR, "\n Error : Received Sync Exception ", 0); |
| 47 | - val_set_status(index, RESULT_FAIL(g_sbsa_level, TEST_NUM, 01)); |
| 48 | -} |
| 49 | |
| 50 | uint32_t |
| 51 | uart_reg_read(uint32_t offset, uint32_t width_mask) |
| 52 | @@ -115,7 +99,7 @@ isr() |
| 53 | uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid()); |
| 54 | uart_disable_txintr(); |
| 55 | val_print(AVS_PRINT_DEBUG, "\n Received interrupt ", 0); |
| 56 | - val_set_status(index, RESULT_PASS(g_sbsa_level, TEST_NUM1, 01)); |
| 57 | + val_set_status(index, RESULT_PASS(g_sbsa_level, TEST_NUM, 0x01)); |
| 58 | val_gic_end_of_interrupt(int_id); |
| 59 | } |
| 60 | |
| 61 | @@ -166,14 +150,9 @@ payload() |
| 62 | uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid()); |
| 63 | uint32_t data1, data2; |
| 64 | |
| 65 | - val_pe_install_esr(EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS, esr); |
| 66 | - val_pe_install_esr(EXCEPT_AARCH64_SERROR, esr); |
| 67 | - |
| 68 | - branch_to_test = &&exception_taken; |
| 69 | - |
| 70 | if (count == 0) { |
| 71 | val_print(AVS_PRINT_WARN, "\n No UART defined by Platform ", 0); |
| 72 | - val_set_status(index, RESULT_FAIL(g_sbsa_level, TEST_NUM, 01)); |
| 73 | + val_set_status(index, RESULT_SKIP(g_sbsa_level, TEST_NUM, 01)); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | @@ -213,7 +192,6 @@ payload() |
| 78 | |
| 79 | count--; |
| 80 | } |
| 81 | -exception_taken: |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | @@ -223,49 +201,40 @@ payload1() |
| 86 | { |
| 87 | uint32_t count = val_peripheral_get_info(NUM_UART, 0); |
| 88 | uint32_t index = val_pe_get_index_mpid(val_pe_get_mpid()); |
| 89 | - uint32_t timeout; |
| 90 | + uint32_t timeout = TIMEOUT_MEDIUM; |
| 91 | |
| 92 | if (count == 0) { |
| 93 | - val_set_status(index, RESULT_SKIP(g_sbsa_level, TEST_NUM1, 01)); |
| 94 | + val_set_status(index, RESULT_SKIP(g_sbsa_level, TEST_NUM2, 01)); |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | while (count != 0) { |
| 99 | - timeout = TIMEOUT_MEDIUM; |
| 100 | + |
| 101 | int_id = val_peripheral_get_info(UART_GSIV, count - 1); |
| 102 | - l_uart_base = val_peripheral_get_info(UART_BASE0, count - 1); |
| 103 | |
| 104 | /* If Interrupt ID is available, check for interrupt generation */ |
| 105 | if (int_id != 0x0) { |
| 106 | /* PASS will be set from ISR */ |
| 107 | - val_set_status(index, RESULT_PENDING(g_sbsa_level, TEST_NUM1)); |
| 108 | - if (val_gic_install_isr(int_id, isr)) { |
| 109 | - val_print(AVS_PRINT_ERR, "\n GIC Install Handler Fail", 0); |
| 110 | - val_set_status(index, RESULT_FAIL(g_sbsa_level, TEST_NUM1, 01)); |
| 111 | - return; |
| 112 | - } |
| 113 | + val_set_status(index, RESULT_PENDING(g_sbsa_level, TEST_NUM2)); |
| 114 | + val_gic_install_isr(int_id, isr); |
| 115 | uart_enable_txintr(); |
| 116 | - val_print_raw(l_uart_base, g_print_level, |
| 117 | - "\n Test Message ", 0); |
| 118 | + val_print_raw(g_print_level, "\n Test Message ", 0); |
| 119 | |
| 120 | - while ((--timeout > 0) && (IS_RESULT_PENDING(val_get_status(index)))){ |
| 121 | - }; |
| 122 | + while ((--timeout > 0) && (IS_RESULT_PENDING(val_get_status(index)))); |
| 123 | |
| 124 | if (timeout == 0) { |
| 125 | val_print(AVS_PRINT_ERR, |
| 126 | - "\n Did not receive UART interrupt %d ", int_id); |
| 127 | - test_fail++; |
| 128 | + "\n Did not receive UART interrupt on %d ", int_id); |
| 129 | + val_set_status(index, RESULT_FAIL(g_sbsa_level, TEST_NUM2, 02)); |
| 130 | + return; |
| 131 | } |
| 132 | } else { |
| 133 | - val_set_status(index, RESULT_SKIP(g_sbsa_level, TEST_NUM1, 02)); |
| 134 | + val_set_status(index, RESULT_SKIP(g_sbsa_level, TEST_NUM2, 01)); |
| 135 | } |
| 136 | |
| 137 | count--; |
| 138 | } |
| 139 | - if (test_fail) |
| 140 | - val_set_status(index, RESULT_FAIL(g_sbsa_level, TEST_NUM1, 02)); |
| 141 | - else |
| 142 | - val_set_status(index, RESULT_PASS(g_sbsa_level, TEST_NUM1, 02)); |
| 143 | + return; |
| 144 | } |
| 145 | |
| 146 | |
| 147 | @@ -290,13 +259,13 @@ d003_entry(uint32_t num_pe) |
| 148 | val_report_status(0, SBSA_AVS_END(g_sbsa_level, TEST_NUM)); |
| 149 | |
| 150 | if (!status) { |
| 151 | - status = val_initialize_test(TEST_NUM1, TEST_DESC1, val_pe_get_num(), g_sbsa_level); |
| 152 | + status = val_initialize_test(TEST_NUM2, TEST_DESC1, val_pe_get_num(), g_sbsa_level); |
| 153 | if (status != AVS_STATUS_SKIP) |
| 154 | - val_run_test_payload(TEST_NUM1, num_pe, payload1, 0); |
| 155 | + val_run_test_payload(TEST_NUM2, num_pe, payload1, 0); |
| 156 | |
| 157 | /* get the result from all PE and check for failure */ |
| 158 | - status = val_check_for_error(TEST_NUM1, num_pe); |
| 159 | - val_report_status(0, SBSA_AVS_END(g_sbsa_level, TEST_NUM1)); |
| 160 | + status = val_check_for_error(TEST_NUM2, num_pe); |
| 161 | + val_report_status(0, SBSA_AVS_END(g_sbsa_level, TEST_NUM2)); |
| 162 | } |
| 163 | |
| 164 | |
| 165 | diff --git a/val/include/val_interface.h b/val/include/val_interface.h |
| 166 | index c03edb7..0997c64 100644 |
| 167 | --- a/val/include/val_interface.h |
| 168 | +++ b/val/include/val_interface.h |
| 169 | @@ -44,8 +44,7 @@ |
| 170 | void val_allocate_shared_mem(void); |
| 171 | void val_free_shared_mem(void); |
| 172 | void val_print(uint32_t level, char8_t *string, uint64_t data); |
| 173 | -void val_print_raw(uint64_t uart_address, uint32_t level, char8_t *string, |
| 174 | - uint64_t data); |
| 175 | +void val_print_raw(uint32_t level, char8_t *string, uint64_t data); |
| 176 | void val_print_test_end(uint32_t status, char8_t *string); |
| 177 | void val_set_test_data(uint32_t index, uint64_t addr, uint64_t test_data); |
| 178 | void val_get_test_data(uint32_t index, uint64_t *data0, uint64_t *data1); |
| 179 | diff --git a/val/src/avs_test_infra.c b/val/src/avs_test_infra.c |
| 180 | index 4d4e80b..a39e85b 100644 |
| 181 | --- a/val/src/avs_test_infra.c |
| 182 | +++ b/val/src/avs_test_infra.c |
| 183 | @@ -65,7 +65,6 @@ val_print_test_end(uint32_t status, char8_t *string) |
| 184 | 1. Caller - Application layer |
| 185 | 2. Prerequisite - None. |
| 186 | |
| 187 | - @param uart_address address of uart to be used |
| 188 | @param level the print verbosity (1 to 5) |
| 189 | @param string formatted ASCII string |
| 190 | @param data 64-bit data. set to 0 if no data is to sent to console. |
| 191 | @@ -73,11 +72,11 @@ val_print_test_end(uint32_t status, char8_t *string) |
| 192 | @return None |
| 193 | **/ |
| 194 | void |
| 195 | -val_print_raw(uint64_t uart_address, uint32_t level, char8_t *string, |
| 196 | - uint64_t data) |
| 197 | +val_print_raw(uint32_t level, char8_t *string, uint64_t data) |
| 198 | { |
| 199 | |
| 200 | if (level >= g_print_level){ |
| 201 | + uint64_t uart_address = val_peripheral_get_info(UART_BASE0, 0); |
| 202 | pal_print_raw(uart_address, string, data); |
| 203 | } |
| 204 | |