]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - GRUB2/MOD_SRC/grub-2.04/include/grub/efi/efi.h
1. Optimization for WIMBOOT mode.
[Ventoy.git] / GRUB2 / MOD_SRC / grub-2.04 / include / grub / efi / efi.h
1 /* efi.h - declare variables and functions for EFI support */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
5 *
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef GRUB_EFI_EFI_HEADER
21 #define GRUB_EFI_EFI_HEADER 1
22
23 #include <grub/types.h>
24 #include <grub/dl.h>
25 #include <grub/efi/api.h>
26
27 /* Functions. */
28 void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
29 void *registration);
30 grub_efi_handle_t *
31 EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type,
32 grub_efi_guid_t *protocol,
33 void *search_key,
34 grub_efi_uintn_t *num_handles);
35 void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle,
36 grub_efi_guid_t *protocol,
37 grub_efi_uint32_t attributes);
38 int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
39 void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
40 void *
41 EXPORT_FUNC(grub_efi_allocate_pages_real) (grub_efi_physical_address_t address,
42 grub_efi_uintn_t pages,
43 grub_efi_allocate_type_t alloctype,
44 grub_efi_memory_type_t memtype);
45 void *
46 EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
47 grub_efi_uintn_t pages);
48 void *
49 EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages);
50 void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
51 grub_efi_uintn_t pages);
52 grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void);
53 int
54 EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
55 grub_efi_memory_descriptor_t *memory_map,
56 grub_efi_uintn_t *map_key,
57 grub_efi_uintn_t *descriptor_size,
58 grub_efi_uint32_t *descriptor_version);
59 void grub_efi_memory_fini (void);
60 grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
61 void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
62 char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
63 grub_efi_device_path_t *
64 EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
65 grub_efi_device_path_t *
66 EXPORT_FUNC(grub_efi_find_last_device_path) (const grub_efi_device_path_t *dp);
67 grub_efi_device_path_t *
68 EXPORT_FUNC(grub_efi_duplicate_device_path) (const grub_efi_device_path_t *dp);
69 grub_err_t EXPORT_FUNC (grub_efi_finish_boot_services) (grub_efi_uintn_t *outbuf_size, void *outbuf,
70 grub_efi_uintn_t *map_key,
71 grub_efi_uintn_t *efi_desc_size,
72 grub_efi_uint32_t *efi_desc_version);
73 grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
74 grub_efi_uintn_t descriptor_size,
75 grub_efi_uint32_t descriptor_version,
76 grub_efi_memory_descriptor_t *virtual_map);
77 void *EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
78 const grub_efi_guid_t *guid,
79 grub_size_t *datasize_out);
80 grub_err_t
81 EXPORT_FUNC (grub_efi_set_variable) (const char *var,
82 const grub_efi_guid_t *guid,
83 void *data,
84 grub_size_t datasize);
85 int
86 EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
87 const grub_efi_device_path_t *dp2);
88
89 void * EXPORT_FUNC (grub_efi_allocate_iso_buf) (grub_uint64_t size);
90 void * EXPORT_FUNC (grub_efi_allocate_chain_buf) (grub_uint64_t size);
91
92
93 extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
94 char **device,
95 char **path);
96
97 #if defined(__arm__) || defined(__aarch64__) || defined(__riscv)
98 void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
99 grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
100 #include <grub/cpu/linux.h>
101 grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
102 grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
103 char *args);
104 #endif
105
106 grub_addr_t grub_efi_modules_addr (void);
107
108 void grub_efi_mm_init (void);
109 void grub_efi_mm_fini (void);
110 void grub_efi_init (void);
111 void grub_efi_fini (void);
112 void grub_efi_set_prefix (void);
113
114 /* Variables. */
115 extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
116 extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
117
118 extern int EXPORT_VAR(grub_efi_is_finished);
119
120 struct grub_net_card;
121
122 grub_efi_handle_t
123 grub_efinet_get_device_handle (struct grub_net_card *card);
124
125 #endif /* ! GRUB_EFI_EFI_HEADER */