efi_runtime.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * EFI application runtime services
  4. *
  5. * Copyright (c) 2016 Alexander Graf
  6. */
  7. #include <common.h>
  8. #include <command.h>
  9. #include <dm.h>
  10. #include <elf.h>
  11. #include <efi_loader.h>
  12. #include <rtc.h>
  13. /* For manual relocation support */
  14. DECLARE_GLOBAL_DATA_PTR;
  15. struct efi_runtime_mmio_list {
  16. struct list_head link;
  17. void **ptr;
  18. u64 paddr;
  19. u64 len;
  20. };
  21. /* This list contains all runtime available mmio regions */
  22. LIST_HEAD(efi_runtime_mmio);
  23. static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void);
  24. static efi_status_t __efi_runtime EFIAPI efi_device_error(void);
  25. static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
  26. /*
  27. * TODO(sjg@chromium.org): These defines and structures should come from the ELF
  28. * header for each architecture (or a generic header) rather than being repeated
  29. * here.
  30. */
  31. #if defined(__aarch64__)
  32. #define R_RELATIVE R_AARCH64_RELATIVE
  33. #define R_MASK 0xffffffffULL
  34. #define IS_RELA 1
  35. #elif defined(__arm__)
  36. #define R_RELATIVE R_ARM_RELATIVE
  37. #define R_MASK 0xffULL
  38. #elif defined(__i386__)
  39. #define R_RELATIVE R_386_RELATIVE
  40. #define R_MASK 0xffULL
  41. #elif defined(__x86_64__)
  42. #define R_RELATIVE R_X86_64_RELATIVE
  43. #define R_MASK 0xffffffffULL
  44. #define IS_RELA 1
  45. #elif defined(__riscv)
  46. #define R_RELATIVE R_RISCV_RELATIVE
  47. #define R_MASK 0xffULL
  48. #define IS_RELA 1
  49. struct dyn_sym {
  50. ulong foo1;
  51. ulong addr;
  52. u32 foo2;
  53. u32 foo3;
  54. };
  55. #if (__riscv_xlen == 32)
  56. #define R_ABSOLUTE R_RISCV_32
  57. #define SYM_INDEX 8
  58. #elif (__riscv_xlen == 64)
  59. #define R_ABSOLUTE R_RISCV_64
  60. #define SYM_INDEX 32
  61. #else
  62. #error unknown riscv target
  63. #endif
  64. #else
  65. #error Need to add relocation awareness
  66. #endif
  67. struct elf_rel {
  68. ulong *offset;
  69. ulong info;
  70. };
  71. struct elf_rela {
  72. ulong *offset;
  73. ulong info;
  74. long addend;
  75. };
  76. /*
  77. * EFI runtime code lives in two stages. In the first stage, U-Boot and an EFI
  78. * payload are running concurrently at the same time. In this mode, we can
  79. * handle a good number of runtime callbacks
  80. */
  81. /**
  82. * efi_update_table_header_crc32() - Update crc32 in table header
  83. *
  84. * @table: EFI table
  85. */
  86. void __efi_runtime efi_update_table_header_crc32(struct efi_table_hdr *table)
  87. {
  88. table->crc32 = 0;
  89. table->crc32 = crc32(0, (const unsigned char *)table,
  90. table->headersize);
  91. }
  92. /**
  93. * efi_reset_system_boottime() - reset system at boot time
  94. *
  95. * This function implements the ResetSystem() runtime service before
  96. * SetVirtualAddressMap() is called.
  97. *
  98. * See the Unified Extensible Firmware Interface (UEFI) specification for
  99. * details.
  100. *
  101. * @reset_type: type of reset to perform
  102. * @reset_status: status code for the reset
  103. * @data_size: size of reset_data
  104. * @reset_data: information about the reset
  105. */
  106. static void EFIAPI efi_reset_system_boottime(
  107. enum efi_reset_type reset_type,
  108. efi_status_t reset_status,
  109. unsigned long data_size, void *reset_data)
  110. {
  111. struct efi_event *evt;
  112. EFI_ENTRY("%d %lx %lx %p", reset_type, reset_status, data_size,
  113. reset_data);
  114. /* Notify reset */
  115. list_for_each_entry(evt, &efi_events, link) {
  116. if (evt->group &&
  117. !guidcmp(evt->group,
  118. &efi_guid_event_group_reset_system)) {
  119. efi_signal_event(evt, false);
  120. break;
  121. }
  122. }
  123. switch (reset_type) {
  124. case EFI_RESET_COLD:
  125. case EFI_RESET_WARM:
  126. case EFI_RESET_PLATFORM_SPECIFIC:
  127. do_reset(NULL, 0, 0, NULL);
  128. break;
  129. case EFI_RESET_SHUTDOWN:
  130. #ifdef CONFIG_CMD_POWEROFF
  131. do_poweroff(NULL, 0, 0, NULL);
  132. #endif
  133. break;
  134. }
  135. while (1) { }
  136. }
  137. /**
  138. * efi_get_time_boottime() - get current time at boot time
  139. *
  140. * This function implements the GetTime runtime service before
  141. * SetVirtualAddressMap() is called.
  142. *
  143. * See the Unified Extensible Firmware Interface (UEFI) specification
  144. * for details.
  145. *
  146. * @time: pointer to structure to receive current time
  147. * @capabilities: pointer to structure to receive RTC properties
  148. * Returns: status code
  149. */
  150. static efi_status_t EFIAPI efi_get_time_boottime(
  151. struct efi_time *time,
  152. struct efi_time_cap *capabilities)
  153. {
  154. #ifdef CONFIG_DM_RTC
  155. efi_status_t ret = EFI_SUCCESS;
  156. int r;
  157. struct rtc_time tm;
  158. struct udevice *dev;
  159. EFI_ENTRY("%p %p", time, capabilities);
  160. if (!time) {
  161. ret = EFI_INVALID_PARAMETER;
  162. goto out;
  163. }
  164. r = uclass_get_device(UCLASS_RTC, 0, &dev);
  165. if (!r)
  166. r = dm_rtc_get(dev, &tm);
  167. if (r) {
  168. ret = EFI_DEVICE_ERROR;
  169. goto out;
  170. }
  171. memset(time, 0, sizeof(*time));
  172. time->year = tm.tm_year;
  173. time->month = tm.tm_mon;
  174. time->day = tm.tm_mday;
  175. time->hour = tm.tm_hour;
  176. time->minute = tm.tm_min;
  177. time->second = tm.tm_sec;
  178. time->daylight = EFI_TIME_ADJUST_DAYLIGHT;
  179. if (tm.tm_isdst > 0)
  180. time->daylight |= EFI_TIME_IN_DAYLIGHT;
  181. time->timezone = EFI_UNSPECIFIED_TIMEZONE;
  182. if (capabilities) {
  183. /* Set reasonable dummy values */
  184. capabilities->resolution = 1; /* 1 Hz */
  185. capabilities->accuracy = 100000000; /* 100 ppm */
  186. capabilities->sets_to_zero = false;
  187. }
  188. out:
  189. return EFI_EXIT(ret);
  190. #else
  191. EFI_ENTRY("%p %p", time, capabilities);
  192. return EFI_EXIT(EFI_DEVICE_ERROR);
  193. #endif
  194. }
  195. /**
  196. * efi_reset_system() - reset system
  197. *
  198. * This function implements the ResetSystem() runtime service after
  199. * SetVirtualAddressMap() is called. It only executes an endless loop.
  200. * Boards may override the helpers below to implement reset functionality.
  201. *
  202. * See the Unified Extensible Firmware Interface (UEFI) specification for
  203. * details.
  204. *
  205. * @reset_type: type of reset to perform
  206. * @reset_status: status code for the reset
  207. * @data_size: size of reset_data
  208. * @reset_data: information about the reset
  209. */
  210. void __weak __efi_runtime EFIAPI efi_reset_system(
  211. enum efi_reset_type reset_type,
  212. efi_status_t reset_status,
  213. unsigned long data_size, void *reset_data)
  214. {
  215. /* Nothing we can do */
  216. while (1) { }
  217. }
  218. /**
  219. * efi_reset_system_init() - initialize the reset driver
  220. *
  221. * Boards may override this function to initialize the reset driver.
  222. */
  223. efi_status_t __weak efi_reset_system_init(void)
  224. {
  225. return EFI_SUCCESS;
  226. }
  227. /**
  228. * efi_get_time() - get current time
  229. *
  230. * This function implements the GetTime runtime service after
  231. * SetVirtualAddressMap() is called. As the U-Boot driver are not available
  232. * anymore only an error code is returned.
  233. *
  234. * See the Unified Extensible Firmware Interface (UEFI) specification
  235. * for details.
  236. *
  237. * @time: pointer to structure to receive current time
  238. * @capabilities: pointer to structure to receive RTC properties
  239. * Returns: status code
  240. */
  241. efi_status_t __weak __efi_runtime EFIAPI efi_get_time(
  242. struct efi_time *time,
  243. struct efi_time_cap *capabilities)
  244. {
  245. /* Nothing we can do */
  246. return EFI_DEVICE_ERROR;
  247. }
  248. struct efi_runtime_detach_list_struct {
  249. void *ptr;
  250. void *patchto;
  251. };
  252. static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = {
  253. {
  254. /* do_reset is gone */
  255. .ptr = &efi_runtime_services.reset_system,
  256. .patchto = efi_reset_system,
  257. }, {
  258. /* invalidate_*cache_all are gone */
  259. .ptr = &efi_runtime_services.set_virtual_address_map,
  260. .patchto = &efi_unimplemented,
  261. }, {
  262. /* RTC accessors are gone */
  263. .ptr = &efi_runtime_services.get_time,
  264. .patchto = &efi_get_time,
  265. }, {
  266. /* Clean up system table */
  267. .ptr = &systab.con_in,
  268. .patchto = NULL,
  269. }, {
  270. /* Clean up system table */
  271. .ptr = &systab.con_out,
  272. .patchto = NULL,
  273. }, {
  274. /* Clean up system table */
  275. .ptr = &systab.std_err,
  276. .patchto = NULL,
  277. }, {
  278. /* Clean up system table */
  279. .ptr = &systab.boottime,
  280. .patchto = NULL,
  281. }, {
  282. .ptr = &efi_runtime_services.get_variable,
  283. .patchto = &efi_device_error,
  284. }, {
  285. .ptr = &efi_runtime_services.get_next_variable_name,
  286. .patchto = &efi_device_error,
  287. }, {
  288. .ptr = &efi_runtime_services.set_variable,
  289. .patchto = &efi_device_error,
  290. }
  291. };
  292. static bool efi_runtime_tobedetached(void *p)
  293. {
  294. int i;
  295. for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++)
  296. if (efi_runtime_detach_list[i].ptr == p)
  297. return true;
  298. return false;
  299. }
  300. static void efi_runtime_detach(ulong offset)
  301. {
  302. int i;
  303. ulong patchoff = offset - (ulong)gd->relocaddr;
  304. for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) {
  305. ulong patchto = (ulong)efi_runtime_detach_list[i].patchto;
  306. ulong *p = efi_runtime_detach_list[i].ptr;
  307. ulong newaddr = patchto ? (patchto + patchoff) : 0;
  308. debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
  309. *p = newaddr;
  310. }
  311. /* Update CRC32 */
  312. efi_update_table_header_crc32(&efi_runtime_services.hdr);
  313. }
  314. /* Relocate EFI runtime to uboot_reloc_base = offset */
  315. void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
  316. {
  317. #ifdef IS_RELA
  318. struct elf_rela *rel = (void*)&__efi_runtime_rel_start;
  319. #else
  320. struct elf_rel *rel = (void*)&__efi_runtime_rel_start;
  321. static ulong lastoff = CONFIG_SYS_TEXT_BASE;
  322. #endif
  323. debug("%s: Relocating to offset=%lx\n", __func__, offset);
  324. for (; (ulong)rel < (ulong)&__efi_runtime_rel_stop; rel++) {
  325. ulong base = CONFIG_SYS_TEXT_BASE;
  326. ulong *p;
  327. ulong newaddr;
  328. p = (void*)((ulong)rel->offset - base) + gd->relocaddr;
  329. debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__,
  330. rel->info, *p, rel->offset);
  331. switch (rel->info & R_MASK) {
  332. case R_RELATIVE:
  333. #ifdef IS_RELA
  334. newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE;
  335. #else
  336. newaddr = *p - lastoff + offset;
  337. #endif
  338. break;
  339. #ifdef R_ABSOLUTE
  340. case R_ABSOLUTE: {
  341. ulong symidx = rel->info >> SYM_INDEX;
  342. extern struct dyn_sym __dyn_sym_start[];
  343. newaddr = __dyn_sym_start[symidx].addr + offset;
  344. #ifdef IS_RELA
  345. newaddr -= CONFIG_SYS_TEXT_BASE;
  346. #endif
  347. break;
  348. }
  349. #endif
  350. default:
  351. if (!efi_runtime_tobedetached(p))
  352. printf("%s: Unknown relocation type %llx\n",
  353. __func__, rel->info & R_MASK);
  354. continue;
  355. }
  356. /* Check if the relocation is inside bounds */
  357. if (map && ((newaddr < map->virtual_start) ||
  358. newaddr > (map->virtual_start +
  359. (map->num_pages << EFI_PAGE_SHIFT)))) {
  360. if (!efi_runtime_tobedetached(p))
  361. printf("%s: Relocation at %p is out of "
  362. "range (%lx)\n", __func__, p, newaddr);
  363. continue;
  364. }
  365. debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
  366. *p = newaddr;
  367. flush_dcache_range((ulong)p & ~(EFI_CACHELINE_SIZE - 1),
  368. ALIGN((ulong)&p[1], EFI_CACHELINE_SIZE));
  369. }
  370. #ifndef IS_RELA
  371. lastoff = offset;
  372. #endif
  373. invalidate_icache_all();
  374. }
  375. /**
  376. * efi_set_virtual_address_map() - change from physical to virtual mapping
  377. *
  378. * This function implements the SetVirtualAddressMap() runtime service.
  379. *
  380. * See the Unified Extensible Firmware Interface (UEFI) specification for
  381. * details.
  382. *
  383. * @memory_map_size: size of the virtual map
  384. * @descriptor_size: size of an entry in the map
  385. * @descriptor_version: version of the map entries
  386. * @virtmap: virtual address mapping information
  387. * Return: status code
  388. */
  389. static efi_status_t EFIAPI efi_set_virtual_address_map(
  390. unsigned long memory_map_size,
  391. unsigned long descriptor_size,
  392. uint32_t descriptor_version,
  393. struct efi_mem_desc *virtmap)
  394. {
  395. int n = memory_map_size / descriptor_size;
  396. int i;
  397. int rt_code_sections = 0;
  398. EFI_ENTRY("%lx %lx %x %p", memory_map_size, descriptor_size,
  399. descriptor_version, virtmap);
  400. /*
  401. * TODO:
  402. * Further down we are cheating. While really we should implement
  403. * SetVirtualAddressMap() events and ConvertPointer() to allow
  404. * dynamically loaded drivers to expose runtime services, we don't
  405. * today.
  406. *
  407. * So let's ensure we see exactly one single runtime section, as
  408. * that is the built-in one. If we see more (or less), someone must
  409. * have tried adding or removing to that which we don't support yet.
  410. * In that case, let's better fail rather than expose broken runtime
  411. * services.
  412. */
  413. for (i = 0; i < n; i++) {
  414. struct efi_mem_desc *map = (void*)virtmap +
  415. (descriptor_size * i);
  416. if (map->type == EFI_RUNTIME_SERVICES_CODE)
  417. rt_code_sections++;
  418. }
  419. if (rt_code_sections != 1) {
  420. /*
  421. * We expose exactly one single runtime code section, so
  422. * something is definitely going wrong.
  423. */
  424. return EFI_EXIT(EFI_INVALID_PARAMETER);
  425. }
  426. /* Rebind mmio pointers */
  427. for (i = 0; i < n; i++) {
  428. struct efi_mem_desc *map = (void*)virtmap +
  429. (descriptor_size * i);
  430. struct list_head *lhandle;
  431. efi_physical_addr_t map_start = map->physical_start;
  432. efi_physical_addr_t map_len = map->num_pages << EFI_PAGE_SHIFT;
  433. efi_physical_addr_t map_end = map_start + map_len;
  434. u64 off = map->virtual_start - map_start;
  435. /* Adjust all mmio pointers in this region */
  436. list_for_each(lhandle, &efi_runtime_mmio) {
  437. struct efi_runtime_mmio_list *lmmio;
  438. lmmio = list_entry(lhandle,
  439. struct efi_runtime_mmio_list,
  440. link);
  441. if ((map_start <= lmmio->paddr) &&
  442. (map_end >= lmmio->paddr)) {
  443. uintptr_t new_addr = lmmio->paddr + off;
  444. *lmmio->ptr = (void *)new_addr;
  445. }
  446. }
  447. if ((map_start <= (uintptr_t)systab.tables) &&
  448. (map_end >= (uintptr_t)systab.tables)) {
  449. char *ptr = (char *)systab.tables;
  450. ptr += off;
  451. systab.tables = (struct efi_configuration_table *)ptr;
  452. }
  453. }
  454. /* Move the actual runtime code over */
  455. for (i = 0; i < n; i++) {
  456. struct efi_mem_desc *map;
  457. map = (void*)virtmap + (descriptor_size * i);
  458. if (map->type == EFI_RUNTIME_SERVICES_CODE) {
  459. ulong new_offset = map->virtual_start -
  460. map->physical_start + gd->relocaddr;
  461. efi_runtime_relocate(new_offset, map);
  462. /* Once we're virtual, we can no longer handle
  463. complex callbacks */
  464. efi_runtime_detach(new_offset);
  465. return EFI_EXIT(EFI_SUCCESS);
  466. }
  467. }
  468. return EFI_EXIT(EFI_INVALID_PARAMETER);
  469. }
  470. /**
  471. * efi_add_runtime_mmio() - add memory-mapped IO region
  472. *
  473. * This function adds a memory-mapped IO region to the memory map to make it
  474. * available at runtime.
  475. *
  476. * @mmio_ptr: address of the memory-mapped IO region
  477. * @len: size of the memory-mapped IO region
  478. * Returns: status code
  479. */
  480. efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
  481. {
  482. struct efi_runtime_mmio_list *newmmio;
  483. u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
  484. uint64_t addr = *(uintptr_t *)mmio_ptr;
  485. uint64_t retaddr;
  486. retaddr = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false);
  487. if (retaddr != addr)
  488. return EFI_OUT_OF_RESOURCES;
  489. newmmio = calloc(1, sizeof(*newmmio));
  490. if (!newmmio)
  491. return EFI_OUT_OF_RESOURCES;
  492. newmmio->ptr = mmio_ptr;
  493. newmmio->paddr = *(uintptr_t *)mmio_ptr;
  494. newmmio->len = len;
  495. list_add_tail(&newmmio->link, &efi_runtime_mmio);
  496. return EFI_SUCCESS;
  497. }
  498. /*
  499. * In the second stage, U-Boot has disappeared. To isolate our runtime code
  500. * that at this point still exists from the rest, we put it into a special
  501. * section.
  502. *
  503. * !!WARNING!!
  504. *
  505. * This means that we can not rely on any code outside of this file in any
  506. * function or variable below this line.
  507. *
  508. * Please keep everything fully self-contained and annotated with
  509. * __efi_runtime and __efi_runtime_data markers.
  510. */
  511. /*
  512. * Relocate the EFI runtime stub to a different place. We need to call this
  513. * the first time we expose the runtime interface to a user and on set virtual
  514. * address map calls.
  515. */
  516. /**
  517. * efi_unimplemented() - replacement function, returns EFI_UNSUPPORTED
  518. *
  519. * This function is used after SetVirtualAddressMap() is called as replacement
  520. * for services that are not available anymore due to constraints of the U-Boot
  521. * implementation.
  522. *
  523. * Return: EFI_UNSUPPORTED
  524. */
  525. static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void)
  526. {
  527. return EFI_UNSUPPORTED;
  528. }
  529. /**
  530. * efi_device_error() - replacement function, returns EFI_DEVICE_ERROR
  531. *
  532. * This function is used after SetVirtualAddressMap() is called as replacement
  533. * for services that are not available anymore due to constraints of the U-Boot
  534. * implementation.
  535. *
  536. * Return: EFI_DEVICE_ERROR
  537. */
  538. static efi_status_t __efi_runtime EFIAPI efi_device_error(void)
  539. {
  540. return EFI_DEVICE_ERROR;
  541. }
  542. /**
  543. * efi_invalid_parameter() - replacement function, returns EFI_INVALID_PARAMETER
  544. *
  545. * This function is used after SetVirtualAddressMap() is called as replacement
  546. * for services that are not available anymore due to constraints of the U-Boot
  547. * implementation.
  548. *
  549. * Return: EFI_INVALID_PARAMETER
  550. */
  551. static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void)
  552. {
  553. return EFI_INVALID_PARAMETER;
  554. }
  555. /**
  556. * efi_update_capsule() - process information from operating system
  557. *
  558. * This function implements the UpdateCapsule() runtime service.
  559. *
  560. * See the Unified Extensible Firmware Interface (UEFI) specification for
  561. * details.
  562. *
  563. * @capsule_header_array: pointer to array of virtual pointers
  564. * @capsule_count: number of pointers in capsule_header_array
  565. * @scatter_gather_list: pointer to arry of physical pointers
  566. * Returns: status code
  567. */
  568. efi_status_t __efi_runtime EFIAPI efi_update_capsule(
  569. struct efi_capsule_header **capsule_header_array,
  570. efi_uintn_t capsule_count,
  571. u64 scatter_gather_list)
  572. {
  573. return EFI_UNSUPPORTED;
  574. }
  575. /**
  576. * efi_query_capsule_caps() - check if capsule is supported
  577. *
  578. * This function implements the QueryCapsuleCapabilities() runtime service.
  579. *
  580. * See the Unified Extensible Firmware Interface (UEFI) specification for
  581. * details.
  582. *
  583. * @capsule_header_array: pointer to array of virtual pointers
  584. * @capsule_count: number of pointers in capsule_header_array
  585. * @maximum_capsule_size: maximum capsule size
  586. * @reset_type: type of reset needed for capsule update
  587. * Returns: status code
  588. */
  589. efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps(
  590. struct efi_capsule_header **capsule_header_array,
  591. efi_uintn_t capsule_count,
  592. u64 *maximum_capsule_size,
  593. u32 *reset_type)
  594. {
  595. return EFI_UNSUPPORTED;
  596. }
  597. /**
  598. * efi_query_variable_info() - get information about EFI variables
  599. *
  600. * This function implements the QueryVariableInfo() runtime service.
  601. *
  602. * See the Unified Extensible Firmware Interface (UEFI) specification for
  603. * details.
  604. *
  605. * @attributes: bitmask to select variables to be
  606. * queried
  607. * @maximum_variable_storage_size: maximum size of storage area for the
  608. * selected variable types
  609. * @remaining_variable_storage_size: remaining size of storage are for the
  610. * selected variable types
  611. * @maximum_variable_size: maximum size of a variable of the
  612. * selected type
  613. * Returns: status code
  614. */
  615. efi_status_t __efi_runtime EFIAPI efi_query_variable_info(
  616. u32 attributes,
  617. u64 *maximum_variable_storage_size,
  618. u64 *remaining_variable_storage_size,
  619. u64 *maximum_variable_size)
  620. {
  621. return EFI_UNSUPPORTED;
  622. }
  623. struct efi_runtime_services __efi_runtime_data efi_runtime_services = {
  624. .hdr = {
  625. .signature = EFI_RUNTIME_SERVICES_SIGNATURE,
  626. .revision = EFI_SPECIFICATION_VERSION,
  627. .headersize = sizeof(struct efi_runtime_services),
  628. },
  629. .get_time = &efi_get_time_boottime,
  630. .set_time = (void *)&efi_device_error,
  631. .get_wakeup_time = (void *)&efi_unimplemented,
  632. .set_wakeup_time = (void *)&efi_unimplemented,
  633. .set_virtual_address_map = &efi_set_virtual_address_map,
  634. .convert_pointer = (void *)&efi_invalid_parameter,
  635. .get_variable = efi_get_variable,
  636. .get_next_variable_name = efi_get_next_variable_name,
  637. .set_variable = efi_set_variable,
  638. .get_next_high_mono_count = (void *)&efi_device_error,
  639. .reset_system = &efi_reset_system_boottime,
  640. .update_capsule = efi_update_capsule,
  641. .query_capsule_caps = efi_query_capsule_caps,
  642. .query_variable_info = efi_query_variable_info,
  643. };