Blame view

include/efi_api.h 26.8 KB
867a6ac86   Simon Glass   efi: Add start-up...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  /*
   * Extensible Firmware Interface
   * Based on 'Extensible Firmware Interface Specification' version 0.9,
   * April 30, 1999
   *
   * Copyright (C) 1999 VA Linux Systems
   * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
   * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
   *	David Mosberger-Tang <davidm@hpl.hp.com>
   *	Stephane Eranian <eranian@hpl.hp.com>
   *
   * From include/linux/efi.h in kernel 4.1 with some additions/subtractions
   */
  
  #ifndef _EFI_API_H
  #define _EFI_API_H
  
  #include <efi.h>
a86aeaf22   Alexander Graf   efi_loader: Add e...
19
20
21
  #ifdef CONFIG_EFI_LOADER
  #include <asm/setjmp.h>
  #endif
2bb9b79d6   Alexander Graf   include/efi_api.h...
22
  /* Types and defines for EFI CreateEvent */
b521d29eb   xypron.glpk@gmx.de   efi_loader: param...
23
  enum efi_timer_delay {
2bb9b79d6   Alexander Graf   include/efi_api.h...
24
25
26
27
  	EFI_TIMER_STOP = 0,
  	EFI_TIMER_PERIODIC = 1,
  	EFI_TIMER_RELATIVE = 2
  };
152cade32   Heinrich Schuchardt   efi_loader: repla...
28
  #define efi_uintn_t size_t
3a45bc7fa   Rob Clark   efi_loader: Some ...
29
  typedef uint16_t *efi_string_t;
503f26955   xypron.glpk@gmx.de   efi_loader: corre...
30

c68415922   xypron.glpk@gmx.de   efi_loader: imple...
31
32
33
34
35
36
37
38
39
40
41
  #define EVT_TIMER				0x80000000
  #define EVT_RUNTIME				0x40000000
  #define EVT_NOTIFY_WAIT				0x00000100
  #define EVT_NOTIFY_SIGNAL			0x00000200
  #define EVT_SIGNAL_EXIT_BOOT_SERVICES		0x00000201
  #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE	0x60000202
  
  #define TPL_APPLICATION		0x04
  #define TPL_CALLBACK		0x08
  #define TPL_NOTIFY		0x10
  #define TPL_HIGH_LEVEL		0x1F
37a980b3f   Jonathan Gray   efi_loader: run C...
42

2fd945fe7   xypron.glpk@gmx.de   efi_loader: use s...
43
  struct efi_event;
867a6ac86   Simon Glass   efi: Add start-up...
44
45
46
  /* EFI Boot Services table */
  struct efi_boot_services {
  	struct efi_table_hdr hdr;
152cade32   Heinrich Schuchardt   efi_loader: repla...
47
48
  	efi_status_t (EFIAPI *raise_tpl)(efi_uintn_t new_tpl);
  	void (EFIAPI *restore_tpl)(efi_uintn_t old_tpl);
867a6ac86   Simon Glass   efi: Add start-up...
49

f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
50
  	efi_status_t (EFIAPI *allocate_pages)(int, int, efi_uintn_t,
867a6ac86   Simon Glass   efi: Add start-up...
51
  					      efi_physical_addr_t *);
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
52
53
54
55
56
57
58
  	efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, efi_uintn_t);
  	efi_status_t (EFIAPI *get_memory_map)(efi_uintn_t *memory_map_size,
  					      struct efi_mem_desc *desc,
  					      efi_uintn_t *key,
  					      efi_uintn_t *desc_size,
  					      u32 *desc_version);
  	efi_status_t (EFIAPI *allocate_pool)(int, efi_uintn_t, void **);
867a6ac86   Simon Glass   efi: Add start-up...
59
  	efi_status_t (EFIAPI *free_pool)(void *);
b521d29eb   xypron.glpk@gmx.de   efi_loader: param...
60
  	efi_status_t (EFIAPI *create_event)(uint32_t type,
152cade32   Heinrich Schuchardt   efi_loader: repla...
61
  			efi_uintn_t notify_tpl,
2fd945fe7   xypron.glpk@gmx.de   efi_loader: use s...
62
63
64
65
  			void (EFIAPI *notify_function) (
  					struct efi_event *event,
  					void *context),
  			void *notify_context, struct efi_event **event);
b521d29eb   xypron.glpk@gmx.de   efi_loader: param...
66
67
68
  	efi_status_t (EFIAPI *set_timer)(struct efi_event *event,
  					 enum efi_timer_delay type,
  					 uint64_t trigger_time);
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
69
70
71
  	efi_status_t (EFIAPI *wait_for_event)(efi_uintn_t number_of_events,
  					      struct efi_event **event,
  					      efi_uintn_t *index);
2fd945fe7   xypron.glpk@gmx.de   efi_loader: use s...
72
73
74
  	efi_status_t (EFIAPI *signal_event)(struct efi_event *event);
  	efi_status_t (EFIAPI *close_event)(struct efi_event *event);
  	efi_status_t (EFIAPI *check_event)(struct efi_event *event);
e0549f8a1   xypron.glpk@gmx.de   efi_loader: imple...
75
  #define EFI_NATIVE_INTERFACE	0x00000000
2bb9b79d6   Alexander Graf   include/efi_api.h...
76
  	efi_status_t (EFIAPI *install_protocol_interface)(
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
77
  			void **handle, const efi_guid_t *protocol,
2bb9b79d6   Alexander Graf   include/efi_api.h...
78
79
  			int protocol_interface_type, void *protocol_interface);
  	efi_status_t (EFIAPI *reinstall_protocol_interface)(
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
80
  			void *handle, const efi_guid_t *protocol,
2bb9b79d6   Alexander Graf   include/efi_api.h...
81
  			void *old_interface, void *new_interface);
