summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/GraphicsLib.h31
-rw-r--r--MdePkg/Include/Library/UefiLib.h99
-rw-r--r--MdePkg/Library/UefiLib/UefiLib.inf6
-rw-r--r--MdePkg/Library/UefiLib/UefiLibInternal.h5
-rw-r--r--MdePkg/Library/UefiLib/UefiLibPrint.c412
-rw-r--r--MdePkg/MdePkg.dec3
6 files changed, 517 insertions, 39 deletions
diff --git a/MdePkg/Include/Library/GraphicsLib.h b/MdePkg/Include/Library/GraphicsLib.h
index 37dc557a62..c54dcf8041 100644
--- a/MdePkg/Include/Library/GraphicsLib.h
+++ b/MdePkg/Include/Library/GraphicsLib.h
@@ -17,9 +17,6 @@
#ifndef __EFI_GRAPHICS_LIB_H__
#define __EFI_GRAPHICS_LIB_H__
-#include <Protocol/GraphicsOutput.h>
-
-
/**
Return the graphics image file named FileNameGuid into Image and return it's
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
@@ -146,32 +143,4 @@ LockKeyboards (
IN CHAR16 *Password
);
-
-/**
- Print Unicode string to graphics screen at the given X,Y coordinates of the graphics screen.
- see definition of Print to find rules for constructing Fmt.
-
- @param[in] X Row to start printing at
- @param[in] Y Column to start printing at
- @param[in] ForeGround Foreground color
- @param[in] BackGround background color
- @param[in] Fmt Print format sting. See definition of Print
- @param ... Variable argument list whose contents are accessed based on
- the format string specified by Format.
-
- @return Number of Characters printed.
-
-**/
-UINTN
-EFIAPI
-PrintXY (
- IN UINTN X,
- IN UINTN Y,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
- IN CHAR16 *Fmt,
- ...
- );
-
-
#endif
diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index c9da13316c..eeffdc052f 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/ComponentName2.h>
#include <Protocol/DriverDiagnostics.h>
#include <Protocol/DriverDiagnostics2.h>
+#include <Protocol/GraphicsOutput.h>
#include <Library/BaseLib.h>
@@ -916,6 +917,104 @@ AsciiErrorPrint (
);
/**
+ Prints a formatted Unicode string to a graphics console device specified by
+ ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
+
+ This function prints a formatted Unicode string to the graphics console device
+ specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
+ Unicode characters printed. If the length of the formatted Unicode string is
+ greater than PcdUefiLibMaxPrintBufferSize, then only the first
+ PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
+ is used to convert the string to a bitmap using the glyphs registered with the
+ HII database. No wrapping is performed, so any portions of the string the fall
+ outside the active display region will not be displayed.
+
+ If a graphics console device is not associated with the ConsoleOutputHandle
+ defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
+ If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
+ string is printed, and 0 is returned.
+ If Format is NULL, then ASSERT().
+ If Format is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param X X coordinate to print the string.
+ @param Y Y coordinate to print the string.
+ @param ForeGround The forground color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the foreground color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param BackGround The background color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the background color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param Format Null-terminated Unicode format string. See Print Library
+ for the supported format string syntax.
+ @param ... Variable argument list whose contents are accessed based on
+ the format string specified by Format.
+
+ @return The number of Unicode characters printed.
+
+**/
+UINTN
+EFIAPI
+PrintXY (
+ IN UINTN X,
+ IN UINTN Y,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
+ IN CONST CHAR16 *Format,
+ ...
+ );
+
+/**
+ Prints a formatted ASCII string to a graphics console device specified by
+ ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
+
+ This function prints a formatted ASCII string to the graphics console device
+ specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
+ ASCII characters printed. If the length of the formatted ASCII string is
+ greater than PcdUefiLibMaxPrintBufferSize, then only the first
+ PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
+ is used to convert the string to a bitmap using the glyphs registered with the
+ HII database. No wrapping is performed, so any portions of the string the fall
+ outside the active display region will not be displayed.
+
+ If a graphics console device is not associated with the ConsoleOutputHandle
+ defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
+ If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
+ string is printed, and 0 is returned.
+ If Format is NULL, then ASSERT().
+ If Format is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param X X coordinate to print the string.
+ @param Y Y coordinate to print the string.
+ @param ForeGround The forground color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the foreground color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param BackGround The background color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the background color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param Format Null-terminated ASCII format string. See Print Library
+ for the supported format string syntax.
+ @param ... Variable argument list whose contents are accessed based on
+ the format string specified by Format.
+
+ @return The number of ASCII characters printed.
+
+**/
+UINTN
+EFIAPI
+AsciiPrintXY (
+ IN UINTN X,
+ IN UINTN Y,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
+ IN CONST CHAR8 *Format,
+ ...
+ );
+
+/**
Initializes a driver by installing the Driver Binding Protocol onto the driver's
DriverBindingHandle. This is typically the same as the driver's ImageHandle, but
it can be different if the driver produces multiple DriverBinding Protocols.
diff --git a/MdePkg/Library/UefiLib/UefiLib.inf b/MdePkg/Library/UefiLib/UefiLib.inf
index 103014cd3d..26bed07bfb 100644
--- a/MdePkg/Library/UefiLib/UefiLib.inf
+++ b/MdePkg/Library/UefiLib/UefiLib.inf
@@ -64,12 +64,17 @@
[Protocols]
gEfiDriverBindingProtocolGuid # ALWAYS_CONSUMED
+ gEfiSimpleTextOutProtocolGuid # ALWAYS_CONSUMED
+ gEfiGraphicsOutputProtocolGuid # ALWAYS_CONSUMED
+ gEfiHiiFontProtocolGuid # ALWAYS_CONSUMED
gEfiComponentNameProtocolGuid # SOMETIMES_CONSUMED
gEfiComponentName2ProtocolGuid # SOMETIMES_CONSUMED
gEfiDriverConfigurationProtocolGuid # SOMETIMES_CONSUMED
gEfiDriverConfiguration2ProtocolGuid # SOMETIMES_CONSUMED
gEfiDriverDiagnosticsProtocolGuid # SOMETIMES_CONSUMED
gEfiDriverDiagnostics2ProtocolGuid # SOMETIMES_CONSUMED
+ gEfiUgaDrawProtocolGuid # SOMETIMES_CONSUMED
+
[Pcd.common]
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize
@@ -80,6 +85,7 @@
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable
+ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
[Guids]
gEfiGlobalVariableGuid
diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h b/MdePkg/Library/UefiLib/UefiLibInternal.h
index ef28195b97..14478cf934 100644
--- a/MdePkg/Library/UefiLib/UefiLibInternal.h
+++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
@@ -1,7 +1,7 @@
/** @file
Internal include file for UefiLib.
- Copyright (c) 2007, Intel Corporation.<BR>
+ Copyright (c) 2007 - 2008, 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
@@ -22,6 +22,9 @@
#include <Protocol/DriverDiagnostics.h>
#include <Protocol/DriverDiagnostics2.h>
#include <Protocol/LoadedImage.h>
+#include <Protocol/GraphicsOutput.h>
+#include <Protocol/UgaDraw.h>
+#include <Protocol/HiiFont.h>
#include <Guid/EventGroup.h>
#include <Guid/EventLegacyBios.h>
diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c b/MdePkg/Library/UefiLib/UefiLibPrint.c
index 630d1b3123..4a21a6d9d8 100644
--- a/MdePkg/Library/UefiLib/UefiLibPrint.c
+++ b/MdePkg/Library/UefiLib/UefiLibPrint.c
@@ -13,9 +13,27 @@
**/
-
#include "UefiLibInternal.h"
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
+ { 0x00, 0x00, 0x00, 0x00 },
+ { 0x98, 0x00, 0x00, 0x00 },
+ { 0x00, 0x98, 0x00, 0x00 },
+ { 0x98, 0x98, 0x00, 0x00 },
+ { 0x00, 0x00, 0x98, 0x00 },
+ { 0x98, 0x00, 0x98, 0x00 },
+ { 0x00, 0x98, 0x98, 0x00 },
+ { 0x98, 0x98, 0x98, 0x00 },
+ { 0x10, 0x10, 0x10, 0x00 },
+ { 0xff, 0x10, 0x10, 0x00 },
+ { 0x10, 0xff, 0x10, 0x00 },
+ { 0xff, 0xff, 0x10, 0x00 },
+ { 0x10, 0x10, 0xff, 0x00 },
+ { 0xf0, 0x10, 0xff, 0x00 },
+ { 0x10, 0xff, 0xff, 0x00 },
+ { 0xff, 0xff, 0xff, 0x00 }
+};
+
/**
Internal function which prints a formatted Unicode string to the console output device
specified by Console
@@ -35,7 +53,6 @@
output buffer not including the Null-terminator.
**/
UINTN
-EFIAPI
InternalPrint (
IN CONST CHAR16 *Format,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
@@ -47,7 +64,7 @@ InternalPrint (
UINTN BufferSize;
ASSERT (Format != NULL);
- ASSERT (((UINTN) Format & 0x01) == 0);
+ ASSERT (((UINTN) Format & BIT0) == 0);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
@@ -154,11 +171,8 @@ ErrorPrint (
specified by Console and returns the number of ASCII characters that printed
to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
- If Format is NULL, then ASSERT().
If Format is NULL, then ASSERT().
- If Format is not aligned on a 16-bit boundary, then ASSERT().
-
@param Format Null-terminated ASCII format string.
@param Console The output console.
@@ -169,7 +183,6 @@ ErrorPrint (
**/
UINTN
-EFIAPI
AsciiInternalPrint (
IN CONST CHAR8 *Format,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
@@ -280,3 +293,388 @@ AsciiErrorPrint (
return Return;
}
+/**
+ Internal function to print a formatted Unicode string to a graphics console device specified by
+ ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
+
+ This function prints a formatted Unicode string to the graphics console device
+ specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
+ Unicode characters printed. The EFI_HII_FONT_PROTOCOL is used to convert the
+ string to a bitmap using the glyphs registered with the
+ HII database. No wrapping is performed, so any portions of the string the fall
+ outside the active display region will not be displayed.
+
+ If a graphics console device is not associated with the ConsoleOutputHandle
+ defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
+ If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
+ string is printed, and 0 is returned.
+
+ @param X X coordinate to print the string.
+ @param Y Y coordinate to print the string.
+ @param ForeGround The forground color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the foreground color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param BackGround The background color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the background color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param Buffer Null-terminated Unicode formatted string.
+ @param PrintNum The number of Unicode formatted string to be printed.
+
+ @return Number of Unicode Characters printed. Zero means no any character
+ displayed successfully.
+
+**/
+UINTN
+InternalPrintGraphic (
+ IN UINTN X,
+ IN UINTN Y,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
+ IN CHAR16 *Buffer,
+ IN UINTN PrintNum
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ CHAR16 *UnicodeWeight;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ UINTN LineBufferLen;
+ EFI_HII_FONT_PROTOCOL *HiiFont;
+ EFI_IMAGE_OUTPUT *Blt;
+ EFI_FONT_DISPLAY_INFO FontInfo;
+ EFI_HII_ROW_INFO *RowInfoArray;
+ UINTN RowInfoArraySize;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
+ EFI_HANDLE ConsoleHandle;
+
+ HorizontalResolution = 0;
+ VerticalResolution = 0;
+ Blt = NULL;
+
+ ConsoleHandle = gST->ConsoleOutHandle;
+
+ Status = gBS->HandleProtocol (
+ ConsoleHandle,
+ &gEfiGraphicsOutputProtocolGuid,
+ (VOID **) &GraphicsOutput
+ );
+
+ UgaDraw = NULL;
+ if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
+ //
+ // If no GOP available, try to open UGA Draw protocol if supported.
+ //
+ GraphicsOutput = NULL;
+
+ Status = gBS->HandleProtocol (
+ ConsoleHandle,
+ &gEfiUgaDrawProtocolGuid,
+ (VOID **) &UgaDraw
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ return 0;
+ }
+
+ Status = gBS->HandleProtocol (
+ ConsoleHandle,
+ &gEfiSimpleTextOutProtocolGuid,
+ (VOID **) &Sto
+ );
+
+ if (EFI_ERROR (Status)) {
+ return 0;
+ }
+
+ if (GraphicsOutput != NULL) {
+ HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
+ VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
+ } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
+ UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
+ } else {
+ Status = EFI_UNSUPPORTED;
+ goto Error;
+ }
+
+ ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
+
+ Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
+
+ UnicodeWeight = Buffer;
+
+ for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
+ if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
+ UnicodeWeight[Index] == CHAR_LINEFEED ||
+ UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
+ UnicodeWeight[Index] = 0;
+ }
+ }
+
+ LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;
+ if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * PrintNum > LineBufferLen) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Error;
+ }
+
+ Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
+ ASSERT (Blt != NULL);
+
+ Blt->Width = (UINT16) (HorizontalResolution);
+ Blt->Height = (UINT16) (VerticalResolution);
+
+ ZeroMem (&FontInfo, sizeof (EFI_FONT_DISPLAY_INFO));
+
+ if (Foreground != NULL) {
+ CopyMem (&FontInfo.ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ } else {
+ CopyMem (
+ &FontInfo.ForegroundColor,
+ &mEfiColors[Sto->Mode->Attribute & 0x0f],
+ sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ }
+ if (Background != NULL) {
+ CopyMem (&FontInfo.BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ } else {
+ CopyMem (
+ &FontInfo.BackgroundColor,
+ &mEfiColors[Sto->Mode->Attribute >> 4],
+ sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ }
+
+ if (GraphicsOutput != NULL) {
+ Blt->Image.Screen = GraphicsOutput;
+
+ Status = HiiFont->StringToImage (
+ HiiFont,
+ EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
+ Buffer,
+ &FontInfo,
+ &Blt,
+ X,
+ Y,
+ NULL,
+ NULL,
+ NULL
+ );
+
+ } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
+ ASSERT (UgaDraw!= NULL);
+
+ Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ ASSERT (Blt->Image.Bitmap != NULL);
+
+ RowInfoArray = NULL;
+ //
+ // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
+ // we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
+ //
+ Status = HiiFont->StringToImage (
+ HiiFont,
+ EFI_HII_IGNORE_IF_NO_GLYPH,
+ Buffer,
+ &FontInfo,
+ &Blt,
+ X,
+ Y,
+ &RowInfoArray,
+ &RowInfoArraySize,
+ NULL
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ASSERT (RowInfoArray != NULL);
+ //
+ // Line breaks are handled by caller of DrawUnicodeWeightAtCursorN, so the updated parameter RowInfoArraySize by StringToImage will
+ // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
+ //
+ ASSERT (RowInfoArraySize <= 1);
+
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) Blt->Image.Bitmap,
+ EfiUgaBltBufferToVideo,
+ X,
+ Y,
+ X,
+ Y,
+ RowInfoArray[0].LineWidth,
+ RowInfoArray[0].LineHeight,
+ Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ }
+
+ FreePool (RowInfoArray);
+ FreePool (Blt->Image.Bitmap);
+
+ } else {
+ Status = EFI_UNSUPPORTED;
+ }
+
+ FreePool (Blt);
+
+Error:
+ if (EFI_ERROR (Status)) {
+ return 0;
+ } else {
+ return PrintNum;
+ }
+}
+
+/**
+ Prints a formatted Unicode string to a graphics console device specified by
+ ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
+
+ This function prints a formatted Unicode string to the graphics console device
+ specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
+ Unicode characters printed. If the length of the formatted Unicode string is
+ greater than PcdUefiLibMaxPrintBufferSize, then only the first
+ PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
+ is used to convert the string to a bitmap using the glyphs registered with the
+ HII database. No wrapping is performed, so any portions of the string the fall
+ outside the active display region will not be displayed.
+
+ If a graphics console device is not associated with the ConsoleOutputHandle
+ defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
+ If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
+ string is printed, and 0 is returned.
+ If Format is NULL, then ASSERT().
+ If Format is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param X X coordinate to print the string.
+ @param Y Y coordinate to print the string.
+ @param ForeGround The forground color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the foreground color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param BackGround The background color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the background color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param Format Null-terminated Unicode format string. See Print Library
+ for the supported format string syntax.
+ @param ... Variable argument list whose contents are accessed based on
+ the format string specified by Format.
+
+ @return The number of characters printed.
+
+**/
+UINTN
+EFIAPI
+PrintXY (
+ IN UINTN X,
+ IN UINTN Y,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
+ IN CONST CHAR16 *Format,
+ ...
+ )
+{
+ VA_LIST Marker;
+ CHAR16 *Buffer;
+ UINTN BufferSize;
+ UINTN PrintNum;
+ UINTN ReturnNum;
+
+ ASSERT (Format != NULL);
+ ASSERT (((UINTN) Format & BIT0) == 0);
+
+ VA_START (Marker, Format);
+
+ BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
+
+ Buffer = (CHAR16 *) AllocatePool (BufferSize);
+ ASSERT (Buffer != NULL);
+
+ PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
+
+ ReturnNum = InternalPrintGraphic (X, Y, ForeGround, BackGround, Buffer, PrintNum);
+
+ FreePool (Buffer);
+
+ return ReturnNum;
+}
+
+/**
+ Prints a formatted ASCII string to a graphics console device specified by
+ ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
+
+ This function prints a formatted ASCII string to the graphics console device
+ specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
+ Unicode characters printed. If the length of the formatted ASCII string is
+ greater than PcdUefiLibMaxPrintBufferSize, then only the first
+ PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
+ is used to convert the string to a bitmap using the glyphs registered with the
+ HII database. No wrapping is performed, so any portions of the string the fall
+ outside the active display region will not be displayed.
+
+ If a graphics console device is not associated with the ConsoleOutputHandle
+ defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
+ If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
+ string is printed, and 0 is returned.
+ If Format is NULL, then ASSERT().
+
+ @param X X coordinate to print the string.
+ @param Y Y coordinate to print the string.
+ @param ForeGround The forground color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the foreground color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param BackGround The background color of the string being printed. This is
+ an optional parameter that may be NULL. If it is NULL,
+ then the background color of the current ConOut device
+ in the EFI_SYSTEM_TABLE is used.
+ @param Format Null-terminated ASCII format string. See Print Library
+ for the supported format string syntax.
+ @param ... Variable argument list whose contents are accessed based on
+ the format string specified by Format.
+
+ @return The number of characters printed.
+
+**/
+UINTN
+EFIAPI
+AsciiPrintXY (
+ IN UINTN X,
+ IN UINTN Y,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
+ IN CONST CHAR8 *Format,
+ ...
+ )
+{
+ VA_LIST Marker;
+ CHAR16 *Buffer;
+ UINTN BufferSize;
+ UINTN PrintNum;
+ UINTN ReturnNum;
+
+ ASSERT (Format != NULL);
+
+ VA_START (Marker, Format);
+
+ BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
+
+ Buffer = (CHAR16 *) AllocatePool (BufferSize);
+ ASSERT (Buffer != NULL);
+
+ PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
+
+ ReturnNum = InternalPrintGraphic (X, Y, ForeGround, BackGround, Buffer, PrintNum);
+
+ FreePool (Buffer);
+
+ return ReturnNum;
+}
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 14d76dbf94..7d00ffed63 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -401,6 +401,9 @@
## Indicates whether EFI 1.1 ISO 639-2 language supports are obsolete
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012 .
+ ## If TRUE, UGA Draw Protocol is still consumed.
+ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000013 .
+
[PcdsFixedAtBuild.common]
## Indicates the maximum length of unicode string
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001