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