2074f7006   Heinrich Schuchardt   efi_loader: consi...
82
83
84
85
86
87
  	efi_status_t (EFIAPI *uninstall_protocol_interface)(
  			efi_handle_t handle, const efi_guid_t *protocol,
  			void *protocol_interface);
  	efi_status_t (EFIAPI *handle_protocol)(
  			efi_handle_t handle, const efi_guid_t *protocol,
  			void **protocol_interface);
867a6ac86   Simon Glass   efi: Add start-up...
88
  	void *reserved;
2bb9b79d6   Alexander Graf   include/efi_api.h...
89
  	efi_status_t (EFIAPI *register_protocol_notify)(
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
90
  			const efi_guid_t *protocol, struct efi_event *event,
2bb9b79d6   Alexander Graf   include/efi_api.h...
91
  			void **registration);
867a6ac86   Simon Glass   efi: Add start-up...
92
93
  	efi_status_t (EFIAPI *locate_handle)(
  			enum efi_locate_search_type search_type,
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
94
  			const efi_guid_t *protocol, void *search_key,
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
95
  			efi_uintn_t *buffer_size, efi_handle_t *buffer);
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
96
  	efi_status_t (EFIAPI *locate_device_path)(const efi_guid_t *protocol,
867a6ac86   Simon Glass   efi: Add start-up...
97
98
  			struct efi_device_path **device_path,
  			efi_handle_t *device);
2bb9b79d6   Alexander Graf   include/efi_api.h...
99
100
  	efi_status_t (EFIAPI *install_configuration_table)(
  			efi_guid_t *guid, void *table);
867a6ac86   Simon Glass   efi: Add start-up...
101
102
103
104
105
106
107
108
109
110
111
  
  	efi_status_t (EFIAPI *load_image)(bool boot_policiy,
  			efi_handle_t parent_image,
  			struct efi_device_path *file_path, void *source_buffer,
  			unsigned long source_size, efi_handle_t *image);
  	efi_status_t (EFIAPI *start_image)(efi_handle_t handle,
  					   unsigned long *exitdata_size,
  					   s16 **exitdata);
  	efi_status_t (EFIAPI *exit)(efi_handle_t handle,
  				    efi_status_t exit_status,
  				    unsigned long exitdata_size, s16 *exitdata);
2074f7006   Heinrich Schuchardt   efi_loader: consi...
112
  	efi_status_t (EFIAPI *unload_image)(efi_handle_t image_handle);
867a6ac86   Simon Glass   efi: Add start-up...
113
114
115
116
  	efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long);
  
  	efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count);
  	efi_status_t (EFIAPI *stall)(unsigned long usecs);
2bb9b79d6   Alexander Graf   include/efi_api.h...
117
118
119
  	efi_status_t (EFIAPI *set_watchdog_timer)(unsigned long timeout,
  			uint64_t watchdog_code, unsigned long data_size,
  			uint16_t *watchdog_data);
867a6ac86   Simon Glass   efi: Add start-up...
120
121
122
123
  	efi_status_t(EFIAPI *connect_controller)(efi_handle_t controller_handle,
  			efi_handle_t *driver_image_handle,
  			struct efi_device_path *remaining_device_path,
  			bool recursive);
3ebcd0071   Heinrich Schuchardt   efi_loader: fix s...
124
125
126
127
  	efi_status_t (EFIAPI *disconnect_controller)(
  			efi_handle_t controller_handle,
  			efi_handle_t driver_image_handle,
  			efi_handle_t child_handle);
867a6ac86   Simon Glass   efi: Add start-up...
128
129
130
131
132
133
134
  #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
  #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
  #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
  #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
  #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
  #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
  	efi_status_t (EFIAPI *open_protocol)(efi_handle_t handle,
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
135
  			const efi_guid_t *protocol, void **interface,
867a6ac86   Simon Glass   efi: Add start-up...
136
137
  			efi_handle_t agent_handle,
  			efi_handle_t controller_handle, u32 attributes);
2074f7006   Heinrich Schuchardt   efi_loader: consi...
138
139
140
141
  	efi_status_t (EFIAPI *close_protocol)(
  			efi_handle_t handle, const efi_guid_t *protocol,
  			efi_handle_t agent_handle,
  			efi_handle_t controller_handle);
867a6ac86   Simon Glass   efi: Add start-up...
142
  	efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
143
  			const efi_guid_t *protocol,
867a6ac86   Simon Glass   efi: Add start-up...
144
  			struct efi_open_protocol_info_entry **entry_buffer,
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
145
  			efi_uintn_t *entry_count);
867a6ac86   Simon Glass   efi: Add start-up...
146
147
  	efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle,
  			efi_guid_t ***protocol_buffer,
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
148
  			efi_uintn_t *protocols_buffer_count);
867a6ac86   Simon Glass   efi: Add start-up...
149
150
  	efi_status_t (EFIAPI *locate_handle_buffer) (
  			enum efi_locate_search_type search_type,
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
151
  			const efi_guid_t *protocol, void *search_key,
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
152
  			efi_uintn_t *no_handles, efi_handle_t **buffer);
5a9682d0d   Heinrich Schuchardt   efi_loader: pass ...
153
  	efi_status_t (EFIAPI *locate_protocol)(const efi_guid_t *protocol,
2bb9b79d6   Alexander Graf   include/efi_api.h...
154
155
156
157
158
159
160
  			void *registration, void **protocol_interface);
  	efi_status_t (EFIAPI *install_multiple_protocol_interfaces)(
  			void **handle, ...);
  	efi_status_t (EFIAPI *uninstall_multiple_protocol_interfaces)(
  			void *handle, ...);
  	efi_status_t (EFIAPI *calculate_crc32)(void *data,
  			unsigned long data_size, uint32_t *crc32);
fc05a9590   Heinrich Schuchardt   efi_loader: param...
161
162
163
  	void (EFIAPI *copy_mem)(void *destination, const void *source,
  			size_t length);
  	void (EFIAPI *set_mem)(void *buffer, size_t size, uint8_t value);
