1 #ifndef _EFILIB_INCLUDE_ 2 #define _EFILIB_INCLUDE_ 3 4 /*++ 5 6 Copyright (c) 2000 Intel Corporation 7 8 Module Name: 9 10 efilib.h 11 12 Abstract: 13 14 EFI library functions 15 16 17 18 Revision History 19 20 --*/ 21 22 #include "efidebug.h" 23 #include "efipart.h" 24 #include "efilibplat.h" 25 #include "efilink.h" 26 #include "efirtlib.h" 27 #include "efistdarg.h" 28 #include "pci22.h" 29 #include "libsmbios.h" 30 31 // 32 // Public read-only data in the EFI library 33 // 34 35 extern EFI_SYSTEM_TABLE *ST; 36 #define gST ST 37 extern EFI_BOOT_SERVICES *BS; 38 #define gBS BS 39 extern EFI_RUNTIME_SERVICES *RT; 40 #define gRT RT 41 42 extern EFI_GUID gEfiDevicePathProtocolGuid; 43 #define DevicePathProtocol gEfiDevicePathProtocolGuid 44 extern EFI_GUID gEfiDevicePathToTextProtocolGuid; 45 #define DevicePathToTextProtocol gEfiDevicePathToTextProtocolGuid 46 extern EFI_GUID gEfiDevicePathFromTextProtocolGuid; 47 #define DevicePathFromTextProtocol gEfiDevicePathFromTextProtocolGuid 48 extern EFI_GUID gEfiLoadedImageProtocolGuid; 49 #define LoadedImageProtocol gEfiLoadedImageProtocolGuid 50 extern EFI_GUID gEfiSimpleTextInProtocolGuid; 51 #define TextInProtocol gEfiSimpleTextInProtocolGuid 52 extern EFI_GUID gEfiSimpleTextOutProtocolGuid; 53 #define TextOutProtocol gEfiSimpleTextOutProtocolGuid 54 extern EFI_GUID gEfiGraphicsOutputProtocolGuid; 55 #define GraphicsOutputProtocol gEfiGraphicsOutputProtocolGuid 56 extern EFI_GUID gEfiEdidDiscoveredProtocolGuid; 57 #define EdidDiscoveredProtocol gEfiEdidDiscoveredProtocolGuid 58 extern EFI_GUID gEfiEdidActiveProtocolGuid; 59 #define EdidActiveProtocol gEfiEdidActiveProtocolGuid 60 extern EFI_GUID gEfiEdidOverrideProtocolGuid; 61 #define EdidOverrideProtocol gEfiEdidOverrideProtocolGuid 62 extern EFI_GUID gEfiBlockIoProtocolGuid; 63 #define BlockIoProtocol gEfiBlockIoProtocolGuid 64 extern EFI_GUID gEfiBlockIo2ProtocolGuid; 65 #define BlockIo2Protocol gEfiBlockIo2ProtocolGuid 66 extern EFI_GUID gEfiDiskIoProtocolGuid; 67 #define DiskIoProtocol gEfiDiskIoProtocolGuid 68 extern EFI_GUID gEfiDiskIo2ProtocolGuid; 69 #define DiskIo2Protocol gEfiDiskIo2ProtocolGuid 70 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid; 71 #define FileSystemProtocol gEfiSimpleFileSystemProtocolGuid 72 extern EFI_GUID gEfiLoadFileProtocolGuid; 73 #define LoadFileProtocol gEfiLoadFileProtocolGuid 74 extern EFI_GUID gEfiDeviceIoProtocolGuid; 75 #define DeviceIoProtocol gEfiDeviceIoProtocolGuid 76 extern EFI_GUID VariableStoreProtocol; 77 extern EFI_GUID LegacyBootProtocol; 78 extern EFI_GUID gEfiUnicodeCollationProtocolGuid; 79 #define UnicodeCollationProtocol gEfiUnicodeCollationProtocolGuid 80 extern EFI_GUID gEfiSerialIoProtocolGuid; 81 #define SerialIoProtocol gEfiSerialIoProtocolGuid 82 extern EFI_GUID VgaClassProtocol; 83 extern EFI_GUID TextOutSpliterProtocol; 84 extern EFI_GUID ErrorOutSpliterProtocol; 85 extern EFI_GUID TextInSpliterProtocol; 86 extern EFI_GUID gEfiSimpleNetworkProtocolGuid; 87 #define SimpleNetworkProtocol gEfiSimpleNetworkProtocolGuid 88 extern EFI_GUID gEfiPxeBaseCodeProtocolGuid; 89 #define PxeBaseCodeProtocol gEfiPxeBaseCodeProtocolGuid 90 extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid; 91 #define PxeCallbackProtocol gEfiPxeBaseCodeCallbackProtocolGuid 92 extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid; 93 #define NetworkInterfaceIdentifierProtocol gEfiNetworkInterfaceIdentifierProtocolGuid 94 extern EFI_GUID gEFiUiInterfaceProtocolGuid; 95 #define UiProtocol gEFiUiInterfaceProtocolGuid 96 extern EFI_GUID InternalShellProtocol; 97 extern EFI_GUID gEfiPciIoProtocolGuid; 98 #define PciIoProtocol gEfiPciIoProtocolGuid 99 extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid; 100 extern EFI_GUID gEfiDriverBindingProtocolGuid; 101 #define DriverBindingProtocol gEfiDriverBindingProtocolGuid 102 extern EFI_GUID gEfiComponentNameProtocolGuid; 103 #define ComponentNameProtocol gEfiComponentNameProtocolGuid 104 extern EFI_GUID gEfiComponentName2ProtocolGuid; 105 #define ComponentName2Protocol gEfiComponentName2ProtocolGuid 106 extern EFI_GUID gEfiHashProtocolGuid; 107 #define HashProtocol gEfiHashProtocolGuid 108 extern EFI_GUID gEfiPlatformDriverOverrideProtocolGuid; 109 #define PlatformDriverOverrideProtocol gEfiPlatformDriverOverrideProtocolGuid 110 extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid; 111 #define BusSpecificDriverOverrideProtocol gEfiBusSpecificDriverOverrideProtocolGuid 112 extern EFI_GUID gEfiDriverFamilyOverrideProtocolGuid; 113 #define DriverFamilyOverrideProtocol gEfiDriverFamilyOverrideProtocolGuid 114 extern EFI_GUID gEfiEbcProtocolGuid; 115 116 extern EFI_GUID gEfiGlobalVariableGuid; 117 #define EfiGlobalVariable gEfiGlobalVariableGuid 118 extern EFI_GUID gEfiFileInfoGuid; 119 #define GenericFileInfo gEfiFileInfoGuid 120 extern EFI_GUID gEfiFileSystemInfoGuid; 121 #define FileSystemInfo gEfiFileSystemInfoGuid 122 extern EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid; 123 #define FileSystemVolumeLabelInfo gEfiFileSystemVolumeLabelInfoIdGuid 124 extern EFI_GUID gEfiPcAnsiGuid; 125 #define PcAnsiProtocol gEfiPcAnsiGuid 126 extern EFI_GUID gEfiVT100Guid; 127 #define Vt100Protocol gEfiVT100Guid 128 extern EFI_GUID gEfiVT100PlusGuid; 129 extern EFI_GUID gEfiVTUTF8Guid; 130 131 extern EFI_GUID NullGuid; 132 extern EFI_GUID UnknownDevice; 133 134 extern EFI_GUID EfiPartTypeSystemPartitionGuid; 135 extern EFI_GUID EfiPartTypeLegacyMbrGuid; 136 137 extern EFI_GUID MpsTableGuid; 138 extern EFI_GUID AcpiTableGuid; 139 extern EFI_GUID SMBIOSTableGuid; 140 extern EFI_GUID SalSystemTableGuid; 141 142 extern EFI_GUID SimplePointerProtocol; 143 extern EFI_GUID AbsolutePointerProtocol; 144 145 extern EFI_GUID gEfiDebugImageInfoTableGuid; 146 extern EFI_GUID gEfiDebugSupportProtocolGuid; 147 148 // 149 // EFI Variable strings 150 // 151 #define LOAD_OPTION_ACTIVE 0x00000001 152 153 #define VarLanguageCodes L"LangCodes" 154 #define VarLanguage L"Lang" 155 #define VarTimeout L"Timeout" 156 #define VarConsoleInp L"ConIn" 157 #define VarConsoleOut L"ConOut" 158 #define VarErrorOut L"ErrOut" 159 #define VarBootOption L"Boot%04x" 160 #define VarBootOrder L"BootOrder" 161 #define VarBootNext L"BootNext" 162 #define VarBootCurrent L"BootCurrent" 163 #define VarDriverOption L"Driver%04x" 164 #define VarDriverOrder L"DriverOrder" 165 #define VarConsoleInpDev L"ConInDev" 166 #define VarConsoleOutDev L"ConOutDev" 167 #define VarErrorOutDev L"ErrOutDev" 168 169 #define LanguageCodeEnglish "eng" 170 171 extern EFI_DEVICE_PATH RootDevicePath[]; 172 extern EFI_DEVICE_PATH EndDevicePath[]; 173 extern EFI_DEVICE_PATH EndInstanceDevicePath[]; 174 175 // 176 // Other public data in the EFI library 177 // 178 179 extern EFI_MEMORY_TYPE PoolAllocationType; 180 181 // 182 // STATIC - Name is internal to the module 183 // INTERNAL - Name is internal to the component (i.e., directory) 184 // BOOTSERVCE - Name of a boot service function 185 // 186 187 #define STATIC 188 #define INTERNAL 189 #define BOOTSERVICE 190 191 // 192 // Prototypes 193 // 194 195 VOID 196 InitializeLib ( 197 IN EFI_HANDLE ImageHandle, 198 IN EFI_SYSTEM_TABLE *SystemTable 199 ); 200 201 VOID 202 InitializeUnicodeSupport ( 203 CHAR8 *LangCode 204 ); 205 206 VOID 207 EFIDebugVariable ( 208 VOID 209 ); 210 211 VOID 212 Exit( 213 IN EFI_STATUS ExitStatus, 214 IN UINTN ExitDataSize, 215 IN CHAR16 *ExitData OPTIONAL 216 ); 217 218 INTN 219 GetShellArgcArgv( 220 EFI_HANDLE ImageHandle, 221 CHAR16 **Argv[] /* Statically allocated */ 222 ); 223 224 VOID 225 SetCrc ( 226 IN OUT EFI_TABLE_HEADER *Hdr 227 ); 228 229 VOID 230 SetCrcAltSize ( 231 IN UINTN Size, 232 IN OUT EFI_TABLE_HEADER *Hdr 233 ); 234 235 BOOLEAN 236 CheckCrc ( 237 IN UINTN MaxSize, 238 IN OUT EFI_TABLE_HEADER *Hdr 239 ); 240 241 BOOLEAN 242 CheckCrcAltSize ( 243 IN UINTN MaxSize, 244 IN UINTN Size, 245 IN OUT EFI_TABLE_HEADER *Hdr 246 ); 247 248 UINT32 249 CalculateCrc ( 250 UINT8 *pt, 251 UINTN Size 252 ); 253 254 VOID 255 ZeroMem ( 256 IN VOID *Buffer, 257 IN UINTN Size 258 ); 259 260 VOID 261 SetMem ( 262 IN VOID *Buffer, 263 IN UINTN Size, 264 IN UINT8 Value 265 ); 266 267 VOID 268 CopyMem ( 269 IN VOID *Dest, 270 IN CONST VOID *Src, 271 IN UINTN len 272 ); 273 274 INTN 275 CompareMem ( 276 IN CONST VOID *Dest, 277 IN CONST VOID *Src, 278 IN UINTN len 279 ); 280 281 INTN 282 StrCmp ( 283 IN CONST CHAR16 *s1, 284 IN CONST CHAR16 *s2 285 ); 286 287 INTN 288 StrnCmp ( 289 IN CONST CHAR16 *s1, 290 IN CONST CHAR16 *s2, 291 IN UINTN len 292 ); 293 294 INTN 295 StriCmp ( 296 IN CONST CHAR16 *s1, 297 IN CONST CHAR16 *s2 298 ); 299 300 VOID 301 StrLwr ( 302 IN CHAR16 *Str 303 ); 304 305 VOID 306 StrUpr ( 307 IN CHAR16 *Str 308 ); 309 310 VOID 311 StrCpy ( 312 IN CHAR16 *Dest, 313 IN CONST CHAR16 *Src 314 ); 315 316 VOID 317 StrnCpy ( 318 IN CHAR16 *Dest, 319 IN CONST CHAR16 *Src, 320 IN UINTN Len 321 ); 322 323 CHAR16 * 324 StpCpy ( 325 IN CHAR16 *Dest, 326 IN CONST CHAR16 *Src 327 ); 328 329 CHAR16 * 330 StpnCpy ( 331 IN CHAR16 *Dest, 332 IN CONST CHAR16 *Src, 333 IN UINTN Len 334 ); 335 336 VOID 337 StrCat ( 338 IN CHAR16 *Dest, 339 IN CONST CHAR16 *Src 340 ); 341 342 VOID 343 StrnCat ( 344 IN CHAR16 *Dest, 345 IN CONST CHAR16 *Src, 346 IN UINTN Len 347 ); 348 349 UINTN 350 StrLen ( 351 IN CONST CHAR16 *s1 352 ); 353 354 UINTN 355 StrnLen ( 356 IN CONST CHAR16 *s1, 357 IN UINTN Len 358 ); 359 360 UINTN 361 StrSize ( 362 IN CONST CHAR16 *s1 363 ); 364 365 CHAR16 * 366 StrDuplicate ( 367 IN CONST CHAR16 *Src 368 ); 369 370 UINTN 371 strlena ( 372 IN CONST CHAR8 *s1 373 ); 374 375 UINTN 376 strcmpa ( 377 IN CONST CHAR8 *s1, 378 IN CONST CHAR8 *s2 379 ); 380 381 UINTN 382 strncmpa ( 383 IN CONST CHAR8 *s1, 384 IN CONST CHAR8 *s2, 385 IN UINTN len 386 ); 387 388 UINTN 389 xtoi ( 390 CONST CHAR16 *str 391 ); 392 393 UINTN 394 Atoi ( 395 CONST CHAR16 *str 396 ); 397 398 BOOLEAN 399 MetaMatch ( 400 IN CHAR16 *String, 401 IN CHAR16 *Pattern 402 ); 403 404 BOOLEAN 405 MetaiMatch ( 406 IN CHAR16 *String, 407 IN CHAR16 *Pattern 408 ); 409 410 UINT64 411 LShiftU64 ( 412 IN UINT64 Operand, 413 IN UINTN Count 414 ); 415 416 UINT64 417 RShiftU64 ( 418 IN UINT64 Operand, 419 IN UINTN Count 420 ); 421 422 UINT64 423 MultU64x32 ( 424 IN UINT64 Multiplicand, 425 IN UINTN Multiplier 426 ); 427 428 UINT64 429 DivU64x32 ( 430 IN UINT64 Dividend, 431 IN UINTN Divisor, 432 OUT UINTN *Remainder OPTIONAL 433 ); 434 435 VOID 436 InitializeLock ( 437 IN OUT FLOCK *Lock, 438 IN EFI_TPL Priority 439 ); 440 441 VOID 442 AcquireLock ( 443 IN FLOCK *Lock 444 ); 445 446 VOID 447 ReleaseLock ( 448 IN FLOCK *Lock 449 ); 450 451 452 INTN 453 CompareGuid( 454 IN EFI_GUID *Guid1, 455 IN EFI_GUID *Guid2 456 ); 457 458 VOID * 459 AllocatePool ( 460 IN UINTN Size 461 ); 462 463 VOID * 464 AllocateZeroPool ( 465 IN UINTN Size 466 ); 467 468 VOID * 469 ReallocatePool ( 470 IN VOID *OldPool, 471 IN UINTN OldSize, 472 IN UINTN NewSize 473 ); 474 475 VOID 476 FreePool ( 477 IN VOID *p 478 ); 479 480 481 VOID 482 Output ( 483 IN CHAR16 *Str 484 ); 485 486 VOID 487 Input ( 488 IN CHAR16 *Prompt OPTIONAL, 489 OUT CHAR16 *InStr, 490 IN UINTN StrLen 491 ); 492 493 VOID 494 IInput ( 495 IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut, 496 IN SIMPLE_INPUT_INTERFACE *ConIn, 497 IN CHAR16 *Prompt OPTIONAL, 498 OUT CHAR16 *InStr, 499 IN UINTN StrLen 500 ); 501 502 UINTN 503 Print ( 504 IN CONST CHAR16 *fmt, 505 ... 506 ); 507 508 UINTN 509 VPrint ( 510 IN CONST CHAR16 *fmt, 511 va_list args 512 ); 513 514 UINTN 515 SPrint ( 516 OUT CHAR16 *Str, 517 IN UINTN StrSize, 518 IN CONST CHAR16 *fmt, 519 ... 520 ); 521 522 UINTN 523 VSPrint ( 524 OUT CHAR16 *Str, 525 IN UINTN StrSize, 526 IN CONST CHAR16 *fmt, 527 va_list args 528 ); 529 530 CHAR16 * 531 VPoolPrint ( 532 IN CONST CHAR16 *fmt, 533 va_list args 534 ); 535 536 CHAR16 * 537 PoolPrint ( 538 IN CONST CHAR16 *fmt, 539 ... 540 ); 541 542 typedef struct { 543 CHAR16 *str; 544 UINTN len; 545 UINTN maxlen; 546 } POOL_PRINT; 547 548 CHAR16 * 549 CatPrint ( 550 IN OUT POOL_PRINT *Str, 551 IN CONST CHAR16 *fmt, 552 ... 553 ); 554 555 UINTN 556 PrintAt ( 557 IN UINTN Column, 558 IN UINTN Row, 559 IN CONST CHAR16 *fmt, 560 ... 561 ); 562 563 UINTN 564 IPrint ( 565 IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, 566 IN CONST CHAR16 *fmt, 567 ... 568 ); 569 570 UINTN 571 IPrintAt ( 572 IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, 573 IN UINTN Column, 574 IN UINTN Row, 575 IN CONST CHAR16 *fmt, 576 ... 577 ); 578 579 UINTN 580 APrint ( 581 IN CONST CHAR8 *fmt, 582 ... 583 ); 584 585 VOID 586 ValueToHex ( 587 IN CHAR16 *Buffer, 588 IN UINT64 v 589 ); 590 591 VOID 592 ValueToString ( 593 IN CHAR16 *Buffer, 594 IN BOOLEAN Comma, 595 IN INT64 v 596 ); 597 598 VOID 599 FloatToString ( 600 IN CHAR16 *Buffer, 601 IN BOOLEAN Comma, 602 IN double v 603 ); 604 605 VOID 606 TimeToString ( 607 OUT CHAR16 *Buffer, 608 IN EFI_TIME *Time 609 ); 610 611 VOID 612 GuidToString ( 613 OUT CHAR16 *Buffer, 614 IN EFI_GUID *Guid 615 ); 616 617 VOID 618 StatusToString ( 619 OUT CHAR16 *Buffer, 620 EFI_STATUS Status 621 ); 622 623 VOID 624 DumpHex ( 625 IN UINTN Indent, 626 IN UINTN Offset, 627 IN UINTN DataSize, 628 IN VOID *UserData 629 ); 630 631 BOOLEAN 632 GrowBuffer( 633 IN OUT EFI_STATUS *Status, 634 IN OUT VOID **Buffer, 635 IN UINTN BufferSize 636 ); 637 638 EFI_MEMORY_DESCRIPTOR * 639 LibMemoryMap ( 640 OUT UINTN *NoEntries, 641 OUT UINTN *MapKey, 642 OUT UINTN *DescriptorSize, 643 OUT UINT32 *DescriptorVersion 644 ); 645 646 VOID * 647 LibGetVariable ( 648 IN CHAR16 *Name, 649 IN EFI_GUID *VendorGuid 650 ); 651 652 VOID * 653 LibGetVariableAndSize ( 654 IN CHAR16 *Name, 655 IN EFI_GUID *VendorGuid, 656 OUT UINTN *VarSize 657 ); 658 659 EFI_STATUS 660 LibDeleteVariable ( 661 IN CHAR16 *VarName, 662 IN EFI_GUID *VarGuid 663 ); 664 665 EFI_STATUS 666 LibSetNVVariable ( 667 IN CHAR16 *VarName, 668 IN EFI_GUID *VarGuid, 669 IN UINTN DataSize, 670 IN VOID *Data 671 ); 672 673 EFI_STATUS 674 LibSetVariable ( 675 IN CHAR16 *VarName, 676 IN EFI_GUID *VarGuid, 677 IN UINTN DataSize, 678 IN VOID *Data 679 ); 680 EFI_STATUS 681 LibInsertToTailOfBootOrder ( 682 IN UINT16 BootOption, 683 IN BOOLEAN OnlyInsertIfEmpty 684 ); 685 686 EFI_STATUS 687 LibLocateProtocol ( 688 IN EFI_GUID *ProtocolGuid, 689 OUT VOID **Interface 690 ); 691 692 EFI_STATUS 693 LibLocateHandle ( 694 IN EFI_LOCATE_SEARCH_TYPE SearchType, 695 IN EFI_GUID *Protocol OPTIONAL, 696 IN VOID *SearchKey OPTIONAL, 697 IN OUT UINTN *NoHandles, 698 OUT EFI_HANDLE **Buffer 699 ); 700 701 EFI_STATUS 702 LibLocateHandleByDiskSignature ( 703 IN UINT8 MBRType, 704 IN UINT8 SignatureType, 705 IN VOID *Signature, 706 IN OUT UINTN *NoHandles, 707 OUT EFI_HANDLE **Buffer 708 ); 709 710 EFI_STATUS 711 LibInstallProtocolInterfaces ( 712 IN OUT EFI_HANDLE *Handle, 713 ... 714 ); 715 716 VOID 717 LibUninstallProtocolInterfaces ( 718 IN EFI_HANDLE Handle, 719 ... 720 ); 721 722 EFI_STATUS 723 LibReinstallProtocolInterfaces ( 724 IN OUT EFI_HANDLE *Handle, 725 ... 726 ); 727 728 EFI_EVENT 729 LibCreateProtocolNotifyEvent ( 730 IN EFI_GUID *ProtocolGuid, 731 IN EFI_TPL NotifyTpl, 732 IN EFI_EVENT_NOTIFY NotifyFunction, 733 IN VOID *NotifyContext, 734 OUT VOID *Registration 735 ); 736 737 EFI_STATUS 738 WaitForSingleEvent ( 739 IN EFI_EVENT Event, 740 IN UINT64 Timeout OPTIONAL 741 ); 742 743 VOID 744 WaitForEventWithTimeout ( 745 IN EFI_EVENT Event, 746 IN UINTN Timeout, 747 IN UINTN Row, 748 IN UINTN Column, 749 IN CHAR16 *String, 750 IN EFI_INPUT_KEY TimeoutKey, 751 OUT EFI_INPUT_KEY *Key 752 ); 753 754 EFI_FILE_HANDLE 755 LibOpenRoot ( 756 IN EFI_HANDLE DeviceHandle 757 ); 758 759 EFI_FILE_INFO * 760 LibFileInfo ( 761 IN EFI_FILE_HANDLE FHand 762 ); 763 764 EFI_FILE_SYSTEM_INFO * 765 LibFileSystemInfo ( 766 IN EFI_FILE_HANDLE FHand 767 ); 768 769 EFI_FILE_SYSTEM_VOLUME_LABEL_INFO * 770 LibFileSystemVolumeLabelInfo ( 771 IN EFI_FILE_HANDLE FHand 772 ); 773 774 BOOLEAN 775 ValidMBR( 776 IN MASTER_BOOT_RECORD *Mbr, 777 IN EFI_BLOCK_IO *BlkIo 778 ); 779 780 BOOLEAN 781 LibMatchDevicePaths ( 782 IN EFI_DEVICE_PATH *Multi, 783 IN EFI_DEVICE_PATH *Single 784 ); 785 786 EFI_DEVICE_PATH * 787 LibDuplicateDevicePathInstance ( 788 IN EFI_DEVICE_PATH *DevPath 789 ); 790 791 EFI_DEVICE_PATH * 792 DevicePathFromHandle ( 793 IN EFI_HANDLE Handle 794 ); 795 796 EFI_DEVICE_PATH * 797 DevicePathInstance ( 798 IN OUT EFI_DEVICE_PATH **DevicePath, 799 OUT UINTN *Size 800 ); 801 802 UINTN 803 DevicePathInstanceCount ( 804 IN EFI_DEVICE_PATH *DevicePath 805 ); 806 807 EFI_DEVICE_PATH * 808 AppendDevicePath ( 809 IN EFI_DEVICE_PATH *Src1, 810 IN EFI_DEVICE_PATH *Src2 811 ); 812 813 EFI_DEVICE_PATH * 814 AppendDevicePathNode ( 815 IN EFI_DEVICE_PATH *Src1, 816 IN EFI_DEVICE_PATH *Src2 817 ); 818 819 EFI_DEVICE_PATH* 820 AppendDevicePathInstance ( 821 IN EFI_DEVICE_PATH *Src, 822 IN EFI_DEVICE_PATH *Instance 823 ); 824 825 EFI_DEVICE_PATH * 826 FileDevicePath ( 827 IN EFI_HANDLE Device OPTIONAL, 828 IN CHAR16 *FileName 829 ); 830 831 UINTN 832 DevicePathSize ( 833 IN EFI_DEVICE_PATH *DevPath 834 ); 835 836 EFI_DEVICE_PATH * 837 DuplicateDevicePath ( 838 IN EFI_DEVICE_PATH *DevPath 839 ); 840 841 EFI_DEVICE_PATH * 842 UnpackDevicePath ( 843 IN EFI_DEVICE_PATH *DevPath 844 ); 845 846 EFI_STATUS 847 LibDevicePathToInterface ( 848 IN EFI_GUID *Protocol, 849 IN EFI_DEVICE_PATH *FilePath, 850 OUT VOID **Interface 851 ); 852 853 CHAR16 * 854 DevicePathToStr ( 855 EFI_DEVICE_PATH *DevPath 856 ); 857 858 // 859 // BugBug: I need my own include files 860 // 861 typedef struct { 862 UINT8 Register; 863 UINT8 Function; 864 UINT8 Device; 865 UINT8 Bus; 866 UINT32 Reserved; 867 } EFI_ADDRESS; 868 869 typedef union { 870 UINT64 Address; 871 EFI_ADDRESS EfiAddress; 872 } EFI_PCI_ADDRESS_UNION; 873 874 875 EFI_STATUS 876 PciFindDeviceClass ( 877 IN OUT EFI_PCI_ADDRESS_UNION *Address, 878 IN UINT8 BaseClass, 879 IN UINT8 SubClass 880 ); 881 882 EFI_STATUS 883 PciFindDevice ( 884 IN OUT EFI_PCI_ADDRESS_UNION *DeviceAddress, 885 IN UINT16 VendorId, 886 IN UINT16 DeviceId, 887 IN OUT PCI_TYPE00 *Pci 888 ); 889 890 // 891 // SIMPLE_READ_FILE object used to access files 892 // 893 894 typedef VOID *SIMPLE_READ_FILE; 895 896 EFI_STATUS 897 OpenSimpleReadFile ( 898 IN BOOLEAN BootPolicy, 899 IN VOID *SourceBuffer OPTIONAL, 900 IN UINTN SourceSize, 901 IN OUT EFI_DEVICE_PATH **FilePath, 902 OUT EFI_HANDLE *DeviceHandle, 903 OUT SIMPLE_READ_FILE *SimpleReadHandle 904 ); 905 906 EFI_STATUS 907 ReadSimpleReadFile ( 908 IN SIMPLE_READ_FILE SimpleReadHandle, 909 IN UINTN Offset, 910 IN OUT UINTN *ReadSize, 911 OUT VOID *Buffer 912 ); 913 914 915 VOID 916 CloseSimpleReadFile ( 917 IN SIMPLE_READ_FILE SimpleReadHandle 918 ); 919 920 VOID 921 InitializeGuid ( 922 VOID 923 ); 924 925 UINT8 926 DecimaltoBCD( 927 IN UINT8 DecValue 928 ); 929 930 UINT8 931 BCDtoDecimal( 932 IN UINT8 BcdValue 933 ); 934 935 EFI_STATUS 936 LibGetSystemConfigurationTable( 937 IN EFI_GUID *TableGuid, 938 IN OUT VOID **Table 939 ); 940 941 BOOLEAN 942 LibIsValidTextGraphics ( 943 IN CHAR16 Graphic, 944 OUT CHAR8 *PcAnsi, OPTIONAL 945 OUT CHAR8 *Ascii OPTIONAL 946 ); 947 948 BOOLEAN 949 IsValidAscii ( 950 IN CHAR16 Ascii 951 ); 952 953 BOOLEAN 954 IsValidEfiCntlChar ( 955 IN CHAR16 c 956 ); 957 958 CHAR16 * 959 LibGetUiString ( 960 IN EFI_HANDLE Handle, 961 IN UI_STRING_TYPE StringType, 962 IN ISO_639_2 *LangCode, 963 IN BOOLEAN ReturnDevicePathStrOnMismatch 964 ); 965 966 CHAR8* 967 LibGetSmbiosString ( 968 IN SMBIOS_STRUCTURE_POINTER *Smbios, 969 IN UINT16 StringNumber 970 ); 971 972 EFI_STATUS 973 LibGetSmbiosSystemGuidAndSerialNumber ( 974 IN EFI_GUID *SystemGuid, 975 OUT CHAR8 **SystemSerialNumber 976 ); 977 978 979 EFI_STATUS 980 InitializeGlobalIoDevice ( 981 IN EFI_DEVICE_PATH *DevicePath, 982 IN EFI_GUID *Protocol, 983 IN CHAR8 *ErrorStr, 984 OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs 985 ); 986 987 UINT32 988 ReadPort ( 989 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 990 IN EFI_IO_WIDTH Width, 991 IN UINTN Port 992 ); 993 994 UINT32 995 WritePort ( 996 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 997 IN EFI_IO_WIDTH Width, 998 IN UINTN Port, 999 IN UINTN Data 1000 ); 1001 1002 UINT32 1003 ReadPciConfig ( 1004 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 1005 IN EFI_IO_WIDTH Width, 1006 IN UINTN Port 1007 ); 1008 1009 UINT32 1010 WritePciConfig ( 1011 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 1012 IN EFI_IO_WIDTH Width, 1013 IN UINTN Port, 1014 IN UINTN Data 1015 ); 1016 1017 extern EFI_DEVICE_IO_INTERFACE *GlobalIoFncs; 1018 1019 #define outp(_Port, _DataByte) (UINT8)WritePort(GlobalIoFncs, IO_UINT8, (UINTN)_Port, (UINTN)_DataByte) 1020 #define inp(_Port) (UINT8)ReadPort(GlobalIoFncs, IO_UINT8, (UINTN)_Port) 1021 #define outpw(_Port, _DataByte) (UINT16)WritePort(GlobalIoFncs, IO_UINT16, (UINTN)_Port, (UINTN)_DataByte) 1022 #define inpw(_Port) (UINT16)ReadPort(GlobalIoFncs, IO_UINT16, (UINTN)_Port) 1023 #define outpd(_Port, _DataByte) (UINT32)WritePort(GlobalIoFncs, IO_UINT32, (UINTN)_Port, (UINTN)_DataByte) 1024 #define inpd(_Port) (UINT32)ReadPort(GlobalIoFncs, IO_UINT32, (UINTN)_Port) 1025 1026 #define writepci8(_Addr, _DataByte) (UINT8)WritePciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr, (UINTN)_DataByte) 1027 #define readpci8(_Addr) (UINT8)ReadPciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr) 1028 #define writepci16(_Addr, _DataByte) (UINT16)WritePciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr, (UINTN)_DataByte) 1029 #define readpci16(_Addr) (UINT16)ReadPciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr) 1030 #define writepci32(_Addr, _DataByte) (UINT32)WritePciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr, (UINTN)_DataByte) 1031 #define readpci32(_Addr) (UINT32)ReadPciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr) 1032 1033 #define Pause() WaitForSingleEvent (ST->ConIn->WaitForKey, 0) 1034 #define Port80(_PostCode) GlobalIoFncs->Io.Write (GlobalIoFncs, IO_UINT16, (UINT64)0x80, 1, &(_PostCode)) 1035 1036 #endif 1037