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