blob: 5b6506fbdc272bedd2deea3c515192d39c617676 [file] [log] [blame]
Tom Rinif739fcd2018-05-07 17:02:21 -04001// SPDX-License-Identifier: GPL-2.0+
Alexander Graf50149ea2016-03-04 01:10:01 +01002/*
3 * EFI application runtime services
4 *
5 * Copyright (c) 2016 Alexander Graf
Alexander Graf50149ea2016-03-04 01:10:01 +01006 */
7
8#include <common.h>
9#include <command.h>
Simon Glass1eb69ae2019-11-14 12:57:39 -070010#include <cpu_func.h>
Alexander Graf50149ea2016-03-04 01:10:01 +010011#include <dm.h>
Alexander Grafb34662d2018-06-18 17:23:11 +020012#include <elf.h>
Alexander Graf50149ea2016-03-04 01:10:01 +010013#include <efi_loader.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060014#include <log.h>
Simon Glass336d4612020-02-03 07:36:16 -070015#include <malloc.h>
Alexander Graf50149ea2016-03-04 01:10:01 +010016#include <rtc.h>
Simon Glass3db71102019-11-14 12:57:16 -070017#include <u-boot/crc.h>
Alexander Graf50149ea2016-03-04 01:10:01 +010018
19/* For manual relocation support */
20DECLARE_GLOBAL_DATA_PTR;
21
Heinrich Schuchardt76be6872020-02-19 20:48:49 +010022/* GUID of the runtime properties table */
23static const efi_guid_t efi_rt_properties_table_guid =
24 EFI_RT_PROPERTIES_TABLE_GUID;
25
Alexander Graf80a48002016-08-16 21:08:45 +020026struct efi_runtime_mmio_list {
27 struct list_head link;
28 void **ptr;
29 u64 paddr;
30 u64 len;
31};
32
33/* This list contains all runtime available mmio regions */
34LIST_HEAD(efi_runtime_mmio);
35
Alexander Graf3c63db92016-10-14 13:45:30 +020036static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void);
Alexander Graf50149ea2016-03-04 01:10:01 +010037
Simon Glass2d2b5b22018-06-11 23:26:40 -060038/*
Heinrich Schuchardt250b3252018-09-03 19:29:41 +020039 * TODO(sjg@chromium.org): These defines and structures should come from the ELF
40 * header for each architecture (or a generic header) rather than being repeated
41 * here.
Simon Glass2d2b5b22018-06-11 23:26:40 -060042 */
Alexander Grafbc028912018-06-18 17:23:08 +020043#if defined(__aarch64__)
Alexander Grafb34662d2018-06-18 17:23:11 +020044#define R_RELATIVE R_AARCH64_RELATIVE
Alexander Graf50149ea2016-03-04 01:10:01 +010045#define R_MASK 0xffffffffULL
46#define IS_RELA 1
Alexander Grafbc028912018-06-18 17:23:08 +020047#elif defined(__arm__)
Alexander Grafb34662d2018-06-18 17:23:11 +020048#define R_RELATIVE R_ARM_RELATIVE
Alexander Graf50149ea2016-03-04 01:10:01 +010049#define R_MASK 0xffULL
Heinrich Schuchardt3ce78292018-10-13 20:52:08 -070050#elif defined(__i386__)
Simon Glass65e4c0b2016-09-25 15:27:35 -060051#define R_RELATIVE R_386_RELATIVE
52#define R_MASK 0xffULL
Heinrich Schuchardt3ce78292018-10-13 20:52:08 -070053#elif defined(__x86_64__)
54#define R_RELATIVE R_X86_64_RELATIVE
55#define R_MASK 0xffffffffULL
56#define IS_RELA 1
Alexander Grafbc028912018-06-18 17:23:08 +020057#elif defined(__riscv)
Rick Chen6836adb2018-05-28 19:06:37 +080058#define R_RELATIVE R_RISCV_RELATIVE
59#define R_MASK 0xffULL
60#define IS_RELA 1
61
62struct dyn_sym {
63 ulong foo1;
64 ulong addr;
65 u32 foo2;
66 u32 foo3;
67};
Alexander Grafbc028912018-06-18 17:23:08 +020068#if (__riscv_xlen == 32)
Rick Chen6836adb2018-05-28 19:06:37 +080069#define R_ABSOLUTE R_RISCV_32
70#define SYM_INDEX 8
Alexander Grafbc028912018-06-18 17:23:08 +020071#elif (__riscv_xlen == 64)
Rick Chen6836adb2018-05-28 19:06:37 +080072#define R_ABSOLUTE R_RISCV_64
73#define SYM_INDEX 32
Alexander Grafbc028912018-06-18 17:23:08 +020074#else
75#error unknown riscv target
Rick Chen6836adb2018-05-28 19:06:37 +080076#endif
Alexander Graf50149ea2016-03-04 01:10:01 +010077#else
78#error Need to add relocation awareness
79#endif
80
81struct elf_rel {
82 ulong *offset;
83 ulong info;
84};
85
86struct elf_rela {
87 ulong *offset;
88 ulong info;
89 long addend;
90};
91
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +020092static __efi_runtime_data struct efi_mem_desc *efi_virtmap;
93static __efi_runtime_data efi_uintn_t efi_descriptor_count;
94static __efi_runtime_data efi_uintn_t efi_descriptor_size;
95
Alexander Graf50149ea2016-03-04 01:10:01 +010096/*
Heinrich Schuchardt250b3252018-09-03 19:29:41 +020097 * EFI runtime code lives in two stages. In the first stage, U-Boot and an EFI
Alexander Graf50149ea2016-03-04 01:10:01 +010098 * payload are running concurrently at the same time. In this mode, we can
99 * handle a good number of runtime callbacks
100 */
101
Heinrich Schuchardt76be6872020-02-19 20:48:49 +0100102/**
103 * efi_init_runtime_supported() - create runtime properties table
104 *
105 * Create a configuration table specifying which services are available at
106 * runtime.
107 *
108 * Return: status code
109 */
AKASHI Takahiroe771b4b2019-06-05 13:21:38 +0900110efi_status_t efi_init_runtime_supported(void)
111{
Heinrich Schuchardt76be6872020-02-19 20:48:49 +0100112 efi_status_t ret;
113 struct efi_rt_properties_table *rt_table;
114
115 ret = efi_allocate_pool(EFI_RUNTIME_SERVICES_DATA,
116 sizeof(struct efi_rt_properties_table),
117 (void **)&rt_table);
118 if (ret != EFI_SUCCESS)
119 return ret;
120
121 rt_table->version = EFI_RT_PROPERTIES_TABLE_VERSION;
122 rt_table->length = sizeof(struct efi_rt_properties_table);
123 rt_table->runtime_services_supported =
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200124 EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP |
125 EFI_RT_SUPPORTED_CONVERT_POINTER;
AKASHI Takahiroe771b4b2019-06-05 13:21:38 +0900126
127 /*
128 * This value must be synced with efi_runtime_detach_list
129 * as well as efi_runtime_services.
130 */
Heinrich Schuchardt953661a2019-07-05 18:12:16 +0200131#ifdef CONFIG_EFI_HAVE_RUNTIME_RESET
Heinrich Schuchardt76be6872020-02-19 20:48:49 +0100132 rt_table->runtime_services_supported |= EFI_RT_SUPPORTED_RESET_SYSTEM;
AKASHI Takahiroe771b4b2019-06-05 13:21:38 +0900133#endif
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200134
Heinrich Schuchardt76be6872020-02-19 20:48:49 +0100135 ret = efi_install_configuration_table(&efi_rt_properties_table_guid,
136 rt_table);
137 return ret;
AKASHI Takahiroe771b4b2019-06-05 13:21:38 +0900138}
139
Heinrich Schuchardta39f39c2018-07-29 09:49:04 +0200140/**
Heinrich Schuchardtb0dd8cb2020-06-28 16:30:29 +0200141 * efi_memcpy_runtime() - copy memory area
142 *
143 * At runtime memcpy() is not available.
144 *
145 * @dest: destination buffer
146 * @src: source buffer
147 * @n: number of bytes to copy
148 * Return: pointer to destination buffer
149 */
150void __efi_runtime efi_memcpy_runtime(void *dest, const void *src, size_t n)
151{
152 u8 *d = dest;
153 const u8 *s = src;
154
155 for (; n; --n)
156 *d++ = *s++;
157}
158
159/**
Heinrich Schuchardta39f39c2018-07-29 09:49:04 +0200160 * efi_update_table_header_crc32() - Update crc32 in table header
161 *
162 * @table: EFI table
163 */
164void __efi_runtime efi_update_table_header_crc32(struct efi_table_hdr *table)
165{
166 table->crc32 = 0;
167 table->crc32 = crc32(0, (const unsigned char *)table,
168 table->headersize);
169}
170
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200171/**
Heinrich Schuchardt250b3252018-09-03 19:29:41 +0200172 * efi_reset_system_boottime() - reset system at boot time
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200173 *
174 * This function implements the ResetSystem() runtime service before
175 * SetVirtualAddressMap() is called.
176 *
177 * See the Unified Extensible Firmware Interface (UEFI) specification for
178 * details.
179 *
180 * @reset_type: type of reset to perform
181 * @reset_status: status code for the reset
182 * @data_size: size of reset_data
183 * @reset_data: information about the reset
184 */
Alexander Graf80a48002016-08-16 21:08:45 +0200185static void EFIAPI efi_reset_system_boottime(
186 enum efi_reset_type reset_type,
187 efi_status_t reset_status,
188 unsigned long data_size, void *reset_data)
Alexander Graf50149ea2016-03-04 01:10:01 +0100189{
Heinrich Schuchardtb095f3c2018-02-18 15:17:52 +0100190 struct efi_event *evt;
191
Alexander Graf50149ea2016-03-04 01:10:01 +0100192 EFI_ENTRY("%d %lx %lx %p", reset_type, reset_status, data_size,
193 reset_data);
194
Heinrich Schuchardtb095f3c2018-02-18 15:17:52 +0100195 /* Notify reset */
196 list_for_each_entry(evt, &efi_events, link) {
197 if (evt->group &&
198 !guidcmp(evt->group,
199 &efi_guid_event_group_reset_system)) {
Heinrich Schuchardt7eaa9002019-06-07 06:47:01 +0200200 efi_signal_event(evt);
Heinrich Schuchardtb095f3c2018-02-18 15:17:52 +0100201 break;
202 }
203 }
Alexander Graf50149ea2016-03-04 01:10:01 +0100204 switch (reset_type) {
205 case EFI_RESET_COLD:
206 case EFI_RESET_WARM:
Heinrich Schuchardt482fc902018-02-06 22:00:22 +0100207 case EFI_RESET_PLATFORM_SPECIFIC:
Alexander Graf50149ea2016-03-04 01:10:01 +0100208 do_reset(NULL, 0, 0, NULL);
209 break;
210 case EFI_RESET_SHUTDOWN:
Heinrich Schuchardte706ed72018-10-16 07:44:53 +0200211#ifdef CONFIG_CMD_POWEROFF
212 do_poweroff(NULL, 0, 0, NULL);
213#endif
Alexander Graf50149ea2016-03-04 01:10:01 +0100214 break;
215 }
216
Alexander Graf80a48002016-08-16 21:08:45 +0200217 while (1) { }
Alexander Graf50149ea2016-03-04 01:10:01 +0100218}
219
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200220/**
Heinrich Schuchardt250b3252018-09-03 19:29:41 +0200221 * efi_get_time_boottime() - get current time at boot time
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200222 *
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200223 * This function implements the GetTime runtime service before
224 * SetVirtualAddressMap() is called.
225 *
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200226 * See the Unified Extensible Firmware Interface (UEFI) specification
227 * for details.
228 *
229 * @time: pointer to structure to receive current time
230 * @capabilities: pointer to structure to receive RTC properties
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200231 * Returns: status code
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200232 */
Alexander Graf80a48002016-08-16 21:08:45 +0200233static efi_status_t EFIAPI efi_get_time_boottime(
234 struct efi_time *time,
235 struct efi_time_cap *capabilities)
Alexander Graf50149ea2016-03-04 01:10:01 +0100236{
Heinrich Schuchardt5ec48e32019-05-31 22:56:02 +0200237#ifdef CONFIG_EFI_GET_TIME
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200238 efi_status_t ret = EFI_SUCCESS;
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200239 struct rtc_time tm;
Alexander Graf50149ea2016-03-04 01:10:01 +0100240 struct udevice *dev;
241
242 EFI_ENTRY("%p %p", time, capabilities);
243
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200244 if (!time) {
245 ret = EFI_INVALID_PARAMETER;
246 goto out;
247 }
Heinrich Schuchardtbb2b13d2019-05-19 21:41:28 +0200248 if (uclass_get_device(UCLASS_RTC, 0, &dev) ||
249 dm_rtc_get(dev, &tm)) {
250 ret = EFI_UNSUPPORTED;
251 goto out;
252 }
253 if (dm_rtc_get(dev, &tm)) {
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200254 ret = EFI_DEVICE_ERROR;
255 goto out;
256 }
Alexander Graf50149ea2016-03-04 01:10:01 +0100257
258 memset(time, 0, sizeof(*time));
259 time->year = tm.tm_year;
260 time->month = tm.tm_mon;
261 time->day = tm.tm_mday;
262 time->hour = tm.tm_hour;
263 time->minute = tm.tm_min;
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200264 time->second = tm.tm_sec;
Heinrich Schuchardt38b9a792019-05-31 22:08:45 +0200265 if (tm.tm_isdst)
266 time->daylight =
267 EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT;
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200268 time->timezone = EFI_UNSPECIFIED_TIMEZONE;
Alexander Graf50149ea2016-03-04 01:10:01 +0100269
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200270 if (capabilities) {
271 /* Set reasonable dummy values */
272 capabilities->resolution = 1; /* 1 Hz */
273 capabilities->accuracy = 100000000; /* 100 ppm */
274 capabilities->sets_to_zero = false;
275 }
276out:
277 return EFI_EXIT(ret);
Alexander Graf50149ea2016-03-04 01:10:01 +0100278#else
Heinrich Schuchardt49de2452018-07-07 23:39:14 +0200279 EFI_ENTRY("%p %p", time, capabilities);
Heinrich Schuchardtbb2b13d2019-05-19 21:41:28 +0200280 return EFI_EXIT(EFI_UNSUPPORTED);
Alexander Graf50149ea2016-03-04 01:10:01 +0100281#endif
282}
283
Heinrich Schuchardt5ec48e32019-05-31 22:56:02 +0200284#ifdef CONFIG_EFI_SET_TIME
Heinrich Schuchardte6bcc352019-05-31 07:35:19 +0200285
286/**
287 * efi_validate_time() - checks if timestamp is valid
288 *
289 * @time: timestamp to validate
290 * Returns: 0 if timestamp is valid, 1 otherwise
291 */
292static int efi_validate_time(struct efi_time *time)
293{
294 return (!time ||
295 time->year < 1900 || time->year > 9999 ||
296 !time->month || time->month > 12 || !time->day ||
297 time->day > rtc_month_days(time->month - 1, time->year) ||
298 time->hour > 23 || time->minute > 59 || time->second > 59 ||
299 time->nanosecond > 999999999 ||
300 time->daylight &
301 ~(EFI_TIME_IN_DAYLIGHT | EFI_TIME_ADJUST_DAYLIGHT) ||
302 ((time->timezone < -1440 || time->timezone > 1440) &&
303 time->timezone != EFI_UNSPECIFIED_TIMEZONE));
304}
305
306#endif
307
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200308/**
309 * efi_set_time_boottime() - set current time
310 *
311 * This function implements the SetTime() runtime service before
312 * SetVirtualAddressMap() is called.
313 *
314 * See the Unified Extensible Firmware Interface (UEFI) specification
315 * for details.
316 *
317 * @time: pointer to structure to with current time
318 * Returns: status code
319 */
320static efi_status_t EFIAPI efi_set_time_boottime(struct efi_time *time)
321{
Heinrich Schuchardt5ec48e32019-05-31 22:56:02 +0200322#ifdef CONFIG_EFI_SET_TIME
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200323 efi_status_t ret = EFI_SUCCESS;
324 struct rtc_time tm;
325 struct udevice *dev;
Alexander Graf80a48002016-08-16 21:08:45 +0200326
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200327 EFI_ENTRY("%p", time);
328
Heinrich Schuchardte6bcc352019-05-31 07:35:19 +0200329 if (efi_validate_time(time)) {
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200330 ret = EFI_INVALID_PARAMETER;
331 goto out;
332 }
333
334 if (uclass_get_device(UCLASS_RTC, 0, &dev)) {
335 ret = EFI_UNSUPPORTED;
336 goto out;
337 }
338
339 memset(&tm, 0, sizeof(tm));
340 tm.tm_year = time->year;
341 tm.tm_mon = time->month;
342 tm.tm_mday = time->day;
343 tm.tm_hour = time->hour;
344 tm.tm_min = time->minute;
345 tm.tm_sec = time->second;
Heinrich Schuchardt38b9a792019-05-31 22:08:45 +0200346 tm.tm_isdst = time->daylight ==
347 (EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT);
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200348 /* Calculate day of week */
349 rtc_calc_weekday(&tm);
350
351 if (dm_rtc_set(dev, &tm))
352 ret = EFI_DEVICE_ERROR;
353out:
354 return EFI_EXIT(ret);
355#else
356 EFI_ENTRY("%p", time);
357 return EFI_EXIT(EFI_UNSUPPORTED);
358#endif
359}
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200360/**
361 * efi_reset_system() - reset system
362 *
363 * This function implements the ResetSystem() runtime service after
364 * SetVirtualAddressMap() is called. It only executes an endless loop.
365 * Boards may override the helpers below to implement reset functionality.
366 *
367 * See the Unified Extensible Firmware Interface (UEFI) specification for
368 * details.
369 *
370 * @reset_type: type of reset to perform
371 * @reset_status: status code for the reset
372 * @data_size: size of reset_data
373 * @reset_data: information about the reset
374 */
Alexander Graf3c63db92016-10-14 13:45:30 +0200375void __weak __efi_runtime EFIAPI efi_reset_system(
Alexander Graf80a48002016-08-16 21:08:45 +0200376 enum efi_reset_type reset_type,
377 efi_status_t reset_status,
378 unsigned long data_size, void *reset_data)
379{
380 /* Nothing we can do */
381 while (1) { }
382}
383
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200384/**
385 * efi_reset_system_init() - initialize the reset driver
386 *
387 * Boards may override this function to initialize the reset driver.
388 */
Heinrich Schuchardt22c793e2018-03-03 15:28:59 +0100389efi_status_t __weak efi_reset_system_init(void)
Alexander Graf80a48002016-08-16 21:08:45 +0200390{
Heinrich Schuchardt22c793e2018-03-03 15:28:59 +0100391 return EFI_SUCCESS;
Alexander Graf80a48002016-08-16 21:08:45 +0200392}
393
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200394/**
395 * efi_get_time() - get current time
396 *
397 * This function implements the GetTime runtime service after
398 * SetVirtualAddressMap() is called. As the U-Boot driver are not available
399 * anymore only an error code is returned.
400 *
401 * See the Unified Extensible Firmware Interface (UEFI) specification
402 * for details.
403 *
404 * @time: pointer to structure to receive current time
405 * @capabilities: pointer to structure to receive RTC properties
406 * Returns: status code
407 */
Alexander Graf3c63db92016-10-14 13:45:30 +0200408efi_status_t __weak __efi_runtime EFIAPI efi_get_time(
Alexander Graf80a48002016-08-16 21:08:45 +0200409 struct efi_time *time,
410 struct efi_time_cap *capabilities)
411{
Heinrich Schuchardtc5b63be2019-06-13 18:42:40 +0200412 return EFI_UNSUPPORTED;
Alexander Graf80a48002016-08-16 21:08:45 +0200413}
414
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200415/**
416 * efi_set_time() - set current time
417 *
418 * This function implements the SetTime runtime service after
419 * SetVirtualAddressMap() is called. As the U-Boot driver are not available
420 * anymore only an error code is returned.
421 *
422 * See the Unified Extensible Firmware Interface (UEFI) specification
423 * for details.
424 *
425 * @time: pointer to structure to with current time
426 * Returns: status code
427 */
428efi_status_t __weak __efi_runtime EFIAPI efi_set_time(struct efi_time *time)
429{
430 return EFI_UNSUPPORTED;
431}
432
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000433/**
434 * efi_is_runtime_service_pointer() - check if pointer points to runtime table
435 *
436 * @p: pointer to check
437 * Return: true if the pointer points to a service function pointer in the
438 * runtime table
439 */
440static bool efi_is_runtime_service_pointer(void *p)
Alexander Graf50149ea2016-03-04 01:10:01 +0100441{
Heinrich Schuchardt14b40482019-07-11 20:15:09 +0200442 return (p >= (void *)&efi_runtime_services.get_time &&
443 p <= (void *)&efi_runtime_services.query_variable_info) ||
444 p == (void *)&efi_events.prev ||
445 p == (void *)&efi_events.next;
Alexander Graf50149ea2016-03-04 01:10:01 +0100446}
447
Heinrich Schuchardtb23ffcb2019-07-05 18:12:21 +0200448/**
449 * efi_runtime_detach() - detach unimplemented runtime functions
450 */
Heinrich Schuchardt7f951042019-07-05 17:42:16 +0200451void efi_runtime_detach(void)
Alexander Graf50149ea2016-03-04 01:10:01 +0100452{
Heinrich Schuchardtb23ffcb2019-07-05 18:12:21 +0200453 efi_runtime_services.reset_system = efi_reset_system;
454 efi_runtime_services.get_time = efi_get_time;
455 efi_runtime_services.set_time = efi_set_time;
Alexander Graf50149ea2016-03-04 01:10:01 +0100456
Heinrich Schuchardtb23ffcb2019-07-05 18:12:21 +0200457 /* Update CRC32 */
458 efi_update_table_header_crc32(&efi_runtime_services.hdr);
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000459}
460
Heinrich Schuchardtee8ebaa2019-06-29 03:32:52 +0200461/**
462 * efi_set_virtual_address_map_runtime() - change from physical to virtual
463 * mapping
464 *
465 * This function implements the SetVirtualAddressMap() runtime service after
466 * it is first called.
467 *
468 * See the Unified Extensible Firmware Interface (UEFI) specification for
469 * details.
470 *
471 * @memory_map_size: size of the virtual map
472 * @descriptor_size: size of an entry in the map
473 * @descriptor_version: version of the map entries
474 * @virtmap: virtual address mapping information
475 * Return: status code EFI_UNSUPPORTED
476 */
Heinrich Schuchardt96185602019-07-12 22:41:43 +0200477static __efi_runtime efi_status_t EFIAPI efi_set_virtual_address_map_runtime(
Heinrich Schuchardt24e67222019-07-27 20:28:47 +0200478 efi_uintn_t memory_map_size,
479 efi_uintn_t descriptor_size,
Heinrich Schuchardtee8ebaa2019-06-29 03:32:52 +0200480 uint32_t descriptor_version,
481 struct efi_mem_desc *virtmap)
482{
483 return EFI_UNSUPPORTED;
484}
485
486/**
487 * efi_convert_pointer_runtime() - convert from physical to virtual pointer
488 *
489 * This function implements the ConvertPointer() runtime service after
490 * the first call to SetVirtualAddressMap().
491 *
492 * See the Unified Extensible Firmware Interface (UEFI) specification for
493 * details.
494 *
495 * @debug_disposition: indicates if pointer may be converted to NULL
496 * @address: pointer to be converted
497 * Return: status code EFI_UNSUPPORTED
498 */
499static __efi_runtime efi_status_t EFIAPI efi_convert_pointer_runtime(
500 efi_uintn_t debug_disposition, void **address)
501{
502 return EFI_UNSUPPORTED;
503}
504
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200505/**
Heinrich Schuchardt7aeceff2020-03-22 08:28:15 +0100506 * efi_convert_pointer() - convert from physical to virtual pointer
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200507 *
508 * This function implements the ConvertPointer() runtime service until
509 * the first call to SetVirtualAddressMap().
510 *
511 * See the Unified Extensible Firmware Interface (UEFI) specification for
512 * details.
513 *
514 * @debug_disposition: indicates if pointer may be converted to NULL
515 * @address: pointer to be converted
Heinrich Schuchardt7aeceff2020-03-22 08:28:15 +0100516 * Return: status code
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200517 */
Heinrich Schuchardta44d2a22020-03-24 18:05:22 +0100518__efi_runtime efi_status_t EFIAPI
519efi_convert_pointer(efi_uintn_t debug_disposition, void **address)
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200520{
Heinrich Schuchardta27c78f2020-07-07 03:10:12 +0200521 efi_physical_addr_t addr;
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200522 efi_uintn_t i;
523 efi_status_t ret = EFI_NOT_FOUND;
524
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200525 if (!efi_virtmap) {
526 ret = EFI_UNSUPPORTED;
527 goto out;
528 }
529
530 if (!address) {
531 ret = EFI_INVALID_PARAMETER;
532 goto out;
533 }
Heinrich Schuchardt724d2812020-03-24 17:52:40 +0100534 if (!*address) {
535 if (debug_disposition & EFI_OPTIONAL_PTR)
536 return EFI_SUCCESS;
537 else
538 return EFI_INVALID_PARAMETER;
539 }
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200540
Heinrich Schuchardta27c78f2020-07-07 03:10:12 +0200541 addr = (uintptr_t)*address;
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200542 for (i = 0; i < efi_descriptor_count; i++) {
543 struct efi_mem_desc *map = (void *)efi_virtmap +
544 (efi_descriptor_size * i);
545
546 if (addr >= map->physical_start &&
547 (addr < map->physical_start
548 + (map->num_pages << EFI_PAGE_SHIFT))) {
549 *address = (void *)(uintptr_t)
550 (addr + map->virtual_start -
551 map->physical_start);
552
553 ret = EFI_SUCCESS;
554 break;
555 }
556 }
557
558out:
Heinrich Schuchardta44d2a22020-03-24 18:05:22 +0100559 return ret;
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200560}
561
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000562static __efi_runtime void efi_relocate_runtime_table(ulong offset)
563{
564 ulong patchoff;
565 void **pos;
566
567 /* Relocate the runtime services pointers */
568 patchoff = offset - gd->relocaddr;
569 for (pos = (void **)&efi_runtime_services.get_time;
570 pos <= (void **)&efi_runtime_services.query_variable_info; ++pos) {
Heinrich Schuchardtee8ebaa2019-06-29 03:32:52 +0200571 if (*pos)
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000572 *pos += patchoff;
Alexander Graf50149ea2016-03-04 01:10:01 +0100573 }
Heinrich Schuchardta39f39c2018-07-29 09:49:04 +0200574
Heinrich Schuchardtee8ebaa2019-06-29 03:32:52 +0200575 /*
576 * The entry for SetVirtualAddress() must point to a physical address.
577 * After the first execution the service must return EFI_UNSUPPORTED.
578 */
579 efi_runtime_services.set_virtual_address_map =
580 &efi_set_virtual_address_map_runtime;
581
582 /*
583 * The entry for ConvertPointer() must point to a physical address.
584 * The service is not usable after SetVirtualAddress().
585 */
586 efi_runtime_services.convert_pointer = &efi_convert_pointer_runtime;
587
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200588 /*
589 * TODO: Update UEFI variable RuntimeServicesSupported removing flags
590 * EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP and
591 * EFI_RT_SUPPORTED_CONVERT_POINTER as required by the UEFI spec 2.8.
592 */
593
Heinrich Schuchardt250b3252018-09-03 19:29:41 +0200594 /* Update CRC32 */
Heinrich Schuchardta39f39c2018-07-29 09:49:04 +0200595 efi_update_table_header_crc32(&efi_runtime_services.hdr);
Alexander Graf50149ea2016-03-04 01:10:01 +0100596}
597
598/* Relocate EFI runtime to uboot_reloc_base = offset */
599void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
600{
601#ifdef IS_RELA
602 struct elf_rela *rel = (void*)&__efi_runtime_rel_start;
603#else
604 struct elf_rel *rel = (void*)&__efi_runtime_rel_start;
605 static ulong lastoff = CONFIG_SYS_TEXT_BASE;
606#endif
607
Alexander Grafedcef3b2016-06-02 11:38:27 +0200608 debug("%s: Relocating to offset=%lx\n", __func__, offset);
Alexander Graf50149ea2016-03-04 01:10:01 +0100609 for (; (ulong)rel < (ulong)&__efi_runtime_rel_stop; rel++) {
610 ulong base = CONFIG_SYS_TEXT_BASE;
611 ulong *p;
612 ulong newaddr;
613
614 p = (void*)((ulong)rel->offset - base) + gd->relocaddr;
615
Heinrich Schuchardt9f8932d2019-08-14 06:49:09 +0200616 /*
617 * The runtime services table is updated in
618 * efi_relocate_runtime_table()
619 */
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000620 if (map && efi_is_runtime_service_pointer(p))
621 continue;
622
Heinrich Schuchardt3ce78292018-10-13 20:52:08 -0700623 debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__,
624 rel->info, *p, rel->offset);
Alexander Graf50149ea2016-03-04 01:10:01 +0100625
Rick Chen6836adb2018-05-28 19:06:37 +0800626 switch (rel->info & R_MASK) {
627 case R_RELATIVE:
Alexander Graf50149ea2016-03-04 01:10:01 +0100628#ifdef IS_RELA
629 newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE;
630#else
631 newaddr = *p - lastoff + offset;
632#endif
Rick Chen6836adb2018-05-28 19:06:37 +0800633 break;
634#ifdef R_ABSOLUTE
635 case R_ABSOLUTE: {
636 ulong symidx = rel->info >> SYM_INDEX;
637 extern struct dyn_sym __dyn_sym_start[];
638 newaddr = __dyn_sym_start[symidx].addr + offset;
Alexander Grafafdc4fc2018-11-04 22:25:22 +0100639#ifdef IS_RELA
640 newaddr -= CONFIG_SYS_TEXT_BASE;
641#endif
Rick Chen6836adb2018-05-28 19:06:37 +0800642 break;
643 }
644#endif
645 default:
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000646 printf("%s: Unknown relocation type %llx\n",
647 __func__, rel->info & R_MASK);
Rick Chen6836adb2018-05-28 19:06:37 +0800648 continue;
649 }
Alexander Graf50149ea2016-03-04 01:10:01 +0100650
651 /* Check if the relocation is inside bounds */
652 if (map && ((newaddr < map->virtual_start) ||
Heinrich Schuchardt591cf2e2017-09-18 22:11:34 +0200653 newaddr > (map->virtual_start +
654 (map->num_pages << EFI_PAGE_SHIFT)))) {
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000655 printf("%s: Relocation at %p is out of range (%lx)\n",
656 __func__, p, newaddr);
Alexander Graf50149ea2016-03-04 01:10:01 +0100657 continue;
658 }
659
Alexander Grafedcef3b2016-06-02 11:38:27 +0200660 debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
Alexander Graf50149ea2016-03-04 01:10:01 +0100661 *p = newaddr;
Alexander Graf36c37a82016-04-11 23:20:39 +0200662 flush_dcache_range((ulong)p & ~(EFI_CACHELINE_SIZE - 1),
663 ALIGN((ulong)&p[1], EFI_CACHELINE_SIZE));
Alexander Graf50149ea2016-03-04 01:10:01 +0100664 }
665
666#ifndef IS_RELA
667 lastoff = offset;
668#endif
669
670 invalidate_icache_all();
671}
672
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200673/**
674 * efi_set_virtual_address_map() - change from physical to virtual mapping
675 *
676 * This function implements the SetVirtualAddressMap() runtime service.
677 *
678 * See the Unified Extensible Firmware Interface (UEFI) specification for
679 * details.
680 *
681 * @memory_map_size: size of the virtual map
682 * @descriptor_size: size of an entry in the map
683 * @descriptor_version: version of the map entries
684 * @virtmap: virtual address mapping information
685 * Return: status code
686 */
Alexander Graf50149ea2016-03-04 01:10:01 +0100687static efi_status_t EFIAPI efi_set_virtual_address_map(
Heinrich Schuchardt24e67222019-07-27 20:28:47 +0200688 efi_uintn_t memory_map_size,
689 efi_uintn_t descriptor_size,
Alexander Graf50149ea2016-03-04 01:10:01 +0100690 uint32_t descriptor_version,
691 struct efi_mem_desc *virtmap)
692{
Heinrich Schuchardt24e67222019-07-27 20:28:47 +0200693 efi_uintn_t n = memory_map_size / descriptor_size;
694 efi_uintn_t i;
Heinrich Schuchardt53e1d8f2019-08-14 05:19:37 +0200695 efi_status_t ret = EFI_INVALID_PARAMETER;
Alexander Graf5c38e052018-12-11 10:00:42 +0100696 int rt_code_sections = 0;
Heinrich Schuchardt14b40482019-07-11 20:15:09 +0200697 struct efi_event *event;
Alexander Graf50149ea2016-03-04 01:10:01 +0100698
Heinrich Schuchardt24e67222019-07-27 20:28:47 +0200699 EFI_ENTRY("%zx %zx %x %p", memory_map_size, descriptor_size,
Alexander Graf50149ea2016-03-04 01:10:01 +0100700 descriptor_version, virtmap);
701
Heinrich Schuchardt53e1d8f2019-08-14 05:19:37 +0200702 if (descriptor_version != EFI_MEMORY_DESCRIPTOR_VERSION ||
703 descriptor_size < sizeof(struct efi_mem_desc))
704 goto out;
705
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200706 efi_virtmap = virtmap;
707 efi_descriptor_size = descriptor_size;
708 efi_descriptor_count = n;
709
Alexander Graf5c38e052018-12-11 10:00:42 +0100710 /*
711 * TODO:
712 * Further down we are cheating. While really we should implement
713 * SetVirtualAddressMap() events and ConvertPointer() to allow
714 * dynamically loaded drivers to expose runtime services, we don't
715 * today.
716 *
717 * So let's ensure we see exactly one single runtime section, as
718 * that is the built-in one. If we see more (or less), someone must
719 * have tried adding or removing to that which we don't support yet.
720 * In that case, let's better fail rather than expose broken runtime
721 * services.
722 */
723 for (i = 0; i < n; i++) {
724 struct efi_mem_desc *map = (void*)virtmap +
725 (descriptor_size * i);
726
727 if (map->type == EFI_RUNTIME_SERVICES_CODE)
728 rt_code_sections++;
729 }
730
731 if (rt_code_sections != 1) {
732 /*
733 * We expose exactly one single runtime code section, so
734 * something is definitely going wrong.
735 */
Heinrich Schuchardt53e1d8f2019-08-14 05:19:37 +0200736 goto out;
Alexander Graf5c38e052018-12-11 10:00:42 +0100737 }
738
Heinrich Schuchardt14b40482019-07-11 20:15:09 +0200739 /* Notify EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE */
740 list_for_each_entry(event, &efi_events, link) {
741 if (event->notify_function)
742 EFI_CALL_VOID(event->notify_function(
743 event, event->notify_context));
744 }
745
Alexander Graf80a48002016-08-16 21:08:45 +0200746 /* Rebind mmio pointers */
747 for (i = 0; i < n; i++) {
748 struct efi_mem_desc *map = (void*)virtmap +
749 (descriptor_size * i);
750 struct list_head *lhandle;
751 efi_physical_addr_t map_start = map->physical_start;
752 efi_physical_addr_t map_len = map->num_pages << EFI_PAGE_SHIFT;
753 efi_physical_addr_t map_end = map_start + map_len;
Heinrich Schuchardt07240da2018-08-04 23:16:06 +0200754 u64 off = map->virtual_start - map_start;
Alexander Graf80a48002016-08-16 21:08:45 +0200755
756 /* Adjust all mmio pointers in this region */
757 list_for_each(lhandle, &efi_runtime_mmio) {
758 struct efi_runtime_mmio_list *lmmio;
759
760 lmmio = list_entry(lhandle,
761 struct efi_runtime_mmio_list,
762 link);
763 if ((map_start <= lmmio->paddr) &&
764 (map_end >= lmmio->paddr)) {
Alexander Graf80a48002016-08-16 21:08:45 +0200765 uintptr_t new_addr = lmmio->paddr + off;
766 *lmmio->ptr = (void *)new_addr;
767 }
768 }
Heinrich Schuchardt07240da2018-08-04 23:16:06 +0200769 if ((map_start <= (uintptr_t)systab.tables) &&
770 (map_end >= (uintptr_t)systab.tables)) {
771 char *ptr = (char *)systab.tables;
772
773 ptr += off;
774 systab.tables = (struct efi_configuration_table *)ptr;
775 }
Alexander Graf80a48002016-08-16 21:08:45 +0200776 }
777
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000778 /* Relocate the runtime. See TODO above */
Alexander Graf50149ea2016-03-04 01:10:01 +0100779 for (i = 0; i < n; i++) {
780 struct efi_mem_desc *map;
781
782 map = (void*)virtmap + (descriptor_size * i);
783 if (map->type == EFI_RUNTIME_SERVICES_CODE) {
Alexander Graf80a48002016-08-16 21:08:45 +0200784 ulong new_offset = map->virtual_start -
Alexander Graf5c38e052018-12-11 10:00:42 +0100785 map->physical_start + gd->relocaddr;
Alexander Graf50149ea2016-03-04 01:10:01 +0100786
Heinrich Schuchardt24a238f2019-06-20 22:00:02 +0000787 efi_relocate_runtime_table(new_offset);
Alexander Graf50149ea2016-03-04 01:10:01 +0100788 efi_runtime_relocate(new_offset, map);
Heinrich Schuchardt53e1d8f2019-08-14 05:19:37 +0200789 ret = EFI_SUCCESS;
790 goto out;
Alexander Graf50149ea2016-03-04 01:10:01 +0100791 }
792 }
793
Heinrich Schuchardt53e1d8f2019-08-14 05:19:37 +0200794out:
795 return EFI_EXIT(ret);
Alexander Graf50149ea2016-03-04 01:10:01 +0100796}
797
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200798/**
799 * efi_add_runtime_mmio() - add memory-mapped IO region
800 *
801 * This function adds a memory-mapped IO region to the memory map to make it
802 * available at runtime.
803 *
Heinrich Schuchardtfb34f292018-12-23 02:35:13 +0100804 * @mmio_ptr: pointer to a pointer to the start of the memory-mapped
805 * IO region
Heinrich Schuchardt250b3252018-09-03 19:29:41 +0200806 * @len: size of the memory-mapped IO region
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200807 * Returns: status code
808 */
Heinrich Schuchardt22c793e2018-03-03 15:28:59 +0100809efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
Alexander Graf80a48002016-08-16 21:08:45 +0200810{
811 struct efi_runtime_mmio_list *newmmio;
Alexander Graf813468c2018-03-15 15:08:16 +0100812 uint64_t addr = *(uintptr_t *)mmio_ptr;
Bryan O'Donoghueb225c922019-07-15 12:00:39 +0100813 efi_status_t ret;
Alexander Graf813468c2018-03-15 15:08:16 +0100814
Michael Walle714497e2020-05-17 12:29:19 +0200815 ret = efi_add_memory_map(addr, len, EFI_MMAP_IO);
Bryan O'Donoghueb225c922019-07-15 12:00:39 +0100816 if (ret != EFI_SUCCESS)
Alexander Graf813468c2018-03-15 15:08:16 +0100817 return EFI_OUT_OF_RESOURCES;
Alexander Graf80a48002016-08-16 21:08:45 +0200818
819 newmmio = calloc(1, sizeof(*newmmio));
Heinrich Schuchardt22c793e2018-03-03 15:28:59 +0100820 if (!newmmio)
821 return EFI_OUT_OF_RESOURCES;
Alexander Graf80a48002016-08-16 21:08:45 +0200822 newmmio->ptr = mmio_ptr;
823 newmmio->paddr = *(uintptr_t *)mmio_ptr;
824 newmmio->len = len;
825 list_add_tail(&newmmio->link, &efi_runtime_mmio);
Heinrich Schuchardt22c793e2018-03-03 15:28:59 +0100826
Alexander Graf813468c2018-03-15 15:08:16 +0100827 return EFI_SUCCESS;
Alexander Graf80a48002016-08-16 21:08:45 +0200828}
829
Alexander Graf50149ea2016-03-04 01:10:01 +0100830/*
831 * In the second stage, U-Boot has disappeared. To isolate our runtime code
832 * that at this point still exists from the rest, we put it into a special
833 * section.
834 *
835 * !!WARNING!!
836 *
837 * This means that we can not rely on any code outside of this file in any
838 * function or variable below this line.
839 *
840 * Please keep everything fully self-contained and annotated with
Alexander Graf3c63db92016-10-14 13:45:30 +0200841 * __efi_runtime and __efi_runtime_data markers.
Alexander Graf50149ea2016-03-04 01:10:01 +0100842 */
843
844/*
845 * Relocate the EFI runtime stub to a different place. We need to call this
846 * the first time we expose the runtime interface to a user and on set virtual
847 * address map calls.
848 */
849
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200850/**
851 * efi_unimplemented() - replacement function, returns EFI_UNSUPPORTED
852 *
853 * This function is used after SetVirtualAddressMap() is called as replacement
854 * for services that are not available anymore due to constraints of the U-Boot
855 * implementation.
856 *
857 * Return: EFI_UNSUPPORTED
858 */
Alexander Graf3c63db92016-10-14 13:45:30 +0200859static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void)
Alexander Graf50149ea2016-03-04 01:10:01 +0100860{
861 return EFI_UNSUPPORTED;
862}
863
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200864/**
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200865 * efi_update_capsule() - process information from operating system
866 *
867 * This function implements the UpdateCapsule() runtime service.
868 *
869 * See the Unified Extensible Firmware Interface (UEFI) specification for
870 * details.
871 *
872 * @capsule_header_array: pointer to array of virtual pointers
873 * @capsule_count: number of pointers in capsule_header_array
874 * @scatter_gather_list: pointer to arry of physical pointers
875 * Returns: status code
876 */
Heinrich Schuchardt0c230742018-02-09 20:41:21 +0100877efi_status_t __efi_runtime EFIAPI efi_update_capsule(
878 struct efi_capsule_header **capsule_header_array,
879 efi_uintn_t capsule_count,
880 u64 scatter_gather_list)
881{
882 return EFI_UNSUPPORTED;
883}
884
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200885/**
886 * efi_query_capsule_caps() - check if capsule is supported
887 *
888 * This function implements the QueryCapsuleCapabilities() runtime service.
889 *
890 * See the Unified Extensible Firmware Interface (UEFI) specification for
891 * details.
892 *
893 * @capsule_header_array: pointer to array of virtual pointers
894 * @capsule_count: number of pointers in capsule_header_array
Heinrich Schuchardtcc0bfc02018-09-03 20:59:25 +0200895 * @maximum_capsule_size: maximum capsule size
Heinrich Schuchardtbcfb0e22018-07-29 15:10:11 +0200896 * @reset_type: type of reset needed for capsule update
897 * Returns: status code
898 */
Heinrich Schuchardt0c230742018-02-09 20:41:21 +0100899efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps(
900 struct efi_capsule_header **capsule_header_array,
901 efi_uintn_t capsule_count,
AKASHI Takahiro19dd9072018-11-14 16:18:53 +0900902 u64 *maximum_capsule_size,
903 u32 *reset_type)
Heinrich Schuchardt0c230742018-02-09 20:41:21 +0100904{
905 return EFI_UNSUPPORTED;
906}
907
Alexander Graf3c63db92016-10-14 13:45:30 +0200908struct efi_runtime_services __efi_runtime_data efi_runtime_services = {
Alexander Graf50149ea2016-03-04 01:10:01 +0100909 .hdr = {
910 .signature = EFI_RUNTIME_SERVICES_SIGNATURE,
Heinrich Schuchardt112f2432018-06-28 12:45:27 +0200911 .revision = EFI_SPECIFICATION_VERSION,
Heinrich Schuchardt71c846a2018-06-28 12:45:29 +0200912 .headersize = sizeof(struct efi_runtime_services),
Alexander Graf50149ea2016-03-04 01:10:01 +0100913 },
Alexander Graf80a48002016-08-16 21:08:45 +0200914 .get_time = &efi_get_time_boottime,
Heinrich Schuchardt433bfe72019-05-19 20:07:39 +0200915 .set_time = &efi_set_time_boottime,
Alexander Graf50149ea2016-03-04 01:10:01 +0100916 .get_wakeup_time = (void *)&efi_unimplemented,
917 .set_wakeup_time = (void *)&efi_unimplemented,
918 .set_virtual_address_map = &efi_set_virtual_address_map,
Heinrich Schuchardt7be56e82019-07-27 20:35:24 +0200919 .convert_pointer = efi_convert_pointer,
Rob Clarkad644e72017-09-13 18:05:37 -0400920 .get_variable = efi_get_variable,
Heinrich Schuchardt45c66f92018-05-17 07:57:05 +0200921 .get_next_variable_name = efi_get_next_variable_name,
Rob Clarkad644e72017-09-13 18:05:37 -0400922 .set_variable = efi_set_variable,
Heinrich Schuchardtb94461c2019-06-20 15:40:49 +0200923 .get_next_high_mono_count = (void *)&efi_unimplemented,
Alexander Graf80a48002016-08-16 21:08:45 +0200924 .reset_system = &efi_reset_system_boottime,
Heinrich Schuchardt0c230742018-02-09 20:41:21 +0100925 .update_capsule = efi_update_capsule,
926 .query_capsule_caps = efi_query_capsule_caps,
927 .query_variable_info = efi_query_variable_info,
Alexander Graf50149ea2016-03-04 01:10:01 +0100928};