1 /* efi.h - declare EFI types and functions */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
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.
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.
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/>.
20 #ifndef GRUB_EFI_API_HEADER
21 #define GRUB_EFI_API_HEADER 1
23 #include <grub/types.h>
24 #include <grub/symbol.h>
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. */
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
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
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
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
61 #define GRUB_EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
62 #define GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
63 #define GRUB_EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
65 #define GRUB_EFI_TIME_ADJUST_DAYLIGHT 0x01
66 #define GRUB_EFI_TIME_IN_DAYLIGHT 0x02
68 #define GRUB_EFI_UNSPECIFIED_TIMEZONE 0x07FF
70 #define GRUB_EFI_OPTIONAL_PTR 0x00000001
72 #define GRUB_EFI_LOADED_IMAGE_GUID \
73 { 0x5b1b31a1, 0x9562, 0x11d2, \
74 { 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
77 #define GRUB_EFI_DISK_IO_GUID \
78 { 0xce345171, 0xba0b, 0x11d2, \
79 { 0x8e, 0x4f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
82 #define GRUB_EFI_BLOCK_IO_GUID \
83 { 0x964e5b21, 0x6459, 0x11d2, \
84 { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
87 #define GRUB_EFI_SERIAL_IO_GUID \
88 { 0xbb25cf6f, 0xf1d4, 0x11d2, \
89 { 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0xfd } \
92 #define GRUB_EFI_SIMPLE_NETWORK_GUID \
93 { 0xa19832b9, 0xac25, 0x11d3, \
94 { 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
97 #define GRUB_EFI_PXE_GUID \
98 { 0x03c4e603, 0xac28, 0x11d3, \
99 { 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
102 #define GRUB_EFI_DEVICE_PATH_GUID \
103 { 0x09576e91, 0x6d3f, 0x11d2, \
104 { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
107 #define GRUB_EFI_MPS_TABLE_GUID \
108 { 0xeb9d2d2f, 0x2d88, 0x11d3, \
109 { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
112 #define GRUB_EFI_ACPI_TABLE_GUID \
113 { 0xeb9d2d30, 0x2d88, 0x11d3, \
114 { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
117 #define GRUB_EFI_ACPI_20_TABLE_GUID \
118 { 0x8868e871, 0xe4f1, 0x11d3, \
119 { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
122 #define GRUB_EFI_SMBIOS_TABLE_GUID \
123 { 0xeb9d2d31, 0x2d88, 0x11d3, \
124 { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
127 #define GRUB_EFI_SAL_TABLE_GUID \
128 { 0xeb9d2d32, 0x2d88, 0x11d3, \
129 { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
132 #define GRUB_EFI_HCDP_TABLE_GUID \
133 { 0xf951938d, 0x620b, 0x42ef, \
134 { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \
137 struct grub_efi_sal_system_table
139 grub_uint32_t signature
;
140 grub_uint32_t total_table_len
;
141 grub_uint16_t sal_rev
;
142 grub_uint16_t entry_count
;
143 grub_uint8_t checksum
;
144 grub_uint8_t reserved1
[7];
145 grub_uint16_t sal_a_version
;
146 grub_uint16_t sal_b_version
;
147 grub_uint8_t oem_id
[32];
148 grub_uint8_t product_id
[32];
149 grub_uint8_t reserved2
[8];
150 grub_uint8_t entries
[0];
155 GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_ENTRYPOINT_DESCRIPTOR
= 0,
156 GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_MEMORY_DESCRIPTOR
= 1,
157 GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_PLATFORM_FEATURES
= 2,
158 GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_TRANSLATION_REGISTER_DESCRIPTOR
= 3,
159 GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_PURGE_TRANSLATION_COHERENCE
= 4,
160 GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_AP_WAKEUP
= 5
163 struct grub_efi_sal_system_table_entrypoint_descriptor
167 grub_uint64_t pal_proc_addr
;
168 grub_uint64_t sal_proc_addr
;
169 grub_uint64_t global_data_ptr
;
170 grub_uint64_t reserved
[2];
173 struct grub_efi_sal_system_table_memory_descriptor
176 grub_uint8_t sal_used
;
179 grub_uint8_t attr_mask
;
180 grub_uint8_t mem_type
;
182 grub_uint8_t unknown
;
185 grub_uint64_t unknown2
;
188 struct grub_efi_sal_system_table_platform_features
192 grub_uint8_t reserved
[14];
195 struct grub_efi_sal_system_table_translation_register_descriptor
198 grub_uint8_t register_type
;
199 grub_uint8_t register_number
;
200 grub_uint8_t reserved
[5];
202 grub_uint64_t page_size
;
203 grub_uint64_t reserver
;
206 struct grub_efi_sal_system_table_purge_translation_coherence
209 grub_uint8_t reserved
[3];
210 grub_uint32_t ndomains
;
211 grub_uint64_t coherence
;
214 struct grub_efi_sal_system_table_ap_wakeup
217 grub_uint8_t mechanism
;
218 grub_uint8_t reserved
[6];
219 grub_uint64_t vector
;
224 GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_BUSLOCK
= 1,
225 GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IRQREDIRECT
= 2,
226 GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IPIREDIRECT
= 4,
227 GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_ITCDRIFT
= 8,
230 typedef enum grub_efi_parity_type
232 GRUB_EFI_SERIAL_DEFAULT_PARITY
,
233 GRUB_EFI_SERIAL_NO_PARITY
,
234 GRUB_EFI_SERIAL_EVEN_PARITY
,
235 GRUB_EFI_SERIAL_ODD_PARITY
237 grub_efi_parity_type_t
;
239 typedef enum grub_efi_stop_bits
241 GRUB_EFI_SERIAL_DEFAULT_STOP_BITS
,
242 GRUB_EFI_SERIAL_1_STOP_BIT
,
243 GRUB_EFI_SERIAL_1_5_STOP_BITS
,
244 GRUB_EFI_SERIAL_2_STOP_BITS
246 grub_efi_stop_bits_t
;
249 enum grub_efi_timer_delay
251 GRUB_EFI_TIMER_CANCEL
,
252 GRUB_EFI_TIMER_PERIODIC
,
253 GRUB_EFI_TIMER_RELATIVE
255 typedef enum grub_efi_timer_delay grub_efi_timer_delay_t
;
257 enum grub_efi_allocate_type
259 GRUB_EFI_ALLOCATE_ANY_PAGES
,
260 GRUB_EFI_ALLOCATE_MAX_ADDRESS
,
261 GRUB_EFI_ALLOCATE_ADDRESS
,
262 GRUB_EFI_MAX_ALLOCATION_TYPE
264 typedef enum grub_efi_allocate_type grub_efi_allocate_type_t
;
266 enum grub_efi_memory_type
268 GRUB_EFI_RESERVED_MEMORY_TYPE
,
269 GRUB_EFI_LOADER_CODE
,
270 GRUB_EFI_LOADER_DATA
,
271 GRUB_EFI_BOOT_SERVICES_CODE
,
272 GRUB_EFI_BOOT_SERVICES_DATA
,
273 GRUB_EFI_RUNTIME_SERVICES_CODE
,
274 GRUB_EFI_RUNTIME_SERVICES_DATA
,
275 GRUB_EFI_CONVENTIONAL_MEMORY
,
276 GRUB_EFI_UNUSABLE_MEMORY
,
277 GRUB_EFI_ACPI_RECLAIM_MEMORY
,
278 GRUB_EFI_ACPI_MEMORY_NVS
,
279 GRUB_EFI_MEMORY_MAPPED_IO
,
280 GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE
,
282 GRUB_EFI_MAX_MEMORY_TYPE
284 typedef enum grub_efi_memory_type grub_efi_memory_type_t
;
286 enum grub_efi_interface_type
288 GRUB_EFI_NATIVE_INTERFACE
290 typedef enum grub_efi_interface_type grub_efi_interface_type_t
;
292 enum grub_efi_locate_search_type
294 GRUB_EFI_ALL_HANDLES
,
295 GRUB_EFI_BY_REGISTER_NOTIFY
,
298 typedef enum grub_efi_locate_search_type grub_efi_locate_search_type_t
;
300 enum grub_efi_reset_type
304 GRUB_EFI_RESET_SHUTDOWN
306 typedef enum grub_efi_reset_type grub_efi_reset_type_t
;
309 typedef char grub_efi_boolean_t
;
310 typedef long grub_efi_intn_t
;
311 typedef unsigned long grub_efi_uintn_t
;
312 typedef grub_int8_t grub_efi_int8_t
;
313 typedef grub_uint8_t grub_efi_uint8_t
;
314 typedef grub_int16_t grub_efi_int16_t
;
315 typedef grub_uint16_t grub_efi_uint16_t
;
316 typedef grub_int32_t grub_efi_int32_t
;
317 typedef grub_uint32_t grub_efi_uint32_t
;
318 typedef grub_int64_t grub_efi_int64_t
;
319 typedef grub_uint64_t grub_efi_uint64_t
;
320 typedef grub_uint8_t grub_efi_char8_t
;
321 typedef grub_uint16_t grub_efi_char16_t
;
323 #define PRIxGRUB_EFI_UINTN_T "lx"
325 typedef grub_efi_intn_t grub_efi_status_t
;
327 #define GRUB_EFI_ERROR_CODE(value) \
328 ((1L << (sizeof (grub_efi_status_t) * 8 - 1)) | (value))
330 #define GRUB_EFI_WARNING_CODE(value) (value)
332 #define GRUB_EFI_SUCCESS 0
334 #define GRUB_EFI_LOAD_ERROR GRUB_EFI_ERROR_CODE (1)
335 #define GRUB_EFI_INVALID_PARAMETER GRUB_EFI_ERROR_CODE (2)
336 #define GRUB_EFI_UNSUPPORTED GRUB_EFI_ERROR_CODE (3)
337 #define GRUB_EFI_BAD_BUFFER_SIZE GRUB_EFI_ERROR_CODE (4)
338 #define GRUB_EFI_BUFFER_TOO_SMALL GRUB_EFI_ERROR_CODE (5)
339 #define GRUB_EFI_NOT_READY GRUB_EFI_ERROR_CODE (6)
340 #define GRUB_EFI_DEVICE_ERROR GRUB_EFI_ERROR_CODE (7)
341 #define GRUB_EFI_WRITE_PROTECTED GRUB_EFI_ERROR_CODE (8)
342 #define GRUB_EFI_OUT_OF_RESOURCES GRUB_EFI_ERROR_CODE (9)
343 #define GRUB_EFI_VOLUME_CORRUPTED GRUB_EFI_ERROR_CODE (10)
344 #define GRUB_EFI_VOLUME_FULL GRUB_EFI_ERROR_CODE (11)
345 #define GRUB_EFI_NO_MEDIA GRUB_EFI_ERROR_CODE (12)
346 #define GRUB_EFI_MEDIA_CHANGED GRUB_EFI_ERROR_CODE (13)
347 #define GRUB_EFI_NOT_FOUND GRUB_EFI_ERROR_CODE (14)
348 #define GRUB_EFI_ACCESS_DENIED GRUB_EFI_ERROR_CODE (15)
349 #define GRUB_EFI_NO_RESPONSE GRUB_EFI_ERROR_CODE (16)
350 #define GRUB_EFI_NO_MAPPING GRUB_EFI_ERROR_CODE (17)
351 #define GRUB_EFI_TIMEOUT GRUB_EFI_ERROR_CODE (18)
352 #define GRUB_EFI_NOT_STARTED GRUB_EFI_ERROR_CODE (19)
353 #define GRUB_EFI_ALREADY_STARTED GRUB_EFI_ERROR_CODE (20)
354 #define GRUB_EFI_ABORTED GRUB_EFI_ERROR_CODE (21)
355 #define GRUB_EFI_ICMP_ERROR GRUB_EFI_ERROR_CODE (22)
356 #define GRUB_EFI_TFTP_ERROR GRUB_EFI_ERROR_CODE (23)
357 #define GRUB_EFI_PROTOCOL_ERROR GRUB_EFI_ERROR_CODE (24)
358 #define GRUB_EFI_INCOMPATIBLE_VERSION GRUB_EFI_ERROR_CODE (25)
359 #define GRUB_EFI_SECURITY_VIOLATION GRUB_EFI_ERROR_CODE (26)
360 #define GRUB_EFI_CRC_ERROR GRUB_EFI_ERROR_CODE (27)
362 #define GRUB_EFI_WARN_UNKNOWN_GLYPH GRUB_EFI_WARNING_CODE (1)
363 #define GRUB_EFI_WARN_DELETE_FAILURE GRUB_EFI_WARNING_CODE (2)
364 #define GRUB_EFI_WARN_WRITE_FAILURE GRUB_EFI_WARNING_CODE (3)
365 #define GRUB_EFI_WARN_BUFFER_TOO_SMALL GRUB_EFI_WARNING_CODE (4)
367 typedef void *grub_efi_handle_t
;
368 typedef void *grub_efi_event_t
;
369 typedef grub_efi_uint64_t grub_efi_lba_t
;
370 typedef grub_efi_uintn_t grub_efi_tpl_t
;
371 typedef grub_uint8_t grub_efi_mac_address_t
[32];
372 typedef grub_uint8_t grub_efi_ipv4_address_t
[4];
373 typedef grub_uint16_t grub_efi_ipv6_address_t
[8];
374 typedef grub_uint8_t grub_efi_ip_address_t
[8] __attribute__ ((aligned(4)));
375 typedef grub_efi_uint64_t grub_efi_physical_address_t
;
376 typedef grub_efi_uint64_t grub_efi_virtual_address_t
;
383 grub_uint8_t data4
[8];
384 } __attribute__ ((aligned(8)));
385 typedef struct grub_efi_guid grub_efi_guid_t
;
387 /* XXX although the spec does not specify the padding, this actually
388 must have the padding! */
389 struct grub_efi_memory_descriptor
391 grub_efi_uint32_t type
;
392 grub_efi_uint32_t padding
;
393 grub_efi_physical_address_t physical_start
;
394 grub_efi_virtual_address_t virtual_start
;
395 grub_efi_uint64_t num_pages
;
396 grub_efi_uint64_t attribute
;
397 } __attribute__ ((packed
));
398 typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t
;
400 /* Device Path definitions. */
401 struct grub_efi_device_path
403 grub_efi_uint8_t type
;
404 grub_efi_uint8_t subtype
;
405 grub_efi_uint8_t length
[2];
407 typedef struct grub_efi_device_path grub_efi_device_path_t
;
408 /* XXX EFI does not define EFI_DEVICE_PATH_PROTOCOL but uses it.
409 It seems to be identical to EFI_DEVICE_PATH. */
410 typedef struct grub_efi_device_path grub_efi_device_path_protocol_t
;
412 #define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f)
413 #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype)
414 #define GRUB_EFI_DEVICE_PATH_LENGTH(dp) \
415 ((dp)->length[0] | ((grub_efi_uint16_t) ((dp)->length[1]) << 8))
417 /* The End of Device Path nodes. */
418 #define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f)
420 #define GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
421 #define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01
423 #define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \
424 (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \
425 && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \
426 == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE))
428 #define GRUB_EFI_NEXT_DEVICE_PATH(dp) \
429 ((grub_efi_device_path_t *) ((char *) (dp) \
430 + GRUB_EFI_DEVICE_PATH_LENGTH (dp)))
432 /* Hardware Device Path. */
433 #define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1
435 #define GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE 1
437 struct grub_efi_pci_device_path
439 grub_efi_device_path_t header
;
440 grub_efi_uint8_t function
;
441 grub_efi_uint8_t device
;
442 } __attribute__ ((packed
));
443 typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t
;
445 #define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2
447 struct grub_efi_pccard_device_path
449 grub_efi_device_path_t header
;
450 grub_efi_uint8_t function
;
451 } __attribute__ ((packed
));
452 typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t
;
454 #define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3
456 struct grub_efi_memory_mapped_device_path
458 grub_efi_device_path_t header
;
459 grub_efi_uint32_t memory_type
;
460 grub_efi_physical_address_t start_address
;
461 grub_efi_physical_address_t end_address
;
462 } __attribute__ ((packed
));
463 typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t
;
465 #define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4
467 struct grub_efi_vendor_device_path
469 grub_efi_device_path_t header
;
470 grub_efi_guid_t vendor_guid
;
471 grub_efi_uint8_t vendor_defined_data
[0];
472 } __attribute__ ((packed
));
473 typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t
;
475 #define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5
477 struct grub_efi_controller_device_path
479 grub_efi_device_path_t header
;
480 grub_efi_uint32_t controller_number
;
481 } __attribute__ ((packed
));
482 typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t
;
484 /* ACPI Device Path. */
485 #define GRUB_EFI_ACPI_DEVICE_PATH_TYPE 2
487 #define GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE 1
489 struct grub_efi_acpi_device_path
491 grub_efi_device_path_t header
;
492 grub_efi_uint32_t hid
;
493 grub_efi_uint32_t uid
;
494 } __attribute__ ((packed
));
495 typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t
;
497 #define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2
499 struct grub_efi_expanded_acpi_device_path
501 grub_efi_device_path_t header
;
502 grub_efi_uint32_t hid
;
503 grub_efi_uint32_t uid
;
504 grub_efi_uint32_t cid
;
506 } __attribute__ ((packed
));
507 typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t
;
509 #define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
510 (((grub_efi_expanded_acpi_device_path_t *) dp)->hidstr)
511 #define GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp) \
512 (GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
513 + grub_strlen (GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp)) + 1)
514 #define GRUB_EFI_EXPANDED_ACPI_CIDSTR(dp) \
515 (GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp) \
516 + grub_strlen (GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp)) + 1)
518 /* Messaging Device Path. */
519 #define GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE 3
521 #define GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE 1
523 struct grub_efi_atapi_device_path
525 grub_efi_device_path_t header
;
526 grub_efi_uint8_t primary_secondary
;
527 grub_efi_uint8_t slave_master
;
528 grub_efi_uint16_t lun
;
529 } __attribute__ ((packed
));
530 typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t
;
532 #define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2
534 struct grub_efi_scsi_device_path
536 grub_efi_device_path_t header
;
537 grub_efi_uint16_t pun
;
538 grub_efi_uint16_t lun
;
539 } __attribute__ ((packed
));
540 typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t
;
542 #define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3
544 struct grub_efi_fibre_channel_device_path
546 grub_efi_device_path_t header
;
547 grub_efi_uint32_t reserved
;
548 grub_efi_uint64_t wwn
;
549 grub_efi_uint64_t lun
;
550 } __attribute__ ((packed
));
551 typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t
;
553 #define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4
555 struct grub_efi_1394_device_path
557 grub_efi_device_path_t header
;
558 grub_efi_uint32_t reserved
;
559 grub_efi_uint64_t guid
;
560 } __attribute__ ((packed
));
561 typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t
;
563 #define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5
565 struct grub_efi_usb_device_path
567 grub_efi_device_path_t header
;
568 grub_efi_uint8_t parent_port_number
;
569 grub_efi_uint8_t interface
;
570 } __attribute__ ((packed
));
571 typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t
;
573 #define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15
575 struct grub_efi_usb_class_device_path
577 grub_efi_device_path_t header
;
578 grub_efi_uint16_t vendor_id
;
579 grub_efi_uint16_t product_id
;
580 grub_efi_uint8_t device_class
;
581 grub_efi_uint8_t device_subclass
;
582 grub_efi_uint8_t device_protocol
;
583 } __attribute__ ((packed
));
584 typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t
;
586 #define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6
588 struct grub_efi_i2o_device_path
590 grub_efi_device_path_t header
;
591 grub_efi_uint32_t tid
;
592 } __attribute__ ((packed
));
593 typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t
;
595 #define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11
597 struct grub_efi_mac_address_device_path
599 grub_efi_device_path_t header
;
600 grub_efi_mac_address_t mac_address
;
601 grub_efi_uint8_t if_type
;
602 } __attribute__ ((packed
));
603 typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t
;
605 #define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12
607 struct grub_efi_ipv4_device_path
609 grub_efi_device_path_t header
;
610 grub_efi_ipv4_address_t local_ip_address
;
611 grub_efi_ipv4_address_t remote_ip_address
;
612 grub_efi_uint16_t local_port
;
613 grub_efi_uint16_t remote_port
;
614 grub_efi_uint16_t protocol
;
615 grub_efi_uint8_t static_ip_address
;
616 } __attribute__ ((packed
));
617 typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t
;
619 #define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13
621 struct grub_efi_ipv6_device_path
623 grub_efi_device_path_t header
;
624 grub_efi_ipv6_address_t local_ip_address
;
625 grub_efi_ipv6_address_t remote_ip_address
;
626 grub_efi_uint16_t local_port
;
627 grub_efi_uint16_t remote_port
;
628 grub_efi_uint16_t protocol
;
629 grub_efi_uint8_t static_ip_address
;
630 } __attribute__ ((packed
));
631 typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t
;
633 #define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9
635 struct grub_efi_infiniband_device_path
637 grub_efi_device_path_t header
;
638 grub_efi_uint32_t resource_flags
;
639 grub_efi_uint8_t port_gid
[16];
640 grub_efi_uint64_t remote_id
;
641 grub_efi_uint64_t target_port_id
;
642 grub_efi_uint64_t device_id
;
643 } __attribute__ ((packed
));
644 typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t
;
646 #define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14
648 struct grub_efi_uart_device_path
650 grub_efi_device_path_t header
;
651 grub_efi_uint32_t reserved
;
652 grub_efi_uint64_t baud_rate
;
653 grub_efi_uint8_t data_bits
;
654 grub_efi_uint8_t parity
;
655 grub_efi_uint8_t stop_bits
;
656 } __attribute__ ((packed
));
657 typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t
;
659 #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
661 struct grub_efi_vendor_messaging_device_path
663 grub_efi_device_path_t header
;
664 grub_efi_guid_t vendor_guid
;
665 grub_efi_uint8_t vendor_defined_data
[0];
666 } __attribute__ ((packed
));
667 typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t
;
669 /* Media Device Path. */
670 #define GRUB_EFI_MEDIA_DEVICE_PATH_TYPE 4
672 #define GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE 1
674 struct grub_efi_hard_drive_device_path
676 grub_efi_device_path_t header
;
677 grub_efi_uint32_t partition_number
;
678 grub_efi_lba_t partition_start
;
679 grub_efi_lba_t partition_size
;
680 grub_efi_uint8_t partition_signature
[8];
681 grub_efi_uint8_t mbr_type
;
682 grub_efi_uint8_t signature_type
;
683 } __attribute__ ((packed
));
684 typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t
;
686 #define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2
688 struct grub_efi_cdrom_device_path
690 grub_efi_device_path_t header
;
691 grub_efi_uint32_t boot_entry
;
692 grub_efi_lba_t partition_start
;
693 grub_efi_lba_t partition_size
;
694 } __attribute__ ((packed
));
695 typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t
;
697 #define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3
699 struct grub_efi_vendor_media_device_path
701 grub_efi_device_path_t header
;
702 grub_efi_guid_t vendor_guid
;
703 grub_efi_uint8_t vendor_defined_data
[0];
704 } __attribute__ ((packed
));
705 typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t
;
707 #define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4
709 struct grub_efi_file_path_device_path
711 grub_efi_device_path_t header
;
712 grub_efi_char16_t path_name
[0];
713 } __attribute__ ((packed
));
714 typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t
;
716 #define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5
718 struct grub_efi_protocol_device_path
720 grub_efi_device_path_t header
;
721 grub_efi_guid_t guid
;
722 } __attribute__ ((packed
));
723 typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t
;
725 #define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6
727 struct grub_efi_piwg_device_path
729 grub_efi_device_path_t header
;
730 grub_efi_guid_t guid
__attribute__ ((packed
));
731 } __attribute__ ((packed
));
732 typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t
;
735 /* BIOS Boot Specification Device Path. */
736 #define GRUB_EFI_BIOS_DEVICE_PATH_TYPE 5
738 #define GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE 1
740 struct grub_efi_bios_device_path
742 grub_efi_device_path_t header
;
743 grub_efi_uint16_t device_type
;
744 grub_efi_uint16_t status_flags
;
746 } __attribute__ ((packed
));
747 typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t
;
749 struct grub_efi_open_protocol_information_entry
751 grub_efi_handle_t agent_handle
;
752 grub_efi_handle_t controller_handle
;
753 grub_efi_uint32_t attributes
;
754 grub_efi_uint32_t open_count
;
756 typedef struct grub_efi_open_protocol_information_entry grub_efi_open_protocol_information_entry_t
;
760 grub_efi_uint16_t year
;
761 grub_efi_uint8_t month
;
762 grub_efi_uint8_t day
;
763 grub_efi_uint8_t hour
;
764 grub_efi_uint8_t minute
;
765 grub_efi_uint8_t second
;
766 grub_efi_uint8_t pad1
;
767 grub_efi_uint32_t nanosecond
;
768 grub_efi_int16_t time_zone
;
769 grub_efi_uint8_t daylight
;
770 grub_efi_uint8_t pad2
;
771 } __attribute__ ((packed
));
772 typedef struct grub_efi_time grub_efi_time_t
;
774 struct grub_efi_time_capabilities
776 grub_efi_uint32_t resolution
;
777 grub_efi_uint32_t accuracy
;
778 grub_efi_boolean_t sets_to_zero
;
780 typedef struct grub_efi_time_capabilities grub_efi_time_capabilities_t
;
782 struct grub_efi_input_key
784 grub_efi_uint16_t scan_code
;
785 grub_efi_char16_t unicode_char
;
787 typedef struct grub_efi_input_key grub_efi_input_key_t
;
789 struct grub_efi_simple_text_output_mode
791 grub_efi_int32_t max_mode
;
792 grub_efi_int32_t mode
;
793 grub_efi_int32_t attribute
;
794 grub_efi_int32_t cursor_column
;
795 grub_efi_int32_t cursor_row
;
796 grub_efi_boolean_t cursor_visible
;
798 typedef struct grub_efi_simple_text_output_mode grub_efi_simple_text_output_mode_t
;
801 struct grub_efi_table_header
803 grub_efi_uint64_t signature
;
804 grub_efi_uint32_t revision
;
805 grub_efi_uint32_t header_size
;
806 grub_efi_uint32_t crc32
;
807 grub_efi_uint32_t reserved
;
809 typedef struct grub_efi_table_header grub_efi_table_header_t
;
811 struct grub_efi_boot_services
813 grub_efi_table_header_t hdr
;
816 (*raise_tpl
) (grub_efi_tpl_t new_tpl
);
819 (*restore_tpl
) (grub_efi_tpl_t old_tpl
);
822 (*allocate_pages
) (grub_efi_allocate_type_t type
,
823 grub_efi_memory_type_t memory_type
,
824 grub_efi_uintn_t pages
,
825 grub_efi_physical_address_t
*memory
);
828 (*free_pages
) (grub_efi_physical_address_t memory
,
829 grub_efi_uintn_t pages
);
832 (*get_memory_map
) (grub_efi_uintn_t
*memory_map_size
,
833 grub_efi_memory_descriptor_t
*memory_map
,
834 grub_efi_uintn_t
*map_key
,
835 grub_efi_uintn_t
*descriptor_size
,
836 grub_efi_uint32_t
*descriptor_version
);
839 (*allocate_pool
) (grub_efi_memory_type_t pool_type
,
840 grub_efi_uintn_t size
,
844 (*free_pool
) (void *buffer
);
847 (*create_event
) (grub_efi_uint32_t type
,
848 grub_efi_tpl_t notify_tpl
,
849 void (*notify_function
) (grub_efi_event_t event
,
851 void *notify_context
,
852 grub_efi_event_t
*event
);
855 (*set_timer
) (grub_efi_event_t event
,
856 grub_efi_timer_delay_t type
,
857 grub_efi_uint64_t trigger_time
);
860 (*wait_for_event
) (grub_efi_uintn_t num_events
,
861 grub_efi_event_t
*event
,
862 grub_efi_uintn_t
*index
);
865 (*signal_event
) (grub_efi_event_t event
);
868 (*close_event
) (grub_efi_event_t event
);
871 (*check_event
) (grub_efi_event_t event
);
874 (*install_protocol_interface
) (grub_efi_handle_t
*handle
,
875 grub_efi_guid_t
*protocol
,
876 grub_efi_interface_type_t interface_type
,
880 (*reinstall_protocol_interface
) (grub_efi_handle_t handle
,
881 grub_efi_guid_t
*protocol
,
883 void *new_interface
);
886 (*uninstall_protocol_interface
) (grub_efi_handle_t handle
,
887 grub_efi_guid_t
*protocol
,
891 (*handle_protocol
) (grub_efi_handle_t handle
,
892 grub_efi_guid_t
*protocol
,
898 (*register_protocol_notify
) (grub_efi_guid_t
*protocol
,
899 grub_efi_event_t event
,
900 void **registration
);
903 (*locate_handle
) (grub_efi_locate_search_type_t search_type
,
904 grub_efi_guid_t
*protocol
,
906 grub_efi_uintn_t
*buffer_size
,
907 grub_efi_handle_t
*buffer
);
910 (*locate_device_path
) (grub_efi_guid_t
*protocol
,
911 grub_efi_device_path_t
**device_path
,
912 grub_efi_handle_t
*device
);
915 (*install_configuration_table
) (grub_efi_guid_t
*guid
, void *table
);
918 (*load_image
) (grub_efi_boolean_t boot_policy
,
919 grub_efi_handle_t parent_image_handle
,
920 grub_efi_device_path_t
*file_path
,
922 grub_efi_uintn_t source_size
,
923 grub_efi_handle_t
*image_handle
);
926 (*start_image
) (grub_efi_handle_t image_handle
,
927 grub_efi_uintn_t
*exit_data_size
,
928 grub_efi_char16_t
**exit_data
);
931 (*exit
) (grub_efi_handle_t image_handle
,
932 grub_efi_status_t exit_status
,
933 grub_efi_uintn_t exit_data_size
,
934 grub_efi_char16_t
*exit_data
) __attribute__((noreturn
));
937 (*unload_image
) (grub_efi_handle_t image_handle
);
940 (*exit_boot_services
) (grub_efi_handle_t image_handle
,
941 grub_efi_uintn_t map_key
);
944 (*get_next_monotonic_count
) (grub_efi_uint64_t
*count
);
947 (*stall
) (grub_efi_uintn_t microseconds
);
950 (*set_watchdog_timer
) (grub_efi_uintn_t timeout
,
951 grub_efi_uint64_t watchdog_code
,
952 grub_efi_uintn_t data_size
,
953 grub_efi_char16_t
*watchdog_data
);
956 (*connect_controller
) (grub_efi_handle_t controller_handle
,
957 grub_efi_handle_t
*driver_image_handle
,
958 grub_efi_device_path_protocol_t
*remaining_device_path
,
959 grub_efi_boolean_t recursive
);
962 (*disconnect_controller
) (grub_efi_handle_t controller_handle
,
963 grub_efi_handle_t driver_image_handle
,
964 grub_efi_handle_t child_handle
);
967 (*open_protocol
) (grub_efi_handle_t handle
,
968 grub_efi_guid_t
*protocol
,
970 grub_efi_handle_t agent_handle
,
971 grub_efi_handle_t controller_handle
,
972 grub_efi_uint32_t attributes
);
975 (*close_protocol
) (grub_efi_handle_t handle
,
976 grub_efi_guid_t
*protocol
,
977 grub_efi_handle_t agent_handle
,
978 grub_efi_handle_t controller_handle
);
981 (*open_protocol_information
) (grub_efi_handle_t handle
,
982 grub_efi_guid_t
*protocol
,
983 grub_efi_open_protocol_information_entry_t
**entry_buffer
,
984 grub_efi_uintn_t
*entry_count
);
987 (*protocols_per_handle
) (grub_efi_handle_t handle
,
988 grub_efi_guid_t
***protocol_buffer
,
989 grub_efi_uintn_t
*protocol_buffer_count
);
992 (*locate_handle_buffer
) (grub_efi_locate_search_type_t search_type
,
993 grub_efi_guid_t
*protocol
,
995 grub_efi_uintn_t
*no_handles
,
996 grub_efi_handle_t
**buffer
);
999 (*locate_protocol
) (grub_efi_guid_t
*protocol
,
1004 (*install_multiple_protocol_interfaces
) (grub_efi_handle_t
*handle
, ...);
1007 (*uninstall_multiple_protocol_interfaces
) (grub_efi_handle_t handle
, ...);
1010 (*calculate_crc32
) (void *data
,
1011 grub_efi_uintn_t data_size
,
1012 grub_efi_uint32_t
*crc32
);
1015 (*copy_mem
) (void *destination
, void *source
, grub_efi_uintn_t length
);
1018 (*set_mem
) (void *buffer
, grub_efi_uintn_t size
, grub_efi_uint8_t value
);
1020 typedef struct grub_efi_boot_services grub_efi_boot_services_t
;
1022 struct grub_efi_runtime_services
1024 grub_efi_table_header_t hdr
;
1027 (*get_time
) (grub_efi_time_t
*time
,
1028 grub_efi_time_capabilities_t
*capabilities
);
1031 (*set_time
) (grub_efi_time_t
*time
);
1034 (*get_wakeup_time
) (grub_efi_boolean_t
*enabled
,
1035 grub_efi_boolean_t
*pending
,
1036 grub_efi_time_t
*time
);
1039 (*set_wakeup_time
) (grub_efi_boolean_t enabled
,
1040 grub_efi_time_t
*time
);
1043 (*set_virtual_address_map
) (grub_efi_uintn_t memory_map_size
,
1044 grub_efi_uintn_t descriptor_size
,
1045 grub_efi_uint32_t descriptor_version
,
1046 grub_efi_memory_descriptor_t
*virtual_map
);
1049 (*convert_pointer
) (grub_efi_uintn_t debug_disposition
, void **address
);
1051 #define GRUB_EFI_GLOBAL_VARIABLE_GUID \
1052 { 0x8BE4DF61, 0x93CA, 0x11d2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B,0x8C }}
1056 (*get_variable
) (grub_efi_char16_t
*variable_name
,
1057 const grub_efi_guid_t
*vendor_guid
,
1058 grub_efi_uint32_t
*attributes
,
1059 grub_efi_uintn_t
*data_size
,
1063 (*get_next_variable_name
) (grub_efi_uintn_t
*variable_name_size
,
1064 grub_efi_char16_t
*variable_name
,
1065 grub_efi_guid_t
*vendor_guid
);
1068 (*set_variable
) (grub_efi_char16_t
*variable_name
,
1069 grub_efi_guid_t
*vendor_guid
,
1070 grub_efi_uint32_t attributes
,
1071 grub_efi_uintn_t data_size
,
1075 (*get_next_high_monotonic_count
) (grub_efi_uint32_t
*high_count
);
1078 (*reset_system
) (grub_efi_reset_type_t reset_type
,
1079 grub_efi_status_t reset_status
,
1080 grub_efi_uintn_t data_size
,
1081 grub_efi_char16_t
*reset_data
);
1083 typedef struct grub_efi_runtime_services grub_efi_runtime_services_t
;
1085 struct grub_efi_configuration_table
1087 grub_efi_guid_t vendor_guid
;
1089 } __attribute__ ((packed
));
1090 typedef struct grub_efi_configuration_table grub_efi_configuration_table_t
;
1092 #define GRUB_EFIEMU_SYSTEM_TABLE_SIGNATURE 0x5453595320494249LL
1093 #define GRUB_EFIEMU_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552LL
1095 struct grub_efi_serial_io_interface
1097 grub_efi_uint32_t revision
;
1098 void (*reset
) (void);
1099 grub_efi_status_t (*set_attributes
) (struct grub_efi_serial_io_interface
*this,
1100 grub_efi_uint64_t speed
,
1101 grub_efi_uint32_t fifo_depth
,
1102 grub_efi_uint32_t timeout
,
1103 grub_efi_parity_type_t parity
,
1104 grub_uint8_t word_len
,
1105 grub_efi_stop_bits_t stop_bits
);
1106 void (*set_control_bits
) (void);
1107 void (*get_control_bits
) (void);
1108 grub_efi_status_t (*write
) (struct grub_efi_serial_io_interface
*this,
1109 grub_efi_uintn_t
*buf_size
,
1111 grub_efi_status_t (*read
) (struct grub_efi_serial_io_interface
*this,
1112 grub_efi_uintn_t
*buf_size
,
1116 struct grub_efi_simple_input_interface
1119 (*reset
) (struct grub_efi_simple_input_interface
*this,
1120 grub_efi_boolean_t extended_verification
);
1123 (*read_key_stroke
) (struct grub_efi_simple_input_interface
*this,
1124 grub_efi_input_key_t
*key
);
1126 grub_efi_event_t wait_for_key
;
1128 typedef struct grub_efi_simple_input_interface grub_efi_simple_input_interface_t
;
1130 struct grub_efi_simple_text_output_interface
1133 (*reset
) (struct grub_efi_simple_text_output_interface
*this,
1134 grub_efi_boolean_t extended_verification
);
1137 (*output_string
) (struct grub_efi_simple_text_output_interface
*this,
1138 grub_efi_char16_t
*string
);
1141 (*test_string
) (struct grub_efi_simple_text_output_interface
*this,
1142 grub_efi_char16_t
*string
);
1145 (*query_mode
) (struct grub_efi_simple_text_output_interface
*this,
1146 grub_efi_uintn_t mode_number
,
1147 grub_efi_uintn_t
*columns
,
1148 grub_efi_uintn_t
*rows
);
1151 (*set_mode
) (struct grub_efi_simple_text_output_interface
*this,
1152 grub_efi_uintn_t mode_number
);
1155 (*set_attributes
) (struct grub_efi_simple_text_output_interface
*this,
1156 grub_efi_uintn_t attribute
);
1159 (*clear_screen
) (struct grub_efi_simple_text_output_interface
*this);
1162 (*set_cursor_position
) (struct grub_efi_simple_text_output_interface
*this,
1163 grub_efi_uintn_t column
,
1164 grub_efi_uintn_t row
);
1167 (*enable_cursor
) (struct grub_efi_simple_text_output_interface
*this,
1168 grub_efi_boolean_t visible
);
1170 grub_efi_simple_text_output_mode_t
*mode
;
1172 typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t
;
1174 typedef grub_uint8_t grub_efi_pxe_packet_t
[1472];
1176 typedef struct grub_efi_pxe_mode
1178 grub_uint8_t unused
[52];
1179 grub_efi_pxe_packet_t dhcp_discover
;
1180 grub_efi_pxe_packet_t dhcp_ack
;
1181 grub_efi_pxe_packet_t proxy_offer
;
1182 grub_efi_pxe_packet_t pxe_discover
;
1183 grub_efi_pxe_packet_t pxe_reply
;
1184 } grub_efi_pxe_mode_t
;
1186 typedef struct grub_efi_pxe
1189 void (*start
) (void);
1190 void (*stop
) (void);
1191 void (*dhcp
) (void);
1192 void (*discover
) (void);
1193 void (*mftp
) (void);
1194 void (*udpwrite
) (void);
1195 void (*udpread
) (void);
1196 void (*setipfilter
) (void);
1198 void (*setparams
) (void);
1199 void (*setstationip
) (void);
1200 void (*setpackets
) (void);
1201 struct grub_efi_pxe_mode
*mode
;
1204 #define GRUB_EFI_BLACK 0x00
1205 #define GRUB_EFI_BLUE 0x01
1206 #define GRUB_EFI_GREEN 0x02
1207 #define GRUB_EFI_CYAN 0x03
1208 #define GRUB_EFI_RED 0x04
1209 #define GRUB_EFI_MAGENTA 0x05
1210 #define GRUB_EFI_BROWN 0x06
1211 #define GRUB_EFI_LIGHTGRAY 0x07
1212 #define GRUB_EFI_BRIGHT 0x08
1213 #define GRUB_EFI_DARKGRAY 0x08
1214 #define GRUB_EFI_LIGHTBLUE 0x09
1215 #define GRUB_EFI_LIGHTGREEN 0x0A
1216 #define GRUB_EFI_LIGHTCYAN 0x0B
1217 #define GRUB_EFI_LIGHTRED 0x0C
1218 #define GRUB_EFI_LIGHTMAGENTA 0x0D
1219 #define GRUB_EFI_YELLOW 0x0E
1220 #define GRUB_EFI_WHITE 0x0F
1222 #define GRUB_EFI_BACKGROUND_BLACK 0x00
1223 #define GRUB_EFI_BACKGROUND_BLUE 0x10
1224 #define GRUB_EFI_BACKGROUND_GREEN 0x20
1225 #define GRUB_EFI_BACKGROUND_CYAN 0x30
1226 #define GRUB_EFI_BACKGROUND_RED 0x40
1227 #define GRUB_EFI_BACKGROUND_MAGENTA 0x50
1228 #define GRUB_EFI_BACKGROUND_BROWN 0x60
1229 #define GRUB_EFI_BACKGROUND_LIGHTGRAY 0x70
1231 #define GRUB_EFI_TEXT_ATTR(fg, bg) ((fg) | ((bg)))
1233 struct grub_efi_system_table
1235 grub_efi_table_header_t hdr
;
1236 grub_efi_char16_t
*firmware_vendor
;
1237 grub_efi_uint32_t firmware_revision
;
1238 grub_efi_handle_t console_in_handler
;
1239 grub_efi_simple_input_interface_t
*con_in
;
1240 grub_efi_handle_t console_out_handler
;
1241 grub_efi_simple_text_output_interface_t
*con_out
;
1242 grub_efi_handle_t standard_error_handle
;
1243 grub_efi_simple_text_output_interface_t
*std_err
;
1244 grub_efi_runtime_services_t
*runtime_services
;
1245 grub_efi_boot_services_t
*boot_services
;
1246 grub_efi_uintn_t num_table_entries
;
1247 grub_efi_configuration_table_t
*configuration_table
;
1249 typedef struct grub_efi_system_table grub_efi_system_table_t
;
1251 struct grub_efi_loaded_image
1253 grub_efi_uint32_t revision
;
1254 grub_efi_handle_t parent_handle
;
1255 grub_efi_system_table_t
*system_table
;
1257 grub_efi_handle_t device_handle
;
1258 grub_efi_device_path_t
*file_path
;
1261 grub_efi_uint32_t load_options_size
;
1265 grub_efi_uint64_t image_size
;
1266 grub_efi_memory_type_t image_code_type
;
1267 grub_efi_memory_type_t image_data_type
;
1269 grub_efi_status_t (*unload
) (grub_efi_handle_t image_handle
);
1271 typedef struct grub_efi_loaded_image grub_efi_loaded_image_t
;
1273 struct grub_efi_disk_io
1275 grub_efi_uint64_t revision
;
1276 grub_efi_status_t (*read
) (struct grub_efi_disk_io
*this,
1277 grub_efi_uint32_t media_id
,
1278 grub_efi_uint64_t offset
,
1279 grub_efi_uintn_t buffer_size
,
1281 grub_efi_status_t (*write
) (struct grub_efi_disk_io
*this,
1282 grub_efi_uint32_t media_id
,
1283 grub_efi_uint64_t offset
,
1284 grub_efi_uintn_t buffer_size
,
1287 typedef struct grub_efi_disk_io grub_efi_disk_io_t
;
1289 struct grub_efi_block_io_media
1291 grub_efi_uint32_t media_id
;
1292 grub_efi_boolean_t removable_media
;
1293 grub_efi_boolean_t media_present
;
1294 grub_efi_boolean_t logical_partition
;
1295 grub_efi_boolean_t read_only
;
1296 grub_efi_boolean_t write_caching
;
1297 grub_efi_uint8_t pad
[3];
1298 grub_efi_uint32_t block_size
;
1299 grub_efi_uint32_t io_align
;
1300 grub_efi_uint8_t pad2
[4];
1301 grub_efi_lba_t last_block
;
1303 typedef struct grub_efi_block_io_media grub_efi_block_io_media_t
;
1305 typedef grub_uint8_t grub_efi_mac_t
[32];
1307 struct grub_efi_simple_network_mode
1309 grub_uint32_t state
;
1310 grub_uint32_t hwaddr_size
;
1311 grub_uint32_t media_header_size
;
1312 grub_uint32_t max_packet_size
;
1313 grub_uint32_t nvram_size
;
1314 grub_uint32_t nvram_access_size
;
1315 grub_uint32_t receive_filter_mask
;
1316 grub_uint32_t receive_filter_setting
;
1317 grub_uint32_t max_mcast_filter_count
;
1318 grub_uint32_t mcast_filter_count
;
1319 grub_efi_mac_t mcast_filter
[16];
1320 grub_efi_mac_t current_address
;
1321 grub_efi_mac_t broadcast_address
;
1322 grub_efi_mac_t permanent_address
;
1323 grub_uint8_t if_type
;
1324 grub_uint8_t mac_changeable
;
1325 grub_uint8_t multitx_supported
;
1326 grub_uint8_t media_present_supported
;
1327 grub_uint8_t media_present
;
1332 GRUB_EFI_NETWORK_STOPPED
,
1333 GRUB_EFI_NETWORK_STARTED
,
1334 GRUB_EFI_NETWORK_INITIALIZED
,
1337 struct grub_efi_simple_network
1339 grub_uint64_t revision
;
1340 grub_efi_status_t (*start
) (struct grub_efi_simple_network
*this);
1341 void (*stop
) (void);
1342 grub_efi_status_t (*initialize
) (struct grub_efi_simple_network
*this,
1343 grub_efi_uintn_t extra_rx
,
1344 grub_efi_uintn_t extra_tx
);
1345 void (*reset
) (void);
1346 void (*shutdown
) (void);
1347 void (*receive_filters
) (void);
1348 void (*station_address
) (void);
1349 void (*statistics
) (void);
1350 void (*mcastiptomac
) (void);
1351 void (*nvdata
) (void);
1352 grub_efi_status_t (*get_status
) (struct grub_efi_simple_network
*this,
1353 grub_uint32_t
*int_status
,
1355 grub_efi_status_t (*transmit
) (struct grub_efi_simple_network
*this,
1356 grub_efi_uintn_t header_size
,
1357 grub_efi_uintn_t buffer_size
,
1359 grub_efi_mac_t
*src_addr
,
1360 grub_efi_mac_t
*dest_addr
,
1361 grub_efi_uint16_t
*protocol
);
1362 grub_efi_status_t (*receive
) (struct grub_efi_simple_network
*this,
1363 grub_efi_uintn_t
*header_size
,
1364 grub_efi_uintn_t
*buffer_size
,
1366 grub_efi_mac_t
*src_addr
,
1367 grub_efi_mac_t
*dest_addr
,
1368 grub_uint16_t
*protocol
);
1369 void (*waitforpacket
) (void);
1370 struct grub_efi_simple_network_mode
*mode
;
1372 typedef struct grub_efi_simple_network grub_efi_simple_network_t
;
1375 struct grub_efi_block_io
1377 grub_efi_uint64_t revision
;
1378 grub_efi_block_io_media_t
*media
;
1379 grub_efi_status_t (*reset
) (struct grub_efi_block_io
*this,
1380 grub_efi_boolean_t extended_verification
);
1381 grub_efi_status_t (*read_blocks
) (struct grub_efi_block_io
*this,
1382 grub_efi_uint32_t media_id
,
1384 grub_efi_uintn_t buffer_size
,
1386 grub_efi_status_t (*write_blocks
) (struct grub_efi_block_io
*this,
1387 grub_efi_uint32_t media_id
,
1389 grub_efi_uintn_t buffer_size
,
1391 grub_efi_status_t (*flush_blocks
) (struct grub_efi_block_io
*this);
1393 typedef struct grub_efi_block_io grub_efi_block_io_t
;
1395 #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__)
1397 #define efi_call_0(func) func()
1398 #define efi_call_1(func, a) func(a)
1399 #define efi_call_2(func, a, b) func(a, b)
1400 #define efi_call_3(func, a, b, c) func(a, b, c)
1401 #define efi_call_4(func, a, b, c, d) func(a, b, c, d)
1402 #define efi_call_5(func, a, b, c, d, e) func(a, b, c, d, e)
1403 #define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f)
1404 #define efi_call_7(func, a, b, c, d, e, f, g) func(a, b, c, d, e, f, g)
1405 #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)
1409 #define efi_call_0(func) \
1411 #define efi_call_1(func, a) \
1412 efi_wrap_1(func, (grub_uint64_t) (a))
1413 #define efi_call_2(func, a, b) \
1414 efi_wrap_2(func, (grub_uint64_t) (a), (grub_uint64_t) (b))
1415 #define efi_call_3(func, a, b, c) \
1416 efi_wrap_3(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
1417 (grub_uint64_t) (c))
1418 #define efi_call_4(func, a, b, c, d) \
1419 efi_wrap_4(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
1420 (grub_uint64_t) (c), (grub_uint64_t) (d))
1421 #define efi_call_5(func, a, b, c, d, e) \
1422 efi_wrap_5(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
1423 (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e))
1424 #define efi_call_6(func, a, b, c, d, e, f) \
1425 efi_wrap_6(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
1426 (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
1427 (grub_uint64_t) (f))
1428 #define efi_call_7(func, a, b, c, d, e, f, g) \
1429 efi_wrap_7(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
1430 (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
1431 (grub_uint64_t) (f), (grub_uint64_t) (g))
1432 #define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \
1433 efi_wrap_10(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
1434 (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
1435 (grub_uint64_t) (f), (grub_uint64_t) (g), (grub_uint64_t) (h), \
1436 (grub_uint64_t) (i), (grub_uint64_t) (j))
1438 grub_uint64_t
EXPORT_FUNC(efi_wrap_0
) (void *func
);
1439 grub_uint64_t
EXPORT_FUNC(efi_wrap_1
) (void *func
, grub_uint64_t arg1
);
1440 grub_uint64_t
EXPORT_FUNC(efi_wrap_2
) (void *func
, grub_uint64_t arg1
,
1441 grub_uint64_t arg2
);
1442 grub_uint64_t
EXPORT_FUNC(efi_wrap_3
) (void *func
, grub_uint64_t arg1
,
1443 grub_uint64_t arg2
, grub_uint64_t arg3
);
1444 grub_uint64_t
EXPORT_FUNC(efi_wrap_4
) (void *func
, grub_uint64_t arg1
,
1445 grub_uint64_t arg2
, grub_uint64_t arg3
,
1446 grub_uint64_t arg4
);
1447 grub_uint64_t
EXPORT_FUNC(efi_wrap_5
) (void *func
, grub_uint64_t arg1
,
1448 grub_uint64_t arg2
, grub_uint64_t arg3
,
1449 grub_uint64_t arg4
, grub_uint64_t arg5
);
1450 grub_uint64_t
EXPORT_FUNC(efi_wrap_6
) (void *func
, grub_uint64_t arg1
,
1451 grub_uint64_t arg2
, grub_uint64_t arg3
,
1452 grub_uint64_t arg4
, grub_uint64_t arg5
,
1453 grub_uint64_t arg6
);
1454 grub_uint64_t
EXPORT_FUNC(efi_wrap_7
) (void *func
, grub_uint64_t arg1
,
1455 grub_uint64_t arg2
, grub_uint64_t arg3
,
1456 grub_uint64_t arg4
, grub_uint64_t arg5
,
1457 grub_uint64_t arg6
, grub_uint64_t arg7
);
1458 grub_uint64_t
EXPORT_FUNC(efi_wrap_10
) (void *func
, grub_uint64_t arg1
,
1459 grub_uint64_t arg2
, grub_uint64_t arg3
,
1460 grub_uint64_t arg4
, grub_uint64_t arg5
,
1461 grub_uint64_t arg6
, grub_uint64_t arg7
,
1462 grub_uint64_t arg8
, grub_uint64_t arg9
,
1463 grub_uint64_t arg10
);
1466 #endif /* ! GRUB_EFI_API_HEADER */