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