X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FConsole%2FTerminalDxe%2FTerminalConOut.c;h=8f2675228ff7f3350c4c5681ed2cff4bff764723;hb=f0368006b0d04820a44ae21b0d55ee2d0f5aee3d;hp=daa40d894a77ccf731731c1b8fc04d729d85d9e2;hpb=ab76200c050f3196386dc3637dd58547eef1f519;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c index daa40d894a..8f2675228f 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c @@ -1,8 +1,8 @@ /** @file Implementation for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL protocol. -Copyright (c) 2006 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2010, 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 http://opensource.org/licenses/bsd-license.php @@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // ASCII. The ASCII mapping we just made up. // // -STATIC UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = { +UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = { { BOXDRAW_HORIZONTAL, 0xc4, L'-' }, { BOXDRAW_VERTICAL, 0xb3, L'|' }, { BOXDRAW_DOWN_RIGHT, 0xda, L'/' }, @@ -78,10 +78,10 @@ STATIC UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = { { 0x0000, 0x00, L'\0' } }; -STATIC CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 }; -STATIC CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 }; -STATIC CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 }; -STATIC CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 }; +CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 }; +CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 }; +CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 }; +CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 }; // // Body of the ConOut functions @@ -99,8 +99,8 @@ STATIC CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', exhaustive verification operation of the device during reset. - @return EFI_SUCCESS The reset operation succeeds. - @return EFI_DEVICE_ERROR The terminal is not functioning correctly or the serial port reset fails. + @retval EFI_SUCCESS The reset operation succeeds. + @retval EFI_DEVICE_ERROR The terminal is not functioning correctly or the serial port reset fails. **/ EFI_STATUS @@ -124,7 +124,7 @@ TerminalConOutReset ( // REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_PROGRESS_CODE, - PcdGet32 (PcdStatusCodeValueRemoteConsoleReset), + (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET), TerminalDevice->DevicePath ); @@ -135,7 +135,7 @@ TerminalConOutReset ( // REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_ERROR_CODE | EFI_ERROR_MINOR, - PcdGet32 (PcdStatusCodeValueRemoteConsoleError), + (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR), TerminalDevice->DevicePath ); @@ -193,6 +193,7 @@ TerminalConOutOutputString ( ValidBytes = 0; Warning = FALSE; + AsciiChar = 0; // // get Terminal device data structure pointer. @@ -204,7 +205,7 @@ TerminalConOutOutputString ( // Mode = This->Mode; - if (Mode->Mode > 2) { + if (Mode->Mode >= TERMINAL_MAX_MODE) { return EFI_UNSUPPORTED; } @@ -327,7 +328,7 @@ TerminalConOutOutputString ( OutputError: REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_ERROR_CODE | EFI_ERROR_MINOR, - PcdGet32 (PcdStatusCodeValueRemoteConsoleOutputError), + (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR), TerminalDevice->DevicePath ); @@ -346,8 +347,8 @@ OutputError: @param This Indicates the calling context. @param WString The Null-terminated Unicode string to be tested. - @return EFI_SUCCESS The terminal is capable of rendering the output string. - @return EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered. + @retval EFI_SUCCESS The terminal is capable of rendering the output string. + @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered. **/ EFI_STATUS @@ -399,9 +400,9 @@ TerminalConOutTestString ( @param Columns The returned columns of the requested mode. @param Rows The returned rows of the requested mode. - @return EFI_SUCCESS The requested mode information is returned. - @return EFI_UNSUPPORTED The mode number is not valid. - @return EFI_DEVICE_ERROR + @retval EFI_SUCCESS The requested mode information is returned. + @retval EFI_UNSUPPORTED The mode number is not valid. + @retval EFI_DEVICE_ERROR **/ EFI_STATUS @@ -413,7 +414,7 @@ TerminalConOutQueryMode ( OUT UINTN *Rows ) { - if (This->Mode->MaxMode > 3) { + if (This->Mode->MaxMode > TERMINAL_MAX_MODE) { return EFI_DEVICE_ERROR; } @@ -429,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; @@ -444,10 +455,10 @@ TerminalConOutQueryMode ( @param This Indicates the calling context. @param ModeNumber The text mode to set. - @return EFI_SUCCESS The requested text mode is set. - @return EFI_DEVICE_ERROR The requested text mode cannot be set + @retval EFI_SUCCESS The requested text mode is set. + @retval EFI_DEVICE_ERROR The requested text mode cannot be set because of serial device error. - @return EFI_UNSUPPORTED The text mode number is not valid. + @retval EFI_UNSUPPORTED The text mode number is not valid. **/ EFI_STATUS @@ -465,7 +476,7 @@ TerminalConOutSetMode ( // TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); - if (ModeNumber > 2) { + if (ModeNumber >= TERMINAL_MAX_MODE) { return EFI_UNSUPPORTED; } @@ -503,9 +514,9 @@ TerminalConOutSetMode ( @param Attribute The attribute to set. Only bit0..6 are valid, all other bits are undefined and must be zero. - @return EFI_SUCCESS The requested attribute is set. - @return EFI_DEVICE_ERROR The requested attribute cannot be set due to serial port error. - @return EFI_UNSUPPORTED The attribute requested is not defined by EFI spec. + @retval EFI_SUCCESS The requested attribute is set. + @retval EFI_DEVICE_ERROR The requested attribute cannot be set due to serial port error. + @retval EFI_UNSUPPORTED The attribute requested is not defined by EFI spec. **/ EFI_STATUS @@ -540,7 +551,7 @@ TerminalConOutSetAttribute ( // // Skip outputting the command string for the same attribute - // It improves the terminal performance siginificantly + // It improves the terminal performance significantly // if (This->Mode->Attribute == (INT32) Attribute) { return EFI_SUCCESS; @@ -676,9 +687,9 @@ TerminalConOutSetAttribute ( @param This Indicates the calling context. - @return EFI_SUCCESS The operation completed successfully. - @return EFI_DEVICE_ERROR The terminal screen cannot be cleared due to serial port error. - @return EFI_UNSUPPORTED The terminal is not in a valid display mode. + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The terminal screen cannot be cleared due to serial port error. + @retval EFI_UNSUPPORTED The terminal is not in a valid display mode. **/ EFI_STATUS @@ -716,9 +727,9 @@ TerminalConOutClearScreen ( @param Column The row to set cursor to. @param Row The column to set cursor to. - @return EFI_SUCCESS The operation completed successfully. - @return EFI_DEVICE_ERROR The request fails due to serial port error. - @return EFI_UNSUPPORTED The terminal is not in a valid text mode, or the cursor position + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The request fails due to serial port error. + @retval EFI_UNSUPPORTED The terminal is not in a valid text mode, or the cursor position is invalid for current mode. **/ @@ -794,8 +805,8 @@ TerminalConOutSetCursorPosition ( @param Visible If TRUE, the cursor is set to be visible, If FALSE, the cursor is set to be invisible. - @return EFI_SUCCESS The request is valid. - @return EFI_UNSUPPORTED The terminal does not support cursor hidden. + @retval EFI_SUCCESS The request is valid. + @retval EFI_UNSUPPORTED The terminal does not support cursor hidden. **/ EFI_STATUS @@ -822,7 +833,7 @@ TerminalConOutEnableCursor ( @param Ascii Optional pointer to return ASCII equivalent of Graphic. - @return TRUE If Graphic is a supported Unicode Box Drawing character. + @retval TRUE If Graphic is a supported Unicode Box Drawing character. **/ BOOLEAN