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