summaryrefslogtreecommitdiff
path: root/EDK/Foundation/Library/Dxe/PrintLite
diff options
context:
space:
mode:
Diffstat (limited to 'EDK/Foundation/Library/Dxe/PrintLite')
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintLiteAscii.cif9
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintWidth.h88
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Ascii/Sprint.c142
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/BoxDraw.c212
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Print.c194
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Print.h37
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/PrintLib.inf51
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.cif19
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.mak70
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.sdl26
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/StdErr.c287
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintLiteUnicode.cif9
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintWidth.h35
-rw-r--r--EDK/Foundation/Library/Dxe/PrintLite/Unicode/Sprint.c147
14 files changed, 1326 insertions, 0 deletions
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintLiteAscii.cif b/EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintLiteAscii.cif
new file mode 100644
index 0000000..e7d8a3f
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintLiteAscii.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PrintLiteAscii"
+ category = ModulePart
+ LocalRoot = "EDK\Foundation\Library\Dxe\PrintLite\Ascii"
+ RefName = "PrintLiteAscii"
+[files]
+"PrintWidth.h"
+"Sprint.c"
+<endComponent>
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintWidth.h b/EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintWidth.h
new file mode 100644
index 0000000..07901dc
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Ascii/PrintWidth.h
@@ -0,0 +1,88 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ PrintWidth.h
+
+Abstract:
+
+ Unicde option for generic width.
+ CHAR_W is Ascii
+ STRING_W is ""
+
+--*/
+
+#ifndef _PRINT_WIDTH_H_
+#define _PRINT_WIDTH_H_
+
+typedef CHAR8 CHAR_W;
+#define STRING_W(_s) _s
+
+#define ASPrint(Buffer, BufferSize, Format) SPrint (Buffer, BufferSize, Format)
+#define AvSPrint(Buffer, BufferSize, Format, Marker) VSPrint (Buffer, BufferSize, Format, Marker)
+
+UINTN
+UvSPrint (
+ OUT CHAR16 *StartOfBuffer,
+ IN UINTN StrLen,
+ IN CONST CHAR16 *Format,
+ IN VA_LIST Marker
+ )
+/*++
+
+Routine Description:
+
+ Internal implementation of USPrint.
+ Process format and place the results in Buffer for wide chars.
+
+Arguments:
+
+ StartOfBuffer - Wide char buffer to print the results of the parsing of Format into.
+ StrLen - Maximum number of characters to put into buffer.
+ Format - Format string
+ Marker - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+;
+
+UINTN
+USPrint (
+ OUT CHAR16 *Buffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR16 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Process format and place the results in Buffer for wide chars.
+
+Arguments:
+
+ Buffer - Wide char buffer to print the results of the parsing of Format into.
+ BufferSize - Maximum number of characters to put into buffer.
+ Format - Format string
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+;
+
+#endif
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Ascii/Sprint.c b/EDK/Foundation/Library/Dxe/PrintLite/Ascii/Sprint.c
new file mode 100644
index 0000000..35a7d4b
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Ascii/Sprint.c
@@ -0,0 +1,142 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Sprint.c
+
+Abstract:
+
+ Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
+ simple implemenation of SPrint() and Print() to support debug.
+
+ You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
+ time. This makes the implementation very simple.
+
+ VSPrint, Print, SPrint format specification has the follwoing form
+
+ %[flags][width]type
+
+ flags:
+ '-' - Left justify
+ '+' - Prefix a sign
+ ' ' - Prefix a blank
+ ',' - Place commas in numberss
+ '0' - Prefix for width with zeros
+ 'l' - UINT64
+ 'L' - UINT64
+
+ width:
+ '*' - Get width from a UINTN argumnet from the argument list
+ Decimal number that represents width of print
+
+ type:
+ 'X' - argument is a UINTN hex number, prefix '0'
+ 'x' - argument is a hex number
+ 'd' - argument is a decimal number
+ 'a' - argument is an ascii string
+ 'S','s' - argument is an Unicode string
+ 'g' - argument is a pointer to an EFI_GUID
+ 't' - argument is a pointer to an EFI_TIME structure
+ 'c' - argument is an ascii character
+ 'r' - argument is EFI_STATUS
+ '%' - Print a %
+
+--*/
+
+#include "TianoCommon.h"
+#include "PrintWidth.h"
+#include "EfiPrintLib.h"
+#include "Print.h"
+
+UINTN
+USPrint (
+ OUT CHAR16 *Buffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR16 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Process format and place the results in Buffer for wide chars.
+
+Arguments:
+
+ Buffer - Wide char buffer to print the results of the parsing of Format into.
+ BufferSize - Maximum number of characters to put into buffer.
+ Format - Format string
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+
+ VA_START (Marker, Format);
+ Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
+ VA_END (Marker);
+
+ return Return;
+}
+
+UINTN
+UvSPrint (
+ OUT CHAR16 *Buffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR16 *FormatString,
+ IN VA_LIST Marker
+ )
+/*++
+
+Routine Description:
+
+ Internal implementation of USPrint.
+ Process format and place the results in Buffer for wide chars.
+
+Arguments:
+
+ Buffer - Wide char buffer to print the results of the parsing of Format into.
+ BufferSize - Maximum number of characters to put into buffer.
+ FormatString - Format string
+ Marker - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Index;
+ CHAR8 AsciiFormat[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
+ CHAR8 AsciiResult[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
+
+ for (Index = 0; Index < EFI_DRIVER_LIB_MAX_PRINT_BUFFER && FormatString[Index] != '\0'; Index++) {
+ AsciiFormat[Index] = (CHAR8) FormatString[Index];
+ }
+
+ AsciiFormat[Index] = '\0';
+
+ Index = VSPrint (AsciiResult, EFI_DRIVER_LIB_MAX_PRINT_BUFFER, AsciiFormat, Marker);
+
+ for (Index = 0; (Index < (BufferSize - 1)) && AsciiResult[Index] != '\0'; Index++) {
+ Buffer[Index] = (CHAR16) AsciiResult[Index];
+ }
+
+ Buffer[Index] = '\0';
+
+ return Index++;
+}
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/BoxDraw.c b/EDK/Foundation/Library/Dxe/PrintLite/BoxDraw.c
new file mode 100644
index 0000000..560d92c
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/BoxDraw.c
@@ -0,0 +1,212 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BoxDraw.c
+
+Abstract:
+ Lib functions to support Box Draw Unicode code pages.
+
+
+
+Revision History
+
+--*/
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+
+
+
+typedef struct {
+ CHAR16 Unicode;
+ CHAR8 PcAnsi;
+ CHAR8 Ascii;
+} UNICODE_TO_CHAR;
+
+
+//
+// This list is used to define the valid extend chars.
+// It also provides a mapping from Unicode to PCANSI or
+// ASCII. The ASCII mapping we just made up.
+//
+//
+
+static UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = {
+ BOXDRAW_HORIZONTAL, 0xc4, L'-',
+ BOXDRAW_VERTICAL, 0xb3, L'|',
+ BOXDRAW_DOWN_RIGHT, 0xda, L'/',
+ BOXDRAW_DOWN_LEFT, 0xbf, L'\\',
+ BOXDRAW_UP_RIGHT, 0xc0, L'\\',
+ BOXDRAW_UP_LEFT, 0xd9, L'/',
+ BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|',
+ BOXDRAW_VERTICAL_LEFT, 0xb4, L'|',
+ BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+',
+ BOXDRAW_UP_HORIZONTAL, 0xc1, L'+',
+ BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+',
+ BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-',
+ BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|',
+ BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/',
+ BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/',
+ BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/',
+ BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\',
+ BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\',
+ BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\',
+ BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\',
+ BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\',
+ BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\',
+ BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/',
+ BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/',
+ BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/',
+ BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|',
+ BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|',
+ BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|',
+ BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|',
+ BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|',
+ BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|',
+ BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+',
+ BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+',
+ BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+',
+ BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+',
+ BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+',
+ BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+',
+ BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+',
+ BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+',
+ BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+',
+
+ BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*',
+ BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+',
+
+ GEOMETRICSHAPE_UP_TRIANGLE, 0x1e, L'^',
+ GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x10, L'>',
+ GEOMETRICSHAPE_DOWN_TRIANGLE, 0x1f, L'v',
+ GEOMETRICSHAPE_LEFT_TRIANGLE, 0x11, L'<',
+
+ ARROW_LEFT, 0x3c, L'<',
+
+ ARROW_UP, 0x18, L'^',
+
+ ARROW_RIGHT, 0x3e, L'>',
+
+ ARROW_DOWN, 0x19, L'v',
+
+ 0x0000, 0x00
+};
+
+
+BOOLEAN
+LibIsValidTextGraphics (
+ IN CHAR16 Graphic,
+ OUT CHAR8 *PcAnsi, OPTIONAL
+ OUT CHAR8 *Ascii OPTIONAL
+ )
+/*++
+
+Routine Description:
+
+ Detects if a Unicode char is for Box Drawing text graphics.
+
+Arguments:
+
+ Graphic - Unicode char to test.
+
+ PcAnsi - Optional pointer to return PCANSI equivalent of Graphic.
+
+ Asci - Optional pointer to return Ascii equivalent of Graphic.
+
+Returns:
+
+ TRUE if Gpaphic is a supported Unicode Box Drawing character.
+
+--*/
+{
+ UNICODE_TO_CHAR *Table;
+
+ if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) {
+
+ //
+ // Unicode drawing code charts are all in the 0x25xx range,
+ // arrows are 0x21xx
+ //
+ return FALSE;
+ }
+
+ for (Table = UnicodeToPcAnsiOrAscii; Table->Unicode != 0x0000; Table++) {
+ if (Graphic == Table->Unicode) {
+ if (PcAnsi != NULL) {
+ *PcAnsi = Table->PcAnsi;
+ }
+ if (Ascii != NULL) {
+ *Ascii = Table->Ascii;
+ }
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+BOOLEAN
+IsValidAscii (
+ IN CHAR16 Ascii
+ )
+/*++
+
+Routine Description:
+
+ Is it valid ascii char?
+
+Arguments:
+
+ Ascii - The char to check
+
+Returns:
+
+ TRUE - Is a ascii char
+ FALSE - Not a ascii char
+
+--*/
+{
+ if ((Ascii >= 0x20) && (Ascii <= 0x7f)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+BOOLEAN
+IsValidEfiCntlChar (
+ IN CHAR16 CharC
+ )
+/*++
+
+Routine Description:
+
+ Is it valid EFI control char?
+
+Arguments:
+
+ CharC - The char to check
+
+Returns:
+
+ TRUE - Is a valid EFI control char
+ FALSE - Not a valid EFI control char
+
+--*/
+{
+ if (CharC == CHAR_NULL || CharC == CHAR_BACKSPACE || CharC == CHAR_LINEFEED || CharC == CHAR_CARRIAGE_RETURN) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Print.c b/EDK/Foundation/Library/Dxe/PrintLite/Print.c
new file mode 100644
index 0000000..35b2327
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Print.c
@@ -0,0 +1,194 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Print.c
+
+Abstract:
+
+ Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
+ simple implemenation of SPrint() and Print() to support debug.
+
+ You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
+ time. This makes the implementation very simple.
+
+ VSPrint, Print, SPrint format specification has the follwoing form
+
+ %[flags][width]type
+
+ flags:
+ '-' - Left justify
+ '+' - Prefix a sign
+ ' ' - Prefix a blank
+ ',' - Place commas in numberss
+ '0' - Prefix for width with zeros
+ 'l' - UINT64
+ 'L' - UINT64
+
+ width:
+ '*' - Get width from a UINTN argumnet from the argument list
+ Decimal number that represents width of print
+
+ type:
+ 'X' - argument is a UINTN hex number, prefix '0'
+ 'x' - argument is a hex number
+ 'd' - argument is a decimal number
+ 'a' - argument is an ascii string
+ 'S','s' - argument is an Unicode string
+ 'g' - argument is a pointer to an EFI_GUID
+ 't' - argument is a pointer to an EFI_TIME structure
+ 'c' - argument is an ascii character
+ 'r' - argument is EFI_STATUS
+ '%' - Print a %
+
+--*/
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "TianoCommon.h"
+#include "EfiCommonLib.h"
+#include "PrintWidth.h"
+#include "EfiPrintLib.h"
+#include "Print.h"
+
+#ifndef EFI_PRINT_LITE
+STATIC
+CHAR_W *
+GetFlagsAndWidth (
+ IN CHAR_W *Format,
+ OUT UINTN *Flags,
+ OUT UINTN *Width,
+ IN OUT VA_LIST *Marker
+ );
+
+STATIC
+UINTN
+GuidToString (
+ IN EFI_GUID *Guid,
+ IN OUT CHAR_W *Buffer,
+ IN UINTN BufferSize
+ );
+
+STATIC
+UINTN
+TimeToString (
+ IN EFI_TIME *Time,
+ IN OUT CHAR_W *Buffer,
+ IN UINTN BufferSize
+ );
+
+STATIC
+UINTN
+EfiStatusToString (
+ IN EFI_STATUS Status,
+ OUT CHAR_W *Buffer,
+ IN UINTN BufferSize
+ );
+
+#endif
+STATIC
+UINTN
+Atoi (
+ CHAR_W *String
+ );
+
+UINTN
+SPrint (
+ OUT CHAR_W *Buffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR_W *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ SPrint function to process format and place the results in Buffer.
+
+Arguments:
+
+ Buffer - Wide char buffer to print the results of the parsing of Format into.
+
+ BufferSize - Maximum number of characters to put into buffer. Zero means no
+ limit.
+
+ Format - Format string see file header for more details.
+
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+
+ VA_START (Marker, Format);
+ Return = VSPrint (Buffer, BufferSize, Format, Marker);
+ VA_END (Marker);
+
+ return Return;
+}
+
+UINTN
+VSPrint (
+ OUT CHAR_W *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR_W *FormatString,
+ IN VA_LIST Marker
+ )
+/*++
+
+Routine Description:
+
+ 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
+
+Arguments:
+
+ StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
+
+ BufferSize - Maximum number of characters to put into buffer. Zero means
+ no limit.
+
+ FormatString - Unicode format string see file header for more details.
+
+ Marker - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_PRINT_PROTOCOL *PrintProtocol;
+
+ Status = gBS->LocateProtocol (
+ &gEfiPrintProtocolGuid,
+ NULL,
+ (VOID*)&PrintProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ return 0;
+ } else {
+ return PrintProtocol->VSPrint (
+ StartOfBuffer,
+ BufferSize,
+ FormatString,
+ Marker
+ );
+ }
+}
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Print.h b/EDK/Foundation/Library/Dxe/PrintLite/Print.h
new file mode 100644
index 0000000..ad54aa8
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Print.h
@@ -0,0 +1,37 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Print.h
+
+Abstract:
+
+ Private data for Print.c
+
+--*/
+
+#ifndef _PRINT_H_
+#define _PRINT_H_
+
+#define LEFT_JUSTIFY 0x01
+#define PREFIX_SIGN 0x02
+#define PREFIX_BLANK 0x04
+#define COMMA_TYPE 0x08
+#define LONG_TYPE 0x10
+#define PREFIX_ZERO 0x20
+
+//
+// Largest number of characters that can be printed out.
+//
+#define EFI_DRIVER_LIB_MAX_PRINT_BUFFER (80 * 4)
+
+#endif
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/PrintLib.inf b/EDK/Foundation/Library/Dxe/PrintLite/PrintLib.inf
new file mode 100644
index 0000000..876271d
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/PrintLib.inf
@@ -0,0 +1,51 @@
+#/*++
+#
+# Copyright (c) 2004, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+# PrintLib.inf
+#
+# Abstract:
+#
+# Component description file.
+#
+#--*/
+
+[defines]
+BASE_NAME = PrintLibLite
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ BoxDraw.c
+ Print.c
+ Print.h
+ StdErr.c
+ Unicode\PrintWidth.h
+ Unicode\SPrint.c
+
+[includes.common]
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Efi
+ .
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Print\Unicode
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+
+[libraries.common]
+ EdkProtocolLib
+
+[nmake.common]
+ C_STD_INCLUDE=
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.cif b/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.cif
new file mode 100644
index 0000000..9acf21e
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "PrintLibLite"
+ category = ModulePart
+ LocalRoot = "EDK\Foundation\Library\Dxe\PrintLite\"
+ RefName = "PrintLibLite"
+[files]
+"PrintLibLite.sdl"
+"PrintLibLite.mak"
+"BoxDraw.c"
+"Print.c"
+"Print.h"
+"StdErr.c"
+"PrintLib.inf"
+[parts]
+"PrintLiteAscii"
+"PrintLiteUnicode"
+"PrintLiteAscii"
+"PrintLiteUnicode"
+<endComponent>
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.mak b/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.mak
new file mode 100644
index 0000000..bac6c40
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.mak
@@ -0,0 +1,70 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2009, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelEDK/PrintLibLite/PrintLibLite.mak 1 1/20/12 4:09a Jeffch $
+#
+# $Revision: 1 $
+#
+# $Date: 1/20/12 4:09a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelEDK/PrintLibLite/PrintLibLite.mak $
+#
+# 1 1/20/12 4:09a Jeffch
+# Create Intel EDK 1117 Patch 7.
+#
+# 1 9/27/11 6:31a Wesleychen
+# Intel EDK initially releases.
+#
+# 2 9/02/09 3:53a Iminglin
+# EIP24919
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PrintLibLite.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+$(PRINTLIBLITE) : PrintLibLite
+
+$(BUILD_DIR)\PrintLibLite.lib : PrintLibLite
+
+PrintLibLite : $(BUILD_DIR)\PrintLibLite.mak PrintLibLiteBin
+
+$(BUILD_DIR)\PrintLibLite.mak : $(PrintLibLite_DIR)\$(@B).cif $(PrintLibLite_DIR)\$(@B).mak $(BUILD_RULES) $(PrintLibLite_DIR)\Unicode\PrintLiteUnicode.cif
+ $(CIF2MAK) $(PrintLibLite_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) $(PrintLibLite_DIR)\Unicode\PrintLiteUnicode.cif
+
+PrintLibLiteBin : $(EDKPROTOCOLLIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\PrintLibLite.mak all\
+ "MY_INCLUDES=/I$(PrintLibLite_DIR) /I$(PrintLibLite_DIR)\Unicode"\
+ TYPE=LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2009, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#********************************************************************** \ No newline at end of file
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.sdl b/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.sdl
new file mode 100644
index 0000000..c41267d
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/PrintLibLite.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = "PrintLibLite_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PrintLibLite support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "PRINTLIBLITE"
+ Value = "$(BUILD_DIR)\PrintLibLite.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "PrintLibLite_DIR"
+End
+
+MODULE
+ Help = "Includes PrintLibLite.mak to Project"
+ File = "PrintLibLite.mak"
+End
+
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/StdErr.c b/EDK/Foundation/Library/Dxe/PrintLite/StdErr.c
new file mode 100644
index 0000000..14d6ba9
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/StdErr.c
@@ -0,0 +1,287 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ StdErr.c
+
+Abstract:
+
+ Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
+ simple implemenation of SPrint() and Print() to support debug.
+
+ You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
+ time. This makes the implementation very simple.
+
+ VSPrint, Print, SPrint format specification has the follwoing form
+
+ %[flags][width]type
+
+ flags:
+ '-' - Left justify
+ '+' - Prefix a sign
+ ' ' - Prefix a blank
+ ',' - Place commas in numberss
+ '0' - Prefix for width with zeros
+ 'l' - UINT64
+ 'L' - UINT64
+
+ width:
+ '*' - Get width from a UINTN argumnet from the argument list
+ Decimal number that represents width of print
+
+ type:
+ 'X' - argument is a UINTN hex number, prefix '0'
+ 'x' - argument is a hex number
+ 'd' - argument is a decimal number
+ 'a' - argument is an ascii string
+ 'S','s' - argument is an Unicode string
+ 'g' - argument is a pointer to an EFI_GUID
+ 't' - argument is a pointer to an EFI_TIME structure
+ 'c' - argument is an ascii character
+ 'r' - argument is EFI_STATUS
+ '%' - Print a %
+
+--*/
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "EfiCommonLib.h"
+#include "EfiPrintLib.h"
+#include "Print.h"
+
+
+UINTN
+ErrorPrint (
+ IN CONST CHAR16 *ErrorString,
+ IN CONST CHAR8 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
+ characters.
+
+Arguments:
+
+ ErrorString - String of error infomation.
+
+ Format - Ascii format string see file header for more details.
+
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+ UINTN Index;
+ UINTN MaxIndex;
+ //
+ // Increase array size of 'UnicodeFormat' and 'Buffer' by 1 as there is a possibility of buffer overflow.
+ //
+ CHAR16 Buffer[EFI_DRIVER_LIB_MAX_PRINT_BUFFER+1];
+ CHAR16 UnicodeFormat[EFI_DRIVER_LIB_MAX_PRINT_BUFFER+1];
+
+ MaxIndex = EfiAsciiStrLen ((CHAR8 *) Format);
+ if (MaxIndex >= EFI_DRIVER_LIB_MAX_PRINT_BUFFER) {
+ //
+ // Format string was too long for use to process.
+ //
+ return 0;
+ }
+
+ if (ErrorString != '\0') {
+ if (gST->StdErr != NULL) {
+ //
+ // To be extra safe make sure StdErr has been initialized
+ //
+ gST->StdErr->SetAttribute (gST->StdErr, EFI_TEXT_ATTR (EFI_RED, EFI_BLACK));
+ gST->StdErr->OutputString (gST->StdErr, (CHAR16 *) ErrorString);
+ gST->StdErr->SetAttribute (gST->StdErr, EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK));
+ }
+ }
+
+ for (Index = 0; Index < MaxIndex; Index++) {
+ UnicodeFormat[Index] = (CHAR16) Format[Index];
+ }
+
+ UnicodeFormat[Index] = 0;
+
+ VA_START (Marker, Format);
+ Return = VSPrint (Buffer, sizeof (Buffer), UnicodeFormat, Marker);
+ VA_END (Marker);
+
+ //
+ // Need to convert to Unicode to do an OutputString
+ //
+
+ if (gST->StdErr != NULL) {
+ //
+ // To be extra safe make sure StdErr has been initialized
+ //
+ gST->StdErr->OutputString (gST->StdErr, Buffer);
+ }
+
+ return Return;
+}
+
+
+UINTN
+Aprint (
+ IN CONST CHAR8 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
+ characters.
+
+Arguments:
+
+ Format - Ascii format string see file header for more details.
+
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+ UINTN Index;
+ UINTN MaxIndex;
+ CHAR16 Buffer[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
+ CHAR16 UnicodeFormat[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
+
+ MaxIndex = EfiAsciiStrLen ((CHAR8 *) Format);
+ if (MaxIndex >= EFI_DRIVER_LIB_MAX_PRINT_BUFFER) {
+ //
+ // Format string was too long for use to process.
+ //
+ return 0;
+ }
+
+ for (Index = 0; Index < EFI_DRIVER_LIB_MAX_PRINT_BUFFER; Index++) {
+ UnicodeFormat[Index] = (CHAR16) Format[Index];
+ }
+
+ VA_START (Marker, Format);
+ Return = VSPrint (Buffer, sizeof (Buffer), UnicodeFormat, Marker);
+ VA_END (Marker);
+
+ //
+ // Need to convert to Unicode to do an OutputString
+ //
+
+ if (gST->ConOut != NULL) {
+ //
+ // To be extra safe make sure ConOut has been initialized
+ //
+ gST->ConOut->OutputString (gST->ConOut, Buffer);
+ }
+
+ return Return;
+}
+
+
+UINTN
+Print (
+ IN CONST CHAR16 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
+ characters.
+
+Arguments:
+
+ Format - Ascii format string see file header for more details.
+
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+ CHAR16 Buffer[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
+
+ VA_START (Marker, Format);
+ Return = VSPrint (Buffer, sizeof (Buffer), Format, Marker);
+ VA_END (Marker);
+
+ if (gST->ConOut != NULL) {
+ //
+ // To be extra safe make sure ConOut has been initialized
+ //
+ gST->ConOut->OutputString (gST->ConOut, Buffer);
+ }
+
+ return Return;
+}
+
+UINTN
+UPrint (
+ IN CONST CHAR16 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
+ characters.
+
+Arguments:
+
+ Format - Ascii format string see file header for more details.
+
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+ CHAR16 Buffer[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
+
+ VA_START (Marker, Format);
+ Return = VSPrint (Buffer, sizeof (Buffer), Format, Marker);
+ VA_END (Marker);
+
+ if (gST->ConOut != NULL) {
+ //
+ // To be extra safe make sure ConOut has been initialized
+ //
+ gST->ConOut->OutputString (gST->ConOut, Buffer);
+ }
+
+ return Return;
+}
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintLiteUnicode.cif b/EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintLiteUnicode.cif
new file mode 100644
index 0000000..8e55a78
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintLiteUnicode.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PrintLiteUnicode"
+ category = ModulePart
+ LocalRoot = "EDK\Foundation\Library\Dxe\PrintLite\Unicode"
+ RefName = "PrintLiteUnicode"
+[files]
+"PrintWidth.h"
+"Sprint.c"
+<endComponent>
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintWidth.h b/EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintWidth.h
new file mode 100644
index 0000000..fef9ea9
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Unicode/PrintWidth.h
@@ -0,0 +1,35 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ PrintWidth.h
+
+Abstract:
+
+ Unicde option for generic width.
+ CHAR_W is Unicode
+ STRING_W is L""
+
+--*/
+
+#ifndef _PRINT_WIDTH_H_
+#define _PRINT_WIDTH_H_
+
+typedef CHAR16 CHAR_W;
+#define STRING_W(_s) L##_s
+
+#define USPrint(Buffer, BufferSize, Format) SPrint (Buffer, BufferSize, Format)
+#define UvSPrint(Buffer, BufferSize, Format, Marker) VSPrint (Buffer, BufferSize, Format, Marker)
+
+#include "EfiCommonLib.h"
+
+#endif
diff --git a/EDK/Foundation/Library/Dxe/PrintLite/Unicode/Sprint.c b/EDK/Foundation/Library/Dxe/PrintLite/Unicode/Sprint.c
new file mode 100644
index 0000000..e3b8738
--- /dev/null
+++ b/EDK/Foundation/Library/Dxe/PrintLite/Unicode/Sprint.c
@@ -0,0 +1,147 @@
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Sprint.c
+
+Abstract:
+
+ Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
+ simple implemenation of SPrint() and Print() to support debug.
+
+ You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
+ time. This makes the implementation very simple.
+
+ VSPrint, Print, SPrint format specification has the follwoing form
+
+ %[flags][width]type
+
+ flags:
+ '-' - Left justify
+ '+' - Prefix a sign
+ ' ' - Prefix a blank
+ ',' - Place commas in numberss
+ '0' - Prefix for width with zeros
+ 'l' - UINT64
+ 'L' - UINT64
+
+ width:
+ '*' - Get width from a UINTN argumnet from the argument list
+ Decimal number that represents width of print
+
+ type:
+ 'X' - argument is a UINTN hex number, prefix '0'
+ 'x' - argument is a hex number
+ 'd' - argument is a decimal number
+ 'a' - argument is an ascii string
+ 'S','s' - argument is an Unicode string
+ 'g' - argument is a pointer to an EFI_GUID
+ 't' - argument is a pointer to an EFI_TIME structure
+ 'c' - argument is an ascii character
+ 'r' - argument is EFI_STATUS
+ '%' - Print a %
+
+--*/
+
+#include "TianoCommon.h"
+#include "PrintWidth.h"
+#include "EfiPrintLib.h"
+#include "Print.h"
+
+
+UINTN
+ASPrint (
+ OUT CHAR8 *Buffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR8 *Format,
+ ...
+ )
+/*++
+
+Routine Description:
+
+ Process format and place the results in Buffer for narrow chars.
+
+Arguments:
+
+ Buffer - Narrow char buffer to print the results of the parsing of Format into.
+ BufferSize - Maximum number of characters to put into buffer.
+ Format - Format string
+ ... - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Return;
+ VA_LIST Marker;
+
+ VA_START (Marker, Format);
+ Return = AvSPrint (Buffer, BufferSize, Format, Marker);
+ VA_END (Marker);
+
+ return Return;
+}
+
+
+UINTN
+AvSPrint (
+ OUT CHAR8 *Buffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR8 *FormatString,
+ IN VA_LIST Marker
+ )
+/*++
+
+Routine Description:
+
+ Internal implementation of ASPrint.
+ Process format and place the results in Buffer for narrow chars.
+
+Arguments:
+
+ Buffer - Narrow char buffer to print the results of the parsing of Format into.
+ BufferSize - Maximum number of characters to put into buffer.
+ FormatString - Format string
+ Marker - Vararg list consumed by processing Format.
+
+Returns:
+
+ Number of characters printed.
+
+--*/
+{
+ UINTN Index;
+ //
+ // Increase array size of 'UnicodeFormat' and 'UnicodeResult' by 1 as there is a possibility of buffer overflow.
+ //
+ CHAR16 UnicodeFormat[EFI_DRIVER_LIB_MAX_PRINT_BUFFER+1];
+ CHAR16 UnicodeResult[EFI_DRIVER_LIB_MAX_PRINT_BUFFER+1];
+
+ for (Index = 0; Index < EFI_DRIVER_LIB_MAX_PRINT_BUFFER && FormatString[Index] != '\0'; Index++) {
+ UnicodeFormat[Index] = (CHAR16) FormatString[Index];
+ }
+
+ UnicodeFormat[Index] = '\0';
+
+ Index = VSPrint (UnicodeResult, sizeof (UnicodeResult)/sizeof (CHAR16), UnicodeFormat, Marker);
+
+ for (Index = 0; (Index < (BufferSize - 1)) && UnicodeResult[Index] != '\0'; Index++) {
+ Buffer[Index] = (CHAR8) UnicodeResult[Index];
+ }
+
+ Buffer[Index] = '\0';
+
+ return Index++;
+}