Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / ia64 / stand / efi / include / efiapi.h
blob9d8c844ec37cbdffbf10585bd7933e5aaa75ad1e
1 /* $NetBSD: efiapi.h,v 1.1 2006/04/07 14:21:29 cherry Exp $ */
2 /* $FreeBSD: src/sys/boot/efi/include/efiapi.h,v 1.6 2003/12/10 19:08:09 jhb Exp $ */
3 #ifndef _EFI_API_H
4 #define _EFI_API_H
6 /*++
8 Copyright (c) 1998 Intel Corporation
10 Module Name:
12 efiapi.h
14 Abstract:
16 Global EFI runtime & boot service interfaces
21 Revision History
23 --*/
26 * EFI Specification Revision
29 #define EFI_SPECIFICATION_MAJOR_REVISION 1
30 #define EFI_SPECIFICATION_MINOR_REVISION 02
33 * Declare forward referenced data structures
36 INTERFACE_DECL(_EFI_SYSTEM_TABLE);
39 * EFI Memory
42 typedef
43 EFI_STATUS
44 (EFIAPI *EFI_ALLOCATE_PAGES) (
45 IN EFI_ALLOCATE_TYPE Type,
46 IN EFI_MEMORY_TYPE MemoryType,
47 IN UINTN NoPages,
48 OUT EFI_PHYSICAL_ADDRESS *Memory
51 typedef
52 EFI_STATUS
53 (EFIAPI *EFI_FREE_PAGES) (
54 IN EFI_PHYSICAL_ADDRESS Memory,
55 IN UINTN NoPages
58 typedef
59 EFI_STATUS
60 (EFIAPI *EFI_GET_MEMORY_MAP) (
61 IN OUT UINTN *MemoryMapSize,
62 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
63 OUT UINTN *MapKey,
64 OUT UINTN *DescriptorSize,
65 OUT UINT32 *DescriptorVersion
68 #define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
71 typedef
72 EFI_STATUS
73 (EFIAPI *EFI_ALLOCATE_POOL) (
74 IN EFI_MEMORY_TYPE PoolType,
75 IN UINTN Size,
76 OUT VOID **Buffer
79 typedef
80 EFI_STATUS
81 (EFIAPI *EFI_FREE_POOL) (
82 IN VOID *Buffer
85 typedef
86 EFI_STATUS
87 (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
88 IN UINTN MemoryMapSize,
89 IN UINTN DescriptorSize,
90 IN UINT32 DescriptorVersion,
91 IN EFI_MEMORY_DESCRIPTOR *VirtualMap
95 #define EFI_OPTIONAL_PTR 0x00000001
96 #define EFI_INTERNAL_FNC 0x00000002 /* Pointer to internal runtime fnc */
97 #define EFI_INTERNAL_PTR 0x00000004 /* Pointer to internal runtime data */
100 typedef
101 EFI_STATUS
102 (EFIAPI *EFI_CONVERT_POINTER) (
103 IN UINTN DebugDisposition,
104 IN OUT VOID **Address
109 * EFI Events
114 #define EVT_TIMER 0x80000000
115 #define EVT_RUNTIME 0x40000000
116 #define EVT_RUNTIME_CONTEXT 0x20000000
118 #define EVT_NOTIFY_WAIT 0x00000100
119 #define EVT_NOTIFY_SIGNAL 0x00000200
121 #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
122 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
124 #define EVT_EFI_SIGNAL_MASK 0x000000FF
125 #define EVT_EFI_SIGNAL_MAX 2
127 typedef
128 VOID
129 (EFIAPI *EFI_EVENT_NOTIFY) (
130 IN EFI_EVENT Event,
131 IN VOID *Context
134 typedef
135 EFI_STATUS
136 (EFIAPI *EFI_CREATE_EVENT) (
137 IN UINT32 Type,
138 IN EFI_TPL NotifyTpl,
139 IN EFI_EVENT_NOTIFY NotifyFunction,
140 IN VOID *NotifyContext,
141 OUT EFI_EVENT *Event
144 typedef enum {
145 TimerCancel,
146 TimerPeriodic,
147 TimerRelative,
148 TimerTypeMax
149 } EFI_TIMER_DELAY;
151 typedef
152 EFI_STATUS
153 (EFIAPI *EFI_SET_TIMER) (
154 IN EFI_EVENT Event,
155 IN EFI_TIMER_DELAY Type,
156 IN UINT64 TriggerTime
159 typedef
160 EFI_STATUS
161 (EFIAPI *EFI_SIGNAL_EVENT) (
162 IN EFI_EVENT Event
165 typedef
166 EFI_STATUS
167 (EFIAPI *EFI_WAIT_FOR_EVENT) (
168 IN UINTN NumberOfEvents,
169 IN EFI_EVENT *Event,
170 OUT UINTN *Index
173 typedef
174 EFI_STATUS
175 (EFIAPI *EFI_CLOSE_EVENT) (
176 IN EFI_EVENT Event
179 typedef
180 EFI_STATUS
181 (EFIAPI *EFI_CHECK_EVENT) (
182 IN EFI_EVENT Event
186 * Task priority level
189 #define TPL_APPLICATION 4
190 #define TPL_CALLBACK 8
191 #define TPL_NOTIFY 16
192 #define TPL_HIGH_LEVEL 31
194 typedef
195 EFI_TPL
196 (EFIAPI *EFI_RAISE_TPL) (
197 IN EFI_TPL NewTpl
200 typedef
201 VOID
202 (EFIAPI *EFI_RESTORE_TPL) (
203 IN EFI_TPL OldTpl
208 * EFI platform variables
211 #define EFI_GLOBAL_VARIABLE \
212 { 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }
214 /* Variable attributes */
215 #define EFI_VARIABLE_NON_VOLATILE 0x00000001
216 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
217 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
219 /* Variable size limitation */
220 #define EFI_MAXIMUM_VARIABLE_SIZE 1024
222 typedef
223 EFI_STATUS
224 (EFIAPI *EFI_GET_VARIABLE) (
225 IN CHAR16 *VariableName,
226 IN EFI_GUID *VendorGuid,
227 OUT UINT32 *Attributes OPTIONAL,
228 IN OUT UINTN *DataSize,
229 OUT VOID *Data
232 typedef
233 EFI_STATUS
234 (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
235 IN OUT UINTN *VariableNameSize,
236 IN OUT CHAR16 *VariableName,
237 IN OUT EFI_GUID *VendorGuid
241 typedef
242 EFI_STATUS
243 (EFIAPI *EFI_SET_VARIABLE) (
244 IN CHAR16 *VariableName,
245 IN EFI_GUID *VendorGuid,
246 IN UINT32 Attributes,
247 IN UINTN DataSize,
248 IN VOID *Data
253 * EFI Time
256 typedef struct {
257 UINT32 Resolution; /* 1e-6 parts per million */
258 UINT32 Accuracy; /* hertz */
259 BOOLEAN SetsToZero; /* Set clears sub-second time */
260 } EFI_TIME_CAPABILITIES;
263 typedef
264 EFI_STATUS
265 (EFIAPI *EFI_GET_TIME) (
266 OUT EFI_TIME *Time,
267 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
270 typedef
271 EFI_STATUS
272 (EFIAPI *EFI_SET_TIME) (
273 IN EFI_TIME *Time
276 typedef
277 EFI_STATUS
278 (EFIAPI *EFI_GET_WAKEUP_TIME) (
279 OUT BOOLEAN *Enabled,
280 OUT BOOLEAN *Pending,
281 OUT EFI_TIME *Time
284 typedef
285 EFI_STATUS
286 (EFIAPI *EFI_SET_WAKEUP_TIME) (
287 IN BOOLEAN Enable,
288 IN EFI_TIME *Time OPTIONAL
293 * Image functions
297 /* PE32+ Subsystem type for EFI images */
299 #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
300 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
301 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
302 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
303 #endif
305 /* PE32+ Machine type for EFI images */
307 #if !defined(EFI_IMAGE_MACHINE_IA32)
308 #define EFI_IMAGE_MACHINE_IA32 0x014c
309 #endif
311 #if !defined(EFI_IMAGE_MACHINE_IA64)
312 #define EFI_IMAGE_MACHINE_IA64 0x0200
313 #endif
315 /* Image Entry prototype */
317 typedef
318 EFI_STATUS
319 (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
320 IN EFI_HANDLE ImageHandle,
321 IN struct _EFI_SYSTEM_TABLE *SystemTable
324 typedef
325 EFI_STATUS
326 (EFIAPI *EFI_IMAGE_LOAD) (
327 IN BOOLEAN BootPolicy,
328 IN EFI_HANDLE ParentImageHandle,
329 IN EFI_DEVICE_PATH *FilePath,
330 IN VOID *SourceBuffer OPTIONAL,
331 IN UINTN SourceSize,
332 OUT EFI_HANDLE *ImageHandle
335 typedef
336 EFI_STATUS
337 (EFIAPI *EFI_IMAGE_START) (
338 IN EFI_HANDLE ImageHandle,
339 OUT UINTN *ExitDataSize,
340 OUT CHAR16 **ExitData OPTIONAL
343 typedef
344 EFI_STATUS
345 (EFIAPI *EFI_EXIT) (
346 IN EFI_HANDLE ImageHandle,
347 IN EFI_STATUS ExitStatus,
348 IN UINTN ExitDataSize,
349 IN CHAR16 *ExitData OPTIONAL
352 typedef
353 EFI_STATUS
354 (EFIAPI *EFI_IMAGE_UNLOAD) (
355 IN EFI_HANDLE ImageHandle
359 /* Image handle */
360 #define LOADED_IMAGE_PROTOCOL \
361 { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
363 #define EFI_IMAGE_INFORMATION_REVISION 0x1000
364 typedef struct {
365 UINT32 Revision;
366 EFI_HANDLE ParentHandle;
367 struct _EFI_SYSTEM_TABLE *SystemTable;
369 /* Source location of image */
370 EFI_HANDLE DeviceHandle;
371 EFI_DEVICE_PATH *FilePath;
372 VOID *Reserved;
374 /* Images load options */
375 UINT32 LoadOptionsSize;
376 VOID *LoadOptions;
378 /* Location of where image was loaded */
379 VOID *ImageBase;
380 UINT64 ImageSize;
381 EFI_MEMORY_TYPE ImageCodeType;
382 EFI_MEMORY_TYPE ImageDataType;
384 /* If the driver image supports a dynamic unload request */
385 EFI_IMAGE_UNLOAD Unload;
387 } EFI_LOADED_IMAGE;
390 typedef
391 EFI_STATUS
392 (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
393 IN EFI_HANDLE ImageHandle,
394 IN UINTN MapKey
398 * Misc
402 typedef
403 EFI_STATUS
404 (EFIAPI *EFI_STALL) (
405 IN UINTN Microseconds
408 typedef
409 EFI_STATUS
410 (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
411 IN UINTN Timeout,
412 IN UINT64 WatchdogCode,
413 IN UINTN DataSize,
414 IN CHAR16 *WatchdogData OPTIONAL
418 typedef enum {
419 EfiResetCold,
420 EfiResetWarm
421 } EFI_RESET_TYPE;
423 typedef
424 EFI_STATUS
425 (EFIAPI *EFI_RESET_SYSTEM) (
426 IN EFI_RESET_TYPE ResetType,
427 IN EFI_STATUS ResetStatus,
428 IN UINTN DataSize,
429 IN CHAR16 *ResetData OPTIONAL
432 typedef
433 EFI_STATUS
434 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
435 OUT UINT64 *Count
438 typedef
439 EFI_STATUS
440 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
441 OUT UINT32 *HighCount
445 * Protocol handler functions
448 typedef enum {
449 EFI_NATIVE_INTERFACE,
450 EFI_PCODE_INTERFACE
451 } EFI_INTERFACE_TYPE;
453 typedef
454 EFI_STATUS
455 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
456 IN OUT EFI_HANDLE *Handle,
457 IN EFI_GUID *Protocol,
458 IN EFI_INTERFACE_TYPE InterfaceType,
459 IN VOID *Interface
462 typedef
463 EFI_STATUS
464 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
465 IN EFI_HANDLE Handle,
466 IN EFI_GUID *Protocol,
467 IN VOID *OldInterface,
468 IN VOID *NewInterface
471 typedef
472 EFI_STATUS
473 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
474 IN EFI_HANDLE Handle,
475 IN EFI_GUID *Protocol,
476 IN VOID *Interface
479 typedef
480 EFI_STATUS
481 (EFIAPI *EFI_HANDLE_PROTOCOL) (
482 IN EFI_HANDLE Handle,
483 IN EFI_GUID *Protocol,
484 OUT VOID **Interface
487 typedef
488 EFI_STATUS
489 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
490 IN EFI_GUID *Protocol,
491 IN EFI_EVENT Event,
492 OUT VOID **Registration
495 typedef enum {
496 AllHandles,
497 ByRegisterNotify,
498 ByProtocol
499 } EFI_LOCATE_SEARCH_TYPE;
501 typedef
502 EFI_STATUS
503 (EFIAPI *EFI_LOCATE_HANDLE) (
504 IN EFI_LOCATE_SEARCH_TYPE SearchType,
505 IN EFI_GUID *Protocol OPTIONAL,
506 IN VOID *SearchKey OPTIONAL,
507 IN OUT UINTN *BufferSize,
508 OUT EFI_HANDLE *Buffer
511 typedef
512 EFI_STATUS
513 (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
514 IN EFI_GUID *Protocol,
515 IN OUT EFI_DEVICE_PATH **DevicePath,
516 OUT EFI_HANDLE *Device
519 typedef
520 EFI_STATUS
521 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
522 IN EFI_GUID *Guid,
523 IN VOID *Table
526 typedef
527 EFI_STATUS
528 (EFIAPI *EFI_RESERVED_SERVICE) (
529 VOID
533 * Standard EFI table header
536 typedef struct _EFI_TABLE_HEARDER {
537 UINT64 Signature;
538 UINT32 Revision;
539 UINT32 HeaderSize;
540 UINT32 CRC32;
541 UINT32 Reserved;
542 } EFI_TABLE_HEADER;
546 * EFI Runtime Serivces Table
549 #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
550 #define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
552 typedef struct {
553 EFI_TABLE_HEADER Hdr;
555 /* Time services */
557 EFI_GET_TIME GetTime;
558 EFI_SET_TIME SetTime;
559 EFI_GET_WAKEUP_TIME GetWakeupTime;
560 EFI_SET_WAKEUP_TIME SetWakeupTime;
562 /* Virtual memory services */
564 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
565 EFI_CONVERT_POINTER ConvertPointer;
567 /* Variable serviers */
569 EFI_GET_VARIABLE GetVariable;
570 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
571 EFI_SET_VARIABLE SetVariable;
573 /* Misc */
575 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
576 EFI_RESET_SYSTEM ResetSystem;
578 } EFI_RUNTIME_SERVICES;
582 * EFI Boot Services Table
585 #define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
586 #define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
588 typedef struct _EFI_BOOT_SERVICES {
590 EFI_TABLE_HEADER Hdr;
592 /* Task priority functions */
594 EFI_RAISE_TPL RaiseTPL;
595 EFI_RESTORE_TPL RestoreTPL;
597 /* Memory functions */
599 EFI_ALLOCATE_PAGES AllocatePages;
600 EFI_FREE_PAGES FreePages;
601 EFI_GET_MEMORY_MAP GetMemoryMap;
602 EFI_ALLOCATE_POOL AllocatePool;
603 EFI_FREE_POOL FreePool;
605 /* Event & timer functions */
607 EFI_CREATE_EVENT CreateEvent;
608 EFI_SET_TIMER SetTimer;
609 EFI_WAIT_FOR_EVENT WaitForEvent;
610 EFI_SIGNAL_EVENT SignalEvent;
611 EFI_CLOSE_EVENT CloseEvent;
612 EFI_CHECK_EVENT CheckEvent;
614 /* Protocol handler functions */
616 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
617 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
618 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
619 EFI_HANDLE_PROTOCOL HandleProtocol;
620 EFI_HANDLE_PROTOCOL PCHandleProtocol;
621 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
622 EFI_LOCATE_HANDLE LocateHandle;
623 EFI_LOCATE_DEVICE_PATH LocateDevicePath;
624 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
626 /* Image functions */
628 EFI_IMAGE_LOAD LoadImage;
629 EFI_IMAGE_START StartImage;
630 EFI_EXIT Exit;
631 EFI_IMAGE_UNLOAD UnloadImage;
632 EFI_EXIT_BOOT_SERVICES ExitBootServices;
634 /* Misc functions */
636 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
637 EFI_STALL Stall;
638 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
640 } EFI_BOOT_SERVICES;
644 * EFI Configuration Table and GUID definitions
647 #define MPS_TABLE_GUID \
648 { 0xeb9d2d2f, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
650 #define ACPI_TABLE_GUID \
651 { 0xeb9d2d30, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
653 #define ACPI_20_TABLE_GUID \
654 { 0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
656 #define SMBIOS_TABLE_GUID \
657 { 0xeb9d2d31, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
659 #define SAL_SYSTEM_TABLE_GUID \
660 { 0xeb9d2d32, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
662 /* DIG64 Headless Console & Debug Port Table. */
663 #define HCDP_TABLE_GUID \
664 {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}}
666 typedef struct _EFI_CONFIGURATION_TABLE {
667 EFI_GUID VendorGuid;
668 VOID *VendorTable;
669 } EFI_CONFIGURATION_TABLE;
673 * EFI System Table
679 #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
680 #define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
682 typedef struct _EFI_SYSTEM_TABLE {
683 EFI_TABLE_HEADER Hdr;
685 CHAR16 *FirmwareVendor;
686 UINT32 FirmwareRevision;
688 EFI_HANDLE ConsoleInHandle;
689 SIMPLE_INPUT_INTERFACE *ConIn;
691 EFI_HANDLE ConsoleOutHandle;
692 SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
694 EFI_HANDLE StandardErrorHandle;
695 SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
697 EFI_RUNTIME_SERVICES *RuntimeServices;
698 EFI_BOOT_SERVICES *BootServices;
700 UINTN NumberOfTableEntries;
701 EFI_CONFIGURATION_TABLE *ConfigurationTable;
703 } EFI_SYSTEM_TABLE;
705 #endif