bootefi.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * EFI application loader
  4. *
  5. * Copyright (c) 2016 Alexander Graf
  6. */
  7. #define LOG_CATEGORY LOGC_EFI
  8. #include <common.h>
  9. #include <charset.h>
  10. #include <command.h>
  11. #include <dm.h>
  12. #include <efi_loader.h>
  13. #include <efi_selftest.h>
  14. #include <env.h>
  15. #include <errno.h>
  16. #include <image.h>
  17. #include <log.h>
  18. #include <malloc.h>
  19. #include <linux/libfdt.h>
  20. #include <linux/libfdt_env.h>
  21. #include <mapmem.h>
  22. #include <memalign.h>
  23. #include <asm-generic/sections.h>
  24. #include <linux/linkage.h>
  25. DECLARE_GLOBAL_DATA_PTR;
  26. static struct efi_device_path *bootefi_image_path;
  27. static struct efi_device_path *bootefi_device_path;
  28. static void *image_addr;
  29. static size_t image_size;
  30. /**
  31. * efi_clear_bootdev() - clear boot device
  32. */
  33. static void efi_clear_bootdev(void)
  34. {
  35. efi_free_pool(bootefi_device_path);
  36. efi_free_pool(bootefi_image_path);
  37. bootefi_device_path = NULL;
  38. bootefi_image_path = NULL;
  39. image_addr = NULL;
  40. image_size = 0;
  41. }
  42. /**
  43. * efi_set_bootdev() - set boot device
  44. *
  45. * This function is called when a file is loaded, e.g. via the 'load' command.
  46. * We use the path to this file to inform the UEFI binary about the boot device.
  47. *
  48. * @dev: device, e.g. "MMC"
  49. * @devnr: number of the device, e.g. "1:2"
  50. * @path: path to file loaded
  51. * @buffer: buffer with file loaded
  52. * @buffer_size: size of file loaded
  53. */
  54. void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
  55. void *buffer, size_t buffer_size)
  56. {
  57. struct efi_device_path *device, *image;
  58. efi_status_t ret;
  59. /* Forget overwritten image */
  60. if (buffer + buffer_size >= image_addr &&
  61. image_addr + image_size >= buffer)
  62. efi_clear_bootdev();
  63. /* Remember only PE-COFF and FIT images */
  64. if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
  65. #ifdef CONFIG_FIT
  66. if (!fit_check_format(buffer))
  67. return;
  68. /*
  69. * FIT images of type EFI_OS are started via command bootm.
  70. * We should not use their boot device with the bootefi command.
  71. */
  72. buffer = 0;
  73. buffer_size = 0;
  74. #else
  75. return;
  76. #endif
  77. }
  78. /* efi_set_bootdev() is typically called repeatedly, recover memory */
  79. efi_clear_bootdev();
  80. image_addr = buffer;
  81. image_size = buffer_size;
  82. ret = efi_dp_from_name(dev, devnr, path, &device, &image);
  83. if (ret == EFI_SUCCESS) {
  84. bootefi_device_path = device;
  85. if (image) {
  86. /* FIXME: image should not contain device */
  87. struct efi_device_path *image_tmp = image;
  88. efi_dp_split_file_path(image, &device, &image);
  89. efi_free_pool(image_tmp);
  90. }
  91. bootefi_image_path = image;
  92. } else {
  93. efi_clear_bootdev();
  94. }
  95. }
  96. /**
  97. * efi_env_set_load_options() - set load options from environment variable
  98. *
  99. * @handle: the image handle
  100. * @env_var: name of the environment variable
  101. * @load_options: pointer to load options (output)
  102. * Return: status code
  103. */
  104. static efi_status_t efi_env_set_load_options(efi_handle_t handle,
  105. const char *env_var,
  106. u16 **load_options)
  107. {
  108. const char *env = env_get(env_var);
  109. size_t size;
  110. u16 *pos;
  111. efi_status_t ret;
  112. *load_options = NULL;
  113. if (!env)
  114. return EFI_SUCCESS;
  115. size = sizeof(u16) * (utf8_utf16_strlen(env) + 1);
  116. pos = calloc(size, 1);
  117. if (!pos)
  118. return EFI_OUT_OF_RESOURCES;
  119. *load_options = pos;
  120. utf8_utf16_strcpy(&pos, env);
  121. ret = efi_set_load_options(handle, size, *load_options);
  122. if (ret != EFI_SUCCESS) {
  123. free(*load_options);
  124. *load_options = NULL;
  125. }
  126. return ret;
  127. }
  128. #if !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
  129. /**
  130. * copy_fdt() - Copy the device tree to a new location available to EFI
  131. *
  132. * The FDT is copied to a suitable location within the EFI memory map.
  133. * Additional 12 KiB are added to the space in case the device tree needs to be
  134. * expanded later with fdt_open_into().
  135. *
  136. * @fdtp: On entry a pointer to the flattened device tree.
  137. * On exit a pointer to the copy of the flattened device tree.
  138. * FDT start
  139. * Return: status code
  140. */
  141. static efi_status_t copy_fdt(void **fdtp)
  142. {
  143. unsigned long fdt_ram_start = -1L, fdt_pages;
  144. efi_status_t ret = 0;
  145. void *fdt, *new_fdt;
  146. u64 new_fdt_addr;
  147. uint fdt_size;
  148. int i;
  149. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  150. u64 ram_start = gd->bd->bi_dram[i].start;
  151. u64 ram_size = gd->bd->bi_dram[i].size;
  152. if (!ram_size)
  153. continue;
  154. if (ram_start < fdt_ram_start)
  155. fdt_ram_start = ram_start;
  156. }
  157. /*
  158. * Give us at least 12 KiB of breathing room in case the device tree
  159. * needs to be expanded later.
  160. */
  161. fdt = *fdtp;
  162. fdt_pages = efi_size_in_pages(fdt_totalsize(fdt) + 0x3000);
  163. fdt_size = fdt_pages << EFI_PAGE_SHIFT;
  164. /*
  165. * Safe fdt location is at 127 MiB.
  166. * On the sandbox convert from the sandbox address space.
  167. */
  168. new_fdt_addr = (uintptr_t)map_sysmem(fdt_ram_start + 0x7f00000 +
  169. fdt_size, 0);
  170. ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
  171. EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
  172. &new_fdt_addr);
  173. if (ret != EFI_SUCCESS) {
  174. /* If we can't put it there, put it somewhere */
  175. new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
  176. ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
  177. EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
  178. &new_fdt_addr);
  179. if (ret != EFI_SUCCESS) {
  180. log_err("ERROR: Failed to reserve space for FDT\n");
  181. goto done;
  182. }
  183. }
  184. new_fdt = (void *)(uintptr_t)new_fdt_addr;
  185. memcpy(new_fdt, fdt, fdt_totalsize(fdt));
  186. fdt_set_totalsize(new_fdt, fdt_size);
  187. *fdtp = (void *)(uintptr_t)new_fdt_addr;
  188. done:
  189. return ret;
  190. }
  191. /**
  192. * get_config_table() - get configuration table
  193. *
  194. * @guid: GUID of the configuration table
  195. * Return: pointer to configuration table or NULL
  196. */
  197. static void *get_config_table(const efi_guid_t *guid)
  198. {
  199. size_t i;
  200. for (i = 0; i < systab.nr_tables; i++) {
  201. if (!guidcmp(guid, &systab.tables[i].guid))
  202. return systab.tables[i].table;
  203. }
  204. return NULL;
  205. }
  206. #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
  207. /**
  208. * efi_install_fdt() - install device tree
  209. *
  210. * If fdt is not EFI_FDT_USE_INTERNAL, the device tree located at that memory
  211. * address will will be installed as configuration table, otherwise the device
  212. * tree located at the address indicated by environment variable fdt_addr or as
  213. * fallback fdtcontroladdr will be used.
  214. *
  215. * On architectures using ACPI tables device trees shall not be installed as
  216. * configuration table.
  217. *
  218. * @fdt: address of device tree or EFI_FDT_USE_INTERNAL to use the
  219. * the hardware device tree as indicated by environment variable
  220. * fdt_addr or as fallback the internal device tree as indicated by
  221. * the environment variable fdtcontroladdr
  222. * Return: status code
  223. */
  224. efi_status_t efi_install_fdt(void *fdt)
  225. {
  226. /*
  227. * The EBBR spec requires that we have either an FDT or an ACPI table
  228. * but not both.
  229. */
  230. #if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
  231. if (fdt) {
  232. log_err("ERROR: can't have ACPI table and device tree.\n");
  233. return EFI_LOAD_ERROR;
  234. }
  235. #else
  236. bootm_headers_t img = { 0 };
  237. efi_status_t ret;
  238. if (fdt == EFI_FDT_USE_INTERNAL) {
  239. const char *fdt_opt;
  240. uintptr_t fdt_addr;
  241. /* Look for device tree that is already installed */
  242. if (get_config_table(&efi_guid_fdt))
  243. return EFI_SUCCESS;
  244. /* Check if there is a hardware device tree */
  245. fdt_opt = env_get("fdt_addr");
  246. /* Use our own device tree as fallback */
  247. if (!fdt_opt) {
  248. fdt_opt = env_get("fdtcontroladdr");
  249. if (!fdt_opt) {
  250. log_err("ERROR: need device tree\n");
  251. return EFI_NOT_FOUND;
  252. }
  253. }
  254. fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
  255. if (!fdt_addr) {
  256. log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
  257. return EFI_LOAD_ERROR;
  258. }
  259. fdt = map_sysmem(fdt_addr, 0);
  260. }
  261. /* Install device tree */
  262. if (fdt_check_header(fdt)) {
  263. log_err("ERROR: invalid device tree\n");
  264. return EFI_LOAD_ERROR;
  265. }
  266. /* Prepare device tree for payload */
  267. ret = copy_fdt(&fdt);
  268. if (ret) {
  269. log_err("ERROR: out of memory\n");
  270. return EFI_OUT_OF_RESOURCES;
  271. }
  272. if (image_setup_libfdt(&img, fdt, 0, NULL)) {
  273. log_err("ERROR: failed to process device tree\n");
  274. return EFI_LOAD_ERROR;
  275. }
  276. /* Create memory reservations as indicated by the device tree */
  277. efi_carve_out_dt_rsv(fdt);
  278. /* Install device tree as UEFI table */
  279. ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
  280. if (ret != EFI_SUCCESS) {
  281. log_err("ERROR: failed to install device tree\n");
  282. return ret;
  283. }
  284. #endif /* GENERATE_ACPI_TABLE */
  285. return EFI_SUCCESS;
  286. }
  287. /**
  288. * do_bootefi_exec() - execute EFI binary
  289. *
  290. * The image indicated by @handle is started. When it returns the allocated
  291. * memory for the @load_options is freed.
  292. *
  293. * @handle: handle of loaded image
  294. * @load_options: load options
  295. * Return: status code
  296. *
  297. * Load the EFI binary into a newly assigned memory unwinding the relocation
  298. * information, install the loaded image protocol, and call the binary.
  299. */
  300. static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
  301. {
  302. efi_status_t ret;
  303. efi_uintn_t exit_data_size = 0;
  304. u16 *exit_data = NULL;
  305. /* Call our payload! */
  306. ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
  307. if (ret != EFI_SUCCESS) {
  308. log_err("## Application failed, r = %lu\n",
  309. ret & ~EFI_ERROR_MASK);
  310. if (exit_data) {
  311. log_err("## %ls\n", exit_data);
  312. efi_free_pool(exit_data);
  313. }
  314. }
  315. efi_restore_gd();
  316. free(load_options);
  317. return ret;
  318. }
  319. /**
  320. * do_efibootmgr() - execute EFI boot manager
  321. *
  322. * Return: status code
  323. */
  324. static int do_efibootmgr(void)
  325. {
  326. efi_handle_t handle;
  327. efi_status_t ret;
  328. void *load_options;
  329. ret = efi_bootmgr_load(&handle, &load_options);
  330. if (ret != EFI_SUCCESS) {
  331. log_notice("EFI boot manager: Cannot load any image\n");
  332. return CMD_RET_FAILURE;
  333. }
  334. ret = do_bootefi_exec(handle, load_options);
  335. if (ret != EFI_SUCCESS)
  336. return CMD_RET_FAILURE;
  337. return CMD_RET_SUCCESS;
  338. }
  339. /**
  340. * do_bootefi_image() - execute EFI binary
  341. *
  342. * Set up memory image for the binary to be loaded, prepare device path, and
  343. * then call do_bootefi_exec() to execute it.
  344. *
  345. * @image_opt: string of image start address
  346. * Return: status code
  347. */
  348. static int do_bootefi_image(const char *image_opt)
  349. {
  350. void *image_buf;
  351. unsigned long addr, size;
  352. efi_status_t ret;
  353. #ifdef CONFIG_CMD_BOOTEFI_HELLO
  354. if (!strcmp(image_opt, "hello")) {
  355. image_buf = __efi_helloworld_begin;
  356. size = __efi_helloworld_end - __efi_helloworld_begin;
  357. efi_clear_bootdev();
  358. } else
  359. #endif
  360. {
  361. addr = strtoul(image_opt, NULL, 16);
  362. /* Check that a numeric value was passed */
  363. if (!addr)
  364. return CMD_RET_USAGE;
  365. image_buf = map_sysmem(addr, 0);
  366. if (image_buf != image_addr) {
  367. log_err("No UEFI binary known at %s\n", image_opt);
  368. return CMD_RET_FAILURE;
  369. }
  370. size = image_size;
  371. }
  372. ret = efi_run_image(image_buf, size);
  373. if (ret != EFI_SUCCESS)
  374. return CMD_RET_FAILURE;
  375. return CMD_RET_SUCCESS;
  376. }
  377. /**
  378. * efi_run_image() - run loaded UEFI image
  379. *
  380. * @source_buffer: memory address of the UEFI image
  381. * @source_size: size of the UEFI image
  382. * Return: status code
  383. */
  384. efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
  385. {
  386. efi_handle_t mem_handle = NULL, handle;
  387. struct efi_device_path *file_path = NULL;
  388. struct efi_device_path *msg_path;
  389. efi_status_t ret;
  390. u16 *load_options;
  391. if (!bootefi_device_path || !bootefi_image_path) {
  392. /*
  393. * Special case for efi payload not loaded from disk,
  394. * such as 'bootefi hello' or for example payload
  395. * loaded directly into memory via JTAG, etc:
  396. */
  397. file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
  398. (uintptr_t)source_buffer,
  399. source_size);
  400. /*
  401. * Make sure that device for device_path exist
  402. * in load_image(). Otherwise, shell and grub will fail.
  403. */
  404. ret = efi_create_handle(&mem_handle);
  405. if (ret != EFI_SUCCESS)
  406. goto out;
  407. ret = efi_add_protocol(mem_handle, &efi_guid_device_path,
  408. file_path);
  409. if (ret != EFI_SUCCESS)
  410. goto out;
  411. msg_path = file_path;
  412. } else {
  413. file_path = efi_dp_append(bootefi_device_path,
  414. bootefi_image_path);
  415. msg_path = bootefi_image_path;
  416. }
  417. log_info("Booting %pD\n", msg_path);
  418. ret = EFI_CALL(efi_load_image(false, efi_root, file_path, source_buffer,
  419. source_size, &handle));
  420. if (ret != EFI_SUCCESS) {
  421. log_err("Loading image failed\n");
  422. goto out;
  423. }
  424. /* Transfer environment variable as load options */
  425. ret = efi_env_set_load_options(handle, "bootargs", &load_options);
  426. if (ret != EFI_SUCCESS)
  427. goto out;
  428. ret = do_bootefi_exec(handle, load_options);
  429. out:
  430. efi_delete_handle(mem_handle);
  431. efi_free_pool(file_path);
  432. return ret;
  433. }
  434. #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
  435. static efi_status_t bootefi_run_prepare(const char *load_options_path,
  436. struct efi_device_path *device_path,
  437. struct efi_device_path *image_path,
  438. struct efi_loaded_image_obj **image_objp,
  439. struct efi_loaded_image **loaded_image_infop)
  440. {
  441. efi_status_t ret;
  442. u16 *load_options;
  443. ret = efi_setup_loaded_image(device_path, image_path, image_objp,
  444. loaded_image_infop);
  445. if (ret != EFI_SUCCESS)
  446. return ret;
  447. /* Transfer environment variable as load options */
  448. return efi_env_set_load_options((efi_handle_t)*image_objp,
  449. load_options_path,
  450. &load_options);
  451. }
  452. /**
  453. * bootefi_test_prepare() - prepare to run an EFI test
  454. *
  455. * Prepare to run a test as if it were provided by a loaded image.
  456. *
  457. * @image_objp: pointer to be set to the loaded image handle
  458. * @loaded_image_infop: pointer to be set to the loaded image protocol
  459. * @path: dummy file path used to construct the device path
  460. * set in the loaded image protocol
  461. * @load_options_path: name of a U-Boot environment variable. Its value is
  462. * set as load options in the loaded image protocol.
  463. * Return: status code
  464. */
  465. static efi_status_t bootefi_test_prepare
  466. (struct efi_loaded_image_obj **image_objp,
  467. struct efi_loaded_image **loaded_image_infop, const char *path,
  468. const char *load_options_path)
  469. {
  470. efi_status_t ret;
  471. /* Construct a dummy device path */
  472. bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, 0, 0);
  473. if (!bootefi_device_path)
  474. return EFI_OUT_OF_RESOURCES;
  475. bootefi_image_path = efi_dp_from_file(NULL, 0, path);
  476. if (!bootefi_image_path) {
  477. ret = EFI_OUT_OF_RESOURCES;
  478. goto failure;
  479. }
  480. ret = bootefi_run_prepare(load_options_path, bootefi_device_path,
  481. bootefi_image_path, image_objp,
  482. loaded_image_infop);
  483. if (ret == EFI_SUCCESS)
  484. return ret;
  485. failure:
  486. efi_clear_bootdev();
  487. return ret;
  488. }
  489. /**
  490. * bootefi_run_finish() - finish up after running an EFI test
  491. *
  492. * @loaded_image_info: Pointer to a struct which holds the loaded image info
  493. * @image_obj: Pointer to a struct which holds the loaded image object
  494. */
  495. static void bootefi_run_finish(struct efi_loaded_image_obj *image_obj,
  496. struct efi_loaded_image *loaded_image_info)
  497. {
  498. efi_restore_gd();
  499. free(loaded_image_info->load_options);
  500. efi_delete_handle(&image_obj->header);
  501. }
  502. /**
  503. * do_efi_selftest() - execute EFI selftest
  504. *
  505. * Return: status code
  506. */
  507. static int do_efi_selftest(void)
  508. {
  509. struct efi_loaded_image_obj *image_obj;
  510. struct efi_loaded_image *loaded_image_info;
  511. efi_status_t ret;
  512. ret = bootefi_test_prepare(&image_obj, &loaded_image_info,
  513. "\\selftest", "efi_selftest");
  514. if (ret != EFI_SUCCESS)
  515. return CMD_RET_FAILURE;
  516. /* Execute the test */
  517. ret = EFI_CALL(efi_selftest(&image_obj->header, &systab));
  518. bootefi_run_finish(image_obj, loaded_image_info);
  519. return ret != EFI_SUCCESS;
  520. }
  521. #endif /* CONFIG_CMD_BOOTEFI_SELFTEST */
  522. /**
  523. * do_bootefi() - execute `bootefi` command
  524. *
  525. * @cmdtp: table entry describing command
  526. * @flag: bitmap indicating how the command was invoked
  527. * @argc: number of arguments
  528. * @argv: command line arguments
  529. * Return: status code
  530. */
  531. static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
  532. char *const argv[])
  533. {
  534. efi_status_t ret;
  535. void *fdt;
  536. if (argc < 2)
  537. return CMD_RET_USAGE;
  538. /* Initialize EFI drivers */
  539. ret = efi_init_obj_list();
  540. if (ret != EFI_SUCCESS) {
  541. log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
  542. ret & ~EFI_ERROR_MASK);
  543. return CMD_RET_FAILURE;
  544. }
  545. if (argc > 2) {
  546. uintptr_t fdt_addr;
  547. fdt_addr = simple_strtoul(argv[2], NULL, 16);
  548. fdt = map_sysmem(fdt_addr, 0);
  549. } else {
  550. fdt = EFI_FDT_USE_INTERNAL;
  551. }
  552. ret = efi_install_fdt(fdt);
  553. if (ret == EFI_INVALID_PARAMETER)
  554. return CMD_RET_USAGE;
  555. else if (ret != EFI_SUCCESS)
  556. return CMD_RET_FAILURE;
  557. if (!strcmp(argv[1], "bootmgr"))
  558. return do_efibootmgr();
  559. #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
  560. else if (!strcmp(argv[1], "selftest"))
  561. return do_efi_selftest();
  562. #endif
  563. return do_bootefi_image(argv[1]);
  564. }
  565. #ifdef CONFIG_SYS_LONGHELP
  566. static char bootefi_help_text[] =
  567. "<image address> [fdt address]\n"
  568. " - boot EFI payload stored at address <image address>.\n"
  569. " If specified, the device tree located at <fdt address> gets\n"
  570. " exposed as EFI configuration table.\n"
  571. #ifdef CONFIG_CMD_BOOTEFI_HELLO
  572. "bootefi hello\n"
  573. " - boot a sample Hello World application stored within U-Boot\n"
  574. #endif
  575. #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
  576. "bootefi selftest [fdt address]\n"
  577. " - boot an EFI selftest application stored within U-Boot\n"
  578. " Use environment variable efi_selftest to select a single test.\n"
  579. " Use 'setenv efi_selftest list' to enumerate all tests.\n"
  580. #endif
  581. "bootefi bootmgr [fdt address]\n"
  582. " - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
  583. "\n"
  584. " If specified, the device tree located at <fdt address> gets\n"
  585. " exposed as EFI configuration table.\n";
  586. #endif
  587. U_BOOT_CMD(
  588. bootefi, 3, 0, do_bootefi,
  589. "Boots an EFI payload from memory",
  590. bootefi_help_text
  591. );