1) Added BIT0, BIT1, …, BIT63 to the Base Defines

2) Added MIN() and MAX() macros to the Base Macros
3) Added StrStr(), StrDecimalToUnitn(), StrDecimalToUint64(), StrHexToUintn(), StrHexToUintn64(), UnicodeToAscii(), AsciiStrStr(), AsciiStrDecimalToUnitn(), AsciiStrDecimalToUint64(), AsciiStrHexToUintn(), AsciiStrHexToUintn64(), and AsciiToUnicode() to the Base Library String Functions
4) Added the Base Library Checksum Functions which include CalculateSum8(), CaclculateCheckSum8(), CalculateSum16(), CalculateChecksum16(), CalculateSum32(), CalculateCheckSum32(), CalculateSum64(), CalculateChecksum64().

5) Added MMIO Buffer functions to the I/O Library including MmioReadBuffer8(), MmioReadBuffer16(), MmioReadBuffer32(), MmioReadBuffer64(), MmioWriteBuffer8(), MmioWriteBuffer16(), MmioWriteBuffer32(), MmioWriteBuffer64().

6) Changed the parameter name from SizeOfValue to SizeOfBuffer in PcdSetPtr(), PcdSetPtrEx(), PatchPcdSetPtr(), LibPcdSetPtr(), LibPcdSetPtrEx(), LibPatchPcdSetPtr()

7) Added RADIX_HEX flag to the Print Library to support the conversion of values to hexadecimal strings in UnicodeValueToString() and AsciiValueToString() 

8) Added EfiGetCurrentTpl() UEFI Library.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2363 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2007-02-12 02:53:23 +00:00
parent 2f714ebf9a
commit d958721a06
26 changed files with 15654 additions and 11757 deletions

View File

