]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/Pei/Include/PeiLib.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Pei / Include / PeiLib.h
1 /*++
2
3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 PeiLib.h
15
16 Abstract:
17
18 PEI Library Functions
19
20 --*/
21
22 #ifndef _PEI_LIB_H_
23 #define _PEI_LIB_H_
24
25 #include "Tiano.h"
26 #include "Pei.h"
27 #include "peiHobLib.h"
28 #include EFI_PROTOCOL_DEFINITION (Decompress)
29 #include EFI_PROTOCOL_DEFINITION (TianoDecompress)
30 #include EFI_GUID_DEFINITION (PeiPeCoffLoader)
31 #include EFI_PPI_DEFINITION (FindFv)
32
33
34 #if (PI_SPECIFICATION_VERSION >= 0x00010000)
35
36 typedef struct {
37 UINT32 PeiServiceTable;
38 } PEI_IDT_TABLE;
39
40
41 VOID *
42 EFIAPI
43 ScanGuid (
44 IN VOID *Buffer,
45 IN UINTN Length,
46 IN EFI_GUID *Guid
47 )
48 /*++
49
50 Routine Description:
51
52 Scans a target buffer for a GUID, and returns a pointer to the matching GUID
53 in the target buffer.
54
55 This function searches target the buffer specified by Buffer and Length from
56 the lowest address to the highest address at 128-bit increments for the 128-bit
57 GUID value that matches Guid. If a match is found, then a pointer to the matching
58 GUID in the target buffer is returned. If no match is found, then NULL is returned.
59 If Length is 0, then NULL is returned.
60 If Length > 0 and Buffer is NULL, then ASSERT().
61 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
62 If Length is not aligned on a 128-bit boundary, then ASSERT().
63 If Length is greater than (EFI_MAX_ADDRESS ?Buffer + 1), then ASSERT().
64
65 Arguments:
66
67 Buffer - Pointer to the target buffer to scan.
68 Length - Number of bytes in Buffer to scan.
69 Guid - Value to search for in the target buffer.
70
71 Returns:
72 A pointer to the matching Guid in the target buffer or NULL otherwise.
73
74 --*/
75 ;
76
77 VOID *
78 EFIAPI
79 InvalidateInstructionCacheRange (
80 IN VOID *Address,
81 IN UINTN Length
82 )
83 /*++
84
85 Routine Description:
86
87 Invalidates a range of instruction cache lines in the cache coherency domain
88 of the calling CPU.
89
90 Invalidates the instruction cache lines specified by Address and Length. If
91 Address is not aligned on a cache line boundary, then entire instruction
92 cache line containing Address is invalidated. If Address + Length is not
93 aligned on a cache line boundary, then the entire instruction cache line
94 containing Address + Length -1 is invalidated. This function may choose to
95 invalidate the entire instruction cache if that is more efficient than
96 invalidating the specified range. If Length is 0, the no instruction cache
97 lines are invalidated. Address is returned.
98
99 If Length is greater than (EFI_MAX_ADDRESS - Address + 1), then ASSERT().
100
101 Arguments:
102
103 Address - The base address of the instruction cache lines to
104 invalidate. If the CPU is in a physical addressing mode, then
105 Address is a physical address. If the CPU is in a virtual
106 addressing mode, then Address is a virtual address.
107
108 Length - The number of bytes to invalidate from the instruction cache.
109
110 Returns:
111 Address
112
113 **/
114 ;
115
116 EFI_STATUS
117 EFIAPI
118 PeiLibFfsFindNextVolume (
119 IN UINTN Instance,
120 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
121 )
122 /*++
123
124 Routine Description:
125
126 The wrapper of Pei Core Service function FfsFindNextVolume.
127
128 Arguments:
129
130 Instance - The Fv Volume Instance.
131 VolumeHandle - Pointer to the current Fv Volume to search.
132
133 Returns:
134 EFI_STATUS
135
136 --*/
137 ;
138
139 EFI_STATUS
140 EFIAPI
141 PeiLibFfsFindNextFile (
142 IN EFI_FV_FILETYPE SearchType,
143 IN EFI_PEI_FV_HANDLE FwVolHeader,
144 IN OUT EFI_PEI_FILE_HANDLE *FileHeader
145 )
146 /*++
147
148 Routine Description:
149
150 The wrapper of Pei Core Service function FfsFindNextFile.
151
152 Arguments:
153
154 SearchType - Filter to find only file of this type.
155 FwVolHeader - Pointer to the current FV to search.
156 FileHandle - Pointer to the file matching SearchType in FwVolHeader.
157 - NULL if file not found
158
159 Returns:
160 EFI_STATUS
161
162 --*/
163 ;
164
165 EFI_STATUS
166 EFIAPI
167 PeiLibFfsFindFileByName (
168 IN EFI_GUID *FileName,
169 IN EFI_PEI_FV_HANDLE VolumeHandle,
170 OUT EFI_PEI_FILE_HANDLE *FileHandle
171 )
172 /*++
173
174 Routine Description:
175
176 The wrapper of Pei Core Service function FfsFindFileByName.
177
178 Arguments:
179
180 FileName - File name to search.
181 VolumeHandle - The current FV to search.
182 FileHandle - Pointer to the file matching name in VolumeHandle.
183 - NULL if file not found
184
185 Returns:
186 EFI_STATUS
187
188 --*/
189 ;
190
191 EFI_STATUS
192 EFIAPI
193 PeiLibFfsFindSectionData (
194 IN EFI_SECTION_TYPE SectionType,
195 IN EFI_FFS_FILE_HEADER *FfsFileHeader,
196 IN OUT VOID **SectionData
197 )
198 /*++
199
200 Routine Description:
201
202 The wrapper of Pei Core Service function FfsFindSectionData.
203
204 Arguments:
205
206 SearchType - Filter to find only sections of this type.
207 FileHandle - Pointer to the current file to search.
208 SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
209 - NULL if section not found
210
211 Returns:
212 EFI_STATUS
213 --*/
214 ;
215
216 EFI_STATUS
217 EFIAPI
218 PeiLibFfsGetVolumeInfo (
219 IN EFI_PEI_FV_HANDLE *VolumeHandle,
220 OUT EFI_FV_INFO *VolumeInfo
221 )
222 /*++
223
224 Routine Description:
225
226 The wrapper of Pei Core Service function FfsGetVolumeInfo.
227
228 Arguments:
229
230 VolumeHandle - The handle to Fv Volume.
231 VolumeInfo - The pointer to volume information.
232
233 Returns:
234 EFI_STATUS
235 --*/
236 ;
237
238 EFI_STATUS
239 EFIAPI
240 PeiServicesLocatePpi (
241 IN EFI_GUID *Guid,
242 IN UINTN Instance,
243 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
244 IN OUT VOID **Ppi
245 )
246 /*++
247
248 Routine Description:
249
250 The wrapper of Pei Core Service function LocatePpi.
251
252 Arguments:
253
254 Guid - Pointer to GUID of the PPI.
255 Instance - Instance Number to discover.
256 PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
257 returns a pointer to the descriptor (includes flags, etc)
258 Ppi - Pointer to reference the found PPI
259
260 Returns:
261
262 Status - EFI_SUCCESS if the PPI is in the database
263 EFI_NOT_FOUND if the PPI is not in the database
264 --*/
265 ;
266
267 VOID
268 EFIAPI
269 BuildFvHob (
270 IN EFI_PHYSICAL_ADDRESS BaseAddress,
271 IN UINT64 Length
272 )
273 /*++
274
275 Routine Description:
276
277 Build FvHob.
278
279 Arguments:
280
281 BaseAddress - Fv base address.
282 Length - Fv Length.
283
284 Returns:
285 NONE.
286
287 --*/
288 ;
289
290 VOID
291 EFIAPI
292 BuildFvHob2 (
293 IN EFI_PHYSICAL_ADDRESS BaseAddress,
294 IN UINT64 Length,
295 IN EFI_GUID *FvNameGuid,
296 IN EFI_GUID *FileNameGuid
297 )
298 /*++
299
300 Routine Description:
301
302 Build FvHob2.
303
304 Arguments:
305
306 BaseAddress - Fv base address.
307 Length - Fv length.
308 FvNameGuid - Fv name.
309 FileNameGuid - File name which contians encapsulated Fv.
310
311 Returns:
312 NONE.
313 --*/
314 ;
315
316
317 VOID
318 EFIAPI
319 BuildGuidDataHob (
320 IN EFI_GUID *Guid,
321 IN VOID *Data,
322 IN UINTN DataLength
323 )
324 /*++
325
326 Routine Description:
327
328 Build Guid data Hob.
329
330 Arguments:
331
332 Guid - guid to build data hob.
333 Data - data to build data hob.
334 DataLength - the length of data.
335
336 Returns:
337 NONE
338
339 --*/
340 ;
341
342 VOID *
343 EFIAPI
344 AllocatePages (
345 IN UINTN Pages
346 )
347 /*++
348
349 Routine Description:
350
351 Allocate Memory.
352
353 Arguments:
354
355 Pages - Pages to allocate.
356
357 Returns:
358 Address if successful to allocate memory.
359 NULL if fail to allocate memory.
360
361 --*/
362 ;
363
364 VOID
365 SetPeiServicesTablePointer (
366 IN EFI_PEI_SERVICES **PeiServices
367 )
368 /*++
369
370 Routine Description:
371
372 Save PeiService pointer so that it can be retrieved anywhere.
373
374 Arguments:
375
376 PeiServices - The direct pointer to PeiServiceTable.
377
378 Returns:
379 NONE
380
381 --*/
382 ;
383
384 EFI_PEI_SERVICES **
385 GetPeiServicesTablePointer (
386 VOID
387 )
388 /*++
389
390 Routine Description:
391
392 Get PeiService pointer.
393
394 Arguments:
395
396 NONE.
397
398 Returns:
399 The direct pointer to PeiServiceTable.
400
401 --*/
402 ;
403
404 VOID
405 MigrateIdtTable (
406 IN EFI_PEI_SERVICES **PeiServices
407 )
408 /*++
409
410 Routine Description:
411
412 Migrate IDT from CAR to real memory where preceded with 4 bytes for
413 storing PeiService pointer.
414
415 Arguments:
416
417 PeiServices - The direct pointer to PeiServiceTable.
418
419 Returns:
420
421 NONE.
422
423 --*/
424 ;
425
426
427 UINTN
428 ReadIdtBase (
429 VOID
430 )
431 /*++
432
433 Routine Description:
434
435 Read IDT Register BaseAddress.
436
437 Arguments:
438
439 NONE
440
441 Returns:
442 IDT Register BaseAddress.
443
444 --*/
445 ;
446
447
448 UINT16
449 ReadIdtLimit (
450 VOID
451 )
452 /*++
453
454 Routine Description:
455
456 Read IDT Register Limit.
457
458 Arguments:
459
460 NONE
461
462 Returns:
463 IDT Register Limit.
464
465 --*/
466 ;
467
468
469 VOID
470 SetIdtBase (
471 UINT32 IdtBase,
472 UINT16 IdtLimit
473 )
474 /*++
475
476 Routine Description:
477
478 Set IDT Register BaseAddress.
479
480 Arguments:
481
482 IdtBase - IDT.BaseAddress
483 IdtLimit - IDT.Limit
484
485 Returns:
486 NONE
487 --*/
488 ;
489
490 VOID
491 AsmWriteKr7 (
492 UINT64 Address
493 )
494 /*++
495
496 Routine Description:
497
498 Write 64 bit into Kernel Register7 on IPF.
499
500 Arguments:
501
502 Address - Data to write into kr7.
503
504 Returns:
505 NONE
506
507 --*/
508 ;
509
510
511 UINT64
512 AsmReadKr7 (
513 VOID
514 )
515 /*++
516
517 Routine Description:
518
519 Read 64 bit from Kernel Register7 on IPF.
520
521 Arguments:
522
523 NONE
524
525 Returns:
526 Data in kr7.
527
528 --*/
529 ;
530
531 #endif
532
533 VOID
534 PeiCopyMem (
535 IN VOID *Destination,
536 IN VOID *Source,
537 IN UINTN Length
538 )
539 /*++
540
541 Routine Description:
542
543 Copy Length bytes from Source to Destination.
544
545 Arguments:
546
547 Destination - Target of copy
548
549 Source - Place to copy from
550
551 Length - Number of bytes to copy
552
553 Returns:
554
555 None
556
557 --*/
558 ;
559
560 VOID
561 ZeroMem (
562 IN VOID *Buffer,
563 IN UINTN Size
564 )
565 /*++
566
567 Routine Description:
568
569 Set Buffer to zero for Size bytes.
570
571 Arguments:
572
573 Buffer - Memory to set.
574
575 Size - Number of bytes to set
576
577 Returns:
578
579 None
580
581 --*/
582 ;
583
584 VOID
585 CopyMem (
586 IN VOID *Destination,
587 IN VOID *Source,
588 IN UINTN Length
589 )
590 /*++
591
592 Routine Description:
593
594 Copy Length bytes from Source to Destination.
595
596 Arguments:
597
598 Destination - Target of copy
599
600 Source - Place to copy from
601
602 Length - Number of bytes to copy
603
604 Returns:
605
606 None
607
608 --*/
609 ;
610
611 BOOLEAN
612 CompareGuid (
613 IN EFI_GUID *Guid1,
614 IN EFI_GUID *Guid2
615 )
616 /*++
617
618 Routine Description:
619
620 Compares two GUIDs
621
622 Arguments:
623
624 Guid1 - guid to compare
625 Guid2 - guid to compare
626
627 Returns:
628 = TRUE if Guid1 == Guid2
629 = FALSE if Guid1 != Guid2
630
631 --*/
632 ;
633
634 EFI_STATUS
635 InstallEfiPeiPeCoffLoader (
636 IN EFI_PEI_SERVICES **PeiServices,
637 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL **This,
638 IN EFI_PEI_PPI_DESCRIPTOR *ThisPpi
639 )
640 /*++
641
642 Routine Description:
643
644 Install EFI Pei PE coff loader protocol.
645
646 Arguments:
647
648 PeiServices - The PEI core services table.
649
650 This - Pointer to get Pei PE coff loader protocol as output
651
652 ThisPpi - Passed in as EFI_NT_LOAD_AS_DLL_PPI on NT_EMULATOR platform
653
654 Returns:
655
656 EFI_SUCCESS
657
658 --*/
659 ;
660
661 EFI_STATUS
662 InstallEfiPeiPeCoffLoader64 (
663 IN EFI_PEI_SERVICES **PeiServices,
664 IN OUT EFI_PEI_PE_COFF_LOADER_PROTOCOL **This,
665 IN EFI_PEI_PPI_DESCRIPTOR *ThisPpi
666 );
667
668
669
670 EFI_STATUS
671 InstallEfiDecompress (
672 EFI_DECOMPRESS_PROTOCOL **This
673 )
674 /*++
675
676 Routine Description:
677
678 Install EFI decompress protocol.
679
680 Arguments:
681
682 This - Pointer to get decompress protocol as output
683
684 Returns:
685
686 EFI_SUCCESS - EFI decompress protocol successfully installed.
687
688 --*/
689 ;
690
691 EFI_STATUS
692 InstallTianoDecompress (
693 EFI_TIANO_DECOMPRESS_PROTOCOL **This
694 )
695 /*++
696
697 Routine Description:
698
699 Install Tiano decompress protocol.
700
701 Arguments:
702
703 This - Pointer to get decompress protocol as output
704
705 Returns:
706
707 EFI_SUCCESS - Tiano decompress protocol successfully installed.
708
709 --*/
710 ;
711
712 VOID
713 PeiPerfMeasure (
714 EFI_PEI_SERVICES **PeiServices,
715 IN UINT16 *Token,
716 IN EFI_FFS_FILE_HEADER *FileHeader,
717 IN BOOLEAN EntryExit,
718 IN UINT64 Value
719 )
720 /*++
721
722 Routine Description:
723
724 Log a timestamp count.
725
726 Arguments:
727
728 PeiServices - Pointer to the PEI Core Services table
729
730 Token - Pointer to Token Name
731
732 FileHeader - Pointer to the file header
733
734 EntryExit - Indicates start or stop measurement
735
736 Value - The start time or the stop time
737
738 Returns:
739
740 --*/
741 ;
742
743 EFI_STATUS
744 GetTimerValue (
745 OUT UINT64 *TimerValue
746 )
747 /*++
748
749 Routine Description:
750
751 Get timer value.
752
753 Arguments:
754
755 TimerValue - Pointer to the returned timer value
756
757 Returns:
758
759 EFI_SUCCESS - Successfully got timer value
760
761 --*/
762 ;
763
764 #ifdef EFI_PEI_PERFORMANCE
765 #define PEI_PERF_START(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, FALSE, Value)
766 #define PEI_PERF_END(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, TRUE, Value)
767 #else
768 #define PEI_PERF_START(Ps, Token, FileHeader, Value)
769 #define PEI_PERF_END(Ps, Token, FileHeader, Value)
770 #endif
771
772 #ifdef EFI_NT_EMULATOR
773 EFI_STATUS
774 PeCoffLoaderWinNtLoadAsDll (
775 IN CHAR8 *PdbFileName,
776 IN VOID **ImageEntryPoint,
777 OUT VOID **ModHandle
778 )
779 /*++
780
781 Routine Description:
782
783 Loads the .DLL file is present when a PE/COFF file is loaded. This provides source level
784 debugging for drivers that have cooresponding .DLL files on the local system.
785
786 Arguments:
787
788 PdbFileName - The name of the .PDB file. This was found from the PE/COFF
789 file's debug directory entry.
790
791 ImageEntryPoint - A pointer to the DLL entry point of the .DLL file was loaded.
792
793 ModHandle - Pointer to loaded library.
794
795 Returns:
796
797 EFI_SUCCESS - The .DLL file was loaded, and the DLL entry point is returned in ImageEntryPoint
798
799 EFI_NOT_FOUND - The .DLL file could not be found
800
801 EFI_UNSUPPORTED - The .DLL file was loaded, but the entry point to the .DLL file could not
802 determined.
803
804 --*/
805 ;
806
807 #endif
808 //
809 // hob.c
810 //
811 EFI_STATUS
812 PeiBuildHobModule (
813 IN EFI_PEI_SERVICES **PeiServices,
814 IN EFI_GUID *ModuleName,
815 IN EFI_PHYSICAL_ADDRESS Module,
816 IN UINT64 ModuleLength,
817 IN EFI_PHYSICAL_ADDRESS EntryPoint
818 )
819 /*++
820
821 Routine Description:
822
823 Builds a HOB for a loaded PE32 module
824
825 Arguments:
826
827 PeiServices - The PEI core services table.
828 ModuleName - The GUID File Name of the module
829 Memory - The 64 bit physical address of the module
830 ModuleLength - The length of the module in bytes
831 EntryPoint - The 64 bit physical address of the entry point
832 to the module
833
834 Returns:
835
836 EFI_SUCCESS - Hob is successfully built.
837 Others - Errors occur while creating new Hob
838
839 --*/
840 ;
841
842 EFI_STATUS
843 PeiBuildHobResourceDescriptor (
844 IN EFI_PEI_SERVICES **PeiServices,
845 IN EFI_RESOURCE_TYPE ResourceType,
846 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
847 IN EFI_PHYSICAL_ADDRESS PhysicalStart,
848 IN UINT64 NumberOfBytes
849 )
850 /*++
851
852 Routine Description:
853
854 Builds a HOB that describes a chunck of system memory
855
856 Arguments:
857
858 PeiServices - The PEI core services table.
859
860 ResourceType - The type of resource described by this HOB
861
862 ResourceAttribute - The resource attributes of the memory described by this HOB
863
864 PhysicalStart - The 64 bit physical address of memory described by this HOB
865
866 NumberOfBytes - The length of the memoty described by this HOB in bytes
867
868 Returns:
869
870 EFI_SUCCESS - Hob is successfully built.
871 Others - Errors occur while creating new Hob
872
873 --*/
874 ;
875
876 EFI_STATUS
877 PeiBuildHobGuid (
878 IN EFI_PEI_SERVICES **PeiServices,
879 IN EFI_GUID *Guid,
880 IN UINTN DataLength,
881 IN OUT VOID **Hob
882 )
883 /*++
884
885 Routine Description:
886
887 Builds a custom HOB that is tagged with a GUID for identification
888
889 Arguments:
890
891 PeiServices - The PEI core services table.
892
893 Guid - The GUID of the custome HOB type
894
895 DataLength - The size of the data payload for the GUIDed HOB
896
897 Hob - Pointer to the Hob
898
899 Returns:
900
901 EFI_SUCCESS - Hob is successfully built.
902 Others - Errors occur while creating new Hob
903
904 --*/
905 ;
906
907 EFI_STATUS
908 PeiBuildHobGuidData (
909 IN EFI_PEI_SERVICES **PeiServices,
910 IN EFI_GUID *Guid,
911 IN VOID *Data,
912 IN UINTN DataLength
913 )
914 /*++
915
916 Routine Description:
917
918 Builds a custom HOB that is tagged with a GUID for identification
919
920 Arguments:
921
922 PeiServices - The PEI core services table.
923
924 Guid - The GUID of the custome HOB type
925
926 Data - The data to be copied into the GUIDed HOB data field.
927
928 DataLength - The data field length.
929
930 Returns:
931
932 EFI_SUCCESS - Hob is successfully built.
933 Others - Errors occur while creating new Hob
934
935 --*/
936 ;
937
938 EFI_STATUS
939 PeiBuildHobFv (
940 IN EFI_PEI_SERVICES **PeiServices,
941 IN EFI_PHYSICAL_ADDRESS BaseAddress,
942 IN UINT64 Length
943 )
944 /*++
945
946 Routine Description:
947
948 Builds a Firmware Volume HOB
949
950 Arguments:
951
952 PeiServices - The PEI core services table.
953
954 BaseAddress - The base address of the Firmware Volume
955
956 Length - The size of the Firmware Volume in bytes
957
958 Returns:
959
960 EFI_SUCCESS - Hob is successfully built.
961 Others - Errors occur while creating new Hob
962
963 --*/
964 ;
965
966 EFI_STATUS
967 PeiBuildHobCpu (
968 IN EFI_PEI_SERVICES **PeiServices,
969 IN UINT8 SizeOfMemorySpace,
970 IN UINT8 SizeOfIoSpace
971 )
972 /*++
973
974 Routine Description:
975
976 Builds a HOB for the CPU
977
978 Arguments:
979
980 PeiServices - The PEI core services table.
981
982 SizeOfMemorySpace - Identifies the maximum
983 physical memory addressibility of the processor.
984
985 SizeOfIoSpace - Identifies the maximum physical I/O addressibility
986 of the processor.
987
988 Returns:
989
990 EFI_SUCCESS - Hob is successfully built.
991 Others - Errors occur while creating new Hob
992
993 --*/
994 ;
995
996 EFI_STATUS
997 PeiBuildHobStack (
998 IN EFI_PEI_SERVICES **PeiServices,
999 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1000 IN UINT64 Length
1001 )
1002 /*++
1003
1004 Routine Description:
1005
1006 Builds a HOB for the Stack
1007
1008 Arguments:
1009
1010 PeiServices - The PEI core services table.
1011
1012 BaseAddress - The 64 bit physical address of the Stack
1013
1014 Length - The length of the stack in bytes
1015
1016 Returns:
1017
1018 EFI_SUCCESS - Hob is successfully built.
1019 Others - Errors occur while creating new Hob
1020
1021 --*/
1022 ;
1023
1024 EFI_STATUS
1025 PeiBuildHobBspStore (
1026 IN EFI_PEI_SERVICES **PeiServices,
1027 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1028 IN UINT64 Length,
1029 IN EFI_MEMORY_TYPE MemoryType
1030 )
1031 /*++
1032
1033 Routine Description:
1034
1035 Builds a HOB for the bsp store
1036
1037 Arguments:
1038
1039 PeiServices - The PEI core services table.
1040
1041 BaseAddress - The 64 bit physical address of the bsp store
1042
1043 Length - The length of the bsp store in bytes
1044
1045 MemoryType - Memory type
1046
1047 Returns:
1048
1049 EFI_SUCCESS - Hob is successfully built.
1050 Others - Errors occur while creating new Hob
1051
1052 --*/
1053 ;
1054
1055 EFI_STATUS
1056 PeiBuildHobMemoryAllocation (
1057 IN EFI_PEI_SERVICES **PeiServices,
1058 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1059 IN UINT64 Length,
1060 IN EFI_GUID *Name,
1061 IN EFI_MEMORY_TYPE MemoryType
1062 )
1063 /*++
1064
1065 Routine Description:
1066
1067 Builds a HOB for the memory allocation
1068
1069 Arguments:
1070
1071 PeiServices - The PEI core services table.
1072
1073 BaseAddress - The 64 bit physical address of the memory
1074
1075 Length - The length of the memory allocation in bytes
1076
1077 Name - Name for Hob
1078
1079 MemoryType - Memory type
1080
1081 Returns:
1082
1083 EFI_SUCCESS - Hob is successfully built.
1084 Others - Errors occur while creating new Hob
1085
1086 --*/
1087 ;
1088
1089 //
1090 // print.c
1091 //
1092 UINTN
1093 AvSPrint (
1094 OUT CHAR8 *StartOfBuffer,
1095 IN UINTN StrSize,
1096 IN CONST CHAR8 *Format,
1097 IN VA_LIST Marker
1098 )
1099 /*++
1100
1101 Routine Description:
1102
1103 AvSPrint function to process format and place the results in Buffer. Since a
1104 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
1105 this is the main print working routine
1106
1107 Arguments:
1108
1109 StartOfBuffer - Ascii buffer to print the results of the parsing of Format into.
1110
1111 StrSize - Maximum number of characters to put into buffer. Zero means
1112 no limit.
1113
1114 FormatString - Ascii format string see file header for more details.
1115
1116 Marker - Vararg list consumed by processing Format.
1117
1118 Returns:
1119
1120 Number of characters printed.
1121
1122 --*/
1123 ;
1124
1125 UINTN
1126 ASPrint (
1127 OUT CHAR8 *Buffer,
1128 IN UINTN BufferSize,
1129 IN CONST CHAR8 *Format,
1130 ...
1131 )
1132 /*++
1133
1134 Routine Description:
1135
1136 ASPrint function to process format and place the results in Buffer.
1137
1138 Arguments:
1139
1140 Buffer - Ascii buffer to print the results of the parsing of Format into.
1141
1142 BufferSize - Maximum number of characters to put into buffer. Zero means no
1143 limit.
1144
1145 Format - Ascii format string see file header for more details.
1146
1147 ... - Vararg list consumed by processing Format.
1148
1149 Returns:
1150
1151 Number of characters printed.
1152
1153 --*/
1154 ;
1155
1156 //
1157 // math.c
1158 //
1159 UINT64
1160 MultU64x32 (
1161 IN UINT64 Multiplicand,
1162 IN UINTN Multiplier
1163 )
1164 /*++
1165
1166 Routine Description:
1167
1168 This routine allows a 64 bit value to be multiplied with a 32 bit
1169 value returns 64bit result.
1170 No checking if the result is greater than 64bits
1171
1172 Arguments:
1173
1174 Multiplicand - multiplicand
1175 Multiplier - multiplier
1176
1177 Returns:
1178
1179 Multiplicand * Multiplier
1180
1181 --*/
1182 ;
1183
1184 UINT64
1185 DivU64x32 (
1186 IN UINT64 Dividend,
1187 IN UINTN Divisor,
1188 OUT UINTN *Remainder OPTIONAL
1189 )
1190 /*++
1191
1192 Routine Description:
1193
1194 This routine allows a 64 bit value to be divided with a 32 bit value returns
1195 64bit result and the Remainder.
1196 N.B. only works for 31bit divisors!!
1197
1198 Arguments:
1199
1200 Dividend - dividend
1201 Divisor - divisor
1202 Remainder - buffer for remainder
1203
1204 Returns:
1205
1206 Dividend / Divisor
1207 Remainder = Dividend mod Divisor
1208
1209 --*/
1210 ;
1211
1212 UINT64
1213 RShiftU64 (
1214 IN UINT64 Operand,
1215 IN UINTN Count
1216 )
1217 /*++
1218
1219 Routine Description:
1220
1221 This routine allows a 64 bit value to be right shifted by 32 bits and returns the
1222 shifted value.
1223 Count is valid up 63. (Only Bits 0-5 is valid for Count)
1224
1225 Arguments:
1226
1227 Operand - Value to be shifted
1228 Count - Number of times to shift right.
1229
1230 Returns:
1231
1232 Value shifted right identified by the Count.
1233
1234 --*/
1235 ;
1236
1237 UINT64
1238 LShiftU64 (
1239 IN UINT64 Operand,
1240 IN UINTN Count
1241 )
1242 /*++
1243
1244 Routine Description:
1245
1246 This routine allows a 64 bit value to be left shifted by 32 bits and
1247 returns the shifted value.
1248 Count is valid up 63. (Only Bits 0-5 is valid for Count)
1249
1250 Arguments:
1251
1252 Operand - Value to be shifted
1253 Count - Number of times to shift left.
1254
1255 Returns:
1256
1257 Value shifted left identified by the Count.
1258
1259 --*/
1260 ;
1261
1262 VOID
1263 RegisterNativeCpuIo (
1264 IN EFI_PEI_SERVICES **PeiServices,
1265 IN VOID *CpuIo
1266 )
1267 /*++
1268
1269 Routine Description:
1270
1271 Register a native Cpu IO
1272
1273 Arguments:
1274
1275 PeiServices - Calling context
1276 CpuIo - CpuIo instance to register
1277
1278 Returns:
1279
1280 None
1281
1282 --*/
1283 ;
1284
1285 VOID
1286 GetNativeCpuIo (
1287 IN EFI_PEI_SERVICES **PeiServices,
1288 OUT VOID **CpuIo
1289 )
1290 /*++
1291
1292 Routine Description:
1293
1294 Get registered Cpu IO.
1295
1296 Arguments:
1297
1298 PeiServices - Calling context
1299 CpuIo - CpuIo instance registered before
1300
1301 Returns:
1302
1303 None
1304
1305 --*/
1306 ;
1307
1308 EFI_STATUS
1309 FindFv (
1310 IN EFI_FIND_FV_PPI *This,
1311 IN EFI_PEI_SERVICES **PeiServices,
1312 IN OUT UINT8 *FvNumber,
1313 IN OUT EFI_FIRMWARE_VOLUME_HEADER **FVAddress
1314 )
1315 /*++
1316
1317 Routine Description:
1318
1319 Search Fv in Hob.
1320
1321 Arguments:
1322
1323 This - Interface pointer that implement the Find Fv PPI
1324
1325 PeiServices - Pointer to the PEI Service Table
1326
1327 FvNumber - On input, the number of the fireware volume which supports FFS to locate
1328 On output, the next FV number which supports FFS.
1329
1330 FVAddress - The address of the volume which supports FFS to discover
1331
1332 Returns:
1333
1334 EFI_SUCCESS - An addtional FV which supports FFS found
1335 EFI_OUT_OF_RESOURCES - There are no fireware volume which supports FFS for given fvnumber
1336 EFI_INVALID_PARAMETER - FvAddress is NULL
1337
1338 --*/
1339 ;
1340
1341 #endif