Initial import.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bbahnsen
2006-04-21 22:54:32 +00:00
commit 878ddf1fc3
2651 changed files with 624620 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,395 @@
/** @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__
/**
Copy Length bytes from Source to Destination.
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 Destination Target of copy
@param Source Place to copy from
@param Length Number of bytes to copy
@return Destination
**/
VOID *
EFIAPI
CopyMem (
OUT VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
);
/**
Set Buffer to Value for Size bytes.
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 Size 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 Buffer is NULL and Length > 0, 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 Buffer is NULL and Length > 0, 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 Buffer is NULL and Length > 0, 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
);
/**
Set Buffer to 0 for Size bytes.
This function fills Length bytes of Buffer with zeros, and returns Buffer.
If Buffer is NULL and Length > 0, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Memory to set.
@param Size Number of bytes to set
@return Buffer
**/
VOID *
EFIAPI
ZeroMem (
OUT VOID *Buffer,
IN UINTN Length
);
/**
Compares two memory buffers of a given length.
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 DestinationBuffer is NULL and Length > 0, then ASSERT().
If 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 First memory buffer
@param SourceBuffer Second memory buffer
@param Length Length of DestinationBuffer and SourceBuffer memory
regions to compare
@retval 0 if DestinationBuffer == SourceBuffer
@retval Non-zero if DestinationBuffer != SourceBuffer
**/
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 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 Pointer to the first occurrence or NULL if not found.
@retval NULL if Length == 0 or Value was not found.
**/
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 at 16-bit increments for a 16-bit
value that matches Value. If a match is found, then a pointer to the matching
value in the target buffer is returned. If no match is found, then NULL is
returned. If Length is 0, then NULL is returned.
If Buffer is NULL, then ASSERT().
If Buffer 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 Pointer to the first occurrence.
@retval NULL if Length == 0 or Value was not found.
**/
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 at 32-bit increments for a 32-bit
value that matches Value. If a match is found, then a pointer to the matching
value in the target buffer is returned. If no match is found, then NULL is
returned. If Length is 0, then NULL is returned.
If Buffer is NULL, then ASSERT().
If Buffer 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 Pointer to the first occurrence or NULL if not found.
@retval NULL if Length == 0 or Value was not found.
**/
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 at 64-bit increments for a 64-bit
value that matches Value. If a match is found, then a pointer to the matching
value in the target buffer is returned. If no match is found, then NULL is
returned. If Length is 0, then NULL is returned.
If Buffer is NULL, then ASSERT().
If Buffer 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 Pointer to the first occurrence or NULL if not found.
@retval NULL if Length == 0 or Value was not found.
**/
VOID *
EFIAPI
ScanMem64 (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT64 Value
);
/**
This function 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 guid to compare
@param Guid2 guid to compare
@retval TRUE if Guid1 == Guid2
@retval FALSE if Guid1 != Guid2
**/
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 Buffer is NULL, then ASSERT().
If Buffer 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 Guid Value to search for in the target buffer.
@return Pointer to the first occurrence.
@retval NULL if Length == 0 or Guid was not found.
**/
VOID *
EFIAPI
ScanGuid (
IN CONST VOID *Buffer,
IN UINTN Length,
IN CONST GUID *Guid
);
#endif

View File

@@ -0,0 +1,72 @@
/** @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__
VOID
EFIAPI
InvalidateInstructionCache (
VOID
);
VOID *
EFIAPI
InvalidateInstructionCacheRange (
IN VOID *Address,
IN UINTN Length
);
VOID
EFIAPI
WriteBackInvalidateDataCache (
VOID
);
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
);
VOID
EFIAPI
WriteBackDataCache (
VOID
);
VOID *
EFIAPI
WriteBackDataCacheRange (
IN VOID *Address,
IN UINTN Length
);
VOID
EFIAPI
InvalidateDataCache (
VOID
);
VOID *
EFIAPI
InvalidateInstructionCacheRange (
IN VOID *Address,
IN UINTN Length
);
#endif

View 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

View File

@@ -0,0 +1,439 @@
/** @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 EFI_D_INIT 0x00000001 // Initialization style messages
#define EFI_D_WARN 0x00000002 // Warnings
#define EFI_D_LOAD 0x00000004 // Load events
#define EFI_D_FS 0x00000008 // EFI File system
#define EFI_D_POOL 0x00000010 // Alloc & Free's
#define EFI_D_PAGE 0x00000020 // Alloc & Free's
#define EFI_D_INFO 0x00000040 // Verbose
#define EFI_D_VARIABLE 0x00000100 // Variable
#define EFI_D_BM 0x00000400 // Boot Manager (BDS)
#define EFI_D_BLKIO 0x00001000 // BlkIo Driver
#define EFI_D_NET 0x00004000 // SNI Driver
#define EFI_D_UNDI 0x00010000 // UNDI Driver
#define EFI_D_LOADFILE 0x00020000 // UNDI Driver
#define EFI_D_EVENT 0x00080000 // Event messages
#define EFI_D_ERROR 0x80000000 // 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 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 <20>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 <20>(NULL) Filename<6D> is printed.
If Description is NULL, then a <Description> string of <20>(NULL) Description<6F> 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 CHAR8 *FileName,
IN INTN LineNumber,
IN 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 <20> 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 (Guid, NULL, &Instance))) { \
_ASSERT (Guid already installed in database); \
} \
} else { \
if (!EFI_ERROR (gBS->LocateProtocol (Handle, 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; } } 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 <20>CR has a bad signature<72> 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

View File

@@ -0,0 +1,197 @@
/** @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__
/**
This function returns the size, in bytes,
of the device path data structure specified by DevicePath.
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
)
;
/**
This function allocates space for a new copy of the device path
specified by DevicePath.
@param DevicePath A pointer to a device path data structure.
@return The duplicated device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
DuplicateDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
;
/**
This function appends the device path SecondDevicePath
to every device path instance in FirstDevicePath.
@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 is returned.
NULL is returned if space for the new device path could not be allocated from pool.
It is up to the caller to free the memory used by FirstDevicePath and SecondDevicePath
if they are no longer needed.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
AppendDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
)
;
/**
This function appends the device path node SecondDevicePath
to every device path instance in FirstDevicePath.
@param FirstDevicePath A pointer to a device path data structure.
@param SecondDevicePath A pointer to a single device path node.
@return
A pointer to the new device path.
If there is not enough temporary pool memory available to complete this function,
then NULL is returned.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
AppendDevicePathNode (
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
)
;
/**
This function appends the device path instance Instance to the device path Source.
If Source is NULL, then a new device path with one instance is created.
@param Source A pointer to a device path data structure.
@param Instance A pointer to a device path instance.
@return
A pointer to the new device path.
If there is not enough temporary pool memory available to complete this function,
then NULL is returned.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
AppendDevicePathInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *Source,
IN CONST EFI_DEVICE_PATH_PROTOCOL *Instance
)
;
/**
Function retrieves the next device path instance from a device path data structure.
@param DevicePath A pointer to a device path data structure.
@param Size A pointer to the size of a device path instance in bytes.
@return
This function returns a pointer to the current device path instance.
In addition, it returns the size in bytes of the current device path instance in Size,
and a pointer to the next device path instance in DevicePath.
If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GetNextDevicePathInstance (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT UINTN *Size
)
;
/**
Return TRUE is this is a multi instance device path.
@param DevicePath A pointer to a device path data structure.
@retval TRUE If DevicePath is multi-instance.
@retval FALSE If DevicePath is not multi-instance or DevicePath is NULL.
**/
BOOLEAN
EFIAPI
IsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
;
/**
This function retrieves the device path protocol from a handle.
@param Handle The handle from which to retrieve the device path protocol.
@return
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.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
DevicePathFromHandle (
IN EFI_HANDLE Handle
)
;
/**
This function allocates a device path for a file and appends it to an existing device path.
@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
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.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
FileDevicePath (
IN EFI_HANDLE Device, OPTIONAL
IN CONST CHAR16 *FileName
)
;
#endif

View File

@@ -0,0 +1,77 @@
/** @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 the list of driver entry points. Automatics Generated by tool.
@param HobStart Pointer to HobList.
**/
VOID
EFIAPI
ProcessModuleEntryPointList (
IN VOID *HobStart
);
#endif

View File

@@ -0,0 +1,332 @@
/** @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: DxeRuntimeDriverLib.h
**/
#ifndef __DXE_RUNTIME_DRIVER_LIB__
#define __DXE_RUNTIME_DRIVER_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<63><65>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
);
EFI_STATUS
EFIAPI
EfiUpdateCapsule (
IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
);
EFI_STATUS
EFIAPI
EfiQueryCapsuleCapabilities (
IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
OUT UINT64 *MaximumCapsuleSize,
OUT EFI_RESET_TYPE *ResetType
);
EFI_STATUS
EFIAPI
EfiQueryVariableInfo (
IN UINT32 Attrubutes,
OUT UINT64 *MaximumVariableStorageSize,
OUT UINT64 *RemainingVariableStorageSize,
OUT UINT64 *MaximumVariableSize
);
#endif

View 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__
//
//
//
extern EFI_DXE_SERVICES *gDS;
#endif

View 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

View File

@@ -0,0 +1,44 @@
/** @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__
/**
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_PACKAGES *
EFIAPI
PreparePackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
...
)
;
#endif

View File

@@ -0,0 +1,275 @@
/** @file
Public include file for the HOB 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: HobLib.h
**/
#ifndef __HOB_LIB_H__
#define __HOB_LIB_H__
/**
Returns the pointer to the HOB list.
@return The pointer to the HOB list.
**/
VOID *
EFIAPI
GetHobList (
VOID
)
;
/**
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.
@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
)
;
/**
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.
@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.
@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
)
;
/**
This function builds a HOB for a loaded PE32 module.
@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<6C>s 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.
@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
)
;
/**
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.
@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
)
;
/**
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 GUID HOB data.
@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.
@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.
@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.
@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.
@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.
@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.
@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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,547 @@
/** @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 the number of 4KB pages specified by Pages of type EfiBootServicesData.
@param Pages The number of 4 KB pages to allocate.
@return
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.
**/
VOID *
EFIAPI
AllocatePages (
IN UINTN Pages
)
;
/**
Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData.
@param Pages The number of 4 KB pages to allocate.
@return
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.
**/
VOID *
EFIAPI
AllocateRuntimePages (
IN UINTN Pages
)
;
/**
Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType.
@param Pages The number of 4 KB pages to allocate.
@return
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.
**/
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.
@param Buffer Pointer to the buffer of pages to free.
@param Pages The number of 4 KB pages to free.
None.
**/
VOID
EFIAPI
FreePages (
IN VOID *Buffer,
IN UINTN Pages
)
;
/**
Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an alignment specified by Alignment.
@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
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.
**/
VOID *
EFIAPI
AllocateAlignedPages (
IN UINTN Pages,
IN UINTN Alignment
)
;
/**
Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an alignment specified by Alignment.
@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
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.
**/
VOID *
EFIAPI
AllocateAlignedRuntimePages (
IN UINTN Pages,
IN UINTN Alignment
)
;
/**
Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
@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
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.
**/
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.
@param Buffer Pointer to the buffer of pages to free.
@param Pages The number of 4 KB pages to free.
None.
**/
VOID
EFIAPI
FreeAlignedPages (
IN VOID *Buffer,
IN UINTN Pages
)
;
/**
Allocates a buffer of type EfiBootServicesData.
@param AllocationSize The number of bytes to allocate.
@return
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.
**/
VOID *
EFIAPI
AllocatePool (
IN UINTN AllocationSize
)
;
/**
Allocates a buffer of type EfiRuntimeServicesData.
@param AllocationSize The number of bytes to allocate.
@return
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.
**/
VOID *
EFIAPI
AllocateRuntimePool (
IN UINTN AllocationSize
)
;
/**
Allocates a buffer of type EfiReservedMemoryType.
@param AllocationSize The number of bytes to allocate.
@return
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.
**/
VOID *
EFIAPI
AllocateReservedPool (
IN UINTN AllocationSize
)
;
/**
Allocates and zeros a buffer of type EfiBootServicesData.
@param AllocationSize The number of bytes to allocate and zero.
@return
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.
**/
VOID *
EFIAPI
AllocateZeroPool (
IN UINTN AllocationSize
)
;
/**
Allocates and zeros a buffer of type EfiRuntimeServicesData.
@param AllocationSize The number of bytes to allocate and zero.
@return
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.
**/
VOID *
EFIAPI
AllocateRuntimeZeroPool (
IN UINTN AllocationSize
)
;
/**
Allocates and zeros a buffer of type EfiReservedMemoryType.
@param AllocationSize The number of bytes to allocate and zero.
@return
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.
**/
VOID *
EFIAPI
AllocateReservedZeroPool (
IN UINTN AllocationSize
)
;
/**
Copies a buffer to an allocated buffer of type EfiBootServicesData.
@param AllocationSize The number of bytes to allocate.
@param Buffer The buffer to copy to the allocated buffer.
@return
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.
**/
VOID *
EFIAPI
AllocateCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer
)
;
/**
Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
@param AllocationSize The number of bytes to allocate.
@param Buffer The buffer to copy to the allocated buffer.
@return
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.
**/
VOID *
EFIAPI
AllocateRuntimeCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer
)
;
/**
Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
@param AllocationSize The number of bytes to allocate.
@param Buffer The buffer to copy to the allocated buffer.
@return
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.
**/
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.
@param Buffer Pointer to the buffer to free.
None.
**/
VOID
EFIAPI
FreePool (
IN VOID *Buffer
)
;
/**
Allocates a buffer of type EfiBootServicesData at a specified alignment.
@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. 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.
**/
VOID *
EFIAPI
AllocateAlignedPool (
IN UINTN AllocationSize,
IN UINTN Alignment
)
;
/**
Allocates a buffer of type EfiRuntimeServicesData at a specified alignment.
@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. 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.
**/
VOID *
EFIAPI
AllocateAlignedRuntimePool (
IN UINTN AllocationSize,
IN UINTN Alignment
)
;
/**
Allocates a buffer of type EfiReservedMemoryType at a specified alignment.
@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. 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.
**/
VOID *
EFIAPI
AllocateAlignedReservedPool (
IN UINTN AllocationSize,
IN UINTN Alignment
)
;
/**
Allocates and zeros a buffer of type EfiBootServicesData at a specified alignment.
@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. 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.
**/
VOID *
EFIAPI
AllocateAlignedZeroPool (
IN UINTN AllocationSize,
IN UINTN Alignment
)
;
/**
Allocates and zeros a buffer of type EfiRuntimeServicesData at a specified alignment.
@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. 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.
**/
VOID *
EFIAPI
AllocateAlignedRuntimeZeroPool (
IN UINTN AllocationSize,
IN UINTN Alignment
)
;
/**
Allocates and zeros a buffer of type EfiReservedMemoryType at a specified alignment.
@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. 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.
**/
VOID *
EFIAPI
AllocateAlignedReservedZeroPool (
IN UINTN AllocationSize,
IN UINTN Alignment
)
;
/**
Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.
@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. 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.
**/
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.
@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. 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.
**/
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.
@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. 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.
**/
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.
@param Buffer Pointer to the buffer to free.
None.
**/
VOID
EFIAPI
FreeAlignedPool (
IN VOID *Buffer
)
;
#endif

View File

@@ -0,0 +1,690 @@
/** @file
PCD Library Class Interface Declarations
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: PcdLib.h
**/
#ifndef __PCD_LIB_H__
#define __PCD_LIB_H__
#define PcdToken(TokenName) _PCD_TOKEN_##TokenName
//
// Feature Flag is in the form of a global constant
//
#define FeaturePcdGet(TokenName) _gPcd_FixedAtBuild_##TokenName
//
// Fixed is fixed at build time
//
#define FixedPcdGet8(TokenName) _gPcd_FixedAtBuild_##TokenName
#define FixedPcdGet16(TokenName) _gPcd_FixedAtBuild_##TokenName
#define FixedPcdGet32(TokenName) _gPcd_FixedAtBuild_##TokenName
#define FixedPcdGet64(TokenName) _gPcd_FixedAtBuild_##TokenName
#define FixedPcdGetBool(TokenName) _gPcd_FixedAtBuild_##TokenName
//
// BugBug: This works for strings, but not constants.
//
#define FixedPcdGetPtr(TokenName) ((VOID *)_gPcd_FixedAtBuild_##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)
//
// 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_MODE_8_##TokenName
#define PcdGet16(TokenName) _PCD_MODE_16_##TokenName
#define PcdGet32(TokenName) _PCD_MODE_32_##TokenName
#define PcdGet64(TokenName) _PCD_MODE_64_##TokenName
#define PcdGetPtr(TokenName) _PCD_MODE_PTR_##TokenName
#define PcdGetBool(TokenName) _PCD_MODE_BOOL_##TokenName
//
// 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
//
#define PcdSet8(TokenName, Value) LibPcdSet8 (_PCD_TOKEN_##TokenName, Value)
#define PcdSet16(TokenName, Value) LibPcdSet16 (_PCD_TOKEN_##TokenName, Value)
#define PcdSet32(TokenName, Value) LibPcdSet32 (_PCD_TOKEN_##TokenName, Value)
#define PcdSet64(TokenName, Value) LibPcdSet64 (_PCD_TOKEN_##TokenName, Value)
#define PcdSetPtr(TokenName, Value) LibPcdSetPtr (_PCD_TOKEN_##TokenName, Value)
#define PcdSetBool(TokenName, Value) LibPcdSetBool(_PCD_TOKEN_##TokenName, Value)
//
// 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, Value) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, Value)
#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 UINTN 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 Value. Value is returned.
If Value is NULL, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for.
@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 CONST VOID *Value
);
/**
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 and
Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT().
If Value 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 VOID * Return the value been set.
**/
VOID *
EFIAPI
LibPcdSetExPtr (
IN CONST GUID *Guid,
IN UINTN TokenNumber,
IN CONST VOID *Value
);
/**
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().
@param[in] CallBackGuid The PCD token GUID being set.
@param[in] CallBackToken The PCD token number being set.
@param[in] 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 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
);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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 or equal to 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

View File

@@ -0,0 +1,39 @@
/** @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__
/**
Loads a PE/COFF image into memory
@param Pe32Data Pointer to a PE/COFF Image
@param EntryPoint Pointer to the entry point of the PE/COFF image
@retval EFI_SUCCESS if the EntryPoint was returned
@retval EFI_INVALID_PARAMETER if the EntryPoint could not be found from Pe32Data
**/
RETURN_STATUS
EFIAPI
PeCoffLoaderGetEntryPoint (
IN VOID *Pe32Data,
IN OUT VOID **EntryPoint
)
;
#endif

View File

@@ -0,0 +1,131 @@
/** @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: PeCoffLib.h
**/
#ifndef __BASE_PE_COFF_LIB_H__
#define __BASE_PE_COFF_LIB_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
//
// PE/COFF Loader Read Function passed in by caller
//
typedef
RETURN_STATUS
(EFIAPI *PE_COFF_LOADER_READ_FILE) (
IN VOID *FileHandle,
IN UINTN FileOffset,
IN OUT UINTN *ReadSize,
OUT VOID *Buffer
);
//
// Context structure used while PE/COFF image is being loaded and relocated
//
typedef struct {
PHYSICAL_ADDRESS ImageAddress;
UINT64 ImageSize;
PHYSICAL_ADDRESS DestinationAddress;
PHYSICAL_ADDRESS EntryPoint;
PE_COFF_LOADER_READ_FILE ImageRead;
VOID *Handle;
VOID *FixupData;
UINT32 SectionAlignment;
UINT32 PeCoffHeaderOffset;
UINT32 DebugDirectoryEntryRva;
VOID *CodeView;
CHAR8 *PdbPointer;
UINTN SizeOfHeaders;
UINT32 ImageCodeMemoryType;
UINT32 ImageDataMemoryType;
UINT32 ImageError;
UINTN FixupDataSize;
UINT16 Machine;
UINT16 ImageType;
BOOLEAN RelocationsStripped;
BOOLEAN IsTeImage;
} PE_COFF_LOADER_IMAGE_CONTEXT;
/**
Retrieves information on a PE/COFF image
@param ImageContext The context of the image being loaded
@retval EFI_SUCCESS The information on the PE/COFF image was collected.
@retval EFI_INVALID_PARAMETER ImageContext is NULL.
@retval EFI_UNSUPPORTED The PE/COFF image is not supported.
@retval Otherwise The error status from reading the PE/COFF image using the
ImageContext->ImageRead() function
**/
RETURN_STATUS
EFIAPI
PeCoffLoaderGetImageInfo (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
/**
Relocates a PE/COFF image in memory
@param ImageContext Contains information on the loaded image to relocate
@retval EFI_SUCCESS if the PE/COFF image was relocated
@retval EFI_LOAD_ERROR if the image is not a valid PE/COFF image
@retval EFI_UNSUPPORTED not support
**/
RETURN_STATUS
EFIAPI
PeCoffLoaderRelocateImage (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
/**
Loads a PE/COFF image into memory
@param ImageContext Contains information on image to load into memory
@retval EFI_SUCCESS if the PE/COFF image was loaded
@retval EFI_BUFFER_TOO_SMALL if the caller did not provide a large enough buffer
@retval EFI_LOAD_ERROR if the image is a runtime driver with no relocations
@retval EFI_INVALID_PARAMETER if the image address is invalid
**/
RETURN_STATUS
EFIAPI
PeCoffLoaderLoadImage (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
#endif

View File

@@ -0,0 +1,50 @@
/** @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__
/**
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 EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
IN VOID *OldCoreData
);
#endif

View File

@@ -0,0 +1,306 @@
/** @file
PEI Core Library implementation
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: PeiCoreLib.h
**/
#ifndef __PEI_CORE_LIB_H__
#define __PEI_CORE_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
PeiCoreInstallPpi (
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
PeiCoreReinstallPpi (
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
PeiCoreLocatePpi (
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
PeiCoreNotifyPpi (
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
PeiCoreGetBootMode (
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
PeiCoreSetBootMode (
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
PeiCoreGetHobList (
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
PeiCoreCreateHob (
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
PeiCoreFfsFindNextVolume (
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
PeiCoreFfsFindNextFile (
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
PeiCoreFfsFindSectionData (
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
PeiCoreInstallPeiMemory (
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
PeiCoreAllocatePages (
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 allocated 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
PeiCoreAllocatePool (
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
PeiCoreResetSystem (
VOID
)
;
#endif

View File

@@ -0,0 +1,26 @@
/** @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__
EFI_PEI_SERVICES **
GetPeiServicesTablePointer (
VOID
);
#endif

View 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

View File

@@ -0,0 +1,201 @@
/** @file
Library that provides services to measure module execution performance
Copyright (c) 2004, 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
);
/**
Retrieves a previously logged 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 then the start of the measurement is returned in StartTimeStamp,
and the end of the measurement is returned in EndTimeStamp.
@param LogEntryKey The key for the previous performance measurement log entry.
If 0, then the first performance measurement log entry is retrieved.
@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 The 64-bit time stamp that was recorded when the measurement was started.
@param EndTimeStamp The 64-bit time stamp that was recorded when the measurement was ended.
@return The key for the current performance log entry.
**/
UINTN
EFIAPI
GetPerformanceMeasurement (
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; } } 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

View File

@@ -0,0 +1,116 @@
/** @file
Library that provides print 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: PrintLib.h
**/
#ifndef __PRINT_LIB_H__
#define __PRINT_LIB_H__
//
// Print primitives
//
#define LEFT_JUSTIFY 0x01
#define COMMA_TYPE 0x08
#define PREFIX_ZERO 0x20
UINTN
EFIAPI
UnicodeVSPrint (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
IN VA_LIST Marker
);
UINTN
EFIAPI
UnicodeSPrint (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
...
);
UINTN
EFIAPI
UnicodeVSPrintAsciiFormat (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
IN VA_LIST Marker
);
UINTN
EFIAPI
UnicodeSPrintAsciiFormat (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
...
);
UINTN
EFIAPI
AsciiVSPrint (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
IN VA_LIST Marker
);
UINTN
EFIAPI
AsciiSPrint (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
...
);
UINTN
EFIAPI
AsciiVSPrintUnicodeFormat (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
IN VA_LIST Marker
);
UINTN
EFIAPI
AsciiSPrintUnicodeFormat (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
...
);
UINTN
UnicodeValueToString (
IN OUT CHAR16 *Buffer,
IN UINTN Flags,
IN INT64 Value,
IN UINTN Width
);
UINTN
AsciiValueToString (
IN OUT CHAR8 *Buffer,
IN UINTN Flags,
IN INT64 Value,
IN UINTN Width
);
#endif

View File

@@ -0,0 +1,763 @@
/** @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
#define REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED 0x00000008
#define REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED 0x00000010
//
// 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 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 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 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 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 EFI_GUID *CallerId OPTIONAL,
IN EFI_GUID *ExtendedDataGuid OPTIONAL,
IN VOID *ExtendedData OPTIONAL,
IN UINTN ExtendedDataSize
);
/**
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 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
);
/**
Returns TRUE if POST Codes are enabled.
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is set.
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
ReportPostCodeEnabled (
VOID
);
/**
Returns TRUE if POST code descriptions are enabled.
This function returns TRUE if the
REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED bit of
PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED
bit of PcdReportStatusCodeProperyMask is set.
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED
bit of PcdReportStatusCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
ReportPostCodeDescriptionEnabled (
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
/**
Sends an 32-bit value to a POST card.
If POST codes are enabled in PcdReportStatusCodeProperyMask, 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) ReportPostCodeEnabled() ? 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
PcdReportStatusCodeProperyMask, 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) \
ReportPostCodeEnabled() ? \
(ReportPostCodeDescriptionEnabled() ? \
PostCodeWithDescription(Value,Description) : \
PostCode(Value)) : \
Value
#endif

View 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

View File

@@ -0,0 +1,474 @@
/** @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__
/**
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) ? MAX_BIT : 0) | \
(((SlaveAddress) & 0x7f) << 1) | \
(((Command) & 0xff) << 8) | \
(((Length) & 0x1f) << 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.
**/
BOOLEAN
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<65><72>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 OutBuffer. Bytes are then read from the SMBUS into InBuffer.
If Status is not NULL, then the status of the executed command is returned in Status.
It is the caller<65><72>s responsibility to make sure InBuffer 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 OutBuffer is NULL, then ASSERT().
If InBuffer 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 OutBuffer Pointer to the buffer of bytes to write to the SMBUS.
@param InBuffer 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,
OUT VOID *OutBuffer,
OUT VOID *InBuffer,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Enumerates the SMBUS and assigns slave addresses.
Executes the SMBUS enumeration algorithm and assigns a valid address to all SMBUS slave devices.
The total number of SMBUS slave devices detected is returned.
The status of the executed command is returned.
If Slave Address in SmBusAddress is not zero, then ASSERT().
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If PEC in SmBusAddress is set, 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.
@retval RETURN_SUCCESS The SMBUS command was executed.
@retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.
@retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected
in the Host Status Register bit.
Device errors are a result of a transaction collision, illegal command field,
unclaimed cycle (host initiated), or bus errors (collisions).
**/
RETURN_STATUS
EFIAPI
SmBusArpAll (
IN UINTN SmBusAddress
)
;
/**
Assigns an SMBUS slave addresses.
Assigns the SMBUS device specified by Uuid the slave address specified by SmBusAddress.
The status of the executed command is returned.
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If PEC in SmBusAddress is set, 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 Uuid Pointer to the UUID of the device to assign a slave address.
@retval RETURN_SUCCESS The SMBUS command was executed.
@retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.
@retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected
in the Host Status Register bit.
Device errors are a result of a transaction collision, illegal command field,
unclaimed cycle (host initiated), or bus errors (collisions).
**/
RETURN_STATUS
EFIAPI
SmBusArpDevice (
IN UINTN SmBusAddress,
IN CONST GUID *Uuid
)
;
/**
Retrieves the UUID associated with an SMBUS slave device.
Retrieves the UUID associated with the slave address specified
by SmBusAddress and returns the UUID in Uuid.
The status of the executed command is returned.
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If PEC in SmBusAddress is set, then ASSERT().
If Uuid 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 Uuid Pointer to the UUID retrieved from the SMBUS slave device.
@retval RETURN_SUCCESS The SMBUS command was executed.
@retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.
@retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected
in the Host Status Register bit.
Device errors are a result of a transaction collision, illegal command field,
unclaimed cycle (host initiated), or bus errors (collisions).
**/
RETURN_STATUS
EFIAPI
SmBusGetUuid (
IN UINTN SmBusAddress,
OUT GUID *Uuid
)
;
#endif

View 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 Return value depends on implementation.
**/
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 Return value depends on implementation.
**/
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 (
IN UINT64 *StartValue, OPTIONAL
IN UINT64 *EndValue OPTIONAL
);
#endif

View File

@@ -0,0 +1,27 @@
/** @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__
//
//
//
extern EFI_HANDLE gImageHandle;
extern EFI_SYSTEM_TABLE *gST;
extern EFI_BOOT_SERVICES *gBS;
#endif

View File

@@ -0,0 +1,37 @@
/** @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__
RETURN_STATUS
EFIAPI
UefiDecompressGetInfo (
IN CONST VOID *Source,
IN UINT32 SourceSize,
OUT UINT32 *DestinationSize,
OUT UINT32 *ScratchSize
);
RETURN_STATUS
EFIAPI
UefiDecompress (
IN CONST VOID *Source,
IN OUT VOID *Destination,
IN OUT VOID *Scratch
);
#endif

View 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

View File

@@ -0,0 +1,48 @@
/** @file
UEFI Driver Model 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: UefiDriverModelLib.h
**/
#ifndef __UEFI_DRIVER_MODEL_LIB_H__
#define __UEFI_DRIVER_MODEL_LIB_H__
//
// Declare bitmask values for the protocols that are enabled
//
#define UEFI_DRIVER_MODEL_LIBRARY_COMPONENT_NAME_PROTOCOL_ENABLED 0x01
#define UEFI_DRIVER_MODEL_LIBRARY_DRIVER_DIAGNOSTICS_PROTOCOL_ENABLED 0x02
#define UEFI_DRIVER_MODEL_LIBRARY_DRIVER_CONFIGURATION_PROTOCOL_ENABLED 0x04
//
//
//
extern const UINT8 _gDriverModelProtocolBitmask;
//
//
//
typedef struct {
const EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
const EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
const EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration;
const EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics;
} EFI_DRIVER_MODEL_PROTOCOL_LIST;
//
//
//
extern const UINTN _gDriverModelProtocolListEntries;
extern const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[];
#endif

View File

@@ -0,0 +1,486 @@
/** @file
MDE UEFI library functions and macros
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 __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
);
/**
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<65><6D>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<65><6D>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<65><6D>s task priority level to its
previous level.
@param Lock A pointer to the lock to release.
**/
VOID
EFIAPI
EfiReleaseLock (
IN EFI_LOCK *Lock
);
/**
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 R8.5/EFI 1.10 form and R9/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 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 R8.5/EFI 1.10 form and R9/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
);
/**
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 PIWG 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 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
IN 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 PIWG 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 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
);
#endif

View 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__
//
//
//
extern EFI_RUNTIME_SERVICES *gRT;
#endif