]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
Fix the terminal driver to call hotkey callback even no one is calling ReadKeyStroke
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / TerminalConOut.c
index 06fda61274fa15885136aab4ac28f0adae46f981..8f2675228ff7f3350c4c5681ed2cff4bff764723 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL protocol.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // ASCII. The ASCII mapping we just made up.\r
 //\r
 //\r
-STATIC UNICODE_TO_CHAR  UnicodeToPcAnsiOrAscii[] = {\r
+UNICODE_TO_CHAR  UnicodeToPcAnsiOrAscii[] = {\r
   { BOXDRAW_HORIZONTAL,                 0xc4, L'-' },\r
   { BOXDRAW_VERTICAL,                   0xb3, L'|' },\r
   { BOXDRAW_DOWN_RIGHT,                 0xda, L'/' },\r
@@ -70,10 +70,10 @@ STATIC UNICODE_TO_CHAR  UnicodeToPcAnsiOrAscii[] = {
   { GEOMETRICSHAPE_DOWN_TRIANGLE,       0x1f, L'v' },\r
   { GEOMETRICSHAPE_LEFT_TRIANGLE,       0x11, L'<' },\r
 \r
-  {  ARROW_LEFT,                         0x3c, L'<' },\r
-  {  ARROW_UP,                           0x18, L'^' },\r
-  {  ARROW_RIGHT,                        0x3e, L'>' },\r
-  {  ARROW_DOWN,                         0x19, L'v' },\r
+  { ARROW_LEFT,                         0x3c, L'<' },\r
+  { ARROW_UP,                           0x18, L'^' },\r
+  { ARROW_RIGHT,                        0x3e, L'>' },\r
+  { ARROW_DOWN,                         0x19, L'v' },\r
 \r
   { 0x0000,                             0x00, L'\0' }\r
 };\r
@@ -86,36 +86,29 @@ CHAR16 mSetCursorPositionString[]  = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0
 //\r
 // Body of the ConOut functions\r
 //\r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
+\r
+  If ExtendeVerification is TRUE, then perform dependent serial device reset,\r
+  and set display mode to mode 0.\r
+  If ExtendedVerification is FALSE, only set display mode to mode 0.\r
+\r
+  @param  This                  Indicates the calling context.\r
+  @param  ExtendedVerification  Indicates that the driver may perform a more\r
+                                exhaustive verification operation of the device\r
+                                during reset.\r
+\r
+  @retval EFI_SUCCESS           The reset operation succeeds.\r
+  @retval EFI_DEVICE_ERROR      The terminal is not functioning correctly or the serial port reset fails.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutReset (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,\r
   IN  BOOLEAN                          ExtendedVerification\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
-    If ExtendeVerification is TRUE, then perform dependent serial device reset,\r
-    and set display mode to mode 0.\r
-    If ExtendedVerification is FALSE, only set display mode to mode 0.\r
-\r
-  Arguments:\r
-\r
-    This - Indicates the calling context.\r
-\r
-    ExtendedVerification - Indicates that the driver may perform a more exhaustive\r
-                           verification operation of the device during reset.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-       The reset operation succeeds.\r
-\r
-    EFI_DEVICE_ERROR\r
-      The terminal is not functioning correctly or the serial port reset fails.\r
-\r
---*/\r
 {\r
   EFI_STATUS    Status;\r
   TERMINAL_DEV  *TerminalDevice;\r
@@ -131,7 +124,7 @@ TerminalConOutReset (
     //\r
     REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
       EFI_PROGRESS_CODE,\r
-      PcdGet32 (PcdStatusCodeValueRemoteConsoleReset),\r
+      (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET),\r
       TerminalDevice->DevicePath\r
       );\r
 \r
@@ -142,7 +135,7 @@ TerminalConOutReset (
       //\r
       REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
         EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
-        PcdGet32 (PcdStatusCodeValueRemoteConsoleError),\r
+        (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR),\r
         TerminalDevice->DevicePath\r
         );\r
 \r
@@ -157,42 +150,30 @@ TerminalConOutReset (
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
+\r
+  The Unicode string will be converted to terminal expressible data stream\r
+  and send to terminal via serial port.\r
+\r
+  @param  This                    Indicates the calling context.\r
+  @param  WString                 The Null-terminated Unicode string to be displayed\r
+                                  on the terminal screen.\r
+\r
+  @retval EFI_SUCCESS             The string is output successfully.\r
+  @retval EFI_DEVICE_ERROR        The serial port fails to send the string out.\r
+  @retval EFI_WARN_UNKNOWN_GLYPH  Indicates that some of the characters in the Unicode string could not\r
+                                  be rendered and are skipped.\r
+  @retval EFI_UNSUPPORTED         If current display mode is out of range.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutOutputString (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,\r
   IN  CHAR16                           *WString\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
-    The Unicode string will be converted to terminal expressible data stream\r
-    and send to terminal via serial port.\r
-\r
-\r
-  Arguments:\r
-\r
-    This - Indicates the calling context.\r
-\r
-    WString - The Null-terminated Unicode string to be displayed on\r
-              the terminal screen.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-       The string is output successfully.\r
-\r
-    EFI_DEVICE_ERROR\r
-      The serial port fails to send the string out.\r
-\r
-    EFI_WARN_UNKNOWN_GLYPH\r
-      Indicates that some of the characters in the Unicode string could not\r
-      be rendered and are skipped.\r
-\r
-    EFI_UNSUPPORTED\r
-\r
---*/\r
 {\r
   TERMINAL_DEV                *TerminalDevice;\r
   EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;\r
@@ -212,6 +193,7 @@ TerminalConOutOutputString (
 \r
   ValidBytes  = 0;\r
   Warning     = FALSE;\r
+  AsciiChar   = 0;\r
 \r
   //\r
   //  get Terminal device data structure pointer.\r
@@ -223,7 +205,7 @@ TerminalConOutOutputString (
   //\r
   Mode = This->Mode;\r
 \r
-  if (Mode->Mode > 2) {\r
+  if (Mode->Mode >= TERMINAL_MAX_MODE) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -238,9 +220,9 @@ TerminalConOutOutputString (
 \r
     switch (TerminalDevice->TerminalType) {\r
 \r
-    case PcAnsiType:\r
-    case VT100Type:\r
-    case VT100PlusType:\r
+    case PCANSITYPE:\r
+    case VT100TYPE:\r
+    case VT100PLUSTYPE:\r
 \r
       if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {\r
         //\r
@@ -266,7 +248,7 @@ TerminalConOutOutputString (
 \r
       }\r
 \r
-      if (TerminalDevice->TerminalType != PcAnsiType) {\r
+      if (TerminalDevice->TerminalType != PCANSITYPE) {\r
         GraphicChar = AsciiChar;\r
       }\r
 \r
@@ -284,7 +266,7 @@ TerminalConOutOutputString (
 \r
       break;\r
 \r
-    case VTUTF8Type:\r
+    case VTUTF8TYPE:\r
       UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes);\r
       Length = ValidBytes;\r
       Status = TerminalDevice->SerialIo->Write (\r
@@ -346,44 +328,35 @@ TerminalConOutOutputString (
 OutputError:\r
   REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
     EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
-    PcdGet32 (PcdStatusCodeValueRemoteConsoleOutputError),\r
+    (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR),\r
     TerminalDevice->DevicePath\r
     );\r
 \r
   return EFI_DEVICE_ERROR;\r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
+\r
+  If one of the characters in the *Wstring is\r
+  neither valid Unicode drawing characters,\r
+  not ASCII code, then this function will return\r
+  EFI_UNSUPPORTED.\r
+\r
+  @param  This              Indicates the calling context.\r
+  @param  WString           The Null-terminated Unicode string to be tested.\r
+\r
+  @retval EFI_SUCCESS       The terminal is capable of rendering the output string.\r
+  @retval EFI_UNSUPPORTED   Some of the characters in the Unicode string cannot be rendered.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutTestString (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,\r
   IN  CHAR16                           *WString\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
-    If one of the characters in the *Wstring is\r
-    neither valid Unicode drawing characters,\r
-    not ASCII code, then this function will return\r
-    EFI_UNSUPPORTED.\r
-\r
-\r
-  Arguments:\r
-\r
-    This - Indicates the calling context.\r
-\r
-    WString - The Null-terminated Unicode string to be tested.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-       The terminal is capable of rendering the output string.\r
-\r
-    EFI_UNSUPPORTED\r
-      Some of the characters in the Unicode string cannot be rendered.\r
-\r
---*/\r
 {\r
   TERMINAL_DEV  *TerminalDevice;\r
   EFI_STATUS    Status;\r
@@ -395,13 +368,13 @@ TerminalConOutTestString (
 \r
   switch (TerminalDevice->TerminalType) {\r
 \r
-  case PcAnsiType:\r
-  case VT100Type:\r
-  case VT100PlusType:\r
+  case PCANSITYPE:\r
+  case VT100TYPE:\r
+  case VT100PLUSTYPE:\r
     Status = AnsiTestString (TerminalDevice, WString);\r
     break;\r
 \r
-  case VTUTF8Type:\r
+  case VTUTF8TYPE:\r
     Status = VTUTF8TestString (TerminalDevice, WString);\r
     break;\r
 \r
@@ -413,6 +386,25 @@ TerminalConOutTestString (
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
+\r
+  It returns information for an available text mode\r
+  that the terminal supports.\r
+  In this driver, we support text mode 80x25 (mode 0),\r
+  80x50 (mode 1), 100x31 (mode 2).\r
+\r
+  @param This        Indicates the calling context.\r
+  @param ModeNumber  The mode number to return information on.\r
+  @param Columns     The returned columns of the requested mode.\r
+  @param Rows        The returned rows of the requested mode.\r
+\r
+  @retval EFI_SUCCESS       The requested mode information is returned.\r
+  @retval EFI_UNSUPPORTED   The mode number is not valid.\r
+  @retval EFI_DEVICE_ERROR\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutQueryMode (\r
@@ -421,43 +413,8 @@ TerminalConOutQueryMode (
   OUT UINTN                            *Columns,\r
   OUT UINTN                            *Rows\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.QueryMode().\r
-    It returns information for an available text mode\r
-    that the terminal supports.\r
-    In this driver, we support text mode 80x25 (mode 0),\r
-    80x50 (mode 1), 100x31 (mode 2).\r
-\r
-\r
-  Arguments:\r
-\r
-    *This\r
-        Indicates the calling context.\r
-\r
-    ModeNumber\r
-        The mode number to return information on.\r
-\r
-    Columns\r
-        The returned columns of the requested mode.\r
-\r
-    Rows\r
-        The returned rows of the requested mode.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-      The requested mode information is returned.\r
-\r
-    EFI_UNSUPPORTED\r
-      The mode number is not valid.\r
-\r
-    EFI_DEVICE_ERROR\r
-\r
---*/\r
 {\r
-  if (This->Mode->MaxMode > 3) {\r
+  if (This->Mode->MaxMode > TERMINAL_MAX_MODE) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
@@ -473,44 +430,43 @@ TerminalConOutQueryMode (
     *Columns  = MODE2_COLUMN_COUNT;\r
     *Rows     = MODE2_ROW_COUNT;\r
     return EFI_SUCCESS;\r
+  } else if (ModeNumber == 3) {\r
+    *Columns  = (UINTN) PcdGet32 (PcdConOutColumn);\r
+    if (*Columns == 0) {\r
+      *Columns = MODE0_COLUMN_COUNT;\r
+    }\r
+    *Rows  = (UINTN) PcdGet32 (PcdConOutRow);\r
+    if (*Rows == 0) {\r
+      *Rows     = MODE0_ROW_COUNT;\r
+    }\r
+    return EFI_SUCCESS;\r
   }\r
 \r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUT.SetMode().\r
+\r
+  Set the terminal to a specified display mode.\r
+  In this driver, we only support mode 0.\r
+\r
+  @param This          Indicates the calling context.\r
+  @param ModeNumber    The text mode to set.\r
+\r
+  @retval EFI_SUCCESS       The requested text mode is set.\r
+  @retval EFI_DEVICE_ERROR  The requested text mode cannot be set \r
+                            because of serial device error.\r
+  @retval EFI_UNSUPPORTED   The text mode number is not valid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutSetMode (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,\r
   IN  UINTN                            ModeNumber\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUT.SetMode().\r
-    Set the terminal to a specified display mode.\r
-    In this driver, we only support mode 0.\r
-\r
-  Arguments:\r
-\r
-    This\r
-        Indicates the calling context.\r
-\r
-    ModeNumber\r
-        The text mode to set.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-       The requested text mode is set.\r
-\r
-    EFI_DEVICE_ERROR\r
-      The requested text mode cannot be set because of serial device error.\r
-\r
-    EFI_UNSUPPORTED\r
-      The text mode number is not valid.\r
-\r
---*/\r
 {\r
   EFI_STATUS    Status;\r
   TERMINAL_DEV  *TerminalDevice;\r
@@ -520,7 +476,7 @@ TerminalConOutSetMode (
   //\r
   TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);\r
 \r
-  if (ModeNumber > 2) {\r
+  if (ModeNumber >= TERMINAL_MAX_MODE) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -550,38 +506,25 @@ TerminalConOutSetMode (
 \r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().\r
+\r
+  @param This        Indicates the calling context.\r
+  @param Attribute   The attribute to set. Only bit0..6 are valid, all other bits\r
+                     are undefined and must be zero.\r
+\r
+  @retval EFI_SUCCESS        The requested attribute is set.\r
+  @retval EFI_DEVICE_ERROR   The requested attribute cannot be set due to serial port error.\r
+  @retval EFI_UNSUPPORTED    The attribute requested is not defined by EFI spec.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutSetAttribute (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,\r
   IN  UINTN                            Attribute\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().\r
-\r
-  Arguments:\r
-\r
-    This\r
-        Indicates the calling context.\r
-\r
-    Attribute\r
-        The attribute to set. Only bit0..6 are valid, all other bits\r
-        are undefined and must be zero.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-      The requested attribute is set.\r
-\r
-    EFI_DEVICE_ERROR\r
-      The requested attribute cannot be set due to serial port error.\r
-\r
-    EFI_UNSUPPORTED\r
-      The attribute requested is not defined by EFI spec.\r
-\r
---*/\r
 {\r
   UINT8         ForegroundControl;\r
   UINT8         BackgroundControl;\r
@@ -608,7 +551,7 @@ TerminalConOutSetAttribute (
 \r
   //\r
   // Skip outputting the command string for the same attribute\r
-  // It improves the terminal performance siginificantly\r
+  // It improves the terminal performance significantly\r
   //\r
   if (This->Mode->Attribute == (INT32) Attribute) {\r
     return EFI_SUCCESS;\r
@@ -736,36 +679,24 @@ TerminalConOutSetAttribute (
 \r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().\r
+  It clears the ANSI terminal's display to the\r
+  currently selected background color.\r
+\r
+  @param This     Indicates the calling context.\r
+\r
+  @retval EFI_SUCCESS       The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR  The terminal screen cannot be cleared due to serial port error.\r
+  @retval EFI_UNSUPPORTED   The terminal is not in a valid display mode.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutClearScreen (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().\r
-    It clears the ANSI terminal's display to the\r
-    currently selected background color.\r
-\r
-\r
-  Arguments:\r
-\r
-    This\r
-        Indicates the calling context.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-      The operation completed successfully.\r
-\r
-    EFI_DEVICE_ERROR\r
-      The terminal screen cannot be cleared due to serial port error.\r
-\r
-    EFI_UNSUPPORTED\r
-      The terminal is not in a valid display mode.\r
-\r
---*/\r
 {\r
   EFI_STATUS    Status;\r
   TERMINAL_DEV  *TerminalDevice;\r
@@ -788,6 +719,20 @@ TerminalConOutClearScreen (
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().\r
+\r
+  @param This      Indicates the calling context.\r
+  @param Column    The row to set cursor to.\r
+  @param Row       The column to set cursor to.\r
+\r
+  @retval EFI_SUCCESS       The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR  The request fails due to serial port error.\r
+  @retval EFI_UNSUPPORTED   The terminal is not in a valid text mode, or the cursor position\r
+                            is invalid for current mode.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutSetCursorPosition (\r
@@ -795,35 +740,6 @@ TerminalConOutSetCursorPosition (
   IN  UINTN                            Column,\r
   IN  UINTN                            Row\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().\r
-\r
-  Arguments:\r
-\r
-    This\r
-        Indicates the calling context.\r
-\r
-    Column\r
-        The row to set cursor to.\r
-\r
-    Row\r
-        The column to set cursor to.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-      The operation completed successfully.\r
-\r
-    EFI_DEVICE_ERROR\r
-      The request fails due to serial port error.\r
-\r
-    EFI_UNSUPPORTED\r
-      The terminal is not in a valid text mode, or the cursor position\r
-      is invalid for current mode.\r
-\r
---*/\r
 {\r
   EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;\r
   UINTN                       MaxColumn;\r
@@ -879,36 +795,26 @@ TerminalConOutSetCursorPosition (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
+\r
+  In this driver, the cursor cannot be hidden.\r
+\r
+  @param This      Indicates the calling context.\r
+  @param Visible   If TRUE, the cursor is set to be visible,\r
+                   If FALSE, the cursor is set to be invisible.\r
+\r
+  @retval EFI_SUCCESS      The request is valid.\r
+  @retval EFI_UNSUPPORTED  The terminal does not support cursor hidden.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TerminalConOutEnableCursor (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,\r
   IN  BOOLEAN                          Visible\r
   )\r
-/*++\r
-  Routine Description:\r
-\r
-    Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
-    In this driver, the cursor cannot be hidden.\r
-\r
-  Arguments:\r
-\r
-    This\r
-        Indicates the calling context.\r
-\r
-    Visible\r
-        If TRUE, the cursor is set to be visible,\r
-        If FALSE, the cursor is set to be invisible.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS\r
-      The request is valid.\r
-\r
-    EFI_UNSUPPORTED\r
-      The terminal does not support cursor hidden.\r
-\r
---*/\r
 {\r
   if (!Visible) {\r
     return EFI_UNSUPPORTED;\r
@@ -917,31 +823,25 @@ TerminalConOutEnableCursor (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Detects if a Unicode char is for Box Drawing text graphics.\r
+\r
+  @param  Graphic      Unicode char to test.\r
+  @param  PcAnsi       Optional pointer to return PCANSI equivalent of\r
+                       Graphic.\r
+  @param  Ascii        Optional pointer to return ASCII equivalent of\r
+                       Graphic.\r
+\r
+  @retval TRUE         If Graphic is a supported Unicode Box Drawing character.\r
+\r
+**/\r
 BOOLEAN\r
 TerminalIsValidTextGraphics (\r
   IN  CHAR16  Graphic,\r
   OUT CHAR8   *PcAnsi, OPTIONAL\r
   OUT CHAR8   *Ascii OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-    Detects if a Unicode char is for Box Drawing text graphics.\r
-\r
-Arguments:\r
-\r
-    Graphic  - Unicode char to test.\r
-\r
-    PcAnsi  - Optional pointer to return PCANSI equivalent of Graphic.\r
-\r
-    Ascii   - Optional pointer to return ASCII equivalent of Graphic.\r
-\r
-Returns:\r
-\r
-    TRUE if Graphic is a supported Unicode Box Drawing character.\r
-\r
---*/\r
 {\r
   UNICODE_TO_CHAR *Table;\r
 \r
@@ -970,6 +870,15 @@ Returns:
   return FALSE;\r
 }\r
 \r
+/**\r
+  Detects if a valid ASCII char.\r
+\r
+  @param  Ascii        An ASCII character.\r
+                       \r
+  @retval TRUE         If it is a valid ASCII character.\r
+  @retval FALSE        If it is not a valid ASCII character.\r
+\r
+**/\r
 BOOLEAN\r
 TerminalIsValidAscii (\r
   IN  CHAR16  Ascii\r
@@ -985,6 +894,15 @@ TerminalIsValidAscii (
   return FALSE;\r
 }\r
 \r
+/**\r
+  Detects if a valid EFI control character.\r
+\r
+  @param  CharC        An input EFI Control character.\r
+                       \r
+  @retval TRUE         If it is a valid EFI control character.\r
+  @retval FALSE        If it is not a valid EFI control character.\r
+\r
+**/\r
 BOOLEAN\r
 TerminalIsValidEfiCntlChar (\r
   IN  CHAR16  CharC\r