/** @file\r
This is the main routine for initializing the Graphics Console support routines.\r
\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, 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
EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
EFI_HII_FONT_PROTOCOL *mHiiFont;\r
EFI_HII_HANDLE mHiiHandle;\r
-EFI_EVENT mHiiRegistration;\r
+VOID *mHiiRegistration;\r
\r
EFI_GUID mFontPackageListGuid = {0xf5f219d3, 0x7006, 0x4648, {0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad}};\r
\r
UINTN ValidCount;\r
UINTN ValidIndex;\r
UINTN MaxColumns;\r
- UINTN MaxRows; \r
- \r
+ UINTN MaxRows;\r
+\r
if ((TextModeCount == NULL) || (TextModeData == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
// Mode 0 and mode 1 is for 80x25, 80x50 according to UEFI spec.\r
//\r
- ValidCount = 0; \r
+ ValidCount = 0;\r
\r
NewModeBuffer[ValidCount].Columns = 80;\r
NewModeBuffer[ValidCount].Rows = 25;\r
NewModeBuffer[ValidCount].GopHeight = VerticalResolution;\r
NewModeBuffer[ValidCount].GopModeNumber = GopModeNumber;\r
NewModeBuffer[ValidCount].DeltaX = (HorizontalResolution - (NewModeBuffer[ValidCount].Columns * EFI_GLYPH_WIDTH)) >> 1;\r
- NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (NewModeBuffer[ValidCount].Rows * EFI_GLYPH_HEIGHT)) >> 1; \r
+ NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (NewModeBuffer[ValidCount].Rows * EFI_GLYPH_HEIGHT)) >> 1;\r
ValidCount++;\r
\r
if ((MaxColumns >= 80) && (MaxRows >= 50)) {\r
NewModeBuffer[ValidCount].Columns = 80;\r
NewModeBuffer[ValidCount].Rows = 50;\r
NewModeBuffer[ValidCount].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
- NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1; \r
+ NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;\r
}\r
NewModeBuffer[ValidCount].GopWidth = HorizontalResolution;\r
NewModeBuffer[ValidCount].GopHeight = VerticalResolution;\r
NewModeBuffer[ValidCount].GopModeNumber = GopModeNumber;\r
ValidCount++;\r
- \r
+\r
//\r
// Start from mode 2 to put the valid mode other than 80x25 and 80x50 in the output mode buffer.\r
//\r
ValidCount++;\r
}\r
}\r
- \r
+\r
DEBUG_CODE (\r
for (Index = 0; Index < ValidCount; Index++) {\r
- DEBUG ((EFI_D_INFO, "Graphics - Mode %d, Column = %d, Row = %d\n", \r
- Index, NewModeBuffer[Index].Columns, NewModeBuffer[Index].Rows)); \r
+ DEBUG ((EFI_D_INFO, "Graphics - Mode %d, Column = %d, Row = %d\n",\r
+ Index, NewModeBuffer[Index].Columns, NewModeBuffer[Index].Rows));\r
}\r
);\r
- \r
+\r
//\r
// Return valid mode count and mode information buffer.\r
//\r
UINTN MaxMode;\r
UINT32 ModeNumber;\r
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;\r
- UINTN SizeOfInfo; \r
+ UINTN SizeOfInfo;\r
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
- \r
+\r
ModeNumber = 0;\r
\r
//\r
if ((HorizontalResolution == 0x0) || (VerticalResolution == 0x0)) {\r
//\r
// Find the highest resolution which GOP supports.\r
- // \r
+ //\r
MaxMode = Private->GraphicsOutput->Mode->MaxMode;\r
- \r
+\r
for (ModeIndex = 0; ModeIndex < MaxMode; ModeIndex++) {\r
Status = Private->GraphicsOutput->QueryMode (\r
Private->GraphicsOutput,\r
&Info\r
);\r
if (!EFI_ERROR (Status)) {\r
- if ((Info->HorizontalResolution >= HorizontalResolution) &&\r
- (Info->VerticalResolution >= VerticalResolution)) {\r
+ if ((Info->HorizontalResolution > HorizontalResolution) ||\r
+ ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution > VerticalResolution))) {\r
HorizontalResolution = Info->HorizontalResolution;\r
VerticalResolution = Info->VerticalResolution;\r
ModeNumber = ModeIndex;\r
//\r
// if not supporting current mode, try 800x600 which is required by UEFI/EFI spec\r
//\r
+ HorizontalResolution = 800;\r
+ VerticalResolution = 600;\r
Status = CheckModeSupported (\r
Private->GraphicsOutput,\r
- 800,\r
- 600,\r
+ HorizontalResolution,\r
+ VerticalResolution,\r
&ModeNumber\r
);\r
Mode = Private->GraphicsOutput->Mode;\r
}\r
}\r
\r
+ DEBUG ((EFI_D_INFO, "GraphicsConsole video resolution %d x %d\n", HorizontalResolution, VerticalResolution));\r
+\r
//\r
// Initialize the mode which GraphicsConsole supports.\r
//\r
Status = GraphicsConsoleConOutOutputString (&Private->SimpleTextOutput, (CHAR16 *)L"Graphics Console Started\n\r");\r
if (EFI_ERROR (Status)) {\r
goto Error;\r
- } \r
+ }\r
DEBUG_CODE_END ();\r
\r
//\r
VOID\r
)\r
{\r
- EFI_HANDLE Handle;\r
- UINTN Size;\r
EFI_STATUS Status;\r
\r
- //\r
- // There should only be one - so buffer size is this\r
- //\r
- Size = sizeof (EFI_HANDLE);\r
-\r
- Status = gBS->LocateHandle (\r
- ByProtocol,\r
- &gEfiHiiDatabaseProtocolGuid,\r
- NULL,\r
- &Size,\r
- (VOID **) &Handle\r
- );\r
-\r
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabase);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- Status = gBS->HandleProtocol (\r
- Handle,\r
- &gEfiHiiDatabaseProtocolGuid,\r
- (VOID **) &mHiiDatabase\r
- );\r
-\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- Status = gBS->HandleProtocol (\r
- Handle,\r
- &gEfiHiiFontProtocolGuid,\r
- (VOID **) &mHiiFont\r
- );\r
+ Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &mHiiFont);\r
return Status;\r
}\r
\r
}\r
\r
Status = EFI_SUCCESS;\r
- \r
+\r
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
//\r
// Current mode\r
Status = EFI_UNSUPPORTED;\r
goto Done;\r
}\r
- \r
+\r
ModeData = &(Private->ModeData[ModeNumber]);\r
\r
if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {\r
This->Mode->CursorColumn = 0;\r
This->Mode->CursorRow = 0;\r
\r
- FlushCursor (This); \r
+ FlushCursor (This);\r
\r
Status = EFI_SUCCESS;\r
\r
{\r
EFI_TPL OldTpl;\r
\r
- if ((Attribute | 0xFF) != 0xFF) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- if (This->Mode->Mode == -1) {\r
- //\r
- // If current mode is not valid, return error.\r
- //\r
+ if ((Attribute | 0x7F) != 0x7F) {\r
return EFI_UNSUPPORTED;\r
}\r
\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;\r
EFI_TPL OldTpl;\r
- \r
+\r
if (This->Mode->Mode == -1) {\r
//\r
// If current mode is not valid, return error.\r
\r
/**\r
Flush the cursor on the screen.\r
- \r
+\r
If CursorVisible is FALSE, nothing to do and return directly.\r
- If CursorVisible is TRUE, \r
+ If CursorVisible is TRUE,\r
i) If the cursor shows on screen, it will be erased.\r
- ii) If the cursor does not show on screen, it will be shown. \r
+ ii) If the cursor does not show on screen, it will be shown.\r
\r
@param This Protocol instance pointer.\r
\r
NULL,\r
(VOID **) &HiiDatabase\r
);\r
- ASSERT_EFI_ERROR (Status);\r
+ if (EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
\r
//\r
// Add 4 bytes to the header for entire length for HiiAddPackages use only.\r