Debian Codegraph @

gnu-efi/inc/efilib.h

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