]>
Commit | Line | Data |
---|---|---|
83709125 | 1 | /* efi.h - declare EFI types and functions */ |
2 | /* | |
3 | * GRUB -- GRand Unified Bootloader | |
58bc8bd5 | 4 | * Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc. |
83709125 | 5 | * |
5a79f472 | 6 | * GRUB is free software: you can redistribute it and/or modify |
83709125 | 7 | * it under the terms of the GNU General Public License as published by |
5a79f472 | 8 | * the Free Software Foundation, either version 3 of the License, or |
83709125 | 9 | * (at your option) any later version. |
10 | * | |
5a79f472 | 11 | * GRUB is distributed in the hope that it will be useful, |
83709125 | 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 | |
5a79f472 | 17 | * along with GRUB. If not, see <http://www.gnu.org/licenses/>. |
83709125 | 18 | */ |
19 | ||
20 | #ifndef GRUB_EFI_API_HEADER | |
21 | #define GRUB_EFI_API_HEADER 1 | |
22 | ||
23 | #include <grub/types.h> | |
12d6fc84 | 24 | #include <grub/symbol.h> |
83709125 | 25 | |
26 | /* For consistency and safety, we name the EFI-defined types differently. | |
27 | All names are transformed into lower case, _t appended, and | |
28 | grub_efi_ prepended. */ | |
29 | ||
30 | /* Constants. */ | |
31 | #define GRUB_EFI_EVT_TIMER 0x80000000 | |
32 | #define GRUB_EFI_EVT_RUNTIME 0x40000000 | |
33 | #define GRUB_EFI_EVT_RUNTIME_CONTEXT 0x20000000 | |
34 | #define GRUB_EFI_EVT_NOTIFY_WAIT 0x00000100 | |
35 | #define GRUB_EFI_EVT_NOTIFY_SIGNAL 0x00000200 | |
36 | #define GRUB_EFI_EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 | |
37 | #define GRUB_EFI_EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 | |
38 | ||
39 | #define GRUB_EFI_TPL_APPLICATION 4 | |
40 | #define GRUB_EFI_TPL_CALLBACK 8 | |
41 | #define GRUB_EFI_TPL_NOTIFY 16 | |
42 | #define GRUB_EFI_TPL_HIGH_LEVEL 31 | |
43 | ||
5caf964d | 44 | #define GRUB_EFI_MEMORY_UC 0x0000000000000001LL |
45 | #define GRUB_EFI_MEMORY_WC 0x0000000000000002LL | |
46 | #define GRUB_EFI_MEMORY_WT 0x0000000000000004LL | |
47 | #define GRUB_EFI_MEMORY_WB 0x0000000000000008LL | |
48 | #define GRUB_EFI_MEMORY_UCE 0x0000000000000010LL | |
49 | #define GRUB_EFI_MEMORY_WP 0x0000000000001000LL | |
50 | #define GRUB_EFI_MEMORY_RP 0x0000000000002000LL | |
51 | #define GRUB_EFI_MEMORY_XP 0x0000000000004000LL | |
52 | #define GRUB_EFI_MEMORY_RUNTIME 0x8000000000000000LL | |
83709125 | 53 | |
54 | #define GRUB_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 | |
55 | #define GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 | |
56 | #define GRUB_EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 | |
57 | #define GRUB_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 | |
58 | #define GRUB_EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 | |
59 | #define GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE 0x00000020 | |
60 | ||
c5052c81 PJ |
61 | #define GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001ULL |
62 | ||
83709125 | 63 | #define GRUB_EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 |
64 | #define GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 | |
65 | #define GRUB_EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 | |
66 | ||
67 | #define GRUB_EFI_TIME_ADJUST_DAYLIGHT 0x01 | |
68 | #define GRUB_EFI_TIME_IN_DAYLIGHT 0x02 | |
69 | ||
70 | #define GRUB_EFI_UNSPECIFIED_TIMEZONE 0x07FF | |
71 | ||
72 | #define GRUB_EFI_OPTIONAL_PTR 0x00000001 | |
73 | ||
2eab1c0d | 74 | #define GRUB_EFI_LOADED_IMAGE_GUID \ |
9cacaa17 | 75 | { 0x5b1b31a1, 0x9562, 0x11d2, \ |
76 | { 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
77 | } | |
78 | ||
79 | #define GRUB_EFI_DISK_IO_GUID \ | |
80 | { 0xce345171, 0xba0b, 0x11d2, \ | |
81 | { 0x8e, 0x4f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
82 | } | |
83 | ||
84 | #define GRUB_EFI_BLOCK_IO_GUID \ | |
85 | { 0x964e5b21, 0x6459, 0x11d2, \ | |
86 | { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
87 | } | |
88 | ||
a9c7fd1c VS |
89 | #define GRUB_EFI_SERIAL_IO_GUID \ |
90 | { 0xbb25cf6f, 0xf1d4, 0x11d2, \ | |
91 | { 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0xfd } \ | |
92 | } | |
93 | ||
9d22909b VS |
94 | #define GRUB_EFI_SIMPLE_NETWORK_GUID \ |
95 | { 0xa19832b9, 0xac25, 0x11d3, \ | |
96 | { 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
97 | } | |
98 | ||
cae730b4 VS |
99 | #define GRUB_EFI_PXE_GUID \ |
100 | { 0x03c4e603, 0xac28, 0x11d3, \ | |
101 | { 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
102 | } | |
103 | ||
9cacaa17 | 104 | #define GRUB_EFI_DEVICE_PATH_GUID \ |
105 | { 0x09576e91, 0x6d3f, 0x11d2, \ | |
106 | { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
107 | } | |
2eab1c0d | 108 | |
7bd29c01 VS |
109 | #define GRUB_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \ |
110 | { 0x387477c1, 0x69c7, 0x11d2, \ | |
111 | { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
112 | } | |
113 | ||
114 | #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \ | |
115 | { 0xdd9e7534, 0x7762, 0x4698, \ | |
116 | { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } \ | |
117 | } | |
118 | ||
119 | #define GRUB_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \ | |
120 | { 0x387477c2, 0x69c7, 0x11d2, \ | |
121 | { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
122 | } | |
123 | ||
124 | #define GRUB_EFI_SIMPLE_POINTER_PROTOCOL_GUID \ | |
125 | { 0x31878c87, 0xb75, 0x11d5, \ | |
126 | { 0x9a, 0x4f, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
127 | } | |
128 | ||
129 | #define GRUB_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \ | |
130 | { 0x8D59D32B, 0xC655, 0x4AE9, \ | |
131 | { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } \ | |
132 | } | |
133 | ||
134 | #define GRUB_EFI_DRIVER_BINDING_PROTOCOL_GUID \ | |
135 | { 0x18A031AB, 0xB443, 0x4D1A, \ | |
136 | { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } \ | |
137 | } | |
138 | ||
139 | #define GRUB_EFI_LOADED_IMAGE_PROTOCOL_GUID \ | |
140 | { 0x5B1B31A1, 0x9562, 0x11d2, \ | |
141 | { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \ | |
142 | } | |
143 | ||
144 | #define GRUB_EFI_LOAD_FILE_PROTOCOL_GUID \ | |
145 | { 0x56EC3091, 0x954C, 0x11d2, \ | |
146 | { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \ | |
147 | } | |
148 | ||
149 | #define GRUB_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ | |
150 | { 0x0964e5b22, 0x6459, 0x11d2, \ | |
151 | { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ | |
152 | } | |
153 | ||
154 | #define GRUB_EFI_TAPE_IO_PROTOCOL_GUID \ | |
155 | { 0x1e93e633, 0xd65a, 0x459e, \ | |
156 | { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \ | |
157 | } | |
158 | ||
159 | #define GRUB_EFI_UNICODE_COLLATION_PROTOCOL_GUID \ | |
160 | { 0x1d85cd7f, 0xf43d, 0x11d2, \ | |
161 | { 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
162 | } | |
163 | ||
164 | #define GRUB_EFI_SCSI_IO_PROTOCOL_GUID \ | |
165 | { 0x932f47e6, 0x2362, 0x4002, \ | |
166 | { 0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \ | |
167 | } | |
168 | ||
169 | #define GRUB_EFI_USB2_HC_PROTOCOL_GUID \ | |
170 | { 0x3e745226, 0x9818, 0x45b6, \ | |
171 | { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } \ | |
172 | } | |
173 | ||
174 | #define GRUB_EFI_DEBUG_SUPPORT_PROTOCOL_GUID \ | |
175 | { 0x2755590C, 0x6F3C, 0x42FA, \ | |
176 | { 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \ | |
177 | } | |
178 | ||
179 | #define GRUB_EFI_DEBUGPORT_PROTOCOL_GUID \ | |
180 | { 0xEBA4E8D2, 0x3858, 0x41EC, \ | |
181 | { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \ | |
182 | } | |
183 | ||
184 | #define GRUB_EFI_DECOMPRESS_PROTOCOL_GUID \ | |
185 | { 0xd8117cfe, 0x94a6, 0x11d4, \ | |
186 | { 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
187 | } | |
188 | ||
189 | #define GRUB_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \ | |
190 | { 0x8b843e20, 0x8132, 0x4852, \ | |
191 | { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } \ | |
192 | } | |
193 | ||
194 | #define GRUB_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \ | |
195 | { 0x379be4e, 0xd706, 0x437d, \ | |
196 | { 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \ | |
197 | } | |
198 | ||
199 | #define GRUB_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \ | |
200 | { 0x5c99a21, 0xc70f, 0x4ad2, \ | |
201 | { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } \ | |
202 | } | |
203 | ||
204 | #define GRUB_EFI_ACPI_TABLE_PROTOCOL_GUID \ | |
205 | { 0xffe06bdd, 0x6107, 0x46a6, \ | |
206 | { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c} \ | |
207 | } | |
208 | ||
209 | #define GRUB_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \ | |
210 | { 0x587e72d7, 0xcc50, 0x4f79, \ | |
211 | { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } \ | |
212 | } | |
213 | ||
214 | #define GRUB_EFI_HII_DATABASE_PROTOCOL_GUID \ | |
215 | { 0xef9fc172, 0xa1b2, 0x4693, \ | |
216 | { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } \ | |
217 | } | |
218 | ||
219 | #define GRUB_EFI_HII_STRING_PROTOCOL_GUID \ | |
220 | { 0xfd96974, 0x23aa, 0x4cdc, \ | |
221 | { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } \ | |
222 | } | |
223 | ||
224 | #define GRUB_EFI_HII_IMAGE_PROTOCOL_GUID \ | |
225 | { 0x31a6406a, 0x6bdf, 0x4e46, \ | |
226 | { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } \ | |
227 | } | |
228 | ||
229 | #define GRUB_EFI_HII_FONT_PROTOCOL_GUID \ | |
230 | { 0xe9ca4775, 0x8657, 0x47fc, \ | |
231 | { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } \ | |
232 | } | |
233 | ||
234 | #define GRUB_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \ | |
235 | { 0x330d4706, 0xf2a0, 0x4e4f, \ | |
236 | { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } \ | |
237 | } | |
238 | ||
239 | #define GRUB_EFI_COMPONENT_NAME2_PROTOCOL_GUID \ | |
240 | { 0x6a7a5cff, 0xe8d9, 0x4f70, \ | |
241 | { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14} \ | |
242 | } | |
243 | ||
244 | #define GRUB_EFI_USB_IO_PROTOCOL_GUID \ | |
245 | { 0x2B2F68D6, 0x0CD2, 0x44cf, \ | |
246 | { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \ | |
247 | } | |
248 | ||
9902d047 | 249 | #define GRUB_EFI_MPS_TABLE_GUID \ |
250 | { 0xeb9d2d2f, 0x2d88, 0x11d3, \ | |
7bd29c01 | 251 | { 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ |
9902d047 | 252 | } |
253 | ||
254 | #define GRUB_EFI_ACPI_TABLE_GUID \ | |
255 | { 0xeb9d2d30, 0x2d88, 0x11d3, \ | |
256 | { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
257 | } | |
258 | ||
259 | #define GRUB_EFI_ACPI_20_TABLE_GUID \ | |
260 | { 0x8868e871, 0xe4f1, 0x11d3, \ | |
261 | { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ | |
262 | } | |
263 | ||
264 | #define GRUB_EFI_SMBIOS_TABLE_GUID \ | |
265 | { 0xeb9d2d31, 0x2d88, 0x11d3, \ | |
266 | { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
267 | } | |
268 | ||
105de6a7 TG |
269 | #define GRUB_EFI_SAL_TABLE_GUID \ |
270 | { 0xeb9d2d32, 0x2d88, 0x11d3, \ | |
271 | { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ | |
272 | } | |
273 | ||
274 | #define GRUB_EFI_HCDP_TABLE_GUID \ | |
275 | { 0xf951938d, 0x620b, 0x42ef, \ | |
276 | { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \ | |
277 | } | |
278 | ||
30a9ab95 LL |
279 | #define GRUB_EFI_DEVICE_TREE_GUID \ |
280 | { 0xb1b621d5, 0xf19c, 0x41a5, \ | |
281 | { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \ | |
282 | } | |
105de6a7 TG |
283 | struct grub_efi_sal_system_table |
284 | { | |
285 | grub_uint32_t signature; | |
286 | grub_uint32_t total_table_len; | |
287 | grub_uint16_t sal_rev; | |
288 | grub_uint16_t entry_count; | |
289 | grub_uint8_t checksum; | |
290 | grub_uint8_t reserved1[7]; | |
291 | grub_uint16_t sal_a_version; | |
292 | grub_uint16_t sal_b_version; | |
293 | grub_uint8_t oem_id[32]; | |
294 | grub_uint8_t product_id[32]; | |
295 | grub_uint8_t reserved2[8]; | |
296 | grub_uint8_t entries[0]; | |
297 | }; | |
298 | ||
299 | enum | |
300 | { | |
301 | GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_ENTRYPOINT_DESCRIPTOR = 0, | |
302 | GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_MEMORY_DESCRIPTOR = 1, | |
303 | GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_PLATFORM_FEATURES = 2, | |
304 | GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_TRANSLATION_REGISTER_DESCRIPTOR = 3, | |
305 | GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_PURGE_TRANSLATION_COHERENCE = 4, | |
306 | GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_AP_WAKEUP = 5 | |
307 | }; | |
308 | ||
309 | struct grub_efi_sal_system_table_entrypoint_descriptor | |
310 | { | |
311 | grub_uint8_t type; | |
312 | grub_uint8_t pad[7]; | |
313 | grub_uint64_t pal_proc_addr; | |
314 | grub_uint64_t sal_proc_addr; | |
315 | grub_uint64_t global_data_ptr; | |
316 | grub_uint64_t reserved[2]; | |
317 | }; | |
318 | ||
319 | struct grub_efi_sal_system_table_memory_descriptor | |
320 | { | |
321 | grub_uint8_t type; | |
322 | grub_uint8_t sal_used; | |
323 | grub_uint8_t attr; | |
324 | grub_uint8_t ar; | |
325 | grub_uint8_t attr_mask; | |
326 | grub_uint8_t mem_type; | |
327 | grub_uint8_t usage; | |
328 | grub_uint8_t unknown; | |
329 | grub_uint64_t addr; | |
330 | grub_uint64_t len; | |
331 | grub_uint64_t unknown2; | |
332 | }; | |
333 | ||
334 | struct grub_efi_sal_system_table_platform_features | |
335 | { | |
336 | grub_uint8_t type; | |
337 | grub_uint8_t flags; | |
338 | grub_uint8_t reserved[14]; | |
339 | }; | |
340 | ||
341 | struct grub_efi_sal_system_table_translation_register_descriptor | |
342 | { | |
343 | grub_uint8_t type; | |
344 | grub_uint8_t register_type; | |
345 | grub_uint8_t register_number; | |
346 | grub_uint8_t reserved[5]; | |
347 | grub_uint64_t addr; | |
348 | grub_uint64_t page_size; | |
349 | grub_uint64_t reserver; | |
350 | }; | |
351 | ||
352 | struct grub_efi_sal_system_table_purge_translation_coherence | |
353 | { | |
354 | grub_uint8_t type; | |
355 | grub_uint8_t reserved[3]; | |
356 | grub_uint32_t ndomains; | |
357 | grub_uint64_t coherence; | |
358 | }; | |
359 | ||
360 | struct grub_efi_sal_system_table_ap_wakeup | |
361 | { | |
362 | grub_uint8_t type; | |
363 | grub_uint8_t mechanism; | |
364 | grub_uint8_t reserved[6]; | |
365 | grub_uint64_t vector; | |
366 | }; | |
367 | ||
368 | enum | |
369 | { | |
370 | GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_BUSLOCK = 1, | |
371 | GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IRQREDIRECT = 2, | |
372 | GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IPIREDIRECT = 4, | |
373 | GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_ITCDRIFT = 8, | |
374 | }; | |
375 | ||
a9c7fd1c VS |
376 | typedef enum grub_efi_parity_type |
377 | { | |
378 | GRUB_EFI_SERIAL_DEFAULT_PARITY, | |
379 | GRUB_EFI_SERIAL_NO_PARITY, | |
380 | GRUB_EFI_SERIAL_EVEN_PARITY, | |
381 | GRUB_EFI_SERIAL_ODD_PARITY | |
382 | } | |
383 | grub_efi_parity_type_t; | |
384 | ||
385 | typedef enum grub_efi_stop_bits | |
386 | { | |
387 | GRUB_EFI_SERIAL_DEFAULT_STOP_BITS, | |
388 | GRUB_EFI_SERIAL_1_STOP_BIT, | |
389 | GRUB_EFI_SERIAL_1_5_STOP_BITS, | |
390 | GRUB_EFI_SERIAL_2_STOP_BITS | |
391 | } | |
392 | grub_efi_stop_bits_t; | |
393 | ||
83709125 | 394 | /* Enumerations. */ |
395 | enum grub_efi_timer_delay | |
396 | { | |
397 | GRUB_EFI_TIMER_CANCEL, | |
398 | GRUB_EFI_TIMER_PERIODIC, | |
399 | GRUB_EFI_TIMER_RELATIVE | |
400 | }; | |
401 | typedef enum grub_efi_timer_delay grub_efi_timer_delay_t; | |
402 | ||
403 | enum grub_efi_allocate_type | |
404 | { | |
405 | GRUB_EFI_ALLOCATE_ANY_PAGES, | |
406 | GRUB_EFI_ALLOCATE_MAX_ADDRESS, | |
407 | GRUB_EFI_ALLOCATE_ADDRESS, | |
408 | GRUB_EFI_MAX_ALLOCATION_TYPE | |
409 | }; | |
410 | typedef enum grub_efi_allocate_type grub_efi_allocate_type_t; | |
411 | ||
412 | enum grub_efi_memory_type | |
413 | { | |
414 | GRUB_EFI_RESERVED_MEMORY_TYPE, | |
415 | GRUB_EFI_LOADER_CODE, | |
416 | GRUB_EFI_LOADER_DATA, | |
417 | GRUB_EFI_BOOT_SERVICES_CODE, | |
418 | GRUB_EFI_BOOT_SERVICES_DATA, | |
419 | GRUB_EFI_RUNTIME_SERVICES_CODE, | |
420 | GRUB_EFI_RUNTIME_SERVICES_DATA, | |
421 | GRUB_EFI_CONVENTIONAL_MEMORY, | |
422 | GRUB_EFI_UNUSABLE_MEMORY, | |
423 | GRUB_EFI_ACPI_RECLAIM_MEMORY, | |
424 | GRUB_EFI_ACPI_MEMORY_NVS, | |
425 | GRUB_EFI_MEMORY_MAPPED_IO, | |
426 | GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE, | |
427 | GRUB_EFI_PAL_CODE, | |
428 | GRUB_EFI_MAX_MEMORY_TYPE | |
429 | }; | |
430 | typedef enum grub_efi_memory_type grub_efi_memory_type_t; | |
431 | ||
432 | enum grub_efi_interface_type | |
433 | { | |
434 | GRUB_EFI_NATIVE_INTERFACE | |
435 | }; | |
436 | typedef enum grub_efi_interface_type grub_efi_interface_type_t; | |
437 | ||
438 | enum grub_efi_locate_search_type | |
439 | { | |
440 | GRUB_EFI_ALL_HANDLES, | |
441 | GRUB_EFI_BY_REGISTER_NOTIFY, | |
442 | GRUB_EFI_BY_PROTOCOL | |
443 | }; | |
444 | typedef enum grub_efi_locate_search_type grub_efi_locate_search_type_t; | |
445 | ||
446 | enum grub_efi_reset_type | |
447 | { | |
448 | GRUB_EFI_RESET_COLD, | |
449 | GRUB_EFI_RESET_WARM, | |
450 | GRUB_EFI_RESET_SHUTDOWN | |
451 | }; | |
452 | typedef enum grub_efi_reset_type grub_efi_reset_type_t; | |
453 | ||
454 | /* Types. */ | |
455 | typedef char grub_efi_boolean_t; | |
3e38c31a VS |
456 | #if GRUB_CPU_SIZEOF_VOID_P == 8 |
457 | typedef grub_int64_t grub_efi_intn_t; | |
458 | typedef grub_uint64_t grub_efi_uintn_t; | |
459 | #else | |
460 | typedef grub_int32_t grub_efi_intn_t; | |
461 | typedef grub_uint32_t grub_efi_uintn_t; | |
462 | #endif | |
83709125 | 463 | typedef grub_int8_t grub_efi_int8_t; |
464 | typedef grub_uint8_t grub_efi_uint8_t; | |
465 | typedef grub_int16_t grub_efi_int16_t; | |
466 | typedef grub_uint16_t grub_efi_uint16_t; | |
467 | typedef grub_int32_t grub_efi_int32_t; | |
468 | typedef grub_uint32_t grub_efi_uint32_t; | |
469 | typedef grub_int64_t grub_efi_int64_t; | |
470 | typedef grub_uint64_t grub_efi_uint64_t; | |
471 | typedef grub_uint8_t grub_efi_char8_t; | |
472 | typedef grub_uint16_t grub_efi_char16_t; | |
473 | ||
474 | typedef grub_efi_intn_t grub_efi_status_t; | |
475 | ||
476 | #define GRUB_EFI_ERROR_CODE(value) \ | |
b3aea1bc | 477 | ((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) |
83709125 | 478 | |
479 | #define GRUB_EFI_WARNING_CODE(value) (value) | |
480 | ||
481 | #define GRUB_EFI_SUCCESS 0 | |
482 | ||
483 | #define GRUB_EFI_LOAD_ERROR GRUB_EFI_ERROR_CODE (1) | |
484 | #define GRUB_EFI_INVALID_PARAMETER GRUB_EFI_ERROR_CODE (2) | |
485 | #define GRUB_EFI_UNSUPPORTED GRUB_EFI_ERROR_CODE (3) | |
486 | #define GRUB_EFI_BAD_BUFFER_SIZE GRUB_EFI_ERROR_CODE (4) | |
487 | #define GRUB_EFI_BUFFER_TOO_SMALL GRUB_EFI_ERROR_CODE (5) | |
488 | #define GRUB_EFI_NOT_READY GRUB_EFI_ERROR_CODE (6) | |
489 | #define GRUB_EFI_DEVICE_ERROR GRUB_EFI_ERROR_CODE (7) | |
490 | #define GRUB_EFI_WRITE_PROTECTED GRUB_EFI_ERROR_CODE (8) | |
491 | #define GRUB_EFI_OUT_OF_RESOURCES GRUB_EFI_ERROR_CODE (9) | |
492 | #define GRUB_EFI_VOLUME_CORRUPTED GRUB_EFI_ERROR_CODE (10) | |
493 | #define GRUB_EFI_VOLUME_FULL GRUB_EFI_ERROR_CODE (11) | |
494 | #define GRUB_EFI_NO_MEDIA GRUB_EFI_ERROR_CODE (12) | |
495 | #define GRUB_EFI_MEDIA_CHANGED GRUB_EFI_ERROR_CODE (13) | |
496 | #define GRUB_EFI_NOT_FOUND GRUB_EFI_ERROR_CODE (14) | |
497 | #define GRUB_EFI_ACCESS_DENIED GRUB_EFI_ERROR_CODE (15) | |
498 | #define GRUB_EFI_NO_RESPONSE GRUB_EFI_ERROR_CODE (16) | |
499 | #define GRUB_EFI_NO_MAPPING GRUB_EFI_ERROR_CODE (17) | |
500 | #define GRUB_EFI_TIMEOUT GRUB_EFI_ERROR_CODE (18) | |
501 | #define GRUB_EFI_NOT_STARTED GRUB_EFI_ERROR_CODE (19) | |
502 | #define GRUB_EFI_ALREADY_STARTED GRUB_EFI_ERROR_CODE (20) | |
503 | #define GRUB_EFI_ABORTED GRUB_EFI_ERROR_CODE (21) | |
504 | #define GRUB_EFI_ICMP_ERROR GRUB_EFI_ERROR_CODE (22) | |
505 | #define GRUB_EFI_TFTP_ERROR GRUB_EFI_ERROR_CODE (23) | |
506 | #define GRUB_EFI_PROTOCOL_ERROR GRUB_EFI_ERROR_CODE (24) | |
507 | #define GRUB_EFI_INCOMPATIBLE_VERSION GRUB_EFI_ERROR_CODE (25) | |
508 | #define GRUB_EFI_SECURITY_VIOLATION GRUB_EFI_ERROR_CODE (26) | |
509 | #define GRUB_EFI_CRC_ERROR GRUB_EFI_ERROR_CODE (27) | |
510 | ||
511 | #define GRUB_EFI_WARN_UNKNOWN_GLYPH GRUB_EFI_WARNING_CODE (1) | |
512 | #define GRUB_EFI_WARN_DELETE_FAILURE GRUB_EFI_WARNING_CODE (2) | |
513 | #define GRUB_EFI_WARN_WRITE_FAILURE GRUB_EFI_WARNING_CODE (3) | |
514 | #define GRUB_EFI_WARN_BUFFER_TOO_SMALL GRUB_EFI_WARNING_CODE (4) | |
515 | ||
516 | typedef void *grub_efi_handle_t; | |
517 | typedef void *grub_efi_event_t; | |
518 | typedef grub_efi_uint64_t grub_efi_lba_t; | |
519 | typedef grub_efi_uintn_t grub_efi_tpl_t; | |
520 | typedef grub_uint8_t grub_efi_mac_address_t[32]; | |
521 | typedef grub_uint8_t grub_efi_ipv4_address_t[4]; | |
9cacaa17 | 522 | typedef grub_uint16_t grub_efi_ipv6_address_t[8]; |
83709125 | 523 | typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4))); |
524 | typedef grub_efi_uint64_t grub_efi_physical_address_t; | |
525 | typedef grub_efi_uint64_t grub_efi_virtual_address_t; | |
526 | ||
527 | struct grub_efi_guid | |
528 | { | |
529 | grub_uint32_t data1; | |
530 | grub_uint16_t data2; | |
531 | grub_uint16_t data3; | |
9cacaa17 | 532 | grub_uint8_t data4[8]; |
83709125 | 533 | } __attribute__ ((aligned(8))); |
534 | typedef struct grub_efi_guid grub_efi_guid_t; | |
535 | ||
316dda71 VS |
536 | struct grub_efi_packed_guid |
537 | { | |
538 | grub_uint32_t data1; | |
539 | grub_uint16_t data2; | |
540 | grub_uint16_t data3; | |
541 | grub_uint8_t data4[8]; | |
7e47e27b | 542 | } GRUB_PACKED; |
316dda71 VS |
543 | typedef struct grub_efi_packed_guid grub_efi_packed_guid_t; |
544 | ||
976a4ea0 | 545 | /* XXX although the spec does not specify the padding, this actually |
546 | must have the padding! */ | |
83709125 | 547 | struct grub_efi_memory_descriptor |
548 | { | |
549 | grub_efi_uint32_t type; | |
976a4ea0 | 550 | grub_efi_uint32_t padding; |
83709125 | 551 | grub_efi_physical_address_t physical_start; |
552 | grub_efi_virtual_address_t virtual_start; | |
553 | grub_efi_uint64_t num_pages; | |
554 | grub_efi_uint64_t attribute; | |
7e47e27b | 555 | } GRUB_PACKED; |
83709125 | 556 | typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t; |
557 | ||
9cacaa17 | 558 | /* Device Path definitions. */ |
83709125 | 559 | struct grub_efi_device_path |
560 | { | |
561 | grub_efi_uint8_t type; | |
9cacaa17 | 562 | grub_efi_uint8_t subtype; |
219401b8 | 563 | grub_efi_uint16_t length; |
7e47e27b | 564 | } GRUB_PACKED; |
83709125 | 565 | typedef struct grub_efi_device_path grub_efi_device_path_t; |
566 | /* XXX EFI does not define EFI_DEVICE_PATH_PROTOCOL but uses it. | |
567 | It seems to be identical to EFI_DEVICE_PATH. */ | |
568 | typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; | |
569 | ||
9cacaa17 | 570 | #define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f) |
571 | #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype) | |
219401b8 | 572 | #define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length) |
9cacaa17 | 573 | |
574 | /* The End of Device Path nodes. */ | |
575 | #define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f) | |
576 | ||
577 | #define GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff | |
578 | #define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01 | |
579 | ||
580 | #define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \ | |
581 | (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \ | |
582 | && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \ | |
583 | == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)) | |
584 | ||
585 | #define GRUB_EFI_NEXT_DEVICE_PATH(dp) \ | |
586 | ((grub_efi_device_path_t *) ((char *) (dp) \ | |
587 | + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) | |
588 | ||
589 | /* Hardware Device Path. */ | |
590 | #define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1 | |
591 | ||
592 | #define GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE 1 | |
593 | ||
594 | struct grub_efi_pci_device_path | |
595 | { | |
596 | grub_efi_device_path_t header; | |
597 | grub_efi_uint8_t function; | |
598 | grub_efi_uint8_t device; | |
7e47e27b | 599 | } GRUB_PACKED; |
9cacaa17 | 600 | typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t; |
601 | ||
602 | #define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2 | |
603 | ||
604 | struct grub_efi_pccard_device_path | |
605 | { | |
606 | grub_efi_device_path_t header; | |
607 | grub_efi_uint8_t function; | |
7e47e27b | 608 | } GRUB_PACKED; |
9cacaa17 | 609 | typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t; |
610 | ||
611 | #define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3 | |
612 | ||
613 | struct grub_efi_memory_mapped_device_path | |
614 | { | |
615 | grub_efi_device_path_t header; | |
e739d698 | 616 | grub_efi_uint32_t memory_type; |
9cacaa17 | 617 | grub_efi_physical_address_t start_address; |
618 | grub_efi_physical_address_t end_address; | |
7e47e27b | 619 | } GRUB_PACKED; |
9cacaa17 | 620 | typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t; |
621 | ||
622 | #define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4 | |
623 | ||
624 | struct grub_efi_vendor_device_path | |
625 | { | |
626 | grub_efi_device_path_t header; | |
316dda71 | 627 | grub_efi_packed_guid_t vendor_guid; |
9cacaa17 | 628 | grub_efi_uint8_t vendor_defined_data[0]; |
7e47e27b | 629 | } GRUB_PACKED; |
9cacaa17 | 630 | typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t; |
631 | ||
632 | #define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5 | |
633 | ||
634 | struct grub_efi_controller_device_path | |
635 | { | |
636 | grub_efi_device_path_t header; | |
637 | grub_efi_uint32_t controller_number; | |
7e47e27b | 638 | } GRUB_PACKED; |
9cacaa17 | 639 | typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t; |
640 | ||
641 | /* ACPI Device Path. */ | |
642 | #define GRUB_EFI_ACPI_DEVICE_PATH_TYPE 2 | |
643 | ||
644 | #define GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE 1 | |
645 | ||
646 | struct grub_efi_acpi_device_path | |
647 | { | |
648 | grub_efi_device_path_t header; | |
649 | grub_efi_uint32_t hid; | |
650 | grub_efi_uint32_t uid; | |
7e47e27b | 651 | } GRUB_PACKED; |
9cacaa17 | 652 | typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t; |
653 | ||
654 | #define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2 | |
655 | ||
656 | struct grub_efi_expanded_acpi_device_path | |
657 | { | |
658 | grub_efi_device_path_t header; | |
659 | grub_efi_uint32_t hid; | |
660 | grub_efi_uint32_t uid; | |
661 | grub_efi_uint32_t cid; | |
e739d698 | 662 | char hidstr[0]; |
7e47e27b | 663 | } GRUB_PACKED; |
9cacaa17 | 664 | typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t; |
665 | ||
666 | #define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \ | |
667 | (((grub_efi_expanded_acpi_device_path_t *) dp)->hidstr) | |
668 | #define GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp) \ | |
669 | (GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \ | |
670 | + grub_strlen (GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp)) + 1) | |
671 | #define GRUB_EFI_EXPANDED_ACPI_CIDSTR(dp) \ | |
672 | (GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp) \ | |
673 | + grub_strlen (GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp)) + 1) | |
674 | ||
675 | /* Messaging Device Path. */ | |
676 | #define GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE 3 | |
677 | ||
678 | #define GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE 1 | |
679 | ||
680 | struct grub_efi_atapi_device_path | |
681 | { | |
682 | grub_efi_device_path_t header; | |
683 | grub_efi_uint8_t primary_secondary; | |
684 | grub_efi_uint8_t slave_master; | |
685 | grub_efi_uint16_t lun; | |
7e47e27b | 686 | } GRUB_PACKED; |
9cacaa17 | 687 | typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t; |
688 | ||
689 | #define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2 | |
690 | ||
691 | struct grub_efi_scsi_device_path | |
692 | { | |
693 | grub_efi_device_path_t header; | |
694 | grub_efi_uint16_t pun; | |
695 | grub_efi_uint16_t lun; | |
7e47e27b | 696 | } GRUB_PACKED; |
9cacaa17 | 697 | typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t; |
698 | ||
699 | #define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3 | |
700 | ||
701 | struct grub_efi_fibre_channel_device_path | |
702 | { | |
703 | grub_efi_device_path_t header; | |
704 | grub_efi_uint32_t reserved; | |
705 | grub_efi_uint64_t wwn; | |
706 | grub_efi_uint64_t lun; | |
7e47e27b | 707 | } GRUB_PACKED; |
9cacaa17 | 708 | typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t; |
709 | ||
710 | #define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4 | |
711 | ||
712 | struct grub_efi_1394_device_path | |
713 | { | |
714 | grub_efi_device_path_t header; | |
715 | grub_efi_uint32_t reserved; | |
716 | grub_efi_uint64_t guid; | |
7e47e27b | 717 | } GRUB_PACKED; |
9cacaa17 | 718 | typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t; |
719 | ||
720 | #define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5 | |
721 | ||
722 | struct grub_efi_usb_device_path | |
723 | { | |
724 | grub_efi_device_path_t header; | |
725 | grub_efi_uint8_t parent_port_number; | |
607a39f9 | 726 | grub_efi_uint8_t usb_interface; |
7e47e27b | 727 | } GRUB_PACKED; |
9cacaa17 | 728 | typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t; |
729 | ||
730 | #define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15 | |
731 | ||
732 | struct grub_efi_usb_class_device_path | |
733 | { | |
734 | grub_efi_device_path_t header; | |
735 | grub_efi_uint16_t vendor_id; | |
736 | grub_efi_uint16_t product_id; | |
737 | grub_efi_uint8_t device_class; | |
738 | grub_efi_uint8_t device_subclass; | |
739 | grub_efi_uint8_t device_protocol; | |
7e47e27b | 740 | } GRUB_PACKED; |
9cacaa17 | 741 | typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t; |
742 | ||
743 | #define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6 | |
744 | ||
745 | struct grub_efi_i2o_device_path | |
746 | { | |
747 | grub_efi_device_path_t header; | |
748 | grub_efi_uint32_t tid; | |
7e47e27b | 749 | } GRUB_PACKED; |
9cacaa17 | 750 | typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t; |
751 | ||
752 | #define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11 | |
753 | ||
754 | struct grub_efi_mac_address_device_path | |
755 | { | |
756 | grub_efi_device_path_t header; | |
757 | grub_efi_mac_address_t mac_address; | |
758 | grub_efi_uint8_t if_type; | |
7e47e27b | 759 | } GRUB_PACKED; |
9cacaa17 | 760 | typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t; |
761 | ||
762 | #define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12 | |
763 | ||
764 | struct grub_efi_ipv4_device_path | |
765 | { | |
766 | grub_efi_device_path_t header; | |
767 | grub_efi_ipv4_address_t local_ip_address; | |
768 | grub_efi_ipv4_address_t remote_ip_address; | |
769 | grub_efi_uint16_t local_port; | |
770 | grub_efi_uint16_t remote_port; | |
771 | grub_efi_uint16_t protocol; | |
772 | grub_efi_uint8_t static_ip_address; | |
7e47e27b | 773 | } GRUB_PACKED; |
9cacaa17 | 774 | typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t; |
775 | ||
776 | #define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13 | |
777 | ||
778 | struct grub_efi_ipv6_device_path | |
779 | { | |
780 | grub_efi_device_path_t header; | |
781 | grub_efi_ipv6_address_t local_ip_address; | |
782 | grub_efi_ipv6_address_t remote_ip_address; | |
783 | grub_efi_uint16_t local_port; | |
784 | grub_efi_uint16_t remote_port; | |
785 | grub_efi_uint16_t protocol; | |
786 | grub_efi_uint8_t static_ip_address; | |
7e47e27b | 787 | } GRUB_PACKED; |
9cacaa17 | 788 | typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t; |
789 | ||
790 | #define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9 | |
791 | ||
792 | struct grub_efi_infiniband_device_path | |
793 | { | |
794 | grub_efi_device_path_t header; | |
795 | grub_efi_uint32_t resource_flags; | |
796 | grub_efi_uint8_t port_gid[16]; | |
797 | grub_efi_uint64_t remote_id; | |
798 | grub_efi_uint64_t target_port_id; | |
799 | grub_efi_uint64_t device_id; | |
7e47e27b | 800 | } GRUB_PACKED; |
9cacaa17 | 801 | typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t; |
802 | ||
803 | #define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14 | |
804 | ||
805 | struct grub_efi_uart_device_path | |
806 | { | |
807 | grub_efi_device_path_t header; | |
808 | grub_efi_uint32_t reserved; | |
809 | grub_efi_uint64_t baud_rate; | |
810 | grub_efi_uint8_t data_bits; | |
811 | grub_efi_uint8_t parity; | |
812 | grub_efi_uint8_t stop_bits; | |
7e47e27b | 813 | } GRUB_PACKED; |
9cacaa17 | 814 | typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t; |
815 | ||
816 | #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 | |
817 | ||
9cacaa17 | 818 | /* Media Device Path. */ |
819 | #define GRUB_EFI_MEDIA_DEVICE_PATH_TYPE 4 | |
820 | ||
821 | #define GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE 1 | |
822 | ||
823 | struct grub_efi_hard_drive_device_path | |
824 | { | |
825 | grub_efi_device_path_t header; | |
826 | grub_efi_uint32_t partition_number; | |
827 | grub_efi_lba_t partition_start; | |
828 | grub_efi_lba_t partition_size; | |
6dc33377 VS |
829 | grub_efi_uint8_t partition_signature[16]; |
830 | grub_efi_uint8_t partmap_type; | |
9cacaa17 | 831 | grub_efi_uint8_t signature_type; |
7e47e27b | 832 | } GRUB_PACKED; |
9cacaa17 | 833 | typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t; |
834 | ||
835 | #define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2 | |
836 | ||
837 | struct grub_efi_cdrom_device_path | |
838 | { | |
839 | grub_efi_device_path_t header; | |
840 | grub_efi_uint32_t boot_entry; | |
841 | grub_efi_lba_t partition_start; | |
842 | grub_efi_lba_t partition_size; | |
7e47e27b | 843 | } GRUB_PACKED; |
9cacaa17 | 844 | typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t; |
845 | ||
846 | #define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3 | |
847 | ||
848 | struct grub_efi_vendor_media_device_path | |
849 | { | |
850 | grub_efi_device_path_t header; | |
316dda71 | 851 | grub_efi_packed_guid_t vendor_guid; |
9cacaa17 | 852 | grub_efi_uint8_t vendor_defined_data[0]; |
7e47e27b | 853 | } GRUB_PACKED; |
9cacaa17 | 854 | typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t; |
855 | ||
856 | #define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4 | |
857 | ||
858 | struct grub_efi_file_path_device_path | |
859 | { | |
860 | grub_efi_device_path_t header; | |
861 | grub_efi_char16_t path_name[0]; | |
7e47e27b | 862 | } GRUB_PACKED; |
9cacaa17 | 863 | typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t; |
864 | ||
865 | #define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5 | |
866 | ||
867 | struct grub_efi_protocol_device_path | |
868 | { | |
869 | grub_efi_device_path_t header; | |
316dda71 | 870 | grub_efi_packed_guid_t guid; |
7e47e27b | 871 | } GRUB_PACKED; |
9cacaa17 | 872 | typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t; |
873 | ||
52c2d97f VS |
874 | #define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6 |
875 | ||
876 | struct grub_efi_piwg_device_path | |
877 | { | |
878 | grub_efi_device_path_t header; | |
316dda71 | 879 | grub_efi_packed_guid_t guid; |
7e47e27b | 880 | } GRUB_PACKED; |
52c2d97f VS |
881 | typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t; |
882 | ||
883 | ||
9cacaa17 | 884 | /* BIOS Boot Specification Device Path. */ |
885 | #define GRUB_EFI_BIOS_DEVICE_PATH_TYPE 5 | |
886 | ||
887 | #define GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE 1 | |
888 | ||
889 | struct grub_efi_bios_device_path | |
890 | { | |
891 | grub_efi_device_path_t header; | |
892 | grub_efi_uint16_t device_type; | |
893 | grub_efi_uint16_t status_flags; | |
894 | char description[0]; | |
7e47e27b | 895 | } GRUB_PACKED; |
9cacaa17 | 896 | typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; |
897 | ||
83709125 | 898 | struct grub_efi_open_protocol_information_entry |
899 | { | |
900 | grub_efi_handle_t agent_handle; | |
901 | grub_efi_handle_t controller_handle; | |
902 | grub_efi_uint32_t attributes; | |
903 | grub_efi_uint32_t open_count; | |
904 | }; | |
905 | typedef struct grub_efi_open_protocol_information_entry grub_efi_open_protocol_information_entry_t; | |
906 | ||
907 | struct grub_efi_time | |
908 | { | |
909 | grub_efi_uint16_t year; | |
910 | grub_efi_uint8_t month; | |
911 | grub_efi_uint8_t day; | |
912 | grub_efi_uint8_t hour; | |
913 | grub_efi_uint8_t minute; | |
914 | grub_efi_uint8_t second; | |
915 | grub_efi_uint8_t pad1; | |
916 | grub_efi_uint32_t nanosecond; | |
917 | grub_efi_int16_t time_zone; | |
918 | grub_efi_uint8_t daylight; | |
919 | grub_efi_uint8_t pad2; | |
7e47e27b | 920 | } GRUB_PACKED; |
83709125 | 921 | typedef struct grub_efi_time grub_efi_time_t; |
922 | ||
923 | struct grub_efi_time_capabilities | |
924 | { | |
925 | grub_efi_uint32_t resolution; | |
926 | grub_efi_uint32_t accuracy; | |
927 | grub_efi_boolean_t sets_to_zero; | |
928 | }; | |
929 | typedef struct grub_efi_time_capabilities grub_efi_time_capabilities_t; | |
930 | ||
931 | struct grub_efi_input_key | |
932 | { | |
933 | grub_efi_uint16_t scan_code; | |
934 | grub_efi_char16_t unicode_char; | |
935 | }; | |
936 | typedef struct grub_efi_input_key grub_efi_input_key_t; | |
937 | ||
938 | struct grub_efi_simple_text_output_mode | |
939 | { | |
940 | grub_efi_int32_t max_mode; | |
941 | grub_efi_int32_t mode; | |
942 | grub_efi_int32_t attribute; | |
943 | grub_efi_int32_t cursor_column; | |
944 | grub_efi_int32_t cursor_row; | |
945 | grub_efi_boolean_t cursor_visible; | |
946 | }; | |
947 | typedef struct grub_efi_simple_text_output_mode grub_efi_simple_text_output_mode_t; | |
948 | ||
949 | /* Tables. */ | |
950 | struct grub_efi_table_header | |
951 | { | |
952 | grub_efi_uint64_t signature; | |
953 | grub_efi_uint32_t revision; | |
954 | grub_efi_uint32_t header_size; | |
955 | grub_efi_uint32_t crc32; | |
956 | grub_efi_uint32_t reserved; | |
957 | }; | |
958 | typedef struct grub_efi_table_header grub_efi_table_header_t; | |
959 | ||
960 | struct grub_efi_boot_services | |
961 | { | |
962 | grub_efi_table_header_t hdr; | |
b39f9d20 | 963 | |
83709125 | 964 | grub_efi_tpl_t |
965 | (*raise_tpl) (grub_efi_tpl_t new_tpl); | |
b39f9d20 | 966 | |
83709125 | 967 | void |
968 | (*restore_tpl) (grub_efi_tpl_t old_tpl); | |
b39f9d20 | 969 | |
83709125 | 970 | grub_efi_status_t |
971 | (*allocate_pages) (grub_efi_allocate_type_t type, | |
972 | grub_efi_memory_type_t memory_type, | |
973 | grub_efi_uintn_t pages, | |
974 | grub_efi_physical_address_t *memory); | |
b39f9d20 | 975 | |
83709125 | 976 | grub_efi_status_t |
977 | (*free_pages) (grub_efi_physical_address_t memory, | |
978 | grub_efi_uintn_t pages); | |
b39f9d20 | 979 | |
83709125 | 980 | grub_efi_status_t |
981 | (*get_memory_map) (grub_efi_uintn_t *memory_map_size, | |
982 | grub_efi_memory_descriptor_t *memory_map, | |
983 | grub_efi_uintn_t *map_key, | |
984 | grub_efi_uintn_t *descriptor_size, | |
985 | grub_efi_uint32_t *descriptor_version); | |
b39f9d20 | 986 | |
83709125 | 987 | grub_efi_status_t |
988 | (*allocate_pool) (grub_efi_memory_type_t pool_type, | |
989 | grub_efi_uintn_t size, | |
990 | void **buffer); | |
b39f9d20 | 991 | |
83709125 | 992 | grub_efi_status_t |
993 | (*free_pool) (void *buffer); | |
b39f9d20 | 994 | |
83709125 | 995 | grub_efi_status_t |
996 | (*create_event) (grub_efi_uint32_t type, | |
997 | grub_efi_tpl_t notify_tpl, | |
998 | void (*notify_function) (grub_efi_event_t event, | |
999 | void *context), | |
1000 | void *notify_context, | |
1001 | grub_efi_event_t *event); | |
1002 | ||
1003 | grub_efi_status_t | |
83709125 | 1004 | (*set_timer) (grub_efi_event_t event, |
1005 | grub_efi_timer_delay_t type, | |
1006 | grub_efi_uint64_t trigger_time); | |
b39f9d20 | 1007 | |
83709125 | 1008 | grub_efi_status_t |
1009 | (*wait_for_event) (grub_efi_uintn_t num_events, | |
1010 | grub_efi_event_t *event, | |
1011 | grub_efi_uintn_t *index); | |
1012 | ||
1013 | grub_efi_status_t | |
1014 | (*signal_event) (grub_efi_event_t event); | |
b39f9d20 | 1015 | |
83709125 | 1016 | grub_efi_status_t |
1017 | (*close_event) (grub_efi_event_t event); | |
b39f9d20 | 1018 | |
83709125 | 1019 | grub_efi_status_t |
1020 | (*check_event) (grub_efi_event_t event); | |
1021 | ||
1022 | grub_efi_status_t | |
1023 | (*install_protocol_interface) (grub_efi_handle_t *handle, | |
1024 | grub_efi_guid_t *protocol, | |
607a39f9 VS |
1025 | grub_efi_interface_type_t protocol_interface_type, |
1026 | void *protocol_interface); | |
b39f9d20 | 1027 | |
83709125 | 1028 | grub_efi_status_t |
1029 | (*reinstall_protocol_interface) (grub_efi_handle_t handle, | |
1030 | grub_efi_guid_t *protocol, | |
1031 | void *old_interface, | |
cc85c3c3 | 1032 | void *new_interface); |
b39f9d20 | 1033 | |
83709125 | 1034 | grub_efi_status_t |
1035 | (*uninstall_protocol_interface) (grub_efi_handle_t handle, | |
1036 | grub_efi_guid_t *protocol, | |
607a39f9 | 1037 | void *protocol_interface); |
83709125 | 1038 | |
1039 | grub_efi_status_t | |
1040 | (*handle_protocol) (grub_efi_handle_t handle, | |
1041 | grub_efi_guid_t *protocol, | |
607a39f9 | 1042 | void **protocol_interface); |
b39f9d20 | 1043 | |
83709125 | 1044 | void *reserved; |
b39f9d20 | 1045 | |
83709125 | 1046 | grub_efi_status_t |
1047 | (*register_protocol_notify) (grub_efi_guid_t *protocol, | |
1048 | grub_efi_event_t event, | |
1049 | void **registration); | |
1050 | ||
1051 | grub_efi_status_t | |
1052 | (*locate_handle) (grub_efi_locate_search_type_t search_type, | |
1053 | grub_efi_guid_t *protocol, | |
1054 | void *search_key, | |
1055 | grub_efi_uintn_t *buffer_size, | |
1056 | grub_efi_handle_t *buffer); | |
1057 | ||
1058 | grub_efi_status_t | |
1059 | (*locate_device_path) (grub_efi_guid_t *protocol, | |
1060 | grub_efi_device_path_t **device_path, | |
1061 | grub_efi_handle_t *device); | |
1062 | ||
1063 | grub_efi_status_t | |
1064 | (*install_configuration_table) (grub_efi_guid_t *guid, void *table); | |
1065 | ||
1066 | grub_efi_status_t | |
1067 | (*load_image) (grub_efi_boolean_t boot_policy, | |
1068 | grub_efi_handle_t parent_image_handle, | |
1069 | grub_efi_device_path_t *file_path, | |
1070 | void *source_buffer, | |
1071 | grub_efi_uintn_t source_size, | |
1072 | grub_efi_handle_t *image_handle); | |
1073 | ||
1074 | grub_efi_status_t | |
1075 | (*start_image) (grub_efi_handle_t image_handle, | |
1076 | grub_efi_uintn_t *exit_data_size, | |
1077 | grub_efi_char16_t **exit_data); | |
1078 | ||
1079 | grub_efi_status_t | |
1080 | (*exit) (grub_efi_handle_t image_handle, | |
1081 | grub_efi_status_t exit_status, | |
1082 | grub_efi_uintn_t exit_data_size, | |
1083 | grub_efi_char16_t *exit_data) __attribute__((noreturn)); | |
1084 | ||
1085 | grub_efi_status_t | |
1086 | (*unload_image) (grub_efi_handle_t image_handle); | |
1087 | ||
1088 | grub_efi_status_t | |
1089 | (*exit_boot_services) (grub_efi_handle_t image_handle, | |
1090 | grub_efi_uintn_t map_key); | |
1091 | ||
1092 | grub_efi_status_t | |
1093 | (*get_next_monotonic_count) (grub_efi_uint64_t *count); | |
1094 | ||
1095 | grub_efi_status_t | |
1096 | (*stall) (grub_efi_uintn_t microseconds); | |
1097 | ||
1098 | grub_efi_status_t | |
1099 | (*set_watchdog_timer) (grub_efi_uintn_t timeout, | |
1100 | grub_efi_uint64_t watchdog_code, | |
1101 | grub_efi_uintn_t data_size, | |
1102 | grub_efi_char16_t *watchdog_data); | |
1103 | ||
1104 | grub_efi_status_t | |
1105 | (*connect_controller) (grub_efi_handle_t controller_handle, | |
1106 | grub_efi_handle_t *driver_image_handle, | |
1107 | grub_efi_device_path_protocol_t *remaining_device_path, | |
1108 | grub_efi_boolean_t recursive); | |
1109 | ||
1110 | grub_efi_status_t | |
1111 | (*disconnect_controller) (grub_efi_handle_t controller_handle, | |
1112 | grub_efi_handle_t driver_image_handle, | |
1113 | grub_efi_handle_t child_handle); | |
1114 | ||
1115 | grub_efi_status_t | |
1116 | (*open_protocol) (grub_efi_handle_t handle, | |
1117 | grub_efi_guid_t *protocol, | |
607a39f9 | 1118 | void **protocol_interface, |
83709125 | 1119 | grub_efi_handle_t agent_handle, |
1120 | grub_efi_handle_t controller_handle, | |
1121 | grub_efi_uint32_t attributes); | |
1122 | ||
1123 | grub_efi_status_t | |
1124 | (*close_protocol) (grub_efi_handle_t handle, | |
1125 | grub_efi_guid_t *protocol, | |
1126 | grub_efi_handle_t agent_handle, | |
1127 | grub_efi_handle_t controller_handle); | |
1128 | ||
1129 | grub_efi_status_t | |
1130 | (*open_protocol_information) (grub_efi_handle_t handle, | |
1131 | grub_efi_guid_t *protocol, | |
1132 | grub_efi_open_protocol_information_entry_t **entry_buffer, | |
1133 | grub_efi_uintn_t *entry_count); | |
1134 | ||
1135 | grub_efi_status_t | |
1136 | (*protocols_per_handle) (grub_efi_handle_t handle, | |
316dda71 | 1137 | grub_efi_packed_guid_t ***protocol_buffer, |
83709125 | 1138 | grub_efi_uintn_t *protocol_buffer_count); |
1139 | ||
1140 | grub_efi_status_t | |
1141 | (*locate_handle_buffer) (grub_efi_locate_search_type_t search_type, | |
1142 | grub_efi_guid_t *protocol, | |
1143 | void *search_key, | |
1144 | grub_efi_uintn_t *no_handles, | |
1145 | grub_efi_handle_t **buffer); | |
1146 | ||
1147 | grub_efi_status_t | |
1148 | (*locate_protocol) (grub_efi_guid_t *protocol, | |
1149 | void *registration, | |
607a39f9 | 1150 | void **protocol_interface); |
83709125 | 1151 | |
1152 | grub_efi_status_t | |
1153 | (*install_multiple_protocol_interfaces) (grub_efi_handle_t *handle, ...); | |
1154 | ||
1155 | grub_efi_status_t | |
1156 | (*uninstall_multiple_protocol_interfaces) (grub_efi_handle_t handle, ...); | |
1157 | ||
1158 | grub_efi_status_t | |
1159 | (*calculate_crc32) (void *data, | |
1160 | grub_efi_uintn_t data_size, | |
1161 | grub_efi_uint32_t *crc32); | |
1162 | ||
1163 | void | |
1164 | (*copy_mem) (void *destination, void *source, grub_efi_uintn_t length); | |
1165 | ||
1166 | void | |
1167 | (*set_mem) (void *buffer, grub_efi_uintn_t size, grub_efi_uint8_t value); | |
1168 | }; | |
1169 | typedef struct grub_efi_boot_services grub_efi_boot_services_t; | |
1170 | ||
1171 | struct grub_efi_runtime_services | |
1172 | { | |
1173 | grub_efi_table_header_t hdr; | |
1174 | ||
b39f9d20 | 1175 | grub_efi_status_t |
83709125 | 1176 | (*get_time) (grub_efi_time_t *time, |
1177 | grub_efi_time_capabilities_t *capabilities); | |
1178 | ||
1179 | grub_efi_status_t | |
1180 | (*set_time) (grub_efi_time_t *time); | |
1181 | ||
1182 | grub_efi_status_t | |
1183 | (*get_wakeup_time) (grub_efi_boolean_t *enabled, | |
1184 | grub_efi_boolean_t *pending, | |
1185 | grub_efi_time_t *time); | |
1186 | ||
1187 | grub_efi_status_t | |
1188 | (*set_wakeup_time) (grub_efi_boolean_t enabled, | |
1189 | grub_efi_time_t *time); | |
1190 | ||
1191 | grub_efi_status_t | |
1192 | (*set_virtual_address_map) (grub_efi_uintn_t memory_map_size, | |
1193 | grub_efi_uintn_t descriptor_size, | |
1194 | grub_efi_uint32_t descriptor_version, | |
1195 | grub_efi_memory_descriptor_t *virtual_map); | |
1196 | ||
1197 | grub_efi_status_t | |
1198 | (*convert_pointer) (grub_efi_uintn_t debug_disposition, void **address); | |
1199 | ||
c5988629 MG |
1200 | #define GRUB_EFI_GLOBAL_VARIABLE_GUID \ |
1201 | { 0x8BE4DF61, 0x93CA, 0x11d2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B,0x8C }} | |
1202 | ||
1203 | ||
83709125 | 1204 | grub_efi_status_t |
1205 | (*get_variable) (grub_efi_char16_t *variable_name, | |
5a0dc6fb | 1206 | const grub_efi_guid_t *vendor_guid, |
83709125 | 1207 | grub_efi_uint32_t *attributes, |
1208 | grub_efi_uintn_t *data_size, | |
1209 | void *data); | |
1210 | ||
1211 | grub_efi_status_t | |
1212 | (*get_next_variable_name) (grub_efi_uintn_t *variable_name_size, | |
1213 | grub_efi_char16_t *variable_name, | |
1214 | grub_efi_guid_t *vendor_guid); | |
1215 | ||
1216 | grub_efi_status_t | |
1217 | (*set_variable) (grub_efi_char16_t *variable_name, | |
3bfa763c | 1218 | const grub_efi_guid_t *vendor_guid, |
83709125 | 1219 | grub_efi_uint32_t attributes, |
1220 | grub_efi_uintn_t data_size, | |
1221 | void *data); | |
1222 | ||
1223 | grub_efi_status_t | |
1224 | (*get_next_high_monotonic_count) (grub_efi_uint32_t *high_count); | |
1225 | ||
1226 | void | |
1227 | (*reset_system) (grub_efi_reset_type_t reset_type, | |
1228 | grub_efi_status_t reset_status, | |
1229 | grub_efi_uintn_t data_size, | |
1230 | grub_efi_char16_t *reset_data); | |
1231 | }; | |
1232 | typedef struct grub_efi_runtime_services grub_efi_runtime_services_t; | |
1233 | ||
1234 | struct grub_efi_configuration_table | |
1235 | { | |
316dda71 | 1236 | grub_efi_packed_guid_t vendor_guid; |
83709125 | 1237 | void *vendor_table; |
7e47e27b | 1238 | } GRUB_PACKED; |
83709125 | 1239 | typedef struct grub_efi_configuration_table grub_efi_configuration_table_t; |
1240 | ||
5caf964d | 1241 | #define GRUB_EFIEMU_SYSTEM_TABLE_SIGNATURE 0x5453595320494249LL |
1242 | #define GRUB_EFIEMU_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552LL | |
1243 | ||
a9c7fd1c VS |
1244 | struct grub_efi_serial_io_interface |
1245 | { | |
1246 | grub_efi_uint32_t revision; | |
1247 | void (*reset) (void); | |
1248 | grub_efi_status_t (*set_attributes) (struct grub_efi_serial_io_interface *this, | |
1249 | grub_efi_uint64_t speed, | |
1250 | grub_efi_uint32_t fifo_depth, | |
1251 | grub_efi_uint32_t timeout, | |
1252 | grub_efi_parity_type_t parity, | |
1253 | grub_uint8_t word_len, | |
1254 | grub_efi_stop_bits_t stop_bits); | |
9f8acdaa VS |
1255 | grub_efi_status_t (*set_control_bits) (struct grub_efi_serial_io_interface *this, |
1256 | grub_efi_uint32_t flags); | |
a9c7fd1c VS |
1257 | void (*get_control_bits) (void); |
1258 | grub_efi_status_t (*write) (struct grub_efi_serial_io_interface *this, | |
1259 | grub_efi_uintn_t *buf_size, | |
1260 | void *buffer); | |
1261 | grub_efi_status_t (*read) (struct grub_efi_serial_io_interface *this, | |
1262 | grub_efi_uintn_t *buf_size, | |
1263 | void *buffer); | |
1264 | }; | |
1265 | ||
83709125 | 1266 | struct grub_efi_simple_input_interface |
1267 | { | |
1268 | grub_efi_status_t | |
1269 | (*reset) (struct grub_efi_simple_input_interface *this, | |
1270 | grub_efi_boolean_t extended_verification); | |
b39f9d20 | 1271 | |
83709125 | 1272 | grub_efi_status_t |
1273 | (*read_key_stroke) (struct grub_efi_simple_input_interface *this, | |
1274 | grub_efi_input_key_t *key); | |
b39f9d20 | 1275 | |
83709125 | 1276 | grub_efi_event_t wait_for_key; |
1277 | }; | |
1278 | typedef struct grub_efi_simple_input_interface grub_efi_simple_input_interface_t; | |
1279 | ||
1280 | struct grub_efi_simple_text_output_interface | |
1281 | { | |
1282 | grub_efi_status_t | |
1283 | (*reset) (struct grub_efi_simple_text_output_interface *this, | |
1284 | grub_efi_boolean_t extended_verification); | |
1285 | ||
1286 | grub_efi_status_t | |
1287 | (*output_string) (struct grub_efi_simple_text_output_interface *this, | |
1288 | grub_efi_char16_t *string); | |
1289 | ||
1290 | grub_efi_status_t | |
1291 | (*test_string) (struct grub_efi_simple_text_output_interface *this, | |
1292 | grub_efi_char16_t *string); | |
1293 | ||
1294 | grub_efi_status_t | |
1295 | (*query_mode) (struct grub_efi_simple_text_output_interface *this, | |
1296 | grub_efi_uintn_t mode_number, | |
1297 | grub_efi_uintn_t *columns, | |
1298 | grub_efi_uintn_t *rows); | |
1299 | ||
b39f9d20 | 1300 | grub_efi_status_t |
83709125 | 1301 | (*set_mode) (struct grub_efi_simple_text_output_interface *this, |
1302 | grub_efi_uintn_t mode_number); | |
1303 | ||
1304 | grub_efi_status_t | |
1305 | (*set_attributes) (struct grub_efi_simple_text_output_interface *this, | |
1306 | grub_efi_uintn_t attribute); | |
1307 | ||
1308 | grub_efi_status_t | |
1309 | (*clear_screen) (struct grub_efi_simple_text_output_interface *this); | |
1310 | ||
1311 | grub_efi_status_t | |
1312 | (*set_cursor_position) (struct grub_efi_simple_text_output_interface *this, | |
1313 | grub_efi_uintn_t column, | |
1314 | grub_efi_uintn_t row); | |
1315 | ||
1316 | grub_efi_status_t | |
1317 | (*enable_cursor) (struct grub_efi_simple_text_output_interface *this, | |
1318 | grub_efi_boolean_t visible); | |
b39f9d20 | 1319 | |
83709125 | 1320 | grub_efi_simple_text_output_mode_t *mode; |
1321 | }; | |
1322 | typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t; | |
1323 | ||
cae730b4 VS |
1324 | typedef grub_uint8_t grub_efi_pxe_packet_t[1472]; |
1325 | ||
1326 | typedef struct grub_efi_pxe_mode | |
1327 | { | |
1328 | grub_uint8_t unused[52]; | |
1329 | grub_efi_pxe_packet_t dhcp_discover; | |
1330 | grub_efi_pxe_packet_t dhcp_ack; | |
1331 | grub_efi_pxe_packet_t proxy_offer; | |
1332 | grub_efi_pxe_packet_t pxe_discover; | |
1333 | grub_efi_pxe_packet_t pxe_reply; | |
1334 | } grub_efi_pxe_mode_t; | |
1335 | ||
1336 | typedef struct grub_efi_pxe | |
1337 | { | |
1338 | grub_uint64_t rev; | |
1339 | void (*start) (void); | |
1340 | void (*stop) (void); | |
1341 | void (*dhcp) (void); | |
1342 | void (*discover) (void); | |
1343 | void (*mftp) (void); | |
1344 | void (*udpwrite) (void); | |
1345 | void (*udpread) (void); | |
1346 | void (*setipfilter) (void); | |
1347 | void (*arp) (void); | |
1348 | void (*setparams) (void); | |
1349 | void (*setstationip) (void); | |
1350 | void (*setpackets) (void); | |
1351 | struct grub_efi_pxe_mode *mode; | |
1352 | } grub_efi_pxe_t; | |
1353 | ||
976a4ea0 | 1354 | #define GRUB_EFI_BLACK 0x00 |
1355 | #define GRUB_EFI_BLUE 0x01 | |
1356 | #define GRUB_EFI_GREEN 0x02 | |
1357 | #define GRUB_EFI_CYAN 0x03 | |
1358 | #define GRUB_EFI_RED 0x04 | |
1359 | #define GRUB_EFI_MAGENTA 0x05 | |
1360 | #define GRUB_EFI_BROWN 0x06 | |
1361 | #define GRUB_EFI_LIGHTGRAY 0x07 | |
1362 | #define GRUB_EFI_BRIGHT 0x08 | |
1363 | #define GRUB_EFI_DARKGRAY 0x08 | |
1364 | #define GRUB_EFI_LIGHTBLUE 0x09 | |
1365 | #define GRUB_EFI_LIGHTGREEN 0x0A | |
1366 | #define GRUB_EFI_LIGHTCYAN 0x0B | |
1367 | #define GRUB_EFI_LIGHTRED 0x0C | |
1368 | #define GRUB_EFI_LIGHTMAGENTA 0x0D | |
1369 | #define GRUB_EFI_YELLOW 0x0E | |
1370 | #define GRUB_EFI_WHITE 0x0F | |
1371 | ||
1372 | #define GRUB_EFI_BACKGROUND_BLACK 0x00 | |
1373 | #define GRUB_EFI_BACKGROUND_BLUE 0x10 | |
1374 | #define GRUB_EFI_BACKGROUND_GREEN 0x20 | |
1375 | #define GRUB_EFI_BACKGROUND_CYAN 0x30 | |
1376 | #define GRUB_EFI_BACKGROUND_RED 0x40 | |
1377 | #define GRUB_EFI_BACKGROUND_MAGENTA 0x50 | |
1378 | #define GRUB_EFI_BACKGROUND_BROWN 0x60 | |
1379 | #define GRUB_EFI_BACKGROUND_LIGHTGRAY 0x70 | |
1380 | ||
89a7d726 | 1381 | #define GRUB_EFI_TEXT_ATTR(fg, bg) ((fg) | ((bg))) |
976a4ea0 | 1382 | |
83709125 | 1383 | struct grub_efi_system_table |
1384 | { | |
1385 | grub_efi_table_header_t hdr; | |
1386 | grub_efi_char16_t *firmware_vendor; | |
1387 | grub_efi_uint32_t firmware_revision; | |
1388 | grub_efi_handle_t console_in_handler; | |
1389 | grub_efi_simple_input_interface_t *con_in; | |
1390 | grub_efi_handle_t console_out_handler; | |
1391 | grub_efi_simple_text_output_interface_t *con_out; | |
1392 | grub_efi_handle_t standard_error_handle; | |
1393 | grub_efi_simple_text_output_interface_t *std_err; | |
1394 | grub_efi_runtime_services_t *runtime_services; | |
1395 | grub_efi_boot_services_t *boot_services; | |
1396 | grub_efi_uintn_t num_table_entries; | |
1397 | grub_efi_configuration_table_t *configuration_table; | |
1398 | }; | |
1399 | typedef struct grub_efi_system_table grub_efi_system_table_t; | |
1400 | ||
2eab1c0d | 1401 | struct grub_efi_loaded_image |
1402 | { | |
1403 | grub_efi_uint32_t revision; | |
1404 | grub_efi_handle_t parent_handle; | |
1405 | grub_efi_system_table_t *system_table; | |
1406 | ||
1407 | grub_efi_handle_t device_handle; | |
1408 | grub_efi_device_path_t *file_path; | |
1409 | void *reserved; | |
1410 | ||
1411 | grub_efi_uint32_t load_options_size; | |
1412 | void *load_options; | |
1413 | ||
1414 | void *image_base; | |
1415 | grub_efi_uint64_t image_size; | |
1416 | grub_efi_memory_type_t image_code_type; | |
1417 | grub_efi_memory_type_t image_data_type; | |
1418 | ||
1419 | grub_efi_status_t (*unload) (grub_efi_handle_t image_handle); | |
1420 | }; | |
1421 | typedef struct grub_efi_loaded_image grub_efi_loaded_image_t; | |
1422 | ||
9cacaa17 | 1423 | struct grub_efi_disk_io |
1424 | { | |
1425 | grub_efi_uint64_t revision; | |
1426 | grub_efi_status_t (*read) (struct grub_efi_disk_io *this, | |
1427 | grub_efi_uint32_t media_id, | |
1428 | grub_efi_uint64_t offset, | |
1429 | grub_efi_uintn_t buffer_size, | |
1430 | void *buffer); | |
1431 | grub_efi_status_t (*write) (struct grub_efi_disk_io *this, | |
1432 | grub_efi_uint32_t media_id, | |
1433 | grub_efi_uint64_t offset, | |
1434 | grub_efi_uintn_t buffer_size, | |
1435 | void *buffer); | |
1436 | }; | |
1437 | typedef struct grub_efi_disk_io grub_efi_disk_io_t; | |
1438 | ||
1439 | struct grub_efi_block_io_media | |
1440 | { | |
1441 | grub_efi_uint32_t media_id; | |
1442 | grub_efi_boolean_t removable_media; | |
1443 | grub_efi_boolean_t media_present; | |
1444 | grub_efi_boolean_t logical_partition; | |
1445 | grub_efi_boolean_t read_only; | |
1446 | grub_efi_boolean_t write_caching; | |
1447 | grub_efi_uint8_t pad[3]; | |
1448 | grub_efi_uint32_t block_size; | |
1449 | grub_efi_uint32_t io_align; | |
1450 | grub_efi_uint8_t pad2[4]; | |
1451 | grub_efi_lba_t last_block; | |
1452 | }; | |
1453 | typedef struct grub_efi_block_io_media grub_efi_block_io_media_t; | |
1454 | ||
9d22909b VS |
1455 | typedef grub_uint8_t grub_efi_mac_t[32]; |
1456 | ||
1457 | struct grub_efi_simple_network_mode | |
1458 | { | |
1459 | grub_uint32_t state; | |
1460 | grub_uint32_t hwaddr_size; | |
1461 | grub_uint32_t media_header_size; | |
1462 | grub_uint32_t max_packet_size; | |
1463 | grub_uint32_t nvram_size; | |
1464 | grub_uint32_t nvram_access_size; | |
1465 | grub_uint32_t receive_filter_mask; | |
1466 | grub_uint32_t receive_filter_setting; | |
1467 | grub_uint32_t max_mcast_filter_count; | |
1468 | grub_uint32_t mcast_filter_count; | |
1469 | grub_efi_mac_t mcast_filter[16]; | |
1470 | grub_efi_mac_t current_address; | |
1471 | grub_efi_mac_t broadcast_address; | |
1472 | grub_efi_mac_t permanent_address; | |
1473 | grub_uint8_t if_type; | |
1474 | grub_uint8_t mac_changeable; | |
1475 | grub_uint8_t multitx_supported; | |
1476 | grub_uint8_t media_present_supported; | |
1477 | grub_uint8_t media_present; | |
1478 | }; | |
1479 | ||
1480 | enum | |
1481 | { | |
1482 | GRUB_EFI_NETWORK_STOPPED, | |
1483 | GRUB_EFI_NETWORK_STARTED, | |
1484 | GRUB_EFI_NETWORK_INITIALIZED, | |
1485 | }; | |
1486 | ||
1487 | struct grub_efi_simple_network | |
1488 | { | |
1489 | grub_uint64_t revision; | |
1490 | grub_efi_status_t (*start) (struct grub_efi_simple_network *this); | |
1491 | void (*stop) (void); | |
1492 | grub_efi_status_t (*initialize) (struct grub_efi_simple_network *this, | |
1493 | grub_efi_uintn_t extra_rx, | |
1494 | grub_efi_uintn_t extra_tx); | |
1495 | void (*reset) (void); | |
1496 | void (*shutdown) (void); | |
1497 | void (*receive_filters) (void); | |
1498 | void (*station_address) (void); | |
1499 | void (*statistics) (void); | |
1500 | void (*mcastiptomac) (void); | |
1501 | void (*nvdata) (void); | |
eb6a7b97 VS |
1502 | grub_efi_status_t (*get_status) (struct grub_efi_simple_network *this, |
1503 | grub_uint32_t *int_status, | |
1504 | void **txbuf); | |
9d22909b VS |
1505 | grub_efi_status_t (*transmit) (struct grub_efi_simple_network *this, |
1506 | grub_efi_uintn_t header_size, | |
1507 | grub_efi_uintn_t buffer_size, | |
1508 | void *buffer, | |
1509 | grub_efi_mac_t *src_addr, | |
1510 | grub_efi_mac_t *dest_addr, | |
1511 | grub_efi_uint16_t *protocol); | |
1512 | grub_efi_status_t (*receive) (struct grub_efi_simple_network *this, | |
1513 | grub_efi_uintn_t *header_size, | |
1514 | grub_efi_uintn_t *buffer_size, | |
1515 | void *buffer, | |
1516 | grub_efi_mac_t *src_addr, | |
1517 | grub_efi_mac_t *dest_addr, | |
1518 | grub_uint16_t *protocol); | |
1519 | void (*waitforpacket) (void); | |
1520 | struct grub_efi_simple_network_mode *mode; | |
1521 | }; | |
1522 | typedef struct grub_efi_simple_network grub_efi_simple_network_t; | |
1523 | ||
1524 | ||
9cacaa17 | 1525 | struct grub_efi_block_io |
1526 | { | |
1527 | grub_efi_uint64_t revision; | |
1528 | grub_efi_block_io_media_t *media; | |
1529 | grub_efi_status_t (*reset) (struct grub_efi_block_io *this, | |
1530 | grub_efi_boolean_t extended_verification); | |
1531 | grub_efi_status_t (*read_blocks) (struct grub_efi_block_io *this, | |
1532 | grub_efi_uint32_t media_id, | |
1533 | grub_efi_lba_t lba, | |
1534 | grub_efi_uintn_t buffer_size, | |
1535 | void *buffer); | |
1536 | grub_efi_status_t (*write_blocks) (struct grub_efi_block_io *this, | |
1537 | grub_efi_uint32_t media_id, | |
1538 | grub_efi_lba_t lba, | |
1539 | grub_efi_uintn_t buffer_size, | |
1540 | void *buffer); | |
1541 | grub_efi_status_t (*flush_blocks) (struct grub_efi_block_io *this); | |
1542 | }; | |
1543 | typedef struct grub_efi_block_io grub_efi_block_io_t; | |
1544 | ||
15a463d7 | 1545 | #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ |
9fdec226 | 1546 | || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) |
20011694 | 1547 | |
1548 | #define efi_call_0(func) func() | |
1549 | #define efi_call_1(func, a) func(a) | |
1550 | #define efi_call_2(func, a, b) func(a, b) | |
1551 | #define efi_call_3(func, a, b, c) func(a, b, c) | |
1552 | #define efi_call_4(func, a, b, c, d) func(a, b, c, d) | |
1553 | #define efi_call_5(func, a, b, c, d, e) func(a, b, c, d, e) | |
1554 | #define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f) | |
9d22909b | 1555 | #define efi_call_7(func, a, b, c, d, e, f, g) func(a, b, c, d, e, f, g) |
6e09b8b7 | 1556 | #define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) func(a, b, c, d, e, f, g, h, i, j) |
20011694 | 1557 | |
1558 | #else | |
1559 | ||
6e09b8b7 | 1560 | #define efi_call_0(func) \ |
1561 | efi_wrap_0(func) | |
1562 | #define efi_call_1(func, a) \ | |
0c51bb63 | 1563 | efi_wrap_1(func, (grub_uint64_t) (a)) |
6e09b8b7 | 1564 | #define efi_call_2(func, a, b) \ |
0c51bb63 | 1565 | efi_wrap_2(func, (grub_uint64_t) (a), (grub_uint64_t) (b)) |
6e09b8b7 | 1566 | #define efi_call_3(func, a, b, c) \ |
0c51bb63 VS |
1567 | efi_wrap_3(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \ |
1568 | (grub_uint64_t) (c)) | |
6e09b8b7 | 1569 | #define efi_call_4(func, a, b, c, d) \ |
0c51bb63 VS |
1570 | efi_wrap_4(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \ |
1571 | (grub_uint64_t) (c), (grub_uint64_t) (d)) | |
6e09b8b7 | 1572 | #define efi_call_5(func, a, b, c, d, e) \ |
0c51bb63 VS |
1573 | efi_wrap_5(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \ |
1574 | (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e)) | |
6e09b8b7 | 1575 | #define efi_call_6(func, a, b, c, d, e, f) \ |
0c51bb63 VS |
1576 | efi_wrap_6(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \ |
1577 | (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \ | |
1578 | (grub_uint64_t) (f)) | |
9d22909b | 1579 | #define efi_call_7(func, a, b, c, d, e, f, g) \ |
0c51bb63 VS |
1580 | efi_wrap_7(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \ |
1581 | (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \ | |
1582 | (grub_uint64_t) (f), (grub_uint64_t) (g)) | |
6e09b8b7 | 1583 | #define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \ |
0c51bb63 VS |
1584 | efi_wrap_10(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \ |
1585 | (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \ | |
1586 | (grub_uint64_t) (f), (grub_uint64_t) (g), (grub_uint64_t) (h), \ | |
1587 | (grub_uint64_t) (i), (grub_uint64_t) (j)) | |
20011694 | 1588 | |
1589 | grub_uint64_t EXPORT_FUNC(efi_wrap_0) (void *func); | |
1590 | grub_uint64_t EXPORT_FUNC(efi_wrap_1) (void *func, grub_uint64_t arg1); | |
1591 | grub_uint64_t EXPORT_FUNC(efi_wrap_2) (void *func, grub_uint64_t arg1, | |
1592 | grub_uint64_t arg2); | |
1593 | grub_uint64_t EXPORT_FUNC(efi_wrap_3) (void *func, grub_uint64_t arg1, | |
1594 | grub_uint64_t arg2, grub_uint64_t arg3); | |
1595 | grub_uint64_t EXPORT_FUNC(efi_wrap_4) (void *func, grub_uint64_t arg1, | |
1596 | grub_uint64_t arg2, grub_uint64_t arg3, | |
1597 | grub_uint64_t arg4); | |
1598 | grub_uint64_t EXPORT_FUNC(efi_wrap_5) (void *func, grub_uint64_t arg1, | |
1599 | grub_uint64_t arg2, grub_uint64_t arg3, | |
1600 | grub_uint64_t arg4, grub_uint64_t arg5); | |
1601 | grub_uint64_t EXPORT_FUNC(efi_wrap_6) (void *func, grub_uint64_t arg1, | |
1602 | grub_uint64_t arg2, grub_uint64_t arg3, | |
1603 | grub_uint64_t arg4, grub_uint64_t arg5, | |
1604 | grub_uint64_t arg6); | |
9d22909b VS |
1605 | grub_uint64_t EXPORT_FUNC(efi_wrap_7) (void *func, grub_uint64_t arg1, |
1606 | grub_uint64_t arg2, grub_uint64_t arg3, | |
1607 | grub_uint64_t arg4, grub_uint64_t arg5, | |
1608 | grub_uint64_t arg6, grub_uint64_t arg7); | |
6e09b8b7 | 1609 | grub_uint64_t EXPORT_FUNC(efi_wrap_10) (void *func, grub_uint64_t arg1, |
1610 | grub_uint64_t arg2, grub_uint64_t arg3, | |
1611 | grub_uint64_t arg4, grub_uint64_t arg5, | |
1612 | grub_uint64_t arg6, grub_uint64_t arg7, | |
1613 | grub_uint64_t arg8, grub_uint64_t arg9, | |
1614 | grub_uint64_t arg10); | |
20011694 | 1615 | #endif |
1616 | ||
83709125 | 1617 | #endif /* ! GRUB_EFI_API_HEADER */ |