9f0930e5d   Heinrich Schuchardt   efi_loader: creat...
164
165
166
167
168
169
170
171
  	efi_status_t (EFIAPI *create_event_ex)(
  				uint32_t type, efi_uintn_t notify_tpl,
  				void (EFIAPI *notify_function) (
  					struct efi_event *event,
  					void *context),
  				void *notify_context,
  				efi_guid_t *event_group,
  				struct efi_event **event);
867a6ac86   Simon Glass   efi: Add start-up...
172
173
174
175
176
177
178
179
180
181
182
183
  };
  
  /* Types and defines for EFI ResetSystem */
  enum efi_reset_type {
  	EFI_RESET_COLD = 0,
  	EFI_RESET_WARM = 1,
  	EFI_RESET_SHUTDOWN = 2
  };
  
  /* EFI Runtime Services table */
  #define EFI_RUNTIME_SERVICES_SIGNATURE	0x5652453544e5552ULL
  #define EFI_RUNTIME_SERVICES_REVISION	0x00010000
0c2307431   Heinrich Schuchardt   efi_loader: add m...
184
185
186
187
188
189
190
191
192
193
  #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET	0x00010000
  #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE	0x00020000
  #define CAPSULE_FLAGS_INITIATE_RESET		0x00040000
  
  struct efi_capsule_header {
  	efi_guid_t *capsule_guid;
  	u32 header_size;
  	u32 flags;
  	u32 capsule_image_size;
  };
867a6ac86   Simon Glass   efi: Add start-up...
194
195
  struct efi_runtime_services {
  	struct efi_table_hdr hdr;
2bb9b79d6   Alexander Graf   include/efi_api.h...
196
197
198
199
200
201
202
203
204
205
206
207
208
  	efi_status_t (EFIAPI *get_time)(struct efi_time *time,
  			struct efi_time_cap *capabilities);
  	efi_status_t (EFIAPI *set_time)(struct efi_time *time);
  	efi_status_t (EFIAPI *get_wakeup_time)(char *enabled, char *pending,
  			struct efi_time *time);
  	efi_status_t (EFIAPI *set_wakeup_time)(char enabled,
  			struct efi_time *time);
  	efi_status_t (EFIAPI *set_virtual_address_map)(
  			unsigned long memory_map_size,
  			unsigned long descriptor_size,
  			uint32_t descriptor_version,
  			struct efi_mem_desc *virtmap);
  	efi_status_t (*convert_pointer)(unsigned long dbg, void **address);
867a6ac86   Simon Glass   efi: Add start-up...
209
210
211
212
213
214
215
216
217
  	efi_status_t (EFIAPI *get_variable)(s16 *variable_name,
  			efi_guid_t *vendor, u32 *attributes,
  			unsigned long *data_size, void *data);
  	efi_status_t (EFIAPI *get_next_variable)(
  			unsigned long *variable_name_size,
  			s16 *variable_name, efi_guid_t *vendor);
  	efi_status_t (EFIAPI *set_variable)(s16 *variable_name,
  			efi_guid_t *vendor, u32 attributes,
  			unsigned long data_size, void *data);
2bb9b79d6   Alexander Graf   include/efi_api.h...
218
219
  	efi_status_t (EFIAPI *get_next_high_mono_count)(
  			uint32_t *high_count);
867a6ac86   Simon Glass   efi: Add start-up...
220
221
222
  	void (EFIAPI *reset_system)(enum efi_reset_type reset_type,
  				    efi_status_t reset_status,
  				    unsigned long data_size, void *reset_data);
0c2307431   Heinrich Schuchardt   efi_loader: add m...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
  	efi_status_t (EFIAPI *update_capsule)(
  			struct efi_capsule_header **capsule_header_array,
  			efi_uintn_t capsule_count,
  			u64 scatter_gather_list);
  	efi_status_t (EFIAPI *query_capsule_caps)(
  			struct efi_capsule_header **capsule_header_array,
  			efi_uintn_t capsule_count,
  			u64 maximum_capsule_size,
  			u32 reset_type);
  	efi_status_t (EFIAPI *query_variable_info)(
  			u32 attributes,
  			u64 maximum_variable_storage_size,
  			u64 remaining_variable_storage_size,
  			u64 maximum_variable_size);
867a6ac86   Simon Glass   efi: Add start-up...
237
238
239
240
241
242
  };
  
  /* EFI Configuration Table and GUID definitions */
  #define NULL_GUID \
  	EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
  		 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
9975fe96b   Rob Clark   efi_loader: add b...
243
244
245
  #define EFI_GLOBAL_VARIABLE_GUID \
  	EFI_GUID(0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, \
  		 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c)
867a6ac86   Simon Glass   efi: Add start-up...
246
247
248
  #define LOADED_IMAGE_PROTOCOL_GUID \
  	EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, \
  		 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
2bb9b79d6   Alexander Graf   include/efi_api.h...
249
250
251
  #define EFI_FDT_GUID \
  	EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, \
  		 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
e663b350f   Alexander Graf   smbios: Expose in...
252
253
254
  #define SMBIOS_TABLE_GUID \
  	EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3,  \
  		 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
2bb9b79d6   Alexander Graf   include/efi_api.h...
255
256
257
258
259
260
261
  struct efi_configuration_table
  {
  	efi_guid_t guid;
  	void *table;
  };
  
  #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
