Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 2 | /* |
| 3 | * EFI efi_selftest |
| 4 | * |
| 5 | * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de> |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <efi_selftest.h> |
| 9 | #include <vsprintf.h> |
| 10 | |
Simon Glass | 0b9680f | 2018-06-18 08:08:21 -0600 | [diff] [blame] | 11 | /* Constants for test step bitmap */ |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 12 | #define EFI_ST_SETUP 1 |
| 13 | #define EFI_ST_EXECUTE 2 |
| 14 | #define EFI_ST_TEARDOWN 4 |
| 15 | |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 16 | static const struct efi_system_table *systable; |
| 17 | static const struct efi_boot_services *boottime; |
| 18 | static const struct efi_runtime_services *runtime; |
| 19 | static efi_handle_t handle; |
| 20 | static u16 reset_message[] = L"Selftest completed"; |
Heinrich Schuchardt | 7281933 | 2018-10-22 23:15:10 +0200 | [diff] [blame] | 21 | static int *setup_status; |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * Exit the boot services. |
| 25 | * |
| 26 | * The size of the memory map is determined. |
| 27 | * Pool memory is allocated to copy the memory map. |
Simon Glass | 0b9680f | 2018-06-18 08:08:21 -0600 | [diff] [blame] | 28 | * The memory map is copied and the map key is obtained. |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 29 | * The map key is used to exit the boot services. |
| 30 | */ |
| 31 | void efi_st_exit_boot_services(void) |
| 32 | { |
Heinrich Schuchardt | 798a441 | 2017-11-06 21:17:48 +0100 | [diff] [blame] | 33 | efi_uintn_t map_size = 0; |
| 34 | efi_uintn_t map_key; |
| 35 | efi_uintn_t desc_size; |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 36 | u32 desc_version; |
| 37 | efi_status_t ret; |
| 38 | struct efi_mem_desc *memory_map; |
| 39 | |
| 40 | ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size, |
| 41 | &desc_version); |
| 42 | if (ret != EFI_BUFFER_TOO_SMALL) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 43 | efi_st_error( |
| 44 | "GetMemoryMap did not return EFI_BUFFER_TOO_SMALL\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 45 | return; |
| 46 | } |
| 47 | /* Allocate extra space for newly allocated memory */ |
| 48 | map_size += sizeof(struct efi_mem_desc); |
| 49 | ret = boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size, |
| 50 | (void **)&memory_map); |
| 51 | if (ret != EFI_SUCCESS) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 52 | efi_st_error("AllocatePool did not return EFI_SUCCESS\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 53 | return; |
| 54 | } |
| 55 | ret = boottime->get_memory_map(&map_size, memory_map, &map_key, |
| 56 | &desc_size, &desc_version); |
| 57 | if (ret != EFI_SUCCESS) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 58 | efi_st_error("GetMemoryMap did not return EFI_SUCCESS\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 59 | return; |
| 60 | } |
| 61 | ret = boottime->exit_boot_services(handle, map_key); |
| 62 | if (ret != EFI_SUCCESS) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 63 | efi_st_error("ExitBootServices did not return EFI_SUCCESS\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 64 | return; |
| 65 | } |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 66 | efi_st_printc(EFI_WHITE, "\nBoot services terminated\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | /* |
| 70 | * Set up a test. |
| 71 | * |
| 72 | * @test the test to be executed |
| 73 | * @failures counter that will be incremented if a failure occurs |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 74 | * @return EFI_ST_SUCCESS for success |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 75 | */ |
| 76 | static int setup(struct efi_unit_test *test, unsigned int *failures) |
| 77 | { |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 78 | int ret; |
| 79 | |
| 80 | if (!test->setup) |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 81 | return EFI_ST_SUCCESS; |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 82 | efi_st_printc(EFI_LIGHTBLUE, "\nSetting up '%s'\n", test->name); |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 83 | ret = test->setup(handle, systable); |
| 84 | if (ret != EFI_ST_SUCCESS) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 85 | efi_st_error("Setting up '%s' failed\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 86 | ++*failures; |
| 87 | } else { |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 88 | efi_st_printc(EFI_LIGHTGREEN, |
| 89 | "Setting up '%s' succeeded\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 90 | } |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 91 | return ret; |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | /* |
| 95 | * Execute a test. |
| 96 | * |
| 97 | * @test the test to be executed |
| 98 | * @failures counter that will be incremented if a failure occurs |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 99 | * @return EFI_ST_SUCCESS for success |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 100 | */ |
| 101 | static int execute(struct efi_unit_test *test, unsigned int *failures) |
| 102 | { |
| 103 | int ret; |
| 104 | |
| 105 | if (!test->execute) |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 106 | return EFI_ST_SUCCESS; |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 107 | efi_st_printc(EFI_LIGHTBLUE, "\nExecuting '%s'\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 108 | ret = test->execute(); |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 109 | if (ret != EFI_ST_SUCCESS) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 110 | efi_st_error("Executing '%s' failed\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 111 | ++*failures; |
| 112 | } else { |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 113 | efi_st_printc(EFI_LIGHTGREEN, |
| 114 | "Executing '%s' succeeded\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 115 | } |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | /* |
| 120 | * Tear down a test. |
| 121 | * |
| 122 | * @test the test to be torn down |
| 123 | * @failures counter that will be incremented if a failure occurs |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 124 | * @return EFI_ST_SUCCESS for success |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 125 | */ |
| 126 | static int teardown(struct efi_unit_test *test, unsigned int *failures) |
| 127 | { |
| 128 | int ret; |
| 129 | |
| 130 | if (!test->teardown) |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 131 | return EFI_ST_SUCCESS; |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 132 | efi_st_printc(EFI_LIGHTBLUE, "\nTearing down '%s'\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 133 | ret = test->teardown(); |
Heinrich Schuchardt | 1afe5f7 | 2017-10-04 15:31:26 +0200 | [diff] [blame] | 134 | if (ret != EFI_ST_SUCCESS) { |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 135 | efi_st_error("Tearing down '%s' failed\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 136 | ++*failures; |
| 137 | } else { |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 138 | efi_st_printc(EFI_LIGHTGREEN, |
| 139 | "Tearing down '%s' succeeded\n", test->name); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 140 | } |
| 141 | return ret; |
| 142 | } |
| 143 | |
| 144 | /* |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 145 | * Check that a test exists. |
| 146 | * |
| 147 | * @testname: name of the test |
Simon Glass | 0b9680f | 2018-06-18 08:08:21 -0600 | [diff] [blame] | 148 | * @return: test, or NULL if not found |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 149 | */ |
| 150 | static struct efi_unit_test *find_test(const u16 *testname) |
| 151 | { |
| 152 | struct efi_unit_test *test; |
| 153 | |
| 154 | for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); |
| 155 | test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { |
| 156 | if (!efi_st_strcmp_16_8(testname, test->name)) |
| 157 | return test; |
| 158 | } |
| 159 | efi_st_printf("\nTest '%ps' not found\n", testname); |
| 160 | return NULL; |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | * List all available tests. |
| 165 | */ |
| 166 | static void list_all_tests(void) |
| 167 | { |
| 168 | struct efi_unit_test *test; |
| 169 | |
| 170 | /* List all tests */ |
| 171 | efi_st_printf("\nAvailable tests:\n"); |
| 172 | for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); |
| 173 | test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { |
| 174 | efi_st_printf("'%s'%s\n", test->name, |
| 175 | test->on_request ? " - on request" : ""); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | /* |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 180 | * Execute test steps of one phase. |
| 181 | * |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 182 | * @testname name of a single selected test or NULL |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 183 | * @phase test phase |
Simon Glass | 0b9680f | 2018-06-18 08:08:21 -0600 | [diff] [blame] | 184 | * @steps steps to execute (mask with bits from EFI_ST_...) |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 185 | * failures returns EFI_ST_SUCCESS if all test steps succeeded |
| 186 | */ |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 187 | void efi_st_do_tests(const u16 *testname, unsigned int phase, |
| 188 | unsigned int steps, unsigned int *failures) |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 189 | { |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 190 | int i = 0; |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 191 | struct efi_unit_test *test; |
| 192 | |
| 193 | for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 194 | test < ll_entry_end(struct efi_unit_test, efi_unit_test); |
| 195 | ++test, ++i) { |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 196 | if (testname ? |
| 197 | efi_st_strcmp_16_8(testname, test->name) : test->on_request) |
| 198 | continue; |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 199 | if (test->phase != phase) |
| 200 | continue; |
| 201 | if (steps & EFI_ST_SETUP) |
Heinrich Schuchardt | 7281933 | 2018-10-22 23:15:10 +0200 | [diff] [blame] | 202 | setup_status[i] = setup(test, failures); |
| 203 | if (steps & EFI_ST_EXECUTE && setup_status[i] == EFI_ST_SUCCESS) |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 204 | execute(test, failures); |
| 205 | if (steps & EFI_ST_TEARDOWN) |
| 206 | teardown(test, failures); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | /* |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 211 | * Execute selftest of the EFI API |
| 212 | * |
| 213 | * This is the main entry point of the EFI selftest application. |
| 214 | * |
| 215 | * All tests use a driver model and are run in three phases: |
| 216 | * setup, execute, teardown. |
| 217 | * |
| 218 | * A test may be setup and executed at boottime, |
| 219 | * it may be setup at boottime and executed at runtime, |
| 220 | * or it may be setup and executed at runtime. |
| 221 | * |
| 222 | * After executing all tests the system is reset. |
| 223 | * |
| 224 | * @image_handle: handle of the loaded EFI image |
| 225 | * @systab: EFI system table |
| 226 | */ |
| 227 | efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, |
| 228 | struct efi_system_table *systab) |
| 229 | { |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 230 | unsigned int failures = 0; |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 231 | const u16 *testname = NULL; |
| 232 | struct efi_loaded_image *loaded_image; |
| 233 | efi_status_t ret; |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 234 | |
| 235 | systable = systab; |
| 236 | boottime = systable->boottime; |
| 237 | runtime = systable->runtime; |
| 238 | handle = image_handle; |
| 239 | con_out = systable->con_out; |
| 240 | con_in = systable->con_in; |
| 241 | |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 242 | ret = boottime->handle_protocol(image_handle, &efi_guid_loaded_image, |
| 243 | (void **)&loaded_image); |
| 244 | if (ret != EFI_SUCCESS) { |
Heinrich Schuchardt | bf7ea1d | 2017-11-26 14:05:19 +0100 | [diff] [blame] | 245 | efi_st_error("Cannot open loaded image protocol\n"); |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 246 | return ret; |
| 247 | } |
| 248 | |
| 249 | if (loaded_image->load_options) |
| 250 | testname = (u16 *)loaded_image->load_options; |
| 251 | |
| 252 | if (testname) { |
| 253 | if (!efi_st_strcmp_16_8(testname, "list") || |
| 254 | !find_test(testname)) { |
| 255 | list_all_tests(); |
| 256 | /* |
| 257 | * TODO: |
| 258 | * Once the Exit boottime service is correctly |
| 259 | * implemented we should call |
| 260 | * boottime->exit(image_handle, EFI_SUCCESS, 0, NULL); |
| 261 | * here, cf. |
| 262 | * https://lists.denx.de/pipermail/u-boot/2017-October/308720.html |
| 263 | */ |
| 264 | return EFI_SUCCESS; |
| 265 | } |
| 266 | } |
| 267 | |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 268 | efi_st_printc(EFI_WHITE, "\nTesting EFI API implementation\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 269 | |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 270 | if (testname) |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 271 | efi_st_printc(EFI_WHITE, "\nSelected test: '%ps'\n", testname); |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 272 | else |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 273 | efi_st_printc(EFI_WHITE, "\nNumber of tests to execute: %u\n", |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 274 | ll_entry_count(struct efi_unit_test, |
| 275 | efi_unit_test)); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 276 | |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 277 | /* Allocate buffer for setup results */ |
| 278 | ret = boottime->allocate_pool(EFI_RUNTIME_SERVICES_DATA, sizeof(int) * |
| 279 | ll_entry_count(struct efi_unit_test, |
| 280 | efi_unit_test), |
Heinrich Schuchardt | 7281933 | 2018-10-22 23:15:10 +0200 | [diff] [blame] | 281 | (void **)&setup_status); |
Heinrich Schuchardt | 0e77ca9 | 2018-10-19 07:51:26 +0200 | [diff] [blame] | 282 | if (ret != EFI_SUCCESS) { |
| 283 | efi_st_error("Allocate pool failed\n"); |
| 284 | return ret; |
| 285 | } |
| 286 | |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 287 | /* Execute boottime tests */ |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 288 | efi_st_do_tests(testname, EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 289 | EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, |
| 290 | &failures); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 291 | |
| 292 | /* Execute mixed tests */ |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 293 | efi_st_do_tests(testname, EFI_SETUP_BEFORE_BOOTTIME_EXIT, |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 294 | EFI_ST_SETUP, &failures); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 295 | |
| 296 | efi_st_exit_boot_services(); |
| 297 | |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 298 | efi_st_do_tests(testname, EFI_SETUP_BEFORE_BOOTTIME_EXIT, |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 299 | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, &failures); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 300 | |
| 301 | /* Execute runtime tests */ |
Heinrich Schuchardt | 02efd5d | 2017-10-18 18:13:13 +0200 | [diff] [blame] | 302 | efi_st_do_tests(testname, EFI_SETUP_AFTER_BOOTTIME_EXIT, |
Heinrich Schuchardt | 2eb1558 | 2017-10-18 18:13:12 +0200 | [diff] [blame] | 303 | EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, |
| 304 | &failures); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 305 | |
| 306 | /* Give feedback */ |
Heinrich Schuchardt | 9137df8 | 2018-01-11 08:15:54 +0100 | [diff] [blame] | 307 | efi_st_printc(EFI_WHITE, "\nSummary: %u failures\n\n", failures); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 308 | |
| 309 | /* Reset system */ |
Simon Glass | 0b9680f | 2018-06-18 08:08:21 -0600 | [diff] [blame] | 310 | efi_st_printf("Preparing for reset. Press any key...\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 311 | efi_st_get_key(); |
| 312 | runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY, |
| 313 | sizeof(reset_message), reset_message); |
Heinrich Schuchardt | cbfdf81 | 2017-10-04 12:37:02 +0200 | [diff] [blame] | 314 | efi_st_printf("\n"); |
Simon Glass | 0b9680f | 2018-06-18 08:08:21 -0600 | [diff] [blame] | 315 | efi_st_error("Reset failed\n"); |
Heinrich Schuchardt | d33ae3e | 2017-09-15 10:06:11 +0200 | [diff] [blame] | 316 | |
| 317 | return EFI_UNSUPPORTED; |
| 318 | } |