2 * Extensible Firmware Interface
3 * Based on 'Extensible Firmware Interface Specification' version 0.9,
6 * Copyright (C) 1999 VA Linux Systems
7 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
8 * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
9 * David Mosberger-Tang <davidm@hpl.hp.com>
10 * Stephane Eranian <eranian@hpl.hp.com>
12 * From include/linux/efi.h in kernel 4.1 with some additions/subtractions
20 /* EFI Boot Services table */
21 struct efi_boot_services
{
22 struct efi_table_hdr hdr
;
26 efi_status_t (EFIAPI
*allocate_pages
)(int, int, unsigned long,
27 efi_physical_addr_t
*);
28 efi_status_t (EFIAPI
*free_pages
)(efi_physical_addr_t
, unsigned long);
29 efi_status_t (EFIAPI
*get_memory_map
)(unsigned long *memory_map_size
,
30 struct efi_mem_desc
*desc
, unsigned long *key
,
31 unsigned long *desc_size
, u32
*desc_version
);
32 efi_status_t (EFIAPI
*allocate_pool
)(int, unsigned long, void **);
33 efi_status_t (EFIAPI
*free_pool
)(void *);
37 efi_status_t(EFIAPI
*wait_for_event
)(unsigned long number_of_events
,
38 void *event
, unsigned long *index
);
43 void *install_protocol_interface
;
44 void *reinstall_protocol_interface
;
45 void *uninstall_protocol_interface
;
46 efi_status_t (EFIAPI
*handle_protocol
)(efi_handle_t
, efi_guid_t
*,
49 void *register_protocol_notify
;
50 efi_status_t (EFIAPI
*locate_handle
)(
51 enum efi_locate_search_type search_type
,
52 efi_guid_t
*protocol
, void *search_key
,
53 unsigned long *buffer_size
, efi_handle_t
*buffer
);
54 efi_status_t (EFIAPI
*locate_device_path
)(efi_guid_t
*protocol
,
55 struct efi_device_path
**device_path
,
56 efi_handle_t
*device
);
57 void *install_configuration_table
;
59 efi_status_t (EFIAPI
*load_image
)(bool boot_policiy
,
60 efi_handle_t parent_image
,
61 struct efi_device_path
*file_path
, void *source_buffer
,
62 unsigned long source_size
, efi_handle_t
*image
);
63 efi_status_t (EFIAPI
*start_image
)(efi_handle_t handle
,
64 unsigned long *exitdata_size
,
66 efi_status_t (EFIAPI
*exit
)(efi_handle_t handle
,
67 efi_status_t exit_status
,
68 unsigned long exitdata_size
, s16
*exitdata
);
70 efi_status_t (EFIAPI
*exit_boot_services
)(efi_handle_t
, unsigned long);
72 efi_status_t (EFIAPI
*get_next_monotonic_count
)(u64
*count
);
73 efi_status_t (EFIAPI
*stall
)(unsigned long usecs
);
74 void *set_watchdog_timer
;
75 efi_status_t(EFIAPI
*connect_controller
)(efi_handle_t controller_handle
,
76 efi_handle_t
*driver_image_handle
,
77 struct efi_device_path
*remaining_device_path
,
79 void *disconnect_controller
;
80 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
81 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
82 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
83 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
84 #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
85 #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
86 efi_status_t (EFIAPI
*open_protocol
)(efi_handle_t handle
,
87 efi_guid_t
*protocol
, void **interface
,
88 efi_handle_t agent_handle
,
89 efi_handle_t controller_handle
, u32 attributes
);
91 efi_status_t(EFIAPI
*open_protocol_information
)(efi_handle_t handle
,
93 struct efi_open_protocol_info_entry
**entry_buffer
,
94 unsigned long *entry_count
);
95 efi_status_t (EFIAPI
*protocols_per_handle
)(efi_handle_t handle
,
96 efi_guid_t
***protocol_buffer
,
97 unsigned long *protocols_buffer_count
);
98 efi_status_t (EFIAPI
*locate_handle_buffer
) (
99 enum efi_locate_search_type search_type
,
100 efi_guid_t
*protocol
, void *search_key
,
101 unsigned long *no_handles
, efi_handle_t
**buffer
);
102 void *locate_protocol
;
103 void *install_multiple_protocol_interfaces
;
104 void *uninstall_multiple_protocol_interfaces
;
105 void *calculate_crc32
;
108 void *create_event_ex
;
111 /* Types and defines for EFI ResetSystem */
112 enum efi_reset_type
{
115 EFI_RESET_SHUTDOWN
= 2
118 /* EFI Runtime Services table */
119 #define EFI_RUNTIME_SERVICES_SIGNATURE 0x5652453544e5552ULL
120 #define EFI_RUNTIME_SERVICES_REVISION 0x00010000
122 struct efi_runtime_services
{
123 struct efi_table_hdr hdr
;
126 void *get_wakeup_time
;
127 void *set_wakeup_time
;
128 void *set_virtual_address_map
;
129 void *convert_pointer
;
130 efi_status_t (EFIAPI
*get_variable
)(s16
*variable_name
,
131 efi_guid_t
*vendor
, u32
*attributes
,
132 unsigned long *data_size
, void *data
);
133 efi_status_t (EFIAPI
*get_next_variable
)(
134 unsigned long *variable_name_size
,
135 s16
*variable_name
, efi_guid_t
*vendor
);
136 efi_status_t (EFIAPI
*set_variable
)(s16
*variable_name
,
137 efi_guid_t
*vendor
, u32 attributes
,
138 unsigned long data_size
, void *data
);
139 void *get_next_high_mono_count
;
140 void (EFIAPI
*reset_system
)(enum efi_reset_type reset_type
,
141 efi_status_t reset_status
,
142 unsigned long data_size
, void *reset_data
);
143 void *update_capsule
;
144 void *query_capsule_caps
;
145 void *query_variable_info
;
148 /* EFI Configuration Table and GUID definitions */
150 EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
153 #define LOADED_IMAGE_PROTOCOL_GUID \
154 EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, \
155 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
157 struct efi_system_table
{
158 struct efi_table_hdr hdr
;
159 unsigned long fw_vendor
; /* physical addr of wchar_t vendor string */
161 unsigned long con_in_handle
;
162 struct efi_simple_input_interface
*con_in
;
163 unsigned long con_out_handle
;
164 struct efi_simple_text_output_protocol
*con_out
;
165 unsigned long stderr_handle
;
166 unsigned long std_err
;
167 struct efi_runtime_services
*runtime
;
168 struct efi_boot_services
*boottime
;
169 unsigned long nr_tables
;
170 unsigned long tables
;
173 struct efi_loaded_image
{
176 struct efi_system_table
*system_table
;
180 u32 load_options_size
;
183 aligned_u64 image_size
;
184 unsigned int image_code_type
;
185 unsigned int image_data_type
;
186 unsigned long unload
;
189 struct efi_device_path
{
195 struct simple_text_output_mode
{
204 struct efi_simple_text_output_protocol
{
206 efi_status_t (EFIAPI
*output_string
)(
207 struct efi_simple_text_output_protocol
*this,
208 const unsigned short *str
);
211 efi_status_t(EFIAPI
*query_mode
)(
212 struct efi_simple_text_output_protocol
*this,
213 unsigned long mode_number
, unsigned long *columns
,
214 unsigned long *rows
);
215 efi_status_t(EFIAPI
*set_mode
)(
216 struct efi_simple_text_output_protocol
*this,
217 unsigned long mode_number
);
218 efi_status_t(EFIAPI
*set_attribute
)(
219 struct efi_simple_text_output_protocol
*this,
220 unsigned long attribute
);
221 efi_status_t(EFIAPI
*clear_screen
) (
222 struct efi_simple_text_output_protocol
*this);
223 efi_status_t(EFIAPI
*set_cursor_position
) (
224 struct efi_simple_text_output_protocol
*this,
225 unsigned long column
, unsigned long row
);
226 efi_status_t(EFIAPI
*enable_cursor
)(void *, bool enable
);
227 struct simple_text_output_mode
*mode
;
230 struct efi_input_key
{
235 struct efi_simple_input_interface
{
236 efi_status_t(EFIAPI
*reset
)(struct efi_simple_input_interface
*this,
237 bool ExtendedVerification
);
238 efi_status_t(EFIAPI
*read_key_stroke
)(
239 struct efi_simple_input_interface
*this,
240 struct efi_input_key
*key
);