]>
Commit | Line | Data |
---|---|---|
867a6ac8 SG |
1 | /* |
2 | * Extensible Firmware Interface | |
3 | * Based on 'Extensible Firmware Interface Specification' version 0.9, | |
4 | * April 30, 1999 | |
5 | * | |
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> | |
11 | * | |
12 | * From include/linux/efi.h in kernel 4.1 with some additions/subtractions | |
13 | */ | |
14 | ||
15 | #ifndef _EFI_API_H | |
16 | #define _EFI_API_H | |
17 | ||
18 | #include <efi.h> | |
19 | ||
a86aeaf2 AG |
20 | #ifdef CONFIG_EFI_LOADER |
21 | #include <asm/setjmp.h> | |
22 | #endif | |
23 | ||
2bb9b79d AG |
24 | /* Types and defines for EFI CreateEvent */ |
25 | enum efi_event_type { | |
26 | EFI_TIMER_STOP = 0, | |
27 | EFI_TIMER_PERIODIC = 1, | |
28 | EFI_TIMER_RELATIVE = 2 | |
29 | }; | |
30 | ||
37a980b3 JG |
31 | #define EVT_NOTIFY_WAIT 0x00000100 |
32 | #define EVT_NOTIFY_SIGNAL 0x00000200 | |
33 | ||
867a6ac8 SG |
34 | /* EFI Boot Services table */ |
35 | struct efi_boot_services { | |
36 | struct efi_table_hdr hdr; | |
2bb9b79d AG |
37 | efi_status_t (EFIAPI *raise_tpl)(unsigned long new_tpl); |
38 | void (EFIAPI *restore_tpl)(unsigned long old_tpl); | |
867a6ac8 SG |
39 | |
40 | efi_status_t (EFIAPI *allocate_pages)(int, int, unsigned long, | |
41 | efi_physical_addr_t *); | |
42 | efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, unsigned long); | |
43 | efi_status_t (EFIAPI *get_memory_map)(unsigned long *memory_map_size, | |
44 | struct efi_mem_desc *desc, unsigned long *key, | |
45 | unsigned long *desc_size, u32 *desc_version); | |
46 | efi_status_t (EFIAPI *allocate_pool)(int, unsigned long, void **); | |
47 | efi_status_t (EFIAPI *free_pool)(void *); | |
48 | ||
2bb9b79d AG |
49 | efi_status_t (EFIAPI *create_event)(enum efi_event_type type, |
50 | unsigned long notify_tpl, | |
51 | void (EFIAPI *notify_function) (void *event, | |
52 | void *context), | |
53 | void *notify_context, void **event); | |
54 | efi_status_t (EFIAPI *set_timer)(void *event, int type, | |
55 | uint64_t trigger_time); | |
56 | efi_status_t (EFIAPI *wait_for_event)(unsigned long number_of_events, | |
57 | void *event, unsigned long *index); | |
58 | efi_status_t (EFIAPI *signal_event)(void *event); | |
59 | efi_status_t (EFIAPI *close_event)(void *event); | |
60 | efi_status_t (EFIAPI *check_event)(void *event); | |
61 | ||
62 | efi_status_t (EFIAPI *install_protocol_interface)( | |
63 | void **handle, efi_guid_t *protocol, | |
64 | int protocol_interface_type, void *protocol_interface); | |
65 | efi_status_t (EFIAPI *reinstall_protocol_interface)( | |
66 | void *handle, efi_guid_t *protocol, | |
67 | void *old_interface, void *new_interface); | |
68 | efi_status_t (EFIAPI *uninstall_protocol_interface)(void *handle, | |
69 | efi_guid_t *protocol, void *protocol_interface); | |
867a6ac8 SG |
70 | efi_status_t (EFIAPI *handle_protocol)(efi_handle_t, efi_guid_t *, |
71 | void **); | |
72 | void *reserved; | |
2bb9b79d AG |
73 | efi_status_t (EFIAPI *register_protocol_notify)( |
74 | efi_guid_t *protocol, void *event, | |
75 | void **registration); | |
867a6ac8 SG |
76 | efi_status_t (EFIAPI *locate_handle)( |
77 | enum efi_locate_search_type search_type, | |
78 | efi_guid_t *protocol, void *search_key, | |
79 | unsigned long *buffer_size, efi_handle_t *buffer); | |
80 | efi_status_t (EFIAPI *locate_device_path)(efi_guid_t *protocol, | |
81 | struct efi_device_path **device_path, | |
82 | efi_handle_t *device); | |
2bb9b79d AG |
83 | efi_status_t (EFIAPI *install_configuration_table)( |
84 | efi_guid_t *guid, void *table); | |
867a6ac8 SG |
85 | |
86 | efi_status_t (EFIAPI *load_image)(bool boot_policiy, | |
87 | efi_handle_t parent_image, | |
88 | struct efi_device_path *file_path, void *source_buffer, | |
89 | unsigned long source_size, efi_handle_t *image); | |
90 | efi_status_t (EFIAPI *start_image)(efi_handle_t handle, | |
91 | unsigned long *exitdata_size, | |
92 | s16 **exitdata); | |
93 | efi_status_t (EFIAPI *exit)(efi_handle_t handle, | |
94 | efi_status_t exit_status, | |
95 | unsigned long exitdata_size, s16 *exitdata); | |
2bb9b79d | 96 | efi_status_t (EFIAPI *unload_image)(void *image_handle); |
867a6ac8 SG |
97 | efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long); |
98 | ||
99 | efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count); | |
100 | efi_status_t (EFIAPI *stall)(unsigned long usecs); | |
2bb9b79d AG |
101 | efi_status_t (EFIAPI *set_watchdog_timer)(unsigned long timeout, |
102 | uint64_t watchdog_code, unsigned long data_size, | |
103 | uint16_t *watchdog_data); | |
867a6ac8 SG |
104 | efi_status_t(EFIAPI *connect_controller)(efi_handle_t controller_handle, |
105 | efi_handle_t *driver_image_handle, | |
106 | struct efi_device_path *remaining_device_path, | |
107 | bool recursive); | |
2bb9b79d AG |
108 | efi_status_t (EFIAPI *disconnect_controller)(void *controller_handle, |
109 | void *driver_image_handle, void *child_handle); | |
867a6ac8 SG |
110 | #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 |
111 | #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 | |
112 | #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 | |
113 | #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 | |
114 | #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 | |
115 | #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 | |
116 | efi_status_t (EFIAPI *open_protocol)(efi_handle_t handle, | |
117 | efi_guid_t *protocol, void **interface, | |
118 | efi_handle_t agent_handle, | |
119 | efi_handle_t controller_handle, u32 attributes); | |
2bb9b79d AG |
120 | efi_status_t (EFIAPI *close_protocol)(void *handle, |
121 | efi_guid_t *protocol, void *agent_handle, | |
122 | void *controller_handle); | |
867a6ac8 SG |
123 | efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle, |
124 | efi_guid_t *protocol, | |
125 | struct efi_open_protocol_info_entry **entry_buffer, | |
126 | unsigned long *entry_count); | |
127 | efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle, | |
128 | efi_guid_t ***protocol_buffer, | |
129 | unsigned long *protocols_buffer_count); | |
130 | efi_status_t (EFIAPI *locate_handle_buffer) ( | |
131 | enum efi_locate_search_type search_type, | |
132 | efi_guid_t *protocol, void *search_key, | |
133 | unsigned long *no_handles, efi_handle_t **buffer); | |
2bb9b79d AG |
134 | efi_status_t (EFIAPI *locate_protocol)(efi_guid_t *protocol, |
135 | void *registration, void **protocol_interface); | |
136 | efi_status_t (EFIAPI *install_multiple_protocol_interfaces)( | |
137 | void **handle, ...); | |
138 | efi_status_t (EFIAPI *uninstall_multiple_protocol_interfaces)( | |
139 | void *handle, ...); | |
140 | efi_status_t (EFIAPI *calculate_crc32)(void *data, | |
141 | unsigned long data_size, uint32_t *crc32); | |
142 | void (EFIAPI *copy_mem)(void *destination, void *source, | |
143 | unsigned long length); | |
144 | void (EFIAPI *set_mem)(void *buffer, unsigned long size, | |
145 | uint8_t value); | |
867a6ac8 SG |
146 | void *create_event_ex; |
147 | }; | |
148 | ||
149 | /* Types and defines for EFI ResetSystem */ | |
150 | enum efi_reset_type { | |
151 | EFI_RESET_COLD = 0, | |
152 | EFI_RESET_WARM = 1, | |
153 | EFI_RESET_SHUTDOWN = 2 | |
154 | }; | |
155 | ||
156 | /* EFI Runtime Services table */ | |
157 | #define EFI_RUNTIME_SERVICES_SIGNATURE 0x5652453544e5552ULL | |
158 | #define EFI_RUNTIME_SERVICES_REVISION 0x00010000 | |
159 | ||
160 | struct efi_runtime_services { | |
161 | struct efi_table_hdr hdr; | |
2bb9b79d AG |
162 | efi_status_t (EFIAPI *get_time)(struct efi_time *time, |
163 | struct efi_time_cap *capabilities); | |
164 | efi_status_t (EFIAPI *set_time)(struct efi_time *time); | |
165 | efi_status_t (EFIAPI *get_wakeup_time)(char *enabled, char *pending, | |
166 | struct efi_time *time); | |
167 | efi_status_t (EFIAPI *set_wakeup_time)(char enabled, | |
168 | struct efi_time *time); | |
169 | efi_status_t (EFIAPI *set_virtual_address_map)( | |
170 | unsigned long memory_map_size, | |
171 | unsigned long descriptor_size, | |
172 | uint32_t descriptor_version, | |
173 | struct efi_mem_desc *virtmap); | |
174 | efi_status_t (*convert_pointer)(unsigned long dbg, void **address); | |
867a6ac8 SG |
175 | efi_status_t (EFIAPI *get_variable)(s16 *variable_name, |
176 | efi_guid_t *vendor, u32 *attributes, | |
177 | unsigned long *data_size, void *data); | |
178 | efi_status_t (EFIAPI *get_next_variable)( | |
179 | unsigned long *variable_name_size, | |
180 | s16 *variable_name, efi_guid_t *vendor); | |
181 | efi_status_t (EFIAPI *set_variable)(s16 *variable_name, | |
182 | efi_guid_t *vendor, u32 attributes, | |
183 | unsigned long data_size, void *data); | |
2bb9b79d AG |
184 | efi_status_t (EFIAPI *get_next_high_mono_count)( |
185 | uint32_t *high_count); | |
867a6ac8 SG |
186 | void (EFIAPI *reset_system)(enum efi_reset_type reset_type, |
187 | efi_status_t reset_status, | |
188 | unsigned long data_size, void *reset_data); | |
189 | void *update_capsule; | |
190 | void *query_capsule_caps; | |
191 | void *query_variable_info; | |
192 | }; | |
193 | ||
194 | /* EFI Configuration Table and GUID definitions */ | |
195 | #define NULL_GUID \ | |
196 | EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \ | |
197 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) | |
198 | ||
199 | #define LOADED_IMAGE_PROTOCOL_GUID \ | |
200 | EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, \ | |
201 | 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) | |
202 | ||
2bb9b79d AG |
203 | #define EFI_FDT_GUID \ |
204 | EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, \ | |
205 | 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0) | |
206 | ||
e663b350 AG |
207 | #define SMBIOS_TABLE_GUID \ |
208 | EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, \ | |
209 | 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) | |
210 | ||
2bb9b79d AG |
211 | struct efi_configuration_table |
212 | { | |
213 | efi_guid_t guid; | |
214 | void *table; | |
215 | }; | |
216 | ||
217 | #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) | |
218 | ||
867a6ac8 SG |
219 | struct efi_system_table { |
220 | struct efi_table_hdr hdr; | |
221 | unsigned long fw_vendor; /* physical addr of wchar_t vendor string */ | |
222 | u32 fw_revision; | |
223 | unsigned long con_in_handle; | |
224 | struct efi_simple_input_interface *con_in; | |
225 | unsigned long con_out_handle; | |
226 | struct efi_simple_text_output_protocol *con_out; | |
227 | unsigned long stderr_handle; | |
2bb9b79d | 228 | struct efi_simple_text_output_protocol *std_err; |
867a6ac8 SG |
229 | struct efi_runtime_services *runtime; |
230 | struct efi_boot_services *boottime; | |
231 | unsigned long nr_tables; | |
2bb9b79d | 232 | struct efi_configuration_table *tables; |
867a6ac8 SG |
233 | }; |
234 | ||
2bb9b79d AG |
235 | #define LOADED_IMAGE_GUID \ |
236 | EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \ | |
237 | 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) | |
238 | ||
867a6ac8 SG |
239 | struct efi_loaded_image { |
240 | u32 revision; | |
241 | void *parent_handle; | |
242 | struct efi_system_table *system_table; | |
243 | void *device_handle; | |
244 | void *file_path; | |
245 | void *reserved; | |
246 | u32 load_options_size; | |
247 | void *load_options; | |
248 | void *image_base; | |
249 | aligned_u64 image_size; | |
250 | unsigned int image_code_type; | |
251 | unsigned int image_data_type; | |
252 | unsigned long unload; | |
a86aeaf2 AG |
253 | |
254 | /* Below are efi loader private fields */ | |
255 | #ifdef CONFIG_EFI_LOADER | |
256 | efi_status_t exit_status; | |
257 | struct jmp_buf_data exit_jmp; | |
258 | #endif | |
867a6ac8 SG |
259 | }; |
260 | ||
2bb9b79d AG |
261 | #define DEVICE_PATH_GUID \ |
262 | EFI_GUID(0x09576e91, 0x6d3f, 0x11d2, \ | |
263 | 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) | |
264 | ||
265 | #define DEVICE_PATH_TYPE_END 0x7f | |
266 | # define DEVICE_PATH_SUB_TYPE_END 0xff | |
267 | ||
867a6ac8 SG |
268 | struct efi_device_path { |
269 | u8 type; | |
270 | u8 sub_type; | |
271 | u16 length; | |
272 | }; | |
273 | ||
d7608aba OT |
274 | struct efi_mac_addr { |
275 | u8 addr[32]; | |
276 | }; | |
277 | ||
278 | #define DEVICE_PATH_TYPE_MESSAGING_DEVICE 0x03 | |
279 | # define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR 0x0b | |
280 | ||
281 | struct efi_device_path_mac_addr { | |
282 | struct efi_device_path dp; | |
283 | struct efi_mac_addr mac; | |
284 | u8 if_type; | |
285 | }; | |
286 | ||
2bb9b79d AG |
287 | #define DEVICE_PATH_TYPE_MEDIA_DEVICE 0x04 |
288 | # define DEVICE_PATH_SUB_TYPE_FILE_PATH 0x04 | |
289 | ||
290 | struct efi_device_path_file_path { | |
291 | struct efi_device_path dp; | |
ecbe1a07 | 292 | u16 str[32]; |
2bb9b79d AG |
293 | }; |
294 | ||
295 | #define BLOCK_IO_GUID \ | |
296 | EFI_GUID(0x964e5b21, 0x6459, 0x11d2, \ | |
297 | 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) | |
298 | ||
299 | struct efi_block_io_media | |
300 | { | |
301 | u32 media_id; | |
302 | char removable_media; | |
303 | char media_present; | |
304 | char logical_partition; | |
305 | char read_only; | |
306 | char write_caching; | |
307 | u8 pad[3]; | |
308 | u32 block_size; | |
309 | u32 io_align; | |
310 | u8 pad2[4]; | |
311 | u64 last_block; | |
312 | }; | |
313 | ||
314 | struct efi_block_io { | |
315 | u64 revision; | |
316 | struct efi_block_io_media *media; | |
317 | efi_status_t (EFIAPI *reset)(struct efi_block_io *this, | |
318 | char extended_verification); | |
319 | efi_status_t (EFIAPI *read_blocks)(struct efi_block_io *this, | |
320 | u32 media_id, u64 lba, unsigned long buffer_size, | |
321 | void *buffer); | |
322 | efi_status_t (EFIAPI *write_blocks)(struct efi_block_io *this, | |
323 | u32 media_id, u64 lba, unsigned long buffer_size, | |
324 | void *buffer); | |
325 | efi_status_t (EFIAPI *flush_blocks)(struct efi_block_io *this); | |
326 | }; | |
327 | ||
867a6ac8 SG |
328 | struct simple_text_output_mode { |
329 | s32 max_mode; | |
330 | s32 mode; | |
331 | s32 attribute; | |
332 | s32 cursor_column; | |
333 | s32 cursor_row; | |
334 | bool cursor_visible; | |
335 | }; | |
336 | ||
337 | struct efi_simple_text_output_protocol { | |
338 | void *reset; | |
339 | efi_status_t (EFIAPI *output_string)( | |
340 | struct efi_simple_text_output_protocol *this, | |
341 | const unsigned short *str); | |
2bb9b79d AG |
342 | efi_status_t (EFIAPI *test_string)( |
343 | struct efi_simple_text_output_protocol *this, | |
344 | const unsigned short *str); | |
867a6ac8 SG |
345 | efi_status_t(EFIAPI *query_mode)( |
346 | struct efi_simple_text_output_protocol *this, | |
347 | unsigned long mode_number, unsigned long *columns, | |
348 | unsigned long *rows); | |
349 | efi_status_t(EFIAPI *set_mode)( | |
350 | struct efi_simple_text_output_protocol *this, | |
351 | unsigned long mode_number); | |
352 | efi_status_t(EFIAPI *set_attribute)( | |
353 | struct efi_simple_text_output_protocol *this, | |
354 | unsigned long attribute); | |
355 | efi_status_t(EFIAPI *clear_screen) ( | |
356 | struct efi_simple_text_output_protocol *this); | |
357 | efi_status_t(EFIAPI *set_cursor_position) ( | |
358 | struct efi_simple_text_output_protocol *this, | |
359 | unsigned long column, unsigned long row); | |
2bb9b79d AG |
360 | efi_status_t(EFIAPI *enable_cursor)( |
361 | struct efi_simple_text_output_protocol *this, | |
362 | bool enable); | |
867a6ac8 SG |
363 | struct simple_text_output_mode *mode; |
364 | }; | |
365 | ||
366 | struct efi_input_key { | |
367 | u16 scan_code; | |
368 | s16 unicode_char; | |
369 | }; | |
370 | ||
371 | struct efi_simple_input_interface { | |
372 | efi_status_t(EFIAPI *reset)(struct efi_simple_input_interface *this, | |
373 | bool ExtendedVerification); | |
374 | efi_status_t(EFIAPI *read_key_stroke)( | |
375 | struct efi_simple_input_interface *this, | |
376 | struct efi_input_key *key); | |
377 | void *wait_for_key; | |
378 | }; | |
379 | ||
2bb9b79d AG |
380 | #define CONSOLE_CONTROL_GUID \ |
381 | EFI_GUID(0xf42f7782, 0x12e, 0x4c12, \ | |
382 | 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21) | |
383 | #define EFI_CONSOLE_MODE_TEXT 0 | |
384 | #define EFI_CONSOLE_MODE_GFX 1 | |
385 | ||
386 | struct efi_console_control_protocol | |
387 | { | |
388 | efi_status_t (EFIAPI *get_mode)( | |
389 | struct efi_console_control_protocol *this, int *mode, | |
390 | char *uga_exists, char *std_in_locked); | |
391 | efi_status_t (EFIAPI *set_mode)( | |
392 | struct efi_console_control_protocol *this, int mode); | |
393 | efi_status_t (EFIAPI *lock_std_in)( | |
394 | struct efi_console_control_protocol *this, | |
395 | uint16_t *password); | |
396 | }; | |
397 | ||
be8d3241 AG |
398 | #define EFI_GOP_GUID \ |
399 | EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \ | |
400 | 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a) | |
401 | ||
402 | #define EFI_GOT_RGBA8 0 | |
403 | #define EFI_GOT_BGRA8 1 | |
404 | #define EFI_GOT_BITMASK 2 | |
405 | ||
406 | struct efi_gop_mode_info | |
407 | { | |
408 | u32 version; | |
409 | u32 width; | |
410 | u32 height; | |
411 | u32 pixel_format; | |
412 | u32 pixel_bitmask[4]; | |
413 | u32 pixels_per_scanline; | |
414 | }; | |
415 | ||
416 | struct efi_gop_mode | |
417 | { | |
418 | u32 max_mode; | |
419 | u32 mode; | |
420 | struct efi_gop_mode_info *info; | |
421 | unsigned long info_size; | |
422 | efi_physical_addr_t fb_base; | |
423 | unsigned long fb_size; | |
424 | }; | |
425 | ||
426 | #define EFI_BLT_VIDEO_FILL 0 | |
427 | #define EFI_BLT_VIDEO_TO_BLT_BUFFER 1 | |
428 | #define EFI_BLT_BUFFER_TO_VIDEO 2 | |
429 | #define EFI_BLT_VIDEO_TO_VIDEO 3 | |
430 | ||
431 | struct efi_gop | |
432 | { | |
433 | efi_status_t (EFIAPI *query_mode)(struct efi_gop *this, u32 mode_number, | |
434 | unsigned long *size_of_info, | |
435 | struct efi_gop_mode_info **info); | |
436 | efi_status_t (EFIAPI *set_mode)(struct efi_gop *this, u32 mode_number); | |
437 | efi_status_t (EFIAPI *blt)(struct efi_gop *this, void *buffer, | |
438 | unsigned long operation, unsigned long sx, | |
439 | unsigned long sy, unsigned long dx, | |
440 | unsigned long dy, unsigned long width, | |
441 | unsigned long height, unsigned long delta); | |
442 | struct efi_gop_mode *mode; | |
443 | }; | |
444 | ||
0efe1bcf AG |
445 | #define EFI_SIMPLE_NETWORK_GUID \ |
446 | EFI_GUID(0xa19832b9, 0xac25, 0x11d3, \ | |
447 | 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) | |
448 | ||
449 | struct efi_mac_address { | |
450 | char mac_addr[32]; | |
451 | }; | |
452 | ||
453 | struct efi_ip_address { | |
454 | u8 ip_addr[16]; | |
455 | }; | |
456 | ||
457 | enum efi_simple_network_state { | |
458 | EFI_NETWORK_STOPPED, | |
459 | EFI_NETWORK_STARTED, | |
460 | EFI_NETWORK_INITIALIZED, | |
461 | }; | |
462 | ||
463 | struct efi_simple_network_mode { | |
464 | enum efi_simple_network_state state; | |
465 | u32 hwaddr_size; | |
466 | u32 media_header_size; | |
467 | u32 max_packet_size; | |
468 | u32 nvram_size; | |
469 | u32 nvram_access_size; | |
470 | u32 receive_filter_mask; | |
471 | u32 receive_filter_setting; | |
472 | u32 max_mcast_filter_count; | |
473 | u32 mcast_filter_count; | |
474 | struct efi_mac_address mcast_filter[16]; | |
475 | struct efi_mac_address current_address; | |
476 | struct efi_mac_address broadcast_address; | |
477 | struct efi_mac_address permanent_address; | |
478 | u8 if_type; | |
479 | u8 mac_changeable; | |
480 | u8 multitx_supported; | |
481 | u8 media_present_supported; | |
482 | u8 media_present; | |
483 | }; | |
484 | ||
485 | #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01, | |
486 | #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02, | |
487 | #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04, | |
488 | #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08, | |
489 | #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10, | |
490 | ||
491 | struct efi_simple_network | |
492 | { | |
493 | u64 revision; | |
494 | efi_status_t (EFIAPI *start)(struct efi_simple_network *this); | |
495 | efi_status_t (EFIAPI *stop)(struct efi_simple_network *this); | |
496 | efi_status_t (EFIAPI *initialize)(struct efi_simple_network *this, | |
497 | ulong extra_rx, ulong extra_tx); | |
498 | efi_status_t (EFIAPI *reset)(struct efi_simple_network *this, | |
499 | int extended_verification); | |
500 | efi_status_t (EFIAPI *shutdown)(struct efi_simple_network *this); | |
501 | efi_status_t (EFIAPI *receive_filters)(struct efi_simple_network *this, | |
502 | u32 enable, u32 disable, int reset_mcast_filter, | |
503 | ulong mcast_filter_count, | |
504 | struct efi_mac_address *mcast_filter); | |
505 | efi_status_t (EFIAPI *station_address)(struct efi_simple_network *this, | |
506 | int reset, struct efi_mac_address *new_mac); | |
507 | efi_status_t (EFIAPI *statistics)(struct efi_simple_network *this, | |
508 | int reset, ulong *stat_size, void *stat_table); | |
509 | efi_status_t (EFIAPI *mcastiptomac)(struct efi_simple_network *this, | |
510 | int ipv6, struct efi_ip_address *ip, | |
511 | struct efi_mac_address *mac); | |
512 | efi_status_t (EFIAPI *nvdata)(struct efi_simple_network *this, | |
513 | int read_write, ulong offset, ulong buffer_size, | |
514 | char *buffer); | |
515 | efi_status_t (EFIAPI *get_status)(struct efi_simple_network *this, | |
516 | u32 *int_status, void **txbuf); | |
517 | efi_status_t (EFIAPI *transmit)(struct efi_simple_network *this, | |
518 | ulong header_size, ulong buffer_size, void *buffer, | |
519 | struct efi_mac_address *src_addr, | |
520 | struct efi_mac_address *dest_addr, u16 *protocol); | |
521 | efi_status_t (EFIAPI *receive)(struct efi_simple_network *this, | |
522 | ulong *header_size, ulong *buffer_size, void *buffer, | |
523 | struct efi_mac_address *src_addr, | |
524 | struct efi_mac_address *dest_addr, u16 *protocol); | |
525 | void (EFIAPI *waitforpacket)(void); | |
526 | struct efi_simple_network_mode *mode; | |
527 | }; | |
528 | ||
529 | #define EFI_PXE_GUID \ | |
530 | EFI_GUID(0x03c4e603, 0xac28, 0x11d3, \ | |
531 | 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) | |
532 | ||
533 | struct efi_pxe_packet { | |
534 | u8 packet[1472]; | |
535 | }; | |
536 | ||
537 | struct efi_pxe_mode | |
538 | { | |
539 | u8 unused[52]; | |
540 | struct efi_pxe_packet dhcp_discover; | |
541 | struct efi_pxe_packet dhcp_ack; | |
542 | struct efi_pxe_packet proxy_offer; | |
543 | struct efi_pxe_packet pxe_discover; | |
544 | struct efi_pxe_packet pxe_reply; | |
545 | }; | |
546 | ||
547 | struct efi_pxe { | |
548 | u64 rev; | |
549 | void (EFIAPI *start)(void); | |
550 | void (EFIAPI *stop)(void); | |
551 | void (EFIAPI *dhcp)(void); | |
552 | void (EFIAPI *discover)(void); | |
553 | void (EFIAPI *mftp)(void); | |
554 | void (EFIAPI *udpwrite)(void); | |
555 | void (EFIAPI *udpread)(void); | |
556 | void (EFIAPI *setipfilter)(void); | |
557 | void (EFIAPI *arp)(void); | |
558 | void (EFIAPI *setparams)(void); | |
559 | void (EFIAPI *setstationip)(void); | |
560 | void (EFIAPI *setpackets)(void); | |
561 | struct efi_pxe_mode *mode; | |
562 | }; | |
563 | ||
867a6ac8 | 564 | #endif |