summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c124
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h104
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf9
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/LaffStd.c4
4 files changed, 120 insertions, 121 deletions
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index f925daa..407eefb 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -14,9 +14,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "GraphicsConsole.h"
-
//
-// Graphics Console Devcie Private Data template
+// Graphics Console Device Private Data template
//
GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
GRAPHICS_CONSOLE_DEV_SIGNATURE,
@@ -62,24 +61,24 @@ CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHA
EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
//
- // B G R
+ // B G R reserved
//
{0x00, 0x00, 0x00, 0x00}, // BLACK
- {0x98, 0x00, 0x00, 0x00}, // BLUE
- {0x00, 0x98, 0x00, 0x00}, // GREEN
- {0x98, 0x98, 0x00, 0x00}, // CYAN
- {0x00, 0x00, 0x98, 0x00}, // RED
+ {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}, // LIGHTBLUE - ?
- {0x00, 0xff, 0x00, 0x00}, // LIGHTGREEN - ?
- {0xff, 0xff, 0x00, 0x00}, // LIGHTCYAN
- {0x00, 0x00, 0xff, 0x00}, // LIGHTRED
- {0xff, 0x00, 0xff, 0x00}, // LIGHTMAGENTA
- {0x00, 0xff, 0xff, 0x00}, // LIGHTBROWN
- {0xff, 0xff, 0xff, 0x00} // WHITE
+ {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 = {
@@ -117,7 +116,7 @@ GetTextColors (
);
/**
- Draw Unicode string on the Graphice Console device's screen.
+ Draw Unicode string on the Graphics Console device's screen.
@param This Protocol instance pointer.
@param UnicodeWeight One Unicode string to be displayed.
@@ -151,9 +150,9 @@ EraseCursor (
/**
Check if the current specific mode supported the user defined resolution
- for the Graphice Console devcie based on Graphics Output Protocol.
+ for the Graphics Console device based on Graphics Output Protocol.
- If yes, set the graphic devcice's current mode to this specific mode.
+ If yes, set the graphic device's current mode to this specific mode.
@param GraphicsOutput Graphics Output Protocol instance pointer.
@param HorizontalResolution User defined horizontal resolution
@@ -162,7 +161,7 @@ EraseCursor (
@retval EFI_SUCCESS The mode is supported.
@retval EFI_UNSUPPORTED The specific mode is out of range of graphics
- devcie supported.
+ device supported.
@retval other The specific mode does not support user defined
resolution or failed to set the current mode to the
specific mode on graphics device.
@@ -292,7 +291,7 @@ Error:
/**
Start this driver on Controller by opening Graphics Output protocol or
UGA Draw protocol, and installing Simple Text Out protocol on Controller.
- (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)
+ (UGA Draw protocol could be skipped if PcdUgaConsumeSupport is set to FALSE.)
@param This Protocol instance pointer.
@param Controller Handle of device to bind driver to
@@ -313,7 +312,7 @@ GraphicsConsoleControllerDriverStart (
{
EFI_STATUS Status;
GRAPHICS_CONSOLE_DEV *Private;
- UINTN NarrowFontSize;
+ UINT32 NarrowFontSize;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
@@ -323,11 +322,11 @@ GraphicsConsoleControllerDriverStart (
UINTN Rows;
UINT32 ModeNumber;
EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
- UINTN PackageLength;
+ UINT32 PackageLength;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
UINT8 *Package;
UINT8 *Location;
-
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
ModeNumber = 0;
//
@@ -374,13 +373,27 @@ GraphicsConsoleControllerDriverStart (
// Add 4 bytes to the header for entire length for HiiLibPreparePackageList use only.
// Looks ugly. Might be updated when font tool is ready.
//
+ // +--------------------------------+ <-- Package
+ // | |
+ // | PackageLength(4 bytes) |
+ // | |
+ // |--------------------------------| <-- SimplifiedFont
+ // | |
+ // |EFI_HII_SIMPLE_FONT_PACKAGE_HDR |
+ // | |
+ // |--------------------------------| <-- Location
+ // | |
+ // | gUsStdNarrowGlyphData |
+ // | |
+ // +--------------------------------+
+
PackageLength = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + NarrowFontSize + 4;
Package = AllocateZeroPool (PackageLength);
if (Package == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- CopyMem (Package, &PackageLength, 4);
- SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR*) (Package + 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) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));
@@ -400,8 +413,8 @@ GraphicsConsoleControllerDriverStart (
mFirstAccessFlag = FALSE;
}
//
- // If the current mode information can not be retrieved, then attemp to set the default mode
- // of 800x600, 32 bit colot, 60 Hz refresh.
+ // If the current mode information can not be retrieved, then attempt to set the default mode
+ // of 800x600, 32 bit color, 60 Hz refresh.
//
HorizontalResolution = 800;
VerticalResolution = 600;
@@ -435,14 +448,16 @@ GraphicsConsoleControllerDriverStart (
&ModeNumber
);
}
-
- if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) {
+
+ Mode = Private->GraphicsOutput->Mode;
+
+ if (EFI_ERROR (Status) || (Mode->MaxMode)) {
//
// Set default mode failed or device don't support default mode, then get the current mode information
//
- HorizontalResolution = Private->GraphicsOutput->Mode->Info->HorizontalResolution;
- VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution;
- ModeNumber = Private->GraphicsOutput->Mode->Mode;
+ HorizontalResolution = Mode->Info->HorizontalResolution;
+ VerticalResolution = Mode->Info->VerticalResolution;
+ ModeNumber = Mode->Mode;
}
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
//
@@ -629,7 +644,7 @@ Error:
/**
Stop this driver on Controller by removing Simple Text Out protocol
and closing the Graphics Output Protocol or UGA Draw protocol on Controller.
- (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)
+ (UGA Draw protocol could be skipped if PcdUgaConsumeSupport is set to FALSE.)
@param This Protocol instance pointer.
@@ -719,7 +734,7 @@ GraphicsConsoleControllerDriverStop (
/**
Check if the current specific mode supported the user defined resolution
- for the Graphice Console devcie based on Graphics Output Protocol.
+ for the Graphics Console device based on Graphics Output Protocol.
If yes, set the graphic devcice's current mode to this specific mode.
@@ -730,7 +745,7 @@ GraphicsConsoleControllerDriverStop (
@retval EFI_SUCCESS The mode is supported.
@retval EFI_UNSUPPORTED The specific mode is out of range of graphics
- devcie supported.
+ device supported.
@retval other The specific mode does not support user defined
resolution or failed to set the current mode to the
specific mode on graphics device.
@@ -838,7 +853,7 @@ EfiLocateHiiProtocol (
//
/**
- Reset the text output device hardware and optionaly run diagnostics.
+ Reset the text output device hardware and optionally run diagnostics.
Implements SIMPLE_TEXT_OUTPUT.Reset().
If ExtendeVerification is TRUE, then perform dependent Graphics Console
@@ -1086,27 +1101,12 @@ 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) {
- break;
- }
-
- if (WString[Count] == CHAR_BACKSPACE) {
- break;
- }
-
- if (WString[Count] == CHAR_LINEFEED) {
- break;
- }
-
- if (WString[Count] == CHAR_CARRIAGE_RETURN) {
- break;
- }
-
- if (WString[Count] == WIDE_CHAR) {
- break;
- }
-
- if (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;
}
//
@@ -1379,7 +1379,7 @@ GraphicsConsoleConOutSetMode (
if (GraphicsOutput != NULL) {
if (ModeData->GopModeNumber != GraphicsOutput->Mode->Mode) {
//
- // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
+ // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new graphics mode
//
Status = GraphicsOutput->SetMode (GraphicsOutput, ModeData->GopModeNumber);
if (EFI_ERROR (Status)) {
@@ -1418,7 +1418,7 @@ GraphicsConsoleConOutSetMode (
);
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 grapghics mode
+ // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new graphics mode
//
Status = UgaDraw->SetMode (
UgaDraw,
@@ -1458,7 +1458,7 @@ GraphicsConsoleConOutSetMode (
This->Mode->Mode = (INT32) ModeNumber;
//
- // Move the text cursor to the upper left hand corner of the displat and enable it
+ // Move the text cursor to the upper left hand corner of the display and enable it
//
This->SetCursorPosition (This, 0, 0);
@@ -1718,7 +1718,7 @@ GetTextColors (
}
/**
- Draw Unicode string on the Graphice Console device's screen.
+ Draw Unicode string on the Graphics Console device's screen.
@param This Protocol instance pointer.
@param UnicodeWeight One Unicode string to be displayed.
@@ -1778,7 +1778,7 @@ DrawUnicodeWeightAtCursorN (
if (Private->GraphicsOutput != NULL) {
//
- // If Graphcis Output protocol exists, using HII Font protocol to draw.
+ // If Graphics Output protocol exists, using HII Font protocol to draw.
//
Blt->Image.Screen = Private->GraphicsOutput;
@@ -1946,7 +1946,7 @@ EraseCursor (
//
for (PosY = 0; PosY < EFI_GLYPH_HEIGHT; PosY++) {
for (PosX = 0; PosX < EFI_GLYPH_WIDTH; PosX++) {
- if ((mCursorGlyph.GlyphCol1[PosY] & (1 << PosX)) != 0) {
+ if ((mCursorGlyph.GlyphCol1[PosY] & (BIT0 << PosX)) != 0) {
BltChar[PosY][EFI_GLYPH_WIDTH - PosX - 1].Raw ^= Foreground.Raw;
}
}
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
index dd5e6e5..e8678f1 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
@@ -38,6 +38,53 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
+extern EFI_NARROW_GLYPH gUsStdNarrowGlyphData[];
+
+
+//
+// User can define valid graphic resolution here
+// e.g. 640x480, 800x600, 1024x768...
+//
+#define CURRENT_HORIZONTAL_RESOLUTION 800
+#define CURRENT_VERTICAL_RESOLUTION 600
+
+typedef union {
+ EFI_NARROW_GLYPH NarrowGlyph;
+ EFI_WIDE_GLYPH WideGlyph;
+} GLYPH_UNION;
+
+//
+// Device Structure
+//
+#define GRAPHICS_CONSOLE_DEV_SIGNATURE SIGNATURE_32 ('g', 's', 't', 'o')
+
+typedef struct {
+ UINTN Columns;
+ UINTN Rows;
+ INTN DeltaX;
+ INTN DeltaY;
+ UINT32 GopWidth;
+ UINT32 GopHeight;
+ UINT32 GopModeNumber;
+} GRAPHICS_CONSOLE_MODE_DATA;
+
+#define GRAPHICS_MAX_MODE 4
+
+typedef struct {
+ UINTN Signature;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
+ EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
+ GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
+ EFI_HII_HANDLE HiiHandle;
+} GRAPHICS_CONSOLE_DEV;
+
+#define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
+ CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
+
//
// EFI Component Name Functions
@@ -169,64 +216,15 @@ GraphicsConsoleComponentNameGetControllerName (
);
-//
-// User can define valid graphic resolution here
-// e.g. 640x480, 800x600, 1024x768...
-//
-#define CURRENT_HORIZONTAL_RESOLUTION 800
-#define CURRENT_VERTICAL_RESOLUTION 600
-
-typedef union {
- EFI_NARROW_GLYPH NarrowGlyph;
- EFI_WIDE_GLYPH WideGlyph;
-} GLYPH_UNION;
-
-extern EFI_NARROW_GLYPH gUsStdNarrowGlyphData[];
-
-//
-// Device Structure
-//
-#define GRAPHICS_CONSOLE_DEV_SIGNATURE SIGNATURE_32 ('g', 's', 't', 'o')
-
-typedef struct {
- UINTN Columns;
- UINTN Rows;
- INTN DeltaX;
- INTN DeltaY;
- UINT32 GopWidth;
- UINT32 GopHeight;
- UINT32 GopModeNumber;
-} GRAPHICS_CONSOLE_MODE_DATA;
-
-#define GRAPHICS_MAX_MODE 4
-
-typedef struct {
- UINTN Signature;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
- GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
- EFI_HII_HANDLE HiiHandle;
-} GRAPHICS_CONSOLE_DEV;
-
-#define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
- CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
/**
Returns available Unicode glyphs narrow fonts(8*19 pixels) size.
- @return Narrow foun size.
+ @return Narrow font size.
**/
-UINTN
+UINT32
ReturnNarrowFontSize (
VOID
);
@@ -466,7 +464,7 @@ GraphicsConsoleControllerDriverSupported (
/**
Start this driver on Controller by opening Graphics Output protocol or
UGA Draw protocol, and installing Simple Text Out protocol on Controller.
- (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)
+ (UGA Draw protocol could be skipped if PcdUgaConsumeSupport is set to FALSE.)
@param This Protocol instance pointer.
@param Controller Handle of device to bind driver to
@@ -488,7 +486,7 @@ GraphicsConsoleControllerDriverStart (
/**
Stop this driver on Controller by removing Simple Text Out protocol
and closing the Graphics Output Protocol or UGA Draw protocol on Controller.
- (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)
+ (UGA Draw protocol could be skipped if PcdUgaConsumeSupport is set to FALSE.)
@param This Protocol instance pointer.
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
index 6a58519..b6a4bfe 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
@@ -1,9 +1,10 @@
#/** @file
-# Component description file for GraphicsConsole module
-#
-# This is the main routine for initializing the Graphics Console support routines.
-# Copyright (c) 2006 - 2008, Intel Corporation
+#
+# Component description file for GraphicsConsole module
#
+# This is the main routine for initializing the Graphics Console support routines.
+#
+# Copyright (c) 2006 - 2008, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/LaffStd.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/LaffStd.c
index dd7b02b..786cd9a 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/LaffStd.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/LaffStd.c
@@ -273,10 +273,10 @@ EFI_NARROW_GLYPH gUsStdNarrowGlyphData[] = {
/**
Returns available Unicode glyphs narrow fonts(8*19 pixels) size.
- @return Narrow foun size.
+ @return Narrow font size.
**/
-UINTN
+UINT32
ReturnNarrowFontSize (
VOID
)