]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
bd669475 AB |
2 | |
3 | #ifndef _DRIVERS_FIRMWARE_EFI_EFISTUB_H | |
4 | #define _DRIVERS_FIRMWARE_EFI_EFISTUB_H | |
5 | ||
6 | /* error code which can't be mistaken for valid address */ | |
7 | #define EFI_ERROR (~0UL) | |
8 | ||
07e83dbb AB |
9 | /* |
10 | * __init annotations should not be used in the EFI stub, since the code is | |
11 | * either included in the decompressor (x86, ARM) where they have no effect, | |
12 | * or the whole stub is __init annotated at the section level (arm64), by | |
13 | * renaming the sections, in which case the __init annotation will be | |
14 | * redundant, and will result in section names like .init.init.text, and our | |
15 | * linker script does not expect that. | |
16 | */ | |
17 | #undef __init | |
18 | ||
a6a14469 AB |
19 | /* |
20 | * Allow the platform to override the allocation granularity: this allows | |
21 | * systems that have the capability to run with a larger page size to deal | |
22 | * with the allocations for initrd and fdt more efficiently. | |
23 | */ | |
24 | #ifndef EFI_ALLOC_ALIGN | |
25 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE | |
26 | #endif | |
27 | ||
60f38de7 | 28 | extern int __pure nokaslr(void); |
eeff7d63 AB |
29 | extern int __pure is_quiet(void); |
30 | ||
31 | #define pr_efi(sys_table, msg) do { \ | |
32 | if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \ | |
33 | } while (0) | |
34 | ||
35 | #define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg) | |
60f38de7 | 36 | |
bd669475 AB |
37 | void efi_char16_printk(efi_system_table_t *, efi_char16_t *); |
38 | ||
39 | efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg, void *__image, | |
40 | void **__fh); | |
41 | ||
bd669475 AB |
42 | unsigned long get_dram_base(efi_system_table_t *sys_table_arg); |
43 | ||
bd669475 AB |
44 | efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, |
45 | void *handle, | |
46 | unsigned long *new_fdt_addr, | |
47 | unsigned long max_addr, | |
48 | u64 initrd_addr, u64 initrd_size, | |
49 | char *cmdline_ptr, | |
50 | unsigned long fdt_addr, | |
51 | unsigned long fdt_size); | |
52 | ||
a643375f | 53 | void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size); |
bd669475 | 54 | |
f3cdfd23 AB |
55 | void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, |
56 | unsigned long desc_size, efi_memory_desc_t *runtime_map, | |
57 | int *count); | |
58 | ||
e4fbf476 AB |
59 | efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table, |
60 | unsigned long size, u8 *out); | |
61 | ||
2ddbfc81 AB |
62 | efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, |
63 | unsigned long size, unsigned long align, | |
64 | unsigned long *addr, unsigned long random_seed); | |
65 | ||
b9d6769b AB |
66 | efi_status_t check_platform_features(efi_system_table_t *sys_table_arg); |
67 | ||
568bc4e8 AB |
68 | efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg); |
69 | ||
bd669475 | 70 | #endif |