efi_runtime.c 18 KB

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