867a6ac86   Simon Glass   efi: Add start-up...
262
263
264
265
  struct efi_system_table {
  	struct efi_table_hdr hdr;
  	unsigned long fw_vendor;   /* physical addr of wchar_t vendor string */
  	u32 fw_revision;
cc20ed03f   Heinrich Schuchardt   efi_loader: fix E...
266
  	efi_handle_t con_in_handle;
867a6ac86   Simon Glass   efi: Add start-up...
267
  	struct efi_simple_input_interface *con_in;
cc20ed03f   Heinrich Schuchardt   efi_loader: fix E...
268
  	efi_handle_t con_out_handle;
867a6ac86   Simon Glass   efi: Add start-up...
269
  	struct efi_simple_text_output_protocol *con_out;
cc20ed03f   Heinrich Schuchardt   efi_loader: fix E...
270
  	efi_handle_t stderr_handle;
2bb9b79d6   Alexander Graf   include/efi_api.h...
271
  	struct efi_simple_text_output_protocol *std_err;
867a6ac86   Simon Glass   efi: Add start-up...
272
273
  	struct efi_runtime_services *runtime;
  	struct efi_boot_services *boottime;
f5a2a9389   Heinrich Schuchardt   efi_loader: consi...
274
  	efi_uintn_t nr_tables;
2bb9b79d6   Alexander Graf   include/efi_api.h...
275
  	struct efi_configuration_table *tables;
867a6ac86   Simon Glass   efi: Add start-up...
276
  };
2bb9b79d6   Alexander Graf   include/efi_api.h...
277
278
279
  #define LOADED_IMAGE_GUID \
  	EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \
  		 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
867a6ac86   Simon Glass   efi: Add start-up...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
  struct efi_loaded_image {
  	u32 revision;
  	void *parent_handle;
  	struct efi_system_table *system_table;
  	void *device_handle;
  	void *file_path;
  	void *reserved;
  	u32 load_options_size;
  	void *load_options;
  	void *image_base;
  	aligned_u64 image_size;
  	unsigned int image_code_type;
  	unsigned int image_data_type;
  	unsigned long unload;
a86aeaf22   Alexander Graf   efi_loader: Add e...
294
295
296
297
298
299
  
  	/* Below are efi loader private fields */
  #ifdef CONFIG_EFI_LOADER
  	efi_status_t exit_status;
  	struct jmp_buf_data exit_jmp;
  #endif
867a6ac86   Simon Glass   efi: Add start-up...
300
  };
