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> |
| 11 | #include <efi_loader.h> |
| 12 | #include <rtc.h> |
| 13 | #include <asm/global_data.h> |
| 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 | |
Alexander Graf | e570232 | 2016-04-11 23:20:39 +0200 | [diff] [blame] | 32 | #ifdef CONFIG_SYS_CACHELINE_SIZE |
| 33 | #define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE |
| 34 | #else |
| 35 | /* Just use the greatest cache flush alignment requirement I'm aware of */ |
| 36 | #define EFI_CACHELINE_SIZE 128 |
| 37 | #endif |
| 38 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 39 | #if defined(CONFIG_ARM64) |
| 40 | #define R_RELATIVE 1027 |
| 41 | #define R_MASK 0xffffffffULL |
| 42 | #define IS_RELA 1 |
| 43 | #elif defined(CONFIG_ARM) |
| 44 | #define R_RELATIVE 23 |
| 45 | #define R_MASK 0xffULL |
Simon Glass | cdfe696 | 2016-09-25 15:27:35 -0600 | [diff] [blame] | 46 | #elif defined(CONFIG_X86) |
| 47 | #include <asm/elf.h> |
| 48 | #define R_RELATIVE R_386_RELATIVE |
| 49 | #define R_MASK 0xffULL |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 50 | #else |
| 51 | #error Need to add relocation awareness |
| 52 | #endif |
| 53 | |
| 54 | struct elf_rel { |
| 55 | ulong *offset; |
| 56 | ulong info; |
| 57 | }; |
| 58 | |
| 59 | struct elf_rela { |
| 60 | ulong *offset; |
| 61 | ulong info; |
| 62 | long addend; |
| 63 | }; |
| 64 | |
| 65 | /* |
| 66 | * EFI Runtime code lives in 2 stages. In the first stage, U-Boot and an EFI |
| 67 | * payload are running concurrently at the same time. In this mode, we can |
| 68 | * handle a good number of runtime callbacks |
| 69 | */ |
| 70 | |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 71 | static void EFIAPI efi_reset_system_boottime( |
| 72 | enum efi_reset_type reset_type, |
| 73 | efi_status_t reset_status, |
| 74 | unsigned long data_size, void *reset_data) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 75 | { |
Heinrich Schuchardt | bf7f169 | 2018-02-18 15:17:52 +0100 | [diff] [blame] | 76 | struct efi_event *evt; |
| 77 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 78 | EFI_ENTRY("%d %lx %lx %p", reset_type, reset_status, data_size, |
| 79 | reset_data); |
| 80 | |
Heinrich Schuchardt | bf7f169 | 2018-02-18 15:17:52 +0100 | [diff] [blame] | 81 | /* Notify reset */ |
| 82 | list_for_each_entry(evt, &efi_events, link) { |
| 83 | if (evt->group && |
| 84 | !guidcmp(evt->group, |
| 85 | &efi_guid_event_group_reset_system)) { |
| 86 | efi_signal_event(evt, false); |
| 87 | break; |
| 88 | } |
| 89 | } |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 90 | switch (reset_type) { |
| 91 | case EFI_RESET_COLD: |
| 92 | case EFI_RESET_WARM: |
Heinrich Schuchardt | 450d4c8 | 2018-02-06 22:00:22 +0100 | [diff] [blame] | 93 | case EFI_RESET_PLATFORM_SPECIFIC: |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 94 | do_reset(NULL, 0, 0, NULL); |
| 95 | break; |
| 96 | case EFI_RESET_SHUTDOWN: |
| 97 | /* We don't have anything to map this to */ |
| 98 | break; |
| 99 | } |
| 100 | |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 101 | while (1) { } |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 102 | } |
| 103 | |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 104 | static efi_status_t EFIAPI efi_get_time_boottime( |
| 105 | struct efi_time *time, |
| 106 | struct efi_time_cap *capabilities) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 107 | { |
| 108 | #if defined(CONFIG_CMD_DATE) && defined(CONFIG_DM_RTC) |
| 109 | struct rtc_time tm; |
| 110 | int r; |
| 111 | struct udevice *dev; |
| 112 | |
| 113 | EFI_ENTRY("%p %p", time, capabilities); |
| 114 | |
| 115 | r = uclass_get_device(UCLASS_RTC, 0, &dev); |
| 116 | if (r) |
| 117 | return EFI_EXIT(EFI_DEVICE_ERROR); |
| 118 | |
| 119 | r = dm_rtc_get(dev, &tm); |
| 120 | if (r) |
| 121 | return EFI_EXIT(EFI_DEVICE_ERROR); |
| 122 | |
| 123 | memset(time, 0, sizeof(*time)); |
| 124 | time->year = tm.tm_year; |
| 125 | time->month = tm.tm_mon; |
| 126 | time->day = tm.tm_mday; |
| 127 | time->hour = tm.tm_hour; |
| 128 | time->minute = tm.tm_min; |
| 129 | time->daylight = tm.tm_isdst; |
| 130 | |
| 131 | return EFI_EXIT(EFI_SUCCESS); |
| 132 | #else |
| 133 | return EFI_DEVICE_ERROR; |
| 134 | #endif |
| 135 | } |
| 136 | |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 137 | /* Boards may override the helpers below to implement RTS functionality */ |
| 138 | |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 139 | void __weak __efi_runtime EFIAPI efi_reset_system( |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 140 | enum efi_reset_type reset_type, |
| 141 | efi_status_t reset_status, |
| 142 | unsigned long data_size, void *reset_data) |
| 143 | { |
| 144 | /* Nothing we can do */ |
| 145 | while (1) { } |
| 146 | } |
| 147 | |
Heinrich Schuchardt | 099b3b7 | 2018-03-03 15:28:59 +0100 | [diff] [blame] | 148 | efi_status_t __weak efi_reset_system_init(void) |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 149 | { |
Heinrich Schuchardt | 099b3b7 | 2018-03-03 15:28:59 +0100 | [diff] [blame] | 150 | return EFI_SUCCESS; |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 151 | } |
| 152 | |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 153 | efi_status_t __weak __efi_runtime EFIAPI efi_get_time( |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 154 | struct efi_time *time, |
| 155 | struct efi_time_cap *capabilities) |
| 156 | { |
| 157 | /* Nothing we can do */ |
| 158 | return EFI_DEVICE_ERROR; |
| 159 | } |
| 160 | |
Heinrich Schuchardt | 096db01 | 2018-03-03 15:29:00 +0100 | [diff] [blame] | 161 | efi_status_t __weak efi_get_time_init(void) |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 162 | { |
Heinrich Schuchardt | 096db01 | 2018-03-03 15:29:00 +0100 | [diff] [blame] | 163 | return EFI_SUCCESS; |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 164 | } |
| 165 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 166 | struct efi_runtime_detach_list_struct { |
| 167 | void *ptr; |
| 168 | void *patchto; |
| 169 | }; |
| 170 | |
| 171 | static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { |
| 172 | { |
| 173 | /* do_reset is gone */ |
| 174 | .ptr = &efi_runtime_services.reset_system, |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 175 | .patchto = efi_reset_system, |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 176 | }, { |
| 177 | /* invalidate_*cache_all are gone */ |
| 178 | .ptr = &efi_runtime_services.set_virtual_address_map, |
| 179 | .patchto = &efi_invalid_parameter, |
| 180 | }, { |
| 181 | /* RTC accessors are gone */ |
| 182 | .ptr = &efi_runtime_services.get_time, |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 183 | .patchto = &efi_get_time, |
Alexander Graf | c59d360 | 2016-05-18 00:54:47 +0200 | [diff] [blame] | 184 | }, { |
| 185 | /* Clean up system table */ |
| 186 | .ptr = &systab.con_in, |
| 187 | .patchto = NULL, |
| 188 | }, { |
| 189 | /* Clean up system table */ |
| 190 | .ptr = &systab.con_out, |
| 191 | .patchto = NULL, |
| 192 | }, { |
| 193 | /* Clean up system table */ |
| 194 | .ptr = &systab.std_err, |
| 195 | .patchto = NULL, |
| 196 | }, { |
| 197 | /* Clean up system table */ |
| 198 | .ptr = &systab.boottime, |
| 199 | .patchto = NULL, |
Rob Clark | 15f3d74 | 2017-09-13 18:05:37 -0400 | [diff] [blame] | 200 | }, { |
| 201 | .ptr = &efi_runtime_services.get_variable, |
| 202 | .patchto = &efi_device_error, |
| 203 | }, { |
| 204 | .ptr = &efi_runtime_services.get_next_variable, |
| 205 | .patchto = &efi_device_error, |
| 206 | }, { |
| 207 | .ptr = &efi_runtime_services.set_variable, |
| 208 | .patchto = &efi_device_error, |
| 209 | } |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 210 | }; |
| 211 | |
| 212 | static bool efi_runtime_tobedetached(void *p) |
| 213 | { |
| 214 | int i; |
| 215 | |
| 216 | for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) |
| 217 | if (efi_runtime_detach_list[i].ptr == p) |
| 218 | return true; |
| 219 | |
| 220 | return false; |
| 221 | } |
| 222 | |
| 223 | static void efi_runtime_detach(ulong offset) |
| 224 | { |
| 225 | int i; |
| 226 | ulong patchoff = offset - (ulong)gd->relocaddr; |
| 227 | |
| 228 | for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) { |
| 229 | ulong patchto = (ulong)efi_runtime_detach_list[i].patchto; |
| 230 | ulong *p = efi_runtime_detach_list[i].ptr; |
| 231 | ulong newaddr = patchto ? (patchto + patchoff) : 0; |
| 232 | |
Alexander Graf | 62a6748 | 2016-06-02 11:38:27 +0200 | [diff] [blame] | 233 | debug("%s: Setting %p to %lx\n", __func__, p, newaddr); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 234 | *p = newaddr; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | /* Relocate EFI runtime to uboot_reloc_base = offset */ |
| 239 | void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) |
| 240 | { |
| 241 | #ifdef IS_RELA |
| 242 | struct elf_rela *rel = (void*)&__efi_runtime_rel_start; |
| 243 | #else |
| 244 | struct elf_rel *rel = (void*)&__efi_runtime_rel_start; |
| 245 | static ulong lastoff = CONFIG_SYS_TEXT_BASE; |
| 246 | #endif |
| 247 | |
Alexander Graf | 62a6748 | 2016-06-02 11:38:27 +0200 | [diff] [blame] | 248 | debug("%s: Relocating to offset=%lx\n", __func__, offset); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 249 | for (; (ulong)rel < (ulong)&__efi_runtime_rel_stop; rel++) { |
| 250 | ulong base = CONFIG_SYS_TEXT_BASE; |
| 251 | ulong *p; |
| 252 | ulong newaddr; |
| 253 | |
| 254 | p = (void*)((ulong)rel->offset - base) + gd->relocaddr; |
| 255 | |
| 256 | if ((rel->info & R_MASK) != R_RELATIVE) { |
| 257 | continue; |
| 258 | } |
| 259 | |
| 260 | #ifdef IS_RELA |
| 261 | newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE; |
| 262 | #else |
| 263 | newaddr = *p - lastoff + offset; |
| 264 | #endif |
| 265 | |
| 266 | /* Check if the relocation is inside bounds */ |
| 267 | if (map && ((newaddr < map->virtual_start) || |
Heinrich Schuchardt | 9ebc47f | 2017-09-18 22:11:34 +0200 | [diff] [blame] | 268 | newaddr > (map->virtual_start + |
| 269 | (map->num_pages << EFI_PAGE_SHIFT)))) { |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 270 | if (!efi_runtime_tobedetached(p)) |
| 271 | printf("U-Boot EFI: Relocation at %p is out of " |
| 272 | "range (%lx)\n", p, newaddr); |
| 273 | continue; |
| 274 | } |
| 275 | |
Alexander Graf | 62a6748 | 2016-06-02 11:38:27 +0200 | [diff] [blame] | 276 | debug("%s: Setting %p to %lx\n", __func__, p, newaddr); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 277 | *p = newaddr; |
Alexander Graf | e570232 | 2016-04-11 23:20:39 +0200 | [diff] [blame] | 278 | flush_dcache_range((ulong)p & ~(EFI_CACHELINE_SIZE - 1), |
| 279 | ALIGN((ulong)&p[1], EFI_CACHELINE_SIZE)); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | #ifndef IS_RELA |
| 283 | lastoff = offset; |
| 284 | #endif |
| 285 | |
| 286 | invalidate_icache_all(); |
| 287 | } |
| 288 | |
| 289 | static efi_status_t EFIAPI efi_set_virtual_address_map( |
| 290 | unsigned long memory_map_size, |
| 291 | unsigned long descriptor_size, |
| 292 | uint32_t descriptor_version, |
| 293 | struct efi_mem_desc *virtmap) |
| 294 | { |
Heinrich Schuchardt | 9ebc47f | 2017-09-18 22:11:34 +0200 | [diff] [blame] | 295 | ulong runtime_start = (ulong)&__efi_runtime_start & |
| 296 | ~(ulong)EFI_PAGE_MASK; |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 297 | int n = memory_map_size / descriptor_size; |
| 298 | int i; |
| 299 | |
| 300 | EFI_ENTRY("%lx %lx %x %p", memory_map_size, descriptor_size, |
| 301 | descriptor_version, virtmap); |
| 302 | |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 303 | /* Rebind mmio pointers */ |
| 304 | for (i = 0; i < n; i++) { |
| 305 | struct efi_mem_desc *map = (void*)virtmap + |
| 306 | (descriptor_size * i); |
| 307 | struct list_head *lhandle; |
| 308 | efi_physical_addr_t map_start = map->physical_start; |
| 309 | efi_physical_addr_t map_len = map->num_pages << EFI_PAGE_SHIFT; |
| 310 | efi_physical_addr_t map_end = map_start + map_len; |
| 311 | |
| 312 | /* Adjust all mmio pointers in this region */ |
| 313 | list_for_each(lhandle, &efi_runtime_mmio) { |
| 314 | struct efi_runtime_mmio_list *lmmio; |
| 315 | |
| 316 | lmmio = list_entry(lhandle, |
| 317 | struct efi_runtime_mmio_list, |
| 318 | link); |
| 319 | if ((map_start <= lmmio->paddr) && |
| 320 | (map_end >= lmmio->paddr)) { |
| 321 | u64 off = map->virtual_start - map_start; |
| 322 | uintptr_t new_addr = lmmio->paddr + off; |
| 323 | *lmmio->ptr = (void *)new_addr; |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | /* Move the actual runtime code over */ |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 329 | for (i = 0; i < n; i++) { |
| 330 | struct efi_mem_desc *map; |
| 331 | |
| 332 | map = (void*)virtmap + (descriptor_size * i); |
| 333 | if (map->type == EFI_RUNTIME_SERVICES_CODE) { |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 334 | ulong new_offset = map->virtual_start - |
| 335 | (runtime_start - gd->relocaddr); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 336 | |
| 337 | efi_runtime_relocate(new_offset, map); |
| 338 | /* Once we're virtual, we can no longer handle |
| 339 | complex callbacks */ |
| 340 | efi_runtime_detach(new_offset); |
| 341 | return EFI_EXIT(EFI_SUCCESS); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | return EFI_EXIT(EFI_INVALID_PARAMETER); |
| 346 | } |
| 347 | |
Heinrich Schuchardt | 099b3b7 | 2018-03-03 15:28:59 +0100 | [diff] [blame] | 348 | efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len) |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 349 | { |
| 350 | struct efi_runtime_mmio_list *newmmio; |
xypron.glpk@gmx.de | 93fcc7f | 2017-08-11 21:19:37 +0200 | [diff] [blame] | 351 | u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT; |
Alexander Graf | 33a83a3 | 2018-03-15 15:08:16 +0100 | [diff] [blame] | 352 | uint64_t addr = *(uintptr_t *)mmio_ptr; |
| 353 | uint64_t retaddr; |
| 354 | |
| 355 | retaddr = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false); |
| 356 | if (retaddr != addr) |
| 357 | return EFI_OUT_OF_RESOURCES; |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 358 | |
| 359 | newmmio = calloc(1, sizeof(*newmmio)); |
Heinrich Schuchardt | 099b3b7 | 2018-03-03 15:28:59 +0100 | [diff] [blame] | 360 | if (!newmmio) |
| 361 | return EFI_OUT_OF_RESOURCES; |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 362 | newmmio->ptr = mmio_ptr; |
| 363 | newmmio->paddr = *(uintptr_t *)mmio_ptr; |
| 364 | newmmio->len = len; |
| 365 | list_add_tail(&newmmio->link, &efi_runtime_mmio); |
Heinrich Schuchardt | 099b3b7 | 2018-03-03 15:28:59 +0100 | [diff] [blame] | 366 | |
Alexander Graf | 33a83a3 | 2018-03-15 15:08:16 +0100 | [diff] [blame] | 367 | return EFI_SUCCESS; |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 368 | } |
| 369 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 370 | /* |
| 371 | * In the second stage, U-Boot has disappeared. To isolate our runtime code |
| 372 | * that at this point still exists from the rest, we put it into a special |
| 373 | * section. |
| 374 | * |
| 375 | * !!WARNING!! |
| 376 | * |
| 377 | * This means that we can not rely on any code outside of this file in any |
| 378 | * function or variable below this line. |
| 379 | * |
| 380 | * Please keep everything fully self-contained and annotated with |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 381 | * __efi_runtime and __efi_runtime_data markers. |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 382 | */ |
| 383 | |
| 384 | /* |
| 385 | * Relocate the EFI runtime stub to a different place. We need to call this |
| 386 | * the first time we expose the runtime interface to a user and on set virtual |
| 387 | * address map calls. |
| 388 | */ |
| 389 | |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 390 | static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 391 | { |
| 392 | return EFI_UNSUPPORTED; |
| 393 | } |
| 394 | |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 395 | static efi_status_t __efi_runtime EFIAPI efi_device_error(void) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 396 | { |
| 397 | return EFI_DEVICE_ERROR; |
| 398 | } |
| 399 | |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 400 | static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 401 | { |
| 402 | return EFI_INVALID_PARAMETER; |
| 403 | } |
| 404 | |
Heinrich Schuchardt | 897c072 | 2018-02-09 20:41:21 +0100 | [diff] [blame] | 405 | efi_status_t __efi_runtime EFIAPI efi_update_capsule( |
| 406 | struct efi_capsule_header **capsule_header_array, |
| 407 | efi_uintn_t capsule_count, |
| 408 | u64 scatter_gather_list) |
| 409 | { |
| 410 | return EFI_UNSUPPORTED; |
| 411 | } |
| 412 | |
| 413 | efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps( |
| 414 | struct efi_capsule_header **capsule_header_array, |
| 415 | efi_uintn_t capsule_count, |
| 416 | u64 maximum_capsule_size, |
| 417 | u32 reset_type) |
| 418 | { |
| 419 | return EFI_UNSUPPORTED; |
| 420 | } |
| 421 | |
| 422 | efi_status_t __efi_runtime EFIAPI efi_query_variable_info( |
| 423 | u32 attributes, |
| 424 | u64 maximum_variable_storage_size, |
| 425 | u64 remaining_variable_storage_size, |
| 426 | u64 maximum_variable_size) |
| 427 | { |
| 428 | return EFI_UNSUPPORTED; |
| 429 | } |
| 430 | |
Alexander Graf | 393dd91 | 2016-10-14 13:45:30 +0200 | [diff] [blame] | 431 | struct efi_runtime_services __efi_runtime_data efi_runtime_services = { |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 432 | .hdr = { |
| 433 | .signature = EFI_RUNTIME_SERVICES_SIGNATURE, |
| 434 | .revision = EFI_RUNTIME_SERVICES_REVISION, |
| 435 | .headersize = sizeof(struct efi_table_hdr), |
| 436 | }, |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 437 | .get_time = &efi_get_time_boottime, |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 438 | .set_time = (void *)&efi_device_error, |
| 439 | .get_wakeup_time = (void *)&efi_unimplemented, |
| 440 | .set_wakeup_time = (void *)&efi_unimplemented, |
| 441 | .set_virtual_address_map = &efi_set_virtual_address_map, |
| 442 | .convert_pointer = (void *)&efi_invalid_parameter, |
Rob Clark | 15f3d74 | 2017-09-13 18:05:37 -0400 | [diff] [blame] | 443 | .get_variable = efi_get_variable, |
| 444 | .get_next_variable = efi_get_next_variable, |
| 445 | .set_variable = efi_set_variable, |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 446 | .get_next_high_mono_count = (void *)&efi_device_error, |
Alexander Graf | 7725609 | 2016-08-16 21:08:45 +0200 | [diff] [blame] | 447 | .reset_system = &efi_reset_system_boottime, |
Heinrich Schuchardt | 897c072 | 2018-02-09 20:41:21 +0100 | [diff] [blame] | 448 | .update_capsule = efi_update_capsule, |
| 449 | .query_capsule_caps = efi_query_capsule_caps, |
| 450 | .query_variable_info = efi_query_variable_info, |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 451 | }; |