1. Sync the tracker for supporting the ModeNumber larger than 2.

2. Fixed one bug in SetMode(), Cursor should not be enabled with mandatory.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4594 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2008-01-21 09:40:59 +00:00
parent 0ca3bcbc90
commit 7347d5d6e6
5 changed files with 73 additions and 25 deletions

View File

@ -2152,12 +2152,20 @@ Returns:
Mode = 0; Mode = 0;
Index = 0; Index = 0;
while (Mode < MaxMode) { while (Mode < MaxMode) {
TextOut->QueryMode ( Status = TextOut->QueryMode (
TextOut, TextOut,
Mode, Mode,
&Private->TextOutQueryData[Mode].Columns, &Private->TextOutQueryData[Mode].Columns,
&Private->TextOutQueryData[Mode].Rows &Private->TextOutQueryData[Mode].Rows
); );
//
// If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData
// is clear to 0x0.
//
if ((EFI_ERROR(Status)) && (Mode == 1)) {
Private->TextOutQueryData[Mode].Columns = 0;
Private->TextOutQueryData[Mode].Rows = 0;
}
Private->TextOutModeMap[Index] = Mode; Private->TextOutModeMap[Index] = Mode;
Mode++; Mode++;
Index += Private->TextOutListCount; Index += Private->TextOutListCount;
@ -2166,6 +2174,24 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Reconstruct TextOutModeMap to get intersection of modes
This routine reconstruct TextOutModeMap to get the intersection
of modes for all console out devices. Because EFI/UEFI spec require
mode 0 is 80x25, mode 1 is 80x50, this routine will not check the
intersection for mode 0 and mode 1.
@parm TextOutModeMap Current text out mode map, begin with the mode 80x25
@parm NewlyAddedMap New text out mode map, begin with the mode 80x25
@parm MapStepSize Mode step size for one console device
@parm NewMapStepSize Mode step size for one console device
@parm MaxMode Current max text mode
@parm CurrentMode Current text mode
@retval None
**/
STATIC STATIC
VOID VOID
ConSplitterGetIntersection ( ConSplitterGetIntersection (
@ -2183,9 +2209,16 @@ ConSplitterGetIntersection (
INT32 CurrentMaxMode; INT32 CurrentMaxMode;
INT32 Mode; INT32 Mode;
Index = 0; //
CurrentMapEntry = TextOutModeMap; // According to EFI/UEFI spec, mode 0 and mode 1 have been reserved
NextMapEntry = TextOutModeMap; // for 80x25 and 80x50 in Simple Text Out protocol, so don't make intersection
// for mode 0 and mode 1, mode number starts from 2.
//
Index = 2;
CurrentMapEntry = &TextOutModeMap[MapStepSize * 2];
NextMapEntry = &TextOutModeMap[MapStepSize * 2];
NewlyAddedMap = &NewlyAddedMap[NewMapStepSize * 2];
CurrentMaxMode = *MaxMode; CurrentMaxMode = *MaxMode;
Mode = *CurrentMode; Mode = *CurrentMode;
@ -2248,6 +2281,7 @@ Returns:
UINTN Rows; UINTN Rows;
UINTN Columns; UINTN Columns;
UINTN StepSize; UINTN StepSize;
EFI_STATUS Status;
// //
// Must make sure that current mode won't change even if mode number changes // Must make sure that current mode won't change even if mode number changes
@ -2263,9 +2297,16 @@ Returns:
Mode = 0; Mode = 0;
MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles; MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles;
while (Mode < TextOut->Mode->MaxMode) { while (Mode < TextOut->Mode->MaxMode) {
TextOut->QueryMode (TextOut, Mode, &Columns, &Rows); Status = TextOut->QueryMode (TextOut, Mode, &Columns, &Rows);
if (EFI_ERROR(Status)) {
if (Mode == 1) {
MapTable[StepSize] = Mode; MapTable[StepSize] = Mode;
TextOutQueryData[Mode].Columns = 0;
TextOutQueryData[Mode].Rows = 0;
}
Mode++;
continue;
}
// //
// Search the intersection map and QueryData database to see if they intersects // Search the intersection map and QueryData database to see if they intersects
// //

View File

@ -1157,7 +1157,7 @@ GraphicsConsoleConOutQueryMode (
GRAPHICS_CONSOLE_DEV *Private; GRAPHICS_CONSOLE_DEV *Private;
EFI_STATUS Status; EFI_STATUS Status;
EFI_TPL OldTpl; EFI_TPL OldTpl;
if (ModeNumber >= (UINTN) This->Mode->MaxMode) { if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -1280,10 +1280,10 @@ GraphicsConsoleConOutSetMode (
goto Done; goto Done;
} }
// //
// Otherwise, the size of the text console and/or the UGA mode will be changed, // Otherwise, the size of the text console and/or the GOP/UGA mode will be changed,
// so turn off the cursor, and free the LineBuffer for the current mode // so erase the cursor, and free the LineBuffer for the current mode
// //
This->EnableCursor (This, FALSE); EraseCursor (This);
FreePool (Private->LineBuffer); FreePool (Private->LineBuffer);
} }
@ -1377,7 +1377,6 @@ GraphicsConsoleConOutSetMode (
// 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 displat and enable it
// //
This->SetCursorPosition (This, 0, 0); This->SetCursorPosition (This, 0, 0);
This->EnableCursor (This, TRUE);
Status = EFI_SUCCESS; Status = EFI_SUCCESS;

View File

@ -500,7 +500,7 @@ TerminalDriverBindingStart (
TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor; TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;
TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode; TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;
TerminalDevice->SimpleTextOutputMode.MaxMode = 2; TerminalDevice->SimpleTextOutputMode.MaxMode = 3;
// //
// For terminal devices, cursor is always visible // For terminal devices, cursor is always visible
// //

View File

@ -143,8 +143,12 @@ typedef union {
#define MODE0_COLUMN_COUNT 80 #define MODE0_COLUMN_COUNT 80
#define MODE0_ROW_COUNT 25 #define MODE0_ROW_COUNT 25
#define MODE1_COLUMN_COUNT 100 #define MODE1_COLUMN_COUNT 80
#define MODE1_ROW_COUNT 31 #define MODE1_ROW_COUNT 50
#define MODE2_COLUMN_COUNT 100
#define MODE2_ROW_COUNT 31
#define BACKSPACE 8 #define BACKSPACE 8
#define ESC 27 #define ESC 27
#define CSI 0x9B #define CSI 0x9B

View File

@ -230,7 +230,7 @@ TerminalConOutOutputString (
// //
Mode = This->Mode; Mode = This->Mode;
if (Mode->Mode > 1) { if (Mode->Mode > 2) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -431,11 +431,11 @@ TerminalConOutQueryMode (
/*++ /*++
Routine Description: Routine Description:
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode(). Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.QueryMode().
It returns information for an available text mode It returns information for an available text mode
that the terminal supports. that the terminal supports.
In this driver, we only support text mode 80x25, which is In this driver, we support text mode 80x25 (mode 0),
defined as mode 0. 80x50 (mode 1), 100x31 (mode 2).
Arguments: Arguments:
@ -464,7 +464,7 @@ TerminalConOutQueryMode (
--*/ --*/
{ {
if (This->Mode->MaxMode > 2) { if (This->Mode->MaxMode > 3) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
@ -476,6 +476,10 @@ TerminalConOutQueryMode (
*Columns = MODE1_COLUMN_COUNT; *Columns = MODE1_COLUMN_COUNT;
*Rows = MODE1_ROW_COUNT; *Rows = MODE1_ROW_COUNT;
return EFI_SUCCESS; return EFI_SUCCESS;
} else if (ModeNumber == 2) {
*Columns = MODE2_COLUMN_COUNT;
*Rows = MODE2_ROW_COUNT;
return EFI_SUCCESS;
} }
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
@ -523,7 +527,7 @@ TerminalConOutSetMode (
// //
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
if (ModeNumber > 1) { if (ModeNumber > 2) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }