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:
@@ -1,66 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
<MsaHeader>
|
||||
<ModuleName>BaseIoLibIntrinsic</ModuleName>
|
||||
<ModuleType>BASE</ModuleType>
|
||||
<GuidValue>926c9cd0-4bb8-479b-9ac4-8a2a23f85307</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for Intrinsic Base Io Library</Abstract>
|
||||
<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>
|
||||
<Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
|
||||
<License>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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>BaseIoLibIntrinsic</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED">
|
||||
<Keyword>IoLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename SupArchList="IA32">IoLib.c</Filename>
|
||||
<Filename SupArchList="IA32">IoLibMsc.c</Filename>
|
||||
<Filename SupArchList="IA32">IoLibGcc.c</Filename>
|
||||
<Filename SupArchList="IA32">IoHighLevel.c</Filename>
|
||||
<Filename SupArchList="X64">IoLib.c</Filename>
|
||||
<Filename SupArchList="X64">IoLibMsc.c</Filename>
|
||||
<Filename SupArchList="X64">IoLibGcc.c</Filename>
|
||||
<Filename SupArchList="X64">IoHighLevel.c</Filename>
|
||||
<Filename SupArchList="IPF">IoLibIpf.c</Filename>
|
||||
<Filename SupArchList="IPF">IoHighLevel.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
</PackageDependencies>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
<PcdCoded>
|
||||
<PcdEntry SupArchList="IPF" PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdIoBlockBaseAddressForIpf</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<DefaultValue>0x0ffffc000000</DefaultValue>
|
||||
<HelpText>The base address of IPF IO Block</HelpText>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
<MsaHeader>
|
||||
<ModuleName>BaseIoLibIntrinsic</ModuleName>
|
||||
<ModuleType>BASE</ModuleType>
|
||||
<GuidValue>926c9cd0-4bb8-479b-9ac4-8a2a23f85307</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for Intrinsic Base Io Library</Abstract>
|
||||
<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>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
|
||||
<License>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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>BaseIoLibIntrinsic</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED">
|
||||
<Keyword>IoLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>IoLibMmioBuffer.c</Filename>
|
||||
<Filename SupArchList="IA32">IoLib.c</Filename>
|
||||
<Filename SupArchList="IA32">IoLibMsc.c</Filename>
|
||||
<Filename SupArchList="IA32">IoLibGcc.c</Filename>
|
||||
<Filename SupArchList="IA32">IoHighLevel.c</Filename>
|
||||
<Filename SupArchList="X64">IoLib.c</Filename>
|
||||
<Filename SupArchList="X64">IoLibMsc.c</Filename>
|
||||
<Filename SupArchList="X64">IoLibGcc.c</Filename>
|
||||
<Filename SupArchList="X64">IoHighLevel.c</Filename>
|
||||
<Filename SupArchList="IPF">IoLibIpf.c</Filename>
|
||||
<Filename SupArchList="IPF">IoHighLevel.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
</PackageDependencies>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
<PcdCoded>
|
||||
<PcdEntry SupArchList="IPF" PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdIoBlockBaseAddressForIpf</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<DefaultValue>0x0ffffc000000</DefaultValue>
|
||||
<HelpText>The base address of IPF IO Block</HelpText>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
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
|
||||
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
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
**/
|
||||
|
||||
#define BIT63 0x8000000000000000ULL
|
||||
|
||||
#define MAP_PORT_BASE_TO_MEM(_Port) \
|
||||
((((_Port) & 0xfffc) << 10) | ((_Port) & 0x0fff))
|
||||
|
||||
|
409
MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
Normal file
409
MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
Normal 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
334
MdePkg/Library/BaseLib/CheckSum.c
Normal file
334
MdePkg/Library/BaseLib/CheckSum.c
Normal 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
@@ -1,199 +1,209 @@
|
||||
/** @file
|
||||
Print Library worker functions.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PrintLibInternal.c
|
||||
|
||||
**/
|
||||
|
||||
#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'};
|
||||
|
||||
|
||||
/**
|
||||
Internal function that places the 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 EndBuffer The end of the input Buffer. No characters will be
|
||||
placed after that.
|
||||
@param Length Count of character to be placed into Buffer.
|
||||
@param Character Character to be placed into Buffer.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
BasePrintLibFillBuffer (
|
||||
CHAR8 *Buffer,
|
||||
CHAR8 *EndBuffer,
|
||||
INTN Length,
|
||||
UINTN Character,
|
||||
INTN Increment
|
||||
)
|
||||
{
|
||||
INTN Index;
|
||||
|
||||
for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
|
||||
*Buffer = (CHAR8) Character;
|
||||
*(Buffer + 1) = (CHAR8) (Character >> 8);
|
||||
Buffer += Increment;
|
||||
}
|
||||
return 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.
|
||||
|
||||
@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 Radix Radix of the value
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
BasePrintLibValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN INT64 Value,
|
||||
IN UINTN Radix
|
||||
)
|
||||
{
|
||||
UINTN Digits;
|
||||
UINT32 Remainder;
|
||||
|
||||
//
|
||||
// Loop to convert one digit at a time in reverse order
|
||||
//
|
||||
*(Buffer++) = 0;
|
||||
Digits = 0;
|
||||
do {
|
||||
Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder);
|
||||
*(Buffer++) = mHexStr[Remainder];
|
||||
Digits++;
|
||||
} while (Value != 0);
|
||||
return Digits;
|
||||
}
|
||||
|
||||
/**
|
||||
Internal function that converts a decimal value to a Null-terminated string.
|
||||
|
||||
Converts the decimal number specified by Value to a Null-terminated
|
||||
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 characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
Additional conversion parameters are specified in Flags.
|
||||
The Flags bit LEFT_JUSTIFY is always ignored.
|
||||
All conversions are left justified in Buffer.
|
||||
If Width is 0, PREFIX_ZERO is ignored in Flags.
|
||||
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
|
||||
are inserted every 3rd digit starting from the right.
|
||||
If 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,
|
||||
then Buffer is padded with '0' characters so the combination of the optional '-'
|
||||
sign character, '0' characters, digit characters for Value, and the Null-terminator
|
||||
add up to Width characters.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If unsupported bits are set in Flags, then ASSERT().
|
||||
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
|
||||
|
||||
@param Buffer Pointer to the output buffer for the produced Null-terminated
|
||||
string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad,
|
||||
and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of characters to place 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,
|
||||
IN UINTN Flags,
|
||||
IN INT64 Value,
|
||||
IN UINTN Width,
|
||||
IN UINTN Increment
|
||||
)
|
||||
{
|
||||
CHAR8 *OriginalBuffer;
|
||||
CHAR8 *EndBuffer;
|
||||
CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
|
||||
UINTN Count;
|
||||
UINTN Digits;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (Width < MAXIMUM_VALUE_CHARACTERS);
|
||||
//
|
||||
// Make sure Flags can only contain supported bits.
|
||||
//
|
||||
ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO)) == 0);
|
||||
|
||||
OriginalBuffer = Buffer;
|
||||
|
||||
if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
|
||||
Flags &= (~PREFIX_ZERO);
|
||||
}
|
||||
|
||||
if (Width == 0) {
|
||||
Width = MAXIMUM_VALUE_CHARACTERS - 1;
|
||||
}
|
||||
//
|
||||
// Set the tag for the end of the input Buffer.
|
||||
//
|
||||
EndBuffer = Buffer + Width * Increment;
|
||||
|
||||
if (Value < 0) {
|
||||
Value = -Value;
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment);
|
||||
Width--;
|
||||
}
|
||||
|
||||
Count = BasePrintLibValueToString (ValueBuffer, Value, 10);
|
||||
|
||||
if ((Flags & PREFIX_ZERO) != 0) {
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Count, '0', Increment);
|
||||
}
|
||||
|
||||
Digits = Count % 3;
|
||||
if (Digits != 0) {
|
||||
Digits = 3 - Digits;
|
||||
}
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ValueBuffer[Count - Index], Increment);
|
||||
if ((Flags & COMMA_TYPE) != 0) {
|
||||
Digits++;
|
||||
if (Digits == 3) {
|
||||
Digits = 0;
|
||||
if ((Index + 1) < Count) {
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', Increment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BasePrintLibFillBuffer (Buffer, EndBuffer + Increment, 1, 0, Increment);
|
||||
|
||||
return ((Buffer - OriginalBuffer) / Increment);
|
||||
}
|
||||
/** @file
|
||||
Print Library worker functions.
|
||||
|
||||
Copyright (c) 2006 - 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: PrintLibInternal.c
|
||||
|
||||
**/
|
||||
|
||||
#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'};
|
||||
|
||||
|
||||
/**
|
||||
Internal function that places the 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 EndBuffer The end of the input Buffer. No characters will be
|
||||
placed after that.
|
||||
@param Length Count of character to be placed into Buffer.
|
||||
@param Character Character to be placed into Buffer.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
BasePrintLibFillBuffer (
|
||||
CHAR8 *Buffer,
|
||||
CHAR8 *EndBuffer,
|
||||
INTN Length,
|
||||
UINTN Character,
|
||||
INTN Increment
|
||||
)
|
||||
{
|
||||
INTN Index;
|
||||
|
||||
for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
|
||||
*Buffer = (CHAR8) Character;
|
||||
*(Buffer + 1) = (CHAR8) (Character >> 8);
|
||||
Buffer += Increment;
|
||||
}
|
||||
return 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.
|
||||
|
||||
@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 Radix Radix of the value
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
BasePrintLibValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN INT64 Value,
|
||||
IN UINTN Radix
|
||||
)
|
||||
{
|
||||
UINTN Digits;
|
||||
UINT32 Remainder;
|
||||
|
||||
//
|
||||
// Loop to convert one digit at a time in reverse order
|
||||
//
|
||||
*(Buffer++) = 0;
|
||||
Digits = 0;
|
||||
do {
|
||||
Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder);
|
||||
*(Buffer++) = mHexStr[Remainder];
|
||||
Digits++;
|
||||
} while (Value != 0);
|
||||
return Digits;
|
||||
}
|
||||
|
||||
/**
|
||||
Internal function that converts a decimal value to a Null-terminated string.
|
||||
|
||||
Converts the decimal number specified by Value to a Null-terminated
|
||||
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 characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
Additional conversion parameters are specified in Flags.
|
||||
The Flags bit LEFT_JUSTIFY is always ignored.
|
||||
All conversions are left justified in Buffer.
|
||||
If Width is 0, PREFIX_ZERO is ignored in Flags.
|
||||
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
|
||||
are inserted every 3rd digit starting from the right.
|
||||
If HEX_RADIX is set in Flags, then the output buffer will be formatted in hexadecimal format.
|
||||
If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
|
||||
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
|
||||
then Buffer is padded with '0' characters so the combination of the optional '-'
|
||||
sign character, '0' characters, digit characters for Value, and the Null-terminator
|
||||
add up to Width characters.
|
||||
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If unsupported bits are set in Flags, then ASSERT().
|
||||
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
|
||||
|
||||
@param Buffer Pointer to the output buffer for the produced Null-terminated
|
||||
string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad,
|
||||
and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of characters to place 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,
|
||||
IN UINTN Flags,
|
||||
IN INT64 Value,
|
||||
IN UINTN Width,
|
||||
IN UINTN Increment
|
||||
)
|
||||
{
|
||||
CHAR8 *OriginalBuffer;
|
||||
CHAR8 *EndBuffer;
|
||||
CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
|
||||
UINTN Count;
|
||||
UINTN Digits;
|
||||
UINTN Index;
|
||||
UINTN Radix;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (Width < MAXIMUM_VALUE_CHARACTERS);
|
||||
//
|
||||
// Make sure Flags can only contain supported bits.
|
||||
//
|
||||
ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO | RADIX_HEX)) == 0);
|
||||
|
||||
//
|
||||
// If both COMMA_TYPE and HEX_RADIX are set, then ASSERT ()
|
||||
//
|
||||
ASSERT (((Flags & COMMA_TYPE) != 0 && (Flags & RADIX_HEX) != 0) == FALSE);
|
||||
|
||||
OriginalBuffer = Buffer;
|
||||
|
||||
if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
|
||||
Flags &= (~PREFIX_ZERO);
|
||||
}
|
||||
|
||||
if (Width == 0) {
|
||||
Width = MAXIMUM_VALUE_CHARACTERS - 1;
|
||||
}
|
||||
//
|
||||
// Set the tag for the end of the input Buffer.
|
||||
//
|
||||
EndBuffer = Buffer + Width * Increment;
|
||||
|
||||
if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) {
|
||||
Value = -Value;
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment);
|
||||
Width--;
|
||||
}
|
||||
|
||||
Radix = ((Flags & RADIX_HEX) == 0)? 10 : 16;
|
||||
Count = BasePrintLibValueToString (ValueBuffer, Value, Radix);
|
||||
|
||||
if ((Flags & PREFIX_ZERO) != 0) {
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Count, '0', Increment);
|
||||
}
|
||||
|
||||
Digits = Count % 3;
|
||||
if (Digits != 0) {
|
||||
Digits = 3 - Digits;
|
||||
}
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ValueBuffer[Count - Index], Increment);
|
||||
if ((Flags & COMMA_TYPE) != 0) {
|
||||
Digits++;
|
||||
if (Digits == 3) {
|
||||
Digits = 0;
|
||||
if ((Index + 1) < Count) {
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', Increment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BasePrintLibFillBuffer (Buffer, EndBuffer + Increment, 1, 0, Increment);
|
||||
|
||||
return ((Buffer - OriginalBuffer) / Increment);
|
||||
}
|
||||
|
||||
|
@@ -1,201 +1,201 @@
|
||||
/** @file
|
||||
Print Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PrintLibInternal.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PRINT_LIB_INTERNAL_H
|
||||
#define __PRINT_LIB_INTERNAL_H
|
||||
|
||||
//
|
||||
// Print primitives
|
||||
//
|
||||
//#define LEFT_JUSTIFY 0x01
|
||||
#define PREFIX_SIGN 0x02
|
||||
#define PREFIX_BLANK 0x04
|
||||
//#define COMMA_TYPE 0x08
|
||||
#define LONG_TYPE 0x10
|
||||
//#define PREFIX_ZERO 0x20
|
||||
#define OUTPUT_UNICODE 0x40
|
||||
#define RADIX_HEX 0x80
|
||||
#define FORMAT_UNICODE 0x100
|
||||
#define PAD_TO_WIDTH 0x200
|
||||
#define ARGUMENT_UNICODE 0x400
|
||||
#define PRECISION 0x800
|
||||
#define ARGUMENT_REVERSED 0x1000
|
||||
|
||||
//
|
||||
// Record date and time information
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Year;
|
||||
UINT8 Month;
|
||||
UINT8 Day;
|
||||
UINT8 Hour;
|
||||
UINT8 Minute;
|
||||
UINT8 Second;
|
||||
UINT8 Pad1;
|
||||
UINT32 Nanosecond;
|
||||
INT16 TimeZone;
|
||||
UINT8 Daylight;
|
||||
UINT8 Pad2;
|
||||
} TIME;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
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
|
||||
this is the main print working routine.
|
||||
|
||||
@param Buffer Character buffer to print the results of the parsing
|
||||
of Format into.
|
||||
@param BufferSize Maximum number of characters to put into buffer.
|
||||
@param Flags Intial flags value.
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
|
||||
@param Format Null-terminated format string.
|
||||
@param Marker Vararg list consumed by processing Format.
|
||||
|
||||
@return Number of characters printed not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
BasePrintLibVSPrint (
|
||||
OUT CHAR8 *Buffer,
|
||||
IN UINTN BufferSize,
|
||||
IN UINTN Flags,
|
||||
IN CONST CHAR8 *Format,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
Worker function that produces a Null-terminated string in an output buffer
|
||||
based on a Null-terminated format string and variable argument list.
|
||||
|
||||
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
|
||||
this is the main print working routine
|
||||
|
||||
@param Buffer Character buffer to print the results of the parsing
|
||||
of Format into.
|
||||
@param BufferSize Maximum number of characters to put into buffer.
|
||||
Zero means no limit.
|
||||
@param Flags Intial flags value.
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
|
||||
@param FormatString Null-terminated format string.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
BasePrintLibSPrint (
|
||||
OUT CHAR8 *Buffer,
|
||||
IN UINTN BufferSize,
|
||||
IN UINTN Flags,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Internal function that places the 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 EndBuffer The end of the input Buffer. No characters will be
|
||||
placed after that.
|
||||
@param Length Count of character to be placed into Buffer.
|
||||
@param Character Character to be placed into Buffer.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
BasePrintLibFillBuffer (
|
||||
CHAR8 *Buffer,
|
||||
CHAR8 *EndBuffer,
|
||||
INTN Length,
|
||||
UINTN Character,
|
||||
INTN Increment
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@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 Radix Radix of the value
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
BasePrintLibValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN INT64 Value,
|
||||
IN UINTN Radix
|
||||
);
|
||||
|
||||
/**
|
||||
Internal function that converts a decimal value to a Null-terminated string.
|
||||
|
||||
Converts the decimal number specified by Value to a Null-terminated
|
||||
string specified by Buffer containing at most Width characters.
|
||||
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The total number of characters placed in Buffer is returned.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
Additional conversion parameters are specified in Flags.
|
||||
The Flags bit LEFT_JUSTIFY is always ignored.
|
||||
All conversions are left justified in Buffer.
|
||||
If Width is 0, PREFIX_ZERO is ignored in Flags.
|
||||
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
|
||||
are inserted every 3rd digit starting from the right.
|
||||
If 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,
|
||||
then Buffer is padded with '0' characters so the combination of the optional '-'
|
||||
sign character, '0' characters, digit characters for Value, and the Null-terminator
|
||||
add up to Width characters.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If unsupported bits are set in Flags, then ASSERT().
|
||||
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
|
||||
|
||||
@param Buffer Pointer to the output buffer for the produced Null-terminated
|
||||
string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad,
|
||||
and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of characters to place in Buffer, not including
|
||||
the Null-terminator.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Total number of characters required to perform the conversion.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
BasePrintLibConvertValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN UINTN Flags,
|
||||
IN INT64 Value,
|
||||
IN UINTN Width,
|
||||
IN UINTN Increment
|
||||
);
|
||||
|
||||
#endif
|
||||
/** @file
|
||||
Print Library Internal Functions.
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PrintLibInternal.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PRINT_LIB_INTERNAL_H
|
||||
#define __PRINT_LIB_INTERNAL_H
|
||||
|
||||
//
|
||||
// Print primitives
|
||||
//
|
||||
//#define LEFT_JUSTIFY 0x01
|
||||
#define PREFIX_SIGN 0x02
|
||||
#define PREFIX_BLANK 0x04
|
||||
//#define COMMA_TYPE 0x08
|
||||
#define LONG_TYPE 0x10
|
||||
//#define PREFIX_ZERO 0x20
|
||||
#define OUTPUT_UNICODE 0x40
|
||||
//#define RADIX_HEX 0x80
|
||||
#define FORMAT_UNICODE 0x100
|
||||
#define PAD_TO_WIDTH 0x200
|
||||
#define ARGUMENT_UNICODE 0x400
|
||||
#define PRECISION 0x800
|
||||
#define ARGUMENT_REVERSED 0x1000
|
||||
|
||||
//
|
||||
// Record date and time information
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Year;
|
||||
UINT8 Month;
|
||||
UINT8 Day;
|
||||
UINT8 Hour;
|
||||
UINT8 Minute;
|
||||
UINT8 Second;
|
||||
UINT8 Pad1;
|
||||
UINT32 Nanosecond;
|
||||
INT16 TimeZone;
|
||||
UINT8 Daylight;
|
||||
UINT8 Pad2;
|
||||
} TIME;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
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
|
||||
this is the main print working routine.
|
||||
|
||||
@param Buffer Character buffer to print the results of the parsing
|
||||
of Format into.
|
||||
@param BufferSize Maximum number of characters to put into buffer.
|
||||
@param Flags Intial flags value.
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
|
||||
@param Format Null-terminated format string.
|
||||
@param Marker Vararg list consumed by processing Format.
|
||||
|
||||
@return Number of characters printed not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
BasePrintLibVSPrint (
|
||||
OUT CHAR8 *Buffer,
|
||||
IN UINTN BufferSize,
|
||||
IN UINTN Flags,
|
||||
IN CONST CHAR8 *Format,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
Worker function that produces a Null-terminated string in an output buffer
|
||||
based on a Null-terminated format string and variable argument list.
|
||||
|
||||
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
|
||||
this is the main print working routine
|
||||
|
||||
@param Buffer Character buffer to print the results of the parsing
|
||||
of Format into.
|
||||
@param BufferSize Maximum number of characters to put into buffer.
|
||||
Zero means no limit.
|
||||
@param Flags Intial flags value.
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
|
||||
@param FormatString Null-terminated format string.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
BasePrintLibSPrint (
|
||||
OUT CHAR8 *Buffer,
|
||||
IN UINTN BufferSize,
|
||||
IN UINTN Flags,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Internal function that places the 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 EndBuffer The end of the input Buffer. No characters will be
|
||||
placed after that.
|
||||
@param Length Count of character to be placed into Buffer.
|
||||
@param Character Character to be placed into Buffer.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
BasePrintLibFillBuffer (
|
||||
CHAR8 *Buffer,
|
||||
CHAR8 *EndBuffer,
|
||||
INTN Length,
|
||||
UINTN Character,
|
||||
INTN Increment
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@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 Radix Radix of the value
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
BasePrintLibValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN INT64 Value,
|
||||
IN UINTN Radix
|
||||
);
|
||||
|
||||
/**
|
||||
Internal function that converts a decimal value to a Null-terminated string.
|
||||
|
||||
Converts the decimal number specified by Value to a Null-terminated
|
||||
string specified by Buffer containing at most Width characters.
|
||||
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The total number of characters placed in Buffer is returned.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
Additional conversion parameters are specified in Flags.
|
||||
The Flags bit LEFT_JUSTIFY is always ignored.
|
||||
All conversions are left justified in Buffer.
|
||||
If Width is 0, PREFIX_ZERO is ignored in Flags.
|
||||
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
|
||||
are inserted every 3rd digit starting from the right.
|
||||
If 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,
|
||||
then Buffer is padded with '0' characters so the combination of the optional '-'
|
||||
sign character, '0' characters, digit characters for Value, and the Null-terminator
|
||||
add up to Width characters.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If unsupported bits are set in Flags, then ASSERT().
|
||||
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
|
||||
|
||||
@param Buffer Pointer to the output buffer for the produced Null-terminated
|
||||
string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad,
|
||||
and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of characters to place in Buffer, not including
|
||||
the Null-terminator.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Total number of characters required to perform the conversion.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
BasePrintLibConvertValueToString (
|
||||
IN OUT CHAR8 *Buffer,
|
||||
IN UINTN Flags,
|
||||
IN INT64 Value,
|
||||
IN UINTN Width,
|
||||
IN UINTN Increment
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
HOB Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
@@ -160,6 +160,29 @@ GetFirstGuidHob (
|
||||
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.
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
HOB Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
@@ -189,6 +189,30 @@ GetFirstGuidHob (
|
||||
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.
|
||||
|
||||
|
@@ -6,14 +6,14 @@
|
||||
<GuidValue>e94cd42a-3aad-4ea0-9b09-945891c60ccd</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<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>
|
||||
<Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
|
||||
<License>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,
|
||||
<License>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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
@@ -40,6 +40,7 @@
|
||||
<Filename>IoLib.c</Filename>
|
||||
<Filename>IoHighLevel.c</Filename>
|
||||
<Filename>DxeCpuIoLibInternal.h</Filename>
|
||||
<Filename>IoLibMmioBuffer.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
|
409
MdePkg/Library/DxeIoLibCpuIo/IoLibMmioBuffer.c
Normal file
409
MdePkg/Library/DxeIoLibCpuIo/IoLibMmioBuffer.c
Normal 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;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
HOB Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
@@ -167,6 +167,32 @@ GetFirstGuidHob (
|
||||
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.
|
||||
|
||||
|
409
MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c
Normal file
409
MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c
Normal 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;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<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
|
||||
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
|
||||
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
|
||||
@@ -37,6 +37,7 @@
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>IoLibMmioBuffer.c</Filename>
|
||||
<Filename>IoLib.c</Filename>
|
||||
<Filename>IoHighLevel.c</Filename>
|
||||
</SourceFiles>
|
||||
|
@@ -243,6 +243,34 @@ EfiNamedEventSignal (
|
||||
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
|
||||
@@ -779,3 +807,4 @@ FreeUnicodeStringTable (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user