@ -3,7 +3,7 @@
This file is stand alone self consistent set of definitions. This file is stand alone self consistent set of definitions.
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -76,6 +76,71 @@ typedef struct {
#define NULL ((VOID *) 0) #define NULL ((VOID *) 0)
#endif #endif
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
#define BIT32 0x0000000100000000UL
#define BIT33 0x0000000200000000UL
#define BIT34 0x0000000400000000UL
#define BIT35 0x0000000800000000UL
#define BIT36 0x0000001000000000UL
#define BIT37 0x0000002000000000UL
#define BIT38 0x0000004000000000UL
#define BIT39 0x0000008000000000UL
#define BIT40 0x0000010000000000UL
#define BIT41 0x0000020000000000UL
#define BIT42 0x0000040000000000UL
#define BIT43 0x0000080000000000UL
#define BIT44 0x0000100000000000UL
#define BIT45 0x0000200000000000UL
#define BIT46 0x0000400000000000UL
#define BIT47 0x0000800000000000UL
#define BIT48 0x0001000000000000UL
#define BIT49 0x0002000000000000UL
#define BIT50 0x0004000000000000UL
#define BIT51 0x0008000000000000UL
#define BIT52 0x0010000000000000UL
#define BIT53 0x0020000000000000UL
#define BIT54 0x0040000000000000UL
#define BIT55 0x0080000000000000UL
#define BIT56 0x0100000000000000UL
#define BIT57 0x0200000000000000UL
#define BIT58 0x0400000000000000UL
#define BIT59 0x0800000000000000UL
#define BIT60 0x1000000000000000UL
#define BIT61 0x2000000000000000UL
#define BIT62 0x4000000000000000UL
#define BIT63 0x8000000000000000UL
// //
// Support for variable length argument lists using the ANSI standard. // Support for variable length argument lists using the ANSI standard.
// //
@ -151,6 +216,24 @@ typedef CHAR8 *VA_LIST;
} \ } \
(Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment)) (Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
//
// Return the maximum of two operands.
// This macro returns the maximum of two operand specified by a and b.
// Both a and b must be the same numerical types, signed or unsigned.
//
#define MAX(a, b) \
(((a) > (b)) ? (a) : (b))
//
// Return the minimum of two operands.
// This macro returns the minimal of two operand specified by a and b.
// Both a and b must be the same numerical types, signed or unsigned.
//
#define MIN(a, b) \
(((a) < (b)) ? (a) : (b))
// //
// EFI Error Codes common to all execution phases // EFI Error Codes common to all execution phases
// //

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/** @file /** @file
Public include file for the HOB Library Public include file for the HOB Library
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -122,6 +122,24 @@ GetFirstGuidHob (
) )
; ;
/**
Get the Boot Mode from the HOB list.
This function returns the system boot mode information from the
PHIT HOB in HOB list.
@param VOID
@return The Boot Mode.
**/
EFI_BOOT_MODE
EFIAPI
GetBootModeHob (
VOID
)
;
/** /**
Builds a HOB for a loaded PE32 module. Builds a HOB for a loaded PE32 module.

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/** @file /** @file
PCD Library Class Interface Declarations PCD Library Class Interface Declarations
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -461,7 +461,7 @@ EFIAPI
LibPcdSetPtr ( LibPcdSetPtr (
IN UINTN TokenNumber, IN UINTN TokenNumber,
IN OUT UINTN *SizeOfBuffer, IN OUT UINTN *SizeOfBuffer,
IN VOID *Value IN VOID *Buffer
); );

View File

@ -1,457 +1,466 @@
/** @file /** @file
Library that provides print services Library that provides print services
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PrintLib.h Module Name: PrintLib.h
**/ **/
#ifndef __PRINT_LIB_H__ #ifndef __PRINT_LIB_H__
#define __PRINT_LIB_H__ #define __PRINT_LIB_H__
/// ///
/// Define the maximum number of characters that are required to /// Define the maximum number of characters that are required to
/// encode a decimal, hexidecimal, GUID, or TIME value with a NULL /// encode a decimal, hexidecimal, GUID, or TIME value with a NULL
/// terminator. /// terminator.
/// ///
/// Maximum Length Decimal String = 28 /// Maximum Length Decimal String = 28
/// "-9,223,372,036,854,775,808" /// "-9,223,372,036,854,775,808"
/// Maximum Length Hexidecimal String = 17 /// Maximum Length Hexidecimal String = 17
/// "FFFFFFFFFFFFFFFF" /// "FFFFFFFFFFFFFFFF"
/// Maximum Length GUID = 37 /// Maximum Length GUID = 37
/// "00000000-0000-0000-0000-000000000000" /// "00000000-0000-0000-0000-000000000000"
/// Maximum Length TIME = 18 /// Maximum Length TIME = 18
/// "12/12/2006 12:12" /// "12/12/2006 12:12"
/// ///
#define MAXIMUM_VALUE_CHARACTERS 38 #define MAXIMUM_VALUE_CHARACTERS 38
/// ///
/// Flags bitmask values use in UnicodeValueToString() and /// Flags bitmask values use in UnicodeValueToString() and
/// AcsiiValueToString() /// AcsiiValueToString()
/// ///
#define LEFT_JUSTIFY 0x01 #define LEFT_JUSTIFY 0x01
#define COMMA_TYPE 0x08 #define COMMA_TYPE 0x08
#define PREFIX_ZERO 0x20 #define PREFIX_ZERO 0x20
#define RADIX_HEX 0x80
/**
Produces a Null-terminated Unicode string in an output buffer based on /**
a Null-terminated Unicode format string and a VA_LIST argument list Produces a Null-terminated Unicode string in an output buffer based on
a Null-terminated Unicode format string and a VA_LIST argument list
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize. Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
The Unicode string is produced by parsing the format string specified by FormatString. and BufferSize.
Arguments are pulled from the variable argument list specified by Marker based on the The Unicode string is produced by parsing the format string specified by FormatString.
contents of the format string. Arguments are pulled from the variable argument list specified by Marker based on the
The number of Unicode characters in the produced output buffer is returned not including contents of the format string.
the Null-terminator. The number of Unicode characters in the produced output buffer is returned not including
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT(). If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than If BufferSize > 1 and FormatString is NULL, then ASSERT().
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
ASSERT(). PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string ASSERT().
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
Null-terminator, then ASSERT(). contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string. @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. Unicode string.
@param FormatString Null-terminated Unicode format string. @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param Marker VA_LIST marker for the variable argument list. @param FormatString Null-terminated Unicode format string.
@param Marker VA_LIST marker for the variable argument list.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator. @return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN **/
EFIAPI UINTN
UnicodeVSPrint ( EFIAPI
OUT CHAR16 *StartOfBuffer, UnicodeVSPrint (
IN UINTN BufferSize, OUT CHAR16 *StartOfBuffer,
IN CONST CHAR16 *FormatString, IN UINTN BufferSize,
IN VA_LIST Marker IN CONST CHAR16 *FormatString,
); IN VA_LIST Marker
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated /**
Unicode format string and variable argument list. Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
Unicode format string and variable argument list.
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize. Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
The Unicode string is produced by parsing the format string specified by FormatString. and BufferSize.
Arguments are pulled from the variable argument list based on the contents of the format string. The Unicode string is produced by parsing the format string specified by FormatString.
The number of Unicode characters in the produced output buffer is returned not including Arguments are pulled from the variable argument list based on the contents of the format string.
the Null-terminator. The number of Unicode characters in the produced output buffer is returned not including
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT(). If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than If BufferSize > 1 and FormatString is NULL, then ASSERT().
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
ASSERT(). PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string ASSERT().
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
Null-terminator, then ASSERT(). contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string. @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. Unicode string.
@param FormatString Null-terminated Unicode format string. @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator. @return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN **/
EFIAPI UINTN
UnicodeSPrint ( EFIAPI
OUT CHAR16 *StartOfBuffer, UnicodeSPrint (
IN UINTN BufferSize, OUT CHAR16 *StartOfBuffer,
IN CONST CHAR16 *FormatString, IN UINTN BufferSize,
... IN CONST CHAR16 *FormatString,
); ...
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated /**
ASCII format string and a VA_LIST argument list Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
ASCII format string and a VA_LIST argument list
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize. Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
The Unicode string is produced by parsing the format string specified by FormatString. and BufferSize.
Arguments are pulled from the variable argument list specified by Marker based on the The Unicode string is produced by parsing the format string specified by FormatString.
contents of the format string. Arguments are pulled from the variable argument list specified by Marker based on the
The number of Unicode characters in the produced output buffer is returned not including contents of the format string.
the Null-terminator. The number of Unicode characters in the produced output buffer is returned not including
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT(). If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than If BufferSize > 1 and FormatString is NULL, then ASSERT().
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
ASSERT(). PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string ASSERT().
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
Null-terminator, then ASSERT(). contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string. @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. Unicode string.
@param FormatString Null-terminated Unicode format string. @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param Marker VA_LIST marker for the variable argument list. @param FormatString Null-terminated Unicode format string.
@param Marker VA_LIST marker for the variable argument list.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator. @return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN **/
EFIAPI UINTN
UnicodeVSPrintAsciiFormat ( EFIAPI
OUT CHAR16 *StartOfBuffer, UnicodeVSPrintAsciiFormat (
IN UINTN BufferSize, OUT CHAR16 *StartOfBuffer,
IN CONST CHAR8 *FormatString, IN UINTN BufferSize,
IN VA_LIST Marker IN CONST CHAR8 *FormatString,
); IN VA_LIST Marker
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated /**
ASCII format string and variable argument list. Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize. Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
The Unicode string is produced by parsing the format string specified by FormatString. and BufferSize.
Arguments are pulled from the variable argument list based on the contents of the The Unicode string is produced by parsing the format string specified by FormatString.
format string. Arguments are pulled from the variable argument list based on the contents of the
The number of Unicode characters in the produced output buffer is returned not including format string.
the Null-terminator. The number of Unicode characters in the produced output buffer is returned not including
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT(). If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than If BufferSize > 1 and FormatString is NULL, then ASSERT().
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
ASSERT(). PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string ASSERT().
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
Null-terminator, then ASSERT(). contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string. @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. Unicode string.
@param FormatString Null-terminated Unicode format string. @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator. @return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN **/
EFIAPI UINTN
UnicodeSPrintAsciiFormat ( EFIAPI
OUT CHAR16 *StartOfBuffer, UnicodeSPrintAsciiFormat (
IN UINTN BufferSize, OUT CHAR16 *StartOfBuffer,
IN CONST CHAR8 *FormatString, IN UINTN BufferSize,
... IN CONST CHAR8 *FormatString,
); ...
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated /**
ASCII format string and a VA_LIST argument list. Converts a decimal value to a Null-terminated Unicode string.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer Converts the decimal number specified by Value to a Null-terminated Unicode
and BufferSize. string specified by Buffer containing at most Width characters. No padding of spaces
The ASCII string is produced by parsing the format string specified by FormatString. is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
Arguments are pulled from the variable argument list specified by Marker based on The number of Unicode characters in Buffer is returned not including the Null-terminator.
the contents of the format string. If the conversion contains more than Width characters, then only the first
The number of ASCII characters in the produced output buffer is returned not including Width characters are returned, and the total number of characters
the Null-terminator. required to perform the conversion is returned.
If BufferSize is 0, then no output buffer is produced and 0 is returned. Additional conversion parameters are specified in Flags.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). The Flags bit LEFT_JUSTIFY is always ignored.
If BufferSize > 0 and FormatString is NULL, then ASSERT(). All conversions are left justified in Buffer.
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than If Width is 0, PREFIX_ZERO is ignored in Flags.
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
ASSERT(). are inserted every 3rd digit starting from the right.
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string If HEX_RADIX is set in Flags, then the output buffer will be
contains more than PcdMaximumAsciiStringLength ASCII characters not including the formatted in hexadecimal format.
Null-terminator, then ASSERT(). If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated then Buffer is padded with '0' characters so the combination of the optional '-'
ASCII string. sign character, '0' characters, digit characters for Value, and the Null-terminator
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. add up to Width characters.
@param FormatString Null-terminated Unicode format string. If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
@param Marker VA_LIST marker for the variable argument list. If Buffer is NULL, then ASSERT().
If unsupported bits are set in Flags, then ASSERT().
@return The number of ASCII characters in the produced output buffer not including the If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
Null-terminator. If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
**/ @param Buffer Pointer to the output buffer for the produced Null-terminated
UINTN Unicode string.
EFIAPI @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
AsciiVSPrint ( @param Value The 64-bit signed value to convert to a string.
OUT CHAR8 *StartOfBuffer, @param Width The maximum number of Unicode characters to place in Buffer, not including
IN UINTN BufferSize, the Null-terminator.
IN CONST CHAR8 *FormatString,
IN VA_LIST Marker @return The number of Unicode characters in Buffer not including the Null-terminator.
);
**/
/** UINTN
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated EFIAPI
ASCII format string and variable argument list. UnicodeValueToString (
IN OUT CHAR16 *Buffer,
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer IN UINTN Flags,
and BufferSize. IN INT64 Value,
The ASCII string is produced by parsing the format string specified by FormatString. IN UINTN Width
Arguments are pulled from the variable argument list based on the contents of the );
format string.
The number of ASCII characters in the produced output buffer is returned not including /**
the Null-terminator. Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
If BufferSize is 0, then no output buffer is produced and 0 is returned. ASCII format string and a VA_LIST argument list.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
If BufferSize > 0 and FormatString is NULL, then ASSERT(). and BufferSize.
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than The ASCII string is produced by parsing the format string specified by FormatString.
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then Arguments are pulled from the variable argument list specified by Marker based on
ASSERT(). the contents of the format string.
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string The number of ASCII characters in the produced output buffer is returned not including
contains more than PcdMaximumAsciiStringLength ASCII characters not including the the Null-terminator.
Null-terminator, then ASSERT(). If BufferSize is 0, then no output buffer is produced and 0 is returned.
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
ASCII string. If BufferSize > 0 and FormatString is NULL, then ASSERT().
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
@param FormatString Null-terminated Unicode format string. PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
ASSERT().
@return The number of ASCII characters in the produced output buffer not including the If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
Null-terminator. contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
**/
UINTN @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
EFIAPI ASCII string.
AsciiSPrint ( @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
OUT CHAR8 *StartOfBuffer, @param FormatString Null-terminated Unicode format string.
IN UINTN BufferSize, @param Marker VA_LIST marker for the variable argument list.
IN CONST CHAR8 *FormatString,
... @return The number of ASCII characters in the produced output buffer not including the
); Null-terminator.
/** **/
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated UINTN
ASCII format string and a VA_LIST argument list. EFIAPI
AsciiVSPrint (
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer OUT CHAR8 *StartOfBuffer,
and BufferSize. IN UINTN BufferSize,
The ASCII string is produced by parsing the format string specified by FormatString. IN CONST CHAR8 *FormatString,
Arguments are pulled from the variable argument list specified by Marker based on IN VA_LIST Marker
the contents of the format string. );
The number of ASCII characters in the produced output buffer is returned not including
the Null-terminator. /**
If BufferSize is 0, then no output buffer is produced and 0 is returned. Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 0 and FormatString is NULL, then ASSERT(). Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than and BufferSize.
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then The ASCII string is produced by parsing the format string specified by FormatString.
ASSERT(). Arguments are pulled from the variable argument list based on the contents of the
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string format string.
contains more than PcdMaximumAsciiStringLength ASCII characters not including the The number of ASCII characters in the produced output buffer is returned not including
Null-terminator, then ASSERT(). the Null-terminator.
If BufferSize is 0, then no output buffer is produced and 0 is returned.
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string. If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. If BufferSize > 0 and FormatString is NULL, then ASSERT().
@param FormatString Null-terminated Unicode format string. If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
@param Marker VA_LIST marker for the variable argument list. PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
ASSERT().
@return The number of ASCII characters in the produced output buffer not including the If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
Null-terminator. contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
**/
UINTN @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
EFIAPI ASCII string.
AsciiVSPrintUnicodeFormat ( @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
OUT CHAR8 *StartOfBuffer, @param FormatString Null-terminated Unicode format string.
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString, @return The number of ASCII characters in the produced output buffer not including the
IN VA_LIST Marker Null-terminator.
);
**/
/** UINTN
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated EFIAPI
ASCII format string and variable argument list. AsciiSPrint (
OUT CHAR8 *StartOfBuffer,
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer IN UINTN BufferSize,
and BufferSize. IN CONST CHAR8 *FormatString,
The ASCII string is produced by parsing the format string specified by FormatString. ...
Arguments are pulled from the variable argument list based on the contents of the );
format string.
The number of ASCII characters in the produced output buffer is returned not including /**
the Null-terminator. Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
If BufferSize is 0, then no output buffer is produced and 0 is returned. ASCII format string and a VA_LIST argument list.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
If BufferSize > 0 and FormatString is NULL, then ASSERT(). and BufferSize.
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than The ASCII string is produced by parsing the format string specified by FormatString.
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then Arguments are pulled from the variable argument list specified by Marker based on
ASSERT(). the contents of the format string.
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string The number of ASCII characters in the produced output buffer is returned not including
contains more than PcdMaximumAsciiStringLength ASCII characters not including the the Null-terminator.
Null-terminator, then ASSERT(). If BufferSize is 0, then no output buffer is produced and 0 is returned.
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
ASCII string. If BufferSize > 0 and FormatString is NULL, then ASSERT().
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
@param FormatString Null-terminated Unicode format string. PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
ASSERT().
@return The number of ASCII characters in the produced output buffer not including the If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
Null-terminator. contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
**/
UINTN @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
EFIAPI ASCII string.
AsciiSPrintUnicodeFormat ( @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
OUT CHAR8 *StartOfBuffer, @param FormatString Null-terminated Unicode format string.
IN UINTN BufferSize, @param Marker VA_LIST marker for the variable argument list.
IN CONST CHAR16 *FormatString,
... @return The number of ASCII characters in the produced output buffer not including the
); Null-terminator.
/** **/
Converts a decimal value to a Null-terminated Unicode string. UINTN
EFIAPI
Converts the decimal number specified by Value to a Null-terminated Unicode AsciiVSPrintUnicodeFormat (
string specified by Buffer containing at most Width characters. OUT CHAR8 *StartOfBuffer,
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. IN UINTN BufferSize,
The number of Unicode characters in Buffer is returned not including the Null-terminator. IN CONST CHAR16 *FormatString,
If the conversion contains more than Width characters, then only the first IN VA_LIST Marker
Width characters are returned, and the total number of characters );
required to perform the conversion is returned.
Additional conversion parameters are specified in Flags. /**
The Flags bit LEFT_JUSTIFY is always ignored. Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
All conversions are left justified in Buffer. ASCII format string and variable argument list.
If Width is 0, PREFIX_ZERO is ignored in Flags.
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
are inserted every 3rd digit starting from the right. and BufferSize.
If Value is < 0, then the fist character in Buffer is a '-'. The ASCII string is produced by parsing the format string specified by FormatString.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, Arguments are pulled from the variable argument list based on the contents of the
then Buffer is padded with '0' characters so the combination of the optional '-' format string.
sign character, '0' characters, digit characters for Value, and the Null-terminator The number of ASCII characters in the produced output buffer is returned not including
add up to Width characters. the Null-terminator.
If BufferSize is 0, then no output buffer is produced and 0 is returned.
If Buffer is NULL, then ASSERT().
If unsupported bits are set in Flags, then ASSERT(). If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() If BufferSize > 0 and FormatString is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
@param Buffer Pointer to the output buffer for the produced Null-terminated PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
Unicode string. ASSERT().
@param Flags The bitmask of flags that specify left justification, zero pad, and commas. If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
@param Value The 64-bit signed value to convert to a string. contains more than PcdMaximumAsciiStringLength ASCII characters not including the
@param Width The maximum number of Unicode characters to place in Buffer, not including Null-terminator, then ASSERT().
the Null-terminator.
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
@return The number of Unicode characters in Buffer not including the Null-terminator. ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
**/ @param FormatString Null-terminated Unicode format string.
UINTN
EFIAPI @return The number of ASCII characters in the produced output buffer not including the
UnicodeValueToString ( Null-terminator.
IN OUT CHAR16 *Buffer,
IN UINTN Flags, **/
IN INT64 Value, UINTN
IN UINTN Width EFIAPI
); AsciiSPrintUnicodeFormat (
OUT CHAR8 *StartOfBuffer,
/** IN UINTN BufferSize,
Converts a decimal value to a Null-terminated ASCII string. IN CONST CHAR16 *FormatString,
...
Converts the decimal number specified by Value to a Null-terminated ASCII string );
specified by Buffer containing at most Width characters.
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. /**
The number of ASCII characters in Buffer is returned not including the Null-terminator. Converts a decimal value to a Null-terminated ASCII string.
If the conversion contains more than Width characters, then only the first Width
characters are returned, and the total number of characters required to perform Converts the decimal number specified by Value to a Null-terminated ASCII string
the conversion is returned. specified by Buffer containing at most Width characters. No padding of spaces
Additional conversion parameters are specified in Flags. is ever performed.
The Flags bit LEFT_JUSTIFY is always ignored. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
All conversions are left justified in Buffer. The number of ASCII characters in Buffer is returned not including the Null-terminator.
If Width is 0, PREFIX_ZERO is ignored in Flags. If the conversion contains more than Width characters, then only the first Width
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas characters are returned, and the total number of characters required to perform
are inserted every 3rd digit starting from the right. the conversion is returned.
If Value is < 0, then the fist character in Buffer is a '-'. Additional conversion parameters are specified in Flags.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then Buffer The Flags bit LEFT_JUSTIFY is always ignored.
is padded with '0' characters so the combination of the optional '-' All conversions are left justified in Buffer.
sign character, '0' characters, digit characters for Value, and the If Width is 0, PREFIX_ZERO is ignored in Flags.
Null-terminator add up to Width characters. If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
are inserted every 3rd digit starting from the right.
If Buffer is NULL, then ASSERT(). If HEX_RADIX is set in Flags, then the output buffer will be
If unsupported bits are set in Flags, then ASSERT(). formatted in hexadecimal format.
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
@param Buffer Pointer to the output buffer for the produced Null-terminated then Buffer is padded with '0' characters so the combination of the optional '-'
ASCII string. sign character, '0' characters, digit characters for Value, and the Null-terminator
@param Flags The bitmask of flags that specify left justification, zero pad, and commas. add up to Width characters.
@param Value The 64-bit signed value to convert to a string.
@param Width The maximum number of ASCII characters to place in Buffer, not including If Buffer is NULL, then ASSERT().
the Null-terminator. If unsupported bits are set in Flags, then ASSERT().
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
@return The number of ASCII characters in Buffer not including the Null-terminator. If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
**/ @param Buffer Pointer to the output buffer for the produced Null-terminated
UINTN ASCII string.
EFIAPI @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
AsciiValueToString ( @param Value The 64-bit signed value to convert to a string.
IN OUT CHAR8 *Buffer, @param Width The maximum number of ASCII characters to place in Buffer, not including
IN UINTN Flags, the Null-terminator.
IN INT64 Value,
IN UINTN Width @return The number of ASCII characters in Buffer not including the Null-terminator.
);
**/
#endif UINTN
EFIAPI
AsciiValueToString (
IN OUT CHAR8 *Buffer,
IN UINTN Flags,
IN INT64 Value,
IN UINTN Width
);
#endif

View File

@ -128,6 +128,26 @@ EfiNamedEventSignal (
IN CONST EFI_GUID *Name IN CONST EFI_GUID *Name
); );
/**
Returns the current TPL.
This function returns the current TPL. There is no EFI service to directly
retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
can then immediately be restored back to the current TPL level with a call
to RestoreTPL().
@param VOID
@retvale EFI_TPL The current TPL.
**/
EFI_TPL
EFIAPI
EfiGetCurrentTpl (
VOID
);
/** /**
This function initializes a basic mutual exclusion lock to the released state 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 and returns the lock. Each lock provides mutual exclusion access at its task
@ -595,5 +615,4 @@ EfiGetNameGuidFromFwVolDevicePathNode (
IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
); );
#endif #endif

View File

@ -1,66 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0"> <ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
<MsaHeader> <MsaHeader>
<ModuleName>BaseIoLibIntrinsic</ModuleName> <ModuleName>BaseIoLibIntrinsic</ModuleName>
<ModuleType>BASE</ModuleType> <ModuleType>BASE</ModuleType>
<GuidValue>926c9cd0-4bb8-479b-9ac4-8a2a23f85307</GuidValue> <GuidValue>926c9cd0-4bb8-479b-9ac4-8a2a23f85307</GuidValue>
<Version>1.0</Version> <Version>1.0</Version>
<Abstract>Component description file for Intrinsic Base Io Library</Abstract> <Abstract>Component description file for Intrinsic Base Io Library</Abstract>
<Description>I/O Library that uses compiler intrinsics to perform IN and OUT instructions <Description>I/O Library that uses compiler intrinsics to perform IN and OUT instructions
for IA-32 and x64. It also performs direct memory access for MMIO services.</Description> for IA-32 and x64. It also performs direct memory access for MMIO services.</Description>
<Copyright>Copyright (c) 2006, Intel Corporation.</Copyright> <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
<License>All rights reserved. This program and the accompanying materials <License>All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification> <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader> </MsaHeader>
<ModuleDefinitions> <ModuleDefinitions>
<SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures> <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
<BinaryModule>false</BinaryModule> <BinaryModule>false</BinaryModule>
<OutputFileBasename>BaseIoLibIntrinsic</OutputFileBasename> <OutputFileBasename>BaseIoLibIntrinsic</OutputFileBasename>
</ModuleDefinitions> </ModuleDefinitions>
<LibraryClassDefinitions> <LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_PRODUCED"> <LibraryClass Usage="ALWAYS_PRODUCED">
<Keyword>IoLib</Keyword> <Keyword>IoLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword> <Keyword>BaseLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword> <Keyword>DebugLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>PcdLib</Keyword> <Keyword>PcdLib</Keyword>
</LibraryClass> </LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename SupArchList="IA32">IoLib.c</Filename> <Filename>IoLibMmioBuffer.c</Filename>
<Filename SupArchList="IA32">IoLibMsc.c</Filename> <Filename SupArchList="IA32">IoLib.c</Filename>
<Filename SupArchList="IA32">IoLibGcc.c</Filename> <Filename SupArchList="IA32">IoLibMsc.c</Filename>
<Filename SupArchList="IA32">IoHighLevel.c</Filename> <Filename SupArchList="IA32">IoLibGcc.c</Filename>
<Filename SupArchList="X64">IoLib.c</Filename> <Filename SupArchList="IA32">IoHighLevel.c</Filename>
<Filename SupArchList="X64">IoLibMsc.c</Filename> <Filename SupArchList="X64">IoLib.c</Filename>
<Filename SupArchList="X64">IoLibGcc.c</Filename> <Filename SupArchList="X64">IoLibMsc.c</Filename>
<Filename SupArchList="X64">IoHighLevel.c</Filename> <Filename SupArchList="X64">IoLibGcc.c</Filename>
<Filename SupArchList="IPF">IoLibIpf.c</Filename> <Filename SupArchList="X64">IoHighLevel.c</Filename>
<Filename SupArchList="IPF">IoHighLevel.c</Filename> <Filename SupArchList="IPF">IoLibIpf.c</Filename>
</SourceFiles> <Filename SupArchList="IPF">IoHighLevel.c</Filename>
<PackageDependencies> </SourceFiles>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/> <PackageDependencies>
</PackageDependencies> <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Externs> </PackageDependencies>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification> <Externs>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
</Externs> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<PcdCoded> </Externs>
<PcdEntry SupArchList="IPF" PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED"> <PcdCoded>
<C_Name>PcdIoBlockBaseAddressForIpf</C_Name> <PcdEntry SupArchList="IPF" PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName> <C_Name>PcdIoBlockBaseAddressForIpf</C_Name>
<DefaultValue>0x0ffffc000000</DefaultValue> <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<HelpText>The base address of IPF IO Block</HelpText> <DefaultValue>0x0ffffc000000</DefaultValue>
</PcdEntry> <HelpText>The base address of IPF IO Block</HelpText>
</PcdCoded> </PcdEntry>
</ModuleSurfaceArea> </PcdCoded>
</ModuleSurfaceArea>

View File

@ -1,7 +1,7 @@
/** @file /** @file
Common I/O Library routines. Common I/O Library routines.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -14,8 +14,6 @@
**/ **/
#define BIT63 0x8000000000000000ULL
#define MAP_PORT_BASE_TO_MEM(_Port) \ #define MAP_PORT_BASE_TO_MEM(_Port) \
((((_Port) & 0xfffc) << 10) | ((_Port) & 0x0fff)) ((((_Port) & 0xfffc) << 10) | ((_Port) & 0x0fff))

View File

@ -0,0 +1,409 @@
/** @file
I/O Library MMIO Buffer Functions.
Copyright (c) 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/**
Copy data from MMIO region to system memory by using 8-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 8-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT8 *
EFIAPI
MmioReadBuffer8 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT8 *Buffer
)
{
UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ReturnBuffer = Buffer;
while (Length--) {
*(Buffer++) = MmioRead8 (StartAddress++);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 16-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 16-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT16 *
EFIAPI
MmioReadBuffer16 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT16 *Buffer
)
{
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 32-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 32-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT32 *
EFIAPI
MmioReadBuffer32 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT32 *Buffer
)
{
UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
Length -= sizeof (UINT32);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 64-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 64-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT64 *
EFIAPI
MmioReadBuffer64 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT64 *Buffer
)
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 8-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 8-bit access. The total number
of byte to be copied is specified by Length. Buffer is returned.
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT8 *
EFIAPI
MmioWriteBuffer8 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT8 *Buffer
)
{
VOID* ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ReturnBuffer = (UINT8 *) Buffer;
while (Length--) {
MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 16-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 16-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT16 *
EFIAPI
MmioWriteBuffer16 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT16 *Buffer
)
{
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = (UINT16 *) Buffer;
while (Length) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 32-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 32-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT32 *
EFIAPI
MmioWriteBuffer32 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT32 *Buffer
)
{
UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = (UINT32 *) Buffer;
while (Length) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
Length -= sizeof (UINT32);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 64-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 64-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT64 *
EFIAPI
MmioWriteBuffer64 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT64 *Buffer
)
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = (UINT64 *) Buffer;
while (Length) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}

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,334 @@
/** @file
Utility functions to generate checksum based on 2's complement
algorithm.
Copyright (c) 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: CheckSum.c
**/
/**
Calculate the sum of all elements in a buffer in unit of UINT8.
During calculation, the carry bits are dropped.
This function calculates the sum of all elements in a buffer
in unit of UINT8. The carry bits in result of addition are dropped.
The result is returned as UINT8. If Length is Zero, then Zero is
returned.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer .
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT8
EFIAPI
CalculateSum8 (
IN CONST UINT8 *Buffer,
IN UINTN Length
)
{
UINT8 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer
of 8-bit values.
This function first calculates the sum of the 8-bit values in the
buffer specified by Buffer and Length. The carry bits in the result
of addition are dropped. Then, the two's complement of the sum is
returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT8
EFIAPI
CalculateCheckSum8 (
IN CONST UINT8 *Buffer,
IN UINTN Length
)
{
UINT8 CheckSum;
CheckSum = CalculateSum8 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT8) (0x100 - CheckSum);
}
/**
Returns the sum of all elements in a buffer of 16-bit values. During
calculation, the carry bits are dropped.
This function calculates the sum of the 16-bit values in the buffer
specified by Buffer and Length. The carry bits in result of addition are dropped.
The 16-bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer.
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT16
EFIAPI
CalculateSum16 (
IN CONST UINT16 *Buffer,
IN UINTN Length
)
{
UINT16 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (((UINTN) Buffer & 0x1) == 0);
ASSERT ((Length & 0x1) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer of
16-bit values.
This function first calculates the sum of the 16-bit values in the buffer
specified by Buffer and Length. The carry bits in the result of addition
are dropped. Then, the two's complement of the sum is returned. If Length
is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT16
EFIAPI
CalculateCheckSum16 (
IN CONST UINT16 *Buffer,
IN UINTN Length
)
{
UINT16 CheckSum;
CheckSum = CalculateSum16 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT16) (0x10000 - CheckSum);
}
/**
Returns the sum of all elements in a buffer of 32-bit values. During
calculation, the carry bits are dropped.
This function calculates the sum of the 32-bit values in the buffer
specified by Buffer and Length. The carry bits in result of addition are dropped.
The 32-bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer.
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT32
EFIAPI
CalculateSum32 (
IN CONST UINT32 *Buffer,
IN UINTN Length
)
{
UINT32 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (((UINTN) Buffer & 0x3) == 0);
ASSERT ((Length & 0x3) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer of
32-bit values.
This function first calculates the sum of the 32-bit values in the buffer
specified by Buffer and Length. The carry bits in the result of addition
are dropped. Then, the two's complement of the sum is returned. If Length
is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT32
EFIAPI
CalculateCheckSum32 (
IN CONST UINT32 *Buffer,
IN UINTN Length
)
{
UINT32 CheckSum;
CheckSum = CalculateSum32 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT32) ((UINT32)(-1) - CheckSum + 1);
}
/**
Returns the sum of all elements in a buffer of 64-bit values. During
calculation, the carry bits are dropped.
This function calculates the sum of the 64-bit values in the buffer
specified by Buffer and Length. The carry bits in result of addition are dropped.
The 64-bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer.
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT64
EFIAPI
CalculateSum64 (
IN CONST UINT64 *Buffer,
IN UINTN Length
)
{
UINT64 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (((UINTN) Buffer & 0x7) == 0);
ASSERT ((Length & 0x7) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer of
64-bit values.
This function first calculates the sum of the 64-bit values in the buffer
specified by Buffer and Length. The carry bits in the result of addition
are dropped. Then, the two's complement of the sum is returned. If Length
is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT64
EFIAPI
CalculateCheckSum64 (
IN CONST UINT64 *Buffer,
IN UINTN Length
)
{
UINT64 CheckSum;
CheckSum = CalculateSum64 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT64) ((UINT64)(-1) - CheckSum + 1);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,199 +1,209 @@
/** @file /** @file
Print Library worker functions. Print Library worker functions.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PrintLibInternal.c Module Name: PrintLibInternal.c
**/ **/
#include "PrintLibInternal.h" #include "PrintLibInternal.h"
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
/** /**
Internal function that places the character into the Buffer. Internal function that places the character into the Buffer.
Internal function that places ASCII or Unicode character into the Buffer. Internal function that places ASCII or Unicode character into the Buffer.
@param Buffer Buffer to place the Unicode or ASCII string. @param Buffer Buffer to place the Unicode or ASCII string.
@param EndBuffer The end of the input Buffer. No characters will be @param EndBuffer The end of the input Buffer. No characters will be
placed after that. placed after that.
@param Length Count of character to be placed into Buffer. @param Length Count of character to be placed into Buffer.
@param Character Character to be placed into Buffer. @param Character Character to be placed into Buffer.
@param Increment Character increment in Buffer. @param Increment Character increment in Buffer.
@return Number of characters printed. @return Number of characters printed.
**/ **/
CHAR8 * CHAR8 *
BasePrintLibFillBuffer ( BasePrintLibFillBuffer (
CHAR8 *Buffer, CHAR8 *Buffer,
CHAR8 *EndBuffer, CHAR8 *EndBuffer,
INTN Length, INTN Length,
UINTN Character, UINTN Character,
INTN Increment INTN Increment
) )
{ {
INTN Index; INTN Index;
for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) { for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
*Buffer = (CHAR8) Character; *Buffer = (CHAR8) Character;
*(Buffer + 1) = (CHAR8) (Character >> 8); *(Buffer + 1) = (CHAR8) (Character >> 8);
Buffer += Increment; Buffer += Increment;
} }
return Buffer; return Buffer;
} }
/** /**
Internal function that convert a decimal number to a string in Buffer. Internal function that convert a decimal number to a string in Buffer.
Print worker function that convert a decimal number to a string in Buffer. Print worker function that convert a decimal number to a string in Buffer.
@param Buffer Location to place the Unicode or ASCII string of Value. @param Buffer Location to place the Unicode or ASCII string of Value.
@param Value Value to convert to a Decimal or Hexidecimal string in Buffer. @param Value Value to convert to a Decimal or Hexidecimal string in Buffer.
@param Radix Radix of the value @param Radix Radix of the value
@return Number of characters printed. @return Number of characters printed.
**/ **/
UINTN UINTN
EFIAPI EFIAPI
BasePrintLibValueToString ( BasePrintLibValueToString (
IN OUT CHAR8 *Buffer, IN OUT CHAR8 *Buffer,
IN INT64 Value, IN INT64 Value,
IN UINTN Radix IN UINTN Radix
) )
{ {
UINTN Digits; UINTN Digits;
UINT32 Remainder; UINT32 Remainder;
// //
// Loop to convert one digit at a time in reverse order // Loop to convert one digit at a time in reverse order
// //
*(Buffer++) = 0; *(Buffer++) = 0;
Digits = 0; Digits = 0;
do { do {
Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder); Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder);
*(Buffer++) = mHexStr[Remainder]; *(Buffer++) = mHexStr[Remainder];
Digits++; Digits++;
} while (Value != 0); } while (Value != 0);
return Digits; return Digits;
} }
/** /**
Internal function that converts a decimal value to a Null-terminated string. Internal function that converts a decimal value to a Null-terminated string.
Converts the decimal number specified by Value to a Null-terminated Converts the decimal number specified by Value to a Null-terminated
string specified by Buffer containing at most Width characters. string specified by Buffer containing at most Width characters.
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
The number of characters in Buffer is returned not including the Null-terminator. The number of characters in Buffer is returned not including the Null-terminator.
If the conversion contains more than Width characters, then only the first If the conversion contains more than Width characters, then only the first
Width characters are returned, and the total number of characters Width characters are returned, and the total number of characters
required to perform the conversion is returned. required to perform the conversion is returned.
Additional conversion parameters are specified in Flags. Additional conversion parameters are specified in Flags.
The Flags bit LEFT_JUSTIFY is always ignored. The Flags bit LEFT_JUSTIFY is always ignored.
All conversions are left justified in Buffer. All conversions are left justified in Buffer.
If Width is 0, PREFIX_ZERO is ignored in Flags. If Width is 0, PREFIX_ZERO is ignored in Flags.
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
are inserted every 3rd digit starting from the right. are inserted every 3rd digit starting from the right.
If Value is < 0, then the fist character in Buffer is a '-'. If HEX_RADIX is set in Flags, then the output buffer will be formatted in hexadecimal format.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
then Buffer is padded with '0' characters so the combination of the optional '-' If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
sign character, '0' characters, digit characters for Value, and the Null-terminator then Buffer is padded with '0' characters so the combination of the optional '-'
add up to Width characters. sign character, '0' characters, digit characters for Value, and the Null-terminator
add up to Width characters.
If Buffer is NULL, then ASSERT(). If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
If unsupported bits are set in Flags, then ASSERT().
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() If Buffer is NULL, then ASSERT().
If unsupported bits are set in Flags, then ASSERT().
@param Buffer Pointer to the output buffer for the produced Null-terminated If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
string.
@param Flags The bitmask of flags that specify left justification, zero pad, @param Buffer Pointer to the output buffer for the produced Null-terminated
and commas. string.
@param Value The 64-bit signed value to convert to a string. @param Flags The bitmask of flags that specify left justification, zero pad,
@param Width The maximum number of characters to place in Buffer, not including and commas.
the Null-terminator. @param Value The 64-bit signed value to convert to a string.
@param Increment Character increment in Buffer. @param Width The maximum number of characters to place in Buffer, not including
the Null-terminator.
@return The number of characters in Buffer not including the Null-terminator. @param Increment Character increment in Buffer.
**/ @return The number of characters in Buffer not including the Null-terminator.
UINTN
BasePrintLibConvertValueToString ( **/
IN OUT CHAR8 *Buffer, UINTN
IN UINTN Flags, BasePrintLibConvertValueToString (
IN INT64 Value, IN OUT CHAR8 *Buffer,
IN UINTN Width, IN UINTN Flags,
IN UINTN Increment IN INT64 Value,
) IN UINTN Width,
{ IN UINTN Increment
CHAR8 *OriginalBuffer; )
CHAR8 *EndBuffer; {
CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS]; CHAR8 *OriginalBuffer;
UINTN Count; CHAR8 *EndBuffer;
UINTN Digits; CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
UINTN Index; UINTN Count;
UINTN Digits;
ASSERT (Buffer != NULL); UINTN Index;
ASSERT (Width < MAXIMUM_VALUE_CHARACTERS); UINTN Radix;
//
// Make sure Flags can only contain supported bits. ASSERT (Buffer != NULL);
// ASSERT (Width < MAXIMUM_VALUE_CHARACTERS);
ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO)) == 0); //
// Make sure Flags can only contain supported bits.
OriginalBuffer = Buffer; //
ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO | RADIX_HEX)) == 0);
if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
Flags &= (~PREFIX_ZERO); //
} // If both COMMA_TYPE and HEX_RADIX are set, then ASSERT ()
//
if (Width == 0) { ASSERT (((Flags & COMMA_TYPE) != 0 && (Flags & RADIX_HEX) != 0) == FALSE);
Width = MAXIMUM_VALUE_CHARACTERS - 1;
} OriginalBuffer = Buffer;
//
// Set the tag for the end of the input Buffer. if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
// Flags &= (~PREFIX_ZERO);
EndBuffer = Buffer + Width * Increment; }
if (Value < 0) { if (Width == 0) {
Value = -Value; Width = MAXIMUM_VALUE_CHARACTERS - 1;
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment); }
Width--; //
} // Set the tag for the end of the input Buffer.
//
Count = BasePrintLibValueToString (ValueBuffer, Value, 10); EndBuffer = Buffer + Width * Increment;
if ((Flags & PREFIX_ZERO) != 0) { if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Count, '0', Increment); Value = -Value;
} Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment);
Width--;
Digits = Count % 3; }
if (Digits != 0) {
Digits = 3 - Digits; Radix = ((Flags & RADIX_HEX) == 0)? 10 : 16;
} Count = BasePrintLibValueToString (ValueBuffer, Value, Radix);
for (Index = 0; Index < Count; Index++) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ValueBuffer[Count - Index], Increment); if ((Flags & PREFIX_ZERO) != 0) {
if ((Flags & COMMA_TYPE) != 0) { Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Count, '0', Increment);
Digits++; }
if (Digits == 3) {
Digits = 0; Digits = Count % 3;
if ((Index + 1) < Count) { if (Digits != 0) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', Increment); Digits = 3 - Digits;
} }
} for (Index = 0; Index < Count; Index++) {
} Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ValueBuffer[Count - Index], Increment);
} if ((Flags & COMMA_TYPE) != 0) {
Digits++;
BasePrintLibFillBuffer (Buffer, EndBuffer + Increment, 1, 0, Increment); if (Digits == 3) {
Digits = 0;
return ((Buffer - OriginalBuffer) / Increment); if ((Index + 1) < Count) {
} Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', Increment);
}
}
}
}
BasePrintLibFillBuffer (Buffer, EndBuffer + Increment, 1, 0, Increment);
return ((Buffer - OriginalBuffer) / Increment);
}

