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 $
10 Copyright (c) 1998 Intel Corporation
18 Global EFI runtime & boot service interfaces
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
);
46 (EFIAPI
*EFI_ALLOCATE_PAGES
) (
47 IN EFI_ALLOCATE_TYPE Type
,
48 IN EFI_MEMORY_TYPE MemoryType
,
50 OUT EFI_PHYSICAL_ADDRESS
*Memory
55 (EFIAPI
*EFI_FREE_PAGES
) (
56 IN EFI_PHYSICAL_ADDRESS Memory
,
62 (EFIAPI
*EFI_GET_MEMORY_MAP
) (
63 IN OUT UINTN
*MemoryMapSize
,
64 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
66 OUT UINTN
*DescriptorSize
,
67 OUT UINT32
*DescriptorVersion
70 #define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
75 (EFIAPI
*EFI_ALLOCATE_POOL
) (
76 IN EFI_MEMORY_TYPE PoolType
,
83 (EFIAPI
*EFI_FREE_POOL
) (
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 */
104 (EFIAPI
*EFI_CONVERT_POINTER
) (
105 IN UINTN DebugDisposition
,
106 IN OUT VOID
**Address
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
131 (EFIAPI
*EFI_EVENT_NOTIFY
) (
138 (EFIAPI
*EFI_CREATE_EVENT
) (
140 IN EFI_TPL NotifyTpl
,
141 IN EFI_EVENT_NOTIFY NotifyFunction
,
142 IN VOID
*NotifyContext
,
155 (EFIAPI
*EFI_SET_TIMER
) (
157 IN EFI_TIMER_DELAY Type
,
158 IN UINT64 TriggerTime
163 (EFIAPI
*EFI_SIGNAL_EVENT
) (
169 (EFIAPI
*EFI_WAIT_FOR_EVENT
) (
170 IN UINTN NumberOfEvents
,
177 (EFIAPI
*EFI_CLOSE_EVENT
) (
183 (EFIAPI
*EFI_CHECK_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
198 (EFIAPI
*EFI_RAISE_TPL
) (
204 (EFIAPI
*EFI_RESTORE_TPL
) (
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
226 (EFIAPI
*EFI_GET_VARIABLE
) (
227 IN CHAR16
*VariableName
,
228 IN EFI_GUID
*VendorGuid
,
229 OUT UINT32
*Attributes OPTIONAL
,
230 IN OUT UINTN
*DataSize
,
236 (EFIAPI
*EFI_GET_NEXT_VARIABLE_NAME
) (
237 IN OUT UINTN
*VariableNameSize
,
238 IN OUT CHAR16
*VariableName
,
239 IN OUT EFI_GUID
*VendorGuid
245 (EFIAPI
*EFI_SET_VARIABLE
) (
246 IN CHAR16
*VariableName
,
247 IN EFI_GUID
*VendorGuid
,
248 IN UINT32 Attributes
,
259 UINT32 Resolution
; /* 1e-6 parts per million */
260 UINT32 Accuracy
; /* hertz */
261 BOOLEAN SetsToZero
; /* Set clears sub-second time */
262 } EFI_TIME_CAPABILITIES
;
267 (EFIAPI
*EFI_GET_TIME
) (
269 OUT EFI_TIME_CAPABILITIES
*Capabilities OPTIONAL
274 (EFIAPI
*EFI_SET_TIME
) (
280 (EFIAPI
*EFI_GET_WAKEUP_TIME
) (
281 OUT BOOLEAN
*Enabled
,
282 OUT BOOLEAN
*Pending
,
288 (EFIAPI
*EFI_SET_WAKEUP_TIME
) (
290 IN EFI_TIME
*Time OPTIONAL
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
307 /* PE32+ Machine type for EFI images */
309 #if !defined(EFI_IMAGE_MACHINE_IA32)
310 #define EFI_IMAGE_MACHINE_IA32 0x014c
313 #if !defined(EFI_IMAGE_MACHINE_IA64)
314 #define EFI_IMAGE_MACHINE_IA64 0x0200
317 /* Image Entry prototype */
321 (EFIAPI
*EFI_IMAGE_ENTRY_POINT
) (
322 IN EFI_HANDLE ImageHandle
,
323 IN
struct _EFI_SYSTEM_TABLE
*SystemTable
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
,
334 OUT EFI_HANDLE
*ImageHandle
339 (EFIAPI
*EFI_IMAGE_START
) (
340 IN EFI_HANDLE ImageHandle
,
341 OUT UINTN
*ExitDataSize
,
342 OUT CHAR16
**ExitData OPTIONAL
348 IN EFI_HANDLE ImageHandle
,
349 IN EFI_STATUS ExitStatus
,
350 IN UINTN ExitDataSize
,
351 IN CHAR16
*ExitData OPTIONAL
356 (EFIAPI
*EFI_IMAGE_UNLOAD
) (
357 IN EFI_HANDLE ImageHandle
362 #define LOADED_IMAGE_PROTOCOL \
363 { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
365 #define EFI_IMAGE_INFORMATION_REVISION 0x1000
368 EFI_HANDLE ParentHandle
;
369 struct _EFI_SYSTEM_TABLE
*SystemTable
;
371 /* Source location of image */
372 EFI_HANDLE DeviceHandle
;
373 EFI_DEVICE_PATH
*FilePath
;
376 /* Images load options */
377 UINT32 LoadOptionsSize
;
380 /* Location of where image was loaded */
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
;
394 (EFIAPI
*EFI_EXIT_BOOT_SERVICES
) (
395 IN EFI_HANDLE ImageHandle
,
406 (EFIAPI
*EFI_STALL
) (
407 IN UINTN Microseconds
412 (EFIAPI
*EFI_SET_WATCHDOG_TIMER
) (
414 IN UINT64 WatchdogCode
,
416 IN CHAR16
*WatchdogData OPTIONAL
427 (EFIAPI
*EFI_RESET_SYSTEM
) (
428 IN EFI_RESET_TYPE ResetType
,
429 IN EFI_STATUS ResetStatus
,
431 IN CHAR16
*ResetData OPTIONAL
436 (EFIAPI
*EFI_GET_NEXT_MONOTONIC_COUNT
) (
442 (EFIAPI
*EFI_GET_NEXT_HIGH_MONO_COUNT
) (
443 OUT UINT32
*HighCount
447 * Protocol handler functions
451 EFI_NATIVE_INTERFACE
,
453 } EFI_INTERFACE_TYPE
;
457 (EFIAPI
*EFI_INSTALL_PROTOCOL_INTERFACE
) (
458 IN OUT EFI_HANDLE
*Handle
,
459 IN EFI_GUID
*Protocol
,
460 IN EFI_INTERFACE_TYPE InterfaceType
,
466 (EFIAPI
*EFI_REINSTALL_PROTOCOL_INTERFACE
) (
467 IN EFI_HANDLE Handle
,
468 IN EFI_GUID
*Protocol
,
469 IN VOID
*OldInterface
,
470 IN VOID
*NewInterface
475 (EFIAPI
*EFI_UNINSTALL_PROTOCOL_INTERFACE
) (
476 IN EFI_HANDLE Handle
,
477 IN EFI_GUID
*Protocol
,
483 (EFIAPI
*EFI_HANDLE_PROTOCOL
) (
484 IN EFI_HANDLE Handle
,
485 IN EFI_GUID
*Protocol
,
491 (EFIAPI
*EFI_REGISTER_PROTOCOL_NOTIFY
) (
492 IN EFI_GUID
*Protocol
,
494 OUT VOID
**Registration
501 } EFI_LOCATE_SEARCH_TYPE
;
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
515 (EFIAPI
*EFI_LOCATE_DEVICE_PATH
) (
516 IN EFI_GUID
*Protocol
,
517 IN OUT EFI_DEVICE_PATH
**DevicePath
,
518 OUT EFI_HANDLE
*Device
523 (EFIAPI
*EFI_INSTALL_CONFIGURATION_TABLE
) (
530 (EFIAPI
*EFI_RESERVED_SERVICE
) (
535 * Standard EFI table header
538 typedef struct _EFI_TABLE_HEARDER
{
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)
555 EFI_TABLE_HEADER Hdr
;
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
;
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
;
633 EFI_IMAGE_UNLOAD UnloadImage
;
634 EFI_EXIT_BOOT_SERVICES ExitBootServices
;
638 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
;
640 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
;
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
{
671 } EFI_CONFIGURATION_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
;