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