/** @file\r
This is the main routine for initializing the Graphics Console support routines.\r
-Remaining Tasks\r
- Add all standard Glyphs from UEFI 2.0 Specification\r
- Implement optimal automatic Mode creation algorithm\r
- Solve palette issues for mixed graphics and text\r
- When does this protocol reset the palette?\r
\r
Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
@param VerticalResolution User defined vertical resolution.\r
@param CurrentModeNumber Current specific mode to be check.\r
\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
+ @retval EFI_SUCCESS The mode is supported.\r
@retval EFI_UNSUPPORTED The specific mode is out of range of graphics \r
devcie supported.\r
@retval other The specific mode does not support user defined \r
);\r
\r
//\r
-// Globals\r
+// Graphics Console Devcie Private Data template\r
//\r
-GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {\r
+STATIC GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {\r
GRAPHICS_CONSOLE_DEV_SIGNATURE,\r
(EFI_GRAPHICS_OUTPUT_PROTOCOL *) NULL,\r
(EFI_UGA_DRAW_PROTOCOL *) NULL,\r
\r
\r
/**\r
- Test to see if Graphics Console could be supported on the ControllerHandle.\r
+ Test to see if Graphics Console could be supported on the Controller.\r
\r
Graphics Console could be supported if Graphics Output Protocol or UGA Draw\r
- Protocol exists on the ControllerHandle. (UGA Draw Protocol could be shipped\r
+ Protocol exists on the Controller. (UGA Draw Protocol could be skipped\r
if PcdUgaConsumeSupport is set to FALSE.)\r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
+ @param Controller Handle of device to test.\r
@param RemainingDevicePath Optional parameter use to pick a specific child\r
device to start.\r
\r
- @retval EFI_SUCCESS This driver supports this device\r
- @retval other This driver does not support this device\r
+ @retval EFI_SUCCESS This driver supports this device.\r
+ @retval other This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Start this driver on ControllerHandle by opening Graphics Output protocol or \r
- UGA Draw protocol, and installing Simple Text Out protocol on ControllerHandle.\r
+ Start this driver on Controller by opening Graphics Output protocol or \r
+ UGA Draw protocol, and installing Simple Text Out protocol on Controller.\r
(UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to\r
+ @param Controller Handle of device to bind driver to\r
@param RemainingDevicePath Optional parameter use to pick a specific child\r
device to start.\r
\r
- @retval EFI_SUCCESS This driver is added to ControllerHandle\r
- @retval other This driver does not support this device\r
+ @retval EFI_SUCCESS This driver is added to Controller.\r
+ @retval other This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));\r
\r
Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);\r
- CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);\r
+ CopyMem (Location, gUsStdNarrowGlyphData, NarrowFontSize);\r
\r
//\r
// Add this simplified font package to a package list then install it.\r
// Add Mode #0 that must be 80x25\r
//\r
MaxMode = 0;\r
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * EFI_GLYPH_HEIGHT)) >> 1;\r
+ Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
+ Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * EFI_GLYPH_HEIGHT)) >> 1;\r
MaxMode++;\r
\r
//\r
// If it is possible to support Mode #1 - 80x50, than add it as an active mode\r
//\r
if (Rows >= 50) {\r
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;\r
+ Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
+ Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;\r
MaxMode++;\r
}\r
\r
// If it is not to support Mode #1 - 80x50, then skip it\r
//\r
if (MaxMode < 2) {\r
- Private->ModeData[MaxMode].Columns = 0;\r
- Private->ModeData[MaxMode].Rows = 0;\r
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
+ Private->ModeData[MaxMode].Columns = 0;\r
+ Private->ModeData[MaxMode].Rows = 0;\r
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
- Private->ModeData[MaxMode].DeltaX = 0;\r
- Private->ModeData[MaxMode].DeltaY = 0;\r
+ Private->ModeData[MaxMode].DeltaX = 0;\r
+ Private->ModeData[MaxMode].DeltaY = 0;\r
MaxMode++;\r
}\r
\r
// Add Mode #2 that must be 100x31 (graphic mode >= 800x600)\r
//\r
if (Columns >= 100 && Rows >= 31) {\r
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (100 * EFI_GLYPH_WIDTH)) >> 1;\r
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (31 * EFI_GLYPH_HEIGHT)) >> 1;\r
+ Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (100 * EFI_GLYPH_WIDTH)) >> 1;\r
+ Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (31 * EFI_GLYPH_HEIGHT)) >> 1;\r
MaxMode++;\r
}\r
\r
// Add Mode #3 that uses the entire display for user-defined mode\r
//\r
if (HorizontalResolution > 800 && VerticalResolution > 600) {\r
- Private->ModeData[MaxMode].Columns = HorizontalResolution/EFI_GLYPH_WIDTH;\r
- Private->ModeData[MaxMode].Rows = VerticalResolution/EFI_GLYPH_HEIGHT;\r
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
+ Private->ModeData[MaxMode].Columns = HorizontalResolution/EFI_GLYPH_WIDTH;\r
+ Private->ModeData[MaxMode].Rows = VerticalResolution/EFI_GLYPH_HEIGHT;\r
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution % EFI_GLYPH_WIDTH) >> 1;\r
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution % EFI_GLYPH_HEIGHT) >> 1;\r
+ Private->ModeData[MaxMode].DeltaX = (HorizontalResolution % EFI_GLYPH_WIDTH) >> 1;\r
+ Private->ModeData[MaxMode].DeltaY = (VerticalResolution % EFI_GLYPH_HEIGHT) >> 1;\r
MaxMode++;\r
}\r
\r
Error:\r
if (EFI_ERROR (Status)) {\r
//\r
- // Close the GOP or UGA IO Protocol\r
+ // Close the GOP and UGA Draw Protocol\r
//\r
if (Private->GraphicsOutput != NULL) {\r
gBS->CloseProtocol (\r
}\r
\r
/**\r
- Stop this driver on ControllerHandle by removing Simple Text Out protocol \r
- and closing the Graphics Output Protocol or UGA Draw protocol on ControllerHandle.\r
+ Stop this driver on Controller by removing Simple Text Out protocol \r
+ and closing the Graphics Output Protocol or UGA Draw protocol on Controller.\r
(UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
\r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
+ @param Controller Handle of device to stop driver on\r
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
children is zero stop the entire bus driver.\r
@param ChildHandleBuffer List of Child Handles to Stop.\r
\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
+ @retval EFI_SUCCESS This driver is removed Controller.\r
@retval EFI_NOT_STARTED Simple Text Out protocol could not be found the \r
- ControllerHandle.\r
+ Controller.\r
@retval other This driver was not removed from this device.\r
\r
**/\r
@param VerticalResolution User defined vertical resolution.\r
@param CurrentModeNumber Current specific mode to be check.\r
\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
+ @retval EFI_SUCCESS The mode is supported.\r
@retval EFI_UNSUPPORTED The specific mode is out of range of graphics \r
devcie supported.\r
@retval other The specific mode does not support user defined \r
goto Done;\r
}\r
\r
- if (((INT32) Column == This->Mode->CursorColumn) && ((INT32) Row == This->Mode->CursorRow)) {\r
+ if ((This->Mode->CursorColumn == (INT32) Column) && (This->Mode->CursorRow == (INT32) Row)) {\r
Status = EFI_SUCCESS;\r
goto Done;\r
}\r
SafeFreePool (Blt);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- *(String + Count) = 0;\r
+ //\r
+ // Set the end character\r
+ //\r
+ *(String + Count) = L'\0';\r
\r
FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));\r
if (FontInfo == NULL) {\r
SafeFreePool (String);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
+ //\r
+ // Get current foreground and background colors.\r
+ //\r
GetTextColors (This, &FontInfo->ForegroundColor, &FontInfo->BackgroundColor);\r
\r
if (Private->GraphicsOutput != NULL) {\r
+ //\r
+ // If Graphcis Output protocol exists, using HII Font protocol to draw. \r
+ //\r
Blt->Image.Screen = Private->GraphicsOutput;\r
\r
Status = mHiiFont->StringToImage (\r
);\r
\r
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+ //\r
+ // If Graphics Output protocol cannot be found and PcdUgaConsumeSupport enabled, \r
+ // using UGA Draw protocol to draw.\r
+ //\r
ASSERT (Private->UgaDraw!= NULL);\r
\r
UgaDraw = Private->UgaDraw;\r