diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-01-17 05:56:45 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-01-17 05:56:45 +0000 |
commit | 3012ce5cf75f938a79c70568595454e27b2f014a (patch) | |
tree | d924d6c391796ef7ccc54d743f02d2db49ec0b86 /MdeModulePkg/Universal | |
parent | b290614d493ff72fc2a4410d169314e501b7e79e (diff) | |
download | edk2-3012ce5cf75f938a79c70568595454e27b2f014a.zip edk2-3012ce5cf75f938a79c70568595454e27b2f014a.tar.gz edk2-3012ce5cf75f938a79c70568595454e27b2f014a.tar.bz2 |
1. Fixed bugs in DxeNetLib to meet consistence with network module DriverBinding protocol.
2. Sync bugs in console modules.
3. Sync bugs in PlatDriOverLib.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4571 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
7 files changed, 336 insertions, 110 deletions
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 8e49c48..63be0b1 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -2243,6 +2243,7 @@ Returns: INT32 Index;
INT32 *TextOutModeMap;
INT32 *MapTable;
+ INT32 QueryMode;
TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
UINTN Rows;
UINTN Columns;
@@ -2263,13 +2264,15 @@ Returns: MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles;
while (Mode < TextOut->Mode->MaxMode) {
TextOut->QueryMode (TextOut, Mode, &Columns, &Rows);
+ MapTable[StepSize] = Mode;
//
- // Search the QueryData database to see if they intersects
+ // Search the intersection map and QueryData database to see if they intersects
//
Index = 0;
while (Index < CurrentMaxMode) {
- if ((TextOutQueryData[Index].Rows == Rows) && (TextOutQueryData[Index].Columns == Columns)) {
+ QueryMode = *(TextOutModeMap + Index * StepSize);
+ if ((TextOutQueryData[QueryMode].Rows == Rows) && (TextOutQueryData[QueryMode].Columns == Columns)) {
MapTable[Index * StepSize] = Mode;
break;
}
@@ -2308,7 +2311,7 @@ Arguments: Returns:
- None
+ EFI_SUCCESS
EFI_OUT_OF_RESOURCES
--*/
@@ -2319,10 +2322,14 @@ Returns: TEXT_OUT_AND_GOP_DATA *StdErrTextOutList;
UINTN Indexi;
UINTN Indexj;
- UINTN Rows;
- UINTN Columns;
+ UINTN ConOutRows;
+ UINTN ConOutColumns;
+ UINTN StdErrRows;
+ UINTN StdErrColumns;
INT32 ConOutMaxMode;
INT32 StdErrMaxMode;
+ INT32 ConOutMode;
+ INT32 StdErrMode;
INT32 Mode;
INT32 Index;
INT32 *ConOutModeMap;
@@ -2331,6 +2338,8 @@ Returns: INT32 *StdErrMapTable;
TEXT_OUT_SPLITTER_QUERY_DATA *ConOutQueryData;
TEXT_OUT_SPLITTER_QUERY_DATA *StdErrQueryData;
+ UINTN ConOutStepSize;
+ UINTN StdErrStepSize;
BOOLEAN FoundTheSameTextOut;
UINTN ConOutMapTableSize;
UINTN StdErrMapTableSize;
@@ -2366,10 +2375,12 @@ Returns: //
ConOutMaxMode = mConOut.TextOutMode.MaxMode;
ConOutModeMap = mConOut.TextOutModeMap;
+ ConOutStepSize = mConOut.TextOutListCount;
ConOutQueryData = mConOut.TextOutQueryData;
StdErrMaxMode = mStdErr.TextOutMode.MaxMode;
StdErrModeMap = mStdErr.TextOutModeMap;
+ StdErrStepSize = mStdErr.TextOutListCount;
StdErrQueryData = mStdErr.TextOutQueryData;
//
@@ -2398,13 +2409,17 @@ Returns: Mode = 0;
while (Mode < ConOutMaxMode) {
//
- // Search the other's QueryData database to see if they intersect
+ // Search the intersection map and QueryData database to see if they intersect
//
- Index = 0;
- Rows = ConOutQueryData[Mode].Rows;
- Columns = ConOutQueryData[Mode].Columns;
+ Index = 0;
+ ConOutMode = *(ConOutModeMap + Mode * ConOutStepSize);
+ ConOutRows = ConOutQueryData[ConOutMode].Rows;
+ ConOutColumns = ConOutQueryData[ConOutMode].Columns;
while (Index < StdErrMaxMode) {
- if ((StdErrQueryData[Index].Rows == Rows) && (StdErrQueryData[Index].Columns == Columns)) {
+ StdErrMode = *(StdErrModeMap + Index * StdErrStepSize);
+ StdErrRows = StdErrQueryData[StdErrMode].Rows;
+ StdErrColumns = StdErrQueryData[StdErrMode].Columns;
+ if ((StdErrRows == ConOutRows) && (StdErrColumns == ConOutColumns)) {
ConOutMapTable[Mode] = 1;
StdErrMapTable[Index] = 1;
break;
@@ -2470,6 +2485,7 @@ Returns: {
EFI_STATUS Status;
UINTN Index;
+ UINTN CurrentIndex;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
@@ -2479,6 +2495,10 @@ Returns: UINTN NumberIndex;
BOOLEAN Match;
BOOLEAN AlreadyExist;
+ UINT32 UgaHorizontalResolution;
+ UINT32 UgaVerticalResolution;
+ UINT32 UgaColorDepth;
+ UINT32 UgaRefreshRate;
if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
return EFI_UNSUPPORTED;
@@ -2487,6 +2507,7 @@ Returns: CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;
Index = 0;
+ CurrentIndex = 0;
if (Private->CurrentNumberOfUgaDraw != 0) {
//
@@ -2606,34 +2627,49 @@ Returns: }
//
- // Select a prefered Display mode 800x600
+ // Graphics console driver can ensure the same mode for all GOP devices
//
for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
Mode = &Private->GraphicsOutputModeBuffer[Index];
- if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) {
+ if ((Mode->HorizontalResolution == GraphicsOutput->Mode->Info->HorizontalResolution) &&
+ (Mode->VerticalResolution == GraphicsOutput->Mode->Info->VerticalResolution)) {
+ CurrentIndex = Index;
break;
}
}
- //
- // Prefered mode is not found, set to mode 0
- //
if (Index >= CurrentGraphicsOutputMode->MaxMode) {
- Index = 0;
+ //
+ // if user defined mode is not found, set to default mode 800x600
+ //
+ for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
+ Mode = &Private->GraphicsOutputModeBuffer[Index];
+ if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) {
+ CurrentIndex = Index;
+ break;
+ }
+ }
}
-
}
if (UgaDraw != NULL) {
//
- // For UGA device, it's inconvenient to retrieve all the supported display modes.
- // To simplify the implementation, only add one resolution(800x600, 32bit color depth) as defined in UEFI spec
+ // Graphics console driver can ensure the same mode for all GOP devices
+ // so we can get the current mode from this video device
//
+ UgaDraw->GetMode (
+ UgaDraw,
+ &UgaHorizontalResolution,
+ &UgaVerticalResolution,
+ &UgaColorDepth,
+ &UgaRefreshRate
+ );
+
CurrentGraphicsOutputMode->MaxMode = 1;
Info = CurrentGraphicsOutputMode->Info;
Info->Version = 0;
- Info->HorizontalResolution = 800;
- Info->VerticalResolution = 600;
+ Info->HorizontalResolution = UgaHorizontalResolution;
+ Info->VerticalResolution = UgaVerticalResolution;
Info->PixelFormat = PixelBltOnly;
- Info->PixelsPerScanLine = 800;
+ Info->PixelsPerScanLine = UgaHorizontalResolution;
CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
CurrentGraphicsOutputMode->FrameBufferSize = 0;
@@ -2646,7 +2682,7 @@ Returns: //
// Only mode 0 is available to be set
//
- Index = 0;
+ CurrentIndex = 0;
}
Done:
@@ -2666,7 +2702,20 @@ Done: //
// Current mode number may need update now, so set it to an invalid mode number
//
- Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) Index);
+ CurrentGraphicsOutputMode->Mode = 0xffff;
+ //
+ // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.
+ //
+ Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);
+
+ //
+ // If user defined mode is not valid for UGA, set to the default mode 800x600.
+ //
+ if (EFI_ERROR(Status)) {
+ (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;
+ (Private->GraphicsOutputModeBuffer[0]).VerticalResolution = 600;
+ Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);
+ }
return Status;
}
@@ -2694,6 +2743,10 @@ Returns: UINTN CurrentNumOfConsoles;
INT32 CurrentMode;
INT32 MaxMode;
+ UINT32 UgaHorizontalResolution;
+ UINT32 UgaVerticalResolution;
+ UINT32 UgaColorDepth;
+ UINT32 UgaRefreshRate;
TEXT_OUT_AND_GOP_DATA *TextAndGop;
Status = EFI_SUCCESS;
@@ -2728,12 +2781,12 @@ Returns: if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
//
- // If No UGA device then use the ConOut device
+ // If No GOP/UGA device then use the ConOut device
//
TextAndGop->TextOutEnabled = TRUE;
} else {
//
- // If UGA device use ConOut device only used if UGA screen is in Text mode
+ // If GOP/UGA device use ConOut device only used if screen is in Text mode
//
TextAndGop->TextOutEnabled = (BOOLEAN) (Private->ConsoleOutputMode == EfiConsoleControlScreenText);
}
@@ -2760,15 +2813,50 @@ Returns: MaxMode = Private->TextOutMode.MaxMode;
ASSERT (MaxMode >= 1);
+ //
+ // Update DevNull mode according to current video device
+ //
if (FeaturePcdGet (PcdConOutGopSupport)) {
if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {
ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);
}
}
+ if (FeaturePcdGet (PcdConOutUgaSupport)) {
+ if (UgaDraw != NULL) {
+ Status = UgaDraw->GetMode (
+ UgaDraw,
+ &UgaHorizontalResolution,
+ &UgaVerticalResolution,
+ &UgaColorDepth,
+ &UgaRefreshRate
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = ConSpliterUgaDrawSetMode (
+ &Private->UgaDraw,
+ UgaHorizontalResolution,
+ UgaVerticalResolution,
+ UgaColorDepth,
+ UgaRefreshRate
+ );
+ }
+ //
+ // If GetMode/SetMode is failed, set to 800x600 mode
+ //
+ if(EFI_ERROR (Status)) {
+ Status = ConSpliterUgaDrawSetMode (
+ &Private->UgaDraw,
+ 800,
+ 600,
+ 32,
+ 60
+ );
+ }
+ }
+ }
if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) {
//
- // We just added a new UGA device in graphics mode
+ // We just added a new GOP or UGA device in graphics mode
//
if (FeaturePcdGet (PcdConOutGopSupport)) {
DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);
@@ -2823,14 +2911,12 @@ Returns: if (TextOutList->TextOut == TextOut) {
CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);
CurrentNumOfConsoles--;
- if (FeaturePcdGet (PcdConOutGopSupport)) {
if (TextOutList->UgaDraw != NULL) {
Private->CurrentNumberOfUgaDraw--;
}
if (TextOutList->GraphicsOutput != NULL) {
Private->CurrentNumberOfGraphicsOutput--;
}
- }
break;
}
@@ -4300,6 +4386,8 @@ ConSplitterTextOutQueryMode ( --*/
{
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
+ UINTN CurrentMode;
+ INT32 *TextOutModeMap;
Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
@@ -4315,8 +4403,18 @@ ConSplitterTextOutQueryMode ( return EFI_UNSUPPORTED;
}
- *Columns = Private->TextOutQueryData[ModeNumber].Columns;
- *Rows = Private->TextOutQueryData[ModeNumber].Rows;
+ //
+ // We get the available mode from mode intersection map if it's available
+ //
+ if (Private->TextOutModeMap != NULL) {
+ TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber;
+ CurrentMode = (UINTN)(*TextOutModeMap);
+ *Columns = Private->TextOutQueryData[CurrentMode].Columns;
+ *Rows = Private->TextOutQueryData[CurrentMode].Rows;
+ } else {
+ *Columns = Private->TextOutQueryData[ModeNumber].Columns;
+ *Rows = Private->TextOutQueryData[ModeNumber].Rows;
+ }
if (*Columns <= 0 && *Rows <= 0) {
return EFI_UNSUPPORTED;
@@ -4386,8 +4484,8 @@ ConSplitterTextOutSetMode ( TextOutModeMap[Index]
);
//
- // If this console device is based on a UGA device, then sync up the bitmap from
- // the UGA splitter and reclear the text portion of the display in the new mode.
+ // If this console device is based on a GOP or UGA device, then sync up the bitmap from
+ // the GOP/UGA splitter and reclear the text portion of the display in the new mode.
//
if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);
@@ -4651,3 +4749,4 @@ ConSplitterTextOutEnableCursor ( return ReturnStatus;
}
+
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c index 3f720ac..2c66a44 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c @@ -1350,6 +1350,7 @@ DevNullTextOutSetMode ( --*/
{
UINTN Size;
+ INT32 CurrentMode;
UINTN Row;
UINTN Column;
TEXT_OUT_SPLITTER_QUERY_DATA *Mode;
@@ -1357,8 +1358,14 @@ DevNullTextOutSetMode ( //
// No extra check for ModeNumber here, as it has been checked in
// ConSplitterTextOutSetMode. And mode 0 should always be supported.
+ // Row and Column should be fetched from intersection map.
//
- Mode = &(Private->TextOutQueryData[ModeNumber]);
+ if (Private->TextOutModeMap != NULL) {
+ CurrentMode = *(Private->TextOutModeMap + Private->TextOutListCount * ModeNumber);
+ } else {
+ CurrentMode = (INT32)(ModeNumber);
+ }
+ Mode = &(Private->TextOutQueryData[CurrentMode]);
Row = Mode->Rows;
Column = Mode->Columns;
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index ee96eab..0f83803 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -41,6 +41,14 @@ EraseCursor ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
);
+EFI_STATUS
+CheckModeSupported (
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
+ IN UINT32 HorizontalResolution,
+ IN UINT32 VerticalResolution,
+ OUT UINT32 *CurrentModeNumber
+ );
+
//
// Globals
//
@@ -70,8 +78,9 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = { },
{
{ 80, 25, 0, 0, 0, 0 }, // Mode 0
- { 80, 50, 0, 0, 0, 0 }, // Mode 1
- { 0, 0, 0, 0, 0, 0 } // Mode 2
+ { 80, 50, 0, 0, 0, 0 }, // Mode 1
+ { 100,31, 0, 0, 0, 0 }, // Mode 2
+ { 0, 0, 0, 0, 0, 0 } // Mode 3
},
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
(EFI_HII_HANDLE) 0
@@ -238,22 +247,20 @@ GraphicsConsoleControllerDriverStart ( --*/
{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
+ EFI_STATUS Status;
+ GRAPHICS_CONSOLE_DEV *Private;
EFI_HII_PACKAGES *Package;
EFI_HII_FONT_PACK *FontPack;
- UINTN NarrowFontSize;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINTN MaxMode;
- UINTN Columns;
- UINTN Rows;
- UINT8 *Location;
+ UINTN NarrowFontSize;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ UINTN MaxMode;
+ UINTN Columns;
+ UINTN Rows;
+ UINT8 *Location;
UINT32 ModeNumber;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
ModeNumber = 0;
@@ -336,26 +343,32 @@ GraphicsConsoleControllerDriverStart ( if (Private->GraphicsOutput != NULL) {
//
- // The console is build on top of Graphics Output Protocol, find the mode number for 800x600
+ // The console is build on top of Graphics Output Protocol, find the mode number
+ // for the user-defined mode; if there are multiple video devices,
+ // graphic console driver will set all the video devices to the same mode.
//
- for (ModeNumber = 0; ModeNumber < Private->GraphicsOutput->Mode->MaxMode; ModeNumber++) {
- Status = Private->GraphicsOutput->QueryMode (
- Private->GraphicsOutput,
- ModeNumber,
- &SizeOfInfo,
- &Info
- );
- if (!EFI_ERROR (Status)) {
- if ((Info->HorizontalResolution == 800) &&
- (Info->VerticalResolution == 600)) {
- Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
- if (!EFI_ERROR (Status)) {
- FreePool (Info);
- break;
- }
- }
- FreePool (Info);
- }
+ Status = CheckModeSupported (
+ Private->GraphicsOutput,
+ CURRENT_HORIZONTAL_RESOLUTION,
+ CURRENT_VERTICAL_RESOLUTION,
+ &ModeNumber
+ );
+ if (!EFI_ERROR(Status)) {
+ //
+ // Update default mode to current mode
+ //
+ HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION;
+ VerticalResolution = CURRENT_VERTICAL_RESOLUTION;
+ } else {
+ //
+ // if not supporting current mode, try 800x600 which is required by UEFI/EFI spec
+ //
+ Status = CheckModeSupported (
+ Private->GraphicsOutput,
+ 800,
+ 600,
+ &ModeNumber
+ );
}
if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) {
@@ -368,30 +381,42 @@ GraphicsConsoleControllerDriverStart ( }
} else {
//
- // The console is build on top of UGA Draw Protocol
+ // At first try to set user-defined resolution
//
ColorDepth = 32;
RefreshRate = 60;
Status = Private->UgaDraw->SetMode (
Private->UgaDraw,
- HorizontalResolution,
- VerticalResolution,
+ CURRENT_HORIZONTAL_RESOLUTION,
+ CURRENT_VERTICAL_RESOLUTION,
ColorDepth,
RefreshRate
);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION;
+ VerticalResolution = CURRENT_VERTICAL_RESOLUTION;
+ } else {
//
- // Get the current mode information from the UGA Draw Protocol
+ // Try to set 800*600 which is required by UEFI/EFI spec
//
- Status = Private->UgaDraw->GetMode (
+ Status = Private->UgaDraw->SetMode (
Private->UgaDraw,
- &HorizontalResolution,
- &VerticalResolution,
- &ColorDepth,
- &RefreshRate
+ HorizontalResolution,
+ VerticalResolution,
+ ColorDepth,
+ RefreshRate
);
if (EFI_ERROR (Status)) {
- goto Error;
+ Status = Private->UgaDraw->GetMode (
+ Private->UgaDraw,
+ &HorizontalResolution,
+ &VerticalResolution,
+ &ColorDepth,
+ &RefreshRate
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
}
}
}
@@ -430,31 +455,47 @@ GraphicsConsoleControllerDriverStart ( Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * GLYPH_HEIGHT)) >> 1;
MaxMode++;
}
+
//
- // If the graphics mode is 800x600, than add a text mode that uses the entire display
+ // If it is not to support Mode #1 - 80x50, then skip it
//
- if (HorizontalResolution == 800 && VerticalResolution == 600) {
-
- if (MaxMode < 2) {
- Private->ModeData[MaxMode].Columns = 0;
- Private->ModeData[MaxMode].Rows = 0;
- Private->ModeData[MaxMode].GopWidth = 800;
- Private->ModeData[MaxMode].GopHeight = 600;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = 0;
- Private->ModeData[MaxMode].DeltaY = 0;
- MaxMode++;
- }
+ if (MaxMode < 2) {
+ Private->ModeData[MaxMode].Columns = 0;
+ Private->ModeData[MaxMode].Rows = 0;
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;
+ Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
+ Private->ModeData[MaxMode].DeltaX = 0;
+ Private->ModeData[MaxMode].DeltaY = 0;
+ MaxMode++;
+ }
+
+ //
+ // Add Mode #2 that must be 100x31 (graphic mode >= 800x600)
+ //
+ if (Columns >= 100 && Rows >= 31) {
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;
+ Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
+ Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (100 * GLYPH_WIDTH)) >> 1;
+ Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (31 * GLYPH_HEIGHT)) >> 1;
+ MaxMode++;
+ }
- Private->ModeData[MaxMode].Columns = 800 / GLYPH_WIDTH;
- Private->ModeData[MaxMode].Rows = 600 / GLYPH_HEIGHT;
- Private->ModeData[MaxMode].GopWidth = 800;
- Private->ModeData[MaxMode].GopHeight = 600;
+ //
+ // Add Mode #3 that uses the entire display for user-defined mode
+ //
+ if (HorizontalResolution > 800 && VerticalResolution > 600) {
+ Private->ModeData[MaxMode].Columns = HorizontalResolution/GLYPH_WIDTH;
+ Private->ModeData[MaxMode].Rows = VerticalResolution/GLYPH_HEIGHT;
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (800 % GLYPH_WIDTH) >> 1;
- Private->ModeData[MaxMode].DeltaY = (600 % GLYPH_HEIGHT) >> 1;
+ Private->ModeData[MaxMode].DeltaX = (HorizontalResolution % GLYPH_WIDTH) >> 1;
+ Private->ModeData[MaxMode].DeltaY = (VerticalResolution % GLYPH_HEIGHT) >> 1;
MaxMode++;
}
+
//
// Update the maximum number of modes
//
@@ -588,6 +629,49 @@ GraphicsConsoleControllerDriverStop ( }
EFI_STATUS
+CheckModeSupported (
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
+ IN UINT32 HorizontalResolution,
+ IN UINT32 VerticalResolution,
+ OUT UINT32 *CurrentModeNumber
+ )
+{
+ UINT32 ModeNumber;
+ EFI_STATUS Status;
+ UINTN SizeOfInfo;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+
+ Status = EFI_SUCCESS;
+
+ for (ModeNumber = 0; ModeNumber < GraphicsOutput->Mode->MaxMode; ModeNumber++) {
+ Status = GraphicsOutput->QueryMode (
+ GraphicsOutput,
+ ModeNumber,
+ &SizeOfInfo,
+ &Info
+ );
+ if (!EFI_ERROR (Status)) {
+ if ((Info->HorizontalResolution == HorizontalResolution) &&
+ (Info->VerticalResolution == VerticalResolution)) {
+ Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
+ if (!EFI_ERROR (Status)) {
+ gBS->FreePool (Info);
+ break;
+ }
+ }
+ gBS->FreePool (Info);
+ }
+ }
+
+ if (ModeNumber == GraphicsOutput->Mode->MaxMode) {
+ Status = EFI_UNSUPPORTED;
+ }
+
+ *CurrentModeNumber = ModeNumber;
+ return Status;
+}
+
+EFI_STATUS
EfiLocateHiiProtocol (
VOID
)
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h index 98780f7..f78c22c 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006, Intel Corporation
+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
@@ -177,6 +177,13 @@ GraphicsConsoleComponentNameGetControllerName ( #define GLYPH_WIDTH 8
#define GLYPH_HEIGHT 19
+//
+// 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;
@@ -200,7 +207,7 @@ typedef struct { UINT32 GopModeNumber;
} GRAPHICS_CONSOLE_MODE_DATA;
-#define GRAPHICS_MAX_MODE 3
+#define GRAPHICS_MAX_MODE 4
typedef struct {
UINTN Signature;
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index aaeca12..8a38aa8 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -489,8 +489,30 @@ TerminalDriverBindingStart ( //
// Simple Text Output Protocol
//
+ TerminalDevice->SimpleTextOutput.Reset = TerminalConOutReset;
+ TerminalDevice->SimpleTextOutput.OutputString = TerminalConOutOutputString;
+ TerminalDevice->SimpleTextOutput.TestString = TerminalConOutTestString;
+ TerminalDevice->SimpleTextOutput.QueryMode = TerminalConOutQueryMode;
+ TerminalDevice->SimpleTextOutput.SetMode = TerminalConOutSetMode;
+ TerminalDevice->SimpleTextOutput.SetAttribute = TerminalConOutSetAttribute;
+ TerminalDevice->SimpleTextOutput.ClearScreen = TerminalConOutClearScreen;
+ TerminalDevice->SimpleTextOutput.SetCursorPosition = TerminalConOutSetCursorPosition;
+ TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;
TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;
+ TerminalDevice->SimpleTextOutputMode.MaxMode = 2;
+ //
+ // For terminal devices, cursor is always visible
+ //
+ TerminalDevice->SimpleTextOutputMode.CursorVisible = TRUE;
+ Status = TerminalDevice->SimpleTextOutput.SetAttribute (
+ &TerminalDevice->SimpleTextOutput,
+ EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)
+ );
+ if (EFI_ERROR (Status)) {
+ goto ReportError;
+ }
+
Status = TerminalDevice->SimpleTextOutput.Reset (
&TerminalDevice->SimpleTextOutput,
FALSE
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index b352c66..103adfb 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -143,6 +143,8 @@ typedef union { #define MODE0_COLUMN_COUNT 80
#define MODE0_ROW_COUNT 25
+#define MODE1_COLUMN_COUNT 100
+#define MODE1_ROW_COUNT 31
#define BACKSPACE 8
#define ESC 27
#define CSI 0x9B
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c index 1931c22..74def9e 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c @@ -226,11 +226,11 @@ TerminalConOutOutputString ( TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
//
- // get current display mode
- // Terminal driver only support mode 0
+ // Get current display mode
//
Mode = This->Mode;
- if (Mode->Mode != 0) {
+
+ if (Mode->Mode > 1) {
return EFI_UNSUPPORTED;
}
@@ -464,15 +464,17 @@ TerminalConOutQueryMode ( --*/
{
- if (This->Mode->MaxMode > 1) {
+ if (This->Mode->MaxMode > 2) {
return EFI_DEVICE_ERROR;
}
if (ModeNumber == 0) {
-
*Columns = MODE0_COLUMN_COUNT;
*Rows = MODE0_ROW_COUNT;
-
+ return EFI_SUCCESS;
+ } else if (ModeNumber == 1) {
+ *Columns = MODE1_COLUMN_COUNT;
+ *Rows = MODE1_ROW_COUNT;
return EFI_SUCCESS;
}
@@ -521,11 +523,14 @@ TerminalConOutSetMode ( //
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
- if (ModeNumber != 0) {
+ if (ModeNumber > 1) {
return EFI_UNSUPPORTED;
}
-
- This->Mode->Mode = 0;
+
+ //
+ // Set the current mode
+ //
+ This->Mode->Mode = (INT32) ModeNumber;
This->ClearScreen (This);
@@ -537,7 +542,7 @@ TerminalConOutSetMode ( return EFI_DEVICE_ERROR;
}
- This->Mode->Mode = 0;
+ This->Mode->Mode = (INT32) ModeNumber;
Status = This->ClearScreen (This);
if (EFI_ERROR (Status)) {
|