View File

@ -1,201 +1,201 @@
/** @file /** @file
Print Library. Print Library Internal Functions.
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PrintLibInternal.h Module Name: PrintLibInternal.h
**/ **/
#ifndef __PRINT_LIB_INTERNAL_H #ifndef __PRINT_LIB_INTERNAL_H
#define __PRINT_LIB_INTERNAL_H #define __PRINT_LIB_INTERNAL_H
// //
// Print primitives // Print primitives
// //
//#define LEFT_JUSTIFY 0x01 //#define LEFT_JUSTIFY 0x01
#define PREFIX_SIGN 0x02 #define PREFIX_SIGN 0x02
#define PREFIX_BLANK 0x04 #define PREFIX_BLANK 0x04
//#define COMMA_TYPE 0x08 //#define COMMA_TYPE 0x08
#define LONG_TYPE 0x10 #define LONG_TYPE 0x10
//#define PREFIX_ZERO 0x20 //#define PREFIX_ZERO 0x20
#define OUTPUT_UNICODE 0x40 #define OUTPUT_UNICODE 0x40
#define RADIX_HEX 0x80 //#define RADIX_HEX 0x80
#define FORMAT_UNICODE 0x100 #define FORMAT_UNICODE 0x100
#define PAD_TO_WIDTH 0x200 #define PAD_TO_WIDTH 0x200
#define ARGUMENT_UNICODE 0x400 #define ARGUMENT_UNICODE 0x400
#define PRECISION 0x800 #define PRECISION 0x800
#define ARGUMENT_REVERSED 0x1000 #define ARGUMENT_REVERSED 0x1000
// //
// Record date and time information // Record date and time information
// //
typedef struct { typedef struct {
UINT16 Year; UINT16 Year;
UINT8 Month; UINT8 Month;
UINT8 Day; UINT8 Day;
UINT8 Hour; UINT8 Hour;
UINT8 Minute; UINT8 Minute;
UINT8 Second; UINT8 Second;
UINT8 Pad1; UINT8 Pad1;
UINT32 Nanosecond; UINT32 Nanosecond;
INT16 TimeZone; INT16 TimeZone;
UINT8 Daylight; UINT8 Daylight;
UINT8 Pad2; UINT8 Pad2;
} TIME; } TIME;
/** /**
Worker function that produces a Null-terminated string in an output buffer Worker function that produces a Null-terminated string in an output buffer
based on a Null-terminated format string and a VA_LIST argument list. based on a Null-terminated format string and a VA_LIST argument list.
VSPrint function to process format and place the results in Buffer. Since a VSPrint function to process format and place the results in Buffer. Since a
VA_LIST is used this rountine allows the nesting of Vararg routines. Thus VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
this is the main print working routine. this is the main print working routine.
@param Buffer Character buffer to print the results of the parsing @param Buffer Character buffer to print the results of the parsing
of Format into. of Format into.
@param BufferSize Maximum number of characters to put into buffer. @param BufferSize Maximum number of characters to put into buffer.
@param Flags Intial flags value. @param Flags Intial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set. Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
@param Format Null-terminated format string. @param Format Null-terminated format string.
@param Marker Vararg list consumed by processing Format. @param Marker Vararg list consumed by processing Format.
@return Number of characters printed not including the Null-terminator. @return Number of characters printed not including the Null-terminator.
**/ **/
UINTN UINTN
BasePrintLibVSPrint ( BasePrintLibVSPrint (
OUT CHAR8 *Buffer, OUT CHAR8 *Buffer,
IN UINTN BufferSize, IN UINTN BufferSize,
IN UINTN Flags, IN UINTN Flags,
IN CONST CHAR8 *Format, IN CONST CHAR8 *Format,
IN VA_LIST Marker IN VA_LIST Marker
); );
/** /**
Worker function that produces a Null-terminated string in an output buffer Worker function that produces a Null-terminated string in an output buffer
based on a Null-terminated format string and variable argument list. based on a Null-terminated format string and variable argument list.
VSPrint function to process format and place the results in Buffer. Since a VSPrint function to process format and place the results in Buffer. Since a
VA_LIST is used this rountine allows the nesting of Vararg routines. Thus VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
this is the main print working routine this is the main print working routine
@param Buffer Character buffer to print the results of the parsing @param Buffer Character buffer to print the results of the parsing
of Format into. of Format into.
@param BufferSize Maximum number of characters to put into buffer. @param BufferSize Maximum number of characters to put into buffer.
Zero means no limit. Zero means no limit.
@param Flags Intial flags value. @param Flags Intial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
@param FormatString Null-terminated format string. @param FormatString Null-terminated format string.
@return Number of characters printed. @return Number of characters printed.
**/ **/
UINTN UINTN
BasePrintLibSPrint ( BasePrintLibSPrint (
OUT CHAR8 *Buffer, OUT CHAR8 *Buffer,
IN UINTN BufferSize, IN UINTN BufferSize,
IN UINTN Flags, IN UINTN Flags,
IN CONST CHAR8 *FormatString, IN CONST CHAR8 *FormatString,
... ...
); );
/** /**
Internal function that places the character into the Buffer. Internal function that places the character into the Buffer.
Internal function that places ASCII or Unicode character into the Buffer. Internal function that places ASCII or Unicode character into the Buffer.
@param Buffer Buffer to place the Unicode or ASCII string. @param Buffer Buffer to place the Unicode or ASCII string.
@param EndBuffer The end of the input Buffer. No characters will be @param EndBuffer The end of the input Buffer. No characters will be
placed after that. placed after that.
@param Length Count of character to be placed into Buffer. @param Length Count of character to be placed into Buffer.
@param Character Character to be placed into Buffer. @param Character Character to be placed into Buffer.
@param Increment Character increment in Buffer. @param Increment Character increment in Buffer.
@return Number of characters printed. @return Number of characters printed.
**/ **/
CHAR8 * CHAR8 *
BasePrintLibFillBuffer ( BasePrintLibFillBuffer (
CHAR8 *Buffer, CHAR8 *Buffer,
CHAR8 *EndBuffer, CHAR8 *EndBuffer,
INTN Length, INTN Length,
UINTN Character, UINTN Character,
INTN Increment INTN Increment
); );
/** /**
Internal function that convert a decimal number to a string in Buffer. Internal function that convert a decimal number to a string in Buffer.
Print worker function that convert a decimal number to a string in Buffer. Print worker function that convert a decimal number to a string in Buffer.
@param Buffer Location to place the Unicode or ASCII string of Value. @param Buffer Location to place the Unicode or ASCII string of Value.
@param Value Value to convert to a Decimal or Hexidecimal string in Buffer. @param Value Value to convert to a Decimal or Hexidecimal string in Buffer.
@param Radix Radix of the value @param Radix Radix of the value
@return Number of characters printed. @return Number of characters printed.
**/ **/
UINTN UINTN
EFIAPI EFIAPI
BasePrintLibValueToString ( BasePrintLibValueToString (
IN OUT CHAR8 *Buffer, IN OUT CHAR8 *Buffer,
IN INT64 Value, IN INT64 Value,
IN UINTN Radix IN UINTN Radix
); );
/** /**
Internal function that converts a decimal value to a Null-terminated string. Internal function that converts a decimal value to a Null-terminated string.
Converts the decimal number specified by Value to a Null-terminated Converts the decimal number specified by Value to a Null-terminated
string specified by Buffer containing at most Width characters. string specified by Buffer containing at most Width characters.
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
The total number of characters placed in Buffer is returned. The total number of characters placed in Buffer is returned.
If the conversion contains more than Width characters, then only the first If the conversion contains more than Width characters, then only the first
Width characters are returned, and the total number of characters Width characters are returned, and the total number of characters
required to perform the conversion is returned. required to perform the conversion is returned.
Additional conversion parameters are specified in Flags. Additional conversion parameters are specified in Flags.
The Flags bit LEFT_JUSTIFY is always ignored. The Flags bit LEFT_JUSTIFY is always ignored.
All conversions are left justified in Buffer. All conversions are left justified in Buffer.
If Width is 0, PREFIX_ZERO is ignored in Flags. If Width is 0, PREFIX_ZERO is ignored in Flags.
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
are inserted every 3rd digit starting from the right. are inserted every 3rd digit starting from the right.
If Value is < 0, then the fist character in Buffer is a '-'. If Value is < 0, then the fist character in Buffer is a '-'.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
then Buffer is padded with '0' characters so the combination of the optional '-' then Buffer is padded with '0' characters so the combination of the optional '-'
sign character, '0' characters, digit characters for Value, and the Null-terminator sign character, '0' characters, digit characters for Value, and the Null-terminator
add up to Width characters. add up to Width characters.
If Buffer is NULL, then ASSERT(). If Buffer is NULL, then ASSERT().
If unsupported bits are set in Flags, then ASSERT(). If unsupported bits are set in Flags, then ASSERT().
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
@param Buffer Pointer to the output buffer for the produced Null-terminated @param Buffer Pointer to the output buffer for the produced Null-terminated
string. string.
@param Flags The bitmask of flags that specify left justification, zero pad, @param Flags The bitmask of flags that specify left justification, zero pad,
and commas. and commas.
@param Value The 64-bit signed value to convert to a string. @param Value The 64-bit signed value to convert to a string.
@param Width The maximum number of characters to place in Buffer, not including @param Width The maximum number of characters to place in Buffer, not including
the Null-terminator. the Null-terminator.
@param Increment Character increment in Buffer. @param Increment Character increment in Buffer.
@return Total number of characters required to perform the conversion. @return Total number of characters required to perform the conversion.
**/ **/
UINTN UINTN
BasePrintLibConvertValueToString ( BasePrintLibConvertValueToString (
IN OUT CHAR8 *Buffer, IN OUT CHAR8 *Buffer,
IN UINTN Flags, IN UINTN Flags,
IN INT64 Value, IN INT64 Value,
IN UINTN Width, IN UINTN Width,
IN UINTN Increment IN UINTN Increment
); );
#endif #endif

