efi_runtime.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  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. /* We don't have anything to map this to */
  131. break;
  132. }
  133. while (1) { }
  134. }
  135. /**
  136. * efi_get_time_boottime() - get current time at boot time
  137. *
  138. * This function implements the GetTime runtime service before
  139. * SetVirtualAddressMap() is called.
  140. *
  141. * See the Unified Extensible Firmware Interface (UEFI) specification
  142. * for details.
  143. *
  144. * @time: pointer to structure to receive current time
  145. * @capabilities: pointer to structure to receive RTC properties
  146. * Returns: status code
  147. */
  148. static efi_status_t EFIAPI efi_get_time_boottime(
  149. struct efi_time *time,
  150. struct efi_time_cap *capabilities)
  151. {
  152. #ifdef CONFIG_DM_RTC
  153. efi_status_t ret = EFI_SUCCESS;
  154. int r;
  155. struct rtc_time tm;
  156. struct udevice *dev;
  157. EFI_ENTRY("%p %p", time, capabilities);
  158. if (!time) {
  159. ret = EFI_INVALID_PARAMETER;
  160. goto out;
  161. }
  162. r = uclass_get_device(UCLASS_RTC, 0, &dev);
  163. if (!r)
  164. r = dm_rtc_get(dev, &tm);
  165. if (r) {
  166. ret = EFI_DEVICE_ERROR;
  167. goto out;
  168. }
  169. memset(time, 0, sizeof(*time));
  170. time->year = tm.tm_year;
  171. time->month = tm.tm_mon;
  172. time->day = tm.tm_mday;
  173. time->hour = tm.tm_hour;
  174. time->minute = tm.tm_min;
  175. time->second = tm.tm_sec;
  176. time->daylight = EFI_TIME_ADJUST_DAYLIGHT;
  177. if (tm.tm_isdst > 0)
  178. time->daylight |= EFI_TIME_IN_DAYLIGHT;
  179. time->timezone = EFI_UNSPECIFIED_TIMEZONE;
  180. if (capabilities) {
  181. /* Set reasonable dummy values */
  182. capabilities->resolution = 1; /* 1 Hz */
  183. capabilities->accuracy = 100000000; /* 100 ppm */
  184. capabilities->sets_to_zero = false;
  185. }
  186. out:
  187. return EFI_EXIT(ret);
  188. #else
  189. EFI_ENTRY("%p %p", time, capabilities);
  190. return EFI_EXIT(EFI_DEVICE_ERROR);
  191. #endif
  192. }
  193. /**
  194. * efi_reset_system() - reset system
  195. *
  196. * This function implements the ResetSystem() runtime service after
  197. * SetVirtualAddressMap() is called. It only executes an endless loop.
  198. * Boards may override the helpers below to implement reset functionality.
  199. *
  200. * See the Unified Extensible Firmware Interface (UEFI) specification for
  201. * details.
  202. *
  203. * @reset_type: type of reset to perform
  204. * @reset_status: status code for the reset
  205. * @data_size: size of reset_data
  206. * @reset_data: information about the reset
  207. */
  208. void __weak __efi_runtime EFIAPI efi_reset_system(
  209. enum efi_reset_type reset_type,
  210. efi_status_t reset_status,
  211. unsigned long data_size, void *reset_data)
  212. {
  213. /* Nothing we can do */
  214. while (1) { }
  215. }
  216. /**
  217. * efi_reset_system_init() - initialize the reset driver
  218. *
  219. * Boards may override this function to initialize the reset driver.
  220. */
  221. efi_status_t __weak efi_reset_system_init(void)
  222. {
  223. return EFI_SUCCESS;
  224. }
  225. /**
  226. * efi_get_time() - get current time
  227. *
  228. * This function implements the GetTime runtime service after
  229. * SetVirtualAddressMap() is called. As the U-Boot driver are not available
  230. * anymore only an error code is returned.
  231. *
  232. * See the Unified Extensible Firmware Interface (UEFI) specification
  233. * for details.
  234. *
  235. * @time: pointer to structure to receive current time
  236. * @capabilities: pointer to structure to receive RTC properties
  237. * Returns: status code
  238. */
  239. efi_status_t __weak __efi_runtime EFIAPI efi_get_time(
  240. struct efi_time *time,
  241. struct efi_time_cap *capabilities)
  242. {
  243. /* Nothing we can do */
  244. return EFI_DEVICE_ERROR;
  245. }
  246. struct efi_runtime_detach_list_struct {
  247. void *ptr;
  248. void *patchto;
  249. };
  250. static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = {
  251. {
  252. /* do_reset is gone */
  253. .ptr = &efi_runtime_services.reset_system,
  254. .patchto = efi_reset_system,
  255. }, {
  256. /* invalidate_*cache_all are gone */
  257. .ptr = &efi_runtime_services.set_virtual_address_map,
  258. .patchto = &efi_invalid_parameter,
  259. }, {
  260. /* RTC accessors are gone */
  261. .ptr = &efi_runtime_services.get_time,
  262. .patchto = &efi_get_time,
  263. }, {
  264. /* Clean up system table */
  265. .ptr = &systab.con_in,
  266. .patchto = NULL,
  267. }, {
  268. /* Clean up system table */
  269. .ptr = &systab.con_out,
  270. .patchto = NULL,
  271. }, {
  272. /* Clean up system table */
  273. .ptr = &systab.std_err,
  274. .patchto = NULL,
  275. }, {
  276. /* Clean up system table */
  277. .ptr = &systab.boottime,
  278. .patchto = NULL,
  279. }, {
  280. .ptr = &efi_runtime_services.get_variable,
  281. .patchto = &efi_device_error,
  282. }, {
  283. .ptr = &efi_runtime_services.get_next_variable_name,
  284. .patchto = &efi_device_error,
  285. }, {
  286. .ptr = &efi_runtime_services.set_variable,
  287. .patchto = &efi_device_error,
  288. }
  289. };
  290. static bool efi_runtime_tobedetached(void *p)
  291. {
  292. int i;
  293. for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++)
  294. if (efi_runtime_detach_list[i].ptr == p)
  295. return true;
  296. return false;
  297. }
  298. static void efi_runtime_detach(ulong offset)
  299. {
  300. int i;
  301. ulong patchoff = offset - (ulong)gd->relocaddr;
  302. for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) {
  303. ulong patchto = (ulong)efi_runtime_detach_list[i].patchto;
  304. ulong *p = efi_runtime_detach_list[i].ptr;
  305. ulong newaddr = patchto ? (patchto + patchoff) : 0;
  306. debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
  307. *p = newaddr;
  308. }
  309. /* Update CRC32 */
  310. efi_update_table_header_crc32(&efi_runtime_services.hdr);
  311. }
  312. /* Relocate EFI runtime to uboot_reloc_base = offset */
  313. void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
  314. {
  315. #ifdef IS_RELA
  316. struct elf_rela *rel = (void*)&__efi_runtime_rel_start;
  317. #else
  318. struct elf_rel *rel = (void*)&__efi_runtime_rel_start;
  319. static ulong lastoff = CONFIG_SYS_TEXT_BASE;
  320. #endif
  321. debug("%s: Relocating to offset=%lx\n", __func__, offset);
  322. for (; (ulong)rel < (ulong)&__efi_runtime_rel_stop; rel++) {
  323. ulong base = CONFIG_SYS_TEXT_BASE;
  324. ulong *p;
  325. ulong newaddr;
  326. p = (void*)((ulong)rel->offset - base) + gd->relocaddr;
  327. debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__,
  328. rel->info, *p, rel->offset);
  329. switch (rel->info & R_MASK) {
  330. case R_RELATIVE:
  331. #ifdef IS_RELA
  332. newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE;
  333. #else
  334. newaddr = *p - lastoff + offset;
  335. #endif
  336. break;
  337. #ifdef R_ABSOLUTE
  338. case R_ABSOLUTE: {
  339. ulong symidx = rel->info >> SYM_INDEX;
  340. extern struct dyn_sym __dyn_sym_start[];
  341. newaddr = __dyn_sym_start[symidx].addr + offset;
  342. break;
  343. }
  344. #endif
  345. default:
  346. if (!efi_runtime_tobedetached(p))
  347. printf("%s: Unknown relocation type %llx\n",
  348. __func__, rel->info & R_MASK);
  349. continue;
  350. }
  351. /* Check if the relocation is inside bounds */
  352. if (map && ((newaddr < map->virtual_start) ||
  353. newaddr > (map->virtual_start +
  354. (map->num_pages << EFI_PAGE_SHIFT)))) {
  355. if (!efi_runtime_tobedetached(p))
  356. printf("%s: Relocation at %p is out of "
  357. "range (%lx)\n", __func__, p, newaddr);
  358. continue;
  359. }
  360. debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
  361. *p = newaddr;
  362. flush_dcache_range((ulong)p & ~(EFI_CACHELINE_SIZE - 1),
  363. ALIGN((ulong)&p[1], EFI_CACHELINE_SIZE));
  364. }
  365. #ifndef IS_RELA
  366. lastoff = offset;
  367. #endif
  368. invalidate_icache_all();
  369. }
  370. /**
  371. * efi_set_virtual_address_map() - change from physical to virtual mapping
  372. *
  373. * This function implements the SetVirtualAddressMap() runtime service.
  374. *
  375. * See the Unified Extensible Firmware Interface (UEFI) specification for
  376. * details.
  377. *
  378. * @memory_map_size: size of the virtual map
  379. * @descriptor_size: size of an entry in the map
  380. * @descriptor_version: version of the map entries
  381. * @virtmap: virtual address mapping information
  382. * Return: status code
  383. */
  384. static efi_status_t EFIAPI efi_set_virtual_address_map(
  385. unsigned long memory_map_size,
  386. unsigned long descriptor_size,
  387. uint32_t descriptor_version,
  388. struct efi_mem_desc *virtmap)
  389. {
  390. ulong runtime_start = (ulong)&__efi_runtime_start &
  391. ~(ulong)EFI_PAGE_MASK;
  392. int n = memory_map_size / descriptor_size;
  393. int i;
  394. EFI_ENTRY("%lx %lx %x %p", memory_map_size, descriptor_size,
  395. descriptor_version, virtmap);
  396. /* Rebind mmio pointers */
  397. for (i = 0; i < n; i++) {
  398. struct efi_mem_desc *map = (void*)virtmap +
  399. (descriptor_size * i);
  400. struct list_head *lhandle;
  401. efi_physical_addr_t map_start = map->physical_start;
  402. efi_physical_addr_t map_len = map->num_pages << EFI_PAGE_SHIFT;
  403. efi_physical_addr_t map_end = map_start + map_len;
  404. u64 off = map->virtual_start - map_start;
  405. /* Adjust all mmio pointers in this region */
  406. list_for_each(lhandle, &efi_runtime_mmio) {
  407. struct efi_runtime_mmio_list *lmmio;
  408. lmmio = list_entry(lhandle,
  409. struct efi_runtime_mmio_list,
  410. link);
  411. if ((map_start <= lmmio->paddr) &&
  412. (map_end >= lmmio->paddr)) {
  413. uintptr_t new_addr = lmmio->paddr + off;
  414. *lmmio->ptr = (void *)new_addr;
  415. }
  416. }
  417. if ((map_start <= (uintptr_t)systab.tables) &&
  418. (map_end >= (uintptr_t)systab.tables)) {
  419. char *ptr = (char *)systab.tables;
  420. ptr += off;
  421. systab.tables = (struct efi_configuration_table *)ptr;
  422. }
  423. }
  424. /* Move the actual runtime code over */
  425. for (i = 0; i < n; i++) {
  426. struct efi_mem_desc *map;
  427. map = (void*)virtmap + (descriptor_size * i);
  428. if (map->type == EFI_RUNTIME_SERVICES_CODE) {
  429. ulong new_offset = map->virtual_start -
  430. (runtime_start - gd->relocaddr);
  431. efi_runtime_relocate(new_offset, map);
  432. /* Once we're virtual, we can no longer handle
  433. complex callbacks */
  434. efi_runtime_detach(new_offset);
  435. return EFI_EXIT(EFI_SUCCESS);
  436. }
  437. }
  438. return EFI_EXIT(EFI_INVALID_PARAMETER);
  439. }
  440. /**
  441. * efi_add_runtime_mmio() - add memory-mapped IO region
  442. *
  443. * This function adds a memory-mapped IO region to the memory map to make it
  444. * available at runtime.
  445. *
  446. * @mmio_ptr: address of the memory-mapped IO region
  447. * @len: size of the memory-mapped IO region
  448. * Returns: status code
  449. */
  450. efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
  451. {
  452. struct efi_runtime_mmio_list *newmmio;
  453. u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
  454. uint64_t addr = *(uintptr_t *)mmio_ptr;
  455. uint64_t retaddr;
  456. retaddr = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false);
  457. if (retaddr != addr)
  458. return EFI_OUT_OF_RESOURCES;
  459. newmmio = calloc(1, sizeof(*newmmio));
  460. if (!newmmio)
  461. return EFI_OUT_OF_RESOURCES;
  462. newmmio->ptr = mmio_ptr;
  463. newmmio->paddr = *(uintptr_t *)mmio_ptr;
  464. newmmio->len = len;
  465. list_add_tail(&newmmio->link, &efi_runtime_mmio);
  466. return EFI_SUCCESS;
  467. }
  468. /*
  469. * In the second stage, U-Boot has disappeared. To isolate our runtime code
  470. * that at this point still exists from the rest, we put it into a special
  471. * section.
  472. *
  473. * !!WARNING!!
  474. *
  475. * This means that we can not rely on any code outside of this file in any
  476. * function or variable below this line.
  477. *
  478. * Please keep everything fully self-contained and annotated with
  479. * __efi_runtime and __efi_runtime_data markers.
  480. */
  481. /*
  482. * Relocate the EFI runtime stub to a different place. We need to call this
  483. * the first time we expose the runtime interface to a user and on set virtual
  484. * address map calls.
  485. */
  486. /**
  487. * efi_unimplemented() - replacement function, returns EFI_UNSUPPORTED
  488. *
  489. * This function is used after SetVirtualAddressMap() is called as replacement
  490. * for services that are not available anymore due to constraints of the U-Boot
  491. * implementation.
  492. *
  493. * Return: EFI_UNSUPPORTED
  494. */
  495. static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void)
  496. {
  497. return EFI_UNSUPPORTED;
  498. }
  499. /**
  500. * efi_device_error() - replacement function, returns EFI_DEVICE_ERROR
  501. *
  502. * This function is used after SetVirtualAddressMap() is called as replacement
  503. * for services that are not available anymore due to constraints of the U-Boot
  504. * implementation.
  505. *
  506. * Return: EFI_DEVICE_ERROR
  507. */
  508. static efi_status_t __efi_runtime EFIAPI efi_device_error(void)
  509. {
  510. return EFI_DEVICE_ERROR;
  511. }
  512. /**
  513. * efi_invalid_parameter() - replacement function, returns EFI_INVALID_PARAMETER
  514. *
  515. * This function is used after SetVirtualAddressMap() is called as replacement
  516. * for services that are not available anymore due to constraints of the U-Boot
  517. * implementation.
  518. *
  519. * Return: EFI_INVALID_PARAMETER
  520. */
  521. static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void)
  522. {
  523. return EFI_INVALID_PARAMETER;
  524. }
  525. /**
  526. * efi_update_capsule() - process information from operating system
  527. *
  528. * This function implements the UpdateCapsule() runtime service.
  529. *
  530. * See the Unified Extensible Firmware Interface (UEFI) specification for
  531. * details.
  532. *
  533. * @capsule_header_array: pointer to array of virtual pointers
  534. * @capsule_count: number of pointers in capsule_header_array
  535. * @scatter_gather_list: pointer to arry of physical pointers
  536. * Returns: status code
  537. */
  538. efi_status_t __efi_runtime EFIAPI efi_update_capsule(
  539. struct efi_capsule_header **capsule_header_array,
  540. efi_uintn_t capsule_count,
  541. u64 scatter_gather_list)
  542. {
  543. return EFI_UNSUPPORTED;
  544. }
  545. /**
  546. * efi_query_capsule_caps() - check if capsule is supported
  547. *
  548. * This function implements the QueryCapsuleCapabilities() runtime service.
  549. *
  550. * See the Unified Extensible Firmware Interface (UEFI) specification for
  551. * details.
  552. *
  553. * @capsule_header_array: pointer to array of virtual pointers
  554. * @capsule_count: number of pointers in capsule_header_array
  555. * @maximum_capsule_size: maximum capsule size
  556. * @reset_type: type of reset needed for capsule update
  557. * Returns: status code
  558. */
  559. efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps(
  560. struct efi_capsule_header **capsule_header_array,
  561. efi_uintn_t capsule_count,
  562. u64 maximum_capsule_size,
  563. u32 reset_type)
  564. {
  565. return EFI_UNSUPPORTED;
  566. }
  567. /**
  568. * efi_query_variable_info() - get information about EFI variables
  569. *
  570. * This function implements the QueryVariableInfo() runtime service.
  571. *
  572. * See the Unified Extensible Firmware Interface (UEFI) specification for
  573. * details.
  574. *
  575. * @attributes: bitmask to select variables to be
  576. * queried
  577. * @maximum_variable_storage_size: maximum size of storage area for the
  578. * selected variable types
  579. * @remaining_variable_storage_size: remaining size of storage are for the
  580. * selected variable types
  581. * @maximum_variable_size: maximum size of a variable of the
  582. * selected type
  583. * Returns: status code
  584. */
  585. efi_status_t __efi_runtime EFIAPI efi_query_variable_info(
  586. u32 attributes,
  587. u64 *maximum_variable_storage_size,
  588. u64 *remaining_variable_storage_size,
  589. u64 *maximum_variable_size)
  590. {
  591. return EFI_UNSUPPORTED;
  592. }
  593. struct efi_runtime_services __efi_runtime_data efi_runtime_services = {
  594. .hdr = {
  595. .signature = EFI_RUNTIME_SERVICES_SIGNATURE,
  596. .revision = EFI_SPECIFICATION_VERSION,
  597. .headersize = sizeof(struct efi_runtime_services),
  598. },
  599. .get_time = &efi_get_time_boottime,
  600. .set_time = (void *)&efi_device_error,
  601. .get_wakeup_time = (void *)&efi_unimplemented,
  602. .set_wakeup_time = (void *)&efi_unimplemented,
  603. .set_virtual_address_map = &efi_set_virtual_address_map,
  604. .convert_pointer = (void *)&efi_invalid_parameter,
  605. .get_variable = efi_get_variable,
  606. .get_next_variable_name = efi_get_next_variable_name,
  607. .set_variable = efi_set_variable,
  608. .get_next_high_mono_count = (void *)&efi_device_error,
  609. .reset_system = &efi_reset_system_boottime,
  610. .update_capsule = efi_update_capsule,
  611. .query_capsule_caps = efi_query_capsule_caps,
  612. .query_variable_info = efi_query_variable_info,
  613. };