diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 04c79aff5a..313092c2c9 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -724,7 +724,7 @@ TerminalDriverBindingStart ( ); SimpleTextOutput->Mode = &TerminalDevice->SimpleTextOutputMode; - TerminalDevice->SimpleTextOutputMode.MaxMode = 3; + TerminalDevice->SimpleTextOutputMode.MaxMode = TERMINAL_MAX_MODE; // // For terminal devices, cursor is always visible // diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 8a6e997916..34c1c02f3d 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -143,6 +143,12 @@ typedef union { #define MODE2_COLUMN_COUNT 100 #define MODE2_ROW_COUNT 31 +// +// MODE3 is defined by PcdConOutColumn & PcdConOutRow +// + +#define TERMINAL_MAX_MODE 4 + #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 2f1762f037..8f2675228f 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c @@ -205,7 +205,7 @@ TerminalConOutOutputString ( // Mode = This->Mode; - if (Mode->Mode > 2) { + if (Mode->Mode >= TERMINAL_MAX_MODE) { return EFI_UNSUPPORTED; } @@ -414,7 +414,7 @@ TerminalConOutQueryMode ( OUT UINTN *Rows ) { - if (This->Mode->MaxMode > 3) { + if (This->Mode->MaxMode > TERMINAL_MAX_MODE) { return EFI_DEVICE_ERROR; } @@ -430,6 +430,16 @@ TerminalConOutQueryMode ( *Columns = MODE2_COLUMN_COUNT; *Rows = MODE2_ROW_COUNT; return EFI_SUCCESS; + } else if (ModeNumber == 3) { + *Columns = (UINTN) PcdGet32 (PcdConOutColumn); + if (*Columns == 0) { + *Columns = MODE0_COLUMN_COUNT; + } + *Rows = (UINTN) PcdGet32 (PcdConOutRow); + if (*Rows == 0) { + *Rows = MODE0_ROW_COUNT; + } + return EFI_SUCCESS; } return EFI_UNSUPPORTED; @@ -466,7 +476,7 @@ TerminalConOutSetMode ( // TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); - if (ModeNumber > 2) { + if (ModeNumber >= TERMINAL_MAX_MODE) { return EFI_UNSUPPORTED; } diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf index a20ade2a31..7d67eba81a 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf @@ -44,6 +44,7 @@ [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec [LibraryClasses] DevicePathLib @@ -74,6 +75,8 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow # [Event] # ## @@ -82,3 +85,4 @@ # EVENT_TYPE_RELATIVE_TIMER ## PRODUCES # # +