View File

@ -1,7 +1,7 @@
/** @file /** @file
HOB Library. HOB Library.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -160,6 +160,29 @@ GetFirstGuidHob (
return GetNextGuidHob (Guid, HobList); return GetNextGuidHob (Guid, HobList);
} }
/**
Get the Boot Mode from the HOB list.
This function returns the system boot mode information from the
PHIT HOB in HOB list.
@param VOID
@return The Boot Mode.
**/
EFI_BOOT_MODE
EFIAPI
GetBootModeHob (
VOID
)
{
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
return HandOffHob->BootMode;
}
/** /**
Builds a HOB for a loaded PE32 module. Builds a HOB for a loaded PE32 module.

View File

@ -1,7 +1,7 @@
/** @file /** @file
HOB Library. HOB Library.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -189,6 +189,30 @@ GetFirstGuidHob (
return GetNextGuidHob (Guid, HobList); return GetNextGuidHob (Guid, HobList);
} }
/**
Get the Boot Mode from the HOB list.
This function returns the system boot mode information from the
PHIT HOB in HOB list.
@param VOID
@return The Boot Mode.
**/
EFI_BOOT_MODE
EFIAPI
GetBootModeHob (
VOID
)
{
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
return HandOffHob->BootMode;
}
/** /**
Builds a HOB for a loaded PE32 module. Builds a HOB for a loaded PE32 module.

View File

@ -6,14 +6,14 @@
<GuidValue>e94cd42a-3aad-4ea0-9b09-945891c60ccd</GuidValue> <GuidValue>e94cd42a-3aad-4ea0-9b09-945891c60ccd</GuidValue>
<Version>1.0</Version> <Version>1.0</Version>
<Abstract>Component description file for Cpu Io Dxe Io Library.</Abstract> <Abstract>Component description file for Cpu Io Dxe Io Library.</Abstract>
<Description>I/O Library implementation that uses the CPU I/O Protocol for I/O <Description>I/O Library implementation that uses the CPU I/O Protocol for I/O
and MMIO operations.</Description> and MMIO operations.</Description>
<Copyright>Copyright (c) 2006, Intel Corporation.</Copyright> <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
<License>All rights reserved. This program and the accompanying materials <License>All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification> <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader> </MsaHeader>
@ -40,6 +40,7 @@
<Filename>IoLib.c</Filename> <Filename>IoLib.c</Filename>
<Filename>IoHighLevel.c</Filename> <Filename>IoHighLevel.c</Filename>
<Filename>DxeCpuIoLibInternal.h</Filename> <Filename>DxeCpuIoLibInternal.h</Filename>
<Filename>IoLibMmioBuffer.c</Filename>
</SourceFiles> </SourceFiles>
<PackageDependencies> <PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/> <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

View File

@ -0,0 +1,409 @@
/** @file
I/O Library MMIO Buffer Functions.
Copyright (c) 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/**
Copy data from MMIO region to system memory by using 8-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 8-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT8 *
EFIAPI
MmioReadBuffer8 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT8 *Buffer
)
{
UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ReturnBuffer = Buffer;
while (Length--) {
*(Buffer++) = MmioRead8 (StartAddress++);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 16-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 16-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT16 *
EFIAPI
MmioReadBuffer16 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT16 *Buffer
)
{
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 32-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 32-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT32 *
EFIAPI
MmioReadBuffer32 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT32 *Buffer
)
{
UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
Length -= sizeof (UINT32);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 64-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 64-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT64 *
EFIAPI
MmioReadBuffer64 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT64 *Buffer
)
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 8-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 8-bit access. The total number
of byte to be copied is specified by Length. Buffer is returned.
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT8 *
EFIAPI
MmioWriteBuffer8 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT8 *Buffer
)
{
VOID* ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ReturnBuffer = (UINT8 *) Buffer;
while (Length--) {
MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 16-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 16-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT16 *
EFIAPI
MmioWriteBuffer16 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT16 *Buffer
)
{
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = (UINT16 *) Buffer;
while (Length) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 32-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 32-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT32 *
EFIAPI
MmioWriteBuffer32 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT32 *Buffer
)
{
UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = (UINT32 *) Buffer;
while (Length) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
Length -= sizeof (UINT32);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 64-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 64-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT64 *
EFIAPI
MmioWriteBuffer64 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT64 *Buffer
)
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = (UINT64 *) Buffer;
while (Length) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}

View File

@ -1,7 +1,7 @@
/** @file /** @file
HOB Library. HOB Library.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -167,6 +167,32 @@ GetFirstGuidHob (
return GetNextGuidHob (Guid, HobList); return GetNextGuidHob (Guid, HobList);
} }
/**
Get the Boot Mode from the HOB list.
This function returns the system boot mode information from the
PHIT HOB in HOB list.
@param VOID
@return The Boot Mode.
**/
EFI_BOOT_MODE
EFIAPI
GetBootModeHob (
VOID
)
{
EFI_STATUS Status;
EFI_BOOT_MODE BootMode;
Status = PeiServicesGetBootMode (&BootMode);
ASSERT_EFI_ERROR (Status);
return BootMode;
}
/** /**
Adds a new HOB to the HOB List. Adds a new HOB to the HOB List.

View File

@ -0,0 +1,409 @@
/** @file
I/O Library MMIO Buffer Functions.
Copyright (c) 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/**
Copy data from MMIO region to system memory by using 8-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 8-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT8 *
EFIAPI
MmioReadBuffer8 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT8 *Buffer
)
{
UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ReturnBuffer = Buffer;
while (Length--) {
*(Buffer++) = MmioRead8 (StartAddress++);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 16-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 16-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT16 *
EFIAPI
MmioReadBuffer16 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT16 *Buffer
)
{
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 32-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 32-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT32 *
EFIAPI
MmioReadBuffer32 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT32 *Buffer
)
{
UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
Length -= sizeof (UINT32);
}
return ReturnBuffer;
}
/**
Copy data from MMIO region to system memory by using 64-bit access.
Copy data from MMIO region specified by starting address StartAddress
to system memory specified by Buffer by using 64-bit access. The total
number of byte to be copied is specified by Length. Buffer is returned.
If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied from.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer receiving the data read.
@return Buffer
**/
UINT64 *
EFIAPI
MmioReadBuffer64 (
IN UINTN StartAddress,
IN UINTN Length,
OUT UINT64 *Buffer
)
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length) {
*(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 8-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 8-bit access. The total number
of byte to be copied is specified by Length. Buffer is returned.
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT8 *
EFIAPI
MmioWriteBuffer8 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT8 *Buffer
)
{
VOID* ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ReturnBuffer = (UINT8 *) Buffer;
while (Length--) {
MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 16-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 16-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT16 *
EFIAPI
MmioWriteBuffer16 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT16 *Buffer
)
{
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = (UINT16 *) Buffer;
while (Length) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 32-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 32-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT32 *
EFIAPI
MmioWriteBuffer32 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT32 *Buffer
)
{
UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = (UINT32 *) Buffer;
while (Length) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
Length -= sizeof (UINT32);
}
return ReturnBuffer;
}
/**
Copy data from system memory to MMIO region by using 64-bit access.
Copy data from system memory specified by Buffer to MMIO region specified
by starting address StartAddress by using 64-bit access. The total number
of byte to be copied is specified by Length. Length is returned.
If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
@param StartAddress Starting address for the MMIO region to be copied to.
@param Length Size in bytes of the copy.
@param Buffer Pointer to a system memory buffer containing the data to write.
@return Size in bytes of the copy.
**/
UINT64 *
EFIAPI
MmioWriteBuffer64 (
IN UINTN StartAddress,
IN UINTN Length,
IN CONST UINT64 *Buffer
)
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = (UINT64 *) Buffer;
while (Length) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}

