added -y/--side-by-side option
[dfdiff.git] / sys / boot / efi / include / efiapi.h
blob512049828b7239ef9b1f9999067dd22ccc6eee69
1 /*
2 * $FreeBSD: src/sys/boot/efi/include/efiapi.h,v 1.5 2002/12/08 20:47:44 marcel Exp $
3 * $DragonFly: src/sys/boot/efi/include/efiapi.h,v 1.1 2003/11/10 06:08:32 dillon Exp $
4 */
5 #ifndef _EFI_API_H
6 #define _EFI_API_H
8 /*++
10 Copyright (c) 1998 Intel Corporation
12 Module Name:
14 efiapi.h
16 Abstract:
18 Global EFI runtime & boot service interfaces
23 Revision History
25 --*/
28 * EFI Specification Revision
31 #define EFI_SPECIFICATION_MAJOR_REVISION 1
32 #define EFI_SPECIFICATION_MINOR_REVISION 02
35 * Declare forward referenced data structures
38 INTERFACE_DECL(_EFI_SYSTEM_TABLE);
41 * EFI Memory
44 typedef
45 EFI_STATUS
46 (EFIAPI *EFI_ALLOCATE_PAGES) (
47 IN EFI_ALLOCATE_TYPE Type,
48 IN EFI_MEMORY_TYPE MemoryType,
49 IN UINTN NoPages,
50 OUT EFI_PHYSICAL_ADDRESS *Memory
53 typedef
54 EFI_STATUS
55 (EFIAPI *EFI_FREE_PAGES) (
56 IN EFI_PHYSICAL_ADDRESS Memory,
57 IN UINTN NoPages
60 typedef
61 EFI_STATUS
62 (EFIAPI *EFI_GET_MEMORY_MAP) (
63 IN OUT UINTN *MemoryMapSize,
64 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
65 OUT UINTN *MapKey,
66 OUT UINTN *DescriptorSize,
67 OUT UINT32 *DescriptorVersion
70 #define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_ALLOCATE_POOL) (
76 IN EFI_MEMORY_TYPE PoolType,
77 IN UINTN Size,
78 OUT VOID **Buffer
81 typedef
82 EFI_STATUS
83 (EFIAPI *EFI_FREE_POOL) (
84 IN VOID *Buffer
87 typedef
88 EFI_STATUS
89 (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
90 IN UINTN MemoryMapSize,
91 IN UINTN DescriptorSize,
92 IN UINT32 DescriptorVersion,
93 IN EFI_MEMORY_DESCRIPTOR *VirtualMap
97 #define EFI_OPTIONAL_PTR 0x00000001
98 #define EFI_INTERNAL_FNC 0x00000002 /* Pointer to internal runtime fnc */
99 #define EFI_INTERNAL_PTR 0x00000004 /* Pointer to internal runtime data */
102 typedef
103 EFI_STATUS
104 (EFIAPI *EFI_CONVERT_POINTER) (
105 IN UINTN DebugDisposition,
106 IN OUT VOID **Address
111 * EFI Events
116 #define EVT_TIMER 0x80000000
117 #define EVT_RUNTIME 0x40000000
118 #define EVT_RUNTIME_CONTEXT 0x20000000
120 #define EVT_NOTIFY_WAIT 0x00000100
121 #define EVT_NOTIFY_SIGNAL 0x00000200
123 #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
124 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
126 #define EVT_EFI_SIGNAL_MASK 0x000000FF
127 #define EVT_EFI_SIGNAL_MAX 2
129 typedef
130 VOID
131 (EFIAPI *EFI_EVENT_NOTIFY) (
132 IN EFI_EVENT Event,
133 IN VOID *Context
136 typedef
137 EFI_STATUS
138 (EFIAPI *EFI_CREATE_EVENT) (
139 IN UINT32 Type,
140 IN EFI_TPL NotifyTpl,
141 IN EFI_EVENT_NOTIFY NotifyFunction,
142 IN VOID *NotifyContext,
143 OUT EFI_EVENT *Event
146 typedef enum {
147 TimerCancel,
148 TimerPeriodic,
149 TimerRelative,
150 TimerTypeMax
151 } EFI_TIMER_DELAY;
153 typedef
154 EFI_STATUS
155 (EFIAPI *EFI_SET_TIMER) (
156 IN EFI_EVENT Event,
157 IN EFI_TIMER_DELAY Type,
158 IN UINT64 TriggerTime
161 typedef
162 EFI_STATUS
163 (EFIAPI *EFI_SIGNAL_EVENT) (
164 IN EFI_EVENT Event
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_WAIT_FOR_EVENT) (
170 IN UINTN NumberOfEvents,
171 IN EFI_EVENT *Event,
172 OUT UINTN *Index
175 typedef
176 EFI_STATUS
177 (EFIAPI *EFI_CLOSE_EVENT) (
178 IN EFI_EVENT Event
181 typedef
182 EFI_STATUS
183 (EFIAPI *EFI_CHECK_EVENT) (
184 IN EFI_EVENT Event
188 * Task priority level
191 #define TPL_APPLICATION 4
192 #define TPL_CALLBACK 8
193 #define TPL_NOTIFY 16
194 #define TPL_HIGH_LEVEL 31
196 typedef
197 EFI_TPL
198 (EFIAPI *EFI_RAISE_TPL) (
199 IN EFI_TPL NewTpl
202 typedef
203 VOID
204 (EFIAPI *EFI_RESTORE_TPL) (
205 IN EFI_TPL OldTpl
210 * EFI platform varibles
213 #define EFI_GLOBAL_VARIABLE \
214 { 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }
216 /* Variable attributes */
217 #define EFI_VARIABLE_NON_VOLATILE 0x00000001
218 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
219 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
221 /* Variable size limitation */
222 #define EFI_MAXIMUM_VARIABLE_SIZE 1024
224 typedef
225 EFI_STATUS
226 (EFIAPI *EFI_GET_VARIABLE) (
227 IN CHAR16 *VariableName,
228 IN EFI_GUID *VendorGuid,
229 OUT UINT32 *Attributes OPTIONAL,
230 IN OUT UINTN *DataSize,
231 OUT VOID *Data
234 typedef
235 EFI_STATUS
236 (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
237 IN OUT UINTN *VariableNameSize,
238 IN OUT CHAR16 *VariableName,
239 IN OUT EFI_GUID *VendorGuid
243 typedef
244 EFI_STATUS
245 (EFIAPI *EFI_SET_VARIABLE) (
246 IN CHAR16 *VariableName,
247 IN EFI_GUID *VendorGuid,
248 IN UINT32 Attributes,
249 IN UINTN DataSize,
250 IN VOID *Data
255 * EFI Time
258 typedef struct {
259 UINT32 Resolution; /* 1e-6 parts per million */
260 UINT32 Accuracy; /* hertz */
261 BOOLEAN SetsToZero; /* Set clears sub-second time */
262 } EFI_TIME_CAPABILITIES;
265 typedef
266 EFI_STATUS
267 (EFIAPI *EFI_GET_TIME) (
268 OUT EFI_TIME *Time,
269 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
272 typedef
273 EFI_STATUS
274 (EFIAPI *EFI_SET_TIME) (
275 IN EFI_TIME *Time
278 typedef
279 EFI_STATUS
280 (EFIAPI *EFI_GET_WAKEUP_TIME) (
281 OUT BOOLEAN *Enabled,
282 OUT BOOLEAN *Pending,
283 OUT EFI_TIME *Time
286 typedef
287 EFI_STATUS
288 (EFIAPI *EFI_SET_WAKEUP_TIME) (
289 IN BOOLEAN Enable,
290 IN EFI_TIME *Time OPTIONAL
295 * Image functions
299 /* PE32+ Subsystem type for EFI images */
301 #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
302 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
303 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
304 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
305 #endif
307 /* PE32+ Machine type for EFI images */
309 #if !defined(EFI_IMAGE_MACHINE_IA32)
310 #define EFI_IMAGE_MACHINE_IA32 0x014c
311 #endif
313 #if !defined(EFI_IMAGE_MACHINE_IA64)
314 #define EFI_IMAGE_MACHINE_IA64 0x0200
315 #endif
317 /* Image Entry prototype */
319 typedef
320 EFI_STATUS
321 (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
322 IN EFI_HANDLE ImageHandle,
323 IN struct _EFI_SYSTEM_TABLE *SystemTable
326 typedef
327 EFI_STATUS
328 (EFIAPI *EFI_IMAGE_LOAD) (
329 IN BOOLEAN BootPolicy,
330 IN EFI_HANDLE ParentImageHandle,
331 IN EFI_DEVICE_PATH *FilePath,
332 IN VOID *SourceBuffer OPTIONAL,
333 IN UINTN SourceSize,
334 OUT EFI_HANDLE *ImageHandle
337 typedef
338 EFI_STATUS
339 (EFIAPI *EFI_IMAGE_START) (
340 IN EFI_HANDLE ImageHandle,
341 OUT UINTN *ExitDataSize,
342 OUT CHAR16 **ExitData OPTIONAL
345 typedef
346 EFI_STATUS
347 (EFIAPI *EFI_EXIT) (
348 IN EFI_HANDLE ImageHandle,
349 IN EFI_STATUS ExitStatus,
350 IN UINTN ExitDataSize,
351 IN CHAR16 *ExitData OPTIONAL
354 typedef
355 EFI_STATUS
356 (EFIAPI *EFI_IMAGE_UNLOAD) (
357 IN EFI_HANDLE ImageHandle
361 /* Image handle */
362 #define LOADED_IMAGE_PROTOCOL \
363 { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
365 #define EFI_IMAGE_INFORMATION_REVISION 0x1000
366 typedef struct {
367 UINT32 Revision;
368 EFI_HANDLE ParentHandle;
369 struct _EFI_SYSTEM_TABLE *SystemTable;
371 /* Source location of image */
372 EFI_HANDLE DeviceHandle;
373 EFI_DEVICE_PATH *FilePath;
374 VOID *Reserved;
376 /* Images load options */
377 UINT32 LoadOptionsSize;
378 VOID *LoadOptions;
380 /* Location of where image was loaded */
381 VOID *ImageBase;
382 UINT64 ImageSize;
383 EFI_MEMORY_TYPE ImageCodeType;
384 EFI_MEMORY_TYPE ImageDataType;
386 /* If the driver image supports a dynamic unload request */
387 EFI_IMAGE_UNLOAD Unload;
389 } EFI_LOADED_IMAGE;
392 typedef
393 EFI_STATUS
394 (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
395 IN EFI_HANDLE ImageHandle,
396 IN UINTN MapKey
400 * Misc
404 typedef
405 EFI_STATUS
406 (EFIAPI *EFI_STALL) (
407 IN UINTN Microseconds
410 typedef
411 EFI_STATUS
412 (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
413 IN UINTN Timeout,
414 IN UINT64 WatchdogCode,
415 IN UINTN DataSize,
416 IN CHAR16 *WatchdogData OPTIONAL
420 typedef enum {
421 EfiResetCold,
422 EfiResetWarm
423 } EFI_RESET_TYPE;
425 typedef
426 EFI_STATUS
427 (EFIAPI *EFI_RESET_SYSTEM) (
428 IN EFI_RESET_TYPE ResetType,
429 IN EFI_STATUS ResetStatus,
430 IN UINTN DataSize,
431 IN CHAR16 *ResetData OPTIONAL
434 typedef
435 EFI_STATUS
436 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
437 OUT UINT64 *Count
440 typedef
441 EFI_STATUS
442 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
443 OUT UINT32 *HighCount
447 * Protocol handler functions
450 typedef enum {
451 EFI_NATIVE_INTERFACE,
452 EFI_PCODE_INTERFACE
453 } EFI_INTERFACE_TYPE;
455 typedef
456 EFI_STATUS
457 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
458 IN OUT EFI_HANDLE *Handle,
459 IN EFI_GUID *Protocol,
460 IN EFI_INTERFACE_TYPE InterfaceType,
461 IN VOID *Interface
464 typedef
465 EFI_STATUS
466 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
467 IN EFI_HANDLE Handle,
468 IN EFI_GUID *Protocol,
469 IN VOID *OldInterface,
470 IN VOID *NewInterface
473 typedef
474 EFI_STATUS
475 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
476 IN EFI_HANDLE Handle,
477 IN EFI_GUID *Protocol,
478 IN VOID *Interface
481 typedef
482 EFI_STATUS
483 (EFIAPI *EFI_HANDLE_PROTOCOL) (
484 IN EFI_HANDLE Handle,
485 IN EFI_GUID *Protocol,
486 OUT VOID **Interface
489 typedef
490 EFI_STATUS
491 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
492 IN EFI_GUID *Protocol,
493 IN EFI_EVENT Event,
494 OUT VOID **Registration
497 typedef enum {
498 AllHandles,
499 ByRegisterNotify,
500 ByProtocol
501 } EFI_LOCATE_SEARCH_TYPE;
503 typedef
504 EFI_STATUS
505 (EFIAPI *EFI_LOCATE_HANDLE) (
506 IN EFI_LOCATE_SEARCH_TYPE SearchType,
507 IN EFI_GUID *Protocol OPTIONAL,
508 IN VOID *SearchKey OPTIONAL,
509 IN OUT UINTN *BufferSize,
510 OUT EFI_HANDLE *Buffer
513 typedef
514 EFI_STATUS
515 (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
516 IN EFI_GUID *Protocol,
517 IN OUT EFI_DEVICE_PATH **DevicePath,
518 OUT EFI_HANDLE *Device
521 typedef
522 EFI_STATUS
523 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
524 IN EFI_GUID *Guid,
525 IN VOID *Table
528 typedef
529 EFI_STATUS
530 (EFIAPI *EFI_RESERVED_SERVICE) (
531 VOID
535 * Standard EFI table header
538 typedef struct _EFI_TABLE_HEARDER {
539 UINT64 Signature;
540 UINT32 Revision;
541 UINT32 HeaderSize;
542 UINT32 CRC32;
543 UINT32 Reserved;
544 } EFI_TABLE_HEADER;
548 * EFI Runtime Serivces Table
551 #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
552 #define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
554 typedef struct {
555 EFI_TABLE_HEADER Hdr;
557 /* Time services */
559 EFI_GET_TIME GetTime;
560 EFI_SET_TIME SetTime;
561 EFI_GET_WAKEUP_TIME GetWakeupTime;
562 EFI_SET_WAKEUP_TIME SetWakeupTime;
564 /* Virtual memory services */
566 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
567 EFI_CONVERT_POINTER ConvertPointer;
569 /* Variable serviers */
571 EFI_GET_VARIABLE GetVariable;
572 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
573 EFI_SET_VARIABLE SetVariable;
575 /* Misc */
577 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
578 EFI_RESET_SYSTEM ResetSystem;
580 } EFI_RUNTIME_SERVICES;
584 * EFI Boot Services Table
587 #define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
588 #define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
590 typedef struct _EFI_BOOT_SERVICES {
592 EFI_TABLE_HEADER Hdr;
594 /* Task priority functions */
596 EFI_RAISE_TPL RaiseTPL;
597 EFI_RESTORE_TPL RestoreTPL;
599 /* Memory functions */
601 EFI_ALLOCATE_PAGES AllocatePages;
602 EFI_FREE_PAGES FreePages;
603 EFI_GET_MEMORY_MAP GetMemoryMap;
604 EFI_ALLOCATE_POOL AllocatePool;
605 EFI_FREE_POOL FreePool;
607 /* Event & timer functions */
609 EFI_CREATE_EVENT CreateEvent;
610 EFI_SET_TIMER SetTimer;
611 EFI_WAIT_FOR_EVENT WaitForEvent;
612 EFI_SIGNAL_EVENT SignalEvent;
613 EFI_CLOSE_EVENT CloseEvent;
614 EFI_CHECK_EVENT CheckEvent;
616 /* Protocol handler functions */
618 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
619 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
620 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
621 EFI_HANDLE_PROTOCOL HandleProtocol;
622 EFI_HANDLE_PROTOCOL PCHandleProtocol;
623 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
624 EFI_LOCATE_HANDLE LocateHandle;
625 EFI_LOCATE_DEVICE_PATH LocateDevicePath;
626 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
628 /* Image functions */
630 EFI_IMAGE_LOAD LoadImage;
631 EFI_IMAGE_START StartImage;
632 EFI_EXIT Exit;
633 EFI_IMAGE_UNLOAD UnloadImage;
634 EFI_EXIT_BOOT_SERVICES ExitBootServices;
636 /* Misc functions */
638 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
639 EFI_STALL Stall;
640 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
642 } EFI_BOOT_SERVICES;
646 * EFI Configuration Table and GUID definitions
649 #define MPS_TABLE_GUID \
650 { 0xeb9d2d2f, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
652 #define ACPI_TABLE_GUID \
653 { 0xeb9d2d30, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
655 #define ACPI_20_TABLE_GUID \
656 { 0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
658 #define SMBIOS_TABLE_GUID \
659 { 0xeb9d2d31, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
661 #define SAL_SYSTEM_TABLE_GUID \
662 { 0xeb9d2d32, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
664 /* DIG64 Headless Console & Debug Port Table. */
665 #define HCDP_TABLE_GUID \
666 {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}}
668 typedef struct _EFI_CONFIGURATION_TABLE {
669 EFI_GUID VendorGuid;
670 VOID *VendorTable;
671 } EFI_CONFIGURATION_TABLE;
675 * EFI System Table
681 #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
682 #define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
684 typedef struct _EFI_SYSTEM_TABLE {
685 EFI_TABLE_HEADER Hdr;
687 CHAR16 *FirmwareVendor;
688 UINT32 FirmwareRevision;
690 EFI_HANDLE ConsoleInHandle;
691 SIMPLE_INPUT_INTERFACE *ConIn;
693 EFI_HANDLE ConsoleOutHandle;
694 SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
696 EFI_HANDLE StandardErrorHandle;
697 SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
699 EFI_RUNTIME_SERVICES *RuntimeServices;
700 EFI_BOOT_SERVICES *BootServices;
702 UINTN NumberOfTableEntries;
703 EFI_CONFIGURATION_TABLE *ConfigurationTable;
705 } EFI_SYSTEM_TABLE;
707 #endif