3 Copyright (c) 2004, 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
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.
27 #include "peiHobLib.h"
28 #include EFI_PROTOCOL_DEFINITION (Decompress)
29 #include EFI_PROTOCOL_DEFINITION (TianoDecompress)
30 #include EFI_GUID_DEFINITION (PeiPeCoffLoader)
42 Copy Length bytes from Source to Destination.
46 Destination - Target of copy
48 Source - Place to copy from
50 Length - Number of bytes to copy
68 Set Buffer to zero for Size bytes.
72 Buffer - Memory to set.
74 Size - Number of bytes to set
93 Copy Length bytes from Source to Destination.
97 Destination - Target of copy
99 Source - Place to copy from
101 Length - Number of bytes to copy
123 Guid1 - guid to compare
124 Guid2 - guid to compare
127 = TRUE if Guid1 == Guid2
128 = FALSE if Guid1 != Guid2
134 InstallEfiPeiPeCoffLoader (
135 IN EFI_PEI_SERVICES
**PeiServices
,
136 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL
**This
,
137 IN EFI_PEI_PPI_DESCRIPTOR
*ThisPpi
143 Install EFI Pei PE coff loader protocol.
147 PeiServices - The PEI core services table.
149 This - Pointer to get Pei PE coff loader protocol as output
151 ThisPpi - Passed in as EFI_NT_LOAD_AS_DLL_PPI on NT_EMULATOR platform
161 InstallEfiDecompress (
162 EFI_DECOMPRESS_PROTOCOL
**This
168 Install EFI decompress protocol.
172 This - Pointer to get decompress protocol as output
176 EFI_SUCCESS - EFI decompress protocol successfully installed.
182 InstallTianoDecompress (
183 EFI_TIANO_DECOMPRESS_PROTOCOL
**This
189 Install Tiano decompress protocol.
193 This - Pointer to get decompress protocol as output
197 EFI_SUCCESS - Tiano decompress protocol successfully installed.
204 EFI_PEI_SERVICES
**PeiServices
,
206 IN EFI_FFS_FILE_HEADER
*FileHeader
,
207 IN BOOLEAN EntryExit
,
214 Log a timestamp count.
218 PeiServices - Pointer to the PEI Core Services table
220 Token - Pointer to Token Name
222 FileHeader - Pointer to the file header
224 EntryExit - Indicates start or stop measurement
226 Value - The start time or the stop time
235 OUT UINT64
*TimerValue
245 TimerValue - Pointer to the returned timer value
249 EFI_SUCCESS - Successfully got timer value
254 #ifdef EFI_PEI_PERFORMANCE
255 #define PEI_PERF_START(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, FALSE, Value)
256 #define PEI_PERF_END(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, TRUE, Value)
258 #define PEI_PERF_START(Ps, Token, FileHeader, Value)
259 #define PEI_PERF_END(Ps, Token, FileHeader, Value)
267 IN EFI_PEI_SERVICES
**PeiServices
,
268 IN EFI_GUID
*ModuleName
,
269 IN EFI_PHYSICAL_ADDRESS Module
,
270 IN UINT64 ModuleLength
,
271 IN EFI_PHYSICAL_ADDRESS EntryPoint
277 Builds a HOB for a loaded PE32 module
281 PeiServices - The PEI core services table.
282 ModuleName - The GUID File Name of the module
283 Memory - The 64 bit physical address of the module
284 ModuleLength - The length of the module in bytes
285 EntryPoint - The 64 bit physical address of the entry point
290 EFI_SUCCESS - Hob is successfully built.
291 Others - Errors occur while creating new Hob
297 PeiBuildHobResourceDescriptor (
298 IN EFI_PEI_SERVICES
**PeiServices
,
299 IN EFI_RESOURCE_TYPE ResourceType
,
300 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute
,
301 IN EFI_PHYSICAL_ADDRESS PhysicalStart
,
302 IN UINT64 NumberOfBytes
308 Builds a HOB that describes a chunck of system memory
312 PeiServices - The PEI core services table.
314 ResourceType - The type of resource described by this HOB
316 ResourceAttribute - The resource attributes of the memory described by this HOB
318 PhysicalStart - The 64 bit physical address of memory described by this HOB
320 NumberOfBytes - The length of the memoty described by this HOB in bytes
324 EFI_SUCCESS - Hob is successfully built.
325 Others - Errors occur while creating new Hob
332 IN EFI_PEI_SERVICES
**PeiServices
,
341 Builds a custom HOB that is tagged with a GUID for identification
345 PeiServices - The PEI core services table.
347 Guid - The GUID of the custome HOB type
349 DataLength - The size of the data payload for the GUIDed HOB
351 Hob - Pointer to the Hob
355 EFI_SUCCESS - Hob is successfully built.
356 Others - Errors occur while creating new Hob
362 PeiBuildHobGuidData (
363 IN EFI_PEI_SERVICES
**PeiServices
,
372 Builds a custom HOB that is tagged with a GUID for identification
376 PeiServices - The PEI core services table.
378 Guid - The GUID of the custome HOB type
380 Data - The data to be copied into the GUIDed HOB data field.
382 DataLength - The data field length.
386 EFI_SUCCESS - Hob is successfully built.
387 Others - Errors occur while creating new Hob
394 IN EFI_PEI_SERVICES
**PeiServices
,
395 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
402 Builds a Firmware Volume HOB
406 PeiServices - The PEI core services table.
408 BaseAddress - The base address of the Firmware Volume
410 Length - The size of the Firmware Volume in bytes
414 EFI_SUCCESS - Hob is successfully built.
415 Others - Errors occur while creating new Hob
422 IN EFI_PEI_SERVICES
**PeiServices
,
423 IN UINT8 SizeOfMemorySpace
,
424 IN UINT8 SizeOfIoSpace
430 Builds a HOB for the CPU
434 PeiServices - The PEI core services table.
436 SizeOfMemorySpace - Identifies the maximum
437 physical memory addressibility of the processor.
439 SizeOfIoSpace - Identifies the maximum physical I/O addressibility
444 EFI_SUCCESS - Hob is successfully built.
445 Others - Errors occur while creating new Hob
452 IN EFI_PEI_SERVICES
**PeiServices
,
453 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
460 Builds a HOB for the Stack
464 PeiServices - The PEI core services table.
466 BaseAddress - The 64 bit physical address of the Stack
468 Length - The length of the stack in bytes
472 EFI_SUCCESS - Hob is successfully built.
473 Others - Errors occur while creating new Hob
479 PeiBuildHobBspStore (
480 IN EFI_PEI_SERVICES
**PeiServices
,
481 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
483 IN EFI_MEMORY_TYPE MemoryType
489 Builds a HOB for the bsp store
493 PeiServices - The PEI core services table.
495 BaseAddress - The 64 bit physical address of the bsp store
497 Length - The length of the bsp store in bytes
499 MemoryType - Memory type
503 EFI_SUCCESS - Hob is successfully built.
504 Others - Errors occur while creating new Hob
510 PeiBuildHobMemoryAllocation (
511 IN EFI_PEI_SERVICES
**PeiServices
,
512 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
515 IN EFI_MEMORY_TYPE MemoryType
521 Builds a HOB for the memory allocation
525 PeiServices - The PEI core services table.
527 BaseAddress - The 64 bit physical address of the memory
529 Length - The length of the memory allocation in bytes
533 MemoryType - Memory type
537 EFI_SUCCESS - Hob is successfully built.
538 Others - Errors occur while creating new Hob
548 OUT CHAR8
*StartOfBuffer
,
550 IN CONST CHAR8
*Format
,
557 AvSPrint function to process format and place the results in Buffer. Since a
558 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
559 this is the main print working routine
563 StartOfBuffer - Ascii buffer to print the results of the parsing of Format into.
565 StrSize - Maximum number of characters to put into buffer. Zero means
568 FormatString - Ascii format string see file header for more details.
570 Marker - Vararg list consumed by processing Format.
574 Number of characters printed.
583 IN CONST CHAR8
*Format
,
590 ASPrint function to process format and place the results in Buffer.
594 Buffer - Ascii buffer to print the results of the parsing of Format into.
596 BufferSize - Maximum number of characters to put into buffer. Zero means no
599 Format - Ascii format string see file header for more details.
601 ... - Vararg list consumed by processing Format.
605 Number of characters printed.
615 IN UINT64 Multiplicand
,
622 This routine allows a 64 bit value to be multiplied with a 32 bit
623 value returns 64bit result.
624 No checking if the result is greater than 64bits
628 Multiplicand - multiplicand
629 Multiplier - multiplier
633 Multiplicand * Multiplier
642 OUT UINTN
*Remainder OPTIONAL
648 This routine allows a 64 bit value to be divided with a 32 bit value returns
649 64bit result and the Remainder.
650 N.B. only works for 31bit divisors!!
656 Remainder - buffer for remainder
661 Remainder = Dividend mod Divisor
675 This routine allows a 64 bit value to be right shifted by 32 bits and returns the
677 Count is valid up 63. (Only Bits 0-5 is valid for Count)
681 Operand - Value to be shifted
682 Count - Number of times to shift right.
686 Value shifted right identified by the Count.
700 This routine allows a 64 bit value to be left shifted by 32 bits and
701 returns the shifted value.
702 Count is valid up 63. (Only Bits 0-5 is valid for Count)
706 Operand - Value to be shifted
707 Count - Number of times to shift left.
711 Value shifted left identified by the Count.
717 RegisterNativeCpuIo (
718 IN EFI_PEI_SERVICES
**PeiServices
,
725 Register a native Cpu IO
729 PeiServices - Calling context
730 CpuIo - CpuIo instance to register
741 IN EFI_PEI_SERVICES
**PeiServices
,
748 Get registered Cpu IO.
752 PeiServices - Calling context
753 CpuIo - CpuIo instance registered before