xref: /linux/drivers/firmware/efi/libstub/efistub.h (revision 2ddbfc81eac84a299cb4747a8764bc43f23e9008)
1 
2 #ifndef _DRIVERS_FIRMWARE_EFI_EFISTUB_H
3 #define _DRIVERS_FIRMWARE_EFI_EFISTUB_H
4 
5 /* error code which can't be mistaken for valid address */
6 #define EFI_ERROR	(~0UL)
7 
8 void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
9 
10 efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg, void *__image,
11 			     void **__fh);
12 
13 efi_status_t efi_file_size(efi_system_table_t *sys_table_arg, void *__fh,
14 			   efi_char16_t *filename_16, void **handle,
15 			   u64 *file_sz);
16 
17 efi_status_t efi_file_read(void *handle, unsigned long *size, void *addr);
18 
19 efi_status_t efi_file_close(void *handle);
20 
21 unsigned long get_dram_base(efi_system_table_t *sys_table_arg);
22 
23 efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
24 			unsigned long orig_fdt_size,
25 			void *fdt, int new_fdt_size, char *cmdline_ptr,
26 			u64 initrd_addr, u64 initrd_size,
27 			efi_memory_desc_t *memory_map,
28 			unsigned long map_size, unsigned long desc_size,
29 			u32 desc_ver);
30 
31 efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
32 					    void *handle,
33 					    unsigned long *new_fdt_addr,
34 					    unsigned long max_addr,
35 					    u64 initrd_addr, u64 initrd_size,
36 					    char *cmdline_ptr,
37 					    unsigned long fdt_addr,
38 					    unsigned long fdt_size);
39 
40 void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size);
41 
42 void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
43 		     unsigned long desc_size, efi_memory_desc_t *runtime_map,
44 		     int *count);
45 
46 efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table,
47 				  unsigned long size, u8 *out);
48 
49 efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg,
50 			      unsigned long size, unsigned long align,
51 			      unsigned long *addr, unsigned long random_seed);
52 
53 #endif
54