root/drivers/firmware/efi/libstub/efistub.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   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 
   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 
  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 
  28 extern int __pure nokaslr(void);
  29 extern int __pure is_quiet(void);
  30 extern int __pure novamap(void);
  31 
  32 #define pr_efi(sys_table, msg)          do {                            \
  33         if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg);        \
  34 } while (0)
  35 
  36 #define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
  37 
  38 void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
  39 
  40 unsigned long get_dram_base(efi_system_table_t *sys_table_arg);
  41 
  42 efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
  43                                             void *handle,
  44                                             unsigned long *new_fdt_addr,
  45                                             unsigned long max_addr,
  46                                             u64 initrd_addr, u64 initrd_size,
  47                                             char *cmdline_ptr,
  48                                             unsigned long fdt_addr,
  49                                             unsigned long fdt_size);
  50 
  51 void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size);
  52 
  53 void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
  54                      unsigned long desc_size, efi_memory_desc_t *runtime_map,
  55                      int *count);
  56 
  57 efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table,
  58                                   unsigned long size, u8 *out);
  59 
  60 efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg,
  61                               unsigned long size, unsigned long align,
  62                               unsigned long *addr, unsigned long random_seed);
  63 
  64 efi_status_t check_platform_features(efi_system_table_t *sys_table_arg);
  65 
  66 efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg);
  67 
  68 void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid);
  69 
  70 /* Helper macros for the usual case of using simple C variables: */
  71 #ifndef fdt_setprop_inplace_var
  72 #define fdt_setprop_inplace_var(fdt, node_offset, name, var) \
  73         fdt_setprop_inplace((fdt), (node_offset), (name), &(var), sizeof(var))
  74 #endif
  75 
  76 #ifndef fdt_setprop_var
  77 #define fdt_setprop_var(fdt, node_offset, name, var) \
  78         fdt_setprop((fdt), (node_offset), (name), &(var), sizeof(var))
  79 #endif
  80 
  81 #endif

/* [<][>][^][v][top][bottom][index][help] */