1f4f75ad5SArd Biesheuvel 2f4f75ad5SArd Biesheuvel #ifndef _DRIVERS_FIRMWARE_EFI_EFISTUB_H 3f4f75ad5SArd Biesheuvel #define _DRIVERS_FIRMWARE_EFI_EFISTUB_H 4f4f75ad5SArd Biesheuvel 5f4f75ad5SArd Biesheuvel /* error code which can't be mistaken for valid address */ 6f4f75ad5SArd Biesheuvel #define EFI_ERROR (~0UL) 7f4f75ad5SArd Biesheuvel 807e83dbbSArd Biesheuvel /* 907e83dbbSArd Biesheuvel * __init annotations should not be used in the EFI stub, since the code is 1007e83dbbSArd Biesheuvel * either included in the decompressor (x86, ARM) where they have no effect, 1107e83dbbSArd Biesheuvel * or the whole stub is __init annotated at the section level (arm64), by 1207e83dbbSArd Biesheuvel * renaming the sections, in which case the __init annotation will be 1307e83dbbSArd Biesheuvel * redundant, and will result in section names like .init.init.text, and our 1407e83dbbSArd Biesheuvel * linker script does not expect that. 1507e83dbbSArd Biesheuvel */ 1607e83dbbSArd Biesheuvel #undef __init 1707e83dbbSArd Biesheuvel 18f4f75ad5SArd Biesheuvel void efi_char16_printk(efi_system_table_t *, efi_char16_t *); 19f4f75ad5SArd Biesheuvel 20f4f75ad5SArd Biesheuvel efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg, void *__image, 21f4f75ad5SArd Biesheuvel void **__fh); 22f4f75ad5SArd Biesheuvel 23f4f75ad5SArd Biesheuvel efi_status_t efi_file_size(efi_system_table_t *sys_table_arg, void *__fh, 24f4f75ad5SArd Biesheuvel efi_char16_t *filename_16, void **handle, 25f4f75ad5SArd Biesheuvel u64 *file_sz); 26f4f75ad5SArd Biesheuvel 27f4f75ad5SArd Biesheuvel efi_status_t efi_file_read(void *handle, unsigned long *size, void *addr); 28f4f75ad5SArd Biesheuvel 29f4f75ad5SArd Biesheuvel efi_status_t efi_file_close(void *handle); 30f4f75ad5SArd Biesheuvel 31f4f75ad5SArd Biesheuvel unsigned long get_dram_base(efi_system_table_t *sys_table_arg); 32f4f75ad5SArd Biesheuvel 33f4f75ad5SArd Biesheuvel efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, 34f4f75ad5SArd Biesheuvel unsigned long orig_fdt_size, 35f4f75ad5SArd Biesheuvel void *fdt, int new_fdt_size, char *cmdline_ptr, 36f4f75ad5SArd Biesheuvel u64 initrd_addr, u64 initrd_size, 37f4f75ad5SArd Biesheuvel efi_memory_desc_t *memory_map, 38f4f75ad5SArd Biesheuvel unsigned long map_size, unsigned long desc_size, 39f4f75ad5SArd Biesheuvel u32 desc_ver); 40f4f75ad5SArd Biesheuvel 41f4f75ad5SArd Biesheuvel efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, 42f4f75ad5SArd Biesheuvel void *handle, 43f4f75ad5SArd Biesheuvel unsigned long *new_fdt_addr, 44f4f75ad5SArd Biesheuvel unsigned long max_addr, 45f4f75ad5SArd Biesheuvel u64 initrd_addr, u64 initrd_size, 46f4f75ad5SArd Biesheuvel char *cmdline_ptr, 47f4f75ad5SArd Biesheuvel unsigned long fdt_addr, 48f4f75ad5SArd Biesheuvel unsigned long fdt_size); 49f4f75ad5SArd Biesheuvel 50a643375fSArd Biesheuvel void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size); 51f4f75ad5SArd Biesheuvel 52f3cdfd23SArd Biesheuvel void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, 53f3cdfd23SArd Biesheuvel unsigned long desc_size, efi_memory_desc_t *runtime_map, 54f3cdfd23SArd Biesheuvel int *count); 55f3cdfd23SArd Biesheuvel 56b9d6769bSArd Biesheuvel efi_status_t check_platform_features(efi_system_table_t *sys_table_arg); 57b9d6769bSArd Biesheuvel 58f4f75ad5SArd Biesheuvel #endif 59