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 // 146 // EFI Variable strings 147 // 148 #define LOAD_OPTION_ACTIVE 0x00000001 149 150 #define VarLanguageCodes L"LangCodes" 151 #define VarLanguage L"Lang" 152 #define VarTimeout L"Timeout" 153 #define VarConsoleInp L"ConIn" 154 #define VarConsoleOut L"ConOut" 155 #define VarErrorOut L"ErrOut" 156 #define VarBootOption L"Boot%04x" 157 #define VarBootOrder L"BootOrder" 158 #define VarBootNext L"BootNext" 159 #define VarBootCurrent L"BootCurrent" 160 #define VarDriverOption L"Driver%04x" 161 #define VarDriverOrder L"DriverOrder" 162 #define VarConsoleInpDev L"ConInDev" 163 #define VarConsoleOutDev L"ConOutDev" 164 #define VarErrorOutDev L"ErrOutDev" 165 166 #define LanguageCodeEnglish "eng" 167 168 extern EFI_DEVICE_PATH RootDevicePath[]; 169 extern EFI_DEVICE_PATH EndDevicePath[]; 170 extern EFI_DEVICE_PATH EndInstanceDevicePath[]; 171 172 // 173 // Other public data in the EFI library 174 // 175 176 extern EFI_MEMORY_TYPE PoolAllocationType; 177 178 // 179 // STATIC - Name is internal to the module 180 // INTERNAL - Name is internal to the component (i.e., directory) 181 // BOOTSERVCE - Name of a boot service function 182 // 183 184 #define STATIC 185 #define INTERNAL 186 #define BOOTSERVICE 187 188 // 189 // Prototypes 190 // 191 192 VOID 193 InitializeLib ( 194 IN EFI_HANDLE ImageHandle, 195 IN EFI_SYSTEM_TABLE *SystemTable 196 ); 197 198 VOID 199 InitializeUnicodeSupport ( 200 CHAR8 *LangCode 201 ); 202 203 VOID 204 EFIDebugVariable ( 205 VOID 206 ); 207 208 INTN 209 GetShellArgcArgv( 210 EFI_HANDLE ImageHandle, 211 CHAR16 **Argv[] /* Statically allocated */ 212 ); 213 214 VOID 215 SetCrc ( 216 IN OUT EFI_TABLE_HEADER *Hdr 217 ); 218 219 VOID 220 SetCrcAltSize ( 221 IN UINTN Size, 222 IN OUT EFI_TABLE_HEADER *Hdr 223 ); 224 225 BOOLEAN 226 CheckCrc ( 227 IN UINTN MaxSize, 228 IN OUT EFI_TABLE_HEADER *Hdr 229 ); 230 231 BOOLEAN 232 CheckCrcAltSize ( 233 IN UINTN MaxSize, 234 IN UINTN Size, 235 IN OUT EFI_TABLE_HEADER *Hdr 236 ); 237 238 UINT32 239 CalculateCrc ( 240 UINT8 *pt, 241 UINTN Size 242 ); 243 244 VOID 245 ZeroMem ( 246 IN VOID *Buffer, 247 IN UINTN Size 248 ); 249 250 VOID 251 SetMem ( 252 IN VOID *Buffer, 253 IN UINTN Size, 254 IN UINT8 Value 255 ); 256 257 VOID 258 CopyMem ( 259 IN VOID *Dest, 260 IN CONST VOID *Src, 261 IN UINTN len 262 ); 263 264 INTN 265 CompareMem ( 266 IN CONST VOID *Dest, 267 IN CONST VOID *Src, 268 IN UINTN len 269 ); 270 271 INTN 272 StrCmp ( 273 IN CONST CHAR16 *s1, 274 IN CONST CHAR16 *s2 275 ); 276 277 INTN 278 StrnCmp ( 279 IN CONST CHAR16 *s1, 280 IN CONST CHAR16 *s2, 281 IN UINTN len 282 ); 283 284 INTN 285 StriCmp ( 286 IN CONST CHAR16 *s1, 287 IN CONST CHAR16 *s2 288 ); 289 290 VOID 291 StrLwr ( 292 IN CHAR16 *Str 293 ); 294 295 VOID 296 StrUpr ( 297 IN CHAR16 *Str 298 ); 299 300 VOID 301 StrCpy ( 302 IN CHAR16 *Dest, 303 IN CONST CHAR16 *Src 304 ); 305 306 VOID 307 StrCat ( 308 IN CHAR16 *Dest, 309 IN CONST CHAR16 *Src 310 ); 311 312 UINTN 313 StrLen ( 314 IN CONST CHAR16 *s1 315 ); 316 317 UINTN 318 StrSize ( 319 IN CONST CHAR16 *s1 320 ); 321 322 CHAR16 * 323 StrDuplicate ( 324 IN CONST CHAR16 *Src 325 ); 326 327 UINTN 328 strlena ( 329 IN CONST CHAR8 *s1 330 ); 331 332 UINTN 333 strcmpa ( 334 IN CONST CHAR8 *s1, 335 IN CONST CHAR8 *s2 336 ); 337 338 UINTN 339 strncmpa ( 340 IN CONST CHAR8 *s1, 341 IN CONST CHAR8 *s2, 342 IN UINTN len 343 ); 344 345 UINTN 346 xtoi ( 347 CONST CHAR16 *str 348 ); 349 350 UINTN 351 Atoi ( 352 CONST CHAR16 *str 353 ); 354 355 BOOLEAN 356 MetaMatch ( 357 IN CHAR16 *String, 358 IN CHAR16 *Pattern 359 ); 360 361 BOOLEAN 362 MetaiMatch ( 363 IN CHAR16 *String, 364 IN CHAR16 *Pattern 365 ); 366 367 UINT64 368 LShiftU64 ( 369 IN UINT64 Operand, 370 IN UINTN Count 371 ); 372 373 UINT64 374 RShiftU64 ( 375 IN UINT64 Operand, 376 IN UINTN Count 377 ); 378 379 UINT64 380 MultU64x32 ( 381 IN UINT64 Multiplicand, 382 IN UINTN Multiplier 383 ); 384 385 UINT64 386 DivU64x32 ( 387 IN UINT64 Dividend, 388 IN UINTN Divisor, 389 OUT UINTN *Remainder OPTIONAL 390 ); 391 392 VOID 393 InitializeLock ( 394 IN OUT FLOCK *Lock, 395 IN EFI_TPL Priority 396 ); 397 398 VOID 399 AcquireLock ( 400 IN FLOCK *Lock 401 ); 402 403 VOID 404 ReleaseLock ( 405 IN FLOCK *Lock 406 ); 407 408 409 INTN 410 CompareGuid( 411 IN EFI_GUID *Guid1, 412 IN EFI_GUID *Guid2 413 ); 414 415 VOID * 416 AllocatePool ( 417 IN UINTN Size 418 ); 419 420 VOID * 421 AllocateZeroPool ( 422 IN UINTN Size 423 ); 424 425 VOID * 426 ReallocatePool ( 427 IN VOID *OldPool, 428 IN UINTN OldSize, 429 IN UINTN NewSize 430 ); 431 432 VOID 433 FreePool ( 434 IN VOID *p 435 ); 436 437 438 VOID 439 Output ( 440 IN CHAR16 *Str 441 ); 442 443 VOID 444 Input ( 445 IN CHAR16 *Prompt OPTIONAL, 446 OUT CHAR16 *InStr, 447 IN UINTN StrLen 448 ); 449 450 VOID 451 IInput ( 452 IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut, 453 IN SIMPLE_INPUT_INTERFACE *ConIn, 454 IN CHAR16 *Prompt OPTIONAL, 455 OUT CHAR16 *InStr, 456 IN UINTN StrLen 457 ); 458 459 UINTN 460 Print ( 461 IN CHAR16 *fmt, 462 ... 463 ); 464 465 UINTN 466 VPrint ( 467 IN CHAR16 *fmt, 468 va_list args 469 ); 470 471 UINTN 472 SPrint ( 473 OUT CHAR16 *Str, 474 IN UINTN StrSize, 475 IN CHAR16 *fmt, 476 ... 477 ); 478 479 UINTN 480 VSPrint ( 481 OUT CHAR16 *Str, 482 IN UINTN StrSize, 483 IN CHAR16 *fmt, 484 va_list args 485 ); 486 487 CHAR16 * 488 VPoolPrint ( 489 IN CHAR16 *fmt, 490 va_list args 491 ); 492 493 CHAR16 * 494 PoolPrint ( 495 IN CHAR16 *fmt, 496 ... 497 ); 498 499 typedef struct { 500 CHAR16 *str; 501 UINTN len; 502 UINTN maxlen; 503 } POOL_PRINT; 504 505 CHAR16 * 506 CatPrint ( 507 IN OUT POOL_PRINT *Str, 508 IN CHAR16 *fmt, 509 ... 510 ); 511 512 UINTN 513 PrintAt ( 514 IN UINTN Column, 515 IN UINTN Row, 516 IN CHAR16 *fmt, 517 ... 518 ); 519 520 UINTN 521 IPrint ( 522 IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, 523 IN CHAR16 *fmt, 524 ... 525 ); 526 527 UINTN 528 IPrintAt ( 529 IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, 530 IN UINTN Column, 531 IN UINTN Row, 532 IN CHAR16 *fmt, 533 ... 534 ); 535 536 UINTN 537 APrint ( 538 IN CHAR8 *fmt, 539 ... 540 ); 541 542 VOID 543 ValueToHex ( 544 IN CHAR16 *Buffer, 545 IN UINT64 v 546 ); 547 548 VOID 549 ValueToString ( 550 IN CHAR16 *Buffer, 551 IN BOOLEAN Comma, 552 IN INT64 v 553 ); 554 555 VOID 556 FloatToString ( 557 IN CHAR16 *Buffer, 558 IN BOOLEAN Comma, 559 IN double v 560 ); 561 562 VOID 563 TimeToString ( 564 OUT CHAR16 *Buffer, 565 IN EFI_TIME *Time 566 ); 567 568 VOID 569 GuidToString ( 570 OUT CHAR16 *Buffer, 571 IN EFI_GUID *Guid 572 ); 573 574 VOID 575 StatusToString ( 576 OUT CHAR16 *Buffer, 577 EFI_STATUS Status 578 ); 579 580 VOID 581 DumpHex ( 582 IN UINTN Indent, 583 IN UINTN Offset, 584 IN UINTN DataSize, 585 IN VOID *UserData 586 ); 587 588 BOOLEAN 589 GrowBuffer( 590 IN OUT EFI_STATUS *Status, 591 IN OUT VOID **Buffer, 592 IN UINTN BufferSize 593 ); 594 595 EFI_MEMORY_DESCRIPTOR * 596 LibMemoryMap ( 597 OUT UINTN *NoEntries, 598 OUT UINTN *MapKey, 599 OUT UINTN *DescriptorSize, 600 OUT UINT32 *DescriptorVersion 601 ); 602 603 VOID * 604 LibGetVariable ( 605 IN CHAR16 *Name, 606 IN EFI_GUID *VendorGuid 607 ); 608 609 VOID * 610 LibGetVariableAndSize ( 611 IN CHAR16 *Name, 612 IN EFI_GUID *VendorGuid, 613 OUT UINTN *VarSize 614 ); 615 616 EFI_STATUS 617 LibDeleteVariable ( 618 IN CHAR16 *VarName, 619 IN EFI_GUID *VarGuid 620 ); 621 622 EFI_STATUS 623 LibSetNVVariable ( 624 IN CHAR16 *VarName, 625 IN EFI_GUID *VarGuid, 626 IN UINTN DataSize, 627 IN VOID *Data 628 ); 629 630 EFI_STATUS 631 LibSetVariable ( 632 IN CHAR16 *VarName, 633 IN EFI_GUID *VarGuid, 634 IN UINTN DataSize, 635 IN VOID *Data 636 ); 637 EFI_STATUS 638 LibInsertToTailOfBootOrder ( 639 IN UINT16 BootOption, 640 IN BOOLEAN OnlyInsertIfEmpty 641 ); 642 643 EFI_STATUS 644 LibLocateProtocol ( 645 IN EFI_GUID *ProtocolGuid, 646 OUT VOID **Interface 647 ); 648 649 EFI_STATUS 650 LibLocateHandle ( 651 IN EFI_LOCATE_SEARCH_TYPE SearchType, 652 IN EFI_GUID *Protocol OPTIONAL, 653 IN VOID *SearchKey OPTIONAL, 654 IN OUT UINTN *NoHandles, 655 OUT EFI_HANDLE **Buffer 656 ); 657 658 EFI_STATUS 659 LibLocateHandleByDiskSignature ( 660 IN UINT8 MBRType, 661 IN UINT8 SignatureType, 662 IN VOID *Signature, 663 IN OUT UINTN *NoHandles, 664 OUT EFI_HANDLE **Buffer 665 ); 666 667 EFI_STATUS 668 LibInstallProtocolInterfaces ( 669 IN OUT EFI_HANDLE *Handle, 670 ... 671 ); 672 673 VOID 674 LibUninstallProtocolInterfaces ( 675 IN EFI_HANDLE Handle, 676 ... 677 ); 678 679 EFI_STATUS 680 LibReinstallProtocolInterfaces ( 681 IN OUT EFI_HANDLE *Handle, 682 ... 683 ); 684 685 EFI_EVENT 686 LibCreateProtocolNotifyEvent ( 687 IN EFI_GUID *ProtocolGuid, 688 IN EFI_TPL NotifyTpl, 689 IN EFI_EVENT_NOTIFY NotifyFunction, 690 IN VOID *NotifyContext, 691 OUT VOID *Registration 692 ); 693 694 EFI_STATUS 695 WaitForSingleEvent ( 696 IN EFI_EVENT Event, 697 IN UINT64 Timeout OPTIONAL 698 ); 699 700 VOID 701 WaitForEventWithTimeout ( 702 IN EFI_EVENT Event, 703 IN UINTN Timeout, 704 IN UINTN Row, 705 IN UINTN Column, 706 IN CHAR16 *String, 707 IN EFI_INPUT_KEY TimeoutKey, 708 OUT EFI_INPUT_KEY *Key 709 ); 710 711 EFI_FILE_HANDLE 712 LibOpenRoot ( 713 IN EFI_HANDLE DeviceHandle 714 ); 715 716 EFI_FILE_INFO * 717 LibFileInfo ( 718 IN EFI_FILE_HANDLE FHand 719 ); 720 721 EFI_FILE_SYSTEM_INFO * 722 LibFileSystemInfo ( 723 IN EFI_FILE_HANDLE FHand 724 ); 725 726 EFI_FILE_SYSTEM_VOLUME_LABEL_INFO * 727 LibFileSystemVolumeLabelInfo ( 728 IN EFI_FILE_HANDLE FHand 729 ); 730 731 BOOLEAN 732 ValidMBR( 733 IN MASTER_BOOT_RECORD *Mbr, 734 IN EFI_BLOCK_IO *BlkIo 735 ); 736 737 BOOLEAN 738 LibMatchDevicePaths ( 739 IN EFI_DEVICE_PATH *Multi, 740 IN EFI_DEVICE_PATH *Single 741 ); 742 743 EFI_DEVICE_PATH * 744 LibDuplicateDevicePathInstance ( 745 IN EFI_DEVICE_PATH *DevPath 746 ); 747 748 EFI_DEVICE_PATH * 749 DevicePathFromHandle ( 750 IN EFI_HANDLE Handle 751 ); 752 753 EFI_DEVICE_PATH * 754 DevicePathInstance ( 755 IN OUT EFI_DEVICE_PATH **DevicePath, 756 OUT UINTN *Size 757 ); 758 759 UINTN 760 DevicePathInstanceCount ( 761 IN EFI_DEVICE_PATH *DevicePath 762 ); 763 764 EFI_DEVICE_PATH * 765 AppendDevicePath ( 766 IN EFI_DEVICE_PATH *Src1, 767 IN EFI_DEVICE_PATH *Src2 768 ); 769 770 EFI_DEVICE_PATH * 771 AppendDevicePathNode ( 772 IN EFI_DEVICE_PATH *Src1, 773 IN EFI_DEVICE_PATH *Src2 774 ); 775 776 EFI_DEVICE_PATH* 777 AppendDevicePathInstance ( 778 IN EFI_DEVICE_PATH *Src, 779 IN EFI_DEVICE_PATH *Instance 780 ); 781 782 EFI_DEVICE_PATH * 783 FileDevicePath ( 784 IN EFI_HANDLE Device OPTIONAL, 785 IN CHAR16 *FileName 786 ); 787 788 UINTN 789 DevicePathSize ( 790 IN EFI_DEVICE_PATH *DevPath 791 ); 792 793 EFI_DEVICE_PATH * 794 DuplicateDevicePath ( 795 IN EFI_DEVICE_PATH *DevPath 796 ); 797 798 EFI_DEVICE_PATH * 799 UnpackDevicePath ( 800 IN EFI_DEVICE_PATH *DevPath 801 ); 802 803 EFI_STATUS 804 LibDevicePathToInterface ( 805 IN EFI_GUID *Protocol, 806 IN EFI_DEVICE_PATH *FilePath, 807 OUT VOID **Interface 808 ); 809 810 CHAR16 * 811 DevicePathToStr ( 812 EFI_DEVICE_PATH *DevPath 813 ); 814 815 // 816 // BugBug: I need my own include files 817 // 818 typedef struct { 819 UINT8 Register; 820 UINT8 Function; 821 UINT8 Device; 822 UINT8 Bus; 823 UINT32 Reserved; 824 } EFI_ADDRESS; 825 826 typedef union { 827 UINT64 Address; 828 EFI_ADDRESS EfiAddress; 829 } EFI_PCI_ADDRESS_UNION; 830 831 832 EFI_STATUS 833 PciFindDeviceClass ( 834 IN OUT EFI_PCI_ADDRESS_UNION *Address, 835 IN UINT8 BaseClass, 836 IN UINT8 SubClass 837 ); 838 839 EFI_STATUS 840 PciFindDevice ( 841 IN OUT EFI_PCI_ADDRESS_UNION *DeviceAddress, 842 IN UINT16 VendorId, 843 IN UINT16 DeviceId, 844 IN OUT PCI_TYPE00 *Pci 845 ); 846 847 // 848 // SIMPLE_READ_FILE object used to access files 849 // 850 851 typedef VOID *SIMPLE_READ_FILE; 852 853 EFI_STATUS 854 OpenSimpleReadFile ( 855 IN BOOLEAN BootPolicy, 856 IN VOID *SourceBuffer OPTIONAL, 857 IN UINTN SourceSize, 858 IN OUT EFI_DEVICE_PATH **FilePath, 859 OUT EFI_HANDLE *DeviceHandle, 860 OUT SIMPLE_READ_FILE *SimpleReadHandle 861 ); 862 863 EFI_STATUS 864 ReadSimpleReadFile ( 865 IN SIMPLE_READ_FILE SimpleReadHandle, 866 IN UINTN Offset, 867 IN OUT UINTN *ReadSize, 868 OUT VOID *Buffer 869 ); 870 871 872 VOID 873 CloseSimpleReadFile ( 874 IN SIMPLE_READ_FILE SimpleReadHandle 875 ); 876 877 VOID 878 InitializeGuid ( 879 VOID 880 ); 881 882 UINT8 883 DecimaltoBCD( 884 IN UINT8 DecValue 885 ); 886 887 UINT8 888 BCDtoDecimal( 889 IN UINT8 BcdValue 890 ); 891 892 EFI_STATUS 893 LibGetSystemConfigurationTable( 894 IN EFI_GUID *TableGuid, 895 IN OUT VOID **Table 896 ); 897 898 BOOLEAN 899 LibIsValidTextGraphics ( 900 IN CHAR16 Graphic, 901 OUT CHAR8 *PcAnsi, OPTIONAL 902 OUT CHAR8 *Ascii OPTIONAL 903 ); 904 905 BOOLEAN 906 IsValidAscii ( 907 IN CHAR16 Ascii 908 ); 909 910 BOOLEAN 911 IsValidEfiCntlChar ( 912 IN CHAR16 c 913 ); 914 915 CHAR16 * 916 LibGetUiString ( 917 IN EFI_HANDLE Handle, 918 IN UI_STRING_TYPE StringType, 919 IN ISO_639_2 *LangCode, 920 IN BOOLEAN ReturnDevicePathStrOnMismatch 921 ); 922 923 CHAR8* 924 LibGetSmbiosString ( 925 IN SMBIOS_STRUCTURE_POINTER *Smbios, 926 IN UINT16 StringNumber 927 ); 928 929 EFI_STATUS 930 LibGetSmbiosSystemGuidAndSerialNumber ( 931 IN EFI_GUID *SystemGuid, 932 OUT CHAR8 **SystemSerialNumber 933 ); 934 935 936 EFI_STATUS 937 InitializeGlobalIoDevice ( 938 IN EFI_DEVICE_PATH *DevicePath, 939 IN EFI_GUID *Protocol, 940 IN CHAR8 *ErrorStr, 941 OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs 942 ); 943 944 UINT32 945 ReadPort ( 946 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 947 IN EFI_IO_WIDTH Width, 948 IN UINTN Port 949 ); 950 951 UINT32 952 WritePort ( 953 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 954 IN EFI_IO_WIDTH Width, 955 IN UINTN Port, 956 IN UINTN Data 957 ); 958 959 UINT32 960 ReadPciConfig ( 961 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 962 IN EFI_IO_WIDTH Width, 963 IN UINTN Port 964 ); 965 966 UINT32 967 WritePciConfig ( 968 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 969 IN EFI_IO_WIDTH Width, 970 IN UINTN Port, 971 IN UINTN Data 972 ); 973 974 extern EFI_DEVICE_IO_INTERFACE *GlobalIoFncs; 975 976 #define outp(_Port, _DataByte) (UINT8)WritePort(GlobalIoFncs, IO_UINT8, (UINTN)_Port, (UINTN)_DataByte) 977 #define inp(_Port) (UINT8)ReadPort(GlobalIoFncs, IO_UINT8, (UINTN)_Port) 978 #define outpw(_Port, _DataByte) (UINT16)WritePort(GlobalIoFncs, IO_UINT16, (UINTN)_Port, (UINTN)_DataByte) 979 #define inpw(_Port) (UINT16)ReadPort(GlobalIoFncs, IO_UINT16, (UINTN)_Port) 980 #define outpd(_Port, _DataByte) (UINT32)WritePort(GlobalIoFncs, IO_UINT32, (UINTN)_Port, (UINTN)_DataByte) 981 #define inpd(_Port) (UINT32)ReadPort(GlobalIoFncs, IO_UINT32, (UINTN)_Port) 982 983 #define writepci8(_Addr, _DataByte) (UINT8)WritePciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr, (UINTN)_DataByte) 984 #define readpci8(_Addr) (UINT8)ReadPciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr) 985 #define writepci16(_Addr, _DataByte) (UINT16)WritePciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr, (UINTN)_DataByte) 986 #define readpci16(_Addr) (UINT16)ReadPciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr) 987 #define writepci32(_Addr, _DataByte) (UINT32)WritePciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr, (UINTN)_DataByte) 988 #define readpci32(_Addr) (UINT32)ReadPciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr) 989 990 #define Pause() WaitForSingleEvent (ST->ConIn->WaitForKey, 0) 991 #define Port80(_PostCode) GlobalIoFncs->Io.Write (GlobalIoFncs, IO_UINT16, (UINT64)0x80, 1, &(_PostCode)) 992 993 #endif 994