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