/** @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 - 2014, 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
&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
}\r
}\r
+ if (ModeNumber != Private->GraphicsOutput->Mode->Mode) {\r
+ //\r
+ // Current graphics mode is not set or is not set to the mode which we has found,\r
+ // set the new graphic mode.\r
+ //\r
+ Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // The mode set operation failed\r
+ //\r
+ goto Error;\r
+ }\r
+ }\r
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
//\r
// At first try to set user-defined resolution\r
goto Error;\r
}\r
}\r
- } else {\r
- Status = EFI_UNSUPPORTED;\r
- goto Error;\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
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
EFI_TPL OldTpl;\r
\r
- if ((Attribute | 0xFF) != 0xFF) {\r
+ if ((Attribute | 0x7F) != 0x7F) {\r
return EFI_UNSUPPORTED;\r
}\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