1 #ifndef _EFI_API_H 2 #define _EFI_API_H 3 4 /*++ 5 6 Copyright (c) 1998 Intel Corporation 7 8 Module Name: 9 10 efiapi.h 11 12 Abstract: 13 14 Global EFI runtime & boot service interfaces 15 16 17 18 19 Revision History 20 21 --*/ 22 23 // 24 // EFI Specification Revision 25 // 26 27 #define EFI_SPECIFICATION_MAJOR_REVISION 1 28 #define EFI_SPECIFICATION_MINOR_REVISION 02 29 30 // 31 // Declare forward referenced data structures 32 // 33 34 INTERFACE_DECL(_EFI_SYSTEM_TABLE); 35 36 // 37 // EFI Memory 38 // 39 40 typedef 41 EFI_STATUS 42 (EFIAPI *EFI_ALLOCATE_PAGES) ( 43 IN EFI_ALLOCATE_TYPE Type, 44 IN EFI_MEMORY_TYPE MemoryType, 45 IN UINTN NoPages, 46 OUT EFI_PHYSICAL_ADDRESS *Memory 47 ); 48 49 typedef 50 EFI_STATUS 51 (EFIAPI *EFI_FREE_PAGES) ( 52 IN EFI_PHYSICAL_ADDRESS Memory, 53 IN UINTN NoPages 54 ); 55 56 typedef 57 EFI_STATUS 58 (EFIAPI *EFI_GET_MEMORY_MAP) ( 59 IN OUT UINTN *MemoryMapSize, 60 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, 61 OUT UINTN *MapKey, 62 OUT UINTN *DescriptorSize, 63 OUT UINT32 *DescriptorVersion 64 ); 65 66 #define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) 67 68 69 typedef 70 EFI_STATUS 71 (EFIAPI *EFI_ALLOCATE_POOL) ( 72 IN EFI_MEMORY_TYPE PoolType, 73 IN UINTN Size, 74 OUT VOID **Buffer 75 ); 76 77 typedef 78 EFI_STATUS 79 (EFIAPI *EFI_FREE_POOL) ( 80 IN VOID *Buffer 81 ); 82 83 typedef 84 EFI_STATUS 85 (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) ( 86 IN UINTN MemoryMapSize, 87 IN UINTN DescriptorSize, 88 IN UINT32 DescriptorVersion, 89 IN EFI_MEMORY_DESCRIPTOR *VirtualMap 90 ); 91 92 93 #define EFI_OPTIONAL_PTR 0x00000001 94 #define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc 95 #define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data 96 97 98 typedef 99 EFI_STATUS 100 (EFIAPI *EFI_CONVERT_POINTER) ( 101 IN UINTN DebugDisposition, 102 IN OUT VOID **Address 103 ); 104 105 106 // 107 // EFI Events 108 // 109 110 #define EVT_TIMER 0x80000000 111 #define EVT_RUNTIME 0x40000000 112 #define EVT_RUNTIME_CONTEXT 0x20000000 113 114 #define EVT_NOTIFY_WAIT 0x00000100 115 #define EVT_NOTIFY_SIGNAL 0x00000200 116 117 #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 118 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 119 120 #define EVT_EFI_SIGNAL_MASK 0x000000FF 121 #define EVT_EFI_SIGNAL_MAX 4 122 123 #define EFI_EVENT_TIMER EVT_TIMER 124 #define EFI_EVENT_RUNTIME EVT_RUNTIME 125 #define EFI_EVENT_RUNTIME_CONTEXT EVT_RUNTIME_CONTEXT 126 #define EFI_EVENT_NOTIFY_WAIT EVT_NOTIFY_WAIT 127 #define EFI_EVENT_NOTIFY_SIGNAL EVT_NOTIFY_SIGNAL 128 #define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES EVT_SIGNAL_EXIT_BOOT_SERVICES 129 #define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 130 #define EFI_EVENT_EFI_SIGNAL_MASK EVT_EFI_SIGNAL_MASK 131 #define EFI_EVENT_EFI_SIGNAL_MAX EVT_EFI_SIGNAL_MAX 132 133 134 typedef 135 VOID 136 (EFIAPI *EFI_EVENT_NOTIFY) ( 137 IN EFI_EVENT Event, 138 IN VOID *Context 139 ); 140 141 typedef 142 EFI_STATUS 143 (EFIAPI *EFI_CREATE_EVENT) ( 144 IN UINT32 Type, 145 IN EFI_TPL NotifyTpl, 146 IN EFI_EVENT_NOTIFY NotifyFunction, 147 IN VOID *NotifyContext, 148 OUT EFI_EVENT *Event 149 ); 150 151 typedef enum { 152 TimerCancel, 153 TimerPeriodic, 154 TimerRelative, 155 TimerTypeMax 156 } EFI_TIMER_DELAY; 157 158 typedef 159 EFI_STATUS 160 (EFIAPI *EFI_SET_TIMER) ( 161 IN EFI_EVENT Event, 162 IN EFI_TIMER_DELAY Type, 163 IN UINT64 TriggerTime 164 ); 165 166 typedef 167 EFI_STATUS 168 (EFIAPI *EFI_SIGNAL_EVENT) ( 169 IN EFI_EVENT Event 170 ); 171 172 typedef 173 EFI_STATUS 174 (EFIAPI *EFI_WAIT_FOR_EVENT) ( 175 IN UINTN NumberOfEvents, 176 IN EFI_EVENT *Event, 177 OUT UINTN *Index 178 ); 179 180 typedef 181 EFI_STATUS 182 (EFIAPI *EFI_CLOSE_EVENT) ( 183 IN EFI_EVENT Event 184 ); 185 186 typedef 187 EFI_STATUS 188 (EFIAPI *EFI_CHECK_EVENT) ( 189 IN EFI_EVENT Event 190 ); 191 192 // 193 // Task priority level 194 // 195 196 #define TPL_APPLICATION 4 197 #define TPL_CALLBACK 8 198 #define TPL_NOTIFY 16 199 #define TPL_HIGH_LEVEL 31 200 #define EFI_TPL_APPLICATION TPL_APPLICATION 201 #define EFI_TPL_CALLBACK TPL_CALLBACK 202 #define EFI_TPL_NOTIFY TPL_NOTIFY 203 #define EFI_TPL_HIGH_LEVEL TPL_HIGH_LEVEL 204 typedef 205 EFI_TPL 206 (EFIAPI *EFI_RAISE_TPL) ( 207 IN EFI_TPL NewTpl 208 ); 209 210 typedef 211 VOID 212 (EFIAPI *EFI_RESTORE_TPL) ( 213 IN EFI_TPL OldTpl 214 ); 215 216 217 // 218 // EFI platform varibles 219 // 220 221 #define EFI_GLOBAL_VARIABLE \ 222 { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } 223 224 // Variable attributes 225 #define EFI_VARIABLE_NON_VOLATILE 0x00000001 226 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 227 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 228 #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 229 #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 230 #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 231 #define EFI_VARIABLE_APPEND_WRITE 0x00000040 232 233 // Variable size limitation 234 #define EFI_MAXIMUM_VARIABLE_SIZE 1024 235 236 typedef 237 EFI_STATUS 238 (EFIAPI *EFI_GET_VARIABLE) ( 239 IN CHAR16 *VariableName, 240 IN EFI_GUID *VendorGuid, 241 OUT UINT32 *Attributes OPTIONAL, 242 IN OUT UINTN *DataSize, 243 OUT VOID *Data 244 ); 245 246 typedef 247 EFI_STATUS 248 (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) ( 249 IN OUT UINTN *VariableNameSize, 250 IN OUT CHAR16 *VariableName, 251 IN OUT EFI_GUID *VendorGuid 252 ); 253 254 255 typedef 256 EFI_STATUS 257 (EFIAPI *EFI_SET_VARIABLE) ( 258 IN CHAR16 *VariableName, 259 IN EFI_GUID *VendorGuid, 260 IN UINT32 Attributes, 261 IN UINTN DataSize, 262 IN VOID *Data 263 ); 264 265 266 // 267 // EFI Time 268 // 269 270 typedef struct { 271 UINT32 Resolution; // 1e-6 parts per million 272 UINT32 Accuracy; // hertz 273 BOOLEAN SetsToZero; // Set clears sub-second time 274 } EFI_TIME_CAPABILITIES; 275 276 277 typedef 278 EFI_STATUS 279 (EFIAPI *EFI_GET_TIME) ( 280 OUT EFI_TIME *Time, 281 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL 282 ); 283 284 typedef 285 EFI_STATUS 286 (EFIAPI *EFI_SET_TIME) ( 287 IN EFI_TIME *Time 288 ); 289 290 typedef 291 EFI_STATUS 292 (EFIAPI *EFI_GET_WAKEUP_TIME) ( 293 OUT BOOLEAN *Enabled, 294 OUT BOOLEAN *Pending, 295 OUT EFI_TIME *Time 296 ); 297 298 typedef 299 EFI_STATUS 300 (EFIAPI *EFI_SET_WAKEUP_TIME) ( 301 IN BOOLEAN Enable, 302 IN EFI_TIME *Time OPTIONAL 303 ); 304 305 306 // 307 // Image functions 308 // 309 310 311 // PE32+ Subsystem type for EFI images 312 313 #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION) 314 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 315 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 316 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 317 #endif 318 319 // PE32+ Machine type for EFI images 320 321 #if !defined(EFI_IMAGE_MACHINE_IA32) 322 #define EFI_IMAGE_MACHINE_IA32 0x014c 323 #endif 324 325 #if !defined(EFI_IMAGE_MACHINE_IA64) 326 #define EFI_IMAGE_MACHINE_IA64 0x0200 327 #endif 328 329 #if !defined(EFI_IMAGE_MACHINE_EBC) 330 #define EFI_IMAGE_MACHINE_EBC 0x0EBC 331 #endif 332 333 #if !defined(EFI_IMAGE_MACHINE_X64) 334 #define EFI_IMAGE_MACHINE_X64 0x8664 335 #endif 336 337 #if !defined(EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) 338 #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2 339 #endif 340 341 #if !defined(EFI_IMAGE_MACHINE_AARCH64) 342 #define EFI_IMAGE_MACHINE_AARCH64 0xAA64 343 #endif 344 345 // Image Entry prototype 346 347 typedef 348 EFI_STATUS 349 (EFIAPI *EFI_IMAGE_ENTRY_POINT) ( 350 IN EFI_HANDLE ImageHandle, 351 IN struct _EFI_SYSTEM_TABLE *SystemTable 352 ); 353 354 typedef 355 EFI_STATUS 356 (EFIAPI *EFI_IMAGE_LOAD) ( 357 IN BOOLEAN BootPolicy, 358 IN EFI_HANDLE ParentImageHandle, 359 IN EFI_DEVICE_PATH *FilePath, 360 IN VOID *SourceBuffer OPTIONAL, 361 IN UINTN SourceSize, 362 OUT EFI_HANDLE *ImageHandle 363 ); 364 365 typedef 366 EFI_STATUS 367 (EFIAPI *EFI_IMAGE_START) ( 368 IN EFI_HANDLE ImageHandle, 369 OUT UINTN *ExitDataSize, 370 OUT CHAR16 **ExitData OPTIONAL 371 ); 372 373 typedef 374 EFI_STATUS 375 (EFIAPI *EFI_EXIT) ( 376 IN EFI_HANDLE ImageHandle, 377 IN EFI_STATUS ExitStatus, 378 IN UINTN ExitDataSize, 379 IN CHAR16 *ExitData OPTIONAL 380 ); 381 382 383 // Image handle 384 /*#define LOADED_IMAGE_PROTOCOL \ 385 { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } 386 387 #define EFI_IMAGE_INFORMATION_REVISION 0x1000 388 typedef struct { 389 UINT32 Revision; 390 EFI_HANDLE ParentHandle; 391 struct _EFI_SYSTEM_TABLE *SystemTable; 392 393 // Source location of image 394 EFI_HANDLE DeviceHandle; 395 EFI_DEVICE_PATH *FilePath; 396 VOID *Reserved; 397 398 // Images load options 399 UINT32 LoadOptionsSize; 400 VOID *LoadOptions; 401 402 // Location of where image was loaded 403 VOID *ImageBase; 404 UINT64 ImageSize; 405 EFI_MEMORY_TYPE ImageCodeType; 406 EFI_MEMORY_TYPE ImageDataType; 407 408 // If the driver image supports a dynamic unload request 409 EFI_IMAGE_UNLOAD Unload; 410 411 } EFI_LOADED_IMAGE;*/ 412 413 414 typedef 415 EFI_STATUS 416 (EFIAPI *EFI_EXIT_BOOT_SERVICES) ( 417 IN EFI_HANDLE ImageHandle, 418 IN UINTN MapKey 419 ); 420 421 // 422 // Misc 423 // 424 425 426 typedef 427 EFI_STATUS 428 (EFIAPI *EFI_STALL) ( 429 IN UINTN Microseconds 430 ); 431 432 typedef 433 EFI_STATUS 434 (EFIAPI *EFI_SET_WATCHDOG_TIMER) ( 435 IN UINTN Timeout, 436 IN UINT64 WatchdogCode, 437 IN UINTN DataSize, 438 IN CHAR16 *WatchdogData OPTIONAL 439 ); 440 441 typedef 442 EFI_STATUS 443 (EFIAPI *EFI_CONNECT_CONTROLLER) ( 444 IN EFI_HANDLE ControllerHandle, 445 IN EFI_HANDLE *DriverImageHandle OPTIONAL, 446 IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL, 447 IN BOOLEAN Recursive 448 ); 449 450 typedef 451 EFI_STATUS 452 (EFIAPI *EFI_DISCONNECT_CONTROLLER) ( 453 IN EFI_HANDLE ControllerHandle, 454 IN EFI_HANDLE DriverImageHandle OPTIONAL, 455 IN EFI_HANDLE ChildHandle OPTIONAL 456 ); 457 458 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 459 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 460 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 461 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 462 #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 463 #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 464 465 typedef 466 EFI_STATUS 467 (EFIAPI *EFI_OPEN_PROTOCOL) ( 468 IN EFI_HANDLE Handle, 469 IN EFI_GUID *Protocol, 470 OUT VOID **Interface OPTIONAL, 471 IN EFI_HANDLE AgentHandle, 472 IN EFI_HANDLE ControllerHandle, 473 IN UINT32 Attributes 474 ); 475 476 typedef 477 EFI_STATUS 478 (EFIAPI *EFI_CLOSE_PROTOCOL) ( 479 IN EFI_HANDLE Handle, 480 IN EFI_GUID *Protocol, 481 IN EFI_HANDLE AgentHandle, 482 IN EFI_HANDLE ControllerHandle 483 ); 484 485 typedef struct { 486 EFI_HANDLE AgentHandle; 487 EFI_HANDLE ControllerHandle; 488 UINT32 Attributes; 489 UINT32 OpenCount; 490 } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; 491 492 typedef 493 EFI_STATUS 494 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( 495 IN EFI_HANDLE Handle, 496 IN EFI_GUID *Protocol, 497 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, 498 OUT UINTN *EntryCount 499 ); 500 501 typedef 502 EFI_STATUS 503 (EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( 504 IN EFI_HANDLE Handle, 505 OUT EFI_GUID ***ProtocolBuffer, 506 OUT UINTN *ProtocolBufferCount 507 ); 508 509 typedef enum { 510 AllHandles, 511 ByRegisterNotify, 512 ByProtocol 513 } EFI_LOCATE_SEARCH_TYPE; 514 515 typedef 516 EFI_STATUS 517 (EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( 518 IN EFI_LOCATE_SEARCH_TYPE SearchType, 519 IN EFI_GUID *Protocol OPTIONAL, 520 IN VOID *SearchKey OPTIONAL, 521 IN OUT UINTN *NoHandles, 522 OUT EFI_HANDLE **Buffer 523 ); 524 525 typedef 526 EFI_STATUS 527 (EFIAPI *EFI_LOCATE_PROTOCOL) ( 528 IN EFI_GUID *Protocol, 529 IN VOID *Registration OPTIONAL, 530 OUT VOID **Interface 531 ); 532 533 typedef 534 EFI_STATUS 535 (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( 536 IN OUT EFI_HANDLE *Handle, 537 ... 538 ); 539 540 typedef 541 EFI_STATUS 542 (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( 543 IN OUT EFI_HANDLE Handle, 544 ... 545 ); 546 547 typedef 548 EFI_STATUS 549 (EFIAPI *EFI_CALCULATE_CRC32) ( 550 IN VOID *Data, 551 IN UINTN DataSize, 552 OUT UINT32 *Crc32 553 ); 554 555 typedef 556 VOID 557 (EFIAPI *EFI_COPY_MEM) ( 558 IN VOID *Destination, 559 IN VOID *Source, 560 IN UINTN Length 561 ); 562 563 typedef 564 VOID 565 (EFIAPI *EFI_SET_MEM) ( 566 IN VOID *Buffer, 567 IN UINTN Size, 568 IN UINT8 Value 569 ); 570 571 572 typedef 573 EFI_STATUS 574 (EFIAPI *EFI_CREATE_EVENT_EX) ( 575 IN UINT32 Type, 576 IN EFI_TPL NotifyTpl, 577 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, 578 IN const VOID *NotifyContext OPTIONAL, 579 IN const EFI_GUID *EventGroup OPTIONAL, 580 OUT EFI_EVENT *Event 581 ); 582 583 typedef enum { 584 EfiResetCold, 585 EfiResetWarm, 586 EfiResetShutdown 587 } EFI_RESET_TYPE; 588 589 typedef 590 EFI_STATUS 591 (EFIAPI *EFI_RESET_SYSTEM) ( 592 IN EFI_RESET_TYPE ResetType, 593 IN EFI_STATUS ResetStatus, 594 IN UINTN DataSize, 595 IN CHAR16 *ResetData OPTIONAL 596 ); 597 598 typedef 599 EFI_STATUS 600 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) ( 601 OUT UINT64 *Count 602 ); 603 604 typedef 605 EFI_STATUS 606 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) ( 607 OUT UINT32 *HighCount 608 ); 609 610 typedef struct { 611 UINT64 Length; 612 union { 613 EFI_PHYSICAL_ADDRESS DataBlock; 614 EFI_PHYSICAL_ADDRESS ContinuationPointer; 615 } Union; 616 } EFI_CAPSULE_BLOCK_DESCRIPTOR; 617 618 typedef struct { 619 EFI_GUID CapsuleGuid; 620 UINT32 HeaderSize; 621 UINT32 Flags; 622 UINT32 CapsuleImageSize; 623 } EFI_CAPSULE_HEADER; 624 625 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 626 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 627 #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000 628 629 typedef 630 EFI_STATUS 631 (EFIAPI *EFI_UPDATE_CAPSULE) ( 632 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, 633 IN UINTN CapsuleCount, 634 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL 635 ); 636 637 typedef 638 EFI_STATUS 639 (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) ( 640 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, 641 IN UINTN CapsuleCount, 642 OUT UINT64 *MaximumCapsuleSize, 643 OUT EFI_RESET_TYPE *ResetType 644 ); 645 646 typedef 647 EFI_STATUS 648 (EFIAPI *EFI_QUERY_VARIABLE_INFO) ( 649 IN UINT32 Attributes, 650 OUT UINT64 *MaximumVariableStorageSize, 651 OUT UINT64 *RemainingVariableStorageSize, 652 OUT UINT64 *MaximumVariableSize 653 ); 654 655 // 656 // Protocol handler functions 657 // 658 659 typedef enum { 660 EFI_NATIVE_INTERFACE, 661 EFI_PCODE_INTERFACE 662 } EFI_INTERFACE_TYPE; 663 664 typedef 665 EFI_STATUS 666 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( 667 IN OUT EFI_HANDLE *Handle, 668 IN EFI_GUID *Protocol, 669 IN EFI_INTERFACE_TYPE InterfaceType, 670 IN VOID *Interface 671 ); 672 673 typedef 674 EFI_STATUS 675 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( 676 IN EFI_HANDLE Handle, 677 IN EFI_GUID *Protocol, 678 IN VOID *OldInterface, 679 IN VOID *NewInterface 680 ); 681 682 typedef 683 EFI_STATUS 684 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( 685 IN EFI_HANDLE Handle, 686 IN EFI_GUID *Protocol, 687 IN VOID *Interface 688 ); 689 690 typedef 691 EFI_STATUS 692 (EFIAPI *EFI_HANDLE_PROTOCOL) ( 693 IN EFI_HANDLE Handle, 694 IN EFI_GUID *Protocol, 695 OUT VOID **Interface 696 ); 697 698 typedef 699 EFI_STATUS 700 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( 701 IN EFI_GUID *Protocol, 702 IN EFI_EVENT Event, 703 OUT VOID **Registration 704 ); 705 706 typedef 707 EFI_STATUS 708 (EFIAPI *EFI_LOCATE_HANDLE) ( 709 IN EFI_LOCATE_SEARCH_TYPE SearchType, 710 IN EFI_GUID *Protocol OPTIONAL, 711 IN VOID *SearchKey OPTIONAL, 712 IN OUT UINTN *BufferSize, 713 OUT EFI_HANDLE *Buffer 714 ); 715 716 typedef 717 EFI_STATUS 718 (EFIAPI *EFI_LOCATE_DEVICE_PATH) ( 719 IN EFI_GUID *Protocol, 720 IN OUT EFI_DEVICE_PATH **DevicePath, 721 OUT EFI_HANDLE *Device 722 ); 723 724 typedef 725 EFI_STATUS 726 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( 727 IN EFI_GUID *Guid, 728 IN VOID *Table 729 ); 730 731 typedef 732 EFI_STATUS 733 (EFIAPI *EFI_RESERVED_SERVICE) ( 734 ); 735 736 // 737 // Standard EFI table header 738 // 739 740 typedef struct _EFI_TABLE_HEADER { 741 UINT64 Signature; 742 UINT32 Revision; 743 UINT32 HeaderSize; 744 UINT32 CRC32; 745 UINT32 Reserved; 746 } EFI_TABLE_HEADER; 747 748 749 // 750 // EFI Runtime Serivces Table 751 // 752 753 #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 754 #define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) 755 756 typedef struct { 757 EFI_TABLE_HEADER Hdr; 758 759 // 760 // Time services 761 // 762 763 EFI_GET_TIME GetTime; 764 EFI_SET_TIME SetTime; 765 EFI_GET_WAKEUP_TIME GetWakeupTime; 766 EFI_SET_WAKEUP_TIME SetWakeupTime; 767 768 // 769 // Virtual memory services 770 // 771 772 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; 773 EFI_CONVERT_POINTER ConvertPointer; 774 775 // 776 // Variable serviers 777 // 778 779 EFI_GET_VARIABLE GetVariable; 780 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; 781 EFI_SET_VARIABLE SetVariable; 782 783 // 784 // Misc 785 // 786 787 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; 788 EFI_RESET_SYSTEM ResetSystem; 789 790 EFI_UPDATE_CAPSULE UpdateCapsule; 791 EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities; 792 EFI_QUERY_VARIABLE_INFO QueryVariableInfo; 793 } EFI_RUNTIME_SERVICES; 794 795 796 // 797 // EFI Boot Services Table 798 // 799 800 #define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 801 #define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) 802 803 typedef struct _EFI_BOOT_SERVICES { 804 805 EFI_TABLE_HEADER Hdr; 806 807 // 808 // Task priority functions 809 // 810 811 EFI_RAISE_TPL RaiseTPL; 812 EFI_RESTORE_TPL RestoreTPL; 813 814 // 815 // Memory functions 816 // 817 818 EFI_ALLOCATE_PAGES AllocatePages; 819 EFI_FREE_PAGES FreePages; 820 EFI_GET_MEMORY_MAP GetMemoryMap; 821 EFI_ALLOCATE_POOL AllocatePool; 822 EFI_FREE_POOL FreePool; 823 824 // 825 // Event & timer functions 826 // 827 828 EFI_CREATE_EVENT CreateEvent; 829 EFI_SET_TIMER SetTimer; 830 EFI_WAIT_FOR_EVENT WaitForEvent; 831 EFI_SIGNAL_EVENT SignalEvent; 832 EFI_CLOSE_EVENT CloseEvent; 833 EFI_CHECK_EVENT CheckEvent; 834 835 // 836 // Protocol handler functions 837 // 838 839 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; 840 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; 841 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; 842 EFI_HANDLE_PROTOCOL HandleProtocol; 843 EFI_HANDLE_PROTOCOL PCHandleProtocol; 844 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; 845 EFI_LOCATE_HANDLE LocateHandle; 846 EFI_LOCATE_DEVICE_PATH LocateDevicePath; 847 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; 848 849 // 850 // Image functions 851 // 852 853 EFI_IMAGE_LOAD LoadImage; 854 EFI_IMAGE_START StartImage; 855 EFI_EXIT Exit; 856 EFI_IMAGE_UNLOAD UnloadImage; 857 EFI_EXIT_BOOT_SERVICES ExitBootServices; 858 859 // 860 // Misc functions 861 // 862 863 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; 864 EFI_STALL Stall; 865 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; 866 867 // 868 // DriverSupport Services 869 // 870 871 EFI_CONNECT_CONTROLLER ConnectController; 872 EFI_DISCONNECT_CONTROLLER DisconnectController; 873 874 // 875 // Open and Close Protocol Services 876 // 877 EFI_OPEN_PROTOCOL OpenProtocol; 878 EFI_CLOSE_PROTOCOL CloseProtocol; 879 EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; 880 881 // 882 // Library Services 883 // 884 EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; 885 EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; 886 EFI_LOCATE_PROTOCOL LocateProtocol; 887 EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; 888 EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; 889 890 // 891 // 32-bit CRC Services 892 // 893 EFI_CALCULATE_CRC32 CalculateCrc32; 894 895 // 896 // Misc Services 897 // 898 EFI_COPY_MEM CopyMem; 899 EFI_SET_MEM SetMem; 900 EFI_CREATE_EVENT_EX CreateEventEx; 901 } EFI_BOOT_SERVICES; 902 903 904 // 905 // EFI Configuration Table and GUID definitions 906 // 907 908 #define MPS_TABLE_GUID \ 909 { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 910 911 #define ACPI_TABLE_GUID \ 912 { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 913 914 #define ACPI_20_TABLE_GUID \ 915 { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } 916 917 #define SMBIOS_TABLE_GUID \ 918 { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 919 920 #define SMBIOS3_TABLE_GUID \ 921 { 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} } 922 923 #define SAL_SYSTEM_TABLE_GUID \ 924 { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 925 926 927 typedef struct _EFI_CONFIGURATION_TABLE { 928 EFI_GUID VendorGuid; 929 VOID *VendorTable; 930 } EFI_CONFIGURATION_TABLE; 931 932 933 // 934 // EFI System Table 935 // 936 937 938 939 940 #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 941 #define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) 942 943 typedef struct _EFI_SYSTEM_TABLE { 944 EFI_TABLE_HEADER Hdr; 945 946 CHAR16 *FirmwareVendor; 947 UINT32 FirmwareRevision; 948 949 EFI_HANDLE ConsoleInHandle; 950 SIMPLE_INPUT_INTERFACE *ConIn; 951 952 EFI_HANDLE ConsoleOutHandle; 953 SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; 954 955 EFI_HANDLE StandardErrorHandle; 956 SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; 957 958 EFI_RUNTIME_SERVICES *RuntimeServices; 959 EFI_BOOT_SERVICES *BootServices; 960 961 UINTN NumberOfTableEntries; 962 EFI_CONFIGURATION_TABLE *ConfigurationTable; 963 964 } EFI_SYSTEM_TABLE; 965 966 #endif 967 968