.. | .. |
---|
39 | 39 | #define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1))) |
---|
40 | 40 | #define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1))) |
---|
41 | 41 | #define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1))) |
---|
| 42 | +#define EFI_TIMEOUT (18 | (1UL << (BITS_PER_LONG-1))) |
---|
42 | 43 | #define EFI_ABORTED (21 | (1UL << (BITS_PER_LONG-1))) |
---|
43 | 44 | #define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1))) |
---|
44 | 45 | |
---|
.. | .. |
---|
48 | 49 | typedef u64 efi_physical_addr_t; |
---|
49 | 50 | typedef void *efi_handle_t; |
---|
50 | 51 | |
---|
51 | | -typedef guid_t efi_guid_t; |
---|
| 52 | +#if defined(CONFIG_X86_64) |
---|
| 53 | +#define __efiapi __attribute__((ms_abi)) |
---|
| 54 | +#elif defined(CONFIG_X86_32) |
---|
| 55 | +#define __efiapi __attribute__((regparm(0))) |
---|
| 56 | +#else |
---|
| 57 | +#define __efiapi |
---|
| 58 | +#endif |
---|
52 | 59 | |
---|
53 | | -#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ |
---|
54 | | - GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) |
---|
| 60 | +/* |
---|
| 61 | + * The UEFI spec and EDK2 reference implementation both define EFI_GUID as |
---|
| 62 | + * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment |
---|
| 63 | + * is 32 bits not 8 bits like our guid_t. In some cases (i.e., on 32-bit ARM), |
---|
| 64 | + * this means that firmware services invoked by the kernel may assume that |
---|
| 65 | + * efi_guid_t* arguments are 32-bit aligned, and use memory accessors that |
---|
| 66 | + * do not tolerate misalignment. So let's set the minimum alignment to 32 bits. |
---|
| 67 | + * |
---|
| 68 | + * Note that the UEFI spec as well as some comments in the EDK2 code base |
---|
| 69 | + * suggest that EFI_GUID should be 64-bit aligned, but this appears to be |
---|
| 70 | + * a mistake, given that no code seems to exist that actually enforces that |
---|
| 71 | + * or relies on it. |
---|
| 72 | + */ |
---|
| 73 | +typedef guid_t efi_guid_t __aligned(__alignof__(u32)); |
---|
| 74 | + |
---|
| 75 | +#define EFI_GUID(a, b, c, d...) (efi_guid_t){ { \ |
---|
| 76 | + (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ |
---|
| 77 | + (b) & 0xff, ((b) >> 8) & 0xff, \ |
---|
| 78 | + (c) & 0xff, ((c) >> 8) & 0xff, d } } |
---|
55 | 79 | |
---|
56 | 80 | /* |
---|
57 | 81 | * Generic EFI table header |
---|
.. | .. |
---|
99 | 123 | #define EFI_MEMORY_MORE_RELIABLE \ |
---|
100 | 124 | ((u64)0x0000000000010000ULL) /* higher reliability */ |
---|
101 | 125 | #define EFI_MEMORY_RO ((u64)0x0000000000020000ULL) /* read-only */ |
---|
| 126 | +#define EFI_MEMORY_SP ((u64)0x0000000000040000ULL) /* soft reserved */ |
---|
| 127 | +#define EFI_MEMORY_CPU_CRYPTO ((u64)0x0000000000080000ULL) /* supports encryption */ |
---|
102 | 128 | #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */ |
---|
103 | 129 | #define EFI_MEMORY_DESCRIPTOR_VERSION 1 |
---|
104 | 130 | |
---|
.. | .. |
---|
122 | 148 | u32 imagesize; |
---|
123 | 149 | } efi_capsule_header_t; |
---|
124 | 150 | |
---|
125 | | -struct efi_boot_memmap { |
---|
126 | | - efi_memory_desc_t **map; |
---|
127 | | - unsigned long *map_size; |
---|
128 | | - unsigned long *desc_size; |
---|
129 | | - u32 *desc_ver; |
---|
130 | | - unsigned long *key_ptr; |
---|
131 | | - unsigned long *buff_size; |
---|
132 | | -}; |
---|
133 | | - |
---|
134 | 151 | /* |
---|
135 | 152 | * EFI capsule flags |
---|
136 | 153 | */ |
---|
.. | .. |
---|
150 | 167 | size_t page_bytes_remain; |
---|
151 | 168 | }; |
---|
152 | 169 | |
---|
| 170 | +int efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff, |
---|
| 171 | + size_t hdr_bytes); |
---|
153 | 172 | int __efi_capsule_setup_info(struct capsule_info *cap_info); |
---|
154 | | - |
---|
155 | | -/* |
---|
156 | | - * Allocation types for calls to boottime->allocate_pages. |
---|
157 | | - */ |
---|
158 | | -#define EFI_ALLOCATE_ANY_PAGES 0 |
---|
159 | | -#define EFI_ALLOCATE_MAX_ADDRESS 1 |
---|
160 | | -#define EFI_ALLOCATE_ADDRESS 2 |
---|
161 | | -#define EFI_MAX_ALLOCATE_TYPE 3 |
---|
162 | 173 | |
---|
163 | 174 | typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); |
---|
164 | 175 | |
---|
.. | .. |
---|
189 | 200 | u8 sets_to_zero; |
---|
190 | 201 | } efi_time_cap_t; |
---|
191 | 202 | |
---|
192 | | -typedef struct { |
---|
193 | | - efi_table_hdr_t hdr; |
---|
194 | | - u32 raise_tpl; |
---|
195 | | - u32 restore_tpl; |
---|
196 | | - u32 allocate_pages; |
---|
197 | | - u32 free_pages; |
---|
198 | | - u32 get_memory_map; |
---|
199 | | - u32 allocate_pool; |
---|
200 | | - u32 free_pool; |
---|
201 | | - u32 create_event; |
---|
202 | | - u32 set_timer; |
---|
203 | | - u32 wait_for_event; |
---|
204 | | - u32 signal_event; |
---|
205 | | - u32 close_event; |
---|
206 | | - u32 check_event; |
---|
207 | | - u32 install_protocol_interface; |
---|
208 | | - u32 reinstall_protocol_interface; |
---|
209 | | - u32 uninstall_protocol_interface; |
---|
210 | | - u32 handle_protocol; |
---|
211 | | - u32 __reserved; |
---|
212 | | - u32 register_protocol_notify; |
---|
213 | | - u32 locate_handle; |
---|
214 | | - u32 locate_device_path; |
---|
215 | | - u32 install_configuration_table; |
---|
216 | | - u32 load_image; |
---|
217 | | - u32 start_image; |
---|
218 | | - u32 exit; |
---|
219 | | - u32 unload_image; |
---|
220 | | - u32 exit_boot_services; |
---|
221 | | - u32 get_next_monotonic_count; |
---|
222 | | - u32 stall; |
---|
223 | | - u32 set_watchdog_timer; |
---|
224 | | - u32 connect_controller; |
---|
225 | | - u32 disconnect_controller; |
---|
226 | | - u32 open_protocol; |
---|
227 | | - u32 close_protocol; |
---|
228 | | - u32 open_protocol_information; |
---|
229 | | - u32 protocols_per_handle; |
---|
230 | | - u32 locate_handle_buffer; |
---|
231 | | - u32 locate_protocol; |
---|
232 | | - u32 install_multiple_protocol_interfaces; |
---|
233 | | - u32 uninstall_multiple_protocol_interfaces; |
---|
234 | | - u32 calculate_crc32; |
---|
235 | | - u32 copy_mem; |
---|
236 | | - u32 set_mem; |
---|
237 | | - u32 create_event_ex; |
---|
238 | | -} __packed efi_boot_services_32_t; |
---|
239 | | - |
---|
240 | | -typedef struct { |
---|
241 | | - efi_table_hdr_t hdr; |
---|
242 | | - u64 raise_tpl; |
---|
243 | | - u64 restore_tpl; |
---|
244 | | - u64 allocate_pages; |
---|
245 | | - u64 free_pages; |
---|
246 | | - u64 get_memory_map; |
---|
247 | | - u64 allocate_pool; |
---|
248 | | - u64 free_pool; |
---|
249 | | - u64 create_event; |
---|
250 | | - u64 set_timer; |
---|
251 | | - u64 wait_for_event; |
---|
252 | | - u64 signal_event; |
---|
253 | | - u64 close_event; |
---|
254 | | - u64 check_event; |
---|
255 | | - u64 install_protocol_interface; |
---|
256 | | - u64 reinstall_protocol_interface; |
---|
257 | | - u64 uninstall_protocol_interface; |
---|
258 | | - u64 handle_protocol; |
---|
259 | | - u64 __reserved; |
---|
260 | | - u64 register_protocol_notify; |
---|
261 | | - u64 locate_handle; |
---|
262 | | - u64 locate_device_path; |
---|
263 | | - u64 install_configuration_table; |
---|
264 | | - u64 load_image; |
---|
265 | | - u64 start_image; |
---|
266 | | - u64 exit; |
---|
267 | | - u64 unload_image; |
---|
268 | | - u64 exit_boot_services; |
---|
269 | | - u64 get_next_monotonic_count; |
---|
270 | | - u64 stall; |
---|
271 | | - u64 set_watchdog_timer; |
---|
272 | | - u64 connect_controller; |
---|
273 | | - u64 disconnect_controller; |
---|
274 | | - u64 open_protocol; |
---|
275 | | - u64 close_protocol; |
---|
276 | | - u64 open_protocol_information; |
---|
277 | | - u64 protocols_per_handle; |
---|
278 | | - u64 locate_handle_buffer; |
---|
279 | | - u64 locate_protocol; |
---|
280 | | - u64 install_multiple_protocol_interfaces; |
---|
281 | | - u64 uninstall_multiple_protocol_interfaces; |
---|
282 | | - u64 calculate_crc32; |
---|
283 | | - u64 copy_mem; |
---|
284 | | - u64 set_mem; |
---|
285 | | - u64 create_event_ex; |
---|
286 | | -} __packed efi_boot_services_64_t; |
---|
287 | | - |
---|
288 | | -/* |
---|
289 | | - * EFI Boot Services table |
---|
290 | | - */ |
---|
291 | | -typedef struct { |
---|
292 | | - efi_table_hdr_t hdr; |
---|
293 | | - void *raise_tpl; |
---|
294 | | - void *restore_tpl; |
---|
295 | | - efi_status_t (*allocate_pages)(int, int, unsigned long, |
---|
296 | | - efi_physical_addr_t *); |
---|
297 | | - efi_status_t (*free_pages)(efi_physical_addr_t, unsigned long); |
---|
298 | | - efi_status_t (*get_memory_map)(unsigned long *, void *, unsigned long *, |
---|
299 | | - unsigned long *, u32 *); |
---|
300 | | - efi_status_t (*allocate_pool)(int, unsigned long, void **); |
---|
301 | | - efi_status_t (*free_pool)(void *); |
---|
302 | | - void *create_event; |
---|
303 | | - void *set_timer; |
---|
304 | | - void *wait_for_event; |
---|
305 | | - void *signal_event; |
---|
306 | | - void *close_event; |
---|
307 | | - void *check_event; |
---|
308 | | - void *install_protocol_interface; |
---|
309 | | - void *reinstall_protocol_interface; |
---|
310 | | - void *uninstall_protocol_interface; |
---|
311 | | - efi_status_t (*handle_protocol)(efi_handle_t, efi_guid_t *, void **); |
---|
312 | | - void *__reserved; |
---|
313 | | - void *register_protocol_notify; |
---|
314 | | - efi_status_t (*locate_handle)(int, efi_guid_t *, void *, |
---|
315 | | - unsigned long *, efi_handle_t *); |
---|
316 | | - void *locate_device_path; |
---|
317 | | - efi_status_t (*install_configuration_table)(efi_guid_t *, void *); |
---|
318 | | - void *load_image; |
---|
319 | | - void *start_image; |
---|
320 | | - void *exit; |
---|
321 | | - void *unload_image; |
---|
322 | | - efi_status_t (*exit_boot_services)(efi_handle_t, unsigned long); |
---|
323 | | - void *get_next_monotonic_count; |
---|
324 | | - void *stall; |
---|
325 | | - void *set_watchdog_timer; |
---|
326 | | - void *connect_controller; |
---|
327 | | - void *disconnect_controller; |
---|
328 | | - void *open_protocol; |
---|
329 | | - void *close_protocol; |
---|
330 | | - void *open_protocol_information; |
---|
331 | | - void *protocols_per_handle; |
---|
332 | | - void *locate_handle_buffer; |
---|
333 | | - efi_status_t (*locate_protocol)(efi_guid_t *, void *, void **); |
---|
334 | | - void *install_multiple_protocol_interfaces; |
---|
335 | | - void *uninstall_multiple_protocol_interfaces; |
---|
336 | | - void *calculate_crc32; |
---|
337 | | - void *copy_mem; |
---|
338 | | - void *set_mem; |
---|
339 | | - void *create_event_ex; |
---|
340 | | -} efi_boot_services_t; |
---|
341 | | - |
---|
342 | | -typedef enum { |
---|
343 | | - EfiPciIoWidthUint8, |
---|
344 | | - EfiPciIoWidthUint16, |
---|
345 | | - EfiPciIoWidthUint32, |
---|
346 | | - EfiPciIoWidthUint64, |
---|
347 | | - EfiPciIoWidthFifoUint8, |
---|
348 | | - EfiPciIoWidthFifoUint16, |
---|
349 | | - EfiPciIoWidthFifoUint32, |
---|
350 | | - EfiPciIoWidthFifoUint64, |
---|
351 | | - EfiPciIoWidthFillUint8, |
---|
352 | | - EfiPciIoWidthFillUint16, |
---|
353 | | - EfiPciIoWidthFillUint32, |
---|
354 | | - EfiPciIoWidthFillUint64, |
---|
355 | | - EfiPciIoWidthMaximum |
---|
356 | | -} EFI_PCI_IO_PROTOCOL_WIDTH; |
---|
357 | | - |
---|
358 | | -typedef enum { |
---|
359 | | - EfiPciIoAttributeOperationGet, |
---|
360 | | - EfiPciIoAttributeOperationSet, |
---|
361 | | - EfiPciIoAttributeOperationEnable, |
---|
362 | | - EfiPciIoAttributeOperationDisable, |
---|
363 | | - EfiPciIoAttributeOperationSupported, |
---|
364 | | - EfiPciIoAttributeOperationMaximum |
---|
365 | | -} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; |
---|
366 | | - |
---|
367 | | -typedef struct { |
---|
368 | | - u32 read; |
---|
369 | | - u32 write; |
---|
370 | | -} efi_pci_io_protocol_access_32_t; |
---|
371 | | - |
---|
372 | | -typedef struct { |
---|
373 | | - u64 read; |
---|
374 | | - u64 write; |
---|
375 | | -} efi_pci_io_protocol_access_64_t; |
---|
376 | | - |
---|
377 | | -typedef struct { |
---|
378 | | - void *read; |
---|
379 | | - void *write; |
---|
380 | | -} efi_pci_io_protocol_access_t; |
---|
381 | | - |
---|
382 | | -typedef struct { |
---|
383 | | - u32 poll_mem; |
---|
384 | | - u32 poll_io; |
---|
385 | | - efi_pci_io_protocol_access_32_t mem; |
---|
386 | | - efi_pci_io_protocol_access_32_t io; |
---|
387 | | - efi_pci_io_protocol_access_32_t pci; |
---|
388 | | - u32 copy_mem; |
---|
389 | | - u32 map; |
---|
390 | | - u32 unmap; |
---|
391 | | - u32 allocate_buffer; |
---|
392 | | - u32 free_buffer; |
---|
393 | | - u32 flush; |
---|
394 | | - u32 get_location; |
---|
395 | | - u32 attributes; |
---|
396 | | - u32 get_bar_attributes; |
---|
397 | | - u32 set_bar_attributes; |
---|
398 | | - u64 romsize; |
---|
399 | | - u32 romimage; |
---|
400 | | -} efi_pci_io_protocol_32_t; |
---|
401 | | - |
---|
402 | | -typedef struct { |
---|
403 | | - u64 poll_mem; |
---|
404 | | - u64 poll_io; |
---|
405 | | - efi_pci_io_protocol_access_64_t mem; |
---|
406 | | - efi_pci_io_protocol_access_64_t io; |
---|
407 | | - efi_pci_io_protocol_access_64_t pci; |
---|
408 | | - u64 copy_mem; |
---|
409 | | - u64 map; |
---|
410 | | - u64 unmap; |
---|
411 | | - u64 allocate_buffer; |
---|
412 | | - u64 free_buffer; |
---|
413 | | - u64 flush; |
---|
414 | | - u64 get_location; |
---|
415 | | - u64 attributes; |
---|
416 | | - u64 get_bar_attributes; |
---|
417 | | - u64 set_bar_attributes; |
---|
418 | | - u64 romsize; |
---|
419 | | - u64 romimage; |
---|
420 | | -} efi_pci_io_protocol_64_t; |
---|
421 | | - |
---|
422 | | -typedef struct { |
---|
423 | | - void *poll_mem; |
---|
424 | | - void *poll_io; |
---|
425 | | - efi_pci_io_protocol_access_t mem; |
---|
426 | | - efi_pci_io_protocol_access_t io; |
---|
427 | | - efi_pci_io_protocol_access_t pci; |
---|
428 | | - void *copy_mem; |
---|
429 | | - void *map; |
---|
430 | | - void *unmap; |
---|
431 | | - void *allocate_buffer; |
---|
432 | | - void *free_buffer; |
---|
433 | | - void *flush; |
---|
434 | | - void *get_location; |
---|
435 | | - void *attributes; |
---|
436 | | - void *get_bar_attributes; |
---|
437 | | - void *set_bar_attributes; |
---|
438 | | - uint64_t romsize; |
---|
439 | | - void *romimage; |
---|
440 | | -} efi_pci_io_protocol_t; |
---|
441 | | - |
---|
442 | | -#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 |
---|
443 | | -#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 |
---|
444 | | -#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 |
---|
445 | | -#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 |
---|
446 | | -#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 |
---|
447 | | -#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 |
---|
448 | | -#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 |
---|
449 | | -#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 |
---|
450 | | -#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 |
---|
451 | | -#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 |
---|
452 | | -#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 |
---|
453 | | -#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 |
---|
454 | | -#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 |
---|
455 | | -#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 |
---|
456 | | -#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 |
---|
457 | | -#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 |
---|
458 | | -#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 |
---|
459 | | -#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 |
---|
460 | | -#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 |
---|
461 | | - |
---|
462 | | -typedef struct { |
---|
463 | | - u32 version; |
---|
464 | | - u32 get; |
---|
465 | | - u32 set; |
---|
466 | | - u32 del; |
---|
467 | | - u32 get_all; |
---|
468 | | -} apple_properties_protocol_32_t; |
---|
469 | | - |
---|
470 | | -typedef struct { |
---|
471 | | - u64 version; |
---|
472 | | - u64 get; |
---|
473 | | - u64 set; |
---|
474 | | - u64 del; |
---|
475 | | - u64 get_all; |
---|
476 | | -} apple_properties_protocol_64_t; |
---|
477 | | - |
---|
478 | | -typedef struct { |
---|
479 | | - u32 get_capability; |
---|
480 | | - u32 get_event_log; |
---|
481 | | - u32 hash_log_extend_event; |
---|
482 | | - u32 submit_command; |
---|
483 | | - u32 get_active_pcr_banks; |
---|
484 | | - u32 set_active_pcr_banks; |
---|
485 | | - u32 get_result_of_set_active_pcr_banks; |
---|
486 | | -} efi_tcg2_protocol_32_t; |
---|
487 | | - |
---|
488 | | -typedef struct { |
---|
489 | | - u64 get_capability; |
---|
490 | | - u64 get_event_log; |
---|
491 | | - u64 hash_log_extend_event; |
---|
492 | | - u64 submit_command; |
---|
493 | | - u64 get_active_pcr_banks; |
---|
494 | | - u64 set_active_pcr_banks; |
---|
495 | | - u64 get_result_of_set_active_pcr_banks; |
---|
496 | | -} efi_tcg2_protocol_64_t; |
---|
497 | | - |
---|
498 | | -typedef u32 efi_tcg2_event_log_format; |
---|
499 | | - |
---|
500 | | -typedef struct { |
---|
501 | | - void *get_capability; |
---|
502 | | - efi_status_t (*get_event_log)(efi_handle_t, efi_tcg2_event_log_format, |
---|
503 | | - efi_physical_addr_t *, efi_physical_addr_t *, efi_bool_t *); |
---|
504 | | - void *hash_log_extend_event; |
---|
505 | | - void *submit_command; |
---|
506 | | - void *get_active_pcr_banks; |
---|
507 | | - void *set_active_pcr_banks; |
---|
508 | | - void *get_result_of_set_active_pcr_banks; |
---|
509 | | -} efi_tcg2_protocol_t; |
---|
| 203 | +typedef union efi_boot_services efi_boot_services_t; |
---|
510 | 204 | |
---|
511 | 205 | /* |
---|
512 | 206 | * Types and defines for EFI ResetSystem |
---|
.. | .. |
---|
538 | 232 | u32 query_capsule_caps; |
---|
539 | 233 | u32 query_variable_info; |
---|
540 | 234 | } efi_runtime_services_32_t; |
---|
541 | | - |
---|
542 | | -typedef struct { |
---|
543 | | - efi_table_hdr_t hdr; |
---|
544 | | - u64 get_time; |
---|
545 | | - u64 set_time; |
---|
546 | | - u64 get_wakeup_time; |
---|
547 | | - u64 set_wakeup_time; |
---|
548 | | - u64 set_virtual_address_map; |
---|
549 | | - u64 convert_pointer; |
---|
550 | | - u64 get_variable; |
---|
551 | | - u64 get_next_variable; |
---|
552 | | - u64 set_variable; |
---|
553 | | - u64 get_next_high_mono_count; |
---|
554 | | - u64 reset_system; |
---|
555 | | - u64 update_capsule; |
---|
556 | | - u64 query_capsule_caps; |
---|
557 | | - u64 query_variable_info; |
---|
558 | | -} efi_runtime_services_64_t; |
---|
559 | 235 | |
---|
560 | 236 | typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc); |
---|
561 | 237 | typedef efi_status_t efi_set_time_t (efi_time_t *tm); |
---|
.. | .. |
---|
591 | 267 | unsigned long size, |
---|
592 | 268 | bool nonblocking); |
---|
593 | 269 | |
---|
594 | | -typedef struct { |
---|
595 | | - efi_table_hdr_t hdr; |
---|
596 | | - efi_get_time_t *get_time; |
---|
597 | | - efi_set_time_t *set_time; |
---|
598 | | - efi_get_wakeup_time_t *get_wakeup_time; |
---|
599 | | - efi_set_wakeup_time_t *set_wakeup_time; |
---|
600 | | - efi_set_virtual_address_map_t *set_virtual_address_map; |
---|
601 | | - void *convert_pointer; |
---|
602 | | - efi_get_variable_t *get_variable; |
---|
603 | | - efi_get_next_variable_t *get_next_variable; |
---|
604 | | - efi_set_variable_t *set_variable; |
---|
605 | | - efi_get_next_high_mono_count_t *get_next_high_mono_count; |
---|
606 | | - efi_reset_system_t *reset_system; |
---|
607 | | - efi_update_capsule_t *update_capsule; |
---|
608 | | - efi_query_capsule_caps_t *query_capsule_caps; |
---|
609 | | - efi_query_variable_info_t *query_variable_info; |
---|
| 270 | +typedef union { |
---|
| 271 | + struct { |
---|
| 272 | + efi_table_hdr_t hdr; |
---|
| 273 | + efi_get_time_t __efiapi *get_time; |
---|
| 274 | + efi_set_time_t __efiapi *set_time; |
---|
| 275 | + efi_get_wakeup_time_t __efiapi *get_wakeup_time; |
---|
| 276 | + efi_set_wakeup_time_t __efiapi *set_wakeup_time; |
---|
| 277 | + efi_set_virtual_address_map_t __efiapi *set_virtual_address_map; |
---|
| 278 | + void *convert_pointer; |
---|
| 279 | + efi_get_variable_t __efiapi *get_variable; |
---|
| 280 | + efi_get_next_variable_t __efiapi *get_next_variable; |
---|
| 281 | + efi_set_variable_t __efiapi *set_variable; |
---|
| 282 | + efi_get_next_high_mono_count_t __efiapi *get_next_high_mono_count; |
---|
| 283 | + efi_reset_system_t __efiapi *reset_system; |
---|
| 284 | + efi_update_capsule_t __efiapi *update_capsule; |
---|
| 285 | + efi_query_capsule_caps_t __efiapi *query_capsule_caps; |
---|
| 286 | + efi_query_variable_info_t __efiapi *query_variable_info; |
---|
| 287 | + }; |
---|
| 288 | + efi_runtime_services_32_t mixed_mode; |
---|
610 | 289 | } efi_runtime_services_t; |
---|
611 | 290 | |
---|
612 | 291 | void efi_native_runtime_setup(void); |
---|
.. | .. |
---|
659 | 338 | #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) |
---|
660 | 339 | #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0) |
---|
661 | 340 | #define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f) |
---|
| 341 | +#define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) |
---|
| 342 | +#define EFI_LOAD_FILE2_PROTOCOL_GUID EFI_GUID(0x4006c0c1, 0xfcb3, 0x403e, 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d) |
---|
| 343 | +#define EFI_RT_PROPERTIES_TABLE_GUID EFI_GUID(0xeb66918a, 0x7eef, 0x402a, 0x84, 0x2e, 0x93, 0x1d, 0x21, 0xc3, 0x8a, 0xe9) |
---|
662 | 344 | |
---|
663 | 345 | #define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f) |
---|
664 | 346 | #define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) |
---|
| 347 | + |
---|
| 348 | +#define EFI_CERT_SHA256_GUID EFI_GUID(0xc1c41626, 0x504c, 0x4092, 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28) |
---|
| 349 | +#define EFI_CERT_X509_GUID EFI_GUID(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72) |
---|
| 350 | +#define EFI_CERT_X509_SHA256_GUID EFI_GUID(0x3bd2a492, 0x96c0, 0x4079, 0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed) |
---|
665 | 351 | |
---|
666 | 352 | /* |
---|
667 | 353 | * This GUID is used to pass to the kernel proper the struct screen_info |
---|
.. | .. |
---|
669 | 355 | * associated with ConOut |
---|
670 | 356 | */ |
---|
671 | 357 | #define LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) |
---|
| 358 | +#define LINUX_EFI_ARM_CPU_STATE_TABLE_GUID EFI_GUID(0xef79e4aa, 0x3c3d, 0x4989, 0xb9, 0x02, 0x07, 0xa9, 0x43, 0xe5, 0x50, 0xd2) |
---|
672 | 359 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) |
---|
673 | 360 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) |
---|
674 | 361 | #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) |
---|
| 362 | +#define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25) |
---|
| 363 | +#define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) |
---|
| 364 | +#define LINUX_EFI_INITRD_MEDIA_GUID EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68) |
---|
| 365 | +#define LINUX_EFI_MOK_VARIABLE_TABLE_GUID EFI_GUID(0xc451ed2b, 0x9694, 0x45d3, 0xba, 0xba, 0xed, 0x9f, 0x89, 0x88, 0xa3, 0x89) |
---|
| 366 | + |
---|
| 367 | +/* OEM GUIDs */ |
---|
| 368 | +#define DELLEMC_EFI_RCI2_TABLE_GUID EFI_GUID(0x2d9f28a2, 0xa886, 0x456a, 0x97, 0xa8, 0xf1, 0x1e, 0xf2, 0x4f, 0xf4, 0x55) |
---|
675 | 369 | |
---|
676 | 370 | typedef struct { |
---|
677 | 371 | efi_guid_t guid; |
---|
.. | .. |
---|
683 | 377 | u32 table; |
---|
684 | 378 | } efi_config_table_32_t; |
---|
685 | 379 | |
---|
686 | | -typedef struct { |
---|
687 | | - efi_guid_t guid; |
---|
688 | | - unsigned long table; |
---|
| 380 | +typedef union { |
---|
| 381 | + struct { |
---|
| 382 | + efi_guid_t guid; |
---|
| 383 | + void *table; |
---|
| 384 | + }; |
---|
| 385 | + efi_config_table_32_t mixed_mode; |
---|
689 | 386 | } efi_config_table_t; |
---|
690 | 387 | |
---|
691 | 388 | typedef struct { |
---|
692 | 389 | efi_guid_t guid; |
---|
693 | | - const char *name; |
---|
694 | 390 | unsigned long *ptr; |
---|
| 391 | + const char name[16]; |
---|
695 | 392 | } efi_config_table_type_t; |
---|
696 | 393 | |
---|
697 | 394 | #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) |
---|
.. | .. |
---|
737 | 434 | u32 tables; |
---|
738 | 435 | } efi_system_table_32_t; |
---|
739 | 436 | |
---|
740 | | -typedef struct { |
---|
741 | | - efi_table_hdr_t hdr; |
---|
742 | | - unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ |
---|
743 | | - u32 fw_revision; |
---|
744 | | - unsigned long con_in_handle; |
---|
745 | | - unsigned long con_in; |
---|
746 | | - unsigned long con_out_handle; |
---|
747 | | - unsigned long con_out; |
---|
748 | | - unsigned long stderr_handle; |
---|
749 | | - unsigned long stderr; |
---|
750 | | - efi_runtime_services_t *runtime; |
---|
751 | | - efi_boot_services_t *boottime; |
---|
752 | | - unsigned long nr_tables; |
---|
753 | | - unsigned long tables; |
---|
| 437 | +typedef union efi_simple_text_input_protocol efi_simple_text_input_protocol_t; |
---|
| 438 | +typedef union efi_simple_text_output_protocol efi_simple_text_output_protocol_t; |
---|
| 439 | + |
---|
| 440 | +typedef union { |
---|
| 441 | + struct { |
---|
| 442 | + efi_table_hdr_t hdr; |
---|
| 443 | + unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ |
---|
| 444 | + u32 fw_revision; |
---|
| 445 | + unsigned long con_in_handle; |
---|
| 446 | + efi_simple_text_input_protocol_t *con_in; |
---|
| 447 | + unsigned long con_out_handle; |
---|
| 448 | + efi_simple_text_output_protocol_t *con_out; |
---|
| 449 | + unsigned long stderr_handle; |
---|
| 450 | + unsigned long stderr; |
---|
| 451 | + efi_runtime_services_t *runtime; |
---|
| 452 | + efi_boot_services_t *boottime; |
---|
| 453 | + unsigned long nr_tables; |
---|
| 454 | + unsigned long tables; |
---|
| 455 | + }; |
---|
| 456 | + efi_system_table_32_t mixed_mode; |
---|
754 | 457 | } efi_system_table_t; |
---|
755 | 458 | |
---|
756 | 459 | /* |
---|
757 | 460 | * Architecture independent structure for describing a memory map for the |
---|
758 | | - * benefit of efi_memmap_init_early(), saving us the need to pass four |
---|
759 | | - * parameters. |
---|
| 461 | + * benefit of efi_memmap_init_early(), and for passing context between |
---|
| 462 | + * efi_memmap_alloc() and efi_memmap_install(). |
---|
760 | 463 | */ |
---|
761 | 464 | struct efi_memory_map_data { |
---|
762 | 465 | phys_addr_t phys_map; |
---|
763 | 466 | unsigned long size; |
---|
764 | 467 | unsigned long desc_version; |
---|
765 | 468 | unsigned long desc_size; |
---|
| 469 | + unsigned long flags; |
---|
766 | 470 | }; |
---|
767 | 471 | |
---|
768 | 472 | struct efi_memory_map { |
---|
.. | .. |
---|
772 | 476 | int nr_map; |
---|
773 | 477 | unsigned long desc_version; |
---|
774 | 478 | unsigned long desc_size; |
---|
775 | | - bool late; |
---|
| 479 | +#define EFI_MEMMAP_LATE (1UL << 0) |
---|
| 480 | +#define EFI_MEMMAP_MEMBLOCK (1UL << 1) |
---|
| 481 | +#define EFI_MEMMAP_SLAB (1UL << 2) |
---|
| 482 | + unsigned long flags; |
---|
776 | 483 | }; |
---|
777 | 484 | |
---|
778 | 485 | struct efi_mem_range { |
---|
779 | 486 | struct range range; |
---|
780 | 487 | u64 attribute; |
---|
781 | 488 | }; |
---|
782 | | - |
---|
783 | | -struct efi_fdt_params { |
---|
784 | | - u64 system_table; |
---|
785 | | - u64 mmap; |
---|
786 | | - u32 mmap_size; |
---|
787 | | - u32 desc_size; |
---|
788 | | - u32 desc_ver; |
---|
789 | | -}; |
---|
790 | | - |
---|
791 | | -typedef struct { |
---|
792 | | - u32 revision; |
---|
793 | | - u32 parent_handle; |
---|
794 | | - u32 system_table; |
---|
795 | | - u32 device_handle; |
---|
796 | | - u32 file_path; |
---|
797 | | - u32 reserved; |
---|
798 | | - u32 load_options_size; |
---|
799 | | - u32 load_options; |
---|
800 | | - u32 image_base; |
---|
801 | | - __aligned_u64 image_size; |
---|
802 | | - unsigned int image_code_type; |
---|
803 | | - unsigned int image_data_type; |
---|
804 | | - unsigned long unload; |
---|
805 | | -} efi_loaded_image_32_t; |
---|
806 | | - |
---|
807 | | -typedef struct { |
---|
808 | | - u32 revision; |
---|
809 | | - u64 parent_handle; |
---|
810 | | - u64 system_table; |
---|
811 | | - u64 device_handle; |
---|
812 | | - u64 file_path; |
---|
813 | | - u64 reserved; |
---|
814 | | - u32 load_options_size; |
---|
815 | | - u64 load_options; |
---|
816 | | - u64 image_base; |
---|
817 | | - __aligned_u64 image_size; |
---|
818 | | - unsigned int image_code_type; |
---|
819 | | - unsigned int image_data_type; |
---|
820 | | - unsigned long unload; |
---|
821 | | -} efi_loaded_image_64_t; |
---|
822 | | - |
---|
823 | | -typedef struct { |
---|
824 | | - u32 revision; |
---|
825 | | - void *parent_handle; |
---|
826 | | - efi_system_table_t *system_table; |
---|
827 | | - void *device_handle; |
---|
828 | | - void *file_path; |
---|
829 | | - void *reserved; |
---|
830 | | - u32 load_options_size; |
---|
831 | | - void *load_options; |
---|
832 | | - void *image_base; |
---|
833 | | - __aligned_u64 image_size; |
---|
834 | | - unsigned int image_code_type; |
---|
835 | | - unsigned int image_data_type; |
---|
836 | | - unsigned long unload; |
---|
837 | | -} efi_loaded_image_t; |
---|
838 | | - |
---|
839 | | - |
---|
840 | | -typedef struct { |
---|
841 | | - u64 size; |
---|
842 | | - u64 file_size; |
---|
843 | | - u64 phys_size; |
---|
844 | | - efi_time_t create_time; |
---|
845 | | - efi_time_t last_access_time; |
---|
846 | | - efi_time_t modification_time; |
---|
847 | | - __aligned_u64 attribute; |
---|
848 | | - efi_char16_t filename[1]; |
---|
849 | | -} efi_file_info_t; |
---|
850 | | - |
---|
851 | | -typedef struct { |
---|
852 | | - u64 revision; |
---|
853 | | - u32 open; |
---|
854 | | - u32 close; |
---|
855 | | - u32 delete; |
---|
856 | | - u32 read; |
---|
857 | | - u32 write; |
---|
858 | | - u32 get_position; |
---|
859 | | - u32 set_position; |
---|
860 | | - u32 get_info; |
---|
861 | | - u32 set_info; |
---|
862 | | - u32 flush; |
---|
863 | | -} efi_file_handle_32_t; |
---|
864 | | - |
---|
865 | | -typedef struct { |
---|
866 | | - u64 revision; |
---|
867 | | - u64 open; |
---|
868 | | - u64 close; |
---|
869 | | - u64 delete; |
---|
870 | | - u64 read; |
---|
871 | | - u64 write; |
---|
872 | | - u64 get_position; |
---|
873 | | - u64 set_position; |
---|
874 | | - u64 get_info; |
---|
875 | | - u64 set_info; |
---|
876 | | - u64 flush; |
---|
877 | | -} efi_file_handle_64_t; |
---|
878 | | - |
---|
879 | | -typedef struct _efi_file_handle { |
---|
880 | | - u64 revision; |
---|
881 | | - efi_status_t (*open)(struct _efi_file_handle *, |
---|
882 | | - struct _efi_file_handle **, |
---|
883 | | - efi_char16_t *, u64, u64); |
---|
884 | | - efi_status_t (*close)(struct _efi_file_handle *); |
---|
885 | | - void *delete; |
---|
886 | | - efi_status_t (*read)(struct _efi_file_handle *, unsigned long *, |
---|
887 | | - void *); |
---|
888 | | - void *write; |
---|
889 | | - void *get_position; |
---|
890 | | - void *set_position; |
---|
891 | | - efi_status_t (*get_info)(struct _efi_file_handle *, efi_guid_t *, |
---|
892 | | - unsigned long *, void *); |
---|
893 | | - void *set_info; |
---|
894 | | - void *flush; |
---|
895 | | -} efi_file_handle_t; |
---|
896 | | - |
---|
897 | | -typedef struct { |
---|
898 | | - u64 revision; |
---|
899 | | - u32 open_volume; |
---|
900 | | -} efi_file_io_interface_32_t; |
---|
901 | | - |
---|
902 | | -typedef struct { |
---|
903 | | - u64 revision; |
---|
904 | | - u64 open_volume; |
---|
905 | | -} efi_file_io_interface_64_t; |
---|
906 | | - |
---|
907 | | -typedef struct _efi_file_io_interface { |
---|
908 | | - u64 revision; |
---|
909 | | - int (*open_volume)(struct _efi_file_io_interface *, |
---|
910 | | - efi_file_handle_t **); |
---|
911 | | -} efi_file_io_interface_t; |
---|
912 | | - |
---|
913 | | -#define EFI_FILE_MODE_READ 0x0000000000000001 |
---|
914 | | -#define EFI_FILE_MODE_WRITE 0x0000000000000002 |
---|
915 | | -#define EFI_FILE_MODE_CREATE 0x8000000000000000 |
---|
916 | 489 | |
---|
917 | 490 | typedef struct { |
---|
918 | 491 | u32 version; |
---|
.. | .. |
---|
922 | 495 | |
---|
923 | 496 | #define EFI_PROPERTIES_TABLE_VERSION 0x00010000 |
---|
924 | 497 | #define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1 |
---|
| 498 | + |
---|
| 499 | +typedef struct { |
---|
| 500 | + u16 version; |
---|
| 501 | + u16 length; |
---|
| 502 | + u32 runtime_services_supported; |
---|
| 503 | +} efi_rt_properties_table_t; |
---|
| 504 | + |
---|
| 505 | +#define EFI_RT_PROPERTIES_TABLE_VERSION 0x1 |
---|
925 | 506 | |
---|
926 | 507 | #define EFI_INVALID_TABLE_ADDR (~0UL) |
---|
927 | 508 | |
---|
.. | .. |
---|
933 | 514 | efi_memory_desc_t entry[0]; |
---|
934 | 515 | } efi_memory_attributes_table_t; |
---|
935 | 516 | |
---|
| 517 | +typedef struct { |
---|
| 518 | + efi_guid_t signature_owner; |
---|
| 519 | + u8 signature_data[]; |
---|
| 520 | +} efi_signature_data_t; |
---|
| 521 | + |
---|
| 522 | +typedef struct { |
---|
| 523 | + efi_guid_t signature_type; |
---|
| 524 | + u32 signature_list_size; |
---|
| 525 | + u32 signature_header_size; |
---|
| 526 | + u32 signature_size; |
---|
| 527 | + u8 signature_header[]; |
---|
| 528 | + /* efi_signature_data_t signatures[][] */ |
---|
| 529 | +} efi_signature_list_t; |
---|
| 530 | + |
---|
| 531 | +typedef u8 efi_sha256_hash_t[32]; |
---|
| 532 | + |
---|
| 533 | +typedef struct { |
---|
| 534 | + efi_sha256_hash_t to_be_signed_hash; |
---|
| 535 | + efi_time_t time_of_revocation; |
---|
| 536 | +} efi_cert_x509_sha256_t; |
---|
| 537 | + |
---|
| 538 | +extern unsigned long __ro_after_init efi_rng_seed; /* RNG Seed table */ |
---|
| 539 | + |
---|
936 | 540 | /* |
---|
937 | 541 | * All runtime access to EFI goes through this structure: |
---|
938 | 542 | */ |
---|
939 | 543 | extern struct efi { |
---|
940 | | - efi_system_table_t *systab; /* EFI system table */ |
---|
941 | | - unsigned int runtime_version; /* Runtime services version */ |
---|
942 | | - unsigned long mps; /* MPS table */ |
---|
943 | | - unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ |
---|
944 | | - unsigned long acpi20; /* ACPI table (ACPI 2.0) */ |
---|
945 | | - unsigned long smbios; /* SMBIOS table (32 bit entry point) */ |
---|
946 | | - unsigned long smbios3; /* SMBIOS table (64 bit entry point) */ |
---|
947 | | - unsigned long sal_systab; /* SAL system table */ |
---|
948 | | - unsigned long boot_info; /* boot info table */ |
---|
949 | | - unsigned long hcdp; /* HCDP table */ |
---|
950 | | - unsigned long uga; /* UGA table */ |
---|
951 | | - unsigned long uv_systab; /* UV system table */ |
---|
952 | | - unsigned long fw_vendor; /* fw_vendor */ |
---|
953 | | - unsigned long runtime; /* runtime table */ |
---|
954 | | - unsigned long config_table; /* config tables */ |
---|
955 | | - unsigned long esrt; /* ESRT table */ |
---|
956 | | - unsigned long properties_table; /* properties table */ |
---|
957 | | - unsigned long mem_attr_table; /* memory attributes table */ |
---|
958 | | - unsigned long rng_seed; /* UEFI firmware random seed */ |
---|
959 | | - unsigned long tpm_log; /* TPM2 Event Log table */ |
---|
960 | | - efi_get_time_t *get_time; |
---|
961 | | - efi_set_time_t *set_time; |
---|
962 | | - efi_get_wakeup_time_t *get_wakeup_time; |
---|
963 | | - efi_set_wakeup_time_t *set_wakeup_time; |
---|
964 | | - efi_get_variable_t *get_variable; |
---|
965 | | - efi_get_next_variable_t *get_next_variable; |
---|
966 | | - efi_set_variable_t *set_variable; |
---|
967 | | - efi_set_variable_t *set_variable_nonblocking; |
---|
968 | | - efi_query_variable_info_t *query_variable_info; |
---|
969 | | - efi_query_variable_info_t *query_variable_info_nonblocking; |
---|
970 | | - efi_update_capsule_t *update_capsule; |
---|
971 | | - efi_query_capsule_caps_t *query_capsule_caps; |
---|
972 | | - efi_get_next_high_mono_count_t *get_next_high_mono_count; |
---|
973 | | - efi_reset_system_t *reset_system; |
---|
974 | | - efi_set_virtual_address_map_t *set_virtual_address_map; |
---|
975 | | - struct efi_memory_map memmap; |
---|
976 | | - unsigned long flags; |
---|
| 544 | + const efi_runtime_services_t *runtime; /* EFI runtime services table */ |
---|
| 545 | + unsigned int runtime_version; /* Runtime services version */ |
---|
| 546 | + unsigned int runtime_supported_mask; |
---|
| 547 | + |
---|
| 548 | + unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ |
---|
| 549 | + unsigned long acpi20; /* ACPI table (ACPI 2.0) */ |
---|
| 550 | + unsigned long smbios; /* SMBIOS table (32 bit entry point) */ |
---|
| 551 | + unsigned long smbios3; /* SMBIOS table (64 bit entry point) */ |
---|
| 552 | + unsigned long esrt; /* ESRT table */ |
---|
| 553 | + unsigned long tpm_log; /* TPM2 Event Log table */ |
---|
| 554 | + unsigned long tpm_final_log; /* TPM2 Final Events Log table */ |
---|
| 555 | + unsigned long mokvar_table; /* MOK variable config table */ |
---|
| 556 | + |
---|
| 557 | + efi_get_time_t *get_time; |
---|
| 558 | + efi_set_time_t *set_time; |
---|
| 559 | + efi_get_wakeup_time_t *get_wakeup_time; |
---|
| 560 | + efi_set_wakeup_time_t *set_wakeup_time; |
---|
| 561 | + efi_get_variable_t *get_variable; |
---|
| 562 | + efi_get_next_variable_t *get_next_variable; |
---|
| 563 | + efi_set_variable_t *set_variable; |
---|
| 564 | + efi_set_variable_t *set_variable_nonblocking; |
---|
| 565 | + efi_query_variable_info_t *query_variable_info; |
---|
| 566 | + efi_query_variable_info_t *query_variable_info_nonblocking; |
---|
| 567 | + efi_update_capsule_t *update_capsule; |
---|
| 568 | + efi_query_capsule_caps_t *query_capsule_caps; |
---|
| 569 | + efi_get_next_high_mono_count_t *get_next_high_mono_count; |
---|
| 570 | + efi_reset_system_t *reset_system; |
---|
| 571 | + |
---|
| 572 | + struct efi_memory_map memmap; |
---|
| 573 | + unsigned long flags; |
---|
977 | 574 | } efi; |
---|
| 575 | + |
---|
| 576 | +#define EFI_RT_SUPPORTED_GET_TIME 0x0001 |
---|
| 577 | +#define EFI_RT_SUPPORTED_SET_TIME 0x0002 |
---|
| 578 | +#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004 |
---|
| 579 | +#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME 0x0008 |
---|
| 580 | +#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010 |
---|
| 581 | +#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020 |
---|
| 582 | +#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040 |
---|
| 583 | +#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP 0x0080 |
---|
| 584 | +#define EFI_RT_SUPPORTED_CONVERT_POINTER 0x0100 |
---|
| 585 | +#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200 |
---|
| 586 | +#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400 |
---|
| 587 | +#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800 |
---|
| 588 | +#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000 |
---|
| 589 | +#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO 0x2000 |
---|
| 590 | + |
---|
| 591 | +#define EFI_RT_SUPPORTED_ALL 0x3fff |
---|
| 592 | + |
---|
| 593 | +#define EFI_RT_SUPPORTED_TIME_SERVICES 0x000f |
---|
| 594 | +#define EFI_RT_SUPPORTED_VARIABLE_SERVICES 0x0070 |
---|
978 | 595 | |
---|
979 | 596 | extern struct mm_struct efi_mm; |
---|
980 | 597 | |
---|
.. | .. |
---|
1002 | 619 | static inline void efi_enter_virtual_mode (void) {} |
---|
1003 | 620 | #endif |
---|
1004 | 621 | #ifdef CONFIG_X86 |
---|
1005 | | -extern void efi_free_boot_services(void); |
---|
1006 | 622 | extern efi_status_t efi_query_variable_store(u32 attributes, |
---|
1007 | 623 | unsigned long size, |
---|
1008 | 624 | bool nonblocking); |
---|
1009 | | -extern void efi_find_mirror(void); |
---|
1010 | 625 | #else |
---|
1011 | | -static inline void efi_free_boot_services(void) {} |
---|
1012 | 626 | |
---|
1013 | 627 | static inline efi_status_t efi_query_variable_store(u32 attributes, |
---|
1014 | 628 | unsigned long size, |
---|
.. | .. |
---|
1019 | 633 | #endif |
---|
1020 | 634 | extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr); |
---|
1021 | 635 | |
---|
1022 | | -extern phys_addr_t __init efi_memmap_alloc(unsigned int num_entries); |
---|
| 636 | +extern int __init efi_memmap_alloc(unsigned int num_entries, |
---|
| 637 | + struct efi_memory_map_data *data); |
---|
| 638 | +extern void __efi_memmap_free(u64 phys, unsigned long size, |
---|
| 639 | + unsigned long flags); |
---|
1023 | 640 | extern int __init efi_memmap_init_early(struct efi_memory_map_data *data); |
---|
1024 | 641 | extern int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size); |
---|
1025 | 642 | extern void __init efi_memmap_unmap(void); |
---|
1026 | | -extern int __init efi_memmap_install(phys_addr_t addr, unsigned int nr_map); |
---|
| 643 | +extern int __init efi_memmap_install(struct efi_memory_map_data *data); |
---|
1027 | 644 | extern int __init efi_memmap_split_count(efi_memory_desc_t *md, |
---|
1028 | 645 | struct range *range); |
---|
1029 | 646 | extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, |
---|
1030 | 647 | void *buf, struct efi_mem_range *mem); |
---|
1031 | 648 | |
---|
1032 | | -extern int efi_config_init(efi_config_table_type_t *arch_tables); |
---|
1033 | 649 | #ifdef CONFIG_EFI_ESRT |
---|
1034 | 650 | extern void __init efi_esrt_init(void); |
---|
1035 | 651 | #else |
---|
1036 | 652 | static inline void efi_esrt_init(void) { } |
---|
1037 | 653 | #endif |
---|
1038 | | -extern int efi_config_parse_tables(void *config_tables, int count, int sz, |
---|
1039 | | - efi_config_table_type_t *arch_tables); |
---|
| 654 | +extern int efi_config_parse_tables(const efi_config_table_t *config_tables, |
---|
| 655 | + int count, |
---|
| 656 | + const efi_config_table_type_t *arch_tables); |
---|
| 657 | +extern int efi_systab_check_header(const efi_table_hdr_t *systab_hdr, |
---|
| 658 | + int min_major_version); |
---|
| 659 | +extern void efi_systab_report_header(const efi_table_hdr_t *systab_hdr, |
---|
| 660 | + unsigned long fw_vendor); |
---|
1040 | 661 | extern u64 efi_get_iobase (void); |
---|
1041 | 662 | extern int efi_mem_type(unsigned long phys_addr); |
---|
1042 | 663 | extern u64 efi_mem_attributes (unsigned long phys_addr); |
---|
.. | .. |
---|
1045 | 666 | extern u64 efi_mem_desc_end(efi_memory_desc_t *md); |
---|
1046 | 667 | extern int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md); |
---|
1047 | 668 | extern void efi_mem_reserve(phys_addr_t addr, u64 size); |
---|
| 669 | +extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size); |
---|
1048 | 670 | extern void efi_initialize_iomem_resources(struct resource *code_resource, |
---|
1049 | 671 | struct resource *data_resource, struct resource *bss_resource); |
---|
1050 | | -extern void efi_reserve_boot_services(void); |
---|
1051 | | -extern int efi_get_fdt_params(struct efi_fdt_params *params); |
---|
| 672 | +extern u64 efi_get_fdt_params(struct efi_memory_map_data *data); |
---|
1052 | 673 | extern struct kobject *efi_kobj; |
---|
1053 | 674 | |
---|
1054 | 675 | extern int efi_reboot_quirk_mode; |
---|
.. | .. |
---|
1059 | 680 | #else |
---|
1060 | 681 | static inline void efi_fake_memmap(void) { } |
---|
1061 | 682 | #endif |
---|
| 683 | + |
---|
| 684 | +extern unsigned long efi_mem_attr_table; |
---|
1062 | 685 | |
---|
1063 | 686 | /* |
---|
1064 | 687 | * efi_memattr_perm_setter - arch specific callback function passed into |
---|
.. | .. |
---|
1117 | 740 | char * __init efi_md_typeattr_format(char *buf, size_t size, |
---|
1118 | 741 | const efi_memory_desc_t *md); |
---|
1119 | 742 | |
---|
| 743 | + |
---|
| 744 | +typedef void (*efi_element_handler_t)(const char *source, |
---|
| 745 | + const void *element_data, |
---|
| 746 | + size_t element_size); |
---|
| 747 | +extern int __init parse_efi_signature_list( |
---|
| 748 | + const char *source, |
---|
| 749 | + const void *data, size_t size, |
---|
| 750 | + efi_element_handler_t (*get_handler_for_guid)(const efi_guid_t *)); |
---|
| 751 | + |
---|
1120 | 752 | /** |
---|
1121 | 753 | * efi_range_is_wc - check the WC bit on an address range |
---|
1122 | 754 | * @start: starting kvirt address |
---|
.. | .. |
---|
1156 | 788 | #define EFI_DBG 8 /* Print additional debug info at runtime */ |
---|
1157 | 789 | #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ |
---|
1158 | 790 | #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ |
---|
| 791 | +#define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */ |
---|
| 792 | +#define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */ |
---|
1159 | 793 | |
---|
1160 | 794 | #ifdef CONFIG_EFI |
---|
1161 | 795 | /* |
---|
.. | .. |
---|
1167 | 801 | } |
---|
1168 | 802 | extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); |
---|
1169 | 803 | |
---|
1170 | | -extern bool efi_is_table_address(unsigned long phys_addr); |
---|
| 804 | +bool __pure __efi_soft_reserve_enabled(void); |
---|
| 805 | + |
---|
| 806 | +static inline bool __pure efi_soft_reserve_enabled(void) |
---|
| 807 | +{ |
---|
| 808 | + return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE) |
---|
| 809 | + && __efi_soft_reserve_enabled(); |
---|
| 810 | +} |
---|
| 811 | + |
---|
| 812 | +static inline bool efi_rt_services_supported(unsigned int mask) |
---|
| 813 | +{ |
---|
| 814 | + return (efi.runtime_supported_mask & mask) == mask; |
---|
| 815 | +} |
---|
1171 | 816 | #else |
---|
1172 | 817 | static inline bool efi_enabled(int feature) |
---|
1173 | 818 | { |
---|
.. | .. |
---|
1182 | 827 | return false; |
---|
1183 | 828 | } |
---|
1184 | 829 | |
---|
1185 | | -static inline bool efi_is_table_address(unsigned long phys_addr) |
---|
| 830 | +static inline bool efi_soft_reserve_enabled(void) |
---|
| 831 | +{ |
---|
| 832 | + return false; |
---|
| 833 | +} |
---|
| 834 | + |
---|
| 835 | +static inline bool efi_rt_services_supported(unsigned int mask) |
---|
1186 | 836 | { |
---|
1187 | 837 | return false; |
---|
1188 | 838 | } |
---|
.. | .. |
---|
1213 | 863 | * not including trailing NUL |
---|
1214 | 864 | */ |
---|
1215 | 865 | #define EFI_VARIABLE_GUID_LEN UUID_STRING_LEN |
---|
1216 | | - |
---|
1217 | | -/* |
---|
1218 | | - * The type of search to perform when calling boottime->locate_handle |
---|
1219 | | - */ |
---|
1220 | | -#define EFI_LOCATE_ALL_HANDLES 0 |
---|
1221 | | -#define EFI_LOCATE_BY_REGISTER_NOTIFY 1 |
---|
1222 | | -#define EFI_LOCATE_BY_PROTOCOL 2 |
---|
1223 | 866 | |
---|
1224 | 867 | /* |
---|
1225 | 868 | * EFI Device Path information |
---|
.. | .. |
---|
1260 | 903 | #define EFI_DEV_END_ENTIRE 0xFF |
---|
1261 | 904 | |
---|
1262 | 905 | struct efi_generic_dev_path { |
---|
1263 | | - u8 type; |
---|
1264 | | - u8 sub_type; |
---|
1265 | | - u16 length; |
---|
1266 | | -} __attribute ((packed)); |
---|
| 906 | + u8 type; |
---|
| 907 | + u8 sub_type; |
---|
| 908 | + u16 length; |
---|
| 909 | +} __packed; |
---|
| 910 | + |
---|
| 911 | +struct efi_acpi_dev_path { |
---|
| 912 | + struct efi_generic_dev_path header; |
---|
| 913 | + u32 hid; |
---|
| 914 | + u32 uid; |
---|
| 915 | +} __packed; |
---|
| 916 | + |
---|
| 917 | +struct efi_pci_dev_path { |
---|
| 918 | + struct efi_generic_dev_path header; |
---|
| 919 | + u8 fn; |
---|
| 920 | + u8 dev; |
---|
| 921 | +} __packed; |
---|
| 922 | + |
---|
| 923 | +struct efi_vendor_dev_path { |
---|
| 924 | + struct efi_generic_dev_path header; |
---|
| 925 | + efi_guid_t vendorguid; |
---|
| 926 | + u8 vendordata[]; |
---|
| 927 | +} __packed; |
---|
1267 | 928 | |
---|
1268 | 929 | struct efi_dev_path { |
---|
1269 | | - u8 type; /* can be replaced with unnamed */ |
---|
1270 | | - u8 sub_type; /* struct efi_generic_dev_path; */ |
---|
1271 | | - u16 length; /* once we've moved to -std=c11 */ |
---|
1272 | 930 | union { |
---|
1273 | | - struct { |
---|
1274 | | - u32 hid; |
---|
1275 | | - u32 uid; |
---|
1276 | | - } acpi; |
---|
1277 | | - struct { |
---|
1278 | | - u8 fn; |
---|
1279 | | - u8 dev; |
---|
1280 | | - } pci; |
---|
| 931 | + struct efi_generic_dev_path header; |
---|
| 932 | + struct efi_acpi_dev_path acpi; |
---|
| 933 | + struct efi_pci_dev_path pci; |
---|
| 934 | + struct efi_vendor_dev_path vendor; |
---|
1281 | 935 | }; |
---|
1282 | | -} __attribute ((packed)); |
---|
| 936 | +} __packed; |
---|
1283 | 937 | |
---|
1284 | | -#if IS_ENABLED(CONFIG_EFI_DEV_PATH_PARSER) |
---|
1285 | | -struct device *efi_get_device_by_path(struct efi_dev_path **node, size_t *len); |
---|
1286 | | -#endif |
---|
| 938 | +struct device *efi_get_device_by_path(const struct efi_dev_path **node, |
---|
| 939 | + size_t *len); |
---|
1287 | 940 | |
---|
1288 | 941 | static inline void memrange_efi_to_native(u64 *addr, u64 *npages) |
---|
1289 | 942 | { |
---|
.. | .. |
---|
1338 | 991 | bool deleting; |
---|
1339 | 992 | }; |
---|
1340 | 993 | |
---|
1341 | | -typedef struct { |
---|
1342 | | - u32 reset; |
---|
1343 | | - u32 output_string; |
---|
1344 | | - u32 test_string; |
---|
1345 | | -} efi_simple_text_output_protocol_32_t; |
---|
1346 | | - |
---|
1347 | | -typedef struct { |
---|
1348 | | - u64 reset; |
---|
1349 | | - u64 output_string; |
---|
1350 | | - u64 test_string; |
---|
1351 | | -} efi_simple_text_output_protocol_64_t; |
---|
1352 | | - |
---|
1353 | | -struct efi_simple_text_output_protocol { |
---|
1354 | | - void *reset; |
---|
1355 | | - efi_status_t (*output_string)(void *, void *); |
---|
1356 | | - void *test_string; |
---|
1357 | | -}; |
---|
1358 | | - |
---|
1359 | | -#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0 |
---|
1360 | | -#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1 |
---|
1361 | | -#define PIXEL_BIT_MASK 2 |
---|
1362 | | -#define PIXEL_BLT_ONLY 3 |
---|
1363 | | -#define PIXEL_FORMAT_MAX 4 |
---|
1364 | | - |
---|
1365 | | -struct efi_pixel_bitmask { |
---|
1366 | | - u32 red_mask; |
---|
1367 | | - u32 green_mask; |
---|
1368 | | - u32 blue_mask; |
---|
1369 | | - u32 reserved_mask; |
---|
1370 | | -}; |
---|
1371 | | - |
---|
1372 | | -struct efi_graphics_output_mode_info { |
---|
1373 | | - u32 version; |
---|
1374 | | - u32 horizontal_resolution; |
---|
1375 | | - u32 vertical_resolution; |
---|
1376 | | - int pixel_format; |
---|
1377 | | - struct efi_pixel_bitmask pixel_information; |
---|
1378 | | - u32 pixels_per_scan_line; |
---|
1379 | | -} __packed; |
---|
1380 | | - |
---|
1381 | | -struct efi_graphics_output_protocol_mode_32 { |
---|
1382 | | - u32 max_mode; |
---|
1383 | | - u32 mode; |
---|
1384 | | - u32 info; |
---|
1385 | | - u32 size_of_info; |
---|
1386 | | - u64 frame_buffer_base; |
---|
1387 | | - u32 frame_buffer_size; |
---|
1388 | | -} __packed; |
---|
1389 | | - |
---|
1390 | | -struct efi_graphics_output_protocol_mode_64 { |
---|
1391 | | - u32 max_mode; |
---|
1392 | | - u32 mode; |
---|
1393 | | - u64 info; |
---|
1394 | | - u64 size_of_info; |
---|
1395 | | - u64 frame_buffer_base; |
---|
1396 | | - u64 frame_buffer_size; |
---|
1397 | | -} __packed; |
---|
1398 | | - |
---|
1399 | | -struct efi_graphics_output_protocol_mode { |
---|
1400 | | - u32 max_mode; |
---|
1401 | | - u32 mode; |
---|
1402 | | - unsigned long info; |
---|
1403 | | - unsigned long size_of_info; |
---|
1404 | | - u64 frame_buffer_base; |
---|
1405 | | - unsigned long frame_buffer_size; |
---|
1406 | | -} __packed; |
---|
1407 | | - |
---|
1408 | | -struct efi_graphics_output_protocol_32 { |
---|
1409 | | - u32 query_mode; |
---|
1410 | | - u32 set_mode; |
---|
1411 | | - u32 blt; |
---|
1412 | | - u32 mode; |
---|
1413 | | -}; |
---|
1414 | | - |
---|
1415 | | -struct efi_graphics_output_protocol_64 { |
---|
1416 | | - u64 query_mode; |
---|
1417 | | - u64 set_mode; |
---|
1418 | | - u64 blt; |
---|
1419 | | - u64 mode; |
---|
1420 | | -}; |
---|
1421 | | - |
---|
1422 | | -struct efi_graphics_output_protocol { |
---|
1423 | | - unsigned long query_mode; |
---|
1424 | | - unsigned long set_mode; |
---|
1425 | | - unsigned long blt; |
---|
1426 | | - struct efi_graphics_output_protocol_mode *mode; |
---|
1427 | | -}; |
---|
1428 | | - |
---|
1429 | | -typedef efi_status_t (*efi_graphics_output_protocol_query_mode)( |
---|
1430 | | - struct efi_graphics_output_protocol *, u32, unsigned long *, |
---|
1431 | | - struct efi_graphics_output_mode_info **); |
---|
1432 | | - |
---|
1433 | | -extern struct list_head efivar_sysfs_list; |
---|
1434 | | - |
---|
1435 | 994 | static inline void |
---|
1436 | 995 | efivar_unregister(struct efivar_entry *var) |
---|
1437 | 996 | { |
---|
.. | .. |
---|
1444 | 1003 | int efivars_unregister(struct efivars *efivars); |
---|
1445 | 1004 | struct kobject *efivars_kobject(void); |
---|
1446 | 1005 | |
---|
| 1006 | +int efivar_supports_writes(void); |
---|
1447 | 1007 | int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), |
---|
1448 | 1008 | void *data, bool duplicates, struct list_head *head); |
---|
1449 | 1009 | |
---|
.. | .. |
---|
1482 | 1042 | bool efivar_variable_is_removable(efi_guid_t vendor, const char *name, |
---|
1483 | 1043 | size_t len); |
---|
1484 | 1044 | |
---|
1485 | | -extern struct work_struct efivar_work; |
---|
1486 | | -void efivar_run_worker(void); |
---|
1487 | | - |
---|
1488 | | -#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) |
---|
1489 | | -int efivars_sysfs_init(void); |
---|
1490 | | - |
---|
1491 | | -#define EFIVARS_DATA_SIZE_MAX 1024 |
---|
1492 | | - |
---|
1493 | | -#endif /* CONFIG_EFI_VARS */ |
---|
1494 | 1045 | extern bool efi_capsule_pending(int *reset_type); |
---|
1495 | 1046 | |
---|
1496 | 1047 | extern int efi_capsule_supported(efi_guid_t guid, u32 flags, |
---|
.. | .. |
---|
1527 | 1078 | |
---|
1528 | 1079 | #endif |
---|
1529 | 1080 | |
---|
1530 | | -/* prototypes shared between arch specific and generic stub code */ |
---|
1531 | | - |
---|
1532 | | -void efi_printk(efi_system_table_t *sys_table_arg, char *str); |
---|
1533 | | - |
---|
1534 | | -void efi_free(efi_system_table_t *sys_table_arg, unsigned long size, |
---|
1535 | | - unsigned long addr); |
---|
1536 | | - |
---|
1537 | | -char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, |
---|
1538 | | - efi_loaded_image_t *image, int *cmd_line_len); |
---|
1539 | | - |
---|
1540 | | -efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, |
---|
1541 | | - struct efi_boot_memmap *map); |
---|
1542 | | - |
---|
1543 | | -efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, |
---|
1544 | | - unsigned long size, unsigned long align, |
---|
1545 | | - unsigned long *addr); |
---|
1546 | | - |
---|
1547 | | -efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, |
---|
1548 | | - unsigned long size, unsigned long align, |
---|
1549 | | - unsigned long *addr, unsigned long max); |
---|
1550 | | - |
---|
1551 | | -efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, |
---|
1552 | | - unsigned long *image_addr, |
---|
1553 | | - unsigned long image_size, |
---|
1554 | | - unsigned long alloc_size, |
---|
1555 | | - unsigned long preferred_addr, |
---|
1556 | | - unsigned long alignment); |
---|
1557 | | - |
---|
1558 | | -efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, |
---|
1559 | | - efi_loaded_image_t *image, |
---|
1560 | | - char *cmd_line, char *option_string, |
---|
1561 | | - unsigned long max_addr, |
---|
1562 | | - unsigned long *load_addr, |
---|
1563 | | - unsigned long *load_size); |
---|
1564 | | - |
---|
1565 | | -efi_status_t efi_parse_options(char const *cmdline); |
---|
1566 | | - |
---|
1567 | | -efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, |
---|
1568 | | - struct screen_info *si, efi_guid_t *proto, |
---|
1569 | | - unsigned long size); |
---|
1570 | | - |
---|
1571 | 1081 | #ifdef CONFIG_EFI |
---|
1572 | 1082 | extern bool efi_runtime_disabled(void); |
---|
1573 | 1083 | #else |
---|
.. | .. |
---|
1575 | 1085 | #endif |
---|
1576 | 1086 | |
---|
1577 | 1087 | extern void efi_call_virt_check_flags(unsigned long flags, const char *call); |
---|
| 1088 | +extern unsigned long efi_call_virt_save_flags(void); |
---|
1578 | 1089 | |
---|
1579 | 1090 | enum efi_secureboot_mode { |
---|
1580 | 1091 | efi_secureboot_mode_unset, |
---|
.. | .. |
---|
1582 | 1093 | efi_secureboot_mode_disabled, |
---|
1583 | 1094 | efi_secureboot_mode_enabled, |
---|
1584 | 1095 | }; |
---|
1585 | | -enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table); |
---|
| 1096 | +enum efi_secureboot_mode efi_get_secureboot(void); |
---|
1586 | 1097 | |
---|
1587 | 1098 | #ifdef CONFIG_RESET_ATTACK_MITIGATION |
---|
1588 | | -void efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg); |
---|
| 1099 | +void efi_enable_reset_attack_mitigation(void); |
---|
1589 | 1100 | #else |
---|
1590 | 1101 | static inline void |
---|
1591 | | -efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { } |
---|
| 1102 | +efi_enable_reset_attack_mitigation(void) { } |
---|
1592 | 1103 | #endif |
---|
1593 | 1104 | |
---|
1594 | | -void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table); |
---|
| 1105 | +#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE |
---|
| 1106 | +void efi_check_for_embedded_firmwares(void); |
---|
| 1107 | +#else |
---|
| 1108 | +static inline void efi_check_for_embedded_firmwares(void) { } |
---|
| 1109 | +#endif |
---|
| 1110 | + |
---|
| 1111 | +void efi_retrieve_tpm2_eventlog(void); |
---|
1595 | 1112 | |
---|
1596 | 1113 | /* |
---|
1597 | 1114 | * Arch code can implement the following three template macros, avoiding |
---|
.. | .. |
---|
1620 | 1137 | \ |
---|
1621 | 1138 | arch_efi_call_virt_setup(); \ |
---|
1622 | 1139 | \ |
---|
1623 | | - local_save_flags(__flags); \ |
---|
| 1140 | + __flags = efi_call_virt_save_flags(); \ |
---|
1624 | 1141 | __s = arch_efi_call_virt(p, f, args); \ |
---|
1625 | 1142 | efi_call_virt_check_flags(__flags, __stringify(f)); \ |
---|
1626 | 1143 | \ |
---|
.. | .. |
---|
1635 | 1152 | \ |
---|
1636 | 1153 | arch_efi_call_virt_setup(); \ |
---|
1637 | 1154 | \ |
---|
1638 | | - local_save_flags(__flags); \ |
---|
| 1155 | + __flags = efi_call_virt_save_flags(); \ |
---|
1639 | 1156 | arch_efi_call_virt(p, f, args); \ |
---|
1640 | 1157 | efi_call_virt_check_flags(__flags, __stringify(f)); \ |
---|
1641 | 1158 | \ |
---|
1642 | 1159 | arch_efi_call_virt_teardown(); \ |
---|
1643 | 1160 | }) |
---|
1644 | 1161 | |
---|
1645 | | -typedef efi_status_t (*efi_exit_boot_map_processing)( |
---|
1646 | | - efi_system_table_t *sys_table_arg, |
---|
1647 | | - struct efi_boot_memmap *map, |
---|
1648 | | - void *priv); |
---|
1649 | | - |
---|
1650 | | -efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table, |
---|
1651 | | - void *handle, |
---|
1652 | | - struct efi_boot_memmap *map, |
---|
1653 | | - void *priv, |
---|
1654 | | - efi_exit_boot_map_processing priv_func); |
---|
1655 | | - |
---|
1656 | | -#define EFI_RANDOM_SEED_SIZE 64U |
---|
| 1162 | +#define EFI_RANDOM_SEED_SIZE 32U // BLAKE2S_HASH_SIZE |
---|
1657 | 1163 | |
---|
1658 | 1164 | struct linux_efi_random_seed { |
---|
1659 | 1165 | u32 size; |
---|
.. | .. |
---|
1662 | 1168 | |
---|
1663 | 1169 | struct linux_efi_tpm_eventlog { |
---|
1664 | 1170 | u32 size; |
---|
| 1171 | + u32 final_events_preboot_size; |
---|
1665 | 1172 | u8 version; |
---|
1666 | 1173 | u8 log[]; |
---|
1667 | 1174 | }; |
---|
1668 | 1175 | |
---|
1669 | 1176 | extern int efi_tpm_eventlog_init(void); |
---|
1670 | 1177 | |
---|
1671 | | -/* efi_runtime_service() function identifiers */ |
---|
| 1178 | +struct efi_tcg2_final_events_table { |
---|
| 1179 | + u64 version; |
---|
| 1180 | + u64 nr_events; |
---|
| 1181 | + u8 events[]; |
---|
| 1182 | +}; |
---|
| 1183 | +extern int efi_tpm_final_log_size; |
---|
| 1184 | + |
---|
| 1185 | +extern unsigned long rci2_table_phys; |
---|
| 1186 | + |
---|
| 1187 | +/* |
---|
| 1188 | + * efi_runtime_service() function identifiers. |
---|
| 1189 | + * "NONE" is used by efi_recover_from_page_fault() to check if the page |
---|
| 1190 | + * fault happened while executing an efi runtime service. |
---|
| 1191 | + */ |
---|
1672 | 1192 | enum efi_rts_ids { |
---|
1673 | | - GET_TIME, |
---|
1674 | | - SET_TIME, |
---|
1675 | | - GET_WAKEUP_TIME, |
---|
1676 | | - SET_WAKEUP_TIME, |
---|
1677 | | - GET_VARIABLE, |
---|
1678 | | - GET_NEXT_VARIABLE, |
---|
1679 | | - SET_VARIABLE, |
---|
1680 | | - QUERY_VARIABLE_INFO, |
---|
1681 | | - GET_NEXT_HIGH_MONO_COUNT, |
---|
1682 | | - UPDATE_CAPSULE, |
---|
1683 | | - QUERY_CAPSULE_CAPS, |
---|
| 1193 | + EFI_NONE, |
---|
| 1194 | + EFI_GET_TIME, |
---|
| 1195 | + EFI_SET_TIME, |
---|
| 1196 | + EFI_GET_WAKEUP_TIME, |
---|
| 1197 | + EFI_SET_WAKEUP_TIME, |
---|
| 1198 | + EFI_GET_VARIABLE, |
---|
| 1199 | + EFI_GET_NEXT_VARIABLE, |
---|
| 1200 | + EFI_SET_VARIABLE, |
---|
| 1201 | + EFI_QUERY_VARIABLE_INFO, |
---|
| 1202 | + EFI_GET_NEXT_HIGH_MONO_COUNT, |
---|
| 1203 | + EFI_RESET_SYSTEM, |
---|
| 1204 | + EFI_UPDATE_CAPSULE, |
---|
| 1205 | + EFI_QUERY_CAPSULE_CAPS, |
---|
1684 | 1206 | }; |
---|
1685 | 1207 | |
---|
1686 | 1208 | /* |
---|
.. | .. |
---|
1707 | 1229 | /* Workqueue to queue EFI Runtime Services */ |
---|
1708 | 1230 | extern struct workqueue_struct *efi_rts_wq; |
---|
1709 | 1231 | |
---|
| 1232 | +struct linux_efi_memreserve { |
---|
| 1233 | + int size; // allocated size of the array |
---|
| 1234 | + atomic_t count; // number of entries used |
---|
| 1235 | + phys_addr_t next; // pa of next struct instance |
---|
| 1236 | + struct { |
---|
| 1237 | + phys_addr_t base; |
---|
| 1238 | + phys_addr_t size; |
---|
| 1239 | + } entry[]; |
---|
| 1240 | +}; |
---|
| 1241 | + |
---|
| 1242 | +#define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \ |
---|
| 1243 | + / sizeof_field(struct linux_efi_memreserve, entry[0])) |
---|
| 1244 | + |
---|
| 1245 | +void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size); |
---|
| 1246 | + |
---|
| 1247 | +char *efi_systab_show_arch(char *str); |
---|
| 1248 | + |
---|
| 1249 | +/* |
---|
| 1250 | + * The LINUX_EFI_MOK_VARIABLE_TABLE_GUID config table can be provided |
---|
| 1251 | + * to the kernel by an EFI boot loader. The table contains a packed |
---|
| 1252 | + * sequence of these entries, one for each named MOK variable. |
---|
| 1253 | + * The sequence is terminated by an entry with a completely NULL |
---|
| 1254 | + * name and 0 data size. |
---|
| 1255 | + */ |
---|
| 1256 | +struct efi_mokvar_table_entry { |
---|
| 1257 | + char name[256]; |
---|
| 1258 | + u64 data_size; |
---|
| 1259 | + u8 data[]; |
---|
| 1260 | +} __attribute((packed)); |
---|
| 1261 | + |
---|
| 1262 | +#ifdef CONFIG_LOAD_UEFI_KEYS |
---|
| 1263 | +extern void __init efi_mokvar_table_init(void); |
---|
| 1264 | +extern struct efi_mokvar_table_entry *efi_mokvar_entry_next( |
---|
| 1265 | + struct efi_mokvar_table_entry **mokvar_entry); |
---|
| 1266 | +extern struct efi_mokvar_table_entry *efi_mokvar_entry_find(const char *name); |
---|
| 1267 | +#else |
---|
| 1268 | +static inline void efi_mokvar_table_init(void) { } |
---|
| 1269 | +static inline struct efi_mokvar_table_entry *efi_mokvar_entry_next( |
---|
| 1270 | + struct efi_mokvar_table_entry **mokvar_entry) |
---|
| 1271 | +{ |
---|
| 1272 | + return NULL; |
---|
| 1273 | +} |
---|
| 1274 | +static inline struct efi_mokvar_table_entry *efi_mokvar_entry_find( |
---|
| 1275 | + const char *name) |
---|
| 1276 | +{ |
---|
| 1277 | + return NULL; |
---|
| 1278 | +} |
---|
| 1279 | +#endif |
---|
| 1280 | + |
---|
1710 | 1281 | #endif /* _LINUX_EFI_H */ |
---|