1 | #ifndef _SYSLINUX_EFI_H |
---|
2 | #define _SYSLINUX_EFI_H |
---|
3 | |
---|
4 | #include <syslinux/config.h> |
---|
5 | #include <core.h> |
---|
6 | #include <sys/types.h> /* needed for off_t */ |
---|
7 | //#include <syslinux/version.h> /* avoid redefinition of __STDC_VERSION__ */ |
---|
8 | |
---|
9 | /* |
---|
10 | * gnu-efi >= 3.0s enables GNU_EFI_USE_MS_ABI by default, which means |
---|
11 | * that we must also enable it if supported by the compiler. Note that |
---|
12 | * failing to enable GNU_EFI_USE_MS_ABI if gnu-efi was compiled with |
---|
13 | * it on will result in undefined references to uefi_call_wrapper(). |
---|
14 | * |
---|
15 | * The reason we don't attempt to check the version of gnu-efi we're |
---|
16 | * building against is because there's no harm in turning it on for |
---|
17 | * older versions - it will just be ignored. |
---|
18 | */ |
---|
19 | #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) |
---|
20 | #define GNU_EFI_USE_MS_ABI 1 |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <efi.h> |
---|
24 | #include <efilib.h> |
---|
25 | #include <efistdarg.h> |
---|
26 | |
---|
27 | /* Delay for 100 ms */ |
---|
28 | #define EFI_NOMAP_PRINT_DELAY 100 |
---|
29 | /* We should keep EFI_NOMAP_PRINT_COUNT at 10 to limit flooding the console */ |
---|
30 | #define EFI_NOMAP_PRINT_COUNT 10 |
---|
31 | |
---|
32 | struct efi_disk_private { |
---|
33 | EFI_HANDLE dev_handle; |
---|
34 | EFI_BLOCK_IO *bio; |
---|
35 | EFI_DISK_IO *dio; |
---|
36 | }; |
---|
37 | |
---|
38 | struct efi_binding { |
---|
39 | EFI_SERVICE_BINDING *binding; |
---|
40 | EFI_HANDLE parent; |
---|
41 | EFI_HANDLE child; |
---|
42 | EFI_HANDLE this; |
---|
43 | }; |
---|
44 | |
---|
45 | extern EFI_HANDLE image_handle; |
---|
46 | |
---|
47 | struct screen_info; |
---|
48 | extern void setup_screen(struct screen_info *); |
---|
49 | |
---|
50 | extern void efi_write_char(uint8_t, uint8_t); |
---|
51 | |
---|
52 | enum heap; |
---|
53 | extern void *efi_malloc(size_t, enum heap, size_t); |
---|
54 | extern void *efi_realloc(void *, size_t); |
---|
55 | extern void efi_free(void *); |
---|
56 | |
---|
57 | extern struct efi_binding *efi_create_binding(EFI_GUID *, EFI_GUID *); |
---|
58 | extern void efi_destroy_binding(struct efi_binding *, EFI_GUID *); |
---|
59 | |
---|
60 | static inline EFI_STATUS |
---|
61 | efi_setup_event(EFI_EVENT *ev, EFI_EVENT_NOTIFY func, void *ctx) |
---|
62 | { |
---|
63 | EFI_STATUS status; |
---|
64 | |
---|
65 | status = uefi_call_wrapper(BS->CreateEvent, 5, EVT_NOTIFY_SIGNAL, |
---|
66 | TPL_CALLBACK, func, ctx, ev); |
---|
67 | return status; |
---|
68 | } |
---|
69 | |
---|
70 | extern void efi_derivative(enum syslinux_filesystem fs); |
---|
71 | |
---|
72 | struct boot_params; |
---|
73 | typedef void (handover_func_t)(void *, EFI_SYSTEM_TABLE *, |
---|
74 | struct boot_params *, unsigned long); |
---|
75 | |
---|
76 | handover_func_t efi_handover_32; |
---|
77 | handover_func_t efi_handover_64; |
---|
78 | handover_func_t efi_handover; |
---|
79 | |
---|
80 | extern void efi_console_save(void); |
---|
81 | extern void efi_console_restore(void); |
---|
82 | |
---|
83 | #endif /* _SYSLINUX_EFI_H */ |
---|