2bb9b79d6   Alexander Graf   include/efi_api.h...
301
302
303
304
305
306
  #define DEVICE_PATH_GUID \
  	EFI_GUID(0x09576e91, 0x6d3f, 0x11d2, \
  		 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
  
  #define DEVICE_PATH_TYPE_END			0x7f
  #  define DEVICE_PATH_SUB_TYPE_END		0xff
867a6ac86   Simon Glass   efi: Add start-up...
307
308
309
310
  struct efi_device_path {
  	u8 type;
  	u8 sub_type;
  	u16 length;
a8606ef07   Rob Clark   efi: add some mis...
311
  } __packed;
867a6ac86   Simon Glass   efi: Add start-up...
312

d7608aba3   Oleksandr Tymoshenko   efi: Use device d...
313
314
  struct efi_mac_addr {
  	u8 addr[32];
a8606ef07   Rob Clark   efi: add some mis...
315
  } __packed;
d7608aba3   Oleksandr Tymoshenko   efi: Use device d...
316

c80214ce1   Peter Jones   efi: add some mor...
317
  #define DEVICE_PATH_TYPE_HARDWARE_DEVICE	0x01
bf19273e8   Rob Clark   efi_loader: Add m...
318
  #  define DEVICE_PATH_SUB_TYPE_MEMORY		0x03
c80214ce1   Peter Jones   efi: add some mor...
319
  #  define DEVICE_PATH_SUB_TYPE_VENDOR		0x04
bf19273e8   Rob Clark   efi_loader: Add m...
320
321
322
323
324
325
  struct efi_device_path_memory {
  	struct efi_device_path dp;
  	u32 memory_type;
  	u64 start_address;
  	u64 end_address;
  } __packed;
c80214ce1   Peter Jones   efi: add some mor...
326
327
328
329
330
331
332
333
334
335
336
  struct efi_device_path_vendor {
  	struct efi_device_path dp;
  	efi_guid_t guid;
  	u8 vendor_data[];
  } __packed;
  
  #define DEVICE_PATH_TYPE_ACPI_DEVICE		0x02
  #  define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE	0x01
  
  #define EFI_PNP_ID(ID)				(u32)(((ID) << 16) | 0x41D0)
  #define EISA_PNP_ID(ID)				EFI_PNP_ID(ID)
adae4313c   Rob Clark   efi_loader: flesh...
337
  #define EISA_PNP_NUM(ID)			((ID) >> 16)
c80214ce1   Peter Jones   efi: add some mor...
338
339
340
341
342
343
  
  struct efi_device_path_acpi_path {
  	struct efi_device_path dp;
  	u32 hid;
  	u32 uid;
  } __packed;
d7608aba3   Oleksandr Tymoshenko   efi: Use device d...
344
  #define DEVICE_PATH_TYPE_MESSAGING_DEVICE	0x03
af3106a12   Heinrich Schuchardt   efi_loader: suppo...
345
346
  #  define DEVICE_PATH_SUB_TYPE_MSG_ATAPI	0x01
  #  define DEVICE_PATH_SUB_TYPE_MSG_SCSI		0x02
c80214ce1   Peter Jones   efi: add some mor...
347
  #  define DEVICE_PATH_SUB_TYPE_MSG_USB		0x05
d7608aba3   Oleksandr Tymoshenko   efi: Use device d...
348
  #  define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR	0x0b
b66c60dde   Rob Clark   efi_loader: add d...
349
  #  define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS	0x0f
c80214ce1   Peter Jones   efi: add some mor...
350
351
  #  define DEVICE_PATH_SUB_TYPE_MSG_SD		0x1a
  #  define DEVICE_PATH_SUB_TYPE_MSG_MMC		0x1d
af3106a12   Heinrich Schuchardt   efi_loader: suppo...
352
353
354
355
356
357
358
359
360
361
362
363
  struct efi_device_path_atapi {
  	struct efi_device_path dp;
  	u8 primary_secondary;
  	u8 slave_master;
  	u16 logical_unit_number;
  } __packed;
  
  struct efi_device_path_scsi {
  	struct efi_device_path dp;
  	u16 target_id;
  	u16 logical_unit_number;
  } __packed;
c80214ce1   Peter Jones   efi: add some mor...
364
365
366
367
368
  struct efi_device_path_usb {
  	struct efi_device_path dp;
  	u8 parent_port_number;
  	u8 usb_interface;
  } __packed;
d7608aba3   Oleksandr Tymoshenko   efi: Use device d...
369
370
371
372
373
  
  struct efi_device_path_mac_addr {
  	struct efi_device_path dp;
  	struct efi_mac_addr mac;
  	u8 if_type;
a8606ef07   Rob Clark   efi: add some mis...
374
  } __packed;
d7608aba3   Oleksandr Tymoshenko   efi: Use device d...
375

b66c60dde   Rob Clark   efi_loader: add d...
376
377
378
379
380
381
382
383
  struct efi_device_path_usb_class {
  	struct efi_device_path dp;
  	u16 vendor_id;
  	u16 product_id;
  	u8 device_class;
  	u8 device_subclass;
  	u8 device_protocol;
  } __packed;
c80214ce1   Peter Jones   efi: add some mor...
384
385
386
387
  struct efi_device_path_sd_mmc_path {
  	struct efi_device_path dp;
  	u8 slot_number;
  } __packed;
2bb9b79d6   Alexander Graf   include/efi_api.h...
388
  #define DEVICE_PATH_TYPE_MEDIA_DEVICE		0x04
c80214ce1   Peter Jones   efi: add some mor...
389
390
  #  define DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH	0x01
  #  define DEVICE_PATH_SUB_TYPE_CDROM_PATH	0x02
2bb9b79d6   Alexander Graf   include/efi_api.h...
391
  #  define DEVICE_PATH_SUB_TYPE_FILE_PATH	0x04
c80214ce1   Peter Jones   efi: add some mor...
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
  struct efi_device_path_hard_drive_path {
  	struct efi_device_path dp;
  	u32 partition_number;
  	u64 partition_start;
  	u64 partition_end;
  	u8 partition_signature[16];
  	u8 partmap_type;
  	u8 signature_type;
  } __packed;
  
  struct efi_device_path_cdrom_path {
  	struct efi_device_path dp;
  	u32 boot_entry;
  	u64 partition_start;
  	u64 partition_end;
  } __packed;
2bb9b79d6   Alexander Graf   include/efi_api.h...
408
409
  struct efi_device_path_file_path {
  	struct efi_device_path dp;
61b7e2247   Rob Clark   efi_loader: file_...
410
  	u16 str[];
a8606ef07   Rob Clark   efi: add some mis...
411
  } __packed;
2bb9b79d6   Alexander Graf   include/efi_api.h...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
  
  #define BLOCK_IO_GUID \
  	EFI_GUID(0x964e5b21, 0x6459, 0x11d2, \
  		 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  
  struct efi_block_io_media
  {
  	u32 media_id;
  	char removable_media;
  	char media_present;
  	char logical_partition;
  	char read_only;
  	char write_caching;
  	u8 pad[3];
  	u32 block_size;
  	u32 io_align;
  	u8 pad2[4];
  	u64 last_block;
4f94865b3   Heinrich Schuchardt   efi_loader: corre...
430
431
432
433
434
  	/* Added in revision 2 of the protocol */
  	u64 lowest_aligned_lba;
  	u32 logical_blocks_per_physical_block;
  	/* Added in revision 3 of the protocol */
  	u32 optimal_transfer_length_granualarity;
2bb9b79d6   Alexander Graf   include/efi_api.h...
435
  };
4f94865b3   Heinrich Schuchardt   efi_loader: corre...
436
437
  #define EFI_BLOCK_IO_PROTOCOL_REVISION2	0x00020001
  #define EFI_BLOCK_IO_PROTOCOL_REVISION3	0x0002001f
2bb9b79d6   Alexander Graf   include/efi_api.h...
438
439
440
441
442
443
  struct efi_block_io {
  	u64 revision;
  	struct efi_block_io_media *media;
  	efi_status_t (EFIAPI *reset)(struct efi_block_io *this,
  			char extended_verification);
  	efi_status_t (EFIAPI *read_blocks)(struct efi_block_io *this,
4f94865b3   Heinrich Schuchardt   efi_loader: corre...
444
  			u32 media_id, u64 lba, efi_uintn_t buffer_size,
2bb9b79d6   Alexander Graf   include/efi_api.h...
445
446
  			void *buffer);
  	efi_status_t (EFIAPI *write_blocks)(struct efi_block_io *this,
4f94865b3   Heinrich Schuchardt   efi_loader: corre...
447
  			u32 media_id, u64 lba, efi_uintn_t buffer_size,
2bb9b79d6   Alexander Graf   include/efi_api.h...
448
449
450
  			void *buffer);
  	efi_status_t (EFIAPI *flush_blocks)(struct efi_block_io *this);
  };
867a6ac86   Simon Glass   efi: Add start-up...
451
452
453
454
455
456
457
458
  struct simple_text_output_mode {
  	s32 max_mode;
  	s32 mode;
  	s32 attribute;
  	s32 cursor_column;
  	s32 cursor_row;
  	bool cursor_visible;
  };
a17e62cc5   Rob Clark   efi_loader: expos...
459
460
461
462
  
  #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
  	EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
  		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
2d5dc2a52   Rob Clark   efi_loader: conso...
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
  #define EFI_BLACK                0x00
  #define EFI_BLUE                 0x01
  #define EFI_GREEN                0x02
  #define EFI_CYAN                 0x03
  #define EFI_RED                  0x04
  #define EFI_MAGENTA              0x05
  #define EFI_BROWN                0x06
  #define EFI_LIGHTGRAY            0x07
  #define EFI_BRIGHT               0x08
  #define EFI_DARKGRAY             0x08
  #define EFI_LIGHTBLUE            0x09
  #define EFI_LIGHTGREEN           0x0a
  #define EFI_LIGHTCYAN            0x0b
  #define EFI_LIGHTRED             0x0c
  #define EFI_LIGHTMAGENTA         0x0d
  #define EFI_YELLOW               0x0e
  #define EFI_WHITE                0x0f
  #define EFI_BACKGROUND_BLACK     0x00
  #define EFI_BACKGROUND_BLUE      0x10
  #define EFI_BACKGROUND_GREEN     0x20
  #define EFI_BACKGROUND_CYAN      0x30
  #define EFI_BACKGROUND_RED       0x40
  #define EFI_BACKGROUND_MAGENTA   0x50
  #define EFI_BACKGROUND_BROWN     0x60
  #define EFI_BACKGROUND_LIGHTGRAY 0x70
  
  /* extract foreground color from EFI attribute */
  #define EFI_ATTR_FG(attr)        ((attr) & 0x07)
  /* treat high bit of FG as bright/bold (similar to edk2) */
  #define EFI_ATTR_BOLD(attr)      (((attr) >> 3) & 0x01)
  /* extract background color from EFI attribute */
  #define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)
867a6ac86   Simon Glass   efi: Add start-up...
495
496
497
498
  struct efi_simple_text_output_protocol {
  	void *reset;
  	efi_status_t (EFIAPI *output_string)(
  			struct efi_simple_text_output_protocol *this,
3a45bc7fa   Rob Clark   efi_loader: Some ...
499
  			const efi_string_t str);
2bb9b79d6   Alexander Graf   include/efi_api.h...
500
501
  	efi_status_t (EFIAPI *test_string)(
  			struct efi_simple_text_output_protocol *this,
3a45bc7fa   Rob Clark   efi_loader: Some ...
502
  			const efi_string_t str);
867a6ac86   Simon Glass   efi: Add start-up...
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
  	efi_status_t(EFIAPI *query_mode)(
  			struct efi_simple_text_output_protocol *this,
  			unsigned long mode_number, unsigned long *columns,
  			unsigned long *rows);
  	efi_status_t(EFIAPI *set_mode)(
  			struct efi_simple_text_output_protocol *this,
  			unsigned long mode_number);
  	efi_status_t(EFIAPI *set_attribute)(
  			struct efi_simple_text_output_protocol *this,
  			unsigned long attribute);
  	efi_status_t(EFIAPI *clear_screen) (
  			struct efi_simple_text_output_protocol *this);
  	efi_status_t(EFIAPI *set_cursor_position) (
  			struct efi_simple_text_output_protocol *this,
  			unsigned long column, unsigned long row);
2bb9b79d6   Alexander Graf   include/efi_api.h...
518
519
520
  	efi_status_t(EFIAPI *enable_cursor)(
  			struct efi_simple_text_output_protocol *this,
  			bool enable);
867a6ac86   Simon Glass   efi: Add start-up...
521
522
523
524
525
526
527
  	struct simple_text_output_mode *mode;
  };
  
  struct efi_input_key {
  	u16 scan_code;
  	s16 unicode_char;
  };
a17e62cc5   Rob Clark   efi_loader: expos...
528
529
530
  #define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
  	EFI_GUID(0x387477c1, 0x69c7, 0x11d2, \
  		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
867a6ac86   Simon Glass   efi: Add start-up...
531
532
533
534
535
536
  struct efi_simple_input_interface {
  	efi_status_t(EFIAPI *reset)(struct efi_simple_input_interface *this,
  			bool ExtendedVerification);
  	efi_status_t(EFIAPI *read_key_stroke)(
  			struct efi_simple_input_interface *this,
  			struct efi_input_key *key);
2fd945fe7   xypron.glpk@gmx.de   efi_loader: use s...
537
  	struct efi_event *wait_for_key;
867a6ac86   Simon Glass   efi: Add start-up...
538
  };
2bb9b79d6   Alexander Graf   include/efi_api.h...
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
  #define CONSOLE_CONTROL_GUID \
  	EFI_GUID(0xf42f7782, 0x12e, 0x4c12, \
  		 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21)
  #define EFI_CONSOLE_MODE_TEXT	0
  #define EFI_CONSOLE_MODE_GFX	1
  
  struct efi_console_control_protocol
  {
  	efi_status_t (EFIAPI *get_mode)(
  			struct efi_console_control_protocol *this, int *mode,
  			char *uga_exists, char *std_in_locked);
  	efi_status_t (EFIAPI *set_mode)(
  			struct efi_console_control_protocol *this, int mode);
  	efi_status_t (EFIAPI *lock_std_in)(
  			struct efi_console_control_protocol *this,
  			uint16_t *password);
  };
cc5b70812   xypron.glpk@gmx.de   efi_loader: imple...
556
557
558
  #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
  	EFI_GUID(0x8b843e20, 0x8132, 0x4852, \
  		 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c)
cc5b70812   xypron.glpk@gmx.de   efi_loader: imple...
559
560
561
  struct efi_device_path_to_text_protocol
  {
  	uint16_t *(EFIAPI *convert_device_node_to_text)(
9309a1b76   Rob Clark   efi_loader: drop ...
562
  			struct efi_device_path *device_node,
cc5b70812   xypron.glpk@gmx.de   efi_loader: imple...
563
564
565
  			bool display_only,
  			bool allow_shortcuts);
  	uint16_t *(EFIAPI *convert_device_path_to_text)(
9309a1b76   Rob Clark   efi_loader: drop ...
566
  			struct efi_device_path *device_path,
cc5b70812   xypron.glpk@gmx.de   efi_loader: imple...
567
568
569
  			bool display_only,
  			bool allow_shortcuts);
  };
be8d32419   Alexander Graf   efi_loader: Add G...
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
  #define EFI_GOP_GUID \
  	EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
  		 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
  
  #define EFI_GOT_RGBA8		0
  #define EFI_GOT_BGRA8		1
  #define EFI_GOT_BITMASK		2
  
  struct efi_gop_mode_info
  {
  	u32 version;
  	u32 width;
  	u32 height;
  	u32 pixel_format;
  	u32 pixel_bitmask[4];
  	u32 pixels_per_scanline;
  };
  
  struct efi_gop_mode
  {
  	u32 max_mode;
  	u32 mode;
  	struct efi_gop_mode_info *info;
  	unsigned long info_size;
  	efi_physical_addr_t fb_base;
  	unsigned long fb_size;
  };
  
  #define EFI_BLT_VIDEO_FILL		0
  #define EFI_BLT_VIDEO_TO_BLT_BUFFER	1
  #define EFI_BLT_BUFFER_TO_VIDEO		2
  #define EFI_BLT_VIDEO_TO_VIDEO		3
  
  struct efi_gop
  {
  	efi_status_t (EFIAPI *query_mode)(struct efi_gop *this, u32 mode_number,
1c38a7741   Heinrich Schuchardt   efi_loader: efi_g...
606
  					  efi_uintn_t *size_of_info,
be8d32419   Alexander Graf   efi_loader: Add G...
607
608
609
  					  struct efi_gop_mode_info **info);
  	efi_status_t (EFIAPI *set_mode)(struct efi_gop *this, u32 mode_number);
  	efi_status_t (EFIAPI *blt)(struct efi_gop *this, void *buffer,
1c38a7741   Heinrich Schuchardt   efi_loader: efi_g...
610
611
612
613
  				   u32 operation, efi_uintn_t sx,
  				   efi_uintn_t sy, efi_uintn_t dx,
  				   efi_uintn_t dy, efi_uintn_t width,
  				   efi_uintn_t height, efi_uintn_t delta);
be8d32419   Alexander Graf   efi_loader: Add G...
614
615
  	struct efi_gop_mode *mode;
  };
0efe1bcf5   Alexander Graf   efi_loader: Add n...
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
  #define EFI_SIMPLE_NETWORK_GUID \
  	EFI_GUID(0xa19832b9, 0xac25, 0x11d3, \
  		 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
  
  struct efi_mac_address {
  	char mac_addr[32];
  };
  
  struct efi_ip_address {
  	u8 ip_addr[16];
  };
  
  enum efi_simple_network_state {
  	EFI_NETWORK_STOPPED,
  	EFI_NETWORK_STARTED,
  	EFI_NETWORK_INITIALIZED,
  };
  
  struct efi_simple_network_mode {
  	enum efi_simple_network_state state;
  	u32 hwaddr_size;
  	u32 media_header_size;
  	u32 max_packet_size;
  	u32 nvram_size;
  	u32 nvram_access_size;
  	u32 receive_filter_mask;
  	u32 receive_filter_setting;
  	u32 max_mcast_filter_count;
  	u32 mcast_filter_count;
  	struct efi_mac_address mcast_filter[16];
  	struct efi_mac_address current_address;
  	struct efi_mac_address broadcast_address;
  	struct efi_mac_address permanent_address;
  	u8 if_type;
  	u8 mac_changeable;
  	u8 multitx_supported;
  	u8 media_present_supported;
  	u8 media_present;
  };
2e0864a47   Heinrich Schuchardt   efi_loader: corre...
655
656
657
658
659
660
  /* receive_filters bit mask */
  #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST               0x01
  #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST             0x02
  #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST             0x04
  #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS           0x08
  #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
0efe1bcf5   Alexander Graf   efi_loader: Add n...
661

891b3d905   Heinrich Schuchardt   efi_loader: fix e...
662
663
664
665
666
  /* interrupt status bit mask */
  #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT	0x01
  #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT	0x02
  #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT	0x04
  #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT	0x08
bdecf974f   Heinrich Schuchardt   efi_loader: fill ...
667
668
  /* revision of the simple network protocol */
  #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION	0x00010000
0efe1bcf5   Alexander Graf   efi_loader: Add n...
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
  struct efi_simple_network
  {
  	u64 revision;
  	efi_status_t (EFIAPI *start)(struct efi_simple_network *this);
  	efi_status_t (EFIAPI *stop)(struct efi_simple_network *this);
  	efi_status_t (EFIAPI *initialize)(struct efi_simple_network *this,
  			ulong extra_rx, ulong extra_tx);
  	efi_status_t (EFIAPI *reset)(struct efi_simple_network *this,
  			int extended_verification);
  	efi_status_t (EFIAPI *shutdown)(struct efi_simple_network *this);
  	efi_status_t (EFIAPI *receive_filters)(struct efi_simple_network *this,
  			u32 enable, u32 disable, int reset_mcast_filter,
  			ulong mcast_filter_count,
  			struct efi_mac_address *mcast_filter);
  	efi_status_t (EFIAPI *station_address)(struct efi_simple_network *this,
  			int reset, struct efi_mac_address *new_mac);
  	efi_status_t (EFIAPI *statistics)(struct efi_simple_network *this,
  			int reset, ulong *stat_size, void *stat_table);
  	efi_status_t (EFIAPI *mcastiptomac)(struct efi_simple_network *this,
  			int ipv6, struct efi_ip_address *ip,
  			struct efi_mac_address *mac);
  	efi_status_t (EFIAPI *nvdata)(struct efi_simple_network *this,
  			int read_write, ulong offset, ulong buffer_size,
  			char *buffer);
  	efi_status_t (EFIAPI *get_status)(struct efi_simple_network *this,
  			u32 *int_status, void **txbuf);
  	efi_status_t (EFIAPI *transmit)(struct efi_simple_network *this,
8db174d65   Heinrich Schuchardt   efi_loader: size ...
696
  			size_t header_size, size_t buffer_size, void *buffer,
0efe1bcf5   Alexander Graf   efi_loader: Add n...
697
698
699
  			struct efi_mac_address *src_addr,
  			struct efi_mac_address *dest_addr, u16 *protocol);
  	efi_status_t (EFIAPI *receive)(struct efi_simple_network *this,
8db174d65   Heinrich Schuchardt   efi_loader: size ...
700
  			size_t *header_size, size_t *buffer_size, void *buffer,
0efe1bcf5   Alexander Graf   efi_loader: Add n...
701
702
  			struct efi_mac_address *src_addr,
  			struct efi_mac_address *dest_addr, u16 *protocol);
84a12ce64   Heinrich Schuchardt   efi_loader: incor...
703
  	struct efi_event *wait_for_packet;
0efe1bcf5   Alexander Graf   efi_loader: Add n...
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
  	struct efi_simple_network_mode *mode;
  };
  
  #define EFI_PXE_GUID \
  	EFI_GUID(0x03c4e603, 0xac28, 0x11d3, \
  		 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
  
  struct efi_pxe_packet {
  	u8 packet[1472];
  };
  
  struct efi_pxe_mode
  {
  	u8 unused[52];
  	struct efi_pxe_packet dhcp_discover;
  	struct efi_pxe_packet dhcp_ack;
  	struct efi_pxe_packet proxy_offer;
  	struct efi_pxe_packet pxe_discover;
  	struct efi_pxe_packet pxe_reply;
  };
  
  struct efi_pxe {
  	u64 rev;
  	void (EFIAPI *start)(void);
  	void (EFIAPI *stop)(void);
  	void (EFIAPI *dhcp)(void);
  	void (EFIAPI *discover)(void);
  	void (EFIAPI *mftp)(void);
  	void (EFIAPI *udpwrite)(void);
  	void (EFIAPI *udpread)(void);
  	void (EFIAPI *setipfilter)(void);
  	void (EFIAPI *arp)(void);
  	void (EFIAPI *setparams)(void);
  	void (EFIAPI *setstationip)(void);
  	void (EFIAPI *setpackets)(void);
  	struct efi_pxe_mode *mode;
  };
2a92080d8   Rob Clark   efi_loader: add f...
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
  #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  	EFI_GUID(0x964e5b22, 0x6459, 0x11d2, \
  		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  #define EFI_FILE_PROTOCOL_REVISION 0x00010000
  
  struct efi_file_handle {
  	u64 rev;
  	efi_status_t (EFIAPI *open)(struct efi_file_handle *file,
  			struct efi_file_handle **new_handle,
  			s16 *file_name, u64 open_mode, u64 attributes);
  	efi_status_t (EFIAPI *close)(struct efi_file_handle *file);
  	efi_status_t (EFIAPI *delete)(struct efi_file_handle *file);
  	efi_status_t (EFIAPI *read)(struct efi_file_handle *file,
  			u64 *buffer_size, void *buffer);
  	efi_status_t (EFIAPI *write)(struct efi_file_handle *file,
  			u64 *buffer_size, void *buffer);
  	efi_status_t (EFIAPI *getpos)(struct efi_file_handle *file,
  			u64 *pos);
  	efi_status_t (EFIAPI *setpos)(struct efi_file_handle *file,
  			u64 pos);
  	efi_status_t (EFIAPI *getinfo)(struct efi_file_handle *file,
  			efi_guid_t *info_type, u64 *buffer_size, void *buffer);
  	efi_status_t (EFIAPI *setinfo)(struct efi_file_handle *file,
  			efi_guid_t *info_type, u64 buffer_size, void *buffer);
  	efi_status_t (EFIAPI *flush)(struct efi_file_handle *file);
  };
  
  #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  	EFI_GUID(0x964e5b22, 0x6459, 0x11d2, \
  		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
  
  struct efi_simple_file_system_protocol {
  	u64 rev;
  	efi_status_t (EFIAPI *open_volume)(struct efi_simple_file_system_protocol *this,
  			struct efi_file_handle **root);
  };
  
  #define EFI_FILE_INFO_GUID \
  	EFI_GUID(0x9576e92, 0x6d3f, 0x11d2, \
  		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  
  #define EFI_FILE_MODE_READ	0x0000000000000001
  #define EFI_FILE_MODE_WRITE	0x0000000000000002
  #define EFI_FILE_MODE_CREATE	0x8000000000000000
  
  #define EFI_FILE_READ_ONLY	0x0000000000000001
  #define EFI_FILE_HIDDEN		0x0000000000000002
  #define EFI_FILE_SYSTEM		0x0000000000000004
  #define EFI_FILE_RESERVED	0x0000000000000008
  #define EFI_FILE_DIRECTORY	0x0000000000000010
  #define EFI_FILE_ARCHIVE	0x0000000000000020
  #define EFI_FILE_VALID_ATTR	0x0000000000000037
  
  struct efi_file_info {
  	u64 size;
  	u64 file_size;
  	u64 physical_size;
  	struct efi_time create_time;
  	struct efi_time last_access_time;
  	struct efi_time modification_time;
  	u64 attribute;
  	s16 file_name[0];
  };
f0959dbee   Heinrich Schuchardt   efi_loader: imple...
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
  #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
  	EFI_GUID(0x18a031ab, 0xb443, 0x4d1a,\
  		 0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71)
  struct efi_driver_binding_protocol {
  	efi_status_t (EFIAPI * supported)(
  			struct efi_driver_binding_protocol *this,
  			efi_handle_t controller_handle,
  			struct efi_device_path *remaining_device_path);
  	efi_status_t (EFIAPI * start)(
  			struct efi_driver_binding_protocol *this,
  			efi_handle_t controller_handle,
  			struct efi_device_path *remaining_device_path);
  	efi_status_t (EFIAPI * stop)(
  			struct efi_driver_binding_protocol *this,
  			efi_handle_t controller_handle,
  			efi_uintn_t number_of_children,
  			efi_handle_t *child_handle_buffer);
  	u32 version;
  	efi_handle_t image_handle;
  	efi_handle_t driver_binding_handle;
  };
867a6ac86   Simon Glass   efi: Add start-up...
826
  #endif