#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/DxePiLib.h>\r
+#include <Library/PcdLib.h>\r
\r
STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {\r
{ 0x00, 0x00, 0x00, 0x00 },\r
\r
ImageHandle - The driver image handle of the caller. The parameter is used to\r
optimize the loading of the image file so that the FV from which\r
- the driver image is loaded will be tried first. \r
+ the driver image is loaded will be tried first.\r
\r
FileNameGuid - File Name of graphics file in the FV(s).\r
\r
- Image - Pointer to pointer to return graphics image. If NULL, a \r
+ Image - Pointer to pointer to return graphics image. If NULL, a\r
buffer will be allocated.\r
\r
ImageSize - Size of the graphics Image in bytes. Zero if no image found.\r
\r
\r
-Returns: \r
+Returns:\r
\r
- EFI_SUCCESS - Image and ImageSize are valid. \r
+ EFI_SUCCESS - Image and ImageSize are valid.\r
EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size\r
EFI_NOT_FOUND - FileNameGuid not found\r
\r
LogoFile - File name of logo to display on the center of the screen.\r
\r
\r
-Returns: \r
+Returns:\r
\r
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo\r
displayed.\r
the driver image is loaded will be tried first.\r
\r
\r
-Returns: \r
+Returns:\r
\r
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo\r
displayed.\r
// Try to open GOP first\r
//\r
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput);\r
- if (EFI_ERROR (Status)) {\r
+ if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
GraphicsOutput = NULL;\r
//\r
- // Open GOP failed, try to open UGA\r
+ // Open GOP failed, try to open UGwhA\r
//\r
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw);\r
- if (EFI_ERROR (Status)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
+ }\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_UNSUPPORTED;\r
}\r
\r
Badging = NULL;\r
Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID**)&Badging);\r
\r
- ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);\r
+ Status = ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
\r
if (GraphicsOutput != NULL) {\r
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
- } else {\r
+ } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);\r
if (EFI_ERROR (Status)) {\r
return EFI_UNSUPPORTED;\r
}\r
+ } else {\r
+ return EFI_UNSUPPORTED;\r
}\r
\r
Instance = 0;\r
Height,\r
Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
);\r
- } else {\r
+ } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
Status = UgaDraw->Blt (\r
UgaDraw,\r
(EFI_UGA_PIXEL *) Blt,\r
Height,\r
Width * sizeof (EFI_UGA_PIXEL)\r
);\r
+ } else {\r
+ Status = EFI_UNSUPPORTED;\r
}\r
}\r
\r
_IPrint (\r
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,\r
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto,\r
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto,\r
IN UINTN X,\r
IN UINTN Y,\r
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,\r
GraphicsOutput - Graphics output protocol interface\r
\r
UgaDraw - UGA draw protocol interface\r
- \r
+\r
Sto - Simple text out protocol interface\r
- \r
+\r
X - X coordinate to start printing\r
- \r
+\r
Y - Y coordinate to start printing\r
- \r
+\r
Foreground - Foreground color\r
- \r
+\r
Background - Background color\r
- \r
+\r
fmt - Format string\r
- \r
+\r
args - Print arguments\r
\r
-Returns: \r
+Returns:\r
\r
EFI_SUCCESS - success\r
EFI_OUT_OF_RESOURCES - out of resources\r
UINTN LineBufferLen;\r
EFI_HII_FONT_PROTOCOL *HiiFont;\r
EFI_IMAGE_OUTPUT *Blt;\r
- EFI_FONT_DISPLAY_INFO *FontInfo; \r
+ EFI_FONT_DISPLAY_INFO *FontInfo;\r
\r
//\r
// For now, allocate an arbitrarily long buffer\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
+ HorizontalResolution = 0;\r
+ VerticalResolution = 0;\r
+ Blt = NULL;\r
+ FontInfo = NULL;\r
+\r
if (GraphicsOutput != NULL) {\r
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;\r
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;\r
- } else {\r
+ } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);\r
+ } else {\r
+ Status = EFI_UNSUPPORTED;\r
+ goto Error;\r
}\r
- ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0)); \r
\r
- Blt = NULL;\r
- FontInfo = NULL;\r
+ ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));\r
+\r
ASSERT (GraphicsOutput != NULL);\r
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);\r
if (EFI_ERROR (Status)) {\r
goto Error;\r
- } \r
+ }\r
\r
UnicodeVSPrint (Buffer, 0x10000, fmt, args);\r
- \r
+\r
UnicodeWeight = (CHAR16 *) Buffer;\r
\r
for (Index = 0; UnicodeWeight[Index] != 0; Index++) {\r
}\r
\r
BufferLen = StrLen (Buffer);\r
- \r
+\r
\r
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;\r
if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {\r
Blt->Width = (UINT16) (HorizontalResolution);\r
Blt->Height = (UINT16) (VerticalResolution);\r
Blt->Image.Screen = GraphicsOutput;\r
- \r
+\r
FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));\r
if (FontInfo == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
CopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
} else {\r
CopyMem (\r
- &FontInfo->ForegroundColor, \r
- &mEfiColors[Sto->Mode->Attribute & 0x0f], \r
+ &FontInfo->ForegroundColor,\r
+ &mEfiColors[Sto->Mode->Attribute & 0x0f],\r
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
);\r
}\r
CopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
} else {\r
CopyMem (\r
- &FontInfo->BackgroundColor, \r
- &mEfiColors[Sto->Mode->Attribute >> 4], \r
+ &FontInfo->BackgroundColor,\r
+ &mEfiColors[Sto->Mode->Attribute >> 4],\r
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
);\r
}\r
NULL,\r
NULL\r
);\r
- \r
+\r
\r
Error:\r
SafeFreePool (Blt);\r
Arguments:\r
\r
X - X coordinate to start printing\r
- \r
+\r
Y - Y coordinate to start printing\r
- \r
+\r
ForeGround - Foreground color\r
- \r
+\r
BackGround - Background color\r
\r
Fmt - Format string\r
);\r
\r
UgaDraw = NULL;\r
- if (EFI_ERROR (Status)) {\r
+ if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
GraphicsOutput = NULL;\r
\r
Status = gBS->HandleProtocol (\r
&gEfiUgaDrawProtocolGuid,\r
(VOID**)&UgaDraw\r
);\r
-\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
+ }\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
}\r
\r
Status = gBS->HandleProtocol (\r