summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c')
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c934
1 files changed, 476 insertions, 458 deletions
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index 50c4d71005..8f0cba9fcd 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -11,10 +11,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Graphics Console Device Private Data template
//
-GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
+GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
GRAPHICS_CONSOLE_DEV_SIGNATURE,
- (EFI_GRAPHICS_OUTPUT_PROTOCOL *) NULL,
- (EFI_UGA_DRAW_PROTOCOL *) NULL,
+ (EFI_GRAPHICS_OUTPUT_PROTOCOL *)NULL,
+ (EFI_UGA_DRAW_PROTOCOL *)NULL,
{
GraphicsConsoleConOutReset,
GraphicsConsoleConOutOutputString,
@@ -25,69 +25,71 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
GraphicsConsoleConOutClearScreen,
GraphicsConsoleConOutSetCursorPosition,
GraphicsConsoleConOutEnableCursor,
- (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL
+ (EFI_SIMPLE_TEXT_OUTPUT_MODE *)NULL
},
{
0,
-1,
- EFI_TEXT_ATTR(EFI_LIGHTGRAY, EFI_BLACK),
+ EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK),
0,
0,
FALSE
},
- (GRAPHICS_CONSOLE_MODE_DATA *) NULL,
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL
+ (GRAPHICS_CONSOLE_MODE_DATA *)NULL,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)NULL
};
-GRAPHICS_CONSOLE_MODE_DATA mGraphicsConsoleModeData[] = {
- {100, 31},
+GRAPHICS_CONSOLE_MODE_DATA mGraphicsConsoleModeData[] = {
+ { 100, 31 },
//
// New modes can be added here.
// The last entry is specific for full screen mode.
//
- {0, 0}
+ { 0, 0 }
};
-EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
-EFI_HII_FONT_PROTOCOL *mHiiFont;
-EFI_HII_HANDLE mHiiHandle;
-VOID *mHiiRegistration;
+EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
+EFI_HII_FONT_PROTOCOL *mHiiFont;
+EFI_HII_HANDLE mHiiHandle;
+VOID *mHiiRegistration;
-EFI_GUID mFontPackageListGuid = {0xf5f219d3, 0x7006, 0x4648, {0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad}};
+EFI_GUID mFontPackageListGuid = {
+ 0xf5f219d3, 0x7006, 0x4648, { 0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad }
+};
-CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
+CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
-EFI_GRAPHICS_OUTPUT_BLT_PIXEL mGraphicsEfiColors[16] = {
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL mGraphicsEfiColors[16] = {
//
// B G R reserved
//
- {0x00, 0x00, 0x00, 0x00}, // BLACK
- {0x98, 0x00, 0x00, 0x00}, // LIGHTBLUE
- {0x00, 0x98, 0x00, 0x00}, // LIGHGREEN
- {0x98, 0x98, 0x00, 0x00}, // LIGHCYAN
- {0x00, 0x00, 0x98, 0x00}, // LIGHRED
- {0x98, 0x00, 0x98, 0x00}, // MAGENTA
- {0x00, 0x98, 0x98, 0x00}, // BROWN
- {0x98, 0x98, 0x98, 0x00}, // LIGHTGRAY
- {0x30, 0x30, 0x30, 0x00}, // DARKGRAY - BRIGHT BLACK
- {0xff, 0x00, 0x00, 0x00}, // BLUE
- {0x00, 0xff, 0x00, 0x00}, // LIME
- {0xff, 0xff, 0x00, 0x00}, // CYAN
- {0x00, 0x00, 0xff, 0x00}, // RED
- {0xff, 0x00, 0xff, 0x00}, // FUCHSIA
- {0x00, 0xff, 0xff, 0x00}, // YELLOW
- {0xff, 0xff, 0xff, 0x00} // WHITE
+ { 0x00, 0x00, 0x00, 0x00 }, // BLACK
+ { 0x98, 0x00, 0x00, 0x00 }, // LIGHTBLUE
+ { 0x00, 0x98, 0x00, 0x00 }, // LIGHGREEN
+ { 0x98, 0x98, 0x00, 0x00 }, // LIGHCYAN
+ { 0x00, 0x00, 0x98, 0x00 }, // LIGHRED
+ { 0x98, 0x00, 0x98, 0x00 }, // MAGENTA
+ { 0x00, 0x98, 0x98, 0x00 }, // BROWN
+ { 0x98, 0x98, 0x98, 0x00 }, // LIGHTGRAY
+ { 0x30, 0x30, 0x30, 0x00 }, // DARKGRAY - BRIGHT BLACK
+ { 0xff, 0x00, 0x00, 0x00 }, // BLUE
+ { 0x00, 0xff, 0x00, 0x00 }, // LIME
+ { 0xff, 0xff, 0x00, 0x00 }, // CYAN
+ { 0x00, 0x00, 0xff, 0x00 }, // RED
+ { 0xff, 0x00, 0xff, 0x00 }, // FUCHSIA
+ { 0x00, 0xff, 0xff, 0x00 }, // YELLOW
+ { 0xff, 0xff, 0xff, 0x00 } // WHITE
};
-EFI_NARROW_GLYPH mCursorGlyph = {
+EFI_NARROW_GLYPH mCursorGlyph = {
0x0000,
0x00,
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }
+ { 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }
};
-CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };
+CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };
-EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
GraphicsConsoleControllerDriverSupported,
GraphicsConsoleControllerDriverStart,
GraphicsConsoleControllerDriverStop,
@@ -115,15 +117,15 @@ EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_STATUS Status;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
GraphicsOutput = NULL;
UgaDraw = NULL;
@@ -133,7 +135,7 @@ GraphicsConsoleControllerDriverSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput,
+ (VOID **)&GraphicsOutput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -146,12 +148,13 @@ GraphicsConsoleControllerDriverSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
+ (VOID **)&UgaDraw,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
}
+
if (EFI_ERROR (Status)) {
return Status;
}
@@ -164,18 +167,18 @@ GraphicsConsoleControllerDriverSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
+ (VOID **)&DevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
} else {
goto Error;
}
@@ -191,19 +194,20 @@ GraphicsConsoleControllerDriverSupported (
Error:
if (GraphicsOutput != NULL) {
gBS->CloseProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiGraphicsOutputProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
}
+
return Status;
}
@@ -225,11 +229,11 @@ Error:
**/
EFI_STATUS
InitializeGraphicsConsoleTextMode (
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 GopModeNumber,
- OUT UINTN *TextModeCount,
- OUT GRAPHICS_CONSOLE_MODE_DATA **TextModeData
+ IN UINT32 HorizontalResolution,
+ IN UINT32 VerticalResolution,
+ IN UINT32 GopModeNumber,
+ OUT UINTN *TextModeCount,
+ OUT GRAPHICS_CONSOLE_MODE_DATA **TextModeData
)
{
UINTN Index;
@@ -298,6 +302,7 @@ InitializeGraphicsConsoleTextMode (
NewModeBuffer[ValidCount].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;
NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;
}
+
NewModeBuffer[ValidCount].GopWidth = HorizontalResolution;
NewModeBuffer[ValidCount].GopHeight = VerticalResolution;
NewModeBuffer[ValidCount].GopModeNumber = GopModeNumber;
@@ -308,21 +313,25 @@ InitializeGraphicsConsoleTextMode (
//
for (Index = 0; Index < Count; Index++) {
if ((ModeBuffer[Index].Columns == 0) || (ModeBuffer[Index].Rows == 0) ||
- (ModeBuffer[Index].Columns > MaxColumns) || (ModeBuffer[Index].Rows > MaxRows)) {
+ (ModeBuffer[Index].Columns > MaxColumns) || (ModeBuffer[Index].Rows > MaxRows))
+ {
//
// Skip the pre-defined mode which is invalid or exceeds the max column and row.
//
continue;
}
+
for (ValidIndex = 0; ValidIndex < ValidCount; ValidIndex++) {
if ((ModeBuffer[Index].Columns == NewModeBuffer[ValidIndex].Columns) &&
- (ModeBuffer[Index].Rows == NewModeBuffer[ValidIndex].Rows)) {
+ (ModeBuffer[Index].Rows == NewModeBuffer[ValidIndex].Rows))
+ {
//
// Skip the duplicated mode.
//
break;
}
}
+
if (ValidIndex == ValidCount) {
NewModeBuffer[ValidCount].Columns = ModeBuffer[Index].Columns;
NewModeBuffer[ValidCount].Rows = ModeBuffer[Index].Rows;
@@ -336,10 +345,16 @@ InitializeGraphicsConsoleTextMode (
}
DEBUG_CODE_BEGIN ();
- for (Index = 0; Index < ValidCount; Index++) {
- DEBUG ((DEBUG_INFO, "Graphics - Mode %d, Column = %d, Row = %d\n",
- Index, NewModeBuffer[Index].Columns, NewModeBuffer[Index].Rows));
- }
+ for (Index = 0; Index < ValidCount; Index++) {
+ DEBUG ((
+ DEBUG_INFO,
+ "Graphics - Mode %d, Column = %d, Row = %d\n",
+ Index,
+ NewModeBuffer[Index].Columns,
+ NewModeBuffer[Index].Rows
+ ));
+ }
+
DEBUG_CODE_END ();
//
@@ -367,29 +382,29 @@ InitializeGraphicsConsoleTextMode (
EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINT32 ModeIndex;
- UINTN MaxMode;
- UINT32 ModeNumber;
- EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
- INT32 PreferMode;
- INT32 Index;
- UINTN Column;
- UINTN Row;
- UINTN DefaultColumn;
- UINTN DefaultRow;
+ EFI_STATUS Status;
+ GRAPHICS_CONSOLE_DEV *Private;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ UINT32 ModeIndex;
+ UINTN MaxMode;
+ UINT32 ModeNumber;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
+ UINTN SizeOfInfo;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+ INT32 PreferMode;
+ INT32 Index;
+ UINTN Column;
+ UINTN Row;
+ UINTN DefaultColumn;
+ UINTN DefaultRow;
ModeNumber = 0;
@@ -409,17 +424,17 @@ GraphicsConsoleControllerDriverStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiGraphicsOutputProtocolGuid,
- (VOID **) &Private->GraphicsOutput,
+ (VOID **)&Private->GraphicsOutput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
- if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
+ if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = gBS->OpenProtocol (
Controller,
&gEfiUgaDrawProtocolGuid,
- (VOID **) &Private->UgaDraw,
+ (VOID **)&Private->UgaDraw,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -430,8 +445,8 @@ GraphicsConsoleControllerDriverStart (
goto Error;
}
- HorizontalResolution = PcdGet32 (PcdVideoHorizontalResolution);
- VerticalResolution = PcdGet32 (PcdVideoVerticalResolution);
+ HorizontalResolution = PcdGet32 (PcdVideoHorizontalResolution);
+ VerticalResolution = PcdGet32 (PcdVideoVerticalResolution);
if (Private->GraphicsOutput != NULL) {
//
@@ -447,21 +462,24 @@ GraphicsConsoleControllerDriverStart (
for (ModeIndex = 0; ModeIndex < MaxMode; ModeIndex++) {
Status = Private->GraphicsOutput->QueryMode (
- Private->GraphicsOutput,
- ModeIndex,
- &SizeOfInfo,
- &Info
- );
+ Private->GraphicsOutput,
+ ModeIndex,
+ &SizeOfInfo,
+ &Info
+ );
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution > HorizontalResolution) ||
- ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution > VerticalResolution))) {
+ ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution > VerticalResolution)))
+ {
HorizontalResolution = Info->HorizontalResolution;
VerticalResolution = Info->VerticalResolution;
ModeNumber = ModeIndex;
}
+
FreePool (Info);
}
}
+
if ((HorizontalResolution == 0x0) || (VerticalResolution == 0x0)) {
Status = EFI_UNSUPPORTED;
goto Error;
@@ -471,34 +489,35 @@ GraphicsConsoleControllerDriverStart (
// Use user-defined resolution
//
Status = CheckModeSupported (
- Private->GraphicsOutput,
- HorizontalResolution,
- VerticalResolution,
- &ModeNumber
- );
+ Private->GraphicsOutput,
+ HorizontalResolution,
+ VerticalResolution,
+ &ModeNumber
+ );
if (EFI_ERROR (Status)) {
//
// if not supporting current mode, try 800x600 which is required by UEFI/EFI spec
//
HorizontalResolution = 800;
VerticalResolution = 600;
- Status = CheckModeSupported (
- Private->GraphicsOutput,
- HorizontalResolution,
- VerticalResolution,
- &ModeNumber
- );
+ Status = CheckModeSupported (
+ Private->GraphicsOutput,
+ HorizontalResolution,
+ VerticalResolution,
+ &ModeNumber
+ );
Mode = Private->GraphicsOutput->Mode;
- if (EFI_ERROR (Status) && Mode->MaxMode != 0) {
+ if (EFI_ERROR (Status) && (Mode->MaxMode != 0)) {
//
// If set default mode failed or device doesn't support default mode, then get the current mode information
//
HorizontalResolution = Mode->Info->HorizontalResolution;
- VerticalResolution = Mode->Info->VerticalResolution;
- ModeNumber = Mode->Mode;
+ VerticalResolution = Mode->Info->VerticalResolution;
+ ModeNumber = Mode->Mode;
}
}
}
+
if (ModeNumber != Private->GraphicsOutput->Mode->Mode) {
//
// Current graphics mode is not set or is not set to the mode which we have found,
@@ -516,34 +535,34 @@ GraphicsConsoleControllerDriverStart (
//
// At first try to set user-defined resolution
//
- ColorDepth = 32;
- RefreshRate = 60;
- Status = Private->UgaDraw->SetMode (
- Private->UgaDraw,
- HorizontalResolution,
- VerticalResolution,
- ColorDepth,
- RefreshRate
- );
+ ColorDepth = 32;
+ RefreshRate = 60;
+ Status = Private->UgaDraw->SetMode (
+ Private->UgaDraw,
+ HorizontalResolution,
+ VerticalResolution,
+ ColorDepth,
+ RefreshRate
+ );
if (EFI_ERROR (Status)) {
//
// Try to set 800*600 which is required by UEFI/EFI spec
//
Status = Private->UgaDraw->SetMode (
- Private->UgaDraw,
- 800,
- 600,
- ColorDepth,
- RefreshRate
- );
+ Private->UgaDraw,
+ 800,
+ 600,
+ ColorDepth,
+ RefreshRate
+ );
if (EFI_ERROR (Status)) {
Status = Private->UgaDraw->GetMode (
- Private->UgaDraw,
- &HorizontalResolution,
- &VerticalResolution,
- &ColorDepth,
- &RefreshRate
- );
+ Private->UgaDraw,
+ &HorizontalResolution,
+ &VerticalResolution,
+ &ColorDepth,
+ &RefreshRate
+ );
if (EFI_ERROR (Status)) {
goto Error;
}
@@ -571,32 +590,35 @@ GraphicsConsoleControllerDriverStart (
//
// Update the maximum number of modes
//
- Private->SimpleTextOutputMode.MaxMode = (INT32) MaxMode;
+ Private->SimpleTextOutputMode.MaxMode = (INT32)MaxMode;
//
// Initialize the Mode of graphics console devices
//
- PreferMode = -1;
+ PreferMode = -1;
DefaultColumn = PcdGet32 (PcdConOutColumn);
- DefaultRow = PcdGet32 (PcdConOutRow);
- Column = 0;
- Row = 0;
+ DefaultRow = PcdGet32 (PcdConOutRow);
+ Column = 0;
+ Row = 0;
for (Index = 0; Index < (INT32)MaxMode; Index++) {
- if (DefaultColumn != 0 && DefaultRow != 0) {
+ if ((DefaultColumn != 0) && (DefaultRow != 0)) {
if ((Private->ModeData[Index].Columns == DefaultColumn) &&
- (Private->ModeData[Index].Rows == DefaultRow)) {
+ (Private->ModeData[Index].Rows == DefaultRow))
+ {
PreferMode = Index;
break;
}
} else {
if ((Private->ModeData[Index].Columns > Column) &&
- (Private->ModeData[Index].Rows > Row)) {
- Column = Private->ModeData[Index].Columns;
- Row = Private->ModeData[Index].Rows;
+ (Private->ModeData[Index].Rows > Row))
+ {
+ Column = Private->ModeData[Index].Columns;
+ Row = Private->ModeData[Index].Rows;
PreferMode = Index;
}
}
}
+
Private->SimpleTextOutput.Mode->Mode = (INT32)PreferMode;
DEBUG ((DEBUG_INFO, "Graphics Console Started, Mode: %d\n", PreferMode));
@@ -669,10 +691,10 @@ Error:
EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -682,7 +704,7 @@ GraphicsConsoleControllerDriverStop (
Status = gBS->OpenProtocol (
Controller,
&gEfiSimpleTextOutProtocolGuid,
- (VOID **) &SimpleTextOutput,
+ (VOID **)&SimpleTextOutput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -705,18 +727,18 @@ GraphicsConsoleControllerDriverStop (
//
if (Private->GraphicsOutput != NULL) {
gBS->CloseProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiGraphicsOutputProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
}
if (Private->LineBuffer != NULL) {
@@ -763,27 +785,29 @@ CheckModeSupported (
OUT UINT32 *CurrentModeNumber
)
{
- UINT32 ModeNumber;
- EFI_STATUS Status;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
- UINT32 MaxMode;
+ UINT32 ModeNumber;
+ EFI_STATUS Status;
+ UINTN SizeOfInfo;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+ UINT32 MaxMode;
Status = EFI_SUCCESS;
MaxMode = GraphicsOutput->Mode->MaxMode;
for (ModeNumber = 0; ModeNumber < MaxMode; ModeNumber++) {
Status = GraphicsOutput->QueryMode (
- GraphicsOutput,
- ModeNumber,
- &SizeOfInfo,
- &Info
- );
+ GraphicsOutput,
+ ModeNumber,
+ &SizeOfInfo,
+ &Info
+ );
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution == HorizontalResolution) &&
- (Info->VerticalResolution == VerticalResolution)) {
+ (Info->VerticalResolution == VerticalResolution))
+ {
if ((GraphicsOutput->Mode->Info->HorizontalResolution == HorizontalResolution) &&
- (GraphicsOutput->Mode->Info->VerticalResolution == VerticalResolution)) {
+ (GraphicsOutput->Mode->Info->VerticalResolution == VerticalResolution))
+ {
//
// If video device has been set to this mode, we do not need to SetMode again
//
@@ -797,6 +821,7 @@ CheckModeSupported (
}
}
}
+
FreePool (Info);
}
}
@@ -809,7 +834,6 @@ CheckModeSupported (
return Status;
}
-
/**
Locate HII Database protocol and HII Font protocol.
@@ -826,12 +850,12 @@ EfiLocateHiiProtocol (
{
EFI_STATUS Status;
- Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabase);
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **)&mHiiDatabase);
if (EFI_ERROR (Status)) {
return Status;
}
- Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &mHiiFont);
+ Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **)&mHiiFont);
return Status;
}
@@ -864,16 +888,17 @@ GraphicsConsoleConOutReset (
IN BOOLEAN ExtendedVerification
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
Status = This->SetMode (This, 0);
if (EFI_ERROR (Status)) {
return Status;
}
+
Status = This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));
return Status;
}
-
/**
Write a Unicode string to the output device.
@@ -903,25 +928,25 @@ GraphicsConsoleConOutOutputString (
IN CHAR16 *WString
)
{
- GRAPHICS_CONSOLE_DEV *Private;
+ GRAPHICS_CONSOLE_DEV *Private;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- INTN Mode;
- UINTN MaxColumn;
- UINTN MaxRow;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
- EFI_STATUS Status;
- BOOLEAN Warning;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ INTN Mode;
+ UINTN MaxColumn;
+ UINTN MaxRow;
+ UINTN Width;
+ UINTN Height;
+ UINTN Delta;
+ EFI_STATUS Status;
+ BOOLEAN Warning;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- UINTN DeltaX;
- UINTN DeltaY;
- UINTN Count;
- UINTN Index;
- INT32 OriginAttribute;
- EFI_TPL OldTpl;
+ UINTN DeltaX;
+ UINTN DeltaY;
+ UINTN Count;
+ UINTN Index;
+ INT32 OriginAttribute;
+ EFI_TPL OldTpl;
if (This->Mode->Mode == -1) {
//
@@ -936,15 +961,15 @@ GraphicsConsoleConOutOutputString (
//
// Current mode
//
- Mode = This->Mode->Mode;
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ Mode = This->Mode->Mode;
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
+ UgaDraw = Private->UgaDraw;
MaxColumn = Private->ModeData[Mode].Columns;
MaxRow = Private->ModeData[Mode].Rows;
- DeltaX = (UINTN) Private->ModeData[Mode].DeltaX;
- DeltaY = (UINTN) Private->ModeData[Mode].DeltaY;
+ DeltaX = (UINTN)Private->ModeData[Mode].DeltaX;
+ DeltaY = (UINTN)Private->ModeData[Mode].DeltaY;
Width = MaxColumn * EFI_GLYPH_WIDTH;
Height = (MaxRow - 1) * EFI_GLYPH_HEIGHT;
Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
@@ -964,19 +989,18 @@ GraphicsConsoleConOutOutputString (
OriginAttribute = This->Mode->Attribute;
while (*WString != L'\0') {
-
if (*WString == CHAR_BACKSPACE) {
//
// If the cursor is at the left edge of the display, then move the cursor
// one row up.
//
- if (This->Mode->CursorColumn == 0 && This->Mode->CursorRow > 0) {
+ if ((This->Mode->CursorColumn == 0) && (This->Mode->CursorRow > 0)) {
This->Mode->CursorRow--;
- This->Mode->CursorColumn = (INT32) (MaxColumn - 1);
+ This->Mode->CursorColumn = (INT32)(MaxColumn - 1);
This->OutputString (This, SpaceStr);
FlushCursor (This);
This->Mode->CursorRow--;
- This->Mode->CursorColumn = (INT32) (MaxColumn - 1);
+ This->Mode->CursorColumn = (INT32)(MaxColumn - 1);
} else if (This->Mode->CursorColumn > 0) {
//
// If the cursor is not at the left edge of the display, then move the cursor
@@ -989,102 +1013,95 @@ GraphicsConsoleConOutOutputString (
}
WString++;
-
} else if (*WString == CHAR_LINEFEED) {
//
// If the cursor is at the bottom of the display, then scroll the display one
// row, and do not update the cursor position. Otherwise, move the cursor
// down one row.
//
- if (This->Mode->CursorRow == (INT32) (MaxRow - 1)) {
+ if (This->Mode->CursorRow == (INT32)(MaxRow - 1)) {
if (GraphicsOutput != NULL) {
//
// Scroll Screen Up One Row
//
GraphicsOutput->Blt (
- GraphicsOutput,
- NULL,
- EfiBltVideoToVideo,
- DeltaX,
- DeltaY + EFI_GLYPH_HEIGHT,
- DeltaX,
- DeltaY,
- Width,
- Height,
- Delta
- );
+ GraphicsOutput,
+ NULL,
+ EfiBltVideoToVideo,
+ DeltaX,
+ DeltaY + EFI_GLYPH_HEIGHT,
+ DeltaX,
+ DeltaY,
+ Width,
+ Height,
+ Delta
+ );
//
// Print Blank Line at last line
//
GraphicsOutput->Blt (
- GraphicsOutput,
- &Background,
- EfiBltVideoFill,
- 0,
- 0,
- DeltaX,
- DeltaY + Height,
- Width,
- EFI_GLYPH_HEIGHT,
- Delta
- );
+ GraphicsOutput,
+ &Background,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ DeltaX,
+ DeltaY + Height,
+ Width,
+ EFI_GLYPH_HEIGHT,
+ Delta
+ );
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
//
// Scroll Screen Up One Row
//
UgaDraw->Blt (
- UgaDraw,
- NULL,
- EfiUgaVideoToVideo,
- DeltaX,
- DeltaY + EFI_GLYPH_HEIGHT,
- DeltaX,
- DeltaY,
- Width,
- Height,
- Delta
- );
+ UgaDraw,
+ NULL,
+ EfiUgaVideoToVideo,
+ DeltaX,
+ DeltaY + EFI_GLYPH_HEIGHT,
+ DeltaX,
+ DeltaY,
+ Width,
+ Height,
+ Delta
+ );
//
// Print Blank Line at last line
//
UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) &Background,
- EfiUgaVideoFill,
- 0,
- 0,
- DeltaX,
- DeltaY + Height,
- Width,
- EFI_GLYPH_HEIGHT,
- Delta
- );
+ UgaDraw,
+ (EFI_UGA_PIXEL *)(UINTN)&Background,
+ EfiUgaVideoFill,
+ 0,
+ 0,
+ DeltaX,
+ DeltaY + Height,
+ Width,
+ EFI_GLYPH_HEIGHT,
+ Delta
+ );
}
} else {
This->Mode->CursorRow++;
}
WString++;
-
} else if (*WString == CHAR_CARRIAGE_RETURN) {
//
// Move the cursor to the beginning of the current row.
//
This->Mode->CursorColumn = 0;
WString++;
-
} else if (*WString == WIDE_CHAR) {
-
This->Mode->Attribute |= EFI_WIDE_ATTRIBUTE;
WString++;
-
} else if (*WString == NARROW_CHAR) {
-
- This->Mode->Attribute &= (~ (UINT32) EFI_WIDE_ATTRIBUTE);
+ This->Mode->Attribute &= (~(UINT32)EFI_WIDE_ATTRIBUTE);
WString++;
-
} else {
//
// Print the character at the current cursor position and move the cursor
@@ -1100,14 +1117,16 @@ GraphicsConsoleConOutOutputString (
// Count is used to determine how many characters are used regardless of their attributes
//
for (Count = 0, Index = 0; (This->Mode->CursorColumn + Index) < MaxColumn; Count++, Index++) {
- if (WString[Count] == CHAR_NULL ||
- WString[Count] == CHAR_BACKSPACE ||
- WString[Count] == CHAR_LINEFEED ||
- WString[Count] == CHAR_CARRIAGE_RETURN ||
- WString[Count] == WIDE_CHAR ||
- WString[Count] == NARROW_CHAR) {
+ if ((WString[Count] == CHAR_NULL) ||
+ (WString[Count] == CHAR_BACKSPACE) ||
+ (WString[Count] == CHAR_LINEFEED) ||
+ (WString[Count] == CHAR_CARRIAGE_RETURN) ||
+ (WString[Count] == WIDE_CHAR) ||
+ (WString[Count] == NARROW_CHAR))
+ {
break;
}
+
//
// Is the wide attribute on?
//
@@ -1132,17 +1151,18 @@ GraphicsConsoleConOutOutputString (
if (EFI_ERROR (Status)) {
Warning = TRUE;
}
+
//
// At the end of line, output carriage return and line feed
//
- WString += Count;
- This->Mode->CursorColumn += (INT32) Index;
- if (This->Mode->CursorColumn > (INT32) MaxColumn) {
+ WString += Count;
+ This->Mode->CursorColumn += (INT32)Index;
+ if (This->Mode->CursorColumn > (INT32)MaxColumn) {
This->Mode->CursorColumn -= 2;
This->OutputString (This, SpaceStr);
}
- if (This->Mode->CursorColumn >= (INT32) MaxColumn) {
+ if (This->Mode->CursorColumn >= (INT32)MaxColumn) {
FlushCursor (This);
This->OutputString (This, mCrLfString);
FlushCursor (This);
@@ -1160,7 +1180,6 @@ GraphicsConsoleConOutOutputString (
gBS->RestoreTPL (OldTpl);
return Status;
-
}
/**
@@ -1189,10 +1208,10 @@ GraphicsConsoleConOutTestString (
IN CHAR16 *WString
)
{
- EFI_STATUS Status;
- UINT16 Count;
+ EFI_STATUS Status;
+ UINT16 Count;
- EFI_IMAGE_OUTPUT *Blt;
+ EFI_IMAGE_OUTPUT *Blt;
Blt = NULL;
Count = 0;
@@ -1209,6 +1228,7 @@ GraphicsConsoleConOutTestString (
FreePool (Blt);
Blt = NULL;
}
+
Count++;
if (EFI_ERROR (Status)) {
@@ -1219,7 +1239,6 @@ GraphicsConsoleConOutTestString (
return EFI_SUCCESS;
}
-
/**
Returns information for an available text mode that the output device(s)
supports
@@ -1250,22 +1269,21 @@ GraphicsConsoleConOutQueryMode (
EFI_STATUS Status;
EFI_TPL OldTpl;
- if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
+ if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
Status = EFI_SUCCESS;
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- *Columns = Private->ModeData[ModeNumber].Columns;
- *Rows = Private->ModeData[ModeNumber].Rows;
+ *Columns = Private->ModeData[ModeNumber].Columns;
+ *Rows = Private->ModeData[ModeNumber].Rows;
- if (*Columns <= 0 || *Rows <= 0) {
+ if ((*Columns <= 0) || (*Rows <= 0)) {
Status = EFI_UNSUPPORTED;
goto Done;
-
}
Done:
@@ -1273,7 +1291,6 @@ Done:
return Status;
}
-
/**
Sets the output device(s) to a specified mode.
@@ -1296,35 +1313,35 @@ GraphicsConsoleConOutSetMode (
IN UINTN ModeNumber
)
{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- GRAPHICS_CONSOLE_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ GRAPHICS_CONSOLE_DEV *Private;
+ GRAPHICS_CONSOLE_MODE_DATA *ModeData;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
+ UgaDraw = Private->UgaDraw;
//
// Make sure the requested mode number is supported
//
- if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
+ if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
Status = EFI_UNSUPPORTED;
goto Done;
}
- ModeData = &(Private->ModeData[ModeNumber]);
+ ModeData = &(Private->ModeData[ModeNumber]);
- if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
+ if ((ModeData->Columns <= 0) && (ModeData->Rows <= 0)) {
Status = EFI_UNSUPPORTED;
goto Done;
}
@@ -1336,7 +1353,7 @@ GraphicsConsoleConOutSetMode (
//
// If the new mode is the same as the old mode, then just return EFI_SUCCESS
//
- if ((INT32) ModeNumber == This->Mode->Mode) {
+ if ((INT32)ModeNumber == This->Mode->Mode) {
//
// Clear the current text window on the current graphics console
//
@@ -1344,6 +1361,7 @@ GraphicsConsoleConOutSetMode (
Status = EFI_SUCCESS;
goto Done;
}
+
//
// Otherwise, the size of the text console and/or the GOP/UGA mode will be changed,
// so erase the cursor, and free the LineBuffer for the current mode
@@ -1389,17 +1407,17 @@ GraphicsConsoleConOutSetMode (
// The current graphics mode is correct, so simply clear the entire display
//
Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &mGraphicsEfiColors[0],
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 0
- );
+ GraphicsOutput,
+ &mGraphicsEfiColors[0],
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 0
+ );
}
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
//
@@ -1412,7 +1430,7 @@ GraphicsConsoleConOutSetMode (
&ColorDepth,
&RefreshRate
);
- if (EFI_ERROR (Status) || HorizontalResolution != ModeData->GopWidth || VerticalResolution != ModeData->GopHeight) {
+ if (EFI_ERROR (Status) || (HorizontalResolution != ModeData->GopWidth) || (VerticalResolution != ModeData->GopHeight)) {
//
// Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new graphics mode
//
@@ -1435,7 +1453,7 @@ GraphicsConsoleConOutSetMode (
//
Status = UgaDraw->Blt (
UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) &mGraphicsEfiColors[0],
+ (EFI_UGA_PIXEL *)(UINTN)&mGraphicsEfiColors[0],
EfiUgaVideoFill,
0,
0,
@@ -1451,13 +1469,13 @@ GraphicsConsoleConOutSetMode (
//
// The new mode is valid, so commit the mode change
//
- This->Mode->Mode = (INT32) ModeNumber;
+ This->Mode->Mode = (INT32)ModeNumber;
//
// Move the text cursor to the upper left hand corner of the display and flush it
//
- This->Mode->CursorColumn = 0;
- This->Mode->CursorRow = 0;
+ This->Mode->CursorColumn = 0;
+ This->Mode->CursorRow = 0;
FlushCursor (This);
@@ -1468,7 +1486,6 @@ Done:
return Status;
}
-
/**
Sets the background and foreground colors for the OutputString () and
ClearScreen () functions.
@@ -1492,13 +1509,13 @@ GraphicsConsoleConOutSetAttribute (
IN UINTN Attribute
)
{
- EFI_TPL OldTpl;
+ EFI_TPL OldTpl;
if ((Attribute | 0x7F) != 0x7F) {
return EFI_UNSUPPORTED;
}
- if ((INT32) Attribute == This->Mode->Attribute) {
+ if ((INT32)Attribute == This->Mode->Attribute) {
return EFI_SUCCESS;
}
@@ -1506,7 +1523,7 @@ GraphicsConsoleConOutSetAttribute (
FlushCursor (This);
- This->Mode->Attribute = (INT32) Attribute;
+ This->Mode->Attribute = (INT32)Attribute;
FlushCursor (This);
@@ -1515,7 +1532,6 @@ GraphicsConsoleConOutSetAttribute (
return EFI_SUCCESS;
}
-
/**
Clears the output device(s) display to the currently selected background
color.
@@ -1535,14 +1551,14 @@ GraphicsConsoleConOutClearScreen (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
)
{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- GRAPHICS_CONSOLE_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ GRAPHICS_CONSOLE_DEV *Private;
+ GRAPHICS_CONSOLE_MODE_DATA *ModeData;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
+ EFI_TPL OldTpl;
if (This->Mode->Mode == -1) {
//
@@ -1553,29 +1569,29 @@ GraphicsConsoleConOutClearScreen (
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
- ModeData = &(Private->ModeData[This->Mode->Mode]);
+ UgaDraw = Private->UgaDraw;
+ ModeData = &(Private->ModeData[This->Mode->Mode]);
GetTextColors (This, &Foreground, &Background);
if (GraphicsOutput != NULL) {
Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &Background,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 0
- );
+ GraphicsOutput,
+ &Background,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 0
+ );
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt (
UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) &Background,
+ (EFI_UGA_PIXEL *)(UINTN)&Background,
EfiUgaVideoFill,
0,
0,
@@ -1589,8 +1605,8 @@ GraphicsConsoleConOutClearScreen (
Status = EFI_UNSUPPORTED;
}
- This->Mode->CursorColumn = 0;
- This->Mode->CursorRow = 0;
+ This->Mode->CursorColumn = 0;
+ This->Mode->CursorRow = 0;
FlushCursor (This);
@@ -1599,7 +1615,6 @@ GraphicsConsoleConOutClearScreen (
return Status;
}
-
/**
Sets the current coordinates of the cursor position.
@@ -1643,23 +1658,23 @@ GraphicsConsoleConOutSetCursorPosition (
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- ModeData = &(Private->ModeData[This->Mode->Mode]);
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ ModeData = &(Private->ModeData[This->Mode->Mode]);
if ((Column >= ModeData->Columns) || (Row >= ModeData->Rows)) {
Status = EFI_UNSUPPORTED;
goto Done;
}
- if ((This->Mode->CursorColumn == (INT32) Column) && (This->Mode->CursorRow == (INT32) Row)) {
+ if ((This->Mode->CursorColumn == (INT32)Column) && (This->Mode->CursorRow == (INT32)Row)) {
Status = EFI_SUCCESS;
goto Done;
}
FlushCursor (This);
- This->Mode->CursorColumn = (INT32) Column;
- This->Mode->CursorRow = (INT32) Row;
+ This->Mode->CursorColumn = (INT32)Column;
+ This->Mode->CursorRow = (INT32)Row;
FlushCursor (This);
@@ -1669,7 +1684,6 @@ Done:
return Status;
}
-
/**
Makes the cursor visible or invisible.
@@ -1691,7 +1705,7 @@ GraphicsConsoleConOutEnableCursor (
IN BOOLEAN Visible
)
{
- EFI_TPL OldTpl;
+ EFI_TPL OldTpl;
if (This->Mode->Mode == -1) {
//
@@ -1731,7 +1745,7 @@ GetTextColors (
{
INTN Attribute;
- Attribute = This->Mode->Attribute & 0x7F;
+ Attribute = This->Mode->Attribute & 0x7F;
*Foreground = mGraphicsEfiColors[Attribute & 0x0f];
*Background = mGraphicsEfiColors[Attribute >> 4];
@@ -1759,40 +1773,42 @@ DrawUnicodeWeightAtCursorN (
IN UINTN Count
)
{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_IMAGE_OUTPUT *Blt;
- EFI_STRING String;
- EFI_FONT_DISPLAY_INFO *FontInfo;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_HII_ROW_INFO *RowInfoArray;
- UINTN RowInfoArraySize;
+ EFI_STATUS Status;
+ GRAPHICS_CONSOLE_DEV *Private;
+ EFI_IMAGE_OUTPUT *Blt;
+ EFI_STRING String;
+ EFI_FONT_DISPLAY_INFO *FontInfo;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_HII_ROW_INFO *RowInfoArray;
+ UINTN RowInfoArraySize;
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
+ Blt = (EFI_IMAGE_OUTPUT *)AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
if (Blt == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Blt->Width = (UINT16) (Private->ModeData[This->Mode->Mode].GopWidth);
- Blt->Height = (UINT16) (Private->ModeData[This->Mode->Mode].GopHeight);
+ Blt->Width = (UINT16)(Private->ModeData[This->Mode->Mode].GopWidth);
+ Blt->Height = (UINT16)(Private->ModeData[This->Mode->Mode].GopHeight);
String = AllocateCopyPool ((Count + 1) * sizeof (CHAR16), UnicodeWeight);
if (String == NULL) {
FreePool (Blt);
return EFI_OUT_OF_RESOURCES;
}
+
//
// Set the end character
//
*(String + Count) = L'\0';
- FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
+ FontInfo = (EFI_FONT_DISPLAY_INFO *)AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
if (FontInfo == NULL) {
FreePool (Blt);
FreePool (String);
return EFI_OUT_OF_RESOURCES;
}
+
//
// Get current foreground and background colors.
//
@@ -1816,13 +1832,12 @@ DrawUnicodeWeightAtCursorN (
NULL,
NULL
);
-
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
//
// If Graphics Output protocol cannot be found and PcdUgaConsumeSupport enabled,
// using UGA Draw protocol to draw.
//
- ASSERT (Private->UgaDraw!= NULL);
+ ASSERT (Private->UgaDraw != NULL);
UgaDraw = Private->UgaDraw;
@@ -1839,17 +1854,17 @@ DrawUnicodeWeightAtCursorN (
// we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
//
Status = mHiiFont->StringToImage (
- mHiiFont,
- EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_IGNORE_LINE_BREAK,
- String,
- FontInfo,
- &Blt,
- This->Mode->CursorColumn * EFI_GLYPH_WIDTH + Private->ModeData[This->Mode->Mode].DeltaX,
- This->Mode->CursorRow * EFI_GLYPH_HEIGHT + Private->ModeData[This->Mode->Mode].DeltaY,
- &RowInfoArray,
- &RowInfoArraySize,
- NULL
- );
+ mHiiFont,
+ EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_IGNORE_LINE_BREAK,
+ String,
+ FontInfo,
+ &Blt,
+ This->Mode->CursorColumn * EFI_GLYPH_WIDTH + Private->ModeData[This->Mode->Mode].DeltaX,
+ This->Mode->CursorRow * EFI_GLYPH_HEIGHT + Private->ModeData[This->Mode->Mode].DeltaY,
+ &RowInfoArray,
+ &RowInfoArraySize,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
//
@@ -1860,7 +1875,7 @@ DrawUnicodeWeightAtCursorN (
Status = UgaDraw->Blt (
UgaDraw,
- (EFI_UGA_PIXEL *) Blt->Image.Bitmap,
+ (EFI_UGA_PIXEL *)Blt->Image.Bitmap,
EfiUgaBltBufferToVideo,
This->Mode->CursorColumn * EFI_GLYPH_WIDTH + Private->ModeData[This->Mode->Mode].DeltaX,
(This->Mode->CursorRow) * EFI_GLYPH_HEIGHT + Private->ModeData[This->Mode->Mode].DeltaY,
@@ -1881,12 +1896,15 @@ DrawUnicodeWeightAtCursorN (
if (Blt != NULL) {
FreePool (Blt);
}
+
if (String != NULL) {
FreePool (String);
}
+
if (FontInfo != NULL) {
FreePool (FontInfo);
}
+
return Status;
}
@@ -1908,17 +1926,17 @@ FlushCursor (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
)
{
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_SIMPLE_TEXT_OUTPUT_MODE *CurrentMode;
- INTN GlyphX;
- INTN GlyphY;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION BltChar[EFI_GLYPH_HEIGHT][EFI_GLYPH_WIDTH];
- UINTN PosX;
- UINTN PosY;
+ GRAPHICS_CONSOLE_DEV *Private;
+ EFI_SIMPLE_TEXT_OUTPUT_MODE *CurrentMode;
+ INTN GlyphX;
+ INTN GlyphY;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION BltChar[EFI_GLYPH_HEIGHT][EFI_GLYPH_WIDTH];
+ UINTN PosX;
+ UINTN PosY;
CurrentMode = This->Mode;
@@ -1926,9 +1944,9 @@ FlushCursor (
return EFI_SUCCESS;
}
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
+ UgaDraw = Private->UgaDraw;
//
// In this driver, only narrow character was supported.
@@ -1936,34 +1954,34 @@ FlushCursor (
//
// Blt a character to the screen
//
- GlyphX = (CurrentMode->CursorColumn * EFI_GLYPH_WIDTH) + Private->ModeData[CurrentMode->Mode].DeltaX;
- GlyphY = (CurrentMode->CursorRow * EFI_GLYPH_HEIGHT) + Private->ModeData[CurrentMode->Mode].DeltaY;
+ GlyphX = (CurrentMode->CursorColumn * EFI_GLYPH_WIDTH) + Private->ModeData[CurrentMode->Mode].DeltaX;
+ GlyphY = (CurrentMode->CursorRow * EFI_GLYPH_HEIGHT) + Private->ModeData[CurrentMode->Mode].DeltaY;
if (GraphicsOutput != NULL) {
GraphicsOutput->Blt (
- GraphicsOutput,
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,
- EfiBltVideoToBltBuffer,
- GlyphX,
- GlyphY,
- 0,
- 0,
- EFI_GLYPH_WIDTH,
- EFI_GLYPH_HEIGHT,
- EFI_GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
+ GraphicsOutput,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)BltChar,
+ EfiBltVideoToBltBuffer,
+ GlyphX,
+ GlyphY,
+ 0,
+ 0,
+ EFI_GLYPH_WIDTH,
+ EFI_GLYPH_HEIGHT,
+ EFI_GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) BltChar,
- EfiUgaVideoToBltBuffer,
- GlyphX,
- GlyphY,
- 0,
- 0,
- EFI_GLYPH_WIDTH,
- EFI_GLYPH_HEIGHT,
- EFI_GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
- );
+ UgaDraw,
+ (EFI_UGA_PIXEL *)(UINTN)BltChar,
+ EfiUgaVideoToBltBuffer,
+ GlyphX,
+ GlyphY,
+ 0,
+ 0,
+ EFI_GLYPH_WIDTH,
+ EFI_GLYPH_HEIGHT,
+ EFI_GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
+ );
}
GetTextColors (This, &Foreground.Pixel, &Background.Pixel);
@@ -1981,30 +1999,30 @@ FlushCursor (
if (GraphicsOutput != NULL) {
GraphicsOutput->Blt (
- GraphicsOutput,
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,
- EfiBltBufferToVideo,
- 0,
- 0,
- GlyphX,
- GlyphY,
- EFI_GLYPH_WIDTH,
- EFI_GLYPH_HEIGHT,
- EFI_GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
+ GraphicsOutput,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)BltChar,
+ EfiBltBufferToVideo,
+ 0,
+ 0,
+ GlyphX,
+ GlyphY,
+ EFI_GLYPH_WIDTH,
+ EFI_GLYPH_HEIGHT,
+ EFI_GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) BltChar,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- GlyphX,
- GlyphY,
- EFI_GLYPH_WIDTH,
- EFI_GLYPH_HEIGHT,
- EFI_GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
- );
+ UgaDraw,
+ (EFI_UGA_PIXEL *)(UINTN)BltChar,
+ EfiUgaBltBufferToVideo,
+ 0,
+ 0,
+ GlyphX,
+ GlyphY,
+ EFI_GLYPH_WIDTH,
+ EFI_GLYPH_HEIGHT,
+ EFI_GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
+ );
}
return EFI_SUCCESS;
@@ -2021,16 +2039,16 @@ FlushCursor (
VOID
EFIAPI
RegisterFontPackage (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
- UINT32 PackageLength;
- UINT8 *Package;
- UINT8 *Location;
- EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_STATUS Status;
+ EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
+ UINT32 PackageLength;
+ UINT8 *Package;
+ UINT8 *Location;
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
//
// Locate HII Database Protocol
@@ -2038,7 +2056,7 @@ RegisterFontPackage (
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
- (VOID **) &HiiDatabase
+ (VOID **)&HiiDatabase
);
if (EFI_ERROR (Status)) {
return;
@@ -2061,17 +2079,17 @@ RegisterFontPackage (
// | |
// +--------------------------------+
- PackageLength = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + mNarrowFontSize + 4;
- Package = AllocateZeroPool (PackageLength);
+ PackageLength = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + mNarrowFontSize + 4;
+ Package = AllocateZeroPool (PackageLength);
ASSERT (Package != NULL);
- WriteUnaligned32((UINT32 *) Package,PackageLength);
- SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR *) (Package + 4);
- SimplifiedFont->Header.Length = (UINT32) (PackageLength - 4);
+ WriteUnaligned32 ((UINT32 *)Package, PackageLength);
+ SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR *)(Package + 4);
+ SimplifiedFont->Header.Length = (UINT32)(PackageLength - 4);
SimplifiedFont->Header.Type = EFI_HII_PACKAGE_SIMPLE_FONTS;
- SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (mNarrowFontSize / sizeof (EFI_NARROW_GLYPH));
+ SimplifiedFont->NumberOfNarrowGlyphs = (UINT16)(mNarrowFontSize / sizeof (EFI_NARROW_GLYPH));
- Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);
+ Location = (UINT8 *)(&SimplifiedFont->NumberOfWideGlyphs + 1);
CopyMem (Location, gUsStdNarrowGlyphData, mNarrowFontSize);
//
@@ -2100,11 +2118,11 @@ RegisterFontPackage (
EFI_STATUS
EFIAPI
InitializeGraphicsConsole (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// Register notify function on HII Database Protocol to add font package.