efi_api.h 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Extensible Firmware Interface
  4. * Based on 'Extensible Firmware Interface Specification' version 0.9,
  5. * April 30, 1999
  6. *
  7. * Copyright (C) 1999 VA Linux Systems
  8. * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
  9. * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
  10. * David Mosberger-Tang <davidm@hpl.hp.com>
  11. * Stephane Eranian <eranian@hpl.hp.com>
  12. *
  13. * From include/linux/efi.h in kernel 4.1 with some additions/subtractions
  14. */
  15. #ifndef _EFI_API_H
  16. #define _EFI_API_H
  17. #include <efi.h>
  18. #ifdef CONFIG_EFI_LOADER
  19. #include <asm/setjmp.h>
  20. #endif
  21. /* UEFI spec version 2.7 */
  22. #define EFI_SPECIFICATION_VERSION (2 << 16 | 70)
  23. /* Types and defines for EFI CreateEvent */
  24. enum efi_timer_delay {
  25. EFI_TIMER_STOP = 0,
  26. EFI_TIMER_PERIODIC = 1,
  27. EFI_TIMER_RELATIVE = 2
  28. };
  29. #define efi_intn_t ssize_t
  30. #define efi_uintn_t size_t
  31. typedef uint16_t *efi_string_t;
  32. #define EVT_TIMER 0x80000000
  33. #define EVT_RUNTIME 0x40000000
  34. #define EVT_NOTIFY_WAIT 0x00000100
  35. #define EVT_NOTIFY_SIGNAL 0x00000200
  36. #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
  37. #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
  38. #define TPL_APPLICATION 0x04
  39. #define TPL_CALLBACK 0x08
  40. #define TPL_NOTIFY 0x10
  41. #define TPL_HIGH_LEVEL 0x1F
  42. struct efi_event;
  43. /* EFI Boot Services table */
  44. #define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
  45. struct efi_boot_services {
  46. struct efi_table_hdr hdr;
  47. efi_status_t (EFIAPI *raise_tpl)(efi_uintn_t new_tpl);
  48. void (EFIAPI *restore_tpl)(efi_uintn_t old_tpl);
  49. efi_status_t (EFIAPI *allocate_pages)(int, int, efi_uintn_t,
  50. efi_physical_addr_t *);
  51. efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, efi_uintn_t);
  52. efi_status_t (EFIAPI *get_memory_map)(efi_uintn_t *memory_map_size,
  53. struct efi_mem_desc *desc,
  54. efi_uintn_t *key,
  55. efi_uintn_t *desc_size,
  56. u32 *desc_version);
  57. efi_status_t (EFIAPI *allocate_pool)(int, efi_uintn_t, void **);
  58. efi_status_t (EFIAPI *free_pool)(void *);
  59. efi_status_t (EFIAPI *create_event)(uint32_t type,
  60. efi_uintn_t notify_tpl,
  61. void (EFIAPI *notify_function) (
  62. struct efi_event *event,
  63. void *context),
  64. void *notify_context, struct efi_event **event);
  65. efi_status_t (EFIAPI *set_timer)(struct efi_event *event,
  66. enum efi_timer_delay type,
  67. uint64_t trigger_time);
  68. efi_status_t (EFIAPI *wait_for_event)(efi_uintn_t number_of_events,
  69. struct efi_event **event,
  70. efi_uintn_t *index);
  71. efi_status_t (EFIAPI *signal_event)(struct efi_event *event);
  72. efi_status_t (EFIAPI *close_event)(struct efi_event *event);
  73. efi_status_t (EFIAPI *check_event)(struct efi_event *event);
  74. #define EFI_NATIVE_INTERFACE 0x00000000
  75. efi_status_t (EFIAPI *install_protocol_interface)(
  76. void **handle, const efi_guid_t *protocol,
  77. int protocol_interface_type, void *protocol_interface);
  78. efi_status_t (EFIAPI *reinstall_protocol_interface)(
  79. void *handle, const efi_guid_t *protocol,
  80. void *old_interface, void *new_interface);
  81. efi_status_t (EFIAPI *uninstall_protocol_interface)(
  82. efi_handle_t handle, const efi_guid_t *protocol,
  83. void *protocol_interface);
  84. efi_status_t (EFIAPI *handle_protocol)(
  85. efi_handle_t handle, const efi_guid_t *protocol,
  86. void **protocol_interface);
  87. void *reserved;
  88. efi_status_t (EFIAPI *register_protocol_notify)(
  89. const efi_guid_t *protocol, struct efi_event *event,
  90. void **registration);
  91. efi_status_t (EFIAPI *locate_handle)(
  92. enum efi_locate_search_type search_type,
  93. const efi_guid_t *protocol, void *search_key,
  94. efi_uintn_t *buffer_size, efi_handle_t *buffer);
  95. efi_status_t (EFIAPI *locate_device_path)(const efi_guid_t *protocol,
  96. struct efi_device_path **device_path,
  97. efi_handle_t *device);
  98. efi_status_t (EFIAPI *install_configuration_table)(
  99. efi_guid_t *guid, void *table);
  100. efi_status_t (EFIAPI *load_image)(bool boot_policiy,
  101. efi_handle_t parent_image,
  102. struct efi_device_path *file_path, void *source_buffer,
  103. efi_uintn_t source_size, efi_handle_t *image);
  104. efi_status_t (EFIAPI *start_image)(efi_handle_t handle,
  105. unsigned long *exitdata_size,
  106. s16 **exitdata);
  107. efi_status_t (EFIAPI *exit)(efi_handle_t handle,
  108. efi_status_t exit_status,
  109. unsigned long exitdata_size, s16 *exitdata);
  110. efi_status_t (EFIAPI *unload_image)(efi_handle_t image_handle);
  111. efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long);
  112. efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count);
  113. efi_status_t (EFIAPI *stall)(unsigned long usecs);
  114. efi_status_t (EFIAPI *set_watchdog_timer)(unsigned long timeout,
  115. uint64_t watchdog_code, unsigned long data_size,
  116. uint16_t *watchdog_data);
  117. efi_status_t(EFIAPI *connect_controller)(efi_handle_t controller_handle,
  118. efi_handle_t *driver_image_handle,
  119. struct efi_device_path *remaining_device_path,
  120. bool recursive);
  121. efi_status_t (EFIAPI *disconnect_controller)(
  122. efi_handle_t controller_handle,
  123. efi_handle_t driver_image_handle,
  124. efi_handle_t child_handle);
  125. #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
  126. #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
  127. #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
  128. #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
  129. #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
  130. #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
  131. efi_status_t (EFIAPI *open_protocol)(efi_handle_t handle,
  132. const efi_guid_t *protocol, void **interface,
  133. efi_handle_t agent_handle,
  134. efi_handle_t controller_handle, u32 attributes);
  135. efi_status_t (EFIAPI *close_protocol)(
  136. efi_handle_t handle, const efi_guid_t *protocol,
  137. efi_handle_t agent_handle,
  138. efi_handle_t controller_handle);
  139. efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
  140. const efi_guid_t *protocol,
  141. struct efi_open_protocol_info_entry **entry_buffer,
  142. efi_uintn_t *entry_count);
  143. efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle,
  144. efi_guid_t ***protocol_buffer,
  145. efi_uintn_t *protocols_buffer_count);
  146. efi_status_t (EFIAPI *locate_handle_buffer) (
  147. enum efi_locate_search_type search_type,
  148. const efi_guid_t *protocol, void *search_key,
  149. efi_uintn_t *no_handles, efi_handle_t **buffer);
  150. efi_status_t (EFIAPI *locate_protocol)(const efi_guid_t *protocol,
  151. void *registration, void **protocol_interface);
  152. efi_status_t (EFIAPI *install_multiple_protocol_interfaces)(
  153. void **handle, ...);
  154. efi_status_t (EFIAPI *uninstall_multiple_protocol_interfaces)(
  155. void *handle, ...);
  156. efi_status_t (EFIAPI *calculate_crc32)(const void *data,
  157. efi_uintn_t data_size,
  158. u32 *crc32);
  159. void (EFIAPI *copy_mem)(void *destination, const void *source,
  160. size_t length);
  161. void (EFIAPI *set_mem)(void *buffer, size_t size, uint8_t value);
  162. efi_status_t (EFIAPI *create_event_ex)(
  163. uint32_t type, efi_uintn_t notify_tpl,
  164. void (EFIAPI *notify_function) (
  165. struct efi_event *event,
  166. void *context),
  167. void *notify_context,
  168. efi_guid_t *event_group,
  169. struct efi_event **event);
  170. };
  171. /* Types and defines for EFI ResetSystem */
  172. enum efi_reset_type {
  173. EFI_RESET_COLD = 0,
  174. EFI_RESET_WARM = 1,
  175. EFI_RESET_SHUTDOWN = 2,
  176. EFI_RESET_PLATFORM_SPECIFIC = 3,
  177. };
  178. /* EFI Runtime Services table */
  179. #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552ULL
  180. #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
  181. #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
  182. #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
  183. struct efi_capsule_header {
  184. efi_guid_t *capsule_guid;
  185. u32 header_size;
  186. u32 flags;
  187. u32 capsule_image_size;
  188. };
  189. struct efi_runtime_services {
  190. struct efi_table_hdr hdr;
  191. efi_status_t (EFIAPI *get_time)(struct efi_time *time,
  192. struct efi_time_cap *capabilities);
  193. efi_status_t (EFIAPI *set_time)(struct efi_time *time);
  194. efi_status_t (EFIAPI *get_wakeup_time)(char *enabled, char *pending,
  195. struct efi_time *time);
  196. efi_status_t (EFIAPI *set_wakeup_time)(char enabled,
  197. struct efi_time *time);
  198. efi_status_t (EFIAPI *set_virtual_address_map)(
  199. unsigned long memory_map_size,
  200. unsigned long descriptor_size,
  201. uint32_t descriptor_version,
  202. struct efi_mem_desc *virtmap);
  203. efi_status_t (*convert_pointer)(unsigned long dbg, void **address);
  204. efi_status_t (EFIAPI *get_variable)(u16 *variable_name,
  205. efi_guid_t *vendor, u32 *attributes,
  206. efi_uintn_t *data_size, void *data);
  207. efi_status_t (EFIAPI *get_next_variable_name)(
  208. efi_uintn_t *variable_name_size,
  209. u16 *variable_name, efi_guid_t *vendor);
  210. efi_status_t (EFIAPI *set_variable)(u16 *variable_name,
  211. efi_guid_t *vendor, u32 attributes,
  212. efi_uintn_t data_size, void *data);
  213. efi_status_t (EFIAPI *get_next_high_mono_count)(
  214. uint32_t *high_count);
  215. void (EFIAPI *reset_system)(enum efi_reset_type reset_type,
  216. efi_status_t reset_status,
  217. unsigned long data_size, void *reset_data);
  218. efi_status_t (EFIAPI *update_capsule)(
  219. struct efi_capsule_header **capsule_header_array,
  220. efi_uintn_t capsule_count,
  221. u64 scatter_gather_list);
  222. efi_status_t (EFIAPI *query_capsule_caps)(
  223. struct efi_capsule_header **capsule_header_array,
  224. efi_uintn_t capsule_count,
  225. u64 maximum_capsule_size,
  226. u32 reset_type);
  227. efi_status_t (EFIAPI *query_variable_info)(
  228. u32 attributes,
  229. u64 *maximum_variable_storage_size,
  230. u64 *remaining_variable_storage_size,
  231. u64 *maximum_variable_size);
  232. };
  233. /* EFI event group GUID definitions */
  234. #define EFI_EVENT_GROUP_EXIT_BOOT_SERVICES \
  235. EFI_GUID(0x27abf055, 0xb1b8, 0x4c26, 0x80, 0x48, \
  236. 0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf)
  237. #define EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE \
  238. EFI_GUID(0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, \
  239. 0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96)
  240. #define EFI_EVENT_GROUP_MEMORY_MAP_CHANGE \
  241. EFI_GUID(0x78bee926, 0x692f, 0x48fd, 0x9e, 0xdb, \
  242. 0x01, 0x42, 0x2e, 0xf0, 0xd7, 0xab)
  243. #define EFI_EVENT_GROUP_READY_TO_BOOT \
  244. EFI_GUID(0x7ce88fb3, 0x4bd7, 0x4679, 0x87, 0xa8, \
  245. 0xa8, 0xd8, 0xde, 0xe5, 0x0d, 0x2b)
  246. #define EFI_EVENT_GROUP_RESET_SYSTEM \
  247. EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \
  248. 0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b)
  249. /* EFI Configuration Table and GUID definitions */
  250. #define NULL_GUID \
  251. EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
  252. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
  253. #define EFI_GLOBAL_VARIABLE_GUID \
  254. EFI_GUID(0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, \
  255. 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c)
  256. #define LOADED_IMAGE_PROTOCOL_GUID \
  257. EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, \
  258. 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  259. #define EFI_FDT_GUID \
  260. EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, \
  261. 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
  262. #define EFI_ACPI_TABLE_GUID \
  263. EFI_GUID(0x8868e871, 0xe4f1, 0x11d3, \
  264. 0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  265. #define SMBIOS_TABLE_GUID \
  266. EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, \
  267. 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
  268. struct efi_configuration_table {
  269. efi_guid_t guid;
  270. void *table;
  271. };
  272. #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
  273. struct efi_system_table {
  274. struct efi_table_hdr hdr;
  275. u16 *fw_vendor; /* physical addr of wchar_t vendor string */
  276. u32 fw_revision;
  277. efi_handle_t con_in_handle;
  278. struct efi_simple_text_input_protocol *con_in;
  279. efi_handle_t con_out_handle;
  280. struct efi_simple_text_output_protocol *con_out;
  281. efi_handle_t stderr_handle;
  282. struct efi_simple_text_output_protocol *std_err;
  283. struct efi_runtime_services *runtime;
  284. struct efi_boot_services *boottime;
  285. efi_uintn_t nr_tables;
  286. struct efi_configuration_table *tables;
  287. };
  288. #define LOADED_IMAGE_GUID \
  289. EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \
  290. 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  291. #define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000
  292. struct efi_loaded_image {
  293. u32 revision;
  294. void *parent_handle;
  295. struct efi_system_table *system_table;
  296. efi_handle_t device_handle;
  297. struct efi_device_path *file_path;
  298. void *reserved;
  299. u32 load_options_size;
  300. void *load_options;
  301. void *image_base;
  302. aligned_u64 image_size;
  303. unsigned int image_code_type;
  304. unsigned int image_data_type;
  305. unsigned long unload;
  306. };
  307. #define DEVICE_PATH_GUID \
  308. EFI_GUID(0x09576e91, 0x6d3f, 0x11d2, \
  309. 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  310. #define DEVICE_PATH_TYPE_END 0x7f
  311. # define DEVICE_PATH_SUB_TYPE_INSTANCE_END 0x01
  312. # define DEVICE_PATH_SUB_TYPE_END 0xff
  313. struct efi_device_path {
  314. u8 type;
  315. u8 sub_type;
  316. u16 length;
  317. } __packed;
  318. struct efi_mac_addr {
  319. u8 addr[32];
  320. } __packed;
  321. #define DEVICE_PATH_TYPE_HARDWARE_DEVICE 0x01
  322. # define DEVICE_PATH_SUB_TYPE_MEMORY 0x03
  323. # define DEVICE_PATH_SUB_TYPE_VENDOR 0x04
  324. struct efi_device_path_memory {
  325. struct efi_device_path dp;
  326. u32 memory_type;
  327. u64 start_address;
  328. u64 end_address;
  329. } __packed;
  330. struct efi_device_path_vendor {
  331. struct efi_device_path dp;
  332. efi_guid_t guid;
  333. u8 vendor_data[];
  334. } __packed;
  335. #define DEVICE_PATH_TYPE_ACPI_DEVICE 0x02
  336. # define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE 0x01
  337. #define EFI_PNP_ID(ID) (u32)(((ID) << 16) | 0x41D0)
  338. #define EISA_PNP_ID(ID) EFI_PNP_ID(ID)
  339. #define EISA_PNP_NUM(ID) ((ID) >> 16)
  340. struct efi_device_path_acpi_path {
  341. struct efi_device_path dp;
  342. u32 hid;
  343. u32 uid;
  344. } __packed;
  345. #define DEVICE_PATH_TYPE_MESSAGING_DEVICE 0x03
  346. # define DEVICE_PATH_SUB_TYPE_MSG_ATAPI 0x01
  347. # define DEVICE_PATH_SUB_TYPE_MSG_SCSI 0x02
  348. # define DEVICE_PATH_SUB_TYPE_MSG_USB 0x05
  349. # define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR 0x0b
  350. # define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS 0x0f
  351. # define DEVICE_PATH_SUB_TYPE_MSG_SD 0x1a
  352. # define DEVICE_PATH_SUB_TYPE_MSG_MMC 0x1d
  353. struct efi_device_path_atapi {
  354. struct efi_device_path dp;
  355. u8 primary_secondary;
  356. u8 slave_master;
  357. u16 logical_unit_number;
  358. } __packed;
  359. struct efi_device_path_scsi {
  360. struct efi_device_path dp;
  361. u16 target_id;
  362. u16 logical_unit_number;
  363. } __packed;
  364. struct efi_device_path_usb {
  365. struct efi_device_path dp;
  366. u8 parent_port_number;
  367. u8 usb_interface;
  368. } __packed;
  369. struct efi_device_path_mac_addr {
  370. struct efi_device_path dp;
  371. struct efi_mac_addr mac;
  372. u8 if_type;
  373. } __packed;
  374. struct efi_device_path_usb_class {
  375. struct efi_device_path dp;
  376. u16 vendor_id;
  377. u16 product_id;
  378. u8 device_class;
  379. u8 device_subclass;
  380. u8 device_protocol;
  381. } __packed;
  382. struct efi_device_path_sd_mmc_path {
  383. struct efi_device_path dp;
  384. u8 slot_number;
  385. } __packed;
  386. #define DEVICE_PATH_TYPE_MEDIA_DEVICE 0x04
  387. # define DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH 0x01
  388. # define DEVICE_PATH_SUB_TYPE_CDROM_PATH 0x02
  389. # define DEVICE_PATH_SUB_TYPE_FILE_PATH 0x04
  390. struct efi_device_path_hard_drive_path {
  391. struct efi_device_path dp;
  392. u32 partition_number;
  393. u64 partition_start;
  394. u64 partition_end;
  395. u8 partition_signature[16];
  396. u8 partmap_type;
  397. u8 signature_type;
  398. } __packed;
  399. struct efi_device_path_cdrom_path {
  400. struct efi_device_path dp;
  401. u32 boot_entry;
  402. u64 partition_start;
  403. u64 partition_end;
  404. } __packed;
  405. struct efi_device_path_file_path {
  406. struct efi_device_path dp;
  407. u16 str[];
  408. } __packed;
  409. #define BLOCK_IO_GUID \
  410. EFI_GUID(0x964e5b21, 0x6459, 0x11d2, \
  411. 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  412. struct efi_block_io_media {
  413. u32 media_id;
  414. char removable_media;
  415. char media_present;
  416. char logical_partition;
  417. char read_only;
  418. char write_caching;
  419. u8 pad[3];
  420. u32 block_size;
  421. u32 io_align;
  422. u8 pad2[4];
  423. u64 last_block;
  424. /* Added in revision 2 of the protocol */
  425. u64 lowest_aligned_lba;
  426. u32 logical_blocks_per_physical_block;
  427. /* Added in revision 3 of the protocol */
  428. u32 optimal_transfer_length_granualarity;
  429. };
  430. #define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001
  431. #define EFI_BLOCK_IO_PROTOCOL_REVISION3 0x0002001f
  432. struct efi_block_io {
  433. u64 revision;
  434. struct efi_block_io_media *media;
  435. efi_status_t (EFIAPI *reset)(struct efi_block_io *this,
  436. char extended_verification);
  437. efi_status_t (EFIAPI *read_blocks)(struct efi_block_io *this,
  438. u32 media_id, u64 lba, efi_uintn_t buffer_size,
  439. void *buffer);
  440. efi_status_t (EFIAPI *write_blocks)(struct efi_block_io *this,
  441. u32 media_id, u64 lba, efi_uintn_t buffer_size,
  442. void *buffer);
  443. efi_status_t (EFIAPI *flush_blocks)(struct efi_block_io *this);
  444. };
  445. struct simple_text_output_mode {
  446. s32 max_mode;
  447. s32 mode;
  448. s32 attribute;
  449. s32 cursor_column;
  450. s32 cursor_row;
  451. bool cursor_visible;
  452. };
  453. #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
  454. EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
  455. 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  456. #define EFI_BLACK 0x00
  457. #define EFI_BLUE 0x01
  458. #define EFI_GREEN 0x02
  459. #define EFI_CYAN 0x03
  460. #define EFI_RED 0x04
  461. #define EFI_MAGENTA 0x05
  462. #define EFI_BROWN 0x06
  463. #define EFI_LIGHTGRAY 0x07
  464. #define EFI_BRIGHT 0x08
  465. #define EFI_DARKGRAY 0x08
  466. #define EFI_LIGHTBLUE 0x09
  467. #define EFI_LIGHTGREEN 0x0a
  468. #define EFI_LIGHTCYAN 0x0b
  469. #define EFI_LIGHTRED 0x0c
  470. #define EFI_LIGHTMAGENTA 0x0d
  471. #define EFI_YELLOW 0x0e
  472. #define EFI_WHITE 0x0f
  473. #define EFI_BACKGROUND_BLACK 0x00
  474. #define EFI_BACKGROUND_BLUE 0x10
  475. #define EFI_BACKGROUND_GREEN 0x20
  476. #define EFI_BACKGROUND_CYAN 0x30
  477. #define EFI_BACKGROUND_RED 0x40
  478. #define EFI_BACKGROUND_MAGENTA 0x50
  479. #define EFI_BACKGROUND_BROWN 0x60
  480. #define EFI_BACKGROUND_LIGHTGRAY 0x70
  481. /* extract foreground color from EFI attribute */
  482. #define EFI_ATTR_FG(attr) ((attr) & 0x07)
  483. /* treat high bit of FG as bright/bold (similar to edk2) */
  484. #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)
  485. /* extract background color from EFI attribute */
  486. #define EFI_ATTR_BG(attr) (((attr) >> 4) & 0x7)
  487. struct efi_simple_text_output_protocol {
  488. void *reset;
  489. efi_status_t (EFIAPI *output_string)(
  490. struct efi_simple_text_output_protocol *this,
  491. const efi_string_t str);
  492. efi_status_t (EFIAPI *test_string)(
  493. struct efi_simple_text_output_protocol *this,
  494. const efi_string_t str);
  495. efi_status_t(EFIAPI *query_mode)(
  496. struct efi_simple_text_output_protocol *this,
  497. unsigned long mode_number, unsigned long *columns,
  498. unsigned long *rows);
  499. efi_status_t(EFIAPI *set_mode)(
  500. struct efi_simple_text_output_protocol *this,
  501. unsigned long mode_number);
  502. efi_status_t(EFIAPI *set_attribute)(
  503. struct efi_simple_text_output_protocol *this,
  504. unsigned long attribute);
  505. efi_status_t(EFIAPI *clear_screen) (
  506. struct efi_simple_text_output_protocol *this);
  507. efi_status_t(EFIAPI *set_cursor_position) (
  508. struct efi_simple_text_output_protocol *this,
  509. unsigned long column, unsigned long row);
  510. efi_status_t(EFIAPI *enable_cursor)(
  511. struct efi_simple_text_output_protocol *this,
  512. bool enable);
  513. struct simple_text_output_mode *mode;
  514. };
  515. #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
  516. EFI_GUID(0xdd9e7534, 0x7762, 0x4698, \
  517. 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa)
  518. struct efi_input_key {
  519. u16 scan_code;
  520. s16 unicode_char;
  521. };
  522. #define EFI_SHIFT_STATE_INVALID 0x00000000
  523. #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
  524. #define EFI_LEFT_SHIFT_PRESSED 0x00000002
  525. #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
  526. #define EFI_LEFT_CONTROL_PRESSED 0x00000008
  527. #define EFI_RIGHT_ALT_PRESSED 0x00000010
  528. #define EFI_LEFT_ALT_PRESSED 0x00000020
  529. #define EFI_RIGHT_LOGO_PRESSED 0x00000040
  530. #define EFI_LEFT_LOGO_PRESSED 0x00000080
  531. #define EFI_MENU_KEY_PRESSED 0x00000100
  532. #define EFI_SYS_REQ_PRESSED 0x00000200
  533. #define EFI_SHIFT_STATE_VALID 0x80000000
  534. #define EFI_TOGGLE_STATE_INVALID 0x00
  535. #define EFI_SCROLL_LOCK_ACTIVE 0x01
  536. #define EFI_NUM_LOCK_ACTIVE 0x02
  537. #define EFI_CAPS_LOCK_ACTIVE 0x04
  538. #define EFI_KEY_STATE_EXPOSED 0x40
  539. #define EFI_TOGGLE_STATE_VALID 0x80
  540. struct efi_key_state {
  541. u32 key_shift_state;
  542. u8 key_toggle_state;
  543. };
  544. struct efi_key_data {
  545. struct efi_input_key key;
  546. struct efi_key_state key_state;
  547. };
  548. struct efi_simple_text_input_ex_protocol {
  549. efi_status_t (EFIAPI *reset) (
  550. struct efi_simple_text_input_ex_protocol *this,
  551. bool extended_verification);
  552. efi_status_t (EFIAPI *read_key_stroke_ex) (
  553. struct efi_simple_text_input_ex_protocol *this,
  554. struct efi_key_data *key_data);
  555. struct efi_event *wait_for_key_ex;
  556. efi_status_t (EFIAPI *set_state) (
  557. struct efi_simple_text_input_ex_protocol *this,
  558. u8 key_toggle_state);
  559. efi_status_t (EFIAPI *register_key_notify) (
  560. struct efi_simple_text_input_ex_protocol *this,
  561. struct efi_key_data *key_data,
  562. efi_status_t (EFIAPI *key_notify_function)(
  563. struct efi_key_data *key_data),
  564. void **notify_handle);
  565. efi_status_t (EFIAPI *unregister_key_notify) (
  566. struct efi_simple_text_input_ex_protocol *this,
  567. void *notification_handle);
  568. };
  569. #define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
  570. EFI_GUID(0x387477c1, 0x69c7, 0x11d2, \
  571. 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  572. struct efi_simple_text_input_protocol {
  573. efi_status_t(EFIAPI *reset)(struct efi_simple_text_input_protocol *this,
  574. bool extended_verification);
  575. efi_status_t(EFIAPI *read_key_stroke)(
  576. struct efi_simple_text_input_protocol *this,
  577. struct efi_input_key *key);
  578. struct efi_event *wait_for_key;
  579. };
  580. #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
  581. EFI_GUID(0x8b843e20, 0x8132, 0x4852, \
  582. 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c)
  583. struct efi_device_path_to_text_protocol {
  584. uint16_t *(EFIAPI *convert_device_node_to_text)(
  585. struct efi_device_path *device_node,
  586. bool display_only,
  587. bool allow_shortcuts);
  588. uint16_t *(EFIAPI *convert_device_path_to_text)(
  589. struct efi_device_path *device_path,
  590. bool display_only,
  591. bool allow_shortcuts);
  592. };
  593. #define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
  594. EFI_GUID(0x0379be4e, 0xd706, 0x437d, \
  595. 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4)
  596. struct efi_device_path_utilities_protocol {
  597. efi_uintn_t (EFIAPI *get_device_path_size)(
  598. const struct efi_device_path *device_path);
  599. struct efi_device_path *(EFIAPI *duplicate_device_path)(
  600. const struct efi_device_path *device_path);
  601. struct efi_device_path *(EFIAPI *append_device_path)(
  602. const struct efi_device_path *src1,
  603. const struct efi_device_path *src2);
  604. struct efi_device_path *(EFIAPI *append_device_node)(
  605. const struct efi_device_path *device_path,
  606. const struct efi_device_path *device_node);
  607. struct efi_device_path *(EFIAPI *append_device_path_instance)(
  608. const struct efi_device_path *device_path,
  609. const struct efi_device_path *device_path_instance);
  610. struct efi_device_path *(EFIAPI *get_next_device_path_instance)(
  611. struct efi_device_path **device_path_instance,
  612. efi_uintn_t *device_path_instance_size);
  613. bool (EFIAPI *is_device_path_multi_instance)(
  614. const struct efi_device_path *device_path);
  615. struct efi_device_path *(EFIAPI *create_device_node)(
  616. uint8_t node_type,
  617. uint8_t node_sub_type,
  618. uint16_t node_length);
  619. };
  620. #define EFI_GOP_GUID \
  621. EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
  622. 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
  623. #define EFI_GOT_RGBA8 0
  624. #define EFI_GOT_BGRA8 1
  625. #define EFI_GOT_BITMASK 2
  626. struct efi_gop_mode_info {
  627. u32 version;
  628. u32 width;
  629. u32 height;
  630. u32 pixel_format;
  631. u32 pixel_bitmask[4];
  632. u32 pixels_per_scanline;
  633. };
  634. struct efi_gop_mode {
  635. u32 max_mode;
  636. u32 mode;
  637. struct efi_gop_mode_info *info;
  638. unsigned long info_size;
  639. efi_physical_addr_t fb_base;
  640. unsigned long fb_size;
  641. };
  642. struct efi_gop_pixel {
  643. u8 blue;
  644. u8 green;
  645. u8 red;
  646. u8 reserved;
  647. };
  648. #define EFI_BLT_VIDEO_FILL 0
  649. #define EFI_BLT_VIDEO_TO_BLT_BUFFER 1
  650. #define EFI_BLT_BUFFER_TO_VIDEO 2
  651. #define EFI_BLT_VIDEO_TO_VIDEO 3
  652. struct efi_gop {
  653. efi_status_t (EFIAPI *query_mode)(struct efi_gop *this, u32 mode_number,
  654. efi_uintn_t *size_of_info,
  655. struct efi_gop_mode_info **info);
  656. efi_status_t (EFIAPI *set_mode)(struct efi_gop *this, u32 mode_number);
  657. efi_status_t (EFIAPI *blt)(struct efi_gop *this,
  658. struct efi_gop_pixel *buffer,
  659. u32 operation, efi_uintn_t sx,
  660. efi_uintn_t sy, efi_uintn_t dx,
  661. efi_uintn_t dy, efi_uintn_t width,
  662. efi_uintn_t height, efi_uintn_t delta);
  663. struct efi_gop_mode *mode;
  664. };
  665. #define EFI_SIMPLE_NETWORK_GUID \
  666. EFI_GUID(0xa19832b9, 0xac25, 0x11d3, \
  667. 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
  668. struct efi_mac_address {
  669. char mac_addr[32];
  670. };
  671. struct efi_ip_address {
  672. u8 ip_addr[16];
  673. } __attribute__((aligned(4)));
  674. enum efi_simple_network_state {
  675. EFI_NETWORK_STOPPED,
  676. EFI_NETWORK_STARTED,
  677. EFI_NETWORK_INITIALIZED,
  678. };
  679. struct efi_simple_network_mode {
  680. enum efi_simple_network_state state;
  681. u32 hwaddr_size;
  682. u32 media_header_size;
  683. u32 max_packet_size;
  684. u32 nvram_size;
  685. u32 nvram_access_size;
  686. u32 receive_filter_mask;
  687. u32 receive_filter_setting;
  688. u32 max_mcast_filter_count;
  689. u32 mcast_filter_count;
  690. struct efi_mac_address mcast_filter[16];
  691. struct efi_mac_address current_address;
  692. struct efi_mac_address broadcast_address;
  693. struct efi_mac_address permanent_address;
  694. u8 if_type;
  695. u8 mac_changeable;
  696. u8 multitx_supported;
  697. u8 media_present_supported;
  698. u8 media_present;
  699. };
  700. /* receive_filters bit mask */
  701. #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
  702. #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
  703. #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
  704. #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
  705. #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
  706. /* interrupt status bit mask */
  707. #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
  708. #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
  709. #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
  710. #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
  711. /* revision of the simple network protocol */
  712. #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000
  713. struct efi_simple_network {
  714. u64 revision;
  715. efi_status_t (EFIAPI *start)(struct efi_simple_network *this);
  716. efi_status_t (EFIAPI *stop)(struct efi_simple_network *this);
  717. efi_status_t (EFIAPI *initialize)(struct efi_simple_network *this,
  718. ulong extra_rx, ulong extra_tx);
  719. efi_status_t (EFIAPI *reset)(struct efi_simple_network *this,
  720. int extended_verification);
  721. efi_status_t (EFIAPI *shutdown)(struct efi_simple_network *this);
  722. efi_status_t (EFIAPI *receive_filters)(struct efi_simple_network *this,
  723. u32 enable, u32 disable, int reset_mcast_filter,
  724. ulong mcast_filter_count,
  725. struct efi_mac_address *mcast_filter);
  726. efi_status_t (EFIAPI *station_address)(struct efi_simple_network *this,
  727. int reset, struct efi_mac_address *new_mac);
  728. efi_status_t (EFIAPI *statistics)(struct efi_simple_network *this,
  729. int reset, ulong *stat_size, void *stat_table);
  730. efi_status_t (EFIAPI *mcastiptomac)(struct efi_simple_network *this,
  731. int ipv6, struct efi_ip_address *ip,
  732. struct efi_mac_address *mac);
  733. efi_status_t (EFIAPI *nvdata)(struct efi_simple_network *this,
  734. int read_write, ulong offset, ulong buffer_size,
  735. char *buffer);
  736. efi_status_t (EFIAPI *get_status)(struct efi_simple_network *this,
  737. u32 *int_status, void **txbuf);
  738. efi_status_t (EFIAPI *transmit)(struct efi_simple_network *this,
  739. size_t header_size, size_t buffer_size, void *buffer,
  740. struct efi_mac_address *src_addr,
  741. struct efi_mac_address *dest_addr, u16 *protocol);
  742. efi_status_t (EFIAPI *receive)(struct efi_simple_network *this,
  743. size_t *header_size, size_t *buffer_size, void *buffer,
  744. struct efi_mac_address *src_addr,
  745. struct efi_mac_address *dest_addr, u16 *protocol);
  746. struct efi_event *wait_for_packet;
  747. struct efi_simple_network_mode *mode;
  748. };
  749. #define EFI_PXE_GUID \
  750. EFI_GUID(0x03c4e603, 0xac28, 0x11d3, \
  751. 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
  752. struct efi_pxe_packet {
  753. u8 packet[1472];
  754. };
  755. struct efi_pxe_mode {
  756. u8 started;
  757. u8 ipv6_available;
  758. u8 ipv6_supported;
  759. u8 using_ipv6;
  760. u8 bis_supported;
  761. u8 bis_detected;
  762. u8 auto_arp;
  763. u8 send_guid;
  764. u8 dhcp_discover_valid;
  765. u8 dhcp_ack_received;
  766. u8 proxy_offer_received;
  767. u8 pxe_discover_valid;
  768. u8 pxe_reply_received;
  769. u8 pxe_bis_reply_received;
  770. u8 icmp_error_received;
  771. u8 tftp_error_received;
  772. u8 make_callbacks;
  773. u8 ttl;
  774. u8 tos;
  775. u8 pad;
  776. struct efi_ip_address station_ip;
  777. struct efi_ip_address subnet_mask;
  778. struct efi_pxe_packet dhcp_discover;
  779. struct efi_pxe_packet dhcp_ack;
  780. struct efi_pxe_packet proxy_offer;
  781. struct efi_pxe_packet pxe_discover;
  782. struct efi_pxe_packet pxe_reply;
  783. };
  784. struct efi_pxe {
  785. u64 rev;
  786. void (EFIAPI *start)(void);
  787. void (EFIAPI *stop)(void);
  788. void (EFIAPI *dhcp)(void);
  789. void (EFIAPI *discover)(void);
  790. void (EFIAPI *mftp)(void);
  791. void (EFIAPI *udpwrite)(void);
  792. void (EFIAPI *udpread)(void);
  793. void (EFIAPI *setipfilter)(void);
  794. void (EFIAPI *arp)(void);
  795. void (EFIAPI *setparams)(void);
  796. void (EFIAPI *setstationip)(void);
  797. void (EFIAPI *setpackets)(void);
  798. struct efi_pxe_mode *mode;
  799. };
  800. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  801. EFI_GUID(0x964e5b22, 0x6459, 0x11d2, \
  802. 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  803. #define EFI_FILE_PROTOCOL_REVISION 0x00010000
  804. struct efi_file_handle {
  805. u64 rev;
  806. efi_status_t (EFIAPI *open)(struct efi_file_handle *file,
  807. struct efi_file_handle **new_handle,
  808. s16 *file_name, u64 open_mode, u64 attributes);
  809. efi_status_t (EFIAPI *close)(struct efi_file_handle *file);
  810. efi_status_t (EFIAPI *delete)(struct efi_file_handle *file);
  811. efi_status_t (EFIAPI *read)(struct efi_file_handle *file,
  812. efi_uintn_t *buffer_size, void *buffer);
  813. efi_status_t (EFIAPI *write)(struct efi_file_handle *file,
  814. efi_uintn_t *buffer_size, void *buffer);
  815. efi_status_t (EFIAPI *getpos)(struct efi_file_handle *file,
  816. u64 *pos);
  817. efi_status_t (EFIAPI *setpos)(struct efi_file_handle *file,
  818. u64 pos);
  819. efi_status_t (EFIAPI *getinfo)(struct efi_file_handle *file,
  820. const efi_guid_t *info_type, efi_uintn_t *buffer_size,
  821. void *buffer);
  822. efi_status_t (EFIAPI *setinfo)(struct efi_file_handle *file,
  823. const efi_guid_t *info_type, efi_uintn_t buffer_size,
  824. void *buffer);
  825. efi_status_t (EFIAPI *flush)(struct efi_file_handle *file);
  826. };
  827. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  828. EFI_GUID(0x964e5b22, 0x6459, 0x11d2, \
  829. 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  830. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
  831. struct efi_simple_file_system_protocol {
  832. u64 rev;
  833. efi_status_t (EFIAPI *open_volume)(struct efi_simple_file_system_protocol *this,
  834. struct efi_file_handle **root);
  835. };
  836. #define EFI_FILE_INFO_GUID \
  837. EFI_GUID(0x9576e92, 0x6d3f, 0x11d2, \
  838. 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  839. #define EFI_FILE_SYSTEM_INFO_GUID \
  840. EFI_GUID(0x09576e93, 0x6d3f, 0x11d2, \
  841. 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  842. #define EFI_FILE_MODE_READ 0x0000000000000001
  843. #define EFI_FILE_MODE_WRITE 0x0000000000000002
  844. #define EFI_FILE_MODE_CREATE 0x8000000000000000
  845. #define EFI_FILE_READ_ONLY 0x0000000000000001
  846. #define EFI_FILE_HIDDEN 0x0000000000000002
  847. #define EFI_FILE_SYSTEM 0x0000000000000004
  848. #define EFI_FILE_RESERVED 0x0000000000000008
  849. #define EFI_FILE_DIRECTORY 0x0000000000000010
  850. #define EFI_FILE_ARCHIVE 0x0000000000000020
  851. #define EFI_FILE_VALID_ATTR 0x0000000000000037
  852. struct efi_file_info {
  853. u64 size;
  854. u64 file_size;
  855. u64 physical_size;
  856. struct efi_time create_time;
  857. struct efi_time last_access_time;
  858. struct efi_time modification_time;
  859. u64 attribute;
  860. s16 file_name[0];
  861. };
  862. struct efi_file_system_info {
  863. u64 size;
  864. u8 read_only;
  865. u64 volume_size;
  866. u64 free_space;
  867. u32 block_size;
  868. u16 volume_label[0];
  869. };
  870. #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
  871. EFI_GUID(0x18a031ab, 0xb443, 0x4d1a,\
  872. 0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71)
  873. struct efi_driver_binding_protocol {
  874. efi_status_t (EFIAPI * supported)(
  875. struct efi_driver_binding_protocol *this,
  876. efi_handle_t controller_handle,
  877. struct efi_device_path *remaining_device_path);
  878. efi_status_t (EFIAPI * start)(
  879. struct efi_driver_binding_protocol *this,
  880. efi_handle_t controller_handle,
  881. struct efi_device_path *remaining_device_path);
  882. efi_status_t (EFIAPI * stop)(
  883. struct efi_driver_binding_protocol *this,
  884. efi_handle_t controller_handle,
  885. efi_uintn_t number_of_children,
  886. efi_handle_t *child_handle_buffer);
  887. u32 version;
  888. efi_handle_t image_handle;
  889. efi_handle_t driver_binding_handle;
  890. };
  891. #define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
  892. EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \
  893. 0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49)
  894. struct efi_unicode_collation_protocol {
  895. efi_intn_t (EFIAPI *stri_coll)(
  896. struct efi_unicode_collation_protocol *this, u16 *s1, u16 *s2);
  897. bool (EFIAPI *metai_match)(struct efi_unicode_collation_protocol *this,
  898. const u16 *string, const u16 *patter);
  899. void (EFIAPI *str_lwr)(struct efi_unicode_collation_protocol
  900. *this, u16 *string);
  901. void (EFIAPI *str_upr)(struct efi_unicode_collation_protocol *this,
  902. u16 *string);
  903. void (EFIAPI *fat_to_str)(struct efi_unicode_collation_protocol *this,
  904. efi_uintn_t fat_size, char *fat, u16 *string);
  905. bool (EFIAPI *str_to_fat)(struct efi_unicode_collation_protocol *this,
  906. const u16 *string, efi_uintn_t fat_size,
  907. char *fat);
  908. char *supported_languages;
  909. };
  910. #endif