+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- EfiCommonLib.h\r
-\r
-Abstract:\r
-\r
- Light weight lib to support EFI drivers.\r
-\r
---*/\r
-\r
-#ifndef _EFI_COMMON_LIB_H_\r
-#define _EFI_COMMON_LIB_H_\r
-\r
-EFI_STATUS\r
-EfiLibGetSystemConfigurationTable (\r
- IN EFI_GUID *TableGuid,\r
- IN OUT VOID **Table\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- \r
- Return the EFI 1.0 System Tabl entry with TableGuid\r
-\r
-Arguments:\r
-\r
- TableGuid - Name of entry to return in the system table\r
- Table - Pointer in EFI system table associated with TableGuid\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS - Table returned;\r
- EFI_NOT_FOUND - TableGuid not in EFI system table\r
-\r
---*/\r
-;\r
-\r
-//\r
-// ASPrint and AvSPrint definitions you must include the specific library\r
-// to get the expected behavior from the two functions\r
-// PEI: PeiLib\r
-// Graphics: Dxe\Graphics\Unicode Dxe\Graphics\ASCII\r
-// ASCII: Dxe\Print\ASCII\r
-// Unicode: Dxe\Print\Unicode\r
-//\r
-UINTN\r
-ASPrint (\r
- OUT CHAR8 *Buffer,\r
- IN UINTN BufferSize,\r
- IN CONST CHAR8 *Format,\r
- ...\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Process format and place the results in Buffer for narrow chars.\r
-\r
-Arguments:\r
-\r
- Buffer - Narrow char buffer to print the results of the parsing of Format into.\r
- BufferSize - Maximum number of characters to put into buffer.\r
- Format - Format string\r
- ... - Vararg list consumed by processing Format.\r
-\r
-Returns:\r
-\r
- Number of characters printed.\r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-AvSPrint (\r
- OUT CHAR8 *StartOfBuffer,\r
- IN UINTN StrSize,\r
- IN CONST CHAR8 *Format,\r
- IN VA_LIST Marker\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Internal implementation of ASPrint. \r
- Process format and place the results in Buffer for narrow chars.\r
-\r
-Arguments:\r
-\r
- StartOfBuffer - Narrow char buffer to print the results of the parsing of Format into.\r
- StrSize - Maximum number of characters to put into buffer.\r
- FormatString - Format string\r
- Marker - Vararg list consumed by processing Format.\r
-\r
-Returns:\r
-\r
- Number of characters printed.\r
-\r
---*/\r
-;\r
-\r
-//\r
-// Lib functions which can be used in both PEI and DXE pahse\r
-//\r
-EFI_STATUS\r
-EfiInitializeCommonDriverLib (\r
- IN EFI_HANDLE ImageHandle,\r
- IN VOID *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Initialize lib function calling phase: PEI or DXE\r
- \r
-Arguments:\r
-\r
- ImageHandle - The firmware allocated handle for the EFI image.\r
- \r
- SystemTable - A pointer to the EFI System Table.\r
-\r
-Returns: \r
-\r
- EFI_STATUS always returns EFI_SUCCESS\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiCommonIoRead (\r
- IN UINT8 Width,\r
- IN UINTN Address,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Io read operation.\r
-\r
-Arguments:\r
-\r
- Width - Width of read operation\r
- Address - Start IO address to read\r
- Count - Read count\r
- Buffer - Buffer to store result\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiCommonIoWrite (\r
- IN UINT8 Width,\r
- IN UINTN Address,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Io write operation.\r
-\r
-Arguments:\r
-\r
- Width - Width of write operation\r
- Address - Start IO address to write\r
- Count - Write count\r
- Buffer - Buffer to write to the address\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiCommonPciRead (\r
- IN UINT8 Width,\r
- IN UINT64 Address,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Pci read operation\r
-\r
-Arguments:\r
-\r
- Width - Width of PCI read\r
- Address - PCI address to read\r
- Count - Read count\r
- Buffer - Output buffer for the read\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiCommonPciWrite (\r
- IN UINT8 Width,\r
- IN UINT64 Address,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Pci write operation\r
-\r
-Arguments:\r
-\r
- Width - Width of PCI write\r
- Address - PCI address to write\r
- Count - Write count\r
- Buffer - Buffer to write to the address\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-BOOLEAN\r
-EfiCompareGuid (\r
- IN EFI_GUID *Guid1,\r
- IN EFI_GUID *Guid2\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Compares two GUIDs\r
-\r
-Arguments:\r
-\r
- Guid1 - guid to compare\r
-\r
- Guid2 - guid to compare\r
-\r
-Returns:\r
- TRUE if Guid1 == Guid2\r
- FALSE if Guid1 != Guid2\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiCommonLibSetMem (\r
- IN VOID *Buffer,\r
- IN UINTN Size,\r
- IN UINT8 Value\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set Buffer to Value for Size bytes.\r
-\r
-Arguments:\r
-\r
- Buffer - Memory to set.\r
-\r
- Size - Number of bytes to set\r
-\r
- Value - Value of the set operation.\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiCommonLibCopyMem (\r
- IN VOID *Destination,\r
- IN VOID *Source,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Copy Length bytes from Source to Destination.\r
-\r
-Arguments:\r
-\r
- Destination - Target of copy\r
-\r
- Source - Place to copy from\r
-\r
- Length - Number of bytes to copy\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
-\r
-INTN\r
-EfiCompareMem (\r
- IN VOID *MemOne,\r
- IN VOID *MemTwo,\r
- IN UINTN Len\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Compares two memory buffers of a given length.\r
-\r
-Arguments:\r
-\r
- MemOne - First memory buffer\r
-\r
- MemTwo - Second memory buffer\r
-\r
- Len - Length of Mem1 and Mem2 memory regions to compare\r
-\r
-Returns:\r
-\r
- = 0 if MemOne == MemTwo\r
- \r
- > 0 if MemOne > MemTwo\r
- \r
- < 0 if MemOne < MemTwo\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiCommonLibZeroMem (\r
- IN VOID *Buffer,\r
- IN UINTN Size\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set Buffer to 0 for Size bytes.\r
-\r
-Arguments:\r
-\r
- Buffer - Memory to set.\r
-\r
- Size - Number of bytes to set\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
-\r
-//\r
-// Min Max\r
-//\r
-#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))\r
-#define EFI_MAX(a, b) (((a) > (b)) ? (a) : (b))\r
-\r
-//\r
-// Align a pointer. The pointer represented by ptr is aligned to the bound.\r
-// The resulting pointer is always equal or greater (by no more than bound-1)\r
-// than the ptr. I.e., if the ptr is already aligned, the result will be equal to ptr.\r
-// Valid values for bound are powers of two: 2, 4, 8, 16, 32 etc.\r
-// The returned pointer is VOID* this assignment-compatible with all pointer types.\r
-//\r
-#define EFI_ALIGN(ptr, bound) ((VOID *) (((UINTN) (ptr) + ((UINTN) (bound) - 1)) &~((UINTN) (bound) - 1)))\r
-\r
-//\r
-// Alignment tests.\r
-//\r
-#define EFI_UINTN_ALIGN_MASK (sizeof (UINTN) - 1)\r
-#define EFI_UINTN_ALIGNED(ptr) (((UINTN) (ptr)) & EFI_UINTN_ALIGN_MASK)\r
-\r
-//\r
-// Integer division with rounding to the nearest rather than truncating.\r
-// For example 8/3=2 but EFI_IDIV_ROUND(8,3)=3. 1/3=0 and EFI_IDIV_ROUND(1,3)=0.\r
-// A half is rounded up e.g., EFI_IDIV_ROUND(1,2)=1 but 1/2=0.\r
-//\r
-#define EFI_IDIV_ROUND(r, s) ((r) / (s) + (((2 * ((r) % (s))) < (s)) ? 0 : 1))\r
-\r
-//\r
-// ReportStatusCode.c init\r
-//\r
-VOID *\r
-EfiConstructStatusCodeData (\r
- IN UINT16 DataSize,\r
- IN EFI_GUID *TypeGuid,\r
- IN OUT EFI_STATUS_CODE_DATA *Data\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Construct stanader header for optional data passed into ReportStatusCode\r
-\r
-Arguments:\r
-\r
- DataSize - Size of optional data. Does not include EFI_STATUS_CODE_DATA header\r
- TypeGuid - GUID to place in EFI_STATUS_CODE_DATA\r
- Data - Buffer to use.\r
-\r
-Returns:\r
-\r
- Return pointer to Data buffer pointing past the end of EFI_STATUS_CODE_DATA\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiDebugVPrintWorker (\r
- IN UINTN ErrorLevel,\r
- IN CHAR8 *Format,\r
- IN VA_LIST Marker,\r
- IN UINTN BufferSize,\r
- IN OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Worker function for DEBUG(). If Error Logging hub is loaded log ASSERT\r
- information. If Error Logging hub is not loaded do nothing.\r
-\r
- We use UINT64 buffers due to IPF alignment concerns.\r
-\r
-Arguments:\r
-\r
- ErrorLevel - If error level is set do the debug print.\r
-\r
- Format - String to use for the print, followed by Print arguments.\r
-\r
- Marker - VarArgs\r
-\r
- BufferSize - Size of Buffer.\r
-\r
- Buffer - Caller allocated buffer, contains ReportStatusCode extended data\r
- \r
-Returns:\r
- \r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiDebugAssertWorker (\r
- IN CHAR8 *FileName,\r
- IN INTN LineNumber,\r
- IN CHAR8 *Description,\r
- IN UINTN BufferSize,\r
- IN OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Worker function for ASSERT (). If Error Logging hub is loaded log ASSERT\r
- information. If Error Logging hub is not loaded DEADLOOP ().\r
-\r
- We use UINT64 buffers due to IPF alignment concerns.\r
-\r
-Arguments:\r
-\r
- FileName - File name of failing routine.\r
-\r
- LineNumber - Line number of failing ASSERT().\r
-\r
- Description - Description, usually the assertion,\r
- \r
- BufferSize - Size of Buffer.\r
-\r
- Buffer - Caller allocated buffer, contains ReportStatusCode extendecd data\r
-\r
-Returns:\r
- \r
- Status code\r
-\r
---*/\r
-;\r
-\r
-BOOLEAN\r
-ReportStatusCodeExtractAssertInfo (\r
- IN EFI_STATUS_CODE_TYPE CodeType,\r
- IN EFI_STATUS_CODE_VALUE Value,\r
- IN EFI_STATUS_CODE_DATA *Data,\r
- OUT CHAR8 **Filename,\r
- OUT CHAR8 **Description,\r
- OUT UINT32 *LineNumber\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extract assert information from status code data.\r
-\r
-Arguments:\r
-\r
- CodeType - Code type\r
- Value - Code value\r
- Data - Optional data associated with this status code.\r
- Filename - Filename extracted from Data\r
- Description - Description extracted from Data\r
- LineNumber - Line number extracted from Data\r
-\r
-Returns:\r
-\r
- TRUE - Successfully extracted\r
- \r
- FALSE - Extraction failed\r
-\r
---*/\r
-;\r
-\r
-BOOLEAN\r
-ReportStatusCodeExtractDebugInfo (\r
- IN EFI_STATUS_CODE_DATA *Data,\r
- OUT UINT32 *ErrorLevel,\r
- OUT VA_LIST *Marker,\r
- OUT CHAR8 **Format\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extract debug information from status code data.\r
-\r
-Arguments:\r
-\r
- Data - Optional data associated with status code.\r
- ErrorLevel - Error level extracted from Data\r
- Marker - VA_LIST extracted from Data\r
- Format - Format string extracted from Data\r
-\r
-Returns:\r
-\r
- TRUE - Successfully extracted\r
- \r
- FALSE - Extraction failed\r
-\r
---*/\r
-;\r
-\r
-BOOLEAN\r
-CodeTypeToPostCode (\r
- IN EFI_STATUS_CODE_TYPE CodeType,\r
- IN EFI_STATUS_CODE_VALUE Value,\r
- OUT UINT8 *PostCode\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Convert code value to an 8 bit post code\r
-\r
-Arguments:\r
-\r
- CodeType - Code type\r
- Value - Code value\r
- PostCode - Post code as output\r
-\r
-Returns:\r
-\r
- TRUE - Successfully converted\r
-\r
- FALSE - Convertion failed\r
-\r
---*/\r
-;\r
-\r
-//\r
-// math.c\r
-//\r
-UINT64\r
-MultU64x32 (\r
- IN UINT64 Multiplicand,\r
- IN UINTN Multiplier\r
- )\r
-/*++ \r
- \r
-Routine Description:\r
-\r
- This routine allows a 64 bit value to be multiplied with a 32 bit \r
- value returns 64bit result.\r
- No checking if the result is greater than 64bits\r
-\r
-Arguments:\r
-\r
- Multiplicand - multiplicand\r
- Multiplier - multiplier\r
-\r
-Returns:\r
-\r
- Multiplicand * Multiplier\r
- \r
---*/\r
-;\r
-\r
-UINT64\r
-DivU64x32 (\r
- IN UINT64 Dividend,\r
- IN UINTN Divisor,\r
- OUT UINTN *Remainder OPTIONAL\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This routine allows a 64 bit value to be divided with a 32 bit value returns \r
- 64bit result and the Remainder.\r
-\r
-Arguments:\r
-\r
- Dividend - dividend\r
- Divisor - divisor\r
- Remainder - buffer for remainder\r
- \r
-Returns:\r
-\r
- Dividend / Divisor\r
- Remainder = Dividend mod Divisor\r
-\r
---*/\r
-;\r
-\r
-UINT64\r
-RShiftU64 (\r
- IN UINT64 Operand,\r
- IN UINTN Count\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This routine allows a 64 bit value to be right shifted by 32 bits and returns the \r
- shifted value.\r
- Count is valid up 63. (Only Bits 0-5 is valid for Count)\r
-\r
-Arguments:\r
-\r
- Operand - Value to be shifted\r
- Count - Number of times to shift right.\r
- \r
-Returns:\r
-\r
- Value shifted right identified by the Count.\r
-\r
---*/\r
-;\r
-\r
-UINT64\r
-LShiftU64 (\r
- IN UINT64 Operand,\r
- IN UINTN Count\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This routine allows a 64 bit value to be left shifted by 32 bits and \r
- returns the shifted value.\r
- Count is valid up 63. (Only Bits 0-5 is valid for Count)\r
-\r
-Arguments:\r
-\r
- Operand - Value to be shifted\r
- Count - Number of times to shift left.\r
- \r
-Returns:\r
-\r
- Value shifted left identified by the Count.\r
-\r
---*/\r
-;\r
-\r
-UINT64\r
-Power10U64 (\r
- IN UINT64 Operand,\r
- IN UINTN Power\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Raise 10 to the power of Power, and multiply the result with Operand\r
-\r
-Arguments:\r
-\r
- Operand - multiplicand\r
- Power - power\r
-\r
-Returns:\r
-\r
- Operand * 10 ^ Power\r
-\r
---*/\r
-;\r
-\r
-UINT8\r
-Log2 (\r
- IN UINT64 Operand\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Calculates and floors logarithms based on 2\r
-\r
-Arguments:\r
-\r
- Operand - value to calculate logarithm\r
- \r
-Returns:\r
-\r
- The largest integer that is less than or equal\r
- to the logarithm of Operand based on 2 \r
-\r
---*/\r
-;\r
-\r
-UINT64\r
-GetPowerOfTwo (\r
- IN UINT64 Input\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Calculates the largest integer that is both \r
- a power of two and less than Input\r
-\r
-Arguments:\r
-\r
- Input - value to calculate power of two\r
-\r
-Returns:\r
-\r
- the largest integer that is both a power of \r
- two and less than Input\r
-\r
---*/\r
-;\r
-\r
-//\r
-// Unicode String primatives\r
-//\r
-VOID\r
-EfiStrCpy (\r
- IN CHAR16 *Destination,\r
- IN CHAR16 *Source\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Copy the Unicode string Source to Destination.\r
-\r
-Arguments:\r
- Destination - Location to copy string\r
- Source - String to copy\r
-\r
-Returns:\r
- NONE\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiStrnCpy (\r
- OUT CHAR16 *Dst,\r
- IN CHAR16 *Src,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Copy a string from source to destination\r
-\r
-Arguments:\r
- Dst Destination string\r
- Src Source string\r
- Length Length of destination string\r
-\r
-Returns:\r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-EfiStrLen (\r
- IN CHAR16 *String\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return the number of Unicode characters in String. This is not the same as\r
- the length of the string in bytes.\r
-\r
-Arguments:\r
- String - String to process\r
-\r
-Returns:\r
- Number of Unicode characters in String\r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-EfiStrSize (\r
- IN CHAR16 *String\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return the number bytes in the Unicode String. This is not the same as\r
- the length of the string in characters. The string size includes the NULL\r
-\r
-Arguments:\r
- String - String to process\r
-\r
-Returns:\r
- Number of bytes in String\r
-\r
---*/\r
-;\r
-\r
-INTN\r
-EfiStrCmp (\r
- IN CHAR16 *String,\r
- IN CHAR16 *String2\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return the alphabetic relationship between two stirngs. \r
-\r
-Arguments:\r
- String - Compare to String2\r
- \r
- String2 - Compare to String\r
-\r
-Returns:\r
- 0 - Identical\r
- \r
- > 0 - String is alphabeticly greater than String2\r
- \r
- < 0 - String is alphabeticly less than String2\r
-\r
---*/\r
-;\r
-\r
-INTN\r
-EfiStrnCmp (\r
- IN CHAR16 *String,\r
- IN CHAR16 *String2,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- This function compares the Unicode string String to the Unicode\r
- string String2 for len characters. If the first len characters\r
- of String is identical to the first len characters of String2,\r
- then 0 is returned. If substring of String sorts lexicographically\r
- after String2, the function returns a number greater than 0. If\r
- substring of String sorts lexicographically before String2, the\r
- function returns a number less than 0.\r
-\r
-Arguments:\r
- String - Compare to String2\r
- String2 - Compare to String\r
- Length - Number of Unicode characters to compare\r
-\r
-Returns:\r
- 0 - The substring of String and String2 is identical.\r
- > 0 - The substring of String sorts lexicographically after String2\r
- < 0 - The substring of String sorts lexicographically before String2\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiStrCat (\r
- IN CHAR16 *Destination,\r
- IN CHAR16 *Source\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Concatinate Source on the end of Destination\r
-\r
-Arguments:\r
- Destination - String to added to the end of.\r
- Source - String to concatinate.\r
-\r
-Returns:\r
- NONE\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiStrnCat (\r
- IN CHAR16 *Dest,\r
- IN CHAR16 *Src,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Concatinate Source on the end of Destination\r
-\r
-Arguments:\r
- Dst Destination string\r
- Src Source string\r
- Length Length of destination string\r
-\r
-Returns:\r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-EfiAsciiStrLen (\r
- IN CHAR8 *String\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return the number of Ascii characters in String. This is not the same as\r
- the length of the string in bytes.\r
-\r
-Arguments:\r
- String - String to process\r
-\r
-Returns:\r
- Number of Unicode characters in String\r
-\r
---*/\r
-;\r
-\r
-CHAR8 *\r
-EfiAsciiStrCpy (\r
- IN CHAR8 *Destination,\r
- IN CHAR8 *Source\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Copy the Ascii string Source to Destination.\r
-\r
-Arguments:\r
- Destination - Location to copy string\r
- Source - String to copy\r
-\r
-Returns:\r
- Pointer just pass the end of Destination\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiAsciiStrnCpy (\r
- OUT CHAR8 *Dst,\r
- IN CHAR8 *Src,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Copy the Ascii string from source to destination\r
-\r
-Arguments:\r
- Dst Destination string\r
- Src Source string\r
- Length Length of destination string\r
-\r
-Returns:\r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-EfiAsciiStrSize (\r
- IN CHAR8 *String\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return the number bytes in the Ascii String. This is not the same as\r
- the length of the string in characters. The string size includes the NULL\r
-\r
-Arguments:\r
- String - String to process\r
-\r
-Returns:\r
- Number of bytes in String\r
-\r
---*/\r
-;\r
-\r
-\r
-INTN\r
-EfiAsciiStrCmp (\r
- IN CHAR8 *String,\r
- IN CHAR8 *String2\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Compare the Ascii string pointed by String to the string pointed by String2. \r
-\r
-Arguments:\r
- String - String to process\r
-\r
- String2 - The other string to process\r
-\r
-Returns:\r
- Return a positive integer if String is lexicall greater than String2; Zero if \r
- the two strings are identical; and a negative integer if String is lexically \r
- less than String2.\r
---*/\r
-;\r
-\r
-INTN\r
-EfiAsciiStrnCmp (\r
- IN CHAR8 *String,\r
- IN CHAR8 *String2,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- This function compares the ASCII string String to the ASCII\r
- string String2 for len characters. If the first len characters\r
- of String is identical to the first len characters of String2,\r
- then 0 is returned. If substring of String sorts lexicographically\r
- after String2, the function returns a number greater than 0. If\r
- substring of String sorts lexicographically before String2, the\r
- function returns a number less than 0.\r
-\r
-Arguments:\r
- String - Compare to String2\r
- String2 - Compare to String\r
- Length - Number of ASCII characters to compare\r
-\r
-Returns:\r
- 0 - The substring of String and String2 is identical.\r
- > 0 - The substring of String sorts lexicographically after String2\r
- < 0 - The substring of String sorts lexicographically before String2\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiAsciiStrCat (\r
- IN CHAR8 *Destination,\r
- IN CHAR8 *Source\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Concatinate Source on the end of Destination\r
-\r
-Arguments:\r
- Destination - String to added to the end of.\r
- Source - String to concatinate.\r
-\r
-Returns:\r
- NONE\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiAsciiStrnCat (\r
- IN CHAR8 *Destination,\r
- IN CHAR8 *Source,\r
- IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Concatinate Source on the end of Destination\r
-\r
-Arguments:\r
- Destination - String to added to the end of.\r
- Source - String to concatinate.\r
-\r
-Returns:\r
- NONE\r
-\r
---*/\r
-;\r
-\r
-//\r
-// Print primitives\r
-//\r
-#define LEFT_JUSTIFY 0x01\r
-#define PREFIX_SIGN 0x02\r
-#define PREFIX_BLANK 0x04\r
-#define COMMA_TYPE 0x08\r
-#define LONG_TYPE 0x10\r
-#define PREFIX_ZERO 0x20\r
-\r
-//\r
-// Length of temp string buffer to store value string.\r
-//\r
-#define CHARACTER_NUMBER_FOR_VALUE 30\r
-\r
-UINTN\r
-EfiValueToHexStr (\r
- IN OUT CHAR16 *Buffer,\r
- IN UINT64 Value,\r
- IN UINTN Flags,\r
- IN UINTN Width\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- VSPrint worker function that prints a Value as a hex number in Buffer\r
-\r
-Arguments:\r
-\r
- Buffer - Location to place ascii hex string of Value.\r
-\r
- Value - Hex value to convert to a string in Buffer.\r
-\r
- Flags - Flags to use in printing Hex string, see file header for details.\r
-\r
- Width - Width of hex value.\r
-\r
-Returns: \r
-\r
- Number of characters printed. \r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-EfiValueToString (\r
- IN OUT CHAR16 *Buffer,\r
- IN INT64 Value,\r
- IN UINTN Flags,\r
- IN UINTN Width\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- VSPrint worker function that prints a Value as a decimal number in Buffer\r
-\r
-Arguments:\r
-\r
- Buffer - Location to place ascii decimal number string of Value.\r
-\r
- Value - Decimal value to convert to a string in Buffer.\r
-\r
- Flags - Flags to use in printing decimal string, see file header for details.\r
-\r
- Width - Width of hex value.\r
-\r
-Returns: \r
-\r
- Number of characters printed. \r
-\r
---*/\r
-;\r
-\r
-BOOLEAN\r
-IsHexDigit (\r
- OUT UINT8 *Digit,\r
- IN CHAR16 Char\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Determines if a Unicode character is a hexadecimal digit.\r
- The test is case insensitive.\r
-\r
- Arguments:\r
- Digit - Pointer to byte that receives the value of the hex character.\r
- Char - Unicode character to test.\r
-\r
- Returns:\r
- TRUE - If the character is a hexadecimal digit.\r
- FALSE - Otherwise.\r
-\r
---*/\r
-;\r
-\r
-CHAR16\r
-NibbleToHexChar (\r
- UINT8 Nibble\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Converts the low nibble of a byte to hex unicode character.\r
-\r
- Arguments:\r
- Nibble - lower nibble of a byte.\r
-\r
- Returns:\r
- Hex unicode character.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-HexStringToBuf (\r
- IN OUT UINT8 *Buf,\r
- IN OUT UINTN *Len,\r
- IN CHAR16 *Str,\r
- OUT UINTN *ConvertedStrLen OPTIONAL\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Converts Unicode string to binary buffer.\r
- The conversion may be partial.\r
- The first character in the string that is not hex digit stops the conversion.\r
- At a minimum, any blob of data could be represented as a hex string.\r
-\r
- Arguments:\r
- Buf - Pointer to buffer that receives the data.\r
- Len - Length in bytes of the buffer to hold converted data.\r
- If routine return with EFI_SUCCESS, containing length of converted data.\r
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.\r
- Str - String to be converted from.\r
- ConvertedStrLen - Length of the Hex String consumed.\r
-\r
- Returns:\r
- EFI_SUCCESS: Routine Success.\r
- EFI_BUFFER_TOO_SMALL: The buffer is too small to hold converted data.\r
- EFI_\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-BufToHexString (\r
- IN OUT CHAR16 *Str,\r
- IN OUT UINTN *HexStringBufferLength,\r
- IN UINT8 *Buf,\r
- IN UINTN Len\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Converts binary buffer to Unicode string.\r
- At a minimum, any blob of data could be represented as a hex string.\r
-\r
- Arguments:\r
- Str - Pointer to the string.\r
- HexStringBufferLength - Length in bytes of buffer to hold the hex string. Includes tailing '\0' character.\r
- If routine return with EFI_SUCCESS, containing length of hex string buffer.\r
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string buffer desired.\r
- Buf - Buffer to be converted from.\r
- Len - Length in bytes of the buffer to be converted.\r
-\r
- Returns:\r
- EFI_SUCCESS: Routine success.\r
- EFI_BUFFER_TOO_SMALL: The hex string buffer is too small.\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiStrTrim (\r
- IN OUT CHAR16 *str,\r
- IN CHAR16 CharC\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- \r
- Removes (trims) specified leading and trailing characters from a string.\r
- \r
-Arguments: \r
- \r
- str - Pointer to the null-terminated string to be trimmed. On return, \r
- str will hold the trimmed string. \r
- CharC - Character will be trimmed from str.\r
- \r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
-CHAR16*\r
-EfiStrStr (\r
- IN CHAR16 *String,\r
- IN CHAR16 *StrCharSet\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- \r
- Find a substring.\r
- \r
-Arguments: \r
- \r
- String - Null-terminated string to search.\r
- StrCharSet - Null-terminated string to search for.\r
- \r
-Returns:\r
- The address of the first occurrence of the matching substring if successful, or NULL otherwise.\r
---*/\r
-;\r
-\r
-CHAR8*\r
-EfiAsciiStrStr (\r
- IN CHAR8 *String,\r
- IN CHAR8 *StrCharSet\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- \r
- Find a Ascii substring.\r
- \r
-Arguments: \r
- \r
- String - Null-terminated Ascii string to search.\r
- StrCharSet - Null-terminated Ascii string to search for.\r
- \r
-Returns:\r
- The address of the first occurrence of the matching Ascii substring if successful, or NULL otherwise.\r
---*/\r
-;\r
-#endif\r