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