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