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