xref: /rk3399_rockchip-uboot/include/efi_api.h (revision 1a4f6af8bfd44c8ae6e87a81ff125eed47042cc5)
1867a6ac8SSimon Glass /*
2867a6ac8SSimon Glass  * Extensible Firmware Interface
3867a6ac8SSimon Glass  * Based on 'Extensible Firmware Interface Specification' version 0.9,
4867a6ac8SSimon Glass  * April 30, 1999
5867a6ac8SSimon Glass  *
6867a6ac8SSimon Glass  * Copyright (C) 1999 VA Linux Systems
7867a6ac8SSimon Glass  * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
8867a6ac8SSimon Glass  * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
9867a6ac8SSimon Glass  *	David Mosberger-Tang <davidm@hpl.hp.com>
10867a6ac8SSimon Glass  *	Stephane Eranian <eranian@hpl.hp.com>
11867a6ac8SSimon Glass  *
12867a6ac8SSimon Glass  * From include/linux/efi.h in kernel 4.1 with some additions/subtractions
13867a6ac8SSimon Glass  */
14867a6ac8SSimon Glass 
15867a6ac8SSimon Glass #ifndef _EFI_API_H
16867a6ac8SSimon Glass #define _EFI_API_H
17867a6ac8SSimon Glass 
18867a6ac8SSimon Glass #include <efi.h>
19867a6ac8SSimon Glass 
20a86aeaf2SAlexander Graf #ifdef CONFIG_EFI_LOADER
21a86aeaf2SAlexander Graf #include <asm/setjmp.h>
22a86aeaf2SAlexander Graf #endif
23a86aeaf2SAlexander Graf 
242bb9b79dSAlexander Graf /* Types and defines for EFI CreateEvent */
25b521d29eSxypron.glpk@gmx.de enum efi_timer_delay {
262bb9b79dSAlexander Graf 	EFI_TIMER_STOP = 0,
272bb9b79dSAlexander Graf 	EFI_TIMER_PERIODIC = 1,
282bb9b79dSAlexander Graf 	EFI_TIMER_RELATIVE = 2
292bb9b79dSAlexander Graf };
302bb9b79dSAlexander Graf 
31503f2695Sxypron.glpk@gmx.de #define UINTN size_t
32503f2695Sxypron.glpk@gmx.de 
33c6841592Sxypron.glpk@gmx.de #define EVT_TIMER				0x80000000
34c6841592Sxypron.glpk@gmx.de #define EVT_RUNTIME				0x40000000
3537a980b3SJonathan Gray #define EVT_NOTIFY_WAIT				0x00000100
3637a980b3SJonathan Gray #define EVT_NOTIFY_SIGNAL			0x00000200
37c6841592Sxypron.glpk@gmx.de #define EVT_SIGNAL_EXIT_BOOT_SERVICES		0x00000201
38c6841592Sxypron.glpk@gmx.de #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE	0x60000202
39c6841592Sxypron.glpk@gmx.de 
40c6841592Sxypron.glpk@gmx.de #define TPL_APPLICATION		0x04
41c6841592Sxypron.glpk@gmx.de #define TPL_CALLBACK		0x08
42c6841592Sxypron.glpk@gmx.de #define TPL_NOTIFY		0x10
43c6841592Sxypron.glpk@gmx.de #define TPL_HIGH_LEVEL		0x1F
4437a980b3SJonathan Gray 
452fd945feSxypron.glpk@gmx.de struct efi_event;
462fd945feSxypron.glpk@gmx.de 
47867a6ac8SSimon Glass /* EFI Boot Services table */
48867a6ac8SSimon Glass struct efi_boot_services {
49867a6ac8SSimon Glass 	struct efi_table_hdr hdr;
50503f2695Sxypron.glpk@gmx.de 	efi_status_t (EFIAPI *raise_tpl)(UINTN new_tpl);
51503f2695Sxypron.glpk@gmx.de 	void (EFIAPI *restore_tpl)(UINTN old_tpl);
52867a6ac8SSimon Glass 
53867a6ac8SSimon Glass 	efi_status_t (EFIAPI *allocate_pages)(int, int, unsigned long,
54867a6ac8SSimon Glass 					      efi_physical_addr_t *);
55867a6ac8SSimon Glass 	efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, unsigned long);
56867a6ac8SSimon Glass 	efi_status_t (EFIAPI *get_memory_map)(unsigned long *memory_map_size,
57867a6ac8SSimon Glass 			struct efi_mem_desc *desc, unsigned long *key,
58867a6ac8SSimon Glass 			unsigned long *desc_size, u32 *desc_version);
59867a6ac8SSimon Glass 	efi_status_t (EFIAPI *allocate_pool)(int, unsigned long, void **);
60867a6ac8SSimon Glass 	efi_status_t (EFIAPI *free_pool)(void *);
61867a6ac8SSimon Glass 
62b521d29eSxypron.glpk@gmx.de 	efi_status_t (EFIAPI *create_event)(uint32_t type,
63503f2695Sxypron.glpk@gmx.de 			UINTN notify_tpl,
642fd945feSxypron.glpk@gmx.de 			void (EFIAPI *notify_function) (
652fd945feSxypron.glpk@gmx.de 					struct efi_event *event,
662bb9b79dSAlexander Graf 					void *context),
672fd945feSxypron.glpk@gmx.de 			void *notify_context, struct efi_event **event);
68b521d29eSxypron.glpk@gmx.de 	efi_status_t (EFIAPI *set_timer)(struct efi_event *event,
69b521d29eSxypron.glpk@gmx.de 					 enum efi_timer_delay type,
702bb9b79dSAlexander Graf 					 uint64_t trigger_time);
71867a6ac8SSimon Glass 	efi_status_t (EFIAPI *wait_for_event)(unsigned long number_of_events,
722fd945feSxypron.glpk@gmx.de 			struct efi_event **event, unsigned long *index);
732fd945feSxypron.glpk@gmx.de 	efi_status_t (EFIAPI *signal_event)(struct efi_event *event);
742fd945feSxypron.glpk@gmx.de 	efi_status_t (EFIAPI *close_event)(struct efi_event *event);
752fd945feSxypron.glpk@gmx.de 	efi_status_t (EFIAPI *check_event)(struct efi_event *event);
76e0549f8aSxypron.glpk@gmx.de #define EFI_NATIVE_INTERFACE	0x00000000
772bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *install_protocol_interface)(
782bb9b79dSAlexander Graf 			void **handle, efi_guid_t *protocol,
792bb9b79dSAlexander Graf 			int protocol_interface_type, void *protocol_interface);
802bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *reinstall_protocol_interface)(
812bb9b79dSAlexander Graf 			void *handle, efi_guid_t *protocol,
822bb9b79dSAlexander Graf 			void *old_interface, void *new_interface);
832bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *uninstall_protocol_interface)(void *handle,
842bb9b79dSAlexander Graf 			efi_guid_t *protocol, void *protocol_interface);
85867a6ac8SSimon Glass 	efi_status_t (EFIAPI *handle_protocol)(efi_handle_t, efi_guid_t *,
86867a6ac8SSimon Glass 					       void **);
87867a6ac8SSimon Glass 	void *reserved;
882bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *register_protocol_notify)(
892fd945feSxypron.glpk@gmx.de 			efi_guid_t *protocol, struct efi_event *event,
902bb9b79dSAlexander Graf 			void **registration);
91867a6ac8SSimon Glass 	efi_status_t (EFIAPI *locate_handle)(
92867a6ac8SSimon Glass 			enum efi_locate_search_type search_type,
93867a6ac8SSimon Glass 			efi_guid_t *protocol, void *search_key,
94867a6ac8SSimon Glass 			unsigned long *buffer_size, efi_handle_t *buffer);
95867a6ac8SSimon Glass 	efi_status_t (EFIAPI *locate_device_path)(efi_guid_t *protocol,
96867a6ac8SSimon Glass 			struct efi_device_path **device_path,
97867a6ac8SSimon Glass 			efi_handle_t *device);
982bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *install_configuration_table)(
992bb9b79dSAlexander Graf 			efi_guid_t *guid, void *table);
100867a6ac8SSimon Glass 
101867a6ac8SSimon Glass 	efi_status_t (EFIAPI *load_image)(bool boot_policiy,
102867a6ac8SSimon Glass 			efi_handle_t parent_image,
103867a6ac8SSimon Glass 			struct efi_device_path *file_path, void *source_buffer,
104867a6ac8SSimon Glass 			unsigned long source_size, efi_handle_t *image);
105867a6ac8SSimon Glass 	efi_status_t (EFIAPI *start_image)(efi_handle_t handle,
106867a6ac8SSimon Glass 					   unsigned long *exitdata_size,
107867a6ac8SSimon Glass 					   s16 **exitdata);
108867a6ac8SSimon Glass 	efi_status_t (EFIAPI *exit)(efi_handle_t handle,
109867a6ac8SSimon Glass 				    efi_status_t exit_status,
110867a6ac8SSimon Glass 				    unsigned long exitdata_size, s16 *exitdata);
1112bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *unload_image)(void *image_handle);
112867a6ac8SSimon Glass 	efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long);
113867a6ac8SSimon Glass 
114867a6ac8SSimon Glass 	efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count);
115867a6ac8SSimon Glass 	efi_status_t (EFIAPI *stall)(unsigned long usecs);
1162bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *set_watchdog_timer)(unsigned long timeout,
1172bb9b79dSAlexander Graf 			uint64_t watchdog_code, unsigned long data_size,
1182bb9b79dSAlexander Graf 			uint16_t *watchdog_data);
119867a6ac8SSimon Glass 	efi_status_t(EFIAPI *connect_controller)(efi_handle_t controller_handle,
120867a6ac8SSimon Glass 			efi_handle_t *driver_image_handle,
121867a6ac8SSimon Glass 			struct efi_device_path *remaining_device_path,
122867a6ac8SSimon Glass 			bool recursive);
1232bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *disconnect_controller)(void *controller_handle,
1242bb9b79dSAlexander Graf 			void *driver_image_handle, void *child_handle);
125867a6ac8SSimon Glass #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
126867a6ac8SSimon Glass #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
127867a6ac8SSimon Glass #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
128867a6ac8SSimon Glass #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
129867a6ac8SSimon Glass #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
130867a6ac8SSimon Glass #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
131867a6ac8SSimon Glass 	efi_status_t (EFIAPI *open_protocol)(efi_handle_t handle,
132867a6ac8SSimon Glass 			efi_guid_t *protocol, void **interface,
133867a6ac8SSimon Glass 			efi_handle_t agent_handle,
134867a6ac8SSimon Glass 			efi_handle_t controller_handle, u32 attributes);
1352bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *close_protocol)(void *handle,
1362bb9b79dSAlexander Graf 			efi_guid_t *protocol, void *agent_handle,
1372bb9b79dSAlexander Graf 			void *controller_handle);
138867a6ac8SSimon Glass 	efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
139867a6ac8SSimon Glass 			efi_guid_t *protocol,
140867a6ac8SSimon Glass 			struct efi_open_protocol_info_entry **entry_buffer,
141867a6ac8SSimon Glass 			unsigned long *entry_count);
142867a6ac8SSimon Glass 	efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle,
143867a6ac8SSimon Glass 			efi_guid_t ***protocol_buffer,
144867a6ac8SSimon Glass 			unsigned long *protocols_buffer_count);
145867a6ac8SSimon Glass 	efi_status_t (EFIAPI *locate_handle_buffer) (
146867a6ac8SSimon Glass 			enum efi_locate_search_type search_type,
147867a6ac8SSimon Glass 			efi_guid_t *protocol, void *search_key,
148867a6ac8SSimon Glass 			unsigned long *no_handles, efi_handle_t **buffer);
1492bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *locate_protocol)(efi_guid_t *protocol,
1502bb9b79dSAlexander Graf 			void *registration, void **protocol_interface);
1512bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *install_multiple_protocol_interfaces)(
1522bb9b79dSAlexander Graf 			void **handle, ...);
1532bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *uninstall_multiple_protocol_interfaces)(
1542bb9b79dSAlexander Graf 			void *handle, ...);
1552bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *calculate_crc32)(void *data,
1562bb9b79dSAlexander Graf 			unsigned long data_size, uint32_t *crc32);
1572bb9b79dSAlexander Graf 	void (EFIAPI *copy_mem)(void *destination, void *source,
1582bb9b79dSAlexander Graf 			unsigned long length);
1592bb9b79dSAlexander Graf 	void (EFIAPI *set_mem)(void *buffer, unsigned long size,
1602bb9b79dSAlexander Graf 			uint8_t value);
161867a6ac8SSimon Glass 	void *create_event_ex;
162867a6ac8SSimon Glass };
163867a6ac8SSimon Glass 
164867a6ac8SSimon Glass /* Types and defines for EFI ResetSystem */
165867a6ac8SSimon Glass enum efi_reset_type {
166867a6ac8SSimon Glass 	EFI_RESET_COLD = 0,
167867a6ac8SSimon Glass 	EFI_RESET_WARM = 1,
168867a6ac8SSimon Glass 	EFI_RESET_SHUTDOWN = 2
169867a6ac8SSimon Glass };
170867a6ac8SSimon Glass 
171867a6ac8SSimon Glass /* EFI Runtime Services table */
172867a6ac8SSimon Glass #define EFI_RUNTIME_SERVICES_SIGNATURE	0x5652453544e5552ULL
173867a6ac8SSimon Glass #define EFI_RUNTIME_SERVICES_REVISION	0x00010000
174867a6ac8SSimon Glass 
175867a6ac8SSimon Glass struct efi_runtime_services {
176867a6ac8SSimon Glass 	struct efi_table_hdr hdr;
1772bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *get_time)(struct efi_time *time,
1782bb9b79dSAlexander Graf 			struct efi_time_cap *capabilities);
1792bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *set_time)(struct efi_time *time);
1802bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *get_wakeup_time)(char *enabled, char *pending,
1812bb9b79dSAlexander Graf 			struct efi_time *time);
1822bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *set_wakeup_time)(char enabled,
1832bb9b79dSAlexander Graf 			struct efi_time *time);
1842bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *set_virtual_address_map)(
1852bb9b79dSAlexander Graf 			unsigned long memory_map_size,
1862bb9b79dSAlexander Graf 			unsigned long descriptor_size,
1872bb9b79dSAlexander Graf 			uint32_t descriptor_version,
1882bb9b79dSAlexander Graf 			struct efi_mem_desc *virtmap);
1892bb9b79dSAlexander Graf 	efi_status_t (*convert_pointer)(unsigned long dbg, void **address);
190867a6ac8SSimon Glass 	efi_status_t (EFIAPI *get_variable)(s16 *variable_name,
191867a6ac8SSimon Glass 			efi_guid_t *vendor, u32 *attributes,
192867a6ac8SSimon Glass 			unsigned long *data_size, void *data);
193867a6ac8SSimon Glass 	efi_status_t (EFIAPI *get_next_variable)(
194867a6ac8SSimon Glass 			unsigned long *variable_name_size,
195867a6ac8SSimon Glass 			s16 *variable_name, efi_guid_t *vendor);
196867a6ac8SSimon Glass 	efi_status_t (EFIAPI *set_variable)(s16 *variable_name,
197867a6ac8SSimon Glass 			efi_guid_t *vendor, u32 attributes,
198867a6ac8SSimon Glass 			unsigned long data_size, void *data);
1992bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *get_next_high_mono_count)(
2002bb9b79dSAlexander Graf 			uint32_t *high_count);
201867a6ac8SSimon Glass 	void (EFIAPI *reset_system)(enum efi_reset_type reset_type,
202867a6ac8SSimon Glass 				    efi_status_t reset_status,
203867a6ac8SSimon Glass 				    unsigned long data_size, void *reset_data);
204867a6ac8SSimon Glass 	void *update_capsule;
205867a6ac8SSimon Glass 	void *query_capsule_caps;
206867a6ac8SSimon Glass 	void *query_variable_info;
207867a6ac8SSimon Glass };
208867a6ac8SSimon Glass 
209867a6ac8SSimon Glass /* EFI Configuration Table and GUID definitions */
210867a6ac8SSimon Glass #define NULL_GUID \
211867a6ac8SSimon Glass 	EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
212867a6ac8SSimon Glass 		 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
213867a6ac8SSimon Glass 
214867a6ac8SSimon Glass #define LOADED_IMAGE_PROTOCOL_GUID \
215867a6ac8SSimon Glass 	EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, \
216867a6ac8SSimon Glass 		 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
217867a6ac8SSimon Glass 
2182bb9b79dSAlexander Graf #define EFI_FDT_GUID \
2192bb9b79dSAlexander Graf 	EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, \
2202bb9b79dSAlexander Graf 		 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
2212bb9b79dSAlexander Graf 
222e663b350SAlexander Graf #define SMBIOS_TABLE_GUID \
223e663b350SAlexander Graf 	EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3,  \
224e663b350SAlexander Graf 		 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
225e663b350SAlexander Graf 
2262bb9b79dSAlexander Graf struct efi_configuration_table
2272bb9b79dSAlexander Graf {
2282bb9b79dSAlexander Graf 	efi_guid_t guid;
2292bb9b79dSAlexander Graf 	void *table;
2302bb9b79dSAlexander Graf };
2312bb9b79dSAlexander Graf 
2322bb9b79dSAlexander Graf #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
2332bb9b79dSAlexander Graf 
234867a6ac8SSimon Glass struct efi_system_table {
235867a6ac8SSimon Glass 	struct efi_table_hdr hdr;
236867a6ac8SSimon Glass 	unsigned long fw_vendor;   /* physical addr of wchar_t vendor string */
237867a6ac8SSimon Glass 	u32 fw_revision;
238867a6ac8SSimon Glass 	unsigned long con_in_handle;
239867a6ac8SSimon Glass 	struct efi_simple_input_interface *con_in;
240867a6ac8SSimon Glass 	unsigned long con_out_handle;
241867a6ac8SSimon Glass 	struct efi_simple_text_output_protocol *con_out;
242867a6ac8SSimon Glass 	unsigned long stderr_handle;
2432bb9b79dSAlexander Graf 	struct efi_simple_text_output_protocol *std_err;
244867a6ac8SSimon Glass 	struct efi_runtime_services *runtime;
245867a6ac8SSimon Glass 	struct efi_boot_services *boottime;
246867a6ac8SSimon Glass 	unsigned long nr_tables;
2472bb9b79dSAlexander Graf 	struct efi_configuration_table *tables;
248867a6ac8SSimon Glass };
249867a6ac8SSimon Glass 
2502bb9b79dSAlexander Graf #define LOADED_IMAGE_GUID \
2512bb9b79dSAlexander Graf 	EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \
2522bb9b79dSAlexander Graf 		 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
2532bb9b79dSAlexander Graf 
254867a6ac8SSimon Glass struct efi_loaded_image {
255867a6ac8SSimon Glass 	u32 revision;
256867a6ac8SSimon Glass 	void *parent_handle;
257867a6ac8SSimon Glass 	struct efi_system_table *system_table;
258867a6ac8SSimon Glass 	void *device_handle;
259867a6ac8SSimon Glass 	void *file_path;
260867a6ac8SSimon Glass 	void *reserved;
261867a6ac8SSimon Glass 	u32 load_options_size;
262867a6ac8SSimon Glass 	void *load_options;
263867a6ac8SSimon Glass 	void *image_base;
264867a6ac8SSimon Glass 	aligned_u64 image_size;
265867a6ac8SSimon Glass 	unsigned int image_code_type;
266867a6ac8SSimon Glass 	unsigned int image_data_type;
267867a6ac8SSimon Glass 	unsigned long unload;
268a86aeaf2SAlexander Graf 
269a86aeaf2SAlexander Graf 	/* Below are efi loader private fields */
270a86aeaf2SAlexander Graf #ifdef CONFIG_EFI_LOADER
271a86aeaf2SAlexander Graf 	efi_status_t exit_status;
272a86aeaf2SAlexander Graf 	struct jmp_buf_data exit_jmp;
273a86aeaf2SAlexander Graf #endif
274867a6ac8SSimon Glass };
275867a6ac8SSimon Glass 
2762bb9b79dSAlexander Graf #define DEVICE_PATH_GUID \
2772bb9b79dSAlexander Graf 	EFI_GUID(0x09576e91, 0x6d3f, 0x11d2, \
2782bb9b79dSAlexander Graf 		 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
2792bb9b79dSAlexander Graf 
2802bb9b79dSAlexander Graf #define DEVICE_PATH_TYPE_END			0x7f
2812bb9b79dSAlexander Graf #  define DEVICE_PATH_SUB_TYPE_END		0xff
2822bb9b79dSAlexander Graf 
283867a6ac8SSimon Glass struct efi_device_path {
284867a6ac8SSimon Glass 	u8 type;
285867a6ac8SSimon Glass 	u8 sub_type;
286867a6ac8SSimon Glass 	u16 length;
287867a6ac8SSimon Glass };
288867a6ac8SSimon Glass 
289d7608abaSOleksandr Tymoshenko struct efi_mac_addr {
290d7608abaSOleksandr Tymoshenko 	u8 addr[32];
291d7608abaSOleksandr Tymoshenko };
292d7608abaSOleksandr Tymoshenko 
2939fafdb85SPeter Jones #define DEVICE_PATH_TYPE_HARDWARE_DEVICE	0x01
2949fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_VENDOR		0x04
2959fafdb85SPeter Jones 
2969fafdb85SPeter Jones struct efi_device_path_vendor {
2979fafdb85SPeter Jones 	struct efi_device_path dp;
2989fafdb85SPeter Jones 	efi_guid_t guid;
2999fafdb85SPeter Jones 	u8 vendor_data[];
3009fafdb85SPeter Jones } __packed;
3019fafdb85SPeter Jones 
3029fafdb85SPeter Jones #define DEVICE_PATH_TYPE_ACPI_DEVICE		0x02
3039fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE	0x01
3049fafdb85SPeter Jones 
3059fafdb85SPeter Jones #define EFI_PNP_ID(ID)				(u32)(((ID) << 16) | 0x41D0)
3069fafdb85SPeter Jones #define EISA_PNP_ID(ID)				EFI_PNP_ID(ID)
3079fafdb85SPeter Jones 
3089fafdb85SPeter Jones struct efi_device_path_acpi_path {
3099fafdb85SPeter Jones 	struct efi_device_path dp;
3109fafdb85SPeter Jones 	u32 hid;
3119fafdb85SPeter Jones 	u32 uid;
3129fafdb85SPeter Jones } __packed;
3139fafdb85SPeter Jones 
314d7608abaSOleksandr Tymoshenko #define DEVICE_PATH_TYPE_MESSAGING_DEVICE	0x03
3159fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_MSG_USB		0x05
316d7608abaSOleksandr Tymoshenko #  define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR	0x0b
317*1fa8dee8SRob Clark #  define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS	0x0f
3189fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_MSG_SD		0x1a
3199fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_MSG_MMC		0x1d
3209fafdb85SPeter Jones 
3219fafdb85SPeter Jones struct efi_device_path_usb {
3229fafdb85SPeter Jones 	struct efi_device_path dp;
3239fafdb85SPeter Jones 	u8 parent_port_number;
3249fafdb85SPeter Jones 	u8 usb_interface;
3259fafdb85SPeter Jones } __packed;
326d7608abaSOleksandr Tymoshenko 
327d7608abaSOleksandr Tymoshenko struct efi_device_path_mac_addr {
328d7608abaSOleksandr Tymoshenko 	struct efi_device_path dp;
329d7608abaSOleksandr Tymoshenko 	struct efi_mac_addr mac;
330d7608abaSOleksandr Tymoshenko 	u8 if_type;
331d7608abaSOleksandr Tymoshenko };
332d7608abaSOleksandr Tymoshenko 
333*1fa8dee8SRob Clark struct efi_device_path_usb_class {
334*1fa8dee8SRob Clark 	struct efi_device_path dp;
335*1fa8dee8SRob Clark 	u16 vendor_id;
336*1fa8dee8SRob Clark 	u16 product_id;
337*1fa8dee8SRob Clark 	u8 device_class;
338*1fa8dee8SRob Clark 	u8 device_subclass;
339*1fa8dee8SRob Clark 	u8 device_protocol;
340*1fa8dee8SRob Clark } __packed;
341*1fa8dee8SRob Clark 
3429fafdb85SPeter Jones struct efi_device_path_sd_mmc_path {
3439fafdb85SPeter Jones 	struct efi_device_path dp;
3449fafdb85SPeter Jones 	u8 slot_number;
3459fafdb85SPeter Jones } __packed;
3469fafdb85SPeter Jones 
3472bb9b79dSAlexander Graf #define DEVICE_PATH_TYPE_MEDIA_DEVICE		0x04
3489fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH	0x01
3499fafdb85SPeter Jones #  define DEVICE_PATH_SUB_TYPE_CDROM_PATH	0x02
3502bb9b79dSAlexander Graf #  define DEVICE_PATH_SUB_TYPE_FILE_PATH	0x04
3512bb9b79dSAlexander Graf 
3529fafdb85SPeter Jones struct efi_device_path_hard_drive_path {
3539fafdb85SPeter Jones 	struct efi_device_path dp;
3549fafdb85SPeter Jones 	u32 partition_number;
3559fafdb85SPeter Jones 	u64 partition_start;
3569fafdb85SPeter Jones 	u64 partition_end;
3579fafdb85SPeter Jones 	u8 partition_signature[16];
3589fafdb85SPeter Jones 	u8 partmap_type;
3599fafdb85SPeter Jones 	u8 signature_type;
3609fafdb85SPeter Jones } __packed;
3619fafdb85SPeter Jones 
3629fafdb85SPeter Jones struct efi_device_path_cdrom_path {
3639fafdb85SPeter Jones 	struct efi_device_path dp;
3649fafdb85SPeter Jones 	u32 boot_entry;
3659fafdb85SPeter Jones 	u64 partition_start;
3669fafdb85SPeter Jones 	u64 partition_end;
3679fafdb85SPeter Jones } __packed;
3689fafdb85SPeter Jones 
3692bb9b79dSAlexander Graf struct efi_device_path_file_path {
3702bb9b79dSAlexander Graf 	struct efi_device_path dp;
371ecbe1a07SAlexander Graf 	u16 str[32];
3722bb9b79dSAlexander Graf };
3732bb9b79dSAlexander Graf 
3742bb9b79dSAlexander Graf #define BLOCK_IO_GUID \
3752bb9b79dSAlexander Graf 	EFI_GUID(0x964e5b21, 0x6459, 0x11d2, \
3762bb9b79dSAlexander Graf 		 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
3772bb9b79dSAlexander Graf 
3782bb9b79dSAlexander Graf struct efi_block_io_media
3792bb9b79dSAlexander Graf {
3802bb9b79dSAlexander Graf 	u32 media_id;
3812bb9b79dSAlexander Graf 	char removable_media;
3822bb9b79dSAlexander Graf 	char media_present;
3832bb9b79dSAlexander Graf 	char logical_partition;
3842bb9b79dSAlexander Graf 	char read_only;
3852bb9b79dSAlexander Graf 	char write_caching;
3862bb9b79dSAlexander Graf 	u8 pad[3];
3872bb9b79dSAlexander Graf 	u32 block_size;
3882bb9b79dSAlexander Graf 	u32 io_align;
3892bb9b79dSAlexander Graf 	u8 pad2[4];
3902bb9b79dSAlexander Graf 	u64 last_block;
3912bb9b79dSAlexander Graf };
3922bb9b79dSAlexander Graf 
3932bb9b79dSAlexander Graf struct efi_block_io {
3942bb9b79dSAlexander Graf 	u64 revision;
3952bb9b79dSAlexander Graf 	struct efi_block_io_media *media;
3962bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *reset)(struct efi_block_io *this,
3972bb9b79dSAlexander Graf 			char extended_verification);
3982bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *read_blocks)(struct efi_block_io *this,
3992bb9b79dSAlexander Graf 			u32 media_id, u64 lba, unsigned long buffer_size,
4002bb9b79dSAlexander Graf 			void *buffer);
4012bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *write_blocks)(struct efi_block_io *this,
4022bb9b79dSAlexander Graf 			u32 media_id, u64 lba, unsigned long buffer_size,
4032bb9b79dSAlexander Graf 			void *buffer);
4042bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *flush_blocks)(struct efi_block_io *this);
4052bb9b79dSAlexander Graf };
4062bb9b79dSAlexander Graf 
407867a6ac8SSimon Glass struct simple_text_output_mode {
408867a6ac8SSimon Glass 	s32 max_mode;
409867a6ac8SSimon Glass 	s32 mode;
410867a6ac8SSimon Glass 	s32 attribute;
411867a6ac8SSimon Glass 	s32 cursor_column;
412867a6ac8SSimon Glass 	s32 cursor_row;
413867a6ac8SSimon Glass 	bool cursor_visible;
414867a6ac8SSimon Glass };
415867a6ac8SSimon Glass 
416a17e62ccSRob Clark 
417a17e62ccSRob Clark #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
418a17e62ccSRob Clark 	EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
419a17e62ccSRob Clark 		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
420a17e62ccSRob Clark 
421867a6ac8SSimon Glass struct efi_simple_text_output_protocol {
422867a6ac8SSimon Glass 	void *reset;
423867a6ac8SSimon Glass 	efi_status_t (EFIAPI *output_string)(
424867a6ac8SSimon Glass 			struct efi_simple_text_output_protocol *this,
425867a6ac8SSimon Glass 			const unsigned short *str);
4262bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *test_string)(
4272bb9b79dSAlexander Graf 			struct efi_simple_text_output_protocol *this,
4282bb9b79dSAlexander Graf 			const unsigned short *str);
429867a6ac8SSimon Glass 	efi_status_t(EFIAPI *query_mode)(
430867a6ac8SSimon Glass 			struct efi_simple_text_output_protocol *this,
431867a6ac8SSimon Glass 			unsigned long mode_number, unsigned long *columns,
432867a6ac8SSimon Glass 			unsigned long *rows);
433867a6ac8SSimon Glass 	efi_status_t(EFIAPI *set_mode)(
434867a6ac8SSimon Glass 			struct efi_simple_text_output_protocol *this,
435867a6ac8SSimon Glass 			unsigned long mode_number);
436867a6ac8SSimon Glass 	efi_status_t(EFIAPI *set_attribute)(
437867a6ac8SSimon Glass 			struct efi_simple_text_output_protocol *this,
438867a6ac8SSimon Glass 			unsigned long attribute);
439867a6ac8SSimon Glass 	efi_status_t(EFIAPI *clear_screen) (
440867a6ac8SSimon Glass 			struct efi_simple_text_output_protocol *this);
441867a6ac8SSimon Glass 	efi_status_t(EFIAPI *set_cursor_position) (
442867a6ac8SSimon Glass 			struct efi_simple_text_output_protocol *this,
443867a6ac8SSimon Glass 			unsigned long column, unsigned long row);
4442bb9b79dSAlexander Graf 	efi_status_t(EFIAPI *enable_cursor)(
4452bb9b79dSAlexander Graf 			struct efi_simple_text_output_protocol *this,
4462bb9b79dSAlexander Graf 			bool enable);
447867a6ac8SSimon Glass 	struct simple_text_output_mode *mode;
448867a6ac8SSimon Glass };
449867a6ac8SSimon Glass 
450867a6ac8SSimon Glass struct efi_input_key {
451867a6ac8SSimon Glass 	u16 scan_code;
452867a6ac8SSimon Glass 	s16 unicode_char;
453867a6ac8SSimon Glass };
454867a6ac8SSimon Glass 
455a17e62ccSRob Clark #define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
456a17e62ccSRob Clark 	EFI_GUID(0x387477c1, 0x69c7, 0x11d2, \
457a17e62ccSRob Clark 		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
458a17e62ccSRob Clark 
459867a6ac8SSimon Glass struct efi_simple_input_interface {
460867a6ac8SSimon Glass 	efi_status_t(EFIAPI *reset)(struct efi_simple_input_interface *this,
461867a6ac8SSimon Glass 			bool ExtendedVerification);
462867a6ac8SSimon Glass 	efi_status_t(EFIAPI *read_key_stroke)(
463867a6ac8SSimon Glass 			struct efi_simple_input_interface *this,
464867a6ac8SSimon Glass 			struct efi_input_key *key);
4652fd945feSxypron.glpk@gmx.de 	struct efi_event *wait_for_key;
466867a6ac8SSimon Glass };
467867a6ac8SSimon Glass 
4682bb9b79dSAlexander Graf #define CONSOLE_CONTROL_GUID \
4692bb9b79dSAlexander Graf 	EFI_GUID(0xf42f7782, 0x12e, 0x4c12, \
4702bb9b79dSAlexander Graf 		 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21)
4712bb9b79dSAlexander Graf #define EFI_CONSOLE_MODE_TEXT	0
4722bb9b79dSAlexander Graf #define EFI_CONSOLE_MODE_GFX	1
4732bb9b79dSAlexander Graf 
4742bb9b79dSAlexander Graf struct efi_console_control_protocol
4752bb9b79dSAlexander Graf {
4762bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *get_mode)(
4772bb9b79dSAlexander Graf 			struct efi_console_control_protocol *this, int *mode,
4782bb9b79dSAlexander Graf 			char *uga_exists, char *std_in_locked);
4792bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *set_mode)(
4802bb9b79dSAlexander Graf 			struct efi_console_control_protocol *this, int mode);
4812bb9b79dSAlexander Graf 	efi_status_t (EFIAPI *lock_std_in)(
4822bb9b79dSAlexander Graf 			struct efi_console_control_protocol *this,
4832bb9b79dSAlexander Graf 			uint16_t *password);
4842bb9b79dSAlexander Graf };
4852bb9b79dSAlexander Graf 
486cc5b7081Sxypron.glpk@gmx.de #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
487cc5b7081Sxypron.glpk@gmx.de 	EFI_GUID(0x8b843e20, 0x8132, 0x4852, \
488cc5b7081Sxypron.glpk@gmx.de 		 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c)
489cc5b7081Sxypron.glpk@gmx.de 
490cc5b7081Sxypron.glpk@gmx.de struct efi_device_path_protocol
491cc5b7081Sxypron.glpk@gmx.de {
492cc5b7081Sxypron.glpk@gmx.de 	uint8_t type;
493cc5b7081Sxypron.glpk@gmx.de 	uint8_t sub_type;
494cc5b7081Sxypron.glpk@gmx.de 	uint16_t length;
495cc5b7081Sxypron.glpk@gmx.de 	uint8_t data[];
496cc5b7081Sxypron.glpk@gmx.de };
497cc5b7081Sxypron.glpk@gmx.de 
498cc5b7081Sxypron.glpk@gmx.de struct efi_device_path_to_text_protocol
499cc5b7081Sxypron.glpk@gmx.de {
500cc5b7081Sxypron.glpk@gmx.de 	uint16_t *(EFIAPI *convert_device_node_to_text)(
501cc5b7081Sxypron.glpk@gmx.de 			struct efi_device_path_protocol *device_node,
502cc5b7081Sxypron.glpk@gmx.de 			bool display_only,
503cc5b7081Sxypron.glpk@gmx.de 			bool allow_shortcuts);
504cc5b7081Sxypron.glpk@gmx.de 	uint16_t *(EFIAPI *convert_device_path_to_text)(
505cc5b7081Sxypron.glpk@gmx.de 			struct efi_device_path_protocol *device_path,
506cc5b7081Sxypron.glpk@gmx.de 			bool display_only,
507cc5b7081Sxypron.glpk@gmx.de 			bool allow_shortcuts);
508cc5b7081Sxypron.glpk@gmx.de };
509cc5b7081Sxypron.glpk@gmx.de 
510be8d3241SAlexander Graf #define EFI_GOP_GUID \
511be8d3241SAlexander Graf 	EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
512be8d3241SAlexander Graf 		 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
513be8d3241SAlexander Graf 
514be8d3241SAlexander Graf #define EFI_GOT_RGBA8		0
515be8d3241SAlexander Graf #define EFI_GOT_BGRA8		1
516be8d3241SAlexander Graf #define EFI_GOT_BITMASK		2
517be8d3241SAlexander Graf 
518be8d3241SAlexander Graf struct efi_gop_mode_info
519be8d3241SAlexander Graf {
520be8d3241SAlexander Graf 	u32 version;
521be8d3241SAlexander Graf 	u32 width;
522be8d3241SAlexander Graf 	u32 height;
523be8d3241SAlexander Graf 	u32 pixel_format;
524be8d3241SAlexander Graf 	u32 pixel_bitmask[4];
525be8d3241SAlexander Graf 	u32 pixels_per_scanline;
526be8d3241SAlexander Graf };
527be8d3241SAlexander Graf 
528be8d3241SAlexander Graf struct efi_gop_mode
529be8d3241SAlexander Graf {
530be8d3241SAlexander Graf 	u32 max_mode;
531be8d3241SAlexander Graf 	u32 mode;
532be8d3241SAlexander Graf 	struct efi_gop_mode_info *info;
533be8d3241SAlexander Graf 	unsigned long info_size;
534be8d3241SAlexander Graf 	efi_physical_addr_t fb_base;
535be8d3241SAlexander Graf 	unsigned long fb_size;
536be8d3241SAlexander Graf };
537be8d3241SAlexander Graf 
538be8d3241SAlexander Graf #define EFI_BLT_VIDEO_FILL		0
539be8d3241SAlexander Graf #define EFI_BLT_VIDEO_TO_BLT_BUFFER	1
540be8d3241SAlexander Graf #define EFI_BLT_BUFFER_TO_VIDEO		2
541be8d3241SAlexander Graf #define EFI_BLT_VIDEO_TO_VIDEO		3
542be8d3241SAlexander Graf 
543be8d3241SAlexander Graf struct efi_gop
544be8d3241SAlexander Graf {
545be8d3241SAlexander Graf 	efi_status_t (EFIAPI *query_mode)(struct efi_gop *this, u32 mode_number,
546be8d3241SAlexander Graf 					  unsigned long *size_of_info,
547be8d3241SAlexander Graf 					  struct efi_gop_mode_info **info);
548be8d3241SAlexander Graf 	efi_status_t (EFIAPI *set_mode)(struct efi_gop *this, u32 mode_number);
549be8d3241SAlexander Graf 	efi_status_t (EFIAPI *blt)(struct efi_gop *this, void *buffer,
550be8d3241SAlexander Graf 				   unsigned long operation, unsigned long sx,
551be8d3241SAlexander Graf 				   unsigned long sy, unsigned long dx,
552be8d3241SAlexander Graf 				   unsigned long dy, unsigned long width,
553be8d3241SAlexander Graf 				   unsigned long height, unsigned long delta);
554be8d3241SAlexander Graf 	struct efi_gop_mode *mode;
555be8d3241SAlexander Graf };
556be8d3241SAlexander Graf 
5570efe1bcfSAlexander Graf #define EFI_SIMPLE_NETWORK_GUID \
5580efe1bcfSAlexander Graf 	EFI_GUID(0xa19832b9, 0xac25, 0x11d3, \
5590efe1bcfSAlexander Graf 		 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
5600efe1bcfSAlexander Graf 
5610efe1bcfSAlexander Graf struct efi_mac_address {
5620efe1bcfSAlexander Graf 	char mac_addr[32];
5630efe1bcfSAlexander Graf };
5640efe1bcfSAlexander Graf 
5650efe1bcfSAlexander Graf struct efi_ip_address {
5660efe1bcfSAlexander Graf 	u8 ip_addr[16];
5670efe1bcfSAlexander Graf };
5680efe1bcfSAlexander Graf 
5690efe1bcfSAlexander Graf enum efi_simple_network_state {
5700efe1bcfSAlexander Graf 	EFI_NETWORK_STOPPED,
5710efe1bcfSAlexander Graf 	EFI_NETWORK_STARTED,
5720efe1bcfSAlexander Graf 	EFI_NETWORK_INITIALIZED,
5730efe1bcfSAlexander Graf };
5740efe1bcfSAlexander Graf 
5750efe1bcfSAlexander Graf struct efi_simple_network_mode {
5760efe1bcfSAlexander Graf 	enum efi_simple_network_state state;
5770efe1bcfSAlexander Graf 	u32 hwaddr_size;
5780efe1bcfSAlexander Graf 	u32 media_header_size;
5790efe1bcfSAlexander Graf 	u32 max_packet_size;
5800efe1bcfSAlexander Graf 	u32 nvram_size;
5810efe1bcfSAlexander Graf 	u32 nvram_access_size;
5820efe1bcfSAlexander Graf 	u32 receive_filter_mask;
5830efe1bcfSAlexander Graf 	u32 receive_filter_setting;
5840efe1bcfSAlexander Graf 	u32 max_mcast_filter_count;
5850efe1bcfSAlexander Graf 	u32 mcast_filter_count;
5860efe1bcfSAlexander Graf 	struct efi_mac_address mcast_filter[16];
5870efe1bcfSAlexander Graf 	struct efi_mac_address current_address;
5880efe1bcfSAlexander Graf 	struct efi_mac_address broadcast_address;
5890efe1bcfSAlexander Graf 	struct efi_mac_address permanent_address;
5900efe1bcfSAlexander Graf 	u8 if_type;
5910efe1bcfSAlexander Graf 	u8 mac_changeable;
5920efe1bcfSAlexander Graf 	u8 multitx_supported;
5930efe1bcfSAlexander Graf 	u8 media_present_supported;
5940efe1bcfSAlexander Graf 	u8 media_present;
5950efe1bcfSAlexander Graf };
5960efe1bcfSAlexander Graf 
5970efe1bcfSAlexander Graf #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST               0x01,
5980efe1bcfSAlexander Graf #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST             0x02,
5990efe1bcfSAlexander Graf #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST             0x04,
6000efe1bcfSAlexander Graf #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS           0x08,
6010efe1bcfSAlexander Graf #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10,
6020efe1bcfSAlexander Graf 
6030efe1bcfSAlexander Graf struct efi_simple_network
6040efe1bcfSAlexander Graf {
6050efe1bcfSAlexander Graf 	u64 revision;
6060efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *start)(struct efi_simple_network *this);
6070efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *stop)(struct efi_simple_network *this);
6080efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *initialize)(struct efi_simple_network *this,
6090efe1bcfSAlexander Graf 			ulong extra_rx, ulong extra_tx);
6100efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *reset)(struct efi_simple_network *this,
6110efe1bcfSAlexander Graf 			int extended_verification);
6120efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *shutdown)(struct efi_simple_network *this);
6130efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *receive_filters)(struct efi_simple_network *this,
6140efe1bcfSAlexander Graf 			u32 enable, u32 disable, int reset_mcast_filter,
6150efe1bcfSAlexander Graf 			ulong mcast_filter_count,
6160efe1bcfSAlexander Graf 			struct efi_mac_address *mcast_filter);
6170efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *station_address)(struct efi_simple_network *this,
6180efe1bcfSAlexander Graf 			int reset, struct efi_mac_address *new_mac);
6190efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *statistics)(struct efi_simple_network *this,
6200efe1bcfSAlexander Graf 			int reset, ulong *stat_size, void *stat_table);
6210efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *mcastiptomac)(struct efi_simple_network *this,
6220efe1bcfSAlexander Graf 			int ipv6, struct efi_ip_address *ip,
6230efe1bcfSAlexander Graf 			struct efi_mac_address *mac);
6240efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *nvdata)(struct efi_simple_network *this,
6250efe1bcfSAlexander Graf 			int read_write, ulong offset, ulong buffer_size,
6260efe1bcfSAlexander Graf 			char *buffer);
6270efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *get_status)(struct efi_simple_network *this,
6280efe1bcfSAlexander Graf 			u32 *int_status, void **txbuf);
6290efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *transmit)(struct efi_simple_network *this,
6300efe1bcfSAlexander Graf 			ulong header_size, ulong buffer_size, void *buffer,
6310efe1bcfSAlexander Graf 			struct efi_mac_address *src_addr,
6320efe1bcfSAlexander Graf 			struct efi_mac_address *dest_addr, u16 *protocol);
6330efe1bcfSAlexander Graf 	efi_status_t (EFIAPI *receive)(struct efi_simple_network *this,
6340efe1bcfSAlexander Graf 			ulong *header_size, ulong *buffer_size, void *buffer,
6350efe1bcfSAlexander Graf 			struct efi_mac_address *src_addr,
6360efe1bcfSAlexander Graf 			struct efi_mac_address *dest_addr, u16 *protocol);
6370efe1bcfSAlexander Graf 	void (EFIAPI *waitforpacket)(void);
6380efe1bcfSAlexander Graf 	struct efi_simple_network_mode *mode;
6390efe1bcfSAlexander Graf };
6400efe1bcfSAlexander Graf 
6410efe1bcfSAlexander Graf #define EFI_PXE_GUID \
6420efe1bcfSAlexander Graf 	EFI_GUID(0x03c4e603, 0xac28, 0x11d3, \
6430efe1bcfSAlexander Graf 		 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
6440efe1bcfSAlexander Graf 
6450efe1bcfSAlexander Graf struct efi_pxe_packet {
6460efe1bcfSAlexander Graf 	u8 packet[1472];
6470efe1bcfSAlexander Graf };
6480efe1bcfSAlexander Graf 
6490efe1bcfSAlexander Graf struct efi_pxe_mode
6500efe1bcfSAlexander Graf {
6510efe1bcfSAlexander Graf 	u8 unused[52];
6520efe1bcfSAlexander Graf 	struct efi_pxe_packet dhcp_discover;
6530efe1bcfSAlexander Graf 	struct efi_pxe_packet dhcp_ack;
6540efe1bcfSAlexander Graf 	struct efi_pxe_packet proxy_offer;
6550efe1bcfSAlexander Graf 	struct efi_pxe_packet pxe_discover;
6560efe1bcfSAlexander Graf 	struct efi_pxe_packet pxe_reply;
6570efe1bcfSAlexander Graf };
6580efe1bcfSAlexander Graf 
6590efe1bcfSAlexander Graf struct efi_pxe {
6600efe1bcfSAlexander Graf 	u64 rev;
6610efe1bcfSAlexander Graf 	void (EFIAPI *start)(void);
6620efe1bcfSAlexander Graf 	void (EFIAPI *stop)(void);
6630efe1bcfSAlexander Graf 	void (EFIAPI *dhcp)(void);
6640efe1bcfSAlexander Graf 	void (EFIAPI *discover)(void);
6650efe1bcfSAlexander Graf 	void (EFIAPI *mftp)(void);
6660efe1bcfSAlexander Graf 	void (EFIAPI *udpwrite)(void);
6670efe1bcfSAlexander Graf 	void (EFIAPI *udpread)(void);
6680efe1bcfSAlexander Graf 	void (EFIAPI *setipfilter)(void);
6690efe1bcfSAlexander Graf 	void (EFIAPI *arp)(void);
6700efe1bcfSAlexander Graf 	void (EFIAPI *setparams)(void);
6710efe1bcfSAlexander Graf 	void (EFIAPI *setstationip)(void);
6720efe1bcfSAlexander Graf 	void (EFIAPI *setpackets)(void);
6730efe1bcfSAlexander Graf 	struct efi_pxe_mode *mode;
6740efe1bcfSAlexander Graf };
6750efe1bcfSAlexander Graf 
676867a6ac8SSimon Glass #endif
677