mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
Import Library Class from original MDE package. Also I added the EFI_PEI_CORE_ENTRY_POINT definition in PiPeiCis.h.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2677 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a7ed1e2ed5
commit
fb3df220f8
7138
MdePkg/Include/Library/BaseLib.h
Normal file
7138
MdePkg/Include/Library/BaseLib.h
Normal file
File diff suppressed because it is too large
Load Diff
377
MdePkg/Include/Library/BaseMemoryLib.h
Normal file
377
MdePkg/Include/Library/BaseMemoryLib.h
Normal file
@ -0,0 +1,377 @@
|
||||
/** @file
|
||||
Memory-only library functions with no library constructor/destructor
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: BaseMemoryLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __BASE_MEMORY_LIB__
|
||||
#define __BASE_MEMORY_LIB__
|
||||
|
||||
/**
|
||||
Copies a source buffer to a destination buffer, and returns the destination buffer.
|
||||
|
||||
This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
|
||||
DestinationBuffer. The implementation must be reentrant, and it must handle the case
|
||||
where SourceBuffer overlaps DestinationBuffer.
|
||||
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
|
||||
|
||||
@param DestinationBuffer Pointer to the destination buffer of the memory copy.
|
||||
@param SourceBuffer Pointer to the source buffer of the memory copy.
|
||||
@param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.
|
||||
|
||||
@return DestinationBuffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
CopyMem (
|
||||
OUT VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a byte value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with Value, and returns Buffer.
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 16-bit value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the 16-bit value specified by
|
||||
Value, and returns Buffer. Value is repeated every 16-bits in for Length
|
||||
bytes of Buffer.
|
||||
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem16 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 32-bit value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the 32-bit value specified by
|
||||
Value, and returns Buffer. Value is repeated every 32-bits in for Length
|
||||
bytes of Buffer.
|
||||
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem32 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 64-bit value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the 64-bit value specified by
|
||||
Value, and returns Buffer. Value is repeated every 64-bits in for Length
|
||||
bytes of Buffer.
|
||||
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem64 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with zeros, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with zeros, and returns Buffer.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill with zeros.
|
||||
@param Length Number of bytes in Buffer to fill with zeros.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ZeroMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Compares the contents of two buffers.
|
||||
|
||||
This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
|
||||
If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
|
||||
value returned is the first mismatched byte in SourceBuffer subtracted from the first
|
||||
mismatched byte in DestinationBuffer.
|
||||
If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
|
||||
If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
|
||||
|
||||
@param DestinationBuffer Pointer to the destination buffer to compare.
|
||||
@param SourceBuffer Pointer to the source buffer to compare.
|
||||
@param Length Number of bytes to compare.
|
||||
|
||||
@return 0 All Length bytes of the two buffers are identical.
|
||||
@retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
|
||||
mismatched byte in DestinationBuffer.
|
||||
|
||||
**/
|
||||
INTN
|
||||
EFIAPI
|
||||
CompareMem (
|
||||
IN CONST VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for an 8-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem8 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for a 16-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem16 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for a 32-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem32 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for a 64-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem64 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a source GUID to a destination GUID.
|
||||
|
||||
This function copies the contents of the 128-bit GUID specified by SourceGuid to
|
||||
DestinationGuid, and returns DestinationGuid.
|
||||
If DestinationGuid is NULL, then ASSERT().
|
||||
If SourceGuid is NULL, then ASSERT().
|
||||
|
||||
@param DestinationGuid Pointer to the destination GUID.
|
||||
@param SourceGuid Pointer to the source GUID.
|
||||
|
||||
@return DestinationGuid.
|
||||
|
||||
**/
|
||||
GUID *
|
||||
EFIAPI
|
||||
CopyGuid (
|
||||
OUT GUID *DestinationGuid,
|
||||
IN CONST GUID *SourceGuid
|
||||
);
|
||||
|
||||
/**
|
||||
Compares two GUIDs.
|
||||
|
||||
This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.
|
||||
If there are any bit differences in the two GUIDs, then FALSE is returned.
|
||||
If Guid1 is NULL, then ASSERT().
|
||||
If Guid2 is NULL, then ASSERT().
|
||||
|
||||
@param Guid1 A pointer to a 128 bit GUID.
|
||||
@param Guid2 A pointer to a 128 bit GUID.
|
||||
|
||||
@retval TRUE Guid1 and Guid2 are identical.
|
||||
@retval FALSE Guid1 and Guid2 are not identical.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CompareGuid (
|
||||
IN CONST GUID *Guid1,
|
||||
IN CONST GUID *Guid2
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a GUID, and returns a pointer to the matching GUID
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from
|
||||
the lowest address to the highest address at 128-bit increments for the 128-bit
|
||||
GUID value that matches Guid. If a match is found, then a pointer to the matching
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Guid Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching Guid in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanGuid (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN CONST GUID *Guid
|
||||
);
|
||||
|
||||
#endif
|
214
MdePkg/Include/Library/CacheMaintenanceLib.h
Normal file
214
MdePkg/Include/Library/CacheMaintenanceLib.h
Normal file
@ -0,0 +1,214 @@
|
||||
/** @file
|
||||
Cache Maintenance Functions
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: CacheMaintenanceLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __CACHE_MAINTENANCE_LIB__
|
||||
#define __CACHE_MAINTENANCE_LIB__
|
||||
|
||||
/**
|
||||
Invalidates the entire instruction cache in cache coherency domain of the
|
||||
calling CPU.
|
||||
|
||||
Invalidates the entire instruction cache in cache coherency domain of the
|
||||
calling CPU.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
InvalidateInstructionCache (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Invalidates a range of instruction cache lines in the cache coherency domain
|
||||
of the calling CPU.
|
||||
|
||||
Invalidates the instruction cache lines specified by Address and Length. If
|
||||
Address is not aligned on a cache line boundary, then entire instruction
|
||||
cache line containing Address is invalidated. If Address + Length is not
|
||||
aligned on a cache line boundary, then the entire instruction cache line
|
||||
containing Address + Length -1 is invalidated. This function may choose to
|
||||
invalidate the entire instruction cache if that is more efficient than
|
||||
invalidating the specified range. If Length is 0, the no instruction cache
|
||||
lines are invalidated. Address is returned.
|
||||
|
||||
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
|
||||
|
||||
@param Address The base address of the instruction cache lines to
|
||||
invalidate. If the CPU is in a physical addressing mode, then
|
||||
Address is a physical address. If the CPU is in a virtual
|
||||
addressing mode, then Address is a virtual address.
|
||||
|
||||
@param Length The number of bytes to invalidate from the instruction cache.
|
||||
|
||||
@return Address
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InvalidateInstructionCacheRange (
|
||||
IN VOID *Address,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Writes Back and Invalidates the entire data cache in cache coherency domain
|
||||
of the calling CPU.
|
||||
|
||||
Writes Back and Invalidates the entire data cache in cache coherency domain
|
||||
of the calling CPU. This function guarantees that all dirty cache lines are
|
||||
written back to system memory, and also invalidates all the data cache lines
|
||||
in the cache coherency domain of the calling CPU.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
WriteBackInvalidateDataCache (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Writes Back and Invalidates a range of data cache lines in the cache
|
||||
coherency domain of the calling CPU.
|
||||
|
||||
Writes Back and Invalidate the data cache lines specified by Address and
|
||||
Length. If Address is not aligned on a cache line boundary, then entire data
|
||||
cache line containing Address is written back and invalidated. If Address +
|
||||
Length is not aligned on a cache line boundary, then the entire data cache
|
||||
line containing Address + Length -1 is written back and invalidated. This
|
||||
function may choose to write back and invalidate the entire data cache if
|
||||
that is more efficient than writing back and invalidating the specified
|
||||
range. If Length is 0, the no data cache lines are written back and
|
||||
invalidated. Address is returned.
|
||||
|
||||
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
|
||||
|
||||
@param Address The base address of the data cache lines to write back and
|
||||
invalidate. If the CPU is in a physical addressing mode, then
|
||||
Address is a physical address. If the CPU is in a virtual
|
||||
addressing mode, then Address is a virtual address.
|
||||
@param Length The number of bytes to write back and invalidate from the
|
||||
data cache.
|
||||
|
||||
@return Address
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
WriteBackInvalidateDataCacheRange (
|
||||
IN VOID *Address,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Writes Back the entire data cache in cache coherency domain of the calling
|
||||
CPU.
|
||||
|
||||
Writes Back the entire data cache in cache coherency domain of the calling
|
||||
CPU. This function guarantees that all dirty cache lines are written back to
|
||||
system memory. This function may also invalidate all the data cache lines in
|
||||
the cache coherency domain of the calling CPU.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
WriteBackDataCache (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Writes Back a range of data cache lines in the cache coherency domain of the
|
||||
calling CPU.
|
||||
|
||||
Writes Back the data cache lines specified by Address and Length. If Address
|
||||
is not aligned on a cache line boundary, then entire data cache line
|
||||
containing Address is written back. If Address + Length is not aligned on a
|
||||
cache line boundary, then the entire data cache line containing Address +
|
||||
Length -1 is written back. This function may choose to write back the entire
|
||||
data cache if that is more efficient than writing back the specified range.
|
||||
If Length is 0, the no data cache lines are written back. This function may
|
||||
also invalidate all the data cache lines in the specified range of the cache
|
||||
coherency domain of the calling CPU. Address is returned.
|
||||
|
||||
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
|
||||
|
||||
@param Address The base address of the data cache lines to write back. If
|
||||
the CPU is in a physical addressing mode, then Address is a
|
||||
physical address. If the CPU is in a virtual addressing
|
||||
mode, then Address is a virtual address.
|
||||
@param Length The number of bytes to write back from the data cache.
|
||||
|
||||
@return Address
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
WriteBackDataCacheRange (
|
||||
IN VOID *Address,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Invalidates the entire data cache in cache coherency domain of the calling
|
||||
CPU.
|
||||
|
||||
Invalidates the entire data cache in cache coherency domain of the calling
|
||||
CPU. This function must be used with care because dirty cache lines are not
|
||||
written back to system memory. It is typically used for cache diagnostics. If
|
||||
the CPU does not support invalidation of the entire data cache, then a write
|
||||
back and invalidate operation should be performed on the entire data cache.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
InvalidateDataCache (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Invalidates a range of data cache lines in the cache coherency domain of the
|
||||
calling CPU.
|
||||
|
||||
Invalidates the data cache lines specified by Address and Length. If Address
|
||||
is not aligned on a cache line boundary, then entire data cache line
|
||||
containing Address is invalidated. If Address + Length is not aligned on a
|
||||
cache line boundary, then the entire data cache line containing Address +
|
||||
Length -1 is invalidated. This function must never invalidate any cache lines
|
||||
outside the specified range. If Length is 0, the no data cache lines are
|
||||
invalidated. Address is returned. This function must be used with care
|
||||
because dirty cache lines are not written back to system memory. It is
|
||||
typically used for cache diagnostics. If the CPU does not support
|
||||
invalidation of a data cache range, then a write back and invalidate
|
||||
operation should be performed on the data cache range.
|
||||
|
||||
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
|
||||
|
||||
@param Address The base address of the data cache lines to invalidate. If
|
||||
the CPU is in a physical addressing mode, then Address is a
|
||||
physical address. If the CPU is in a virtual addressing mode,
|
||||
then Address is a virtual address.
|
||||
@param Length The number of bytes to invalidate from the data cache.
|
||||
|
||||
@return Address
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InvalidateDataCacheRange (
|
||||
IN VOID *Address,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
#endif
|
20
MdePkg/Include/Library/CpuLib.h
Normal file
20
MdePkg/Include/Library/CpuLib.h
Normal file
@ -0,0 +1,20 @@
|
||||
/** @file
|
||||
Library that provides processor specific library services
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: CpuLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __CPU_LIB_H__
|
||||
#define __CPU_LIB_H__
|
||||
|
||||
#endif
|
458
MdePkg/Include/Library/DebugLib.h
Normal file
458
MdePkg/Include/Library/DebugLib.h
Normal file
@ -0,0 +1,458 @@
|
||||
/** @file
|
||||
Public include file for the Debug Library
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __DEBUG_LIB_H__
|
||||
#define __DEBUG_LIB_H__
|
||||
|
||||
//
|
||||
// Declare bits for PcdDebugPropertyMask
|
||||
//
|
||||
#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
|
||||
#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
|
||||
#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
|
||||
#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
|
||||
#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
|
||||
#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
|
||||
|
||||
//
|
||||
// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
|
||||
//
|
||||
#define DEBUG_INIT 0x00000001 // Initialization
|
||||
#define DEBUG_WARN 0x00000002 // Warnings
|
||||
#define DEBUG_LOAD 0x00000004 // Load events
|
||||
#define DEBUG_FS 0x00000008 // EFI File system
|
||||
#define DEBUG_POOL 0x00000010 // Alloc & Free's
|
||||
#define DEBUG_PAGE 0x00000020 // Alloc & Free's
|
||||
#define DEBUG_INFO 0x00000040 // Verbose
|
||||
#define DEBUG_VARIABLE 0x00000100 // Variable
|
||||
#define DEBUG_BM 0x00000400 // Boot Manager
|
||||
#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
|
||||
#define DEBUG_NET 0x00004000 // SNI Driver
|
||||
#define DEBUG_UNDI 0x00010000 // UNDI Driver
|
||||
#define DEBUG_LOADFILE 0x00020000 // UNDI Driver
|
||||
#define DEBUG_EVENT 0x00080000 // Event messages
|
||||
#define DEBUG_ERROR 0x80000000 // Error
|
||||
|
||||
//
|
||||
// Aliases of debug message mask bits
|
||||
//
|
||||
#define EFI_D_INIT DEBUG_INIT
|
||||
#define EFI_D_WARN DEBUG_WARN
|
||||
#define EFI_D_LOAD DEBUG_LOAD
|
||||
#define EFI_D_FS DEBUG_FS
|
||||
#define EFI_D_POOL DEBUG_POOL
|
||||
#define EFI_D_PAGE DEBUG_PAGE
|
||||
#define EFI_D_INFO DEBUG_INFO
|
||||
#define EFI_D_VARIABLE DEBUG_VARIABLE
|
||||
#define EFI_D_BM DEBUG_BM
|
||||
#define EFI_D_BLKIO DEBUG_BLKIO
|
||||
#define EFI_D_NET DEBUG_NET
|
||||
#define EFI_D_UNDI DEBUG_UNDI
|
||||
#define EFI_D_LOADFILE DEBUG_LOADFILE
|
||||
#define EFI_D_EVENT DEBUG_EVENT
|
||||
#define EFI_D_ERROR DEBUG_ERROR
|
||||
|
||||
/**
|
||||
|
||||
Prints a debug message to the debug output device if the specified error level is enabled.
|
||||
|
||||
If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print
|
||||
the message specified by Format and the associated variable argument list to
|
||||
the debug output device.
|
||||
|
||||
If Format is NULL, then ASSERT().
|
||||
|
||||
@param ErrorLevel The error level of the debug message.
|
||||
@param Format Format string for the debug message to print.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugPrint (
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST CHAR8 *Format,
|
||||
...
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Prints an assert message containing a filename, line number, and description.
|
||||
This may be followed by a breakpoint or a dead loop.
|
||||
|
||||
Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
|
||||
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
|
||||
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
|
||||
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
|
||||
CpuDeadLoop() is called. If neither of these bits are set, then this function
|
||||
returns immediately after the message is printed to the debug output device.
|
||||
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
|
||||
processing another DebugAssert(), then DebugAssert() must return immediately.
|
||||
|
||||
If FileName is NULL, then a <FileName> string of ?NULL) Filename?is printed.
|
||||
|
||||
If Description is NULL, then a <Description> string of ?NULL) Description?is printed.
|
||||
|
||||
@param FileName Pointer to the name of the source file that generated the assert condition.
|
||||
@param LineNumber The line number in the source file that generated the assert condition
|
||||
@param Description Pointer to the description of the assert condition.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAssert (
|
||||
IN CONST CHAR8 *FileName,
|
||||
IN UINTN LineNumber,
|
||||
IN CONST CHAR8 *Description
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the value specified by
|
||||
PcdDebugClearMemoryValue, and returns Buffer.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
If Length is greater than (MAX_ADDRESS ?Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.
|
||||
@param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
DebugClearMemory (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns TRUE if ASSERT() macros are enabled.
|
||||
|
||||
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
|
||||
PcdDebugProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
|
||||
@retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DebugAssertEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns TRUE if DEBUG()macros are enabled.
|
||||
|
||||
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
|
||||
PcdDebugProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
|
||||
@retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DebugPrintEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns TRUE if DEBUG_CODE()macros are enabled.
|
||||
|
||||
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
|
||||
PcdDebugProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
|
||||
@retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DebugCodeEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
|
||||
|
||||
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
|
||||
PcdDebugProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
|
||||
@retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DebugClearMemoryEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Internal worker macro that calls DebugAssert().
|
||||
|
||||
This macro calls DebugAssert() passing in the filename, line number, and
|
||||
expression that evailated to FALSE.
|
||||
|
||||
@param Expression Boolean expression that evailated to FALSE
|
||||
|
||||
**/
|
||||
#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Internal worker macro that calls DebugPrint().
|
||||
|
||||
This macro calls DebugPrint() passing in the debug error level, a format
|
||||
string, and a variable argument list.
|
||||
|
||||
@param Expression Expression containing an error level, a format string,
|
||||
and a variable argument list based on the format string.
|
||||
|
||||
**/
|
||||
#define _DEBUG(Expression) DebugPrint Expression
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugAssert() if a expression evaluates to FALSE.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro evaluates the Boolean expression specified by Expression. If
|
||||
Expression evaluates to FALSE, then DebugAssert() is called passing in the
|
||||
source filename, source line number, and Expression.
|
||||
|
||||
@param Expression Boolean expression
|
||||
|
||||
**/
|
||||
#define ASSERT(Expression) \
|
||||
do { \
|
||||
if (DebugAssertEnabled ()) { \
|
||||
if (!(Expression)) { \
|
||||
_ASSERT (Expression); \
|
||||
} \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugPrint().
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro passes Expression to DebugPrint().
|
||||
|
||||
@param Expression Expression containing an error level, a format string,
|
||||
and a variable argument list based on the format string.
|
||||
|
||||
|
||||
**/
|
||||
#define DEBUG(Expression) \
|
||||
do { \
|
||||
if (DebugPrintEnabled ()) { \
|
||||
_DEBUG (Expression); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugAssert() if an EFI_STATUS evaluates to an error code.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro evaluates the EFI_STATUS value specified by StatusParameter.
|
||||
If StatusParameter is an error code, then DebugAssert() is called passing in
|
||||
the source filename, source line number, and StatusParameter.
|
||||
|
||||
@param StatusParameter EFI_STATUS value to evaluate.
|
||||
|
||||
**/
|
||||
#define ASSERT_EFI_ERROR(StatusParameter) \
|
||||
do { \
|
||||
if (DebugAssertEnabled ()) { \
|
||||
if (EFI_ERROR (StatusParameter)) { \
|
||||
DEBUG ((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", StatusParameter)); \
|
||||
_ASSERT (!EFI_ERROR (StatusParameter)); \
|
||||
} \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugAssert() if a protocol is already installed in the
|
||||
handle database.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear,
|
||||
then return.
|
||||
|
||||
If Handle is NULL, then a check is made to see if the protocol specified by Guid
|
||||
is present on any handle in the handle database. If Handle is not NULL, then
|
||||
a check is made to see if the protocol specified by Guid is present on the
|
||||
handle specified by Handle. If the check finds the protocol, then DebugAssert()
|
||||
is called passing in the source filename, source line number, and Guid.
|
||||
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param Handle The handle to check for the protocol. This is an optional
|
||||
parameter that may be NULL. If it is NULL, then the entire
|
||||
handle database is searched.
|
||||
|
||||
@param Guid Pointer to a protocol GUID.
|
||||
|
||||
**/
|
||||
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
|
||||
do { \
|
||||
if (DebugAssertEnabled ()) { \
|
||||
VOID *Instance; \
|
||||
ASSERT (Guid != NULL); \
|
||||
if (Handle == NULL) { \
|
||||
if (!EFI_ERROR (gBS->LocateProtocol ((EFI_GUID *)Guid, NULL, &Instance))) { \
|
||||
_ASSERT (Guid already installed in database); \
|
||||
} \
|
||||
} else { \
|
||||
if (!EFI_ERROR (gBS->HandleProtocol (Handle, (EFI_GUID *)Guid, &Instance))) { \
|
||||
_ASSERT (Guid already installed on Handle); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
Macro that marks the beginning of debug source code.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro marks the beginning of source code that is included in a module.
|
||||
Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END()
|
||||
are not included in a module.
|
||||
|
||||
**/
|
||||
#define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that marks the end of debug source code.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro marks the end of source code that is included in a module.
|
||||
Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END()
|
||||
are not included in a module.
|
||||
|
||||
**/
|
||||
#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that declares a section of debug source code.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then the source code specified by Expression is included in a module.
|
||||
Otherwise, the source specified by Expression is not included in a module.
|
||||
|
||||
**/
|
||||
#define DEBUG_CODE(Expression) \
|
||||
DEBUG_CODE_BEGIN (); \
|
||||
Expression \
|
||||
DEBUG_CODE_END ()
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugClearMemory() to clear a buffer to a default value.
|
||||
|
||||
If the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro calls DebugClearMemory() passing in Address and Length.
|
||||
|
||||
@param Address Pointer to a buffer.
|
||||
@param Length The number of bytes in the buffer to set.
|
||||
|
||||
**/
|
||||
#define DEBUG_CLEAR_MEMORY(Address, Length) \
|
||||
do { \
|
||||
if (DebugClearMemoryEnabled ()) { \
|
||||
DebugClearMemory (Address, Length); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugAssert() if the containing record does not have a
|
||||
matching signature. If the signatures matches, then a pointer to the data
|
||||
structure that contains a specified field of that data structure is returned.
|
||||
This is a light weight method hide information by placing a public data
|
||||
structure inside a larger private data structure and using a pointer to the
|
||||
public data structure to retrieve a pointer to the private data structure.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear,
|
||||
then this macro computes the offset, in bytes, of field specified by Field
|
||||
from the beginning of the data structure specified by TYPE. This offset is
|
||||
subtracted from Record, and is used to return a pointer to a data structure
|
||||
of the type specified by TYPE.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro computes the offset, in bytes, of field specified by Field from
|
||||
the beginning of the data structure specified by TYPE. This offset is
|
||||
subtracted from Record, and is used to compute a pointer to a data structure of
|
||||
the type specified by TYPE. The Signature field of the data structure specified
|
||||
by TYPE is compared to TestSignature. If the signatures match, then a pointer
|
||||
to the pointer to a data structure of the type specified by TYPE is returned.
|
||||
If the signatures do not match, then DebugAssert() is called with a description
|
||||
of "CR has a bad signature" and Record is returned.
|
||||
|
||||
If the data type specified by TYPE does not contain the field specified by Field,
|
||||
then the module will not compile.
|
||||
|
||||
If TYPE does not contain a field called Signature, then the module will not
|
||||
compile.
|
||||
|
||||
@param Record Pointer to the field specified by Field within a data
|
||||
structure of type TYPE.
|
||||
|
||||
@param TYPE The name of the data structure type to return This
|
||||
data structure must contain the field specified by Field.
|
||||
|
||||
@param Field The name of the field in the data structure specified
|
||||
by TYPE to which Record points.
|
||||
|
||||
@param TestSignature The 32-bit signature value to match.
|
||||
|
||||
**/
|
||||
#define CR(Record, TYPE, Field, TestSignature) \
|
||||
(DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
|
||||
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
|
||||
_CR (Record, TYPE, Field)
|
||||
|
||||
#endif
|
251
MdePkg/Include/Library/DevicePathLib.h
Normal file
251
MdePkg/Include/Library/DevicePathLib.h
Normal file
@ -0,0 +1,251 @@
|
||||
/** @file
|
||||
Entry point to a DXE Boot Services Driver
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: DevicePathLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __DEVICE_PATH_LIB_H__
|
||||
#define __DEVICE_PATH_LIB_H__
|
||||
|
||||
/**
|
||||
Returns the size of a device path in bytes.
|
||||
|
||||
This function returns the size, in bytes, of the device path data structure specified by
|
||||
DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@return The size of a device path in bytes.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
GetDevicePathSize (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a new device path by appending a second device path to a first device path.
|
||||
|
||||
This function allocates space for a new copy of the device path specified by DevicePath. If
|
||||
DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the
|
||||
contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer
|
||||
is returned. Otherwise, NULL is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@return A pointer to the duplicated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DuplicateDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a new device path by appending a second device path to a first device path.
|
||||
|
||||
This function creates a new device path by appending a copy of SecondDevicePath to a copy of
|
||||
FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from
|
||||
SecondDevicePath is retained. The newly created device path is returned.
|
||||
If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned.
|
||||
If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned.
|
||||
If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned.
|
||||
If there is not enough memory for the newly allocated buffer, then NULL is returned.
|
||||
The memory for the new device path is allocated from EFI boot services memory. It is the
|
||||
responsibility of the caller to free the memory allocated.
|
||||
|
||||
@param FirstDevicePath A pointer to a device path data structure.
|
||||
@param SecondDevicePath A pointer to a device path data structure.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a new path by appending the device node to the device path.
|
||||
|
||||
This function creates a new device path by appending a copy of the device node specified by
|
||||
DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.
|
||||
The end-of-device-path device node is moved after the end of the appended device node.
|
||||
If DevicePath is NULL, then NULL is returned.
|
||||
If DevicePathNode is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
@param DevicePathNode A pointer to a single device path node.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePathNode (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a new device path by appending the specified device path instance to the specified device
|
||||
path.
|
||||
|
||||
This function creates a new device path by appending a copy of the device path instance specified
|
||||
by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.
|
||||
The end-of-device-path device node is moved after the end of the appended device path instance
|
||||
and a new end-of-device-path-instance node is inserted between.
|
||||
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
|
||||
If DevicePathInstance is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
@param DevicePathInstance A pointer to a device path instance.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePathInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||
instance.
|
||||
|
||||
This function creates a copy of the current device path instance. It also updates DevicePath to
|
||||
point to the next device path instance in the device path (or NULL if no more) and updates Size
|
||||
to hold the size of the device path instance copy.
|
||||
If DevicePath is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
If Size is NULL, then ASSERT().
|
||||
|
||||
@param DevicePath On input, this holds the pointer to the current device path
|
||||
instance. On output, this holds the pointer to the next device
|
||||
path instance or NULL if there are no more device path
|
||||
instances in the device path pointer to a device path data
|
||||
structure.
|
||||
@param Size On output, this holds the size of the device path instance, in
|
||||
bytes or zero, if DevicePath is NULL.
|
||||
|
||||
@return A pointer to the current device path instance.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
GetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||
instance.
|
||||
|
||||
This function creates a new device node in a newly allocated buffer of size NodeLength and
|
||||
initializes the device path node header with NodeType and NodeSubType. The new device path node
|
||||
is returned.
|
||||
If NodeLength is smaller than a device path header, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param NodeType The device node type for the new device node.
|
||||
@param NodeSubType The device node sub-type for the new device node.
|
||||
@param NodeLength The length of the new device node.
|
||||
|
||||
@return The new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
CreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
);
|
||||
|
||||
/**
|
||||
Determines if a device path is single or multi-instance.
|
||||
|
||||
This function returns TRUE if the device path specified by DevicePath is multi-instance.
|
||||
Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@retval TRUE DevicePath is multi-instance.
|
||||
@retval FALSE DevicePath is not multi-instance or DevicePath is NULL.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
IsDevicePathMultiInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the device path protocol from a handle.
|
||||
|
||||
This function returns the device path protocol from the handle specified by Handle. If Handle is
|
||||
NULL or Handle does not contain a device path protocol, then NULL is returned.
|
||||
|
||||
@param Handle The handle from which to retrieve the device path protocol.
|
||||
|
||||
@return The device path protocol from the handle specified by Handle.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DevicePathFromHandle (
|
||||
IN EFI_HANDLE Handle
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a device path for a file and appends it to an existing device path.
|
||||
|
||||
If Device is a valid device handle that contains a device path protocol, then a device path for
|
||||
the file specified by FileName is allocated and appended to the device path associated with the
|
||||
handle Device. The allocated device path is returned. If Device is NULL or Device is a handle
|
||||
that does not support the device path protocol, then a device path containing a single device
|
||||
path node for the file specified by FileName is allocated and returned.
|
||||
If FileName is NULL, then ASSERT().
|
||||
|
||||
@param Device A pointer to a device handle. This parameter is optional and
|
||||
may be NULL.
|
||||
@param FileName A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return The allocated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
FileDevicePath (
|
||||
IN EFI_HANDLE Device, OPTIONAL
|
||||
IN CONST CHAR16 *FileName
|
||||
);
|
||||
|
||||
#endif
|
90
MdePkg/Include/Library/DxeCoreEntryPoint.h
Normal file
90
MdePkg/Include/Library/DxeCoreEntryPoint.h
Normal file
@ -0,0 +1,90 @@
|
||||
/** @file
|
||||
Entry point to the DXE Core
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MODULE_ENTRY_POINT_H__
|
||||
#define __MODULE_ENTRY_POINT_H__
|
||||
|
||||
//
|
||||
// Declare the cache of copy of HobList.
|
||||
//
|
||||
extern VOID *gHobList;
|
||||
|
||||
|
||||
/**
|
||||
Enrty point to DXE core.
|
||||
|
||||
@param HobStart Pointer of HobList.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
_ModuleEntryPoint (
|
||||
IN VOID *HobStart
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Wrapper of enrty point to DXE CORE.
|
||||
|
||||
@param HobStart Pointer of HobList.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiMain (
|
||||
IN VOID *HobStart
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call constructs for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryConstructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Call destructors for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryDestructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Call the list of driver entry points. Automatics Generated by tool.
|
||||
|
||||
@param HobStart Pointer to HobList.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessModuleEntryPointList (
|
||||
IN VOID *HobStart
|
||||
);
|
||||
|
||||
#endif
|
26
MdePkg/Include/Library/DxeServicesTableLib.h
Normal file
26
MdePkg/Include/Library/DxeServicesTableLib.h
Normal file
@ -0,0 +1,26 @@
|
||||
/** @file
|
||||
Library that provides a global pointer to the DXE Services Table
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: DxeServicesTableLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __DXE_SERVICES_TABLE_LIB_H__
|
||||
#define __DXE_SERVICES_TABLE_LIB_H__
|
||||
|
||||
//
|
||||
// Cache copy of the DXE Services Table
|
||||
//
|
||||
extern EFI_DXE_SERVICES *gDS;
|
||||
|
||||
#endif
|
||||
|
140
MdePkg/Include/Library/DxeSmmDriverEntryPoint.h
Normal file
140
MdePkg/Include/Library/DxeSmmDriverEntryPoint.h
Normal file
@ -0,0 +1,140 @@
|
||||
/** @file
|
||||
Entry point to a DXE SMM Driver
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MODULE_ENTRY_POINT_H__
|
||||
#define __MODULE_ENTRY_POINT_H__
|
||||
|
||||
//
|
||||
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
|
||||
//
|
||||
extern const UINT32 _gUefiDriverRevision;
|
||||
|
||||
//
|
||||
// Declare the number of entry points in the image.
|
||||
//
|
||||
extern const UINT8 _gDriverEntryPointCount;
|
||||
|
||||
//
|
||||
// Declare the number of unload handler in the image.
|
||||
//
|
||||
extern const UINT8 _gDriverUnloadImageCount;
|
||||
|
||||
/**
|
||||
Enrty point to DXE SMM Driver.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS One or more of the drivers returned a success code.
|
||||
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
_ModuleEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Enrty point wrapper of DXE SMM Driver.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS One or more of the drivers returned a success code.
|
||||
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiMain (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Computes the cummulative return status for the driver entry point and perform
|
||||
a long jump back into DriverEntryPoint().
|
||||
|
||||
@param Status Status returned by the driver that is exiting.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ExitDriver (
|
||||
IN EFI_STATUS Status
|
||||
);
|
||||
|
||||
/**
|
||||
Call constructs for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryConstructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Call destructors for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryDestructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call the list of driver entry points. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@return Status returned by entry points of drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleEntryPointList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call the unload handlers for all the modules. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
|
||||
@return Status returned by unload handlers of drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleUnloadList (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
#endif
|
250
MdePkg/Include/Library/FvbServiceLib.h
Normal file
250
MdePkg/Include/Library/FvbServiceLib.h
Normal file
@ -0,0 +1,250 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
EdkFvbServiceLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
#ifndef __EDK_FVB_SERVICE_LIB_H__
|
||||
#define __EDK_FVB_SERVICE_LIB_H__
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbReadBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Reads specified number of bytes into a buffer from the specified block
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance to be read from
|
||||
Lba - The logical block address to be read from
|
||||
Offset - Offset into the block at which to begin reading
|
||||
NumBytes - Pointer that on input contains the total size of
|
||||
the buffer. On output, it contains the total number
|
||||
of bytes read
|
||||
Buffer - Pointer to a caller allocated buffer that will be
|
||||
used to hold the data read
|
||||
|
||||
Returns:
|
||||
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbWriteBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Writes specified number of bytes from the input buffer to the block
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance to be written to
|
||||
Lba - The starting logical block index to write to
|
||||
Offset - Offset into the block at which to begin writing
|
||||
NumBytes - Pointer that on input contains the total size of
|
||||
the buffer. On output, it contains the total number
|
||||
of bytes actually written
|
||||
Buffer - Pointer to a caller allocated buffer that contains
|
||||
the source for the write
|
||||
|
||||
Returns:
|
||||
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbEraseBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Erases and initializes a firmware volume block
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance to be erased
|
||||
Lba - The logical block index to be erased
|
||||
|
||||
Returns:
|
||||
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbGetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_FVB_ATTRIBUTES *Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves attributes, insures positive polarity of attribute bits, returns
|
||||
resulting attributes in output parameter
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance whose attributes is going to be
|
||||
returned
|
||||
Attributes - Output buffer which contains attributes
|
||||
|
||||
Returns:
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbSetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
IN EFI_FVB_ATTRIBUTES Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Modifies the current settings of the firmware volume according to the
|
||||
input parameter, and returns the new setting of the volume
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance whose attributes is going to be
|
||||
modified
|
||||
Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES
|
||||
containing the desired firmware volume settings.
|
||||
On successful return, it contains the new settings
|
||||
of the firmware volume
|
||||
|
||||
Returns:
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbGetPhysicalAddress (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_PHYSICAL_ADDRESS *BaseAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves the physical address of a memory mapped FV
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance whose base address is going to be
|
||||
returned
|
||||
BaseAddress - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
|
||||
that on successful return, contains the base address
|
||||
of the firmware volume.
|
||||
|
||||
Returns:
|
||||
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbGetBlockSize (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
OUT UINTN *BlockSize,
|
||||
OUT UINTN *NumOfBlocks
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieve the size of a logical block
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance whose block size is going to be
|
||||
returned
|
||||
Lba - Indicates which block to return the size for.
|
||||
BlockSize - A pointer to a caller allocated UINTN in which
|
||||
the size of the block is returned
|
||||
NumOfBlocks - a pointer to a caller allocated UINTN in which the
|
||||
number of consecutive blocks starting with Lba is
|
||||
returned. All blocks in this range have a size of
|
||||
BlockSize
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The firmware volume was read successfully and
|
||||
contents are in Buffer
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EfiFvbEraseCustomBlockRange (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN OffsetStartLba,
|
||||
IN EFI_LBA LastLba,
|
||||
IN UINTN OffsetLastLba
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Erases and initializes a specified range of a firmware volume
|
||||
|
||||
Arguments:
|
||||
Instance - The FV instance to be erased
|
||||
StartLba - The starting logical block index to be erased
|
||||
OffsetStartLba - Offset into the starting block at which to
|
||||
begin erasing
|
||||
LastLba - The last logical block index to be erased
|
||||
OffsetLastLba - Offset into the last block at which to end erasing
|
||||
|
||||
Returns:
|
||||
|
||||
Status code
|
||||
|
||||
EFI_INVALID_PARAMETER - invalid parameter
|
||||
|
||||
EFI_UNSUPPORTED - not support
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
46
MdePkg/Include/Library/HiiLib.h
Normal file
46
MdePkg/Include/Library/HiiLib.h
Normal file
@ -0,0 +1,46 @@
|
||||
/** @file
|
||||
Public include file for the HII Library
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: HiiLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __HII_LIB_H__
|
||||
#define __HII_LIB_H__
|
||||
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
|
||||
/**
|
||||
This function allocates pool for an EFI_HII_PACKAGES structure
|
||||
with enough space for the variable argument list of package pointers.
|
||||
The allocated structure is initialized using NumberOfPackages, Guid,
|
||||
and the variable length argument list of package pointers.
|
||||
|
||||
@param NumberOfPackages The number of HII packages to prepare.
|
||||
@param Guid Package GUID.
|
||||
|
||||
@return
|
||||
The allocated and initialized packages.
|
||||
|
||||
**/
|
||||
EFI_HII_PACKAGE_LIST_HEADER*
|
||||
EFIAPI
|
||||
PreparePackages (
|
||||
IN UINTN NumberOfPackages,
|
||||
IN CONST EFI_GUID *Guid OPTIONAL,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
#endif
|
371
MdePkg/Include/Library/HobLib.h
Normal file
371
MdePkg/Include/Library/HobLib.h
Normal file
@ -0,0 +1,371 @@
|
||||
/** @file
|
||||
Public include file for the HOB Library
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: HobLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __HOB_LIB_H__
|
||||
#define __HOB_LIB_H__
|
||||
|
||||
/**
|
||||
Returns the pointer to the HOB list.
|
||||
|
||||
This function returns the pointer to first HOB in the list.
|
||||
|
||||
@return The pointer to the HOB list.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetHobList (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Returns the next instance of a HOB type from the starting HOB.
|
||||
|
||||
This function searches the first instance of a HOB type from the starting HOB pointer.
|
||||
If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
|
||||
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
|
||||
unconditionally: it returns HobStart back if HobStart itself meets the requirement;
|
||||
caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
|
||||
If HobStart is NULL, then ASSERT().
|
||||
|
||||
@param Type The HOB type to return.
|
||||
@param HobStart The starting HOB pointer to search from.
|
||||
|
||||
@return The next instance of a HOB type from the starting HOB.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetNextHob (
|
||||
IN UINT16 Type,
|
||||
IN CONST VOID *HobStart
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Returns the first instance of a HOB type among the whole HOB list.
|
||||
|
||||
This function searches the first instance of a HOB type among the whole HOB list.
|
||||
If there does not exist such HOB type in the HOB list, it will return NULL.
|
||||
|
||||
@param Type The HOB type to return.
|
||||
|
||||
@return The next instance of a HOB type from the starting HOB.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetFirstHob (
|
||||
IN UINT16 Type
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
This function searches the first instance of a HOB from the starting HOB pointer.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
|
||||
to extract the data section and its size info respectively.
|
||||
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
|
||||
unconditionally: it returns HobStart back if HobStart itself meets the requirement;
|
||||
caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If HobStart is NULL, then ASSERT().
|
||||
|
||||
@param Guid The GUID to match with in the HOB list.
|
||||
@param HobStart A pointer to a Guid.
|
||||
|
||||
@return The next instance of the matched GUID HOB from the starting HOB.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetNextGuidHob (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN CONST VOID *HobStart
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
This function searches the first instance of a HOB among the whole HOB list.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
|
||||
to extract the data section and its size info respectively.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param Guid The GUID to match with in the HOB list.
|
||||
|
||||
@return The first instance of the matched GUID HOB among the whole HOB list.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetFirstGuidHob (
|
||||
IN CONST EFI_GUID *Guid
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Get the Boot Mode from the HOB list.
|
||||
|
||||
This function returns the system boot mode information from the
|
||||
PHIT HOB in HOB list.
|
||||
|
||||
@param VOID
|
||||
|
||||
@return The Boot Mode.
|
||||
|
||||
**/
|
||||
EFI_BOOT_MODE
|
||||
EFIAPI
|
||||
GetBootModeHob (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a HOB for a loaded PE32 module.
|
||||
|
||||
This function builds a HOB for a loaded PE32 module.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If ModuleName is NULL, then ASSERT().
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param ModuleName The GUID File Name of the module.
|
||||
@param MemoryAllocationModule The 64 bit physical address of the module.
|
||||
@param ModuleLength The length of the module in bytes.
|
||||
@param EntryPoint The 64 bit physical address of the module entry point.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildModuleHob (
|
||||
IN CONST EFI_GUID *ModuleName,
|
||||
IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
|
||||
IN UINT64 ModuleLength,
|
||||
IN EFI_PHYSICAL_ADDRESS EntryPoint
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a HOB that describes a chunk of system memory.
|
||||
|
||||
This function builds a HOB that describes a chunk of system memory.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param ResourceType The type of resource described by this HOB.
|
||||
@param ResourceAttribute The resource attributes of the memory described by this HOB.
|
||||
@param PhysicalStart The 64 bit physical address of memory described by this HOB.
|
||||
@param NumberOfBytes The length of the memory described by this HOB in bytes.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildResourceDescriptorHob (
|
||||
IN EFI_RESOURCE_TYPE ResourceType,
|
||||
IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
|
||||
IN EFI_PHYSICAL_ADDRESS PhysicalStart,
|
||||
IN UINT64 NumberOfBytes
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a GUID HOB with a certain data length.
|
||||
|
||||
This function builds a customized HOB tagged with a GUID for identification
|
||||
and returns the start address of GUID HOB data so that caller can fill the customized data.
|
||||
The HOB Header and Name field is already stripped.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
|
||||
|
||||
@param Guid The GUID to tag the customized HOB.
|
||||
@param DataLength The size of the data payload for the GUID HOB.
|
||||
|
||||
@return The start address of GUID HOB data.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
BuildGuidHob (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN DataLength
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Copies a data buffer to a newly-built HOB.
|
||||
|
||||
This function builds a customized HOB tagged with a GUID for identification,
|
||||
copies the input data to the HOB data field and returns the start address of the GUID HOB data.
|
||||
The HOB Header and Name field is already stripped.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If Data is NULL and DataLength > 0, then ASSERT().
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
|
||||
|
||||
@param Guid The GUID to tag the customized HOB.
|
||||
@param Data The data to be copied into the data field of the GUID HOB.
|
||||
@param DataLength The size of the data payload for the GUID HOB.
|
||||
|
||||
@return The start address of GUID HOB data.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
BuildGuidDataHob (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN VOID *Data,
|
||||
IN UINTN DataLength
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a Firmware Volume HOB.
|
||||
|
||||
This function builds a Firmware Volume HOB.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param BaseAddress The base address of the Firmware Volume.
|
||||
@param Length The size of the Firmware Volume in bytes.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildFvHob (
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a Capsule Volume HOB.
|
||||
|
||||
This function builds a Capsule Volume HOB.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param BaseAddress The base address of the Capsule Volume.
|
||||
@param Length The size of the Capsule Volume in bytes.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildCvHob (
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a HOB for the CPU.
|
||||
|
||||
This function builds a HOB for the CPU.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param SizeOfMemorySpace The maximum physical memory addressability of the processor.
|
||||
@param SizeOfIoSpace The maximum physical I/O addressability of the processor.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildCpuHob (
|
||||
IN UINT8 SizeOfMemorySpace,
|
||||
IN UINT8 SizeOfIoSpace
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a HOB for the Stack.
|
||||
|
||||
This function builds a HOB for the stack.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param BaseAddress The 64 bit physical address of the Stack.
|
||||
@param Length The length of the stack in bytes.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildStackHob (
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a HOB for the BSP store.
|
||||
|
||||
This function builds a HOB for BSP store.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param BaseAddress The 64 bit physical address of the BSP.
|
||||
@param Length The length of the BSP store in bytes.
|
||||
@param MemoryType Type of memory allocated by this HOB.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildBspStoreHob (
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length,
|
||||
IN EFI_MEMORY_TYPE MemoryType
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Builds a HOB for the memory allocation.
|
||||
|
||||
This function builds a HOB for the memory allocation.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
If there is no additional space for HOB creation, then ASSERT().
|
||||
|
||||
@param BaseAddress The 64 bit physical address of the memory.
|
||||
@param Length The length of the memory allocation in bytes.
|
||||
@param MemoryType Type of memory allocated by this HOB.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildMemoryAllocationHob (
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length,
|
||||
IN EFI_MEMORY_TYPE MemoryType
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
1270
MdePkg/Include/Library/IfrSupportLib.h
Normal file
1270
MdePkg/Include/Library/IfrSupportLib.h
Normal file
File diff suppressed because it is too large
Load Diff
2548
MdePkg/Include/Library/IoLib.h
Normal file
2548
MdePkg/Include/Library/IoLib.h
Normal file
File diff suppressed because it is too large
Load Diff
622
MdePkg/Include/Library/MemoryAllocationLib.h
Normal file
622
MdePkg/Include/Library/MemoryAllocationLib.h
Normal file
@ -0,0 +1,622 @@
|
||||
/** @file
|
||||
Memory Allocation Library Services
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: MemoryAllocationLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MEMORY_ALLOCATION_LIB_H__
|
||||
#define __MEMORY_ALLOCATION_LIB_H__
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiBootServicesData.
|
||||
|
||||
Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
|
||||
allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
|
||||
is returned. If there is not enough memory remaining to satisfy the request, then NULL is
|
||||
returned.
|
||||
|
||||
@param Pages The number of 4 KB pages to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocatePages (
|
||||
IN UINTN Pages
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiRuntimeServicesData.
|
||||
|
||||
Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
|
||||
allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
|
||||
is returned. If there is not enough memory remaining to satisfy the request, then NULL is
|
||||
returned.
|
||||
|
||||
@param Pages The number of 4 KB pages to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateRuntimePages (
|
||||
IN UINTN Pages
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiReservedMemoryType.
|
||||
|
||||
Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
|
||||
allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
|
||||
is returned. If there is not enough memory remaining to satisfy the request, then NULL is
|
||||
returned.
|
||||
|
||||
@param Pages The number of 4 KB pages to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateReservedPages (
|
||||
IN UINTN Pages
|
||||
);
|
||||
|
||||
/**
|
||||
Frees one or more 4KB pages that were previously allocated with one of the page allocation
|
||||
functions in the Memory Allocation Library.
|
||||
|
||||
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
|
||||
must have been allocated on a previous call to the page allocation services of the Memory
|
||||
Allocation Library.
|
||||
If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
|
||||
then ASSERT().
|
||||
If Pages is zero, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the buffer of pages to free.
|
||||
@param Pages The number of 4 KB pages to free.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
FreePages (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Pages
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
|
||||
|
||||
Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
|
||||
returned. If there is not enough memory at the specified alignment remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param Pages The number of 4 KB pages to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedPages (
|
||||
IN UINTN Pages,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
|
||||
|
||||
Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
|
||||
returned. If there is not enough memory at the specified alignment remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param Pages The number of 4 KB pages to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedRuntimePages (
|
||||
IN UINTN Pages,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
|
||||
|
||||
Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
|
||||
returned. If there is not enough memory at the specified alignment remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param Pages The number of 4 KB pages to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedReservedPages (
|
||||
IN UINTN Pages,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Frees one or more 4KB pages that were previously allocated with one of the aligned page
|
||||
allocation functions in the Memory Allocation Library.
|
||||
|
||||
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
|
||||
must have been allocated on a previous call to the aligned page allocation services of the Memory
|
||||
Allocation Library.
|
||||
If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
|
||||
Library, then ASSERT().
|
||||
If Pages is zero, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the buffer of pages to free.
|
||||
@param Pages The number of 4 KB pages to free.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
FreeAlignedPages (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Pages
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
|
||||
pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
|
||||
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiRuntimeServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
|
||||
a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
|
||||
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateRuntimePool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfieservedMemoryType.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType and returns
|
||||
a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
|
||||
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateReservedPool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
|
||||
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
|
||||
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiRuntimeServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
|
||||
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
|
||||
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateRuntimeZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiReservedMemoryType.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
|
||||
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
|
||||
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateReservedZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a buffer to an allocated buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
|
||||
AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
|
||||
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
|
||||
is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
@param Buffer The buffer to copy to the allocated buffer.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateCopyPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN CONST VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
|
||||
AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
|
||||
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
|
||||
is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
@param Buffer The buffer to copy to the allocated buffer.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateRuntimeCopyPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN CONST VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
|
||||
AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
|
||||
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
|
||||
is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
@param Buffer The buffer to copy to the allocated buffer.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateReservedCopyPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN CONST VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Frees a buffer that was previously allocated with one of the pool allocation functions in the
|
||||
Memory Allocation Library.
|
||||
|
||||
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
|
||||
pool allocation services of the Memory Allocation Library.
|
||||
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
|
||||
then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the buffer to free.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
FreePool (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiBootServicesData at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
|
||||
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
|
||||
alignment remaining to satisfy the request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiRuntimeServicesData at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
|
||||
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
|
||||
alignment remaining to satisfy the request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedRuntimePool (
|
||||
IN UINTN AllocationSize,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfieservedMemoryType at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
|
||||
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
|
||||
alignment remaining to satisfy the request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedReservedPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiBootServicesData at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an
|
||||
alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
|
||||
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
|
||||
is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
|
||||
returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedZeroPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiRuntimeServicesData at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an
|
||||
alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
|
||||
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
|
||||
is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
|
||||
returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedRuntimeZeroPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfieservedMemoryType at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an
|
||||
alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
|
||||
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
|
||||
is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
|
||||
returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedReservedZeroPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData type with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
|
||||
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
|
||||
alignment remaining to satisfy the request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Buffer The buffer to copy to the allocated buffer.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedCopyPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a buffer to an allocated buffer of type EfiRuntimeServicesData at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData type with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
|
||||
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
|
||||
alignment remaining to satisfy the request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Buffer The buffer to copy to the allocated buffer.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedRuntimeCopyPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Copies a buffer to an allocated buffer of type EfiReservedMemoryType at a specified alignment.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType type with an
|
||||
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
|
||||
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
|
||||
alignment remaining to satisfy the request, then NULL is returned.
|
||||
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
@param Buffer The buffer to copy to the allocated buffer.
|
||||
@param Alignment The requested alignment of the allocation. Must be a power of two.
|
||||
If Alignment is zero, then byte alignment is used.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateAlignedReservedCopyPool (
|
||||
IN UINTN AllocationSize,
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Alignment
|
||||
);
|
||||
|
||||
/**
|
||||
Frees a buffer that was previously allocated with one of the aligned pool allocation functions
|
||||
in the Memory Allocation Library.
|
||||
|
||||
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
|
||||
aligned pool allocation services of the Memory Allocation Library.
|
||||
If Buffer was not allocated with an aligned pool allocation function in the Memory Allocation
|
||||
Library, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the buffer to free.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
FreeAlignedPool (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
#endif
|
61
MdePkg/Include/Library/PalCallLib.h
Normal file
61
MdePkg/Include/Library/PalCallLib.h
Normal file
@ -0,0 +1,61 @@
|
||||
/** @file
|
||||
PAL Call Services
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PalCallLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PAL_CALL_LIB_H__
|
||||
#define __PAL_CALL_LIB_H__
|
||||
|
||||
|
||||
#include <Base.h>
|
||||
//
|
||||
// PAL_CALL_RETURN
|
||||
//
|
||||
|
||||
/**
|
||||
Makes a PAL procedure call.
|
||||
|
||||
This is a wrapper function to make a PAL procedure call. Based on the Index value,
|
||||
this API will make static or stacked PAL call. Architected procedures may be designated
|
||||
as required or optional. If a PAL procedure is specified as optional, a unique return
|
||||
code of 0xFFFFFFFFFFFFFFFF is returned in the Status field of the PAL_CALL_RETURN structure.
|
||||
This indicates that the procedure is not present in this PAL implementation. It is the
|
||||
caller¡¯s responsibility to check for this return code after calling any optional PAL
|
||||
procedure. No parameter checking is performed on the 4 input parameters, but there are
|
||||
some common rules that the caller should follow when making a PAL call. Any address
|
||||
passed to PAL as buffers for return parameters must be 8-byte aligned. Unaligned addresses
|
||||
may cause undefined results. For those parameters defined as reserved or some fields
|
||||
defined as reserved must be zero filled or the invalid argument return value may be
|
||||
returned or undefined result may occur during the execution of the procedure.
|
||||
This function is only available on IPF.
|
||||
|
||||
@param Index - The PAL procedure Index number.
|
||||
@param Arg2 - The 2nd parameter for PAL procedure calls.
|
||||
@param Arg3 - The 3rd parameter for PAL procedure calls.
|
||||
@param Arg4 - The 4th parameter for PAL procedure calls.
|
||||
|
||||
@return structure returned from the PAL Call procedure, including the status and return value.
|
||||
|
||||
**/
|
||||
PAL_CALL_RETURN
|
||||
EFIAPI
|
||||
PalCall (
|
||||
IN UINT64 Index,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4
|
||||
);
|
||||
|
||||
#endif
|
||||
|
779
MdePkg/Include/Library/PcdLib.h
Normal file
779
MdePkg/Include/Library/PcdLib.h
Normal file
@ -0,0 +1,779 @@
|
||||
/** @file
|
||||
PCD Library Class Interface Declarations
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
Module Name: PcdLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PCD_LIB_H__
|
||||
#define __PCD_LIB_H__
|
||||
|
||||
#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
|
||||
|
||||
#define PcdToken(TokenName) _PCD_TOKEN_##TokenName
|
||||
|
||||
|
||||
//
|
||||
// Feature Flag is in the form of a global constant
|
||||
//
|
||||
#define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName
|
||||
|
||||
|
||||
//
|
||||
// Fixed is fixed at build time
|
||||
//
|
||||
#define FixedPcdGet8(TokenName) _PCD_VALUE_##TokenName
|
||||
#define FixedPcdGet16(TokenName) _PCD_VALUE_##TokenName
|
||||
#define FixedPcdGet32(TokenName) _PCD_VALUE_##TokenName
|
||||
#define FixedPcdGet64(TokenName) _PCD_VALUE_##TokenName
|
||||
#define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName
|
||||
|
||||
|
||||
#define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName)
|
||||
|
||||
|
||||
//
|
||||
// (Binary) Patch is in the form of a global variable
|
||||
//
|
||||
#define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
|
||||
#define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
|
||||
#define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
|
||||
#define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
|
||||
#define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
|
||||
#define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
|
||||
|
||||
#define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
|
||||
#define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
|
||||
#define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
|
||||
#define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
|
||||
#define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
|
||||
#define PatchPcdSetPtr(TokenName, Size, Buffer) \
|
||||
LibPatchPcdSetPtr ( \
|
||||
_gPcd_BinaryPatch_##TokenName, \
|
||||
(UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
|
||||
(Size), \
|
||||
(Buffer) \
|
||||
)
|
||||
|
||||
//
|
||||
// Dynamic is via the protocol with only the TokenNumber as argument
|
||||
// It can also be Patch or Fixed type based on a build option
|
||||
//
|
||||
#define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName
|
||||
#define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName
|
||||
#define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
|
||||
#define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName
|
||||
#define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName
|
||||
#define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName
|
||||
|
||||
//
|
||||
// Dynamic Set
|
||||
//
|
||||
#define PcdSet8(TokenName, Value) _PCD_SET_MODE_8_##TokenName ((Value))
|
||||
#define PcdSet16(TokenName, Value) _PCD_SET_MODE_16_##TokenName ((Value))
|
||||
#define PcdSet32(TokenName, Value) _PCD_SET_MODE_32_##TokenName ((Value))
|
||||
#define PcdSet64(TokenName, Value) _PCD_SET_MODE_64_##TokenName ((Value))
|
||||
#define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \
|
||||
_PCD_SET_MODE_PTR_##TokenName ((SizeOfBuffer), (Buffer))
|
||||
#define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))
|
||||
|
||||
//
|
||||
// Dynamic Ex is to support binary distribution
|
||||
//
|
||||
#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), _PCD_TOKEN_##TokenName)
|
||||
#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), _PCD_TOKEN_##TokenName)
|
||||
#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), _PCD_TOKEN_##TokenName)
|
||||
#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), _PCD_TOKEN_##TokenName)
|
||||
#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), _PCD_TOKEN_##TokenName)
|
||||
#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)
|
||||
|
||||
//
|
||||
// Dynamic Set Ex
|
||||
//
|
||||
#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
||||
#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
||||
#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
||||
#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
||||
#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
|
||||
LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))
|
||||
#define PcdSetExBool(Guid, TokenName, Value) \
|
||||
LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))
|
||||
|
||||
|
||||
/**
|
||||
Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
|
||||
|
||||
@param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
|
||||
set values associated with a PCD token.
|
||||
|
||||
@retval SKU_ID Return the SKU ID that just be set.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
LibPcdSetSku (
|
||||
IN UINTN SkuId
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 8-bit value for the token specified by TokenNumber.
|
||||
|
||||
@param[in] The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
LibPcdGet8 (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 16-bit value for the token specified by TokenNumber.
|
||||
|
||||
@param[in] The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
LibPcdGet16 (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 32-bit value for the token specified by TokenNumber.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
LibPcdGet32 (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 64-bit value for the token specified by TokenNumber.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
LibPcdGet64 (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the pointer to the buffer of the token specified by TokenNumber.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval VOID* Returns the pointer to the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdGetPtr (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the Boolean value of the token specified by TokenNumber.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
LibPcdGetBool (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the size of the token specified by TokenNumber.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINTN Returns the size of the token specified by TokenNumber.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
LibPcdGetSize (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 8-bit value for the token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT8 Return the UINT8.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
LibPcdGetEx8 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 16-bit value for the token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT16 Return the UINT16.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
LibPcdGetEx16 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 32-bit value for the token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT32 Return the UINT32.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
LibPcdGetEx32 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the 64-bit value for the token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINT64 Return the UINT64.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
LibPcdGetEx64 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the pointer to the buffer of token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval VOID* Return the VOID* pointer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdGetExPtr (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the Boolean value of the token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval BOOLEAN Return the BOOLEAN.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
LibPcdGetExBool (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns the size of the token specified by TokenNumber and Guid.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates
|
||||
which namespace to retrieve a value from.
|
||||
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
||||
|
||||
@retval UINTN Return the size.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
LibPcdGetExSize (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 8-bit value for the token specified by TokenNumber
|
||||
to the value specified by Value. Value is returned.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 8-bit value to set.
|
||||
|
||||
@retval UINT8 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
LibPcdSet8 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 16-bit value for the token specified by TokenNumber
|
||||
to the value specified by Value. Value is returned.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 16-bit value to set.
|
||||
|
||||
@retval UINT16 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
LibPcdSet16 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT16 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 32-bit value for the token specified by TokenNumber
|
||||
to the value specified by Value. Value is returned.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 32-bit value to set.
|
||||
|
||||
@retval UINT32 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
LibPcdSet32 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 64-bit value for the token specified by TokenNumber
|
||||
to the value specified by Value. Value is returned.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 64-bit value to set.
|
||||
|
||||
@retval UINT64 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
LibPcdSet64 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber to the value
|
||||
specified by Buffer and SizeOfValue. Buffer is returned.
|
||||
If SizeOfValue is greater than the maximum size support by TokenNumber,
|
||||
then set SizeOfValue to the maximum size supported by TokenNumber and
|
||||
return NULL to indicate that the set operation was not actually performed.
|
||||
|
||||
If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to the
|
||||
maximum size supported by TokenName and NULL must be returned.
|
||||
|
||||
If SizeOfValue is NULL, then ASSERT().
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Value A pointer to the buffer to set.
|
||||
|
||||
@retval VOID* Return the pointer for the buffer been set.
|
||||
|
||||
**/
|
||||
VOID*
|
||||
EFIAPI
|
||||
LibPcdSetPtr (
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the Boolean value for the token specified by TokenNumber
|
||||
to the value specified by Value. Value is returned.
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The boolean value to set.
|
||||
|
||||
@retval BOOLEAN Return the value been set.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
LibPcdSetBool (
|
||||
IN UINTN TokenNumber,
|
||||
IN BOOLEAN Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 8-bit value for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 8-bit value to set.
|
||||
|
||||
@retval UINT8 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
LibPcdSetEx8 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 16-bit value for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 16-bit value to set.
|
||||
|
||||
@retval UINT8 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
LibPcdSetEx16 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT16 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 32-bit value for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 32-bit value to set.
|
||||
|
||||
@retval UINT32 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
LibPcdSetEx32 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the 64-bit value for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 64-bit value to set.
|
||||
|
||||
@retval UINT64 Return the value been set.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
LibPcdSetEx64 (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber to the value specified by
|
||||
Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
|
||||
the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
|
||||
supported by TokenNumber and return NULL to indicate that the set operation
|
||||
was not actually performed.
|
||||
|
||||
If Guid is NULL, then ASSERT().
|
||||
If SizeOfValue is NULL, then ASSERT().
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Buffer A pointer to the buffer to set.
|
||||
|
||||
@retval VOID * Return the pinter to the buffer been set.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetExPtr (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the Boolean value for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The Boolean value to set.
|
||||
|
||||
@retval Boolean Return the value been set.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
LibPcdSetExBool (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN BOOLEAN Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
When the token specified by TokenNumber and Guid is set,
|
||||
then notification function specified by NotificationFunction is called.
|
||||
If Guid is NULL, then the default token space is used.
|
||||
If NotificationFunction is NULL, then ASSERT().
|
||||
|
||||
This notification function serves two purposes. Firstly, it notifies the module which
|
||||
did the registration that the value of this PCD token has been set. Secondly,
|
||||
it provides a mechanism for the module which did the registration to intercept
|
||||
the set operation and override the value been set if necessary. After the invocation
|
||||
of the callback function, TokenData will be used by PCD service PEIM or driver to
|
||||
modify the internal data in PCD database.
|
||||
|
||||
|
||||
@param[in] CallBackGuid The PCD token GUID being set.
|
||||
@param[in] CallBackToken The PCD token number being set.
|
||||
@param[in, out] TokenData A pointer to the token data being set.
|
||||
@param[in] TokenDataSize The size, in bytes, of the data being set.
|
||||
|
||||
@retval VOID
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *PCD_CALLBACK) (
|
||||
IN CONST GUID *CallBackGuid, OPTIONAL
|
||||
IN UINTN CallBackToken,
|
||||
IN OUT VOID *TokenData,
|
||||
IN UINTN TokenDataSize
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
When the token specified by TokenNumber and Guid is set,
|
||||
then notification function specified by NotificationFunction is called.
|
||||
If Guid is NULL, then the default token space is used.
|
||||
If NotificationFunction is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates which
|
||||
namespace to set a value from. If NULL, then the default
|
||||
token space is used.
|
||||
@param[in] TokenNumber The PCD token number to monitor.
|
||||
@param[in] NotificationFunction The function to call when the token
|
||||
specified by Guid and TokenNumber is set.
|
||||
|
||||
@retval VOID
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
LibPcdCallbackOnSet (
|
||||
IN CONST GUID *Guid, OPTIONAL
|
||||
IN UINTN TokenNumber,
|
||||
IN PCD_CALLBACK NotificationFunction
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Disable a notification function that was established with LibPcdCallbackonSet().
|
||||
|
||||
@param[in] Guid Specify the GUID token space.
|
||||
@param[in] TokenNumber Specify the token number.
|
||||
@param[in] NotificationFunction The callback function to be unregistered.
|
||||
|
||||
@retval VOID
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
LibPcdCancelCallback (
|
||||
IN CONST GUID *Guid, OPTIONAL
|
||||
IN UINTN TokenNumber,
|
||||
IN PCD_CALLBACK NotificationFunction
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the next PCD token number from the token space specified by Guid.
|
||||
If Guid is NULL, then the default token space is used. If TokenNumber is 0,
|
||||
then the first token number is returned. Otherwise, the token number that
|
||||
follows TokenNumber in the token space is returned. If TokenNumber is the last
|
||||
token number in the token space, then 0 is returned. If TokenNumber is not 0 and
|
||||
is not in the token space specified by Guid, then ASSERT().
|
||||
|
||||
@param[in] Pointer to a 128-bit unique value that designates which namespace
|
||||
to set a value from. If NULL, then the default token space is used.
|
||||
@param[in] The previous PCD token number. If 0, then retrieves the first PCD
|
||||
token number.
|
||||
|
||||
@retval UINTN The next valid token number.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
LibPcdGetNextToken (
|
||||
IN CONST GUID *Guid, OPTIONAL
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the next PCD token space from a token space specified by Guid.
|
||||
Guid of NULL is reserved to mark the default local token namespace on the current
|
||||
platform. If Guid is NULL, then the GUID of the first non-local token space of the
|
||||
current platform is returned. If Guid is the last non-local token space,
|
||||
then NULL is returned.
|
||||
|
||||
If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
|
||||
|
||||
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that designates from which namespace
|
||||
to start the search.
|
||||
|
||||
@retval CONST GUID * The next valid token namespace.
|
||||
|
||||
**/
|
||||
GUID *
|
||||
EFIAPI
|
||||
LibPcdGetNextTokenSpace (
|
||||
IN CONST GUID *Guid
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sets the PCD entry specified by PatchVariable to the value specified by Buffer
|
||||
and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
|
||||
MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
|
||||
NULL to indicate that the set operation was not actually performed.
|
||||
If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
|
||||
MaximumDatumSize and NULL must be returned.
|
||||
|
||||
If PatchVariable is NULL, then ASSERT().
|
||||
If SizeOfValue is NULL, then ASSERT().
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] PatchVariable A pointer to the global variable in a module that is
|
||||
the target of the set operation.
|
||||
@param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
|
||||
@param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
|
||||
@param[in] Buffer A pointer to the buffer to used to set the target variable.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtr (
|
||||
IN VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
);
|
||||
|
||||
#endif
|
1049
MdePkg/Include/Library/PciCf8Lib.h
Normal file
1049
MdePkg/Include/Library/PciCf8Lib.h
Normal file
File diff suppressed because it is too large
Load Diff
1018
MdePkg/Include/Library/PciExpressLib.h
Normal file
1018
MdePkg/Include/Library/PciExpressLib.h
Normal file
File diff suppressed because it is too large
Load Diff
1013
MdePkg/Include/Library/PciLib.h
Normal file
1013
MdePkg/Include/Library/PciLib.h
Normal file
File diff suppressed because it is too large
Load Diff
924
MdePkg/Include/Library/PciSegmentLib.h
Normal file
924
MdePkg/Include/Library/PciSegmentLib.h
Normal file
@ -0,0 +1,924 @@
|
||||
/** @file
|
||||
Functions accessing PCI configuration registers on any supported PCI segment
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PciSegmentLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PCI_SEGMENT_LIB__
|
||||
#define __PCI_SEGMENT_LIB__
|
||||
|
||||
|
||||
/**
|
||||
Macro that converts PCI Segment, PCI Bus, PCI Device, PCI Function,
|
||||
and PCI Register to an address that can be passed to the PCI Segment Library functions.
|
||||
|
||||
Computes an address that is compatible with the PCI Segment Library functions.
|
||||
The unused upper bits of Segment, Bus, Device, Function,
|
||||
and Register are stripped prior to the generation of the address.
|
||||
|
||||
@param Segment PCI Segment number. Range 0..65535.
|
||||
@param Bus PCI Bus number. Range 0..255.
|
||||
@param Device PCI Device number. Range 0..31.
|
||||
@param Function PCI Function number. Range 0..7.
|
||||
@param Register PCI Register number. Range 0..255 for PCI. Range 0..4095 for PCI Express.
|
||||
|
||||
@return The address that is compatible with the PCI Segment Library functions.
|
||||
|
||||
**/
|
||||
#define PCI_SEGMENT_LIB_ADDRESS(Segment,Bus,Device,Function,Register) \
|
||||
( ((Register) & 0xfff) | \
|
||||
(((Function) & 0x07) << 12) | \
|
||||
(((Device) & 0x1f) << 15) | \
|
||||
(((Bus) & 0xff) << 20) | \
|
||||
(LShiftU64((Segment) & 0xffff, 32)) \
|
||||
)
|
||||
|
||||
/**
|
||||
Reads an 8-bit PCI configuration register.
|
||||
|
||||
Reads and returns the 8-bit PCI configuration register specified by Address.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
|
||||
@return The 8-bit PCI configuration register specified by Address.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentRead8 (
|
||||
IN UINT64 Address
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Writes an 8-bit PCI configuration register.
|
||||
|
||||
Writes the 8-bit PCI configuration register specified by Address with the value specified by Value.
|
||||
Value is returned. This function must guarantee that all PCI read and write operations are serialized.
|
||||
If Address > 0x0FFFFFFF, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Value The value to write.
|
||||
|
||||
@return The parameter of Value.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentWrite8 (
|
||||
IN UINT64 Address,
|
||||
IN UINT8 Value
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise inclusive OR of an 8-bit PCI configuration register with an 8-bit value.
|
||||
|
||||
Reads the 8-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 8-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param OrData The value to OR with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentOr8 (
|
||||
IN UINT64 Address,
|
||||
IN UINT8 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value.
|
||||
|
||||
Reads the 8-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
and writes the result to the 8-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Andata The value to AND with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentAnd8 (
|
||||
IN UINT64 Address,
|
||||
IN UINT8 AndData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value,
|
||||
followed a bitwise inclusive OR with another 8-bit value.
|
||||
|
||||
Reads the 8-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
performs a bitwise inclusive OR between the result of the AND operation and the value specified by OrData,
|
||||
and writes the result to the 8-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Andata The value to AND with the PCI configuration register.
|
||||
@param OrData The value to OR with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentAndThenOr8 (
|
||||
IN UINT64 Address,
|
||||
IN UINT8 AndData,
|
||||
IN UINT8 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field of a PCI configuration register.
|
||||
|
||||
Reads the bit field in an 8-bit PCI configuration register.
|
||||
The bit field is specified by the StartBit and the EndBit.
|
||||
The value of the bit field is returned.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
|
||||
@return The value of the bit field.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentBitFieldRead8 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Writes a bit field to a PCI configuration register.
|
||||
|
||||
Writes Value to the bit field of the PCI configuration register.
|
||||
The bit field is specified by the StartBit and the EndBit.
|
||||
All other bits in the destination PCI configuration register are preserved.
|
||||
The new value of the 8-bit register is returned.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param Value New value of the bit field.
|
||||
|
||||
@return The new value of the 8-bit register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentBitFieldWrite8 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT8 Value
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads the 8-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 8-bit PCI configuration register specified by Address.
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param OrData The value to OR with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentBitFieldOr8 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT8 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR,
|
||||
and writes the result back to the bit field in the 8-bit port.
|
||||
|
||||
Reads the 8-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 8-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
Extra left bits in OrData are stripped.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param AndData The value to AND with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentBitFieldAnd8 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT8 AndData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field in an 8-bit PCI configuration register, performs a bitwise AND,
|
||||
and writes the result back to the bit field in the 8-bit register.
|
||||
|
||||
Reads the 8-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
and writes the result to the 8-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
Extra left bits in AndData are stripped.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param AndData The value to AND with the read value from the PCI configuration register.
|
||||
@param OrData The value to OR with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
PciSegmentBitFieldAndThenOr8 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT8 AndData,
|
||||
IN UINT8 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a 16-bit PCI configuration register.
|
||||
|
||||
Reads and returns the 16-bit PCI configuration register specified by Address.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
|
||||
@return The 16-bit PCI configuration register specified by Address.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentRead16 (
|
||||
IN UINT64 Address
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Writes a 16-bit PCI configuration register.
|
||||
|
||||
Writes the 16-bit PCI configuration register specified by Address with the value specified by Value.
|
||||
Value is returned. This function must guarantee that all PCI read and write operations are serialized.
|
||||
If Address > 0x0FFFFFFF, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Value The value to write.
|
||||
|
||||
@return The parameter of Value.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentWrite16 (
|
||||
IN UINT64 Address,
|
||||
IN UINT16 Value
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise inclusive OR of a 16-bit PCI configuration register with a 16-bit value.
|
||||
|
||||
Reads the 16-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 16-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param OrData The value to OR with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentOr16 (
|
||||
IN UINT64 Address,
|
||||
IN UINT16 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value.
|
||||
|
||||
Reads the 16-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
and writes the result to the 16-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Andata The value to AND with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentAnd16 (
|
||||
IN UINT64 Address,
|
||||
IN UINT16 AndData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value,
|
||||
followed a bitwise inclusive OR with another 16-bit value.
|
||||
|
||||
Reads the 16-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
performs a bitwise inclusive OR between the result of the AND operation and the value specified by OrData,
|
||||
and writes the result to the 16-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Andata The value to AND with the PCI configuration register.
|
||||
@param OrData The value to OR with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentAndThenOr16 (
|
||||
IN UINT64 Address,
|
||||
IN UINT16 AndData,
|
||||
IN UINT16 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field of a PCI configuration register.
|
||||
|
||||
Reads the bit field in a 16-bit PCI configuration register.
|
||||
The bit field is specified by the StartBit and the EndBit.
|
||||
The value of the bit field is returned.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
|
||||
@return The value of the bit field.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentBitFieldRead16 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Writes a bit field to a PCI configuration register.
|
||||
|
||||
Writes Value to the bit field of the PCI configuration register.
|
||||
The bit field is specified by the StartBit and the EndBit.
|
||||
All other bits in the destination PCI configuration register are preserved.
|
||||
The new value of the 16-bit register is returned.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param Value New value of the bit field.
|
||||
|
||||
@return The new value of the 16-bit register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentBitFieldWrite16 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT16 Value
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads the 16-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 16-bit PCI configuration register specified by Address.
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param OrData The value to OR with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentBitFieldOr16 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT16 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR,
|
||||
and writes the result back to the bit field in the 16-bit port.
|
||||
|
||||
Reads the 16-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 16-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
Extra left bits in OrData are stripped.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param AndData The value to AND with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentBitFieldAnd16 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT16 AndData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field in a 16-bit PCI configuration register, performs a bitwise AND,
|
||||
and writes the result back to the bit field in the 16-bit register.
|
||||
|
||||
Reads the 16-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
and writes the result to the 16-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
Extra left bits in AndData are stripped.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param AndData The value to AND with the read value from the PCI configuration register.
|
||||
@param OrData The value to OR with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PciSegmentBitFieldAndThenOr16 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT16 AndData,
|
||||
IN UINT16 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a 32-bit PCI configuration register.
|
||||
|
||||
Reads and returns the 32-bit PCI configuration register specified by Address.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
|
||||
@return The 32-bit PCI configuration register specified by Address.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentRead32 (
|
||||
IN UINT64 Address
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Writes a 32-bit PCI configuration register.
|
||||
|
||||
Writes the 32-bit PCI configuration register specified by Address with the value specified by Value.
|
||||
Value is returned. This function must guarantee that all PCI read and write operations are serialized.
|
||||
If Address > 0x0FFFFFFF, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Value The value to write.
|
||||
|
||||
@return The parameter of Value.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentWrite32 (
|
||||
IN UINT64 Address,
|
||||
IN UINT32 Value
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise inclusive OR of a 32-bit PCI configuration register with a 32-bit value.
|
||||
|
||||
Reads the 32-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 32-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param OrData The value to OR with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentOr32 (
|
||||
IN UINT64 Address,
|
||||
IN UINT32 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value.
|
||||
|
||||
Reads the 32-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
and writes the result to the 32-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Andata The value to AND with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentAnd32 (
|
||||
IN UINT64 Address,
|
||||
IN UINT32 AndData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value,
|
||||
followed a bitwise inclusive OR with another 32-bit value.
|
||||
|
||||
Reads the 32-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
performs a bitwise inclusive OR between the result of the AND operation and the value specified by OrData,
|
||||
and writes the result to the 32-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Andata The value to AND with the PCI configuration register.
|
||||
@param OrData The value to OR with the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentAndThenOr32 (
|
||||
IN UINT64 Address,
|
||||
IN UINT32 AndData,
|
||||
IN UINT32 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field of a PCI configuration register.
|
||||
|
||||
Reads the bit field in a 32-bit PCI configuration register.
|
||||
The bit field is specified by the StartBit and the EndBit.
|
||||
The value of the bit field is returned.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
|
||||
@return The value of the bit field.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentBitFieldRead32 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Writes a bit field to a PCI configuration register.
|
||||
|
||||
Writes Value to the bit field of the PCI configuration register.
|
||||
The bit field is specified by the StartBit and the EndBit.
|
||||
All other bits in the destination PCI configuration register are preserved.
|
||||
The new value of the 32-bit register is returned.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param Value New value of the bit field.
|
||||
|
||||
@return The new value of the 32-bit register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentBitFieldWrite32 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT32 Value
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads the 32-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 32-bit PCI configuration register specified by Address.
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param OrData The value to OR with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentBitFieldOr32 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT32 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR,
|
||||
and writes the result back to the bit field in the 32-bit port.
|
||||
|
||||
Reads the 32-bit PCI configuration register specified by Address,
|
||||
performs a bitwise inclusive OR between the read result and the value specified by OrData,
|
||||
and writes the result to the 32-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
Extra left bits in OrData are stripped.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param AndData The value to AND with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentBitFieldAnd32 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT32 AndData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a bit field in a 32-bit PCI configuration register, performs a bitwise AND,
|
||||
and writes the result back to the bit field in the 32-bit register.
|
||||
|
||||
Reads the 32-bit PCI configuration register specified by Address,
|
||||
performs a bitwise AND between the read result and the value specified by AndData,
|
||||
and writes the result to the 32-bit PCI configuration register specified by Address.
|
||||
The value written to the PCI configuration register is returned.
|
||||
This function must guarantee that all PCI read and write operations are serialized.
|
||||
Extra left bits in AndData are stripped.
|
||||
If any reserved bits in Address are set, then ASSERT().
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
|
||||
@param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
The ordinal of the least significant bit in a byte is bit 0.
|
||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||
The ordinal of the most significant bit in a byte is bit 7.
|
||||
@param AndData The value to AND with the read value from the PCI configuration register.
|
||||
@param OrData The value to OR with the read value from the PCI configuration register.
|
||||
|
||||
@return The value written to the PCI configuration register.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PciSegmentBitFieldAndThenOr32 (
|
||||
IN UINT64 Address,
|
||||
IN UINTN StartBit,
|
||||
IN UINTN EndBit,
|
||||
IN UINT32 AndData,
|
||||
IN UINT32 OrData
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Reads a range of PCI configuration registers into a caller supplied buffer.
|
||||
|
||||
Reads the range of PCI configuration registers specified by StartAddress
|
||||
and Size into the buffer specified by Buffer.
|
||||
This function only allows the PCI configuration registers from a single PCI function to be read.
|
||||
Size is returned.
|
||||
If any reserved bits in StartAddress are set, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Size Size in bytes of the transfer.
|
||||
@param Buffer Pointer to a buffer receiving the data read.
|
||||
|
||||
@return The paramter of Size.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
PciSegmentReadBuffer (
|
||||
IN UINT64 StartAddress,
|
||||
IN UINTN Size,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Copies the data in a caller supplied buffer to a specified range of PCI configuration space.
|
||||
|
||||
Writes the range of PCI configuration registers specified by StartAddress
|
||||
and Size from the buffer specified by Buffer.
|
||||
This function only allows the PCI configuration registers from a single PCI function to be written.
|
||||
Size is returned.
|
||||
If any reserved bits in StartAddress are set, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Segment, Bus, Device, Function, and Register.
|
||||
@param Size Size in bytes of the transfer.
|
||||
@param Buffer Pointer to a buffer containing the data to write.
|
||||
|
||||
@return The paramter of Size.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
PciSegmentWriteBuffer (
|
||||
IN UINT64 StartAddress,
|
||||
IN UINTN Size,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
87
MdePkg/Include/Library/PeCoffGetEntryPointLib.h
Normal file
87
MdePkg/Include/Library/PeCoffGetEntryPointLib.h
Normal file
@ -0,0 +1,87 @@
|
||||
/** @file
|
||||
Memory Only PE COFF loader
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeCoffGetEntryPointLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PE_COFF_GET_ENTRY_POINT_LIB_H__
|
||||
#define __PE_COFF_GET_ENTRY_POINT_LIB_H__
|
||||
|
||||
/**
|
||||
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
|
||||
into system memory with the PE/COFF Loader Library functions.
|
||||
|
||||
Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry
|
||||
point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then
|
||||
return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS.
|
||||
If Pe32Data is NULL, then ASSERT().
|
||||
If EntryPoint is NULL, then ASSERT().
|
||||
|
||||
@param Pe32Data Pointer to the PE/COFF image that is loaded in system memory.
|
||||
@param EntryPoint Pointer to entry point to the PE/COFF image to return.
|
||||
|
||||
@retval RETURN_SUCCESS EntryPoint was returned.
|
||||
@retval RETURN_INVALID_PARAMETER The entry point could not be found in the PE/COFF image.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderGetEntryPoint (
|
||||
IN VOID *Pe32Data,
|
||||
OUT VOID **EntryPoint
|
||||
);
|
||||
|
||||
/**
|
||||
Returns the machine type of a PE/COFF image.
|
||||
|
||||
Returns the machine type from the PE/COFF image specified by Pe32Data.
|
||||
If Pe32Data is NULL, then ASSERT().
|
||||
|
||||
@param Pe32Data Pointer to the PE/COFF image that is loaded in system
|
||||
memory.
|
||||
|
||||
@return Machine type or zero if not a valid iamge.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PeCoffLoaderGetMachineType (
|
||||
IN VOID *Pe32Data
|
||||
);
|
||||
|
||||
/**
|
||||
Returns a pointer to the PDB file name for a PE/COFF image that has been
|
||||
loaded into system memory with the PE/COFF Loader Library functions.
|
||||
|
||||
Returns the PDB file name for the PE/COFF image specified by Pe32Data. If
|
||||
the PE/COFF image specified by Pe32Data is not a valid, then NULL is
|
||||
returned. If the PE/COFF image specified by Pe32Data does not contain a
|
||||
debug directory entry, then NULL is returned. If the debug directory entry
|
||||
in the PE/COFF image specified by Pe32Data does not contain a PDB file name,
|
||||
then NULL is returned.
|
||||
If Pe32Data is NULL, then ASSERT().
|
||||
|
||||
@param Pe32Data Pointer to the PE/COFF image that is loaded in system
|
||||
memory.
|
||||
|
||||
@return The PDB file name for the PE/COFF image specified by Pe32Data or NULL
|
||||
if it cannot be retrieved.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
PeCoffLoaderGetPdbPointer (
|
||||
IN VOID *Pe32Data
|
||||
);
|
||||
|
||||
#endif
|
171
MdePkg/Include/Library/PeCoffLib.h
Normal file
171
MdePkg/Include/Library/PeCoffLib.h
Normal file
@ -0,0 +1,171 @@
|
||||
/** @file
|
||||
Memory Only PE COFF loader.
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeCoffLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __BASE_PE_COFF_LIB_H__
|
||||
#define __BASE_PE_COFF_LIB_H__
|
||||
|
||||
#include <Common/PeCoffLoaderImageContext.h>
|
||||
|
||||
//
|
||||
// Return status codes from the PE/COFF Loader services
|
||||
// BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes
|
||||
//
|
||||
#define IMAGE_ERROR_SUCCESS 0
|
||||
#define IMAGE_ERROR_IMAGE_READ 1
|
||||
#define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE 2
|
||||
#define IMAGE_ERROR_INVALID_MACHINE_TYPE 3
|
||||
#define IMAGE_ERROR_INVALID_SUBSYSTEM 4
|
||||
#define IMAGE_ERROR_INVALID_IMAGE_ADDRESS 5
|
||||
#define IMAGE_ERROR_INVALID_IMAGE_SIZE 6
|
||||
#define IMAGE_ERROR_INVALID_SECTION_ALIGNMENT 7
|
||||
#define IMAGE_ERROR_SECTION_NOT_LOADED 8
|
||||
#define IMAGE_ERROR_FAILED_RELOCATION 9
|
||||
#define IMAGE_ERROR_FAILED_ICACHE_FLUSH 10
|
||||
|
||||
|
||||
/**
|
||||
Retrieves information about a PE/COFF image.
|
||||
|
||||
Computes the PeCoffHeaderOffset, ImageAddress, ImageSize, DestinationAddress, CodeView,
|
||||
PdbPointer, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
|
||||
fields of the ImageContext structure. If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
|
||||
If the PE/COFF image accessed through the ImageRead service in the ImageContext structure is not
|
||||
a supported PE/COFF image type, then return RETURN_UNSUPPORTED. If any errors occur while
|
||||
computing the fields of ImageContext, then the error status is returned in the ImageError field of
|
||||
ImageContext.
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
image that needs to be examined by this function.
|
||||
|
||||
@retval RETURN_SUCCESS The information on the PE/COFF image was collected.
|
||||
@retval RETURN_INVALID_PARAMETER ImageContext is NULL.
|
||||
@retval RETURN_UNSUPPORTED The PE/COFF image is not supported.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderGetImageInfo (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Applies relocation fixups to a PE/COFF image that was loaded with PeCoffLoaderLoadImage().
|
||||
|
||||
If the DestinationAddress field of ImageContext is 0, then use the ImageAddress field of
|
||||
ImageContext as the relocation base address. Otherwise, use the DestinationAddress field
|
||||
of ImageContext as the relocation base address. The caller must allocate the relocation
|
||||
fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
image that is being relocated.
|
||||
|
||||
@retval RETURN_SUCCESS The PE/COFF image was relocated.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
@retval RETURN_LOAD_ERROR The image in not a valid PE/COFF image.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
@retval RETURN_UNSUPPORTED A relocation record type is not supported.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderRelocateImage (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Loads a PE/COFF image into memory.
|
||||
|
||||
Loads the PE/COFF image accessed through the ImageRead service of ImageContext into the buffer
|
||||
specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate
|
||||
the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.
|
||||
The EntryPoint, FixupDataSize, CodeView, and PdbPointer fields of ImageContext are computed.
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
image that is being loaded.
|
||||
|
||||
@retval RETURN_SUCCESS The PE/COFF image was loaded into the buffer specified by
|
||||
the ImageAddress and ImageSize fields of ImageContext.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
@retval RETURN_BUFFER_TOO_SMALL The caller did not provide a large enough buffer.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
@retval RETURN_LOAD_ERROR The PE/COFF image is an EFI Runtime image with no relocations.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
@retval RETURN_INVALID_PARAMETER The image address is invalid.
|
||||
Extended status information is in the ImageError field of ImageContext.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderLoadImage (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
ImageRead function that operates on a memory buffer whos base is passed into
|
||||
FileHandle.
|
||||
|
||||
@param FileHandle Ponter to baes of the input stream
|
||||
@param FileOffset Offset to the start of the buffer
|
||||
@param ReadSize Number of bytes to copy into the buffer
|
||||
@param Buffer Location to place results of read
|
||||
|
||||
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
||||
the buffer.
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderImageReadFromMemory (
|
||||
IN VOID *FileHandle,
|
||||
IN UINTN FileOffset,
|
||||
IN OUT UINTN *ReadSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
Reapply fixups on a fixed up PE32/PE32+ image to allow virutal calling at EFI
|
||||
runtime.
|
||||
|
||||
PE_COFF_LOADER_IMAGE_CONTEXT.FixupData stores information needed to reapply
|
||||
the fixups with a virtual mapping.
|
||||
|
||||
|
||||
@param ImageBase Base address of relocated image
|
||||
@param VirtImageBase Virtual mapping for ImageBase
|
||||
@param ImageSize Size of the image to relocate
|
||||
@param RelocationData Location to place results of read
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeCoffLoaderRelocateImageForRuntime (
|
||||
IN PHYSICAL_ADDRESS ImageBase,
|
||||
IN PHYSICAL_ADDRESS VirtImageBase,
|
||||
IN UINTN ImageSize,
|
||||
IN VOID *RelocationData
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
#endif
|
80
MdePkg/Include/Library/PeiCoreEntryPoint.h
Normal file
80
MdePkg/Include/Library/PeiCoreEntryPoint.h
Normal file
@ -0,0 +1,80 @@
|
||||
/** @file
|
||||
Entry point to the PEI Core
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MODULE_ENTRY_POINT_H__
|
||||
#define __MODULE_ENTRY_POINT_H__
|
||||
|
||||
/**
|
||||
Enrty point to PEI core.
|
||||
|
||||
@param PeiStartupDescriptor Pointer of start up information.
|
||||
|
||||
@return Status returned by entry points of core and drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
_ModuleEntryPoint (
|
||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||
);
|
||||
|
||||
/**
|
||||
Wrapper of enrty point to PEI core.
|
||||
|
||||
@param PeiStartupDescriptor Pointer of start up information.
|
||||
|
||||
@return Status returned by entry points of core and drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiMain (
|
||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||
);
|
||||
|
||||
/**
|
||||
Call constructs for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param FfsHeader Pointer to header of FFS.
|
||||
@param PeiServices Pointer to the PEI Services Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryConstructorList (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call the list of driver entry points. Automatics Generated by tool.
|
||||
|
||||
@param PeiStartupDescriptor Pointer to startup information .
|
||||
@param OldCoreData Pointer to Original startup information.
|
||||
|
||||
@return Status returned by entry points of drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleEntryPointList (
|
||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
|
||||
IN VOID *OldCoreData
|
||||
);
|
||||
|
||||
#endif
|
298
MdePkg/Include/Library/PeiServicesLib.h
Normal file
298
MdePkg/Include/Library/PeiServicesLib.h
Normal file
@ -0,0 +1,298 @@
|
||||
/** @file
|
||||
Header file for PEI Services Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeiServicesLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PEI_SERVICES_LIB_H__
|
||||
#define __PEI_SERVICES_LIB_H__
|
||||
|
||||
/**
|
||||
This service enables a given PEIM to register an interface into the PEI Foundation.
|
||||
|
||||
@param PpiList A pointer to the list of interfaces that the caller shall install.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesInstallPpi (
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
|
||||
|
||||
@param OldPpi Pointer to the old PEI PPI Descriptors.
|
||||
@param NewPpi Pointer to the new PEI PPI Descriptors.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
@retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been
|
||||
installed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesReInstallPpi (
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to discover a given instance of an interface.
|
||||
|
||||
@param Guid A pointer to the GUID whose corresponding interface needs to be
|
||||
found.
|
||||
@param Instance The N-th instance of the interface that is required.
|
||||
@param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
|
||||
@param Ppi A pointer to the instance of the interface.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully returned.
|
||||
@retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesLocatePpi (
|
||||
IN EFI_GUID *Guid,
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
|
||||
IN OUT VOID **Ppi
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to register a given service to be invoked when another service is
|
||||
installed or reinstalled.
|
||||
|
||||
@param NotifyList A pointer to the list of notification interfaces that the caller
|
||||
shall install.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the
|
||||
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesNotifyPpi (
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to ascertain the present value of the boot mode.
|
||||
|
||||
@param BootMode A pointer to contain the value of the boot mode.
|
||||
|
||||
@retval EFI_SUCCESS The boot mode was returned successfully.
|
||||
@retval EFI_INVALID_PARAMETER BootMode is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesGetBootMode (
|
||||
IN OUT EFI_BOOT_MODE *BootMode
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to update the boot mode variable.
|
||||
|
||||
@param BootMode The value of the boot mode to set.
|
||||
|
||||
@retval EFI_SUCCESS The value was successfully updated
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesSetBootMode (
|
||||
IN EFI_BOOT_MODE BootMode
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables a PEIM to ascertain the address of the list of HOBs in memory.
|
||||
|
||||
@param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
|
||||
|
||||
@retval EFI_SUCCESS The list was successfully returned.
|
||||
@retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesGetHobList (
|
||||
IN OUT VOID **HobList
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to create various types of HOBs.
|
||||
|
||||
@param Type The type of HOB to be installed.
|
||||
@param Length The length of the HOB to be added.
|
||||
@param Hob The address of a pointer that will contain the HOB header.
|
||||
|
||||
@retval EFI_SUCCESS The HOB was successfully created.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesCreateHob (
|
||||
IN UINT16 Type,
|
||||
IN UINT16 Length,
|
||||
IN OUT VOID **Hob
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to discover additional firmware volumes.
|
||||
|
||||
@param Instance This instance of the firmware volume to find. The value 0 is the
|
||||
Boot Firmware Volume (BFV).
|
||||
@param FwVolHeader Pointer to the firmware volume header of the volume to return.
|
||||
|
||||
@retval EFI_SUCCESS The volume was found.
|
||||
@retval EFI_NOT_FOUND The volume was not found.
|
||||
@retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesFfsFindNextVolume (
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to discover additional firmware files.
|
||||
|
||||
@param SearchType A filter to find files only of this type.
|
||||
@param FwVolHeader Pointer to the firmware volume header of the volume to search.
|
||||
This parameter must point to a valid FFS volume.
|
||||
@param FileHeader Pointer to the current file from which to begin searching.
|
||||
|
||||
@retval EFI_SUCCESS The file was found.
|
||||
@retval EFI_NOT_FOUND The file was not found.
|
||||
@retval EFI_NOT_FOUND The header checksum was not zero.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesFfsFindNextFile (
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN OUT EFI_FFS_FILE_HEADER **FileHeader
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to discover sections of a given type within a valid FFS file.
|
||||
|
||||
@param SearchType The value of the section type to find.
|
||||
@param FfsFileHeader A pointer to the file header that contains the set of sections to
|
||||
be searched.
|
||||
@param SectionData A pointer to the discovered section, if successful.
|
||||
|
||||
@retval EFI_SUCCESS The section was found.
|
||||
@retval EFI_NOT_FOUND The section was not found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesFfsFindSectionData (
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to register the permanent memory configuration
|
||||
that has been initialized with the PEI Foundation.
|
||||
|
||||
@param MemoryBegin The value of a region of installed memory.
|
||||
@param MemoryLength The corresponding length of a region of installed memory.
|
||||
|
||||
@retval EFI_SUCCESS The region was successfully installed in a HOB.
|
||||
@retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesInstallPeiMemory (
|
||||
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
||||
IN UINT64 MemoryLength
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables PEIMs to allocate memory after the permanent memory has been installed by a
|
||||
PEIM.
|
||||
|
||||
@param MemoryType Type of memory to allocate.
|
||||
@param Pages Number of pages to allocate.
|
||||
@param Memory Pointer of memory allocated.
|
||||
|
||||
@retval EFI_SUCCESS The memory range was successfully allocated.
|
||||
@retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
|
||||
@retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
|
||||
@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesAllocatePages (
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
);
|
||||
|
||||
/**
|
||||
This service allocates memory from the Hand-Off Block (HOB) heap.
|
||||
|
||||
@param Size The number of bytes to allocate from the pool.
|
||||
@param Buffer If the call succeeds, a pointer to a pointer to the allocate
|
||||
buffer; undefined otherwise.
|
||||
|
||||
@retval EFI_SUCCESS The allocation was successful
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesAllocatePool (
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
This service resets the entire platform, including all processors and devices, and reboots the
|
||||
system.
|
||||
|
||||
@retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesResetSystem (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
#endif
|
36
MdePkg/Include/Library/PeiServicesTablePointerLib.h
Normal file
36
MdePkg/Include/Library/PeiServicesTablePointerLib.h
Normal file
@ -0,0 +1,36 @@
|
||||
/** @file
|
||||
PEI Services Table Pointer Library services
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeiServicesTablePointerLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PEI_SERVICES_TABLE_POINTER_LIB_H__
|
||||
#define __PEI_SERVICES_TABLE_POINTER_LIB_H__
|
||||
|
||||
/**
|
||||
The function returns the pointer to PEI services.
|
||||
|
||||
The function returns the pointer to PEI services.
|
||||
It will ASSERT() if the pointer to PEI services is NULL.
|
||||
|
||||
@retval The pointer to PeiServices.
|
||||
|
||||
**/
|
||||
EFI_PEI_SERVICES **
|
||||
EFIAPI
|
||||
GetPeiServicesTablePointer (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
103
MdePkg/Include/Library/PeimEntryPoint.h
Normal file
103
MdePkg/Include/Library/PeimEntryPoint.h
Normal file
@ -0,0 +1,103 @@
|
||||
/** @file
|
||||
Entry point to a PEIM
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MODULE_ENTRY_POINT_H__
|
||||
#define __MODULE_ENTRY_POINT_H__
|
||||
|
||||
//
|
||||
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
|
||||
//
|
||||
extern const UINT32 _gPeimRevision;
|
||||
|
||||
/**
|
||||
Image entry point of Peim.
|
||||
|
||||
@param FfsHeader Pointer to FFS header the loaded driver.
|
||||
@param PeiServices Pointer to the PEI services.
|
||||
|
||||
@return Status returned by entry points of Peims.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
_ModuleEntryPoint (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Wrapper of Peim image entry point.
|
||||
|
||||
@param FfsHeader Pointer to FFS header the loaded driver.
|
||||
@param PeiServices Pointer to the PEI services.
|
||||
|
||||
@return Status returned by entry points of Peims.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiMain (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call constructs for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param FfsHeader Pointer to FFS header the loaded driver.
|
||||
@param PeiServices Pointer to the PEI services.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryConstructorList (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call destructors for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param FfsHeader Pointer to FFS header the loaded driver.
|
||||
@param PeiServices Pointer to the PEI services.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryDestructorList (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call the list of driver entry points. Automatics Generated by tool.
|
||||
|
||||
@param FfsHeader Pointer to FFS header the loaded driver.
|
||||
@param PeiServices Pointer to the PEI services.
|
||||
|
||||
@return Status returned by entry points of drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleEntryPointList (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
);
|
||||
|
||||
#endif
|
216
MdePkg/Include/Library/PerformanceLib.h
Normal file
216
MdePkg/Include/Library/PerformanceLib.h
Normal file
@ -0,0 +1,216 @@
|
||||
/** @file
|
||||
Library that provides services to measure module execution performance
|
||||
|
||||
Copyright (c) 2006, Intel Corporation.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PerformanceLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PERFORMANCE_LIB_H__
|
||||
#define __PERFORMANCE_LIB_H__
|
||||
|
||||
//
|
||||
// Performance library propery mask bits
|
||||
//
|
||||
#define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED 0x00000001
|
||||
|
||||
/**
|
||||
Creates a record for the beginning of a performance measurement.
|
||||
|
||||
Creates a record that contains the Handle, Token, and Module.
|
||||
If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
|
||||
If TimeStamp is zero, then this function reads the current time stamp
|
||||
and adds that time stamp value to the record as the start time.
|
||||
|
||||
@param Handle Pointer to environment specific context used
|
||||
to identify the component being measured.
|
||||
@param Token Pointer to a Null-terminated ASCII string
|
||||
that identifies the component being measured.
|
||||
@param Module Pointer to a Null-terminated ASCII string
|
||||
that identifies the module being measured.
|
||||
@param TimeStamp 64-bit time stamp.
|
||||
|
||||
@retval RETURN_SUCCESS The start of the measurement was recorded.
|
||||
@retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
StartPerformanceMeasurement (
|
||||
IN CONST VOID *Handle, OPTIONAL
|
||||
IN CONST CHAR8 *Token, OPTIONAL
|
||||
IN CONST CHAR8 *Module, OPTIONAL
|
||||
IN UINT64 TimeStamp
|
||||
);
|
||||
|
||||
/**
|
||||
Fills in the end time of a performance measurement.
|
||||
|
||||
Looks up the record that matches Handle, Token, and Module.
|
||||
If the record can not be found then return RETURN_NOT_FOUND.
|
||||
If the record is found and TimeStamp is not zero,
|
||||
then TimeStamp is added to the record as the end time.
|
||||
If the record is found and TimeStamp is zero, then this function reads
|
||||
the current time stamp and adds that time stamp value to the record as the end time.
|
||||
If this function is called multiple times for the same record, then the end time is overwritten.
|
||||
|
||||
@param Handle Pointer to environment specific context used
|
||||
to identify the component being measured.
|
||||
@param Token Pointer to a Null-terminated ASCII string
|
||||
that identifies the component being measured.
|
||||
@param Module Pointer to a Null-terminated ASCII string
|
||||
that identifies the module being measured.
|
||||
@param TimeStamp 64-bit time stamp.
|
||||
|
||||
@retval RETURN_SUCCESS The end of the measurement was recorded.
|
||||
@retval RETURN_NOT_FOUND The specified measurement record could not be found.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
EndPerformanceMeasurement (
|
||||
IN CONST VOID *Handle, OPTIONAL
|
||||
IN CONST CHAR8 *Token, OPTIONAL
|
||||
IN CONST CHAR8 *Module, OPTIONAL
|
||||
IN UINT64 TimeStamp
|
||||
);
|
||||
|
||||
/**
|
||||
Attempts to retrieve a performance measurement log entry from the performance measurement log.
|
||||
|
||||
Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
|
||||
zero on entry, then an attempt is made to retrieve the first entry from the performance log,
|
||||
and the key for the second entry in the log is returned. If the performance log is empty,
|
||||
then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
|
||||
log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
|
||||
returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
|
||||
retrieved and an implementation specific non-zero key value that specifies the end of the performance
|
||||
log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
|
||||
is retrieved and zero is returned. In the cases where a performance log entry can be returned,
|
||||
the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
|
||||
If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
|
||||
If Handle is NULL, then ASSERT().
|
||||
If Token is NULL, then ASSERT().
|
||||
If Module is NULL, then ASSERT().
|
||||
If StartTimeStamp is NULL, then ASSERT().
|
||||
If EndTimeStamp is NULL, then ASSERT().
|
||||
|
||||
@param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
|
||||
0, then the first performance measurement log entry is retrieved.
|
||||
On exit, the key of the next performance lof entry entry.
|
||||
@param Handle Pointer to environment specific context used to identify the component
|
||||
being measured.
|
||||
@param Token Pointer to a Null-terminated ASCII string that identifies the component
|
||||
being measured.
|
||||
@param Module Pointer to a Null-terminated ASCII string that identifies the module
|
||||
being measured.
|
||||
@param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
|
||||
was started.
|
||||
@param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
|
||||
was ended.
|
||||
|
||||
@return The key for the next performance log entry (in general case).
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
GetPerformanceMeasurement (
|
||||
IN UINTN LogEntryKey,
|
||||
OUT CONST VOID **Handle,
|
||||
OUT CONST CHAR8 **Token,
|
||||
OUT CONST CHAR8 **Module,
|
||||
OUT UINT64 *StartTimeStamp,
|
||||
OUT UINT64 *EndTimeStamp
|
||||
);
|
||||
|
||||
/**
|
||||
Returns TRUE if the performance measurement macros are enabled.
|
||||
|
||||
This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
|
||||
PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
|
||||
PcdPerformanceLibraryPropertyMask is set.
|
||||
@retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
|
||||
PcdPerformanceLibraryPropertyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PerformanceMeasurementEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Macro that calls EndPerformanceMeasurement().
|
||||
|
||||
If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
|
||||
then EndPerformanceMeasurement() is called.
|
||||
|
||||
**/
|
||||
#define PERF_END(Handle, Token, Module, TimeStamp) \
|
||||
do { \
|
||||
if (PerformanceMeasurementEnabled ()) { \
|
||||
EndPerformanceMeasurement (Handle, Token, Module, TimeStamp); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
/**
|
||||
Macro that calls StartPerformanceMeasurement().
|
||||
|
||||
If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
|
||||
then StartPerformanceMeasurement() is called.
|
||||
|
||||
**/
|
||||
#define PERF_START(Handle, Token, Module, TimeStamp) \
|
||||
do { \
|
||||
if (PerformanceMeasurementEnabled ()) { \
|
||||
StartPerformanceMeasurement (Handle, Token, Module, TimeStamp); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
/**
|
||||
Macro that marks the beginning of performance measurement source code.
|
||||
|
||||
If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
|
||||
then this macro marks the beginning of source code that is included in a module.
|
||||
Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
|
||||
|
||||
**/
|
||||
#define PERF_CODE_BEGIN() do { if (PerformanceMeasurementEnabled ()) { UINT8 __PerformanceCodeLocal
|
||||
|
||||
/**
|
||||
Macro that marks the end of performance measurement source code.
|
||||
|
||||
If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
|
||||
then this macro marks the end of source code that is included in a module.
|
||||
Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
|
||||
|
||||
**/
|
||||
#define PERF_CODE_END() __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE)
|
||||
|
||||
/**
|
||||
Macro that declares a section of performance measurement source code.
|
||||
|
||||
If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
|
||||
then the source code specified by Expression is included in a module.
|
||||
Otherwise, the source specified by Expression is not included in a module.
|
||||
|
||||
@param Expression Performance measurement source code to include in a module.
|
||||
|
||||
**/
|
||||
#define PERF_CODE(Expression) \
|
||||
PERF_CODE_BEGIN (); \
|
||||
Expression \
|
||||
PERF_CODE_END ()
|
||||
|
||||
|
||||
#endif
|
150
MdePkg/Include/Library/PostCodeLib.h
Normal file
150
MdePkg/Include/Library/PostCodeLib.h
Normal file
@ -0,0 +1,150 @@
|
||||
/** @file
|
||||
Report Status Code Library public .h file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __POST_CODE_LIB_H__
|
||||
#define __POST_CODE_LIB_H__
|
||||
|
||||
#define POST_CODE_PROPERTY_POST_CODE_ENABLED 0x00000008
|
||||
#define POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED 0x00000010
|
||||
|
||||
/**
|
||||
Sends an 32-bit value to a POST card.
|
||||
|
||||
Sends the 32-bit value specified by Value to a POST card, and returns Value.
|
||||
Some implementations of this library function may perform I/O operations
|
||||
directly to a POST card device. Other implementations may send Value to
|
||||
ReportStatusCode(), and the status code reporting mechanism will eventually
|
||||
display the 32-bit value on the status reporting device.
|
||||
|
||||
PostCode() must actively prevent recursion. If PostCode() is called while
|
||||
processing another any other Report Status Code Library function, then
|
||||
PostCode() must return Value immediately.
|
||||
|
||||
@param Value The 32-bit value to write to the POST card.
|
||||
|
||||
@return Value
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PostCode (
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sends an 32-bit value to a POST and associated ASCII string.
|
||||
|
||||
Sends the 32-bit value specified by Value to a POST card, and returns Value.
|
||||
If Description is not NULL, then the ASCII string specified by Description is
|
||||
also passed to the handler that displays the POST card value. Some
|
||||
implementations of this library function may perform I/O operations directly
|
||||
to a POST card device. Other implementations may send Value to ReportStatusCode(),
|
||||
and the status code reporting mechanism will eventually display the 32-bit
|
||||
value on the status reporting device.
|
||||
|
||||
PostCodeWithDescription()must actively prevent recursion. If
|
||||
PostCodeWithDescription() is called while processing another any other Report
|
||||
Status Code Library function, then PostCodeWithDescription() must return Value
|
||||
immediately.
|
||||
|
||||
@param Value The 32-bit value to write to the POST card.
|
||||
@param Description Pointer to an ASCII string that is a description of the
|
||||
POST code value. This is an optional parameter that may
|
||||
be NULL.
|
||||
|
||||
@return Value
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PostCodeWithDescription (
|
||||
IN UINT32 Value,
|
||||
IN CONST CHAR8 *Description OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns TRUE if POST Codes are enabled.
|
||||
|
||||
This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
|
||||
bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
||||
PcdPostCodeProperyMask is set.
|
||||
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
||||
PcdPostCodeProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PostCodeEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns TRUE if POST code descriptions are enabled.
|
||||
|
||||
This function returns TRUE if the
|
||||
POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
||||
PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED
|
||||
bit of PcdPostCodeProperyMask is set.
|
||||
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED
|
||||
bit of PcdPostCodeProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PostCodeDescriptionEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Sends an 32-bit value to a POST card.
|
||||
|
||||
If POST codes are enabled in PcdPostCodeProperyMask, then call PostCode()
|
||||
passing in Value. Value is returned.
|
||||
|
||||
@param Value The 32-bit value to write to the POST card.
|
||||
|
||||
@return Value
|
||||
|
||||
**/
|
||||
#define POST_CODE(Value) PostCodeEnabled() ? PostCode(Value) : Value
|
||||
|
||||
/**
|
||||
Sends an 32-bit value to a POST and associated ASCII string.
|
||||
|
||||
If POST codes and POST code descriptions are enabled in
|
||||
PcdPostCodeProperyMask, then call PostCodeWithDescription() passing in
|
||||
Value and Description. If only POST codes are enabled, then call PostCode()
|
||||
passing in Value. Value is returned.
|
||||
|
||||
@param Value The 32-bit value to write to the POST card.
|
||||
@param Description Pointer to an ASCII string that is a description of the
|
||||
POST code value.
|
||||
|
||||
**/
|
||||
#define POST_CODE_WITH_DESCRIPTION(Value,Description) \
|
||||
PostCodeEnabled() ? \
|
||||
(PostCodeDescriptionEnabled() ? \
|
||||
PostCodeWithDescription(Value,Description) : \
|
||||
PostCode(Value)) : \
|
||||
Value
|
||||
|
||||
#endif
|
475
MdePkg/Include/Library/PrintLib.h
Normal file
475
MdePkg/Include/Library/PrintLib.h
Normal file
@ -0,0 +1,475 @@
|
||||
/** @file
|
||||
Library that provides print services
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PrintLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PRINT_LIB_H__
|
||||
#define __PRINT_LIB_H__
|
||||
|
||||
///
|
||||
/// Define the maximum number of characters that are required to
|
||||
/// encode a decimal, hexidecimal, GUID, or TIME value with a NULL
|
||||
/// terminator.
|
||||
///
|
||||
/// Maximum Length Decimal String = 28
|
||||
/// "-9,223,372,036,854,775,808"
|
||||
/// Maximum Length Hexidecimal String = 17
|
||||
/// "FFFFFFFFFFFFFFFF"
|
||||
/// Maximum Length GUID = 37
|
||||
/// "00000000-0000-0000-0000-000000000000"
|
||||
/// Maximum Length TIME = 18
|
||||
/// "12/12/2006 12:12"
|
||||
///
|
||||
#define MAXIMUM_VALUE_CHARACTERS 38
|
||||
|
||||
///
|
||||
/// Flags bitmask values use in UnicodeValueToString() and
|
||||
/// AsciiValueToString()
|
||||
///
|
||||
#define LEFT_JUSTIFY 0x01
|
||||
#define COMMA_TYPE 0x08
|
||||
#define PREFIX_ZERO 0x20
|
||||
#define RADIX_HEX 0x80
|
||||
|
||||
/**
|
||||
Produces a Null-terminated Unicode string in an output buffer based on
|
||||
a Null-terminated Unicode format string and a VA_LIST argument list
|
||||
|
||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on the
|
||||
contents of the format string.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
UnicodeVSPrint (
|
||||
OUT CHAR16 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR16 *FormatString,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
|
||||
Unicode format string and variable argument list.
|
||||
|
||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the format string.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
UnicodeSPrint (
|
||||
OUT CHAR16 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR16 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
|
||||
ASCII format string and a VA_LIST argument list
|
||||
|
||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on the
|
||||
contents of the format string.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
UnicodeVSPrintAsciiFormat (
|
||||
OUT CHAR16 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
|
||||
ASCII format string and variable argument list.
|
||||
|
||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
UnicodeSPrintAsciiFormat (
|
||||
OUT CHAR16 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Converts a decimal value to a Null-terminated Unicode string.
|
||||
|
||||
Converts the decimal number specified by Value to a Null-terminated Unicode
|
||||
string specified by Buffer containing at most Width characters. No padding of spaces
|
||||
is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The number of Unicode characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
Additional conversion parameters are specified in Flags.
|
||||
|
||||
The Flags bit LEFT_JUSTIFY is always ignored.
|
||||
All conversions are left justified in Buffer.
|
||||
If Width is 0, PREFIX_ZERO is ignored in Flags.
|
||||
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
|
||||
are inserted every 3rd digit starting from the right.
|
||||
If HEX_RADIX is set in Flags, then the output buffer will be
|
||||
formatted in hexadecimal format.
|
||||
If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
|
||||
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
|
||||
then Buffer is padded with '0' characters so the combination of the optional '-'
|
||||
sign character, '0' characters, digit characters for Value, and the Null-terminator
|
||||
add up to Width characters.
|
||||
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If unsupported bits are set in Flags, then ASSERT().
|
||||
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
|
||||
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
|
||||
|
||||
@param Buffer Pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad, and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of Unicode characters to place in Buffer, not including
|
||||
the Null-terminator.
|
||||
|
||||
@return The number of Unicode characters in Buffer not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
UnicodeValueToString (
|
||||
IN OUT CHAR16 *Buffer,
|
||||
IN UINTN Flags,
|
||||
IN INT64 Value,
|
||||
IN UINTN Width
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||
ASCII format string and a VA_LIST argument list.
|
||||
|
||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on
|
||||
the contents of the format string.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiVSPrint (
|
||||
OUT CHAR8 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||
ASCII format string and variable argument list.
|
||||
|
||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiSPrint (
|
||||
OUT CHAR8 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||
ASCII format string and a VA_LIST argument list.
|
||||
|
||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on
|
||||
the contents of the format string.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiVSPrintUnicodeFormat (
|
||||
OUT CHAR8 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR16 *FormatString,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||
ASCII format string and variable argument list.
|
||||
|
||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiSPrintUnicodeFormat (
|
||||
OUT CHAR8 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR16 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Converts a decimal value to a Null-terminated ASCII string.
|
||||
|
||||
Converts the decimal number specified by Value to a Null-terminated ASCII string
|
||||
specified by Buffer containing at most Width characters. No padding of spaces
|
||||
is ever performed.
|
||||
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The number of ASCII characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first Width
|
||||
characters are returned, and the total number of characters required to perform
|
||||
the conversion is returned.
|
||||
Additional conversion parameters are specified in Flags.
|
||||
The Flags bit LEFT_JUSTIFY is always ignored.
|
||||
All conversions are left justified in Buffer.
|
||||
If Width is 0, PREFIX_ZERO is ignored in Flags.
|
||||
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
|
||||
are inserted every 3rd digit starting from the right.
|
||||
If HEX_RADIX is set in Flags, then the output buffer will be
|
||||
formatted in hexadecimal format.
|
||||
If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
|
||||
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
|
||||
then Buffer is padded with '0' characters so the combination of the optional '-'
|
||||
sign character, '0' characters, digit characters for Value, and the Null-terminator
|
||||
add up to Width characters.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If unsupported bits are set in Flags, then ASSERT().
|
||||
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
|
||||
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
|
||||
|
||||
@param Buffer Pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad, and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of ASCII characters to place in Buffer, not including
|
||||
the Null-terminator.
|
||||
|
||||
@return The number of ASCII characters in Buffer not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN UINTN Flags,
|
||||
IN INT64 Value,
|
||||
IN UINTN Width
|
||||
);
|
||||
|
||||
#endif
|
632
MdePkg/Include/Library/ReportStatusCodeLib.h
Normal file
632
MdePkg/Include/Library/ReportStatusCodeLib.h
Normal file
@ -0,0 +1,632 @@
|
||||
/** @file
|
||||
Report Status Code Library public .h file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __REPORT_STATUS_CODE_LIB_H__
|
||||
#define __REPORT_STATUS_CODE_LIB_H__
|
||||
|
||||
//
|
||||
// Declare bits for PcdReportStatusCodePropertyMask
|
||||
//
|
||||
#define REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED 0x00000001
|
||||
#define REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED 0x00000002
|
||||
#define REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED 0x00000004
|
||||
|
||||
//
|
||||
// Extended Data structure definitions with EFI_STATUS_CODE_DATA headers removed
|
||||
//
|
||||
|
||||
///
|
||||
/// Voltage Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_EXP_BASE10_DATA Voltage;
|
||||
EFI_EXP_BASE10_DATA Threshold;
|
||||
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_VOLTAGE_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Microcode Update Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Version;
|
||||
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_MICROCODE_UPDATE_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Asynchronous Timer Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_EXP_BASE10_DATA TimerLimit;
|
||||
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_TIMER_EXPIRED_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Host Processor Mismatch Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Instance;
|
||||
UINT16 Attributes;
|
||||
} REPORT_STATUS_CODE_LIBRARY_HOST_PROCESSOR_MISMATCH_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Thermal Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_EXP_BASE10_DATA Temperature;
|
||||
EFI_EXP_BASE10_DATA Threshold;
|
||||
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_THERMAL_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Processor Disabled Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Cause;
|
||||
BOOLEAN SoftwareDisabled;
|
||||
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_CPU_DISABLED_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Embedded cache init extended data
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Level;
|
||||
EFI_INIT_CACHE_TYPE Type;
|
||||
} REPORT_STATUS_CODE_LIBRARY_CACHE_INIT_DATA;
|
||||
|
||||
///
|
||||
/// Memory Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_MEMORY_ERROR_GRANULARITY Granularity;
|
||||
EFI_MEMORY_ERROR_OPERATION Operation;
|
||||
UINTN Syndrome;
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
UINTN Resolution;
|
||||
} REPORT_STATUS_CODE_LIBRARY_MEMORY_EXTENDED_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// DIMM number
|
||||
///
|
||||
typedef struct {
|
||||
UINT16 Array;
|
||||
UINT16 Device;
|
||||
} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_DIMM_NUMBER;
|
||||
|
||||
///
|
||||
/// Memory Module Mismatch Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_STATUS_CODE_DIMM_NUMBER Instance;
|
||||
} REPORT_STATUS_CODE_LIBRARY_MEMORY_MODULE_MISMATCH_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Memory Range Extended Data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_PHYSICAL_ADDRESS Start;
|
||||
EFI_PHYSICAL_ADDRESS Length;
|
||||
} REPORT_STATUS_CODE_LIBRARY_MEMORY_RANGE_EXTENDED_DATA;
|
||||
|
||||
///
|
||||
/// Device handle Extended Data. Used for many
|
||||
/// errors and progress codes to point to the device.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE Handle;
|
||||
} REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 *DevicePath;
|
||||
} REPORT_STATUS_CODE_LIBRARY_DEVICE_PATH_EXTENDED_DATA;
|
||||
|
||||
typedef struct {
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
UINT16 DevicePathSize;
|
||||
UINT8 *RemainingDevicePath;
|
||||
} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_START_EXTENDED_DATA;
|
||||
|
||||
///
|
||||
/// Resource Allocation Failure Extended Error Data
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Bar;
|
||||
UINT16 DevicePathSize;
|
||||
UINT16 ReqResSize;
|
||||
UINT16 AllocResSize;
|
||||
UINT8 *DevicePath;
|
||||
UINT8 *ReqRes;
|
||||
UINT8 *AllocRes;
|
||||
} REPORT_STATUS_CODE_LIBRARY_RESOURCE_ALLOC_FAILURE_ERROR_DATA;
|
||||
|
||||
///
|
||||
/// Extended Error Data for Assert
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 LineNumber;
|
||||
UINT32 FileNameSize;
|
||||
EFI_STATUS_CODE_STRING_DATA *FileName;
|
||||
} REPORT_STATUS_CODE_LIBRARY_DEBUG_ASSERT_DATA;
|
||||
|
||||
///
|
||||
/// System Context Data EBC/IA32/IPF
|
||||
///
|
||||
typedef struct {
|
||||
EFI_STATUS_CODE_EXCEP_SYSTEM_CONTEXT Context;
|
||||
} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_EXCEP_EXTENDED_DATA;
|
||||
|
||||
///
|
||||
/// Legacy Oprom extended data
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_PHYSICAL_ADDRESS RomImageBase;
|
||||
} REPORT_STATUS_CODE_LIBRARY_LEGACY_OPROM_EXTENDED_DATA;
|
||||
|
||||
//
|
||||
// Extern for the modules Caller ID GUID
|
||||
//
|
||||
extern EFI_GUID gEfiCallerIdGuid;
|
||||
|
||||
/**
|
||||
Converts a status code to an 8-bit POST code value.
|
||||
|
||||
Converts the status code specified by CodeType and Value to an 8-bit POST code
|
||||
and returns the 8-bit POST code in PostCode. If CodeType is an
|
||||
EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode
|
||||
are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits
|
||||
24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned.
|
||||
|
||||
If PostCode is NULL, then ASSERT().
|
||||
|
||||
@param CodeType The type of status code being converted.
|
||||
@param Value The status code value being converted.
|
||||
@param PostCode A pointer to the 8-bit POST code value to return.
|
||||
|
||||
@retval TRUE The status code specified by CodeType and Value was converted
|
||||
to an 8-bit POST code and returned in PostCode.
|
||||
@retval FALSE The status code specified by CodeType and Value could not be
|
||||
converted to an 8-bit POST code value.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CodeTypeToPostCode (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
OUT UINT8 *PostCode
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Extracts ASSERT() information from a status code structure.
|
||||
|
||||
Converts the status code specified by CodeType, Value, and Data to the ASSERT()
|
||||
arguments specified by Filename, Description, and LineNumber. If CodeType is
|
||||
an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and
|
||||
Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract
|
||||
Filename, Description, and LineNumber from the optional data area of the
|
||||
status code buffer specified by Data. The optional data area of Data contains
|
||||
a Null-terminated ASCII string for the FileName, followed by a Null-terminated
|
||||
ASCII string for the Description, followed by a 32-bit LineNumber. If the
|
||||
ASSERT() information could be extracted from Data, then return TRUE.
|
||||
Otherwise, FALSE is returned.
|
||||
|
||||
If Data is NULL, then ASSERT().
|
||||
If Filename is NULL, then ASSERT().
|
||||
If Description is NULL, then ASSERT().
|
||||
If LineNumber is NULL, then ASSERT().
|
||||
|
||||
@param CodeType The type of status code being converted.
|
||||
@param Value The status code value being converted.
|
||||
@param Data Pointer to status code data buffer.
|
||||
@param Filename Pointer to the source file name that generated the ASSERT().
|
||||
@param Description Pointer to the description of the ASSERT().
|
||||
@param LineNumber Pointer to source line number that generated the ASSERT().
|
||||
|
||||
@retval TRUE The status code specified by CodeType, Value, and Data was
|
||||
converted ASSERT() arguments specified by Filename, Description,
|
||||
and LineNumber.
|
||||
@retval FALSE The status code specified by CodeType, Value, and Data could
|
||||
not be converted to ASSERT() arguments.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ReportStatusCodeExtractAssertInfo (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN CONST EFI_STATUS_CODE_DATA *Data,
|
||||
OUT CHAR8 **Filename,
|
||||
OUT CHAR8 **Description,
|
||||
OUT UINT32 *LineNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Extracts DEBUG() information from a status code structure.
|
||||
|
||||
Converts the status code specified by Data to the DEBUG() arguments specified
|
||||
by ErrorLevel, Marker, and Format. If type GUID in Data is
|
||||
EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and
|
||||
Format from the optional data area of the status code buffer specified by Data.
|
||||
The optional data area of Data contains a 32-bit ErrorLevel followed by Marker
|
||||
which is 12 UINTN parameters, followed by a Null-terminated ASCII string for
|
||||
the Format. If the DEBUG() information could be extracted from Data, then
|
||||
return TRUE. Otherwise, FALSE is returned.
|
||||
|
||||
If Data is NULL, then ASSERT().
|
||||
If ErrorLevel is NULL, then ASSERT().
|
||||
If Marker is NULL, then ASSERT().
|
||||
If Format is NULL, then ASSERT().
|
||||
|
||||
@param Data Pointer to status code data buffer.
|
||||
@param ErrorLevel Pointer to error level mask for a debug message.
|
||||
@param Marker Pointer to the variable argument list associated with Format.
|
||||
@param Format Pointer to a Null-terminated ASCII format string of a
|
||||
debug message.
|
||||
|
||||
@retval TRUE The status code specified by Data was converted DEBUG() arguments
|
||||
specified by ErrorLevel, Marker, and Format.
|
||||
@retval FALSE The status code specified by Data could not be converted to
|
||||
DEBUG() arguments.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ReportStatusCodeExtractDebugInfo (
|
||||
IN CONST EFI_STATUS_CODE_DATA *Data,
|
||||
OUT UINT32 *ErrorLevel,
|
||||
OUT VA_LIST *Marker,
|
||||
OUT CHAR8 **Format
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code.
|
||||
|
||||
Reports the status code specified by the parameters Type and Value. Status
|
||||
code also require an instance, caller ID, and extended data. This function
|
||||
passed in a zero instance, NULL extended data, and a caller ID of
|
||||
gEfiCallerIdGuid, which is the GUID for the module.
|
||||
|
||||
ReportStatusCode()must actively prevent recusrsion. If ReportStatusCode()
|
||||
is called while processing another any other Report Status Code Library function,
|
||||
then ReportStatusCode() must return immediately.
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported.
|
||||
@retval EFI_DEVICE_ERROR There status code could not be reported due to a
|
||||
device error.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ReportStatusCode (
|
||||
IN EFI_STATUS_CODE_TYPE Type,
|
||||
IN EFI_STATUS_CODE_VALUE Value
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code with a Device Path Protocol as the extended data.
|
||||
|
||||
Allocates and fills in the extended data section of a status code with the
|
||||
Device Path Protocol specified by DevicePath. This function is responsible
|
||||
for allocating a buffer large enough for the standard header and the device
|
||||
path. The standard header is filled in with a GUID of
|
||||
gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero
|
||||
instance and a caller ID of gEfiCallerIdGuid.
|
||||
|
||||
ReportStatusCodeWithDevicePath()must actively prevent recursion. If
|
||||
ReportStatusCodeWithDevicePath() is called while processing another any other
|
||||
Report Status Code Library function, then ReportStatusCodeWithDevicePath()
|
||||
must return EFI_DEVICE_ERROR immediately.
|
||||
|
||||
If DevicePath is NULL, then ASSERT().
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
@param DevicePath Pointer to the Device Path Protocol to be reported.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported with the extended
|
||||
data specified by DevicePath.
|
||||
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
|
||||
extended data section.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ReportStatusCodeWithDevicePath (
|
||||
IN EFI_STATUS_CODE_TYPE Type,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code with an extended data buffer.
|
||||
|
||||
Allocates and fills in the extended data section of a status code with the
|
||||
extended data specified by ExtendedData and ExtendedDataSize. ExtendedData
|
||||
is assumed to be one of the data structures specified in Related Definitions.
|
||||
These data structure do not have the standard header, so this function is
|
||||
responsible for allocating a buffer large enough for the standard header and
|
||||
the extended data passed into this function. The standard header is filled
|
||||
in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported
|
||||
with a zero instance and a caller ID of gEfiCallerIdGuid.
|
||||
|
||||
ReportStatusCodeWithExtendedData()must actively prevent recursion. If
|
||||
ReportStatusCodeWithExtendedData() is called while processing another any other
|
||||
Report Status Code Library function, then ReportStatusCodeWithExtendedData()
|
||||
must return EFI_DEVICE_ERROR immediately.
|
||||
|
||||
If ExtendedData is NULL, then ASSERT().
|
||||
If ExtendedDataSize is 0, then ASSERT().
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
@param ExtendedData Pointer to the extended data buffer to be reported.
|
||||
@param ExtendedDataSize The size, in bytes, of the extended data buffer to
|
||||
be reported.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported with the extended
|
||||
data specified by ExtendedData and ExtendedDataSize.
|
||||
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
|
||||
extended data section.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ReportStatusCodeWithExtendedData (
|
||||
IN EFI_STATUS_CODE_TYPE Type,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN CONST VOID *ExtendedData,
|
||||
IN UINTN ExtendedDataSize
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code with full parameters.
|
||||
|
||||
The function reports a status code. If ExtendedData is NULL and ExtendedDataSize
|
||||
is 0, then an extended data buffer is not reported. If ExtendedData is not
|
||||
NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.
|
||||
ExtendedData is assumed not have the standard status code header, so this function
|
||||
is responsible for allocating a buffer large enough for the standard header and
|
||||
the extended data passed into this function. The standard header is filled in
|
||||
with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a
|
||||
GUID of gEfiStatusCodeSpecificDatauid is used. The status code is reported with
|
||||
an instance specified by Instance and a caller ID specified by CallerId. If
|
||||
CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.
|
||||
|
||||
ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx()
|
||||
is called while processing another any other Report Status Code Library function,
|
||||
then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.
|
||||
|
||||
If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().
|
||||
If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
@param Instance Status code instance number.
|
||||
@param CallerId Pointer to a GUID that identifies the caller of this
|
||||
function. If this parameter is NULL, then a caller
|
||||
ID of gEfiCallerIdGuid is used.
|
||||
@param ExtendedDataGuid Pointer to the GUID for the extended data buffer.
|
||||
If this parameter is NULL, then a the status code
|
||||
standard header is filled in with
|
||||
gEfiStatusCodeSpecificDataGuid.
|
||||
@param ExtendedData Pointer to the extended data buffer. This is an
|
||||
optional parameter that may be NULL.
|
||||
@param ExtendedDataSize The size, in bytes, of the extended data buffer.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported.
|
||||
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate
|
||||
the extended data section if it was specified.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ReportStatusCodeEx (
|
||||
IN EFI_STATUS_CODE_TYPE Type,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN CONST EFI_GUID *CallerId OPTIONAL,
|
||||
IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
|
||||
IN CONST VOID *ExtendedData OPTIONAL,
|
||||
IN UINTN ExtendedDataSize
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled
|
||||
|
||||
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED
|
||||
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
|
||||
PcdReportStatusCodeProperyMask is set.
|
||||
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
|
||||
PcdReportStatusCodeProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ReportProgressCodeEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns TRUE if status codes of type EFI_ERROR_CODE are enabled
|
||||
|
||||
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED
|
||||
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
|
||||
PcdReportStatusCodeProperyMask is set.
|
||||
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
|
||||
PcdReportStatusCodeProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ReportErrorCodeEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled
|
||||
|
||||
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED
|
||||
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
|
||||
|
||||
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
|
||||
PcdReportStatusCodeProperyMask is set.
|
||||
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
|
||||
PcdReportStatusCodeProperyMask is clear.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ReportDebugCodeEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code with minimal parameters if the status code type is enabled.
|
||||
|
||||
If the status code type specified by Type is enabled in
|
||||
PcdReportStatusCodeProperyMask, then call ReportStatusCode() passing in Type
|
||||
and Value.
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported.
|
||||
@retval EFI_DEVICE_ERROR There status code could not be reported due to a device error.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
#define REPORT_STATUS_CODE(Type,Value) \
|
||||
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
|
||||
ReportStatusCode(Type,Value) : \
|
||||
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
|
||||
ReportStatusCode(Type,Value) : \
|
||||
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
|
||||
ReportStatusCode(Type,Value) : \
|
||||
EFI_UNSUPPORTED
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code with a Device Path Protocol as the extended data if the
|
||||
status code type is enabled.
|
||||
|
||||
If the status code type specified by Type is enabled in
|
||||
PcdReportStatusCodeProperyMask, then call ReportStatusCodeWithDevicePath()
|
||||
passing in Type, Value, and DevicePath.
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
@param DevicePath Pointer to the Device Path Protocol to be reported.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported with the extended
|
||||
data specified by DevicePath.
|
||||
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
|
||||
extended data section.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type,Value,DevicePathParameter) \
|
||||
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
|
||||
ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
|
||||
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
|
||||
ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
|
||||
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
|
||||
ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
|
||||
EFI_UNSUPPORTED
|
||||
|
||||
|
||||
/**
|
||||
Reports a status code with an extended data buffer if the status code type
|
||||
is enabled.
|
||||
|
||||
If the status code type specified by Type is enabled in
|
||||
PcdReportStatusCodeProperyMask, then call ReportStatusCodeWithExtendedData()
|
||||
passing in Type, Value, ExtendedData, and ExtendedDataSize.
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
@param ExtendedData Pointer to the extended data buffer to be reported.
|
||||
@param ExtendedDataSize The size, in bytes, of the extended data buffer to
|
||||
be reported.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported with the extended
|
||||
data specified by ExtendedData and ExtendedDataSize.
|
||||
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
|
||||
extended data section.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type,Value,ExtendedData,ExtendedDataSize) \
|
||||
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
|
||||
ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
|
||||
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
|
||||
ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
|
||||
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
|
||||
ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
|
||||
EFI_UNSUPPORTED
|
||||
|
||||
/**
|
||||
Reports a status code specifying all parameters if the status code type is enabled.
|
||||
|
||||
If the status code type specified by Type is enabled in
|
||||
PcdReportStatusCodeProperyMask, then call ReportStatusCodeEx() passing in Type,
|
||||
Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, and ExtendedDataSize.
|
||||
|
||||
@param Type Status code type.
|
||||
@param Value Status code value.
|
||||
@param Instance Status code instance number.
|
||||
@param CallerId Pointer to a GUID that identifies the caller of this
|
||||
function. If this parameter is NULL, then a caller
|
||||
ID of gEfiCallerIdGuid is used.
|
||||
@param ExtendedDataGuid Pointer to the GUID for the extended data buffer.
|
||||
If this parameter is NULL, then a the status code
|
||||
standard header is filled in with
|
||||
gEfiStatusCodeSpecificDataGuid.
|
||||
@param ExtendedData Pointer to the extended data buffer. This is an
|
||||
optional parameter that may be NULL.
|
||||
@param ExtendedDataSize The size, in bytes, of the extended data buffer.
|
||||
|
||||
@retval EFI_SUCCESS The status code was reported.
|
||||
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
|
||||
extended data section if it was specified.
|
||||
@retval EFI_UNSUPPORTED Report status code is not supported
|
||||
|
||||
**/
|
||||
#define REPORT_STATUS_CODE_EX(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) \
|
||||
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
|
||||
ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
|
||||
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
|
||||
ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
|
||||
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
|
||||
ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
|
||||
EFI_UNSUPPORTED
|
||||
|
||||
#endif
|
44
MdePkg/Include/Library/ResourcePublicationLib.h
Normal file
44
MdePkg/Include/Library/ResourcePublicationLib.h
Normal file
@ -0,0 +1,44 @@
|
||||
/** @file
|
||||
Declare presence of resources in the platform
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: ResourcePublicationLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __RESOURCE_PUBLICATION_LIB__
|
||||
#define __RESOURCE_PUBLICATION_LIB__
|
||||
|
||||
/**
|
||||
|
||||
Declares the presence of permanent system memory in the platform.
|
||||
|
||||
Declares that the system memory buffer specified by MemoryBegin and MemoryLength
|
||||
as permanent memory that may be used for general purpose use by software.
|
||||
The amount of memory available to software may be less than MemoryLength
|
||||
if published memory has alignment restrictions.
|
||||
|
||||
@param MemoryBegin The start address of the memory being declared.
|
||||
@param MemoryLength The number of bytes of memory being declared.
|
||||
|
||||
@retval RETURN_SUCCESS The memory buffer was published.
|
||||
@retval RETURN_OUT_OF_RESOURCES There are not enough resources to publish the memory buffer
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PublishSystemMemory (
|
||||
IN PHYSICAL_ADDRESS MemoryBegin,
|
||||
IN UINT64 MemoryLength
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
299
MdePkg/Include/Library/ScsiLib.h
Normal file
299
MdePkg/Include/Library/ScsiLib.h
Normal file
@ -0,0 +1,299 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
ScsiLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Common Libarary for SCSI
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _SCSI_LIB_H
|
||||
#define _SCSI_LIB_H
|
||||
|
||||
//
|
||||
// the time unit is 100ns, since the SCSI I/O defines timeout in 100ns unit.
|
||||
//
|
||||
#define EFI_SCSI_STALL_1_MICROSECOND 10
|
||||
#define EFI_SCSI_STALL_1_MILLISECOND 10000
|
||||
#define EFI_SCSI_STALL_1_SECOND 10000000
|
||||
|
||||
//
|
||||
// this macro cannot be directly used by the gBS->Stall(),
|
||||
// since the value output by this macro is in 100ns unit,
|
||||
// not 1us unit (1us = 1000ns)
|
||||
//
|
||||
#define EfiScsiStallSeconds(a) (a) * EFI_SCSI_STALL_1_SECOND
|
||||
|
||||
EFI_STATUS
|
||||
SubmitTestUnitReadyCommand (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
OUT VOID *SenseData,
|
||||
OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitInquiryCommand (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
IN VOID *SenseData,
|
||||
IN OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus,
|
||||
IN OUT VOID *InquiryDataBuffer,
|
||||
IN OUT UINT32 *InquiryDataLength,
|
||||
IN BOOLEAN EnableVitalProductData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
InquiryDataBuffer - TODO: add argument description
|
||||
InquiryDataLength - TODO: add argument description
|
||||
EnableVitalProductData - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitModeSense10Command (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
IN VOID *SenseData,
|
||||
IN OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus,
|
||||
IN VOID *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT8 DBDField, OPTIONAL
|
||||
IN UINT8 PageControl,
|
||||
IN UINT8 PageCode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
DataBuffer - TODO: add argument description
|
||||
DataLength - TODO: add argument description
|
||||
DBDField - TODO: add argument description
|
||||
PageControl - TODO: add argument description
|
||||
PageCode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitRequestSenseCommand (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
IN VOID *SenseData,
|
||||
IN OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
//
|
||||
// Commands for direct access command
|
||||
//
|
||||
EFI_STATUS
|
||||
SubmitReadCapacityCommand (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
IN VOID *SenseData,
|
||||
IN OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus,
|
||||
OUT VOID *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN BOOLEAN PMI
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
DataBuffer - TODO: add argument description
|
||||
DataLength - TODO: add argument description
|
||||
PMI - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitRead10Command (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
IN VOID *SenseData,
|
||||
IN OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus,
|
||||
OUT VOID *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT32 StartLba,
|
||||
IN UINT32 SectorSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
DataBuffer - TODO: add argument description
|
||||
DataLength - TODO: add argument description
|
||||
StartLba - TODO: add argument description
|
||||
SectorSize - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitWrite10Command (
|
||||
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
|
||||
IN UINT64 Timeout,
|
||||
IN VOID *SenseData,
|
||||
IN OUT UINT8 *SenseDataLength,
|
||||
OUT UINT8 *HostAdapterStatus,
|
||||
OUT UINT8 *TargetStatus,
|
||||
OUT VOID *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT32 StartLba,
|
||||
IN UINT32 SectorSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIo - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
DataBuffer - TODO: add argument description
|
||||
DataLength - TODO: add argument description
|
||||
StartLba - TODO: add argument description
|
||||
SectorSize - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
388
MdePkg/Include/Library/SmbusLib.h
Normal file
388
MdePkg/Include/Library/SmbusLib.h
Normal file
@ -0,0 +1,388 @@
|
||||
/** @file
|
||||
SMBUS Functions
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: SmbusLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __SMBUS_LIB__
|
||||
#define __SMBUS_LIB__
|
||||
|
||||
//
|
||||
// PEC BIT is bit 22 in SMBUS address
|
||||
//
|
||||
#define SMBUS_LIB_PEC_BIT (1 << 22)
|
||||
|
||||
/**
|
||||
Macro that converts SMBUS slave address, SMBUS command, SMBUS data length,
|
||||
and PEC to a value that can be passed to the SMBUS Library functions.
|
||||
|
||||
Computes an address that is compatible with the SMBUS Library functions.
|
||||
The unused upper bits of SlaveAddress, Command, and Length are stripped
|
||||
prior to the generation of the address.
|
||||
|
||||
@param SlaveAddress SMBUS Slave Address. Range 0..127.
|
||||
@param Command SMBUS Command. Range 0..255.
|
||||
@param Length SMBUS Data Length. Range 0..32.
|
||||
@param Pec TRUE if Packet Error Checking is enabled. Otherwise FALSE.
|
||||
|
||||
**/
|
||||
#define SMBUS_LIB_ADDRESS(SlaveAddress,Command,Length,Pec) \
|
||||
( ((Pec) ? SMBUS_LIB_PEC_BIT: 0) | \
|
||||
(((SlaveAddress) & 0x7f) << 1) | \
|
||||
(((Command) & 0xff) << 8) | \
|
||||
(((Length) & 0x3f) << 16) \
|
||||
)
|
||||
|
||||
/**
|
||||
Executes an SMBUS quick read command.
|
||||
|
||||
Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress.
|
||||
Only the SMBUS slave address field of SmBusAddress is required.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If PEC is set in SmBusAddress, then ASSERT().
|
||||
If Command in SmBusAddress is not zero, then ASSERT().
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
SmBusQuickRead (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS quick write command.
|
||||
|
||||
Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.
|
||||
Only the SMBUS slave address field of SmBusAddress is required.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If PEC is set in SmBusAddress, then ASSERT().
|
||||
If Command in SmBusAddress is not zero, then ASSERT().
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
SmBusQuickWrite (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS receive byte command.
|
||||
|
||||
Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress.
|
||||
Only the SMBUS slave address field of SmBusAddress is required.
|
||||
The byte received from the SMBUS is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Command in SmBusAddress is not zero, then ASSERT().
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The byte received from the SMBUS.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
SmBusReceiveByte (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS send byte command.
|
||||
|
||||
Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress.
|
||||
The byte specified by Value is sent.
|
||||
Only the SMBUS slave address field of SmBusAddress is required. Value is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Command in SmBusAddress is not zero, then ASSERT().
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Value The 8-bit value to send.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The parameter of Value.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
SmBusSendByte (
|
||||
IN UINTN SmBusAddress,
|
||||
IN UINT8 Value,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS read data byte command.
|
||||
|
||||
Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress.
|
||||
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
||||
The 8-bit value read from the SMBUS is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The byte read from the SMBUS.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
SmBusReadDataByte (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS write data byte command.
|
||||
|
||||
Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress.
|
||||
The 8-bit value specified by Value is written.
|
||||
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
||||
Value is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Value The 8-bit value to write.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The parameter of Value.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
SmBusWriteDataByte (
|
||||
IN UINTN SmBusAddress,
|
||||
IN UINT8 Value,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS read data word command.
|
||||
|
||||
Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress.
|
||||
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
||||
The 16-bit value read from the SMBUS is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The byte read from the SMBUS.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
SmBusReadDataWord (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS write data word command.
|
||||
|
||||
Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress.
|
||||
The 16-bit value specified by Value is written.
|
||||
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
||||
Value is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Value The 16-bit value to write.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The parameter of Value.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
SmBusWriteDataWord (
|
||||
IN UINTN SmBusAddress,
|
||||
IN UINT16 Value,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS process call command.
|
||||
|
||||
Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress.
|
||||
The 16-bit value specified by Value is written.
|
||||
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
||||
The 16-bit value returned by the process call command is returned.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Value The 16-bit value to write.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The 16-bit value returned by the process call command.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
SmBusProcessCall (
|
||||
IN UINTN SmBusAddress,
|
||||
IN UINT16 Value,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS read block command.
|
||||
|
||||
Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress.
|
||||
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
||||
Bytes are read from the SMBUS and stored in Buffer.
|
||||
The number of bytes read is returned, and will never return a value larger than 32-bytes.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.
|
||||
SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
|
||||
If Length in SmBusAddress is not zero, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The number of bytes read.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SmBusReadBlock (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT VOID *Buffer,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS write block command.
|
||||
|
||||
Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress.
|
||||
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
|
||||
Bytes are written to the SMBUS from Buffer.
|
||||
The number of bytes written is returned, and will never return a value larger than 32-bytes.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
If Length in SmBusAddress is zero or greater than 32, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The number of bytes written.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SmBusWriteBlock (
|
||||
IN UINTN SmBusAddress,
|
||||
OUT VOID *Buffer,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Executes an SMBUS block process call command.
|
||||
|
||||
Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.
|
||||
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
|
||||
Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer.
|
||||
If Status is not NULL, then the status of the executed command is returned in Status.
|
||||
It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.
|
||||
SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
|
||||
If Length in SmBusAddress is zero or greater than 32, then ASSERT().
|
||||
If WriteBuffer is NULL, then ASSERT().
|
||||
If ReadBuffer is NULL, then ASSERT().
|
||||
If any reserved bits of SmBusAddress are set, then ASSERT().
|
||||
|
||||
@param SmBusAddress Address that encodes the SMBUS Slave Address,
|
||||
SMBUS Command, SMBUS Data Length, and PEC.
|
||||
@param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS.
|
||||
@param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS.
|
||||
@param Status Return status for the executed command.
|
||||
This is an optional parameter and may be NULL.
|
||||
|
||||
@return The number of bytes written.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SmBusBlockProcessCall (
|
||||
IN UINTN SmBusAddress,
|
||||
IN VOID *WriteBuffer,
|
||||
OUT VOID *ReadBuffer,
|
||||
OUT RETURN_STATUS *Status OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
#endif
|
100
MdePkg/Include/Library/TimerLib.h
Normal file
100
MdePkg/Include/Library/TimerLib.h
Normal file
@ -0,0 +1,100 @@
|
||||
/** @file
|
||||
Timer Library Functions
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: TimerLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __TIMER_LIB__
|
||||
#define __TIMER_LIB__
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of microseconds.
|
||||
|
||||
Stalls the CPU for the number of microseconds specified by MicroSeconds.
|
||||
|
||||
@param MicroSeconds The minimum number of microseconds to delay.
|
||||
|
||||
@return MicroSeconds
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
MicroSecondDelay (
|
||||
IN UINTN MicroSeconds
|
||||
);
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of nanoseconds.
|
||||
|
||||
Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
|
||||
|
||||
@param NanoSeconds The minimum number of nanoseconds to delay.
|
||||
|
||||
@return NanoSeconds
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
NanoSecondDelay (
|
||||
IN UINTN NanoSeconds
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the current value of a 64-bit free running performance counter.
|
||||
|
||||
Retrieves the current value of a 64-bit free running performance counter. The
|
||||
counter can either count up by 1 or count down by 1. If the physical
|
||||
performance counter counts by a larger increment, then the counter values
|
||||
must be translated. The properties of the counter can be retrieved from
|
||||
GetPerformanceCounterProperties().
|
||||
|
||||
@return The current value of the free running performance counter.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
GetPerformanceCounter (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the 64-bit frequency in Hz and the range of performance counter
|
||||
values.
|
||||
|
||||
If StartValue is not NULL, then the value that the performance counter starts
|
||||
with immediately after is it rolls over is returned in StartValue. If
|
||||
EndValue is not NULL, then the value that the performance counter end with
|
||||
immediately before it rolls over is returned in EndValue. The 64-bit
|
||||
frequency of the performance counter in Hz is always returned. If StartValue
|
||||
is less than EndValue, then the performance counter counts up. If StartValue
|
||||
is greater than EndValue, then the performance counter counts down. For
|
||||
example, a 64-bit free running counter that counts up would have a StartValue
|
||||
of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
|
||||
that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
|
||||
|
||||
@param StartValue The value the performance counter starts with when it
|
||||
rolls over.
|
||||
@param EndValue The value that the performance counter ends with before
|
||||
it rolls over.
|
||||
|
||||
@return The frequency in Hz.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
GetPerformanceCounterProperties (
|
||||
OUT UINT64 *StartValue, OPTIONAL
|
||||
OUT UINT64 *EndValue OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
129
MdePkg/Include/Library/UefiApplicationEntryPoint.h
Normal file
129
MdePkg/Include/Library/UefiApplicationEntryPoint.h
Normal file
@ -0,0 +1,129 @@
|
||||
/** @file
|
||||
Entry point to a UEFI Application.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_APPLICATION_ENTRY_POINT_H__
|
||||
#define __UEFI_APPLICATION_ENTRY_POINT_H__
|
||||
|
||||
//
|
||||
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
|
||||
//
|
||||
extern const UINT32 _gUefiDriverRevision;
|
||||
|
||||
/**
|
||||
Enrty point to UEFI Application.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS One or more of the drivers returned a success code.
|
||||
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
_ModuleEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Enrty point wrapper of UEFI Application.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS One or more of the drivers returned a success code.
|
||||
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiMain (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Invoke the destuctors of all libraries and call gBS->Exit
|
||||
to return control to firmware core.
|
||||
|
||||
@param Status Status returned by the application that is exiting.
|
||||
|
||||
@retval VOID
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
Exit (
|
||||
IN EFI_STATUS Status
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call constructors for all libraries. Autogen tool inserts the implementation
|
||||
of this function into Autogen.c.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval VOID
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryConstructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call destructors for all libraries. Autogen tool inserts the implementation
|
||||
of this function into Autogen.c.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval VOID
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryDestructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Call driver entry point. For UEFI application, user
|
||||
can only specify one entry point. Tool will automatically insert
|
||||
this to Autogen.c.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@return Status returned by entry points specified by
|
||||
the user.
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleEntryPointList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
#endif
|
35
MdePkg/Include/Library/UefiBootServicesTableLib.h
Normal file
35
MdePkg/Include/Library/UefiBootServicesTableLib.h
Normal file
@ -0,0 +1,35 @@
|
||||
/** @file
|
||||
Library that provides a global pointer to the UEFI Boot Services Tables
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: UefiBootServicesTableLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_BOOT_SERVICES_TABLE_LIB_H__
|
||||
#define __UEFI_BOOT_SERVICES_TABLE_LIB_H__
|
||||
|
||||
//
|
||||
// Cache the Image Handle
|
||||
//
|
||||
extern EFI_HANDLE gImageHandle;
|
||||
|
||||
//
|
||||
// Cache pointer to the EFI System Table
|
||||
//
|
||||
extern EFI_SYSTEM_TABLE *gST;
|
||||
|
||||
//
|
||||
// Cache pointer to the EFI Boot Services Table
|
||||
//
|
||||
extern EFI_BOOT_SERVICES *gBS;
|
||||
|
||||
#endif
|
96
MdePkg/Include/Library/UefiDecompressLib.h
Normal file
96
MdePkg/Include/Library/UefiDecompressLib.h
Normal file
@ -0,0 +1,96 @@
|
||||
/** @file
|
||||
Return UEFI Decompress Protocol
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: UefiDecompressLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_DECPOMPRESS_LIB_H__
|
||||
#define __UEFI_DECPOMPRESS_LIB_H__
|
||||
|
||||
/**
|
||||
Retrieves the size of the uncompressed buffer and the size of the scratch buffer.
|
||||
|
||||
Retrieves the size of the uncompressed buffer and the temporary scratch buffer
|
||||
required to decompress the buffer specified by Source and SourceSize.
|
||||
If the size of the uncompressed buffer or the size of the scratch buffer cannot
|
||||
be determined from the compressed data specified by Source and SourceData,
|
||||
then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed
|
||||
buffer is returned in DestinationSize, the size of the scratch buffer is returned
|
||||
in ScratchSize, and RETURN_SUCCESS is returned.
|
||||
This function does not have scratch buffer available to perform a thorough
|
||||
checking of the validity of the source data. It just retrieves the "Original Size"
|
||||
field from the beginning bytes of the source data and output it as DestinationSize.
|
||||
And ScratchSize is specific to the decompression implementation.
|
||||
|
||||
If Source is NULL, then ASSERT().
|
||||
If DestinationSize is NULL, then ASSERT().
|
||||
If ScratchSize is NULL, then ASSERT().
|
||||
|
||||
@param Source The source buffer containing the compressed data.
|
||||
@param SourceSize The size, in bytes, of the source buffer.
|
||||
@param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer
|
||||
that will be generated when the compressed buffer specified
|
||||
by Source and SourceSize is decompressed..
|
||||
@param ScratchSize A pointer to the size, in bytes, of the scratch buffer that
|
||||
is required to decompress the compressed buffer specified
|
||||
by Source and SourceSize.
|
||||
|
||||
@retval RETURN_SUCCESS The size of destination buffer and the size of scratch
|
||||
buffer are successull retrieved.
|
||||
@retval RETURN_INVALID_PARAMETER The source data is corrupted
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
UefiDecompressGetInfo (
|
||||
IN CONST VOID *Source,
|
||||
IN UINT32 SourceSize,
|
||||
OUT UINT32 *DestinationSize,
|
||||
OUT UINT32 *ScratchSize
|
||||
);
|
||||
|
||||
/**
|
||||
Decompresses a compressed source buffer.
|
||||
|
||||
This function is designed so that the decompression algorithm can be implemented
|
||||
without using any memory services. As a result, this function is not allowed to
|
||||
call any memory allocation services in its implementation. It is the caller's r
|
||||
esponsibility to allocate and free the Destination and Scratch buffers.
|
||||
If the compressed source data specified by Source is sucessfully decompressed
|
||||
into Destination, then RETURN_SUCCESS is returned. If the compressed source data
|
||||
specified by Source is not in a valid compressed data format,
|
||||
then RETURN_INVALID_PARAMETER is returned.
|
||||
|
||||
If Source is NULL, then ASSERT().
|
||||
If Destination is NULL, then ASSERT().
|
||||
If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().
|
||||
|
||||
@param Source The source buffer containing the compressed data.
|
||||
@param Destination The destination buffer to store the decompressed data
|
||||
@param Scratch A temporary scratch buffer that is used to perform the decompression.
|
||||
This is an optional parameter that may be NULL if the
|
||||
required scratch buffer size is 0.
|
||||
|
||||
@retval RETURN_SUCCESS Decompression is successfull
|
||||
@retval RETURN_INVALID_PARAMETER The source data is corrupted
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
UefiDecompress (
|
||||
IN CONST VOID *Source,
|
||||
IN OUT VOID *Destination,
|
||||
IN OUT VOID *Scratch
|
||||
);
|
||||
|
||||
#endif
|
154
MdePkg/Include/Library/UefiDriverEntryPoint.h
Normal file
154
MdePkg/Include/Library/UefiDriverEntryPoint.h
Normal file
@ -0,0 +1,154 @@
|
||||
/** @file
|
||||
Entry point to a DXE Boot Services Driver
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MODULE_ENTRY_POINT_H__
|
||||
#define __MODULE_ENTRY_POINT_H__
|
||||
|
||||
//
|
||||
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
|
||||
//
|
||||
extern const UINT32 _gUefiDriverRevision;
|
||||
|
||||
//
|
||||
// Declare the number of entry points in the image.
|
||||
//
|
||||
extern const UINT8 _gDriverEntryPointCount;
|
||||
|
||||
//
|
||||
// Declare the number of unload handler in the image.
|
||||
//
|
||||
extern const UINT8 _gDriverUnloadImageCount;
|
||||
|
||||
//
|
||||
// Declare the arrary of Boot Sevice Exit Event callbacks .
|
||||
//
|
||||
extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];
|
||||
|
||||
//
|
||||
// Declare the arrary of Virtual Address Change Event callbacks .
|
||||
//
|
||||
extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[];
|
||||
|
||||
/**
|
||||
Enrty point to DXE SMM Driver.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS One or more of the drivers returned a success code.
|
||||
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
_ModuleEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Enrty point wrapper of DXE Driver.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS One or more of the drivers returned a success code.
|
||||
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiMain (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Computes the cummulative return status for the driver entry point and perform
|
||||
a long jump back into DriverEntryPoint().
|
||||
|
||||
@param Status Status returned by the driver that is exiting.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ExitDriver (
|
||||
IN EFI_STATUS Status
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call constructs for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryConstructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call destructors for all libraries. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessLibraryDestructorList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Call the list of driver entry points. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the EFI System Table.
|
||||
|
||||
@return Status returned by entry points of drivers.
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleEntryPointList (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Call the unload handlers for all the modules. Automatics Generated by tool.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
|
||||
@return Status returned by unload handlers of drivers.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessModuleUnloadList (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
#endif
|
711
MdePkg/Include/Library/UefiLib.h
Normal file
711
MdePkg/Include/Library/UefiLib.h
Normal file
@ -0,0 +1,711 @@
|
||||
/** @file
|
||||
MDE UEFI library functions and macros
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_LIB_H__
|
||||
#define __UEFI_LIB_H__
|
||||
|
||||
//
|
||||
// Unicode String Table
|
||||
//
|
||||
typedef struct {
|
||||
CHAR8 *Language;
|
||||
CHAR16 *UnicodeString;
|
||||
} EFI_UNICODE_STRING_TABLE;
|
||||
|
||||
//
|
||||
// EFI Lock Status
|
||||
//
|
||||
typedef enum {
|
||||
EfiLockUninitialized = 0,
|
||||
EfiLockReleased = 1,
|
||||
EfiLockAcquired = 2
|
||||
} EFI_LOCK_STATE;
|
||||
|
||||
//
|
||||
// EFI Lock
|
||||
//
|
||||
typedef struct {
|
||||
EFI_TPL Tpl;
|
||||
EFI_TPL OwnerTpl;
|
||||
EFI_LOCK_STATE Lock;
|
||||
} EFI_LOCK;
|
||||
|
||||
|
||||
/**
|
||||
This function searches the list of configuration tables stored in the EFI System
|
||||
Table for a table with a GUID that matches TableGuid. If a match is found,
|
||||
then a pointer to the configuration table is returned in Table, and EFI_SUCCESS
|
||||
is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.
|
||||
|
||||
@param TableGuid Pointer to table's GUID type..
|
||||
@param Table Pointer to the table associated with TableGuid in the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS A configuration table matching TableGuid was found.
|
||||
@retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiGetSystemConfigurationTable (
|
||||
IN EFI_GUID *TableGuid,
|
||||
OUT VOID **Table
|
||||
);
|
||||
|
||||
/**
|
||||
This function causes the notification function to be executed for every protocol
|
||||
of type ProtocolGuid instance that exists in the system when this function is
|
||||
invoked. In addition, every time a protocol of type ProtocolGuid instance is
|
||||
installed or reinstalled, the notification function is also executed.
|
||||
|
||||
@param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
|
||||
@param NotifyTpl Supplies the task priority level of the event notifications.
|
||||
@param NotifyFunction Supplies the function to notify when the event is signaled.
|
||||
@param NotifyContext The context parameter to pass to NotifyFunction.
|
||||
@param Registration A pointer to a memory location to receive the registration value.
|
||||
|
||||
@return The notification event that was created.
|
||||
|
||||
**/
|
||||
EFI_EVENT
|
||||
EFIAPI
|
||||
EfiCreateProtocolNotifyEvent(
|
||||
IN EFI_GUID *ProtocolGuid,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction,
|
||||
IN VOID *NotifyContext, OPTIONAL
|
||||
OUT VOID **Registration
|
||||
);
|
||||
|
||||
/**
|
||||
This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
|
||||
This event is signaled with EfiNamedEventSignal(). This provide the ability for
|
||||
one or more listeners on the same event named by the GUID specified by Name.
|
||||
|
||||
@param Name Supplies GUID name of the event.
|
||||
@param NotifyTpl Supplies the task priority level of the event notifications.
|
||||
@param NotifyFunction Supplies the function to notify when the event is signaled.
|
||||
@param NotifyContext The context parameter to pass to NotifyFunction.
|
||||
@param Registration A pointer to a memory location to receive the registration value.
|
||||
|
||||
@retval EFI_SUCCESS A named event was created.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNamedEventListen (
|
||||
IN CONST EFI_GUID *Name,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction,
|
||||
IN CONST VOID *NotifyContext, OPTIONAL
|
||||
OUT VOID *Registration OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function signals the named event specified by Name. The named event must
|
||||
have been created with EfiNamedEventListen().
|
||||
|
||||
@param Name Supplies GUID name of the event.
|
||||
|
||||
@retval EFI_SUCCESS A named event was signaled.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNamedEventSignal (
|
||||
IN CONST EFI_GUID *Name
|
||||
);
|
||||
|
||||
/**
|
||||
Returns the current TPL.
|
||||
|
||||
This function returns the current TPL. There is no EFI service to directly
|
||||
retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
|
||||
the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
|
||||
can then immediately be restored back to the current TPL level with a call
|
||||
to RestoreTPL().
|
||||
|
||||
@param VOID
|
||||
|
||||
@retvale EFI_TPL The current TPL.
|
||||
|
||||
**/
|
||||
EFI_TPL
|
||||
EFIAPI
|
||||
EfiGetCurrentTpl (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
This function initializes a basic mutual exclusion lock to the released state
|
||||
and returns the lock. Each lock provides mutual exclusion access at its task
|
||||
priority level. Since there is no preemption or multiprocessor support in EFI,
|
||||
acquiring the lock only consists of raising to the locks TPL.
|
||||
|
||||
@param Lock A pointer to the lock data structure to initialize.
|
||||
@param Priority EFI TPL associated with the lock.
|
||||
|
||||
@return The lock.
|
||||
|
||||
**/
|
||||
EFI_LOCK *
|
||||
EFIAPI
|
||||
EfiInitializeLock (
|
||||
IN OUT EFI_LOCK *Lock,
|
||||
IN EFI_TPL Priority
|
||||
);
|
||||
|
||||
/**
|
||||
This macro initializes the contents of a basic mutual exclusion lock to the
|
||||
released state. Each lock provides mutual exclusion access at its task
|
||||
priority level. Since there is no preemption or multiprocessor support in EFI,
|
||||
acquiring the lock only consists of raising to the locks TPL.
|
||||
|
||||
@param Lock A pointer to the lock data structure to initialize.
|
||||
@param Priority The task priority level of the lock.
|
||||
|
||||
@return The lock.
|
||||
|
||||
**/
|
||||
#define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
|
||||
{Priority, EFI_TPL_APPLICATION, EfiLockReleased }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
|
||||
|
||||
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
|
||||
then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
|
||||
is not in the locked state, then DebugAssert() is called passing in the source
|
||||
filename, source line number, and Lock.
|
||||
|
||||
If Lock is NULL, then ASSERT().
|
||||
|
||||
@param LockParameter A pointer to the lock to acquire.
|
||||
|
||||
**/
|
||||
#define ASSERT_LOCKED(LockParameter) \
|
||||
do { \
|
||||
if (DebugAssertEnabled ()) { \
|
||||
ASSERT (LockParameter != NULL); \
|
||||
if ((LockParameter)->Lock != EfiLockAcquired) { \
|
||||
_ASSERT (LockParameter not locked); \
|
||||
} \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
/**
|
||||
This function raises the system's current task priority level to the task
|
||||
priority level of the mutual exclusion lock. Then, it places the lock in the
|
||||
acquired state.
|
||||
|
||||
@param Priority The task priority level of the lock.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiAcquireLock (
|
||||
IN EFI_LOCK *Lock
|
||||
);
|
||||
|
||||
/**
|
||||
This function raises the system's current task priority level to the task
|
||||
priority level of the mutual exclusion lock. Then, it attempts to place the
|
||||
lock in the acquired state.
|
||||
|
||||
@param Lock A pointer to the lock to acquire.
|
||||
|
||||
@retval EFI_SUCCESS The lock was acquired.
|
||||
@retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiAcquireLockOrFail (
|
||||
IN EFI_LOCK *Lock
|
||||
);
|
||||
|
||||
/**
|
||||
This function transitions a mutual exclusion lock from the acquired state to
|
||||
the released state, and restores the system's task priority level to its
|
||||
previous level.
|
||||
|
||||
@param Lock A pointer to the lock to release.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiReleaseLock (
|
||||
IN EFI_LOCK *Lock
|
||||
);
|
||||
|
||||
/**
|
||||
Tests whether a controller handle is being managed by a specific driver.
|
||||
|
||||
This function tests whether the driver specified by DriverBindingHandle is
|
||||
currently managing the controller specified by ControllerHandle. This test
|
||||
is performed by evaluating if the the protocol specified by ProtocolGuid is
|
||||
present on ControllerHandle and is was opened by DriverBindingHandle with an
|
||||
attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
|
||||
If ProtocolGuid is NULL, then ASSERT().
|
||||
|
||||
@param ControllerHandle A handle for a controller to test.
|
||||
@param DriverBindingHandle Specifies the driver binding handle for the
|
||||
driver.
|
||||
@param ProtocolGuid Specifies the protocol that the driver specified
|
||||
by DriverBindingHandle opens in its Start()
|
||||
function.
|
||||
|
||||
@retval EFI_SUCCESS ControllerHandle is managed by the driver
|
||||
specifed by DriverBindingHandle.
|
||||
@retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
|
||||
specifed by DriverBindingHandle.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiTestManagedDevice (
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
IN CONST EFI_HANDLE DriverBindingHandle,
|
||||
IN CONST EFI_GUID *ProtocolGuid
|
||||
);
|
||||
|
||||
/**
|
||||
Tests whether a child handle is a child device of the controller.
|
||||
|
||||
This function tests whether ChildHandle is one of the children of
|
||||
ControllerHandle. This test is performed by checking to see if the protocol
|
||||
specified by ProtocolGuid is present on ControllerHandle and opened by
|
||||
ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
||||
If ProtocolGuid is NULL, then ASSERT().
|
||||
|
||||
@param ControllerHandle A handle for a (parent) controller to test.
|
||||
@param ChildHandle A child handle to test.
|
||||
@param ConsumsedGuid Supplies the protocol that the child controller
|
||||
opens on its parent controller.
|
||||
|
||||
@retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
|
||||
@retval EFI_UNSUPPORTED ChildHandle is not a child of the
|
||||
ControllerHandle.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiTestChildHandle (
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
IN CONST EFI_HANDLE ChildHandle,
|
||||
IN CONST EFI_GUID *ProtocolGuid
|
||||
);
|
||||
|
||||
/**
|
||||
This function looks up a Unicode string in UnicodeStringTable. If Language is
|
||||
a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable
|
||||
that matches the language code specified by Language, then it is returned in
|
||||
UnicodeString.
|
||||
|
||||
@param Language A pointer to the ISO 639-2 language code for the
|
||||
Unicode string to look up and return.
|
||||
@param SupportedLanguages A pointer to the set of ISO 639-2 language codes
|
||||
that the Unicode string table supports. Language
|
||||
must be a member of this set.
|
||||
@param UnicodeStringTable A pointer to the table of Unicode strings.
|
||||
@param UnicodeString A pointer to the Unicode string from UnicodeStringTable
|
||||
that matches the language specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string that matches the language
|
||||
specified by Language was found
|
||||
in the table of Unicoide strings UnicodeStringTable,
|
||||
and it was returned in UnicodeString.
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
@retval EFI_INVALID_PARAMETER UnicodeString is NULL.
|
||||
@retval EFI_UNSUPPORTED SupportedLanguages is NULL.
|
||||
@retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
|
||||
@retval EFI_UNSUPPORTED The language specified by Language is not a
|
||||
member of SupportedLanguages.
|
||||
@retval EFI_UNSUPPORTED The language specified by Language is not
|
||||
supported by UnicodeStringTable.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
LookupUnicodeString (
|
||||
IN CONST CHAR8 *Language,
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
|
||||
OUT CHAR16 **UnicodeString
|
||||
);
|
||||
|
||||
/**
|
||||
This function adds a Unicode string to UnicodeStringTable.
|
||||
If Language is a member of SupportedLanguages then UnicodeString is added to
|
||||
UnicodeStringTable. New buffers are allocated for both Language and
|
||||
UnicodeString. The contents of Language and UnicodeString are copied into
|
||||
these new buffers. These buffers are automatically freed when
|
||||
FreeUnicodeStringTable() is called.
|
||||
|
||||
@param Language A pointer to the ISO 639-2 language code for the Unicode
|
||||
string to add.
|
||||
@param SupportedLanguages A pointer to the set of ISO 639-2 language codes
|
||||
that the Unicode string table supports.
|
||||
Language must be a member of this set.
|
||||
@param UnicodeStringTable A pointer to the table of Unicode strings.
|
||||
@param UnicodeString A pointer to the Unicode string to add.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string that matches the language
|
||||
specified by Language was found in the table of
|
||||
Unicode strings UnicodeStringTable, and it was
|
||||
returned in UnicodeString.
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
@retval EFI_INVALID_PARAMETER UnicodeString is NULL.
|
||||
@retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
|
||||
@retval EFI_UNSUPPORTED SupportedLanguages is NULL.
|
||||
@retval EFI_ALREADY_STARTED A Unicode string with language Language is
|
||||
already present in UnicodeStringTable.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
|
||||
Unicode string to UnicodeStringTable.
|
||||
@retval EFI_UNSUPPORTED The language specified by Language is not a
|
||||
member of SupportedLanguages.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddUnicodeString (
|
||||
IN CONST CHAR8 *Language,
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
|
||||
IN CONST CHAR16 *UnicodeString
|
||||
);
|
||||
|
||||
/**
|
||||
This function frees the table of Unicode strings in UnicodeStringTable.
|
||||
If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
|
||||
Otherwise, each language code, and each Unicode string in the Unicode string
|
||||
table are freed, and EFI_SUCCESS is returned.
|
||||
|
||||
@param UnicodeStringTable A pointer to the table of Unicode strings.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string table was freed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FreeUnicodeStringTable (
|
||||
IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
|
||||
);
|
||||
|
||||
/**
|
||||
This function computes and returns the width of the Unicode character
|
||||
specified by UnicodeChar.
|
||||
|
||||
@param UnicodeChar A Unicode character.
|
||||
|
||||
@retval 0 The width if UnicodeChar could not be determined.
|
||||
@retval 1 UnicodeChar is a narrow glyph.
|
||||
@retval 2 UnicodeChar is a wide glyph.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
GetGlyphWidth (
|
||||
IN CHAR16 UnicodeChar
|
||||
);
|
||||
|
||||
/**
|
||||
This function computes and returns the display length of
|
||||
the Null-terminated Unicode string specified by String.
|
||||
If String is NULL, then 0 is returned.
|
||||
If any of the widths of the Unicode characters in String
|
||||
can not be determined, then 0 is returned.
|
||||
|
||||
@param String A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return The display length of the Null-terminated Unicode string specified by String.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
UnicodeStringDisplayLength (
|
||||
IN CONST CHAR16 *String
|
||||
);
|
||||
|
||||
//
|
||||
// Functions that abstract early Framework contamination of UEFI.
|
||||
//
|
||||
/**
|
||||
Signal a Ready to Boot Event.
|
||||
|
||||
Create a Ready to Boot Event. Signal it and close it. This causes other
|
||||
events of the same event group to be signaled in other modules.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiSignalEventReadyToBoot (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Signal a Legacy Boot Event.
|
||||
|
||||
Create a legacy Boot Event. Signal it and close it. This causes other
|
||||
events of the same event group to be signaled in other modules.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiSignalEventLegacyBoot (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Create a Legacy Boot Event.
|
||||
|
||||
Tiano extended the CreateEvent Type enum to add a legacy boot event type.
|
||||
This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
|
||||
added and now it's possible to not voilate the UEFI specification by
|
||||
declaring a GUID for the legacy boot event class. This library supports
|
||||
the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
|
||||
work both ways.
|
||||
|
||||
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||
|
||||
@retval EFI_SUCCESS Event was created.
|
||||
@retval Other Event was not created.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiCreateEventLegacyBoot (
|
||||
OUT EFI_EVENT *LegacyBootEvent
|
||||
);
|
||||
|
||||
/**
|
||||
Create an EFI event in the Legacy Boot Event Group and allows
|
||||
the caller to specify a notification function.
|
||||
|
||||
This function abstracts the creation of the Legacy Boot Event.
|
||||
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
|
||||
This library abstracts the caller from how this event is created to prevent
|
||||
to code form having to change with the version of the specification supported.
|
||||
If LegacyBootEvent is NULL, then ASSERT().
|
||||
|
||||
@param NotifyTpl The task priority level of the event.
|
||||
@param NotifyFunction The notification function to call when the event is signaled.
|
||||
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
|
||||
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||
|
||||
@retval EFI_SUCCESS Event was created.
|
||||
@retval Other Event was not created.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiCreateEventLegacyBootEx (
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||
IN VOID *NotifyContext, OPTIONAL
|
||||
OUT EFI_EVENT *LegacyBootEvent
|
||||
);
|
||||
|
||||
/**
|
||||
Create a Read to Boot Event.
|
||||
|
||||
Tiano extended the CreateEvent Type enum to add a ready to boot event type.
|
||||
This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
|
||||
added and now it's possible to not voilate the UEFI specification and use
|
||||
the ready to boot event class defined in UEFI 2.0. This library supports
|
||||
the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to
|
||||
work both ways.
|
||||
|
||||
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||
|
||||
@retval EFI_SUCCESS Event was created.
|
||||
@retval Other Event was not created.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiCreateEventReadyToBoot (
|
||||
OUT EFI_EVENT *ReadyToBootEvent
|
||||
);
|
||||
|
||||
/**
|
||||
Create an EFI event in the Ready To Boot Event Group and allows
|
||||
the caller to specify a notification function.
|
||||
|
||||
This function abstracts the creation of the Ready to Boot Event.
|
||||
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
|
||||
This library abstracts the caller from how this event is created to prevent
|
||||
to code form having to change with the version of the specification supported.
|
||||
If ReadyToBootEvent is NULL, then ASSERT().
|
||||
|
||||
@param NotifyTpl The task priority level of the event.
|
||||
@param NotifyFunction The notification function to call when the event is signaled.
|
||||
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
|
||||
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||
|
||||
@retval EFI_SUCCESS Event was created.
|
||||
@retval Other Event was not created.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiCreateEventReadyToBootEx (
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||
IN VOID *NotifyContext, OPTIONAL
|
||||
OUT EFI_EVENT *ReadyToBootEvent
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize a Firmware Volume (FV) Media Device Path node.
|
||||
|
||||
Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
|
||||
so as we move to UEFI 2.0 support we must use a mechanism that conforms with
|
||||
the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
|
||||
device path is defined for Tiano extensions of device path. If the code
|
||||
is compiled to conform with the UEFI 2.0 specification use the new device path
|
||||
else use the old form for backwards compatability.
|
||||
|
||||
@param FvDevicePathNode Pointer to a FV device path node to initialize
|
||||
@param NameGuid FV file name to use in FvDevicePathNode
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiInitializeFwVolDevicepathNode (
|
||||
IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
|
||||
IN CONST EFI_GUID *NameGuid
|
||||
);
|
||||
|
||||
/**
|
||||
Check to see if the Firmware Volume (FV) Media Device Path is valid
|
||||
|
||||
Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
|
||||
so as we move to UEFI 2.0 support we must use a mechanism that conforms with
|
||||
the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
|
||||
device path is defined for Tiano extensions of device path. If the code
|
||||
is compiled to conform with the UEFI 2.0 specification use the new device path
|
||||
else use the old form for backwards compatability. The return value to this
|
||||
function points to a location in FvDevicePathNode and it does not allocate
|
||||
new memory for the GUID pointer that is returned.
|
||||
|
||||
@param FvDevicePathNode Pointer to FV device path to check.
|
||||
|
||||
@retval NULL FvDevicePathNode is not valid.
|
||||
@retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
|
||||
|
||||
**/
|
||||
EFI_GUID *
|
||||
EFIAPI
|
||||
EfiGetNameGuidFromFwVolDevicePathNode (
|
||||
IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
|
||||
);
|
||||
|
||||
/**
|
||||
Prints a formatted Unicode string to the console output device specified by
|
||||
ConOut defined in the EFI_SYSTEM_TABLE.
|
||||
|
||||
This function prints a formatted Unicode string to the console output device
|
||||
specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
|
||||
characters that printed to ConOut. If the length of the formatted Unicode
|
||||
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||
PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
|
||||
|
||||
@param Format Null-terminated Unicode format string.
|
||||
@param ... VARARG list consumed to process Format.
|
||||
If Format is NULL, then ASSERT().
|
||||
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
Print (
|
||||
IN CONST CHAR16 *Format,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Prints a formatted Unicode string to the console output device specified by
|
||||
StdErr defined in the EFI_SYSTEM_TABLE.
|
||||
|
||||
This function prints a formatted Unicode string to the console output device
|
||||
specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
|
||||
characters that printed to StdErr. If the length of the formatted Unicode
|
||||
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||
PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
|
||||
|
||||
@param Format Null-terminated Unicode format string.
|
||||
@param ... VARARG list consumed to process Format.
|
||||
If Format is NULL, then ASSERT().
|
||||
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
ErrorPrint (
|
||||
IN CONST CHAR16 *Format,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Prints a formatted ASCII string to the console output device specified by
|
||||
ConOut defined in the EFI_SYSTEM_TABLE.
|
||||
|
||||
This function prints a formatted ASCII string to the console output device
|
||||
specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
|
||||
characters that printed to ConOut. If the length of the formatted ASCII
|
||||
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||
PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
|
||||
|
||||
@param Format Null-terminated ASCII format string.
|
||||
@param ... VARARG list consumed to process Format.
|
||||
If Format is NULL, then ASSERT().
|
||||
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiPrint (
|
||||
IN CONST CHAR8 *Format,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Prints a formatted ASCII string to the console output device specified by
|
||||
StdErr defined in the EFI_SYSTEM_TABLE.
|
||||
|
||||
This function prints a formatted ASCII string to the console output device
|
||||
specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
|
||||
characters that printed to StdErr. If the length of the formatted ASCII
|
||||
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||
PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
|
||||
|
||||
@param Format Null-terminated ASCII format string.
|
||||
@param ... VARARG list consumed to process Format.
|
||||
If Format is NULL, then ASSERT().
|
||||
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiErrorPrint (
|
||||
IN CONST CHAR8 *Format,
|
||||
...
|
||||
);
|
||||
|
||||
#endif
|
430
MdePkg/Include/Library/UefiRuntimeLib.h
Normal file
430
MdePkg/Include/Library/UefiRuntimeLib.h
Normal file
@ -0,0 +1,430 @@
|
||||
/** @file
|
||||
Library to abstract runtime services
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: UefiRuntimeLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_RUNTIME_LIB__
|
||||
#define __UEFI_RUNTIME_LIB__
|
||||
|
||||
|
||||
extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];
|
||||
|
||||
extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[];
|
||||
|
||||
/**
|
||||
Check to see if the execute context is in Runtime phase or not.
|
||||
|
||||
@param None.
|
||||
|
||||
@retval TRUE The driver is in SMM.
|
||||
@retval FALSE The driver is not in SMM.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
EfiAtRuntime (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Check to see if the SetVirtualAddressMsp() is invoked or not.
|
||||
|
||||
@retval TRUE SetVirtualAddressMsp() has been called.
|
||||
@retval FALSE SetVirtualAddressMsp() has not been called.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
EfiGoneVirtual (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Return current time and date information, and time-keeping
|
||||
capabilities of hardware platform.
|
||||
|
||||
@param Time A pointer to storage to receive a snapshot of the current time.
|
||||
@param Capabilities An optional pointer to a buffer to receive the real time clock device's
|
||||
capabilities.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiGetTime (
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities
|
||||
);
|
||||
|
||||
/**
|
||||
Set current time and date information.
|
||||
|
||||
@param Time A pointer to cache of time setting.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to execute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiSetTime (
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
/**
|
||||
Return current wakeup alarm clock setting.
|
||||
|
||||
@param Enabled Indicate if the alarm clock is enabled or disabled.
|
||||
@param Pending Indicate if the alarm signal is pending and requires acknowledgement.
|
||||
@param Time Current alarm clock setting.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiGetWakeupTime (
|
||||
OUT BOOLEAN *Enabled,
|
||||
OUT BOOLEAN *Pending,
|
||||
OUT EFI_TIME *Time
|
||||
);
|
||||
|
||||
/**
|
||||
Set current wakeup alarm clock.
|
||||
|
||||
@param Enable Enable or disable current alarm clock..
|
||||
@param Time Point to alarm clock setting.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiSetWakeupTime (
|
||||
IN BOOLEAN Enable,
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
/**
|
||||
Return value of variable.
|
||||
|
||||
@param VariableName the name of the vendor's variable, it's a
|
||||
Null-Terminated Unicode String
|
||||
@param VendorGuid Unify identifier for vendor.
|
||||
@param Attributes Point to memory location to return the attributes of variable. If the point
|
||||
is NULL, the parameter would be ignored.
|
||||
@param DataSize As input, point to the maxinum size of return Data-Buffer.
|
||||
As output, point to the actual size of the returned Data-Buffer.
|
||||
@param Data Point to return Data-Buffer.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiGetVariable (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes,
|
||||
IN OUT UINTN *DataSize,
|
||||
OUT VOID *Data
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Enumerates variable's name.
|
||||
|
||||
@param VariableNameSize As input, point to maxinum size of variable name.
|
||||
As output, point to actual size of varaible name.
|
||||
@param VariableName As input, supplies the last VariableName that was returned by
|
||||
GetNextVariableName().
|
||||
As output, returns the name of variable. The name
|
||||
string is Null-Terminated Unicode string.
|
||||
@param VendorGuid As input, supplies the last VendorGuid that was returned by
|
||||
GetNextVriableName().
|
||||
As output, returns the VendorGuid of the current variable.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiGetNextVariableName (
|
||||
IN OUT UINTN *VariableNameSize,
|
||||
IN OUT CHAR16 *VariableName,
|
||||
IN OUT EFI_GUID *VendorGuid
|
||||
);
|
||||
|
||||
/**
|
||||
Sets value of variable.
|
||||
|
||||
@param VariableName the name of the vendor's variable, it's a
|
||||
Null-Terminated Unicode String
|
||||
@param VendorGuid Unify identifier for vendor.
|
||||
@param Attributes Point to memory location to return the attributes of variable. If the point
|
||||
is NULL, the parameter would be ignored.
|
||||
@param DataSize The size in bytes of Data-Buffer.
|
||||
@param Data Point to the content of the variable.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiSetVariable (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
);
|
||||
|
||||
/**
|
||||
Returns the next high 32 bits of platform's monotonic counter.
|
||||
|
||||
@param HighCount Pointer to returned value.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiGetNextHighMonotonicCount (
|
||||
OUT UINT32 *HighCount
|
||||
);
|
||||
|
||||
/**
|
||||
Resets the entire platform.
|
||||
|
||||
@param ResetType The type of reset to perform.
|
||||
@param ResetStatus The status code for reset.
|
||||
@param DataSize The size in bytes of reset data.
|
||||
@param ResetData Pointer to data buffer that includes
|
||||
Null-Terminated Unicode string.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EfiResetSystem (
|
||||
IN EFI_RESET_TYPE ResetType,
|
||||
IN EFI_STATUS ResetStatus,
|
||||
IN UINTN DataSize,
|
||||
IN CHAR16 *ResetData
|
||||
);
|
||||
|
||||
/**
|
||||
Determines the new virtual address that is to be used on subsequent memory accesses.
|
||||
|
||||
@param DebugDisposition Supplies type information for the pointer being converted.
|
||||
@param Address The pointer to a pointer that is to be fixed to be the
|
||||
value needed for the new virtual address mapping being
|
||||
applied.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiConvertPointer (
|
||||
IN UINTN DebugDisposition,
|
||||
IN OUT VOID **Address
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Change the runtime addressing mode of EFI firmware from physical to virtual.
|
||||
|
||||
@param MemoryMapSize The size in bytes of VirtualMap.
|
||||
@param DescriptorSize The size in bytes of an entry in the VirtualMap.
|
||||
@param DescriptorVersion The version of the structure entries in VirtualMap.
|
||||
@param VirtualMap An array of memory descriptors which contain new virtual
|
||||
address mapping information for all runtime ranges. Type
|
||||
EFI_MEMORY_DESCRIPTOR is defined in the
|
||||
GetMemoryMap() function description.
|
||||
|
||||
@retval EFI_SUCCESS The virtual address map has been applied.
|
||||
@retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
|
||||
virtual address mapped mode.
|
||||
@retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
|
||||
invalid.
|
||||
@retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
|
||||
map that requires a mapping.
|
||||
@retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
|
||||
in the memory map.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiSetVirtualAddressMap (
|
||||
IN UINTN MemoryMapSize,
|
||||
IN UINTN DescriptorSize,
|
||||
IN UINT32 DescriptorVersion,
|
||||
IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Conver the standard Lib double linked list to a virtual mapping.
|
||||
|
||||
@param DebugDisposition Supplies type information for the pointer being converted.
|
||||
@param ListHead Head of linked list to convert.
|
||||
|
||||
@retval EFI_SUCCESS Success to execute the function.
|
||||
@retval !EFI_SUCCESS Failed to e3xecute the function.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiConvertList (
|
||||
IN UINTN DebugDisposition,
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Passes capsules to the firmware with both virtual and physical mapping.
|
||||
Depending on the intended consumption, the firmware may
|
||||
process the capsule immediately. If the payload should persist across a
|
||||
system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
|
||||
be passed into ResetSystem() and will cause the capsule to be processed by
|
||||
the firmware as part of the reset process.
|
||||
|
||||
@param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
|
||||
being passed into update capsule. Each capsules is assumed to
|
||||
stored in contiguous virtual memory. The capsules in the
|
||||
CapsuleHeaderArray must be the same capsules as the
|
||||
ScatterGatherList. The CapsuleHeaderArray must
|
||||
have the capsules in the same order as the ScatterGatherList.
|
||||
@param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
|
||||
CaspuleHeaderArray.
|
||||
@param ScatterGatherList Physical pointer to a set of
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
|
||||
location in physical memory of a set of capsules. See Related
|
||||
Definitions for an explanation of how more than one capsule is
|
||||
passed via this interface. The capsules in the
|
||||
ScatterGatherList must be in the same order as the
|
||||
CapsuleHeaderArray. This parameter is only referenced if
|
||||
the capsules are defined to persist across system reset.
|
||||
|
||||
@retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If
|
||||
CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
|
||||
capsule has been successfully processed by the firmware.
|
||||
@retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.
|
||||
@retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiUpdateCapsule (
|
||||
IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
|
||||
IN UINTN CapsuleCount,
|
||||
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or
|
||||
capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and
|
||||
size of the entire capsule is checked.
|
||||
If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be
|
||||
constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof
|
||||
(EFI_CAPSULE_HEADER). To determine reset requirements,
|
||||
CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the
|
||||
EFI_CAPSULE_HEADER.
|
||||
The firmware must support any capsule that has the
|
||||
CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The
|
||||
firmware sets the policy for what capsules are supported that do not have the
|
||||
CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.
|
||||
|
||||
@param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
|
||||
being passed into update capsule. The capsules are assumed to
|
||||
stored in contiguous virtual memory.
|
||||
@param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
|
||||
CaspuleHeaderArray.
|
||||
@param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can
|
||||
support as an argument to UpdateCapsule() via
|
||||
CapsuleHeaderArray and ScatterGatherList.
|
||||
Undefined on input.
|
||||
@param ResetType Returns the type of reset required for the capsule update.
|
||||
|
||||
@retval EFI_SUCCESS Valid answer returned..
|
||||
@retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
|
||||
@retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and
|
||||
MaximumCapsuleSize and ResetType are undefined.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiQueryCapsuleCapabilities (
|
||||
IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
|
||||
IN UINTN CapsuleCount,
|
||||
OUT UINT64 *MaximumCapsuleSize,
|
||||
OUT EFI_RESET_TYPE *ResetType
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
The QueryVariableInfo() function allows a caller to obtain the information about the
|
||||
maximum size of the storage space available for the EFI variables, the remaining size of the storage
|
||||
space available for the EFI variables and the maximum size of each individual EFI variable,
|
||||
associated with the attributes specified.
|
||||
The returned MaximumVariableStorageSize, RemainingVariableStorageSize,
|
||||
MaximumVariableSize information may change immediately after the call based on other
|
||||
runtime activities including asynchronous error events. Also, these values associated with different
|
||||
attributes are not additive in nature.
|
||||
|
||||
@param Attributes Attributes bitmask to specify the type of variables on
|
||||
which to return information. Refer to the
|
||||
GetVariable() function description.
|
||||
@param MaximumVariableStorageSize
|
||||
On output the maximum size of the storage space
|
||||
available for the EFI variables associated with the
|
||||
attributes specified.
|
||||
@param RemainingVariableStorageSize
|
||||
Returns the remaining size of the storage space
|
||||
available for the EFI variables associated with the
|
||||
attributes specified..
|
||||
@param MaximumVariableSize Returns the maximum size of the individual EFI
|
||||
variables associated with the attributes specified.
|
||||
|
||||
@retval EFI_SUCCESS Valid answer returned.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
|
||||
@retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the
|
||||
MaximumVariableStorageSize,
|
||||
RemainingVariableStorageSize, MaximumVariableSize
|
||||
are undefined.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiQueryVariableInfo (
|
||||
IN UINT32 Attrubutes,
|
||||
OUT UINT64 *MaximumVariableStorageSize,
|
||||
OUT UINT64 *RemainingVariableStorageSize,
|
||||
OUT UINT64 *MaximumVariableSize
|
||||
);
|
||||
|
||||
#endif
|
||||
|
25
MdePkg/Include/Library/UefiRuntimeServicesTableLib.h
Normal file
25
MdePkg/Include/Library/UefiRuntimeServicesTableLib.h
Normal file
@ -0,0 +1,25 @@
|
||||
/** @file
|
||||
Library that provides a global pointer to the UEFI Runtime Services Tables
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: UefiRuntimeServicesTableLib.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_RUNTIME_SERVICES_TABLE_LIB_H__
|
||||
#define __UEFI_RUNTIME_SERVICES_TABLE_LIB_H__
|
||||
|
||||
//
|
||||
// Cached copy of the EFI Runtime Services Table
|
||||
//
|
||||
extern EFI_RUNTIME_SERVICES *gRT;
|
||||
|
||||
#endif
|
373
MdePkg/Include/Library/UsbLib.h
Normal file
373
MdePkg/Include/Library/UsbLib.h
Normal file
@ -0,0 +1,373 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbDxeLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Common Dxe Libarary for USB
|
||||
Add Constants & structure definitions for Usb HID
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _USB_DXE_LIB_H
|
||||
#define _USB_DXE_LIB_H
|
||||
|
||||
//
|
||||
// define the timeout time as 3ms
|
||||
//
|
||||
#define TIMEOUT_VALUE 3 * 1000
|
||||
|
||||
//
|
||||
// HID constants definition, see HID rev1.0
|
||||
//
|
||||
//
|
||||
// HID report item format
|
||||
//
|
||||
#define HID_ITEM_FORMAT_SHORT 0
|
||||
#define HID_ITEM_FORMAT_LONG 1
|
||||
|
||||
//
|
||||
// Special tag indicating long items
|
||||
//
|
||||
#define HID_ITEM_TAG_LONG 15
|
||||
|
||||
//
|
||||
// HID report descriptor item type (prefix bit 2,3)
|
||||
//
|
||||
#define HID_ITEM_TYPE_MAIN 0
|
||||
#define HID_ITEM_TYPE_GLOBAL 1
|
||||
#define HID_ITEM_TYPE_LOCAL 2
|
||||
#define HID_ITEM_TYPE_RESERVED 3
|
||||
|
||||
//
|
||||
// HID report descriptor main item tags
|
||||
//
|
||||
#define HID_MAIN_ITEM_TAG_INPUT 8
|
||||
#define HID_MAIN_ITEM_TAG_OUTPUT 9
|
||||
#define HID_MAIN_ITEM_TAG_FEATURE 11
|
||||
#define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION 10
|
||||
#define HID_MAIN_ITEM_TAG_END_COLLECTION 12
|
||||
|
||||
//
|
||||
// HID report descriptor main item contents
|
||||
//
|
||||
#define HID_MAIN_ITEM_CONSTANT 0x001
|
||||
#define HID_MAIN_ITEM_VARIABLE 0x002
|
||||
#define HID_MAIN_ITEM_RELATIVE 0x004
|
||||
#define HID_MAIN_ITEM_WRAP 0x008
|
||||
#define HID_MAIN_ITEM_NONLINEAR 0x010
|
||||
#define HID_MAIN_ITEM_NO_PREFERRED 0x020
|
||||
#define HID_MAIN_ITEM_NULL_STATE 0x040
|
||||
#define HID_MAIN_ITEM_VOLATILE 0x080
|
||||
#define HID_MAIN_ITEM_BUFFERED_BYTE 0x100
|
||||
|
||||
//
|
||||
// HID report descriptor collection item types
|
||||
//
|
||||
#define HID_COLLECTION_PHYSICAL 0
|
||||
#define HID_COLLECTION_APPLICATION 1
|
||||
#define HID_COLLECTION_LOGICAL 2
|
||||
|
||||
//
|
||||
// HID report descriptor global item tags
|
||||
//
|
||||
#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0
|
||||
#define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM 1
|
||||
#define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM 2
|
||||
#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM 3
|
||||
#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM 4
|
||||
#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 5
|
||||
#define HID_GLOBAL_ITEM_TAG_UNIT 6
|
||||
#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 7
|
||||
#define HID_GLOBAL_ITEM_TAG_REPORT_ID 8
|
||||
#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 9
|
||||
#define HID_GLOBAL_ITEM_TAG_PUSH 10
|
||||
#define HID_GLOBAL_ITEM_TAG_POP 11
|
||||
|
||||
//
|
||||
// HID report descriptor local item tags
|
||||
//
|
||||
#define HID_LOCAL_ITEM_TAG_USAGE 0
|
||||
#define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM 1
|
||||
#define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM 2
|
||||
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 3
|
||||
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 4
|
||||
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 5
|
||||
#define HID_LOCAL_ITEM_TAG_STRING_INDEX 7
|
||||
#define HID_LOCAL_ITEM_TAG_STRING_MINIMUM 8
|
||||
#define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM 9
|
||||
#define HID_LOCAL_ITEM_TAG_DELIMITER 10
|
||||
|
||||
//
|
||||
// HID usage tables
|
||||
//
|
||||
#define HID_USAGE_PAGE 0xffff0000
|
||||
|
||||
#define HID_UP_GENDESK 0x00010000
|
||||
#define HID_UP_KEYBOARD 0x00070000
|
||||
#define HID_UP_LED 0x00080000
|
||||
#define HID_UP_BUTTON 0x00090000
|
||||
#define HID_UP_CONSUMER 0x000c0000
|
||||
#define HID_UP_DIGITIZER 0x000d0000
|
||||
#define HID_UP_PID 0x000f0000
|
||||
|
||||
#define HID_USAGE 0x0000ffff
|
||||
|
||||
#define HID_GD_POINTER 0x00010001
|
||||
#define HID_GD_MOUSE 0x00010002
|
||||
#define HID_GD_JOYSTICK 0x00010004
|
||||
#define HID_GD_GAMEPAD 0x00010005
|
||||
#define HID_GD_HATSWITCH 0x00010039
|
||||
|
||||
//
|
||||
// HID report types
|
||||
//
|
||||
#define HID_INPUT_REPORT 1
|
||||
#define HID_OUTPUT_REPORT 2
|
||||
#define HID_FEATURE_REPORT 3
|
||||
|
||||
//
|
||||
// HID device quirks.
|
||||
//
|
||||
#define HID_QUIRK_INVERT 0x01
|
||||
#define HID_QUIRK_NOTOUCH 0x02
|
||||
|
||||
//
|
||||
// HID class protocol request
|
||||
//
|
||||
#define EFI_USB_GET_REPORT_REQUEST 0x01
|
||||
#define EFI_USB_GET_IDLE_REQUEST 0x02
|
||||
#define EFI_USB_GET_PROTOCOL_REQUEST 0x03
|
||||
#define EFI_USB_SET_REPORT_REQUEST 0x09
|
||||
#define EFI_USB_SET_IDLE_REQUEST 0x0a
|
||||
#define EFI_USB_SET_PROTOCOL_REQUEST 0x0b
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// Descriptor header for Report/Physical Descriptors
|
||||
//
|
||||
typedef struct hid_class_descriptor {
|
||||
UINT8 DescriptorType;
|
||||
UINT16 DescriptorLength;
|
||||
} EFI_USB_HID_CLASS_DESCRIPTOR;
|
||||
|
||||
typedef struct hid_descriptor {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT16 BcdHID;
|
||||
UINT8 CountryCode;
|
||||
UINT8 NumDescriptors;
|
||||
EFI_USB_HID_CLASS_DESCRIPTOR HidClassDesc[1];
|
||||
} EFI_USB_HID_DESCRIPTOR;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
EFI_STATUS
|
||||
UsbGetHidDescriptor (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 InterfaceNum,
|
||||
OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbGetReportDescriptor (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 InterfaceNum,
|
||||
IN UINT16 DescriptorSize,
|
||||
OUT UINT8 *DescriptorBuffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbGetProtocolRequest (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 Interface,
|
||||
IN UINT8 *Protocol
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbSetProtocolRequest (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 Interface,
|
||||
IN UINT8 Protocol
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbSetIdleRequest (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 Interface,
|
||||
IN UINT8 ReportId,
|
||||
IN UINT8 Duration
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbGetIdleRequest (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 Interface,
|
||||
IN UINT8 ReportId,
|
||||
OUT UINT8 *Duration
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbSetReportRequest (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 Interface,
|
||||
IN UINT8 ReportId,
|
||||
IN UINT8 ReportType,
|
||||
IN UINT16 ReportLen,
|
||||
IN UINT8 *Report
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UsbGetReportRequest (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 Interface,
|
||||
IN UINT8 ReportId,
|
||||
IN UINT8 ReportType,
|
||||
IN UINT16 ReportLen,
|
||||
IN UINT8 *Report
|
||||
);
|
||||
|
||||
//
|
||||
// Get Device Descriptor
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbGetDescriptor (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT16 Value,
|
||||
IN UINT16 Index,
|
||||
IN UINT16 DescriptorLength,
|
||||
OUT VOID *Descriptor,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Set Device Descriptor
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbSetDescriptor (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT16 Value,
|
||||
IN UINT16 Index,
|
||||
IN UINT16 DescriptorLength,
|
||||
IN VOID *Descriptor,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Get device Interface
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbGetDeviceInterface (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT16 Index,
|
||||
OUT UINT8 *AltSetting,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Set device interface
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbSetDeviceInterface (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT16 InterfaceNo,
|
||||
IN UINT16 AltSetting,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Get device configuration
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbGetDeviceConfiguration (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
OUT UINT8 *ConfigValue,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Set device configuration
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbSetDeviceConfiguration (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT16 Value,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Set Device Feature
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbSetDeviceFeature (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN EFI_USB_RECIPIENT Recipient,
|
||||
IN UINT16 Value,
|
||||
IN UINT16 Target,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Clear Device Feature
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbClearDeviceFeature (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN EFI_USB_RECIPIENT Recipient,
|
||||
IN UINT16 Value,
|
||||
IN UINT16 Target,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Get Device Status
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbGetDeviceStatus (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN EFI_USB_RECIPIENT Recipient,
|
||||
IN UINT16 Target,
|
||||
OUT UINT16 *DevStatus,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// The following APIs are not basic library, but they are common used.
|
||||
//
|
||||
//
|
||||
// Usb Get String
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbGetString (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT16 LangID,
|
||||
IN UINT8 Index,
|
||||
IN VOID *Buf,
|
||||
IN UINTN BufSize,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
//
|
||||
// Clear endpoint stall
|
||||
//
|
||||
EFI_STATUS
|
||||
UsbClearEndpointHalt (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 EndpointNo,
|
||||
OUT UINT32 *Status
|
||||
);
|
||||
|
||||
#endif
|
@ -41,6 +41,7 @@ typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR EFI_PEI_NOTIFY_DESCRIPTOR;
|
||||
#include <Ppi/CpuIo.h>
|
||||
#include <Ppi/PciCfg2.h>
|
||||
|
||||
|
||||
/**
|
||||
The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI
|
||||
Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header.
|
||||
@ -802,4 +803,48 @@ typedef struct _EFI_SEC_PEI_HAND_OFF {
|
||||
UINTN StackSize;
|
||||
} EFI_SEC_PEI_HAND_OFF;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
This function is the entry point for the PEI Foundation, which
|
||||
allows the SEC phase to pass information about the stack,
|
||||
temporary RAM and the Boot Firmware Volume. In addition, it also
|
||||
allows the SEC phase to pass services and data forward for use
|
||||
during the PEI phase in the form of one or more PPIs. There is
|
||||
no limit to the number of additional PPIs that can be passed
|
||||
from SEC into the PEI Foundation. As part of its initialization
|
||||
phase, the PEI Foundation will add these SEC-hosted PPIs to its
|
||||
PPI database such that both the PEI Foundation and any modules
|
||||
can leverage the associated service calls and/or code in these
|
||||
early PPIs.
|
||||
|
||||
@param SecCoreData Points to a data structure containing
|
||||
information about the PEI core's
|
||||
operating environment, such as the size
|
||||
and location of temporary RAM, the stack
|
||||
location and the BFV location. The type
|
||||
EFI_SEC_PEI_HAND_OFF is
|
||||
|
||||
@param PpiList Points to a list of one or more PPI
|
||||
descriptors to be installed initially by
|
||||
the PEI core. An empty PPI list consists
|
||||
of a single descriptor with the end-tag
|
||||
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.
|
||||
As part of its initialization phase, the
|
||||
PEI Foundation will add these SEC-hosted
|
||||
PPIs to its PPI database such that both
|
||||
the PEI Foundation and any modules can
|
||||
leverage the associated service calls
|
||||
and/or code in these early PPIs.
|
||||
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
EFIAPI
|
||||
(*EFI_PEI_CORE_ENTRY_POINT)(
|
||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user