View File

@ -8,7 +8,7 @@
<Abstract>Component description file for Cpu Io Pei Io Library</Abstract> <Abstract>Component description file for Cpu Io Pei Io Library</Abstract>
<Description>I/O Library implementation that uses the CPU I/O PPI for I/O <Description>I/O Library implementation that uses the CPU I/O PPI for I/O
and MMIO operations.</Description> and MMIO operations.</Description>
<Copyright>Copyright (c) 2006, Intel Corporation.</Copyright> <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
<License>All rights reserved. This program and the accompanying materials <License>All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -37,6 +37,7 @@
</LibraryClass> </LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename>IoLibMmioBuffer.c</Filename>
<Filename>IoLib.c</Filename> <Filename>IoLib.c</Filename>
<Filename>IoHighLevel.c</Filename> <Filename>IoHighLevel.c</Filename>
</SourceFiles> </SourceFiles>

View File

@ -243,6 +243,34 @@ EfiNamedEventSignal (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Returns the current TPL.
This function returns the current TPL. There is no EFI service to directly
retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
can then immediately be restored back to the current TPL level with a call
to RestoreTPL().
@param VOID
@retvale EFI_TPL The current TPL.
**/
EFI_TPL
EFIAPI
EfiGetCurrentTpl (
VOID
)
{
EFI_TPL Tpl;
Tpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
gBS->RestoreTPL (Tpl);
return Tpl;
}
/** /**
This function initializes a basic mutual exclusion lock to the released state This function initializes a basic mutual exclusion lock to the released state
@ -779,3 +807,4 @@ FreeUnicodeStringTable (
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -2276,6 +2276,19 @@
<ModuleSA ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="IPF"/> <ModuleSA ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="IPF"/>
<!--Mod: BaseTimerLibNullTemplate Type: BASE Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa--> <!--Mod: BaseTimerLibNullTemplate Type: BASE Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
<ModuleSA ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="EBC"/> <ModuleSA ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="EBC"/>
<!--Mod: BaseIoLibIntrinsic Type: BASE Path: MdePkg\Library\BaseIoLibIntrinsic\BaseIoLibIntrinsic.msa-->
<ModuleSA ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="IPF">
<PcdBuildDefinition>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdIoBlockBaseAddressForIpf</C_Name>
<Token>0x0000000c</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT64</DatumType>
<MaxDatumSize>8</MaxDatumSize>
<Value>0x0ffffc000000</Value>
</PcdData>
</PcdBuildDefinition>
</ModuleSA>
</FrameworkModules> </FrameworkModules>
<BuildOptions> <BuildOptions>
<Ffs FfsKey="APPLICATION"> <Ffs FfsKey="APPLICATION">