]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c
fix ECC tool's warning
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConSplitterDxe / ConSplitterGraphics.c
index 28de49c773b1633d511412c85de85dfa2494f182..1a0715e1417e480cbdfe457c27c7f453d3411ba9 100644 (file)
@@ -13,40 +13,39 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
+\r
 **/\r
 \r
 \r
 #include "ConSplitter.h"\r
 \r
 \r
-static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };\r
+CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };\r
+\r
+\r
+/**\r
+  Return the current video mode information. Also returns info about existence\r
+  of Graphics Output devices or UGA Draw devices in system, and whether the Std\r
+  In device is locked. GopUgaExists and StdInLocked parameters are optional, and\r
+  only returned if a non NULL pointer is passed in.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  Mode                    Current video mode.\r
+  @param  GopUgaExists            TRUE if GOP Spliter has found a GOP/UGA device\r
+  @param  StdInLocked             TRUE if StdIn device is keyboard locked\r
 \r
+  @retval EFI_SUCCESS             Video mode information is returned.\r
+  @retval EFI_INVALID_PARAMETER   Invalid parameters if Mode == NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterConsoleControlGetMode (\r
   IN  EFI_CONSOLE_CONTROL_PROTOCOL    *This,\r
   OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,\r
-  OUT BOOLEAN                         *GopExists,\r
+  OUT BOOLEAN                         *GopUgaExists,\r
   OUT BOOLEAN                         *StdInLocked\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Return the current video mode information. Also returns info about existence\r
-    of Graphics Output devices or UGA Draw devices in system, and if the Std In device is locked. All the\r
-    arguments are optional and only returned if a non NULL pointer is passed in.\r
-\r
-  Arguments:\r
-    This - Protocol instance pointer.\r
-    Mode        - Are we in text of grahics mode.\r
-    GopExists   - TRUE if GOP Spliter has found a GOP/UGA device\r
-    StdInLocked - TRUE if StdIn device is keyboard locked\r
-\r
-  Returns:\r
-    EFI_SUCCESS - Mode information returned.\r
-    EFI_INVALID_PARAMETER - Invalid parameters.\r
-\r
---*/\r
 {\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
   UINTN                           Index;\r
@@ -59,11 +58,11 @@ ConSpliterConsoleControlGetMode (
 \r
   *Mode = Private->ConsoleOutputMode;\r
 \r
-  if (GopExists != NULL) {\r
-    *GopExists = FALSE;\r
+  if (GopUgaExists != NULL) {\r
+    *GopUgaExists = FALSE;\r
     for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
       if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {\r
-        *GopExists = TRUE;\r
+        *GopUgaExists = TRUE;\r
         break;\r
       }\r
     }\r
@@ -76,28 +75,25 @@ ConSpliterConsoleControlGetMode (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Set the current mode to either text or graphics. Graphics is\r
+  for Quiet Boot.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  Mode                    Mode to set the\r
+\r
+  @retval EFI_SUCCESS             Mode information returned.\r
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
+  @retval EFI_UNSUPPORTED         Operation unsupported.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterConsoleControlSetMode (\r
   IN  EFI_CONSOLE_CONTROL_PROTOCOL    *This,\r
   IN  EFI_CONSOLE_CONTROL_SCREEN_MODE Mode\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Set the current mode to either text or graphics. Graphics is\r
-    for Quiet Boot.\r
-\r
-  Arguments:\r
-    This  - Protocol instance pointer.\r
-    Mode  - Mode to set the\r
-\r
-  Returns:\r
-    EFI_SUCCESS     - Mode information returned.\r
-    EFI_INVALID_PARAMETER - Invalid parameter.\r
-    EFI_UNSUPPORTED - Operation unsupported.\r
-\r
---*/\r
 {\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
   UINTN                           Index;\r
@@ -154,6 +150,25 @@ ConSpliterConsoleControlSetMode (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  ModeNumber              The mode number to return information on.\r
+  @param  SizeOfInfo              A pointer to the size, in bytes, of the Info\r
+                                  buffer.\r
+  @param  Info                    Caller allocated buffer that returns information\r
+                                  about ModeNumber.\r
+\r
+  @retval EFI_SUCCESS             Mode information returned.\r
+  @retval EFI_BUFFER_TOO_SMALL    The Info buffer was too small.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occurred trying to retrieve the\r
+                                  video mode.\r
+  @retval EFI_NOT_STARTED         Video display is not initialized. Call SetMode ()\r
+  @retval EFI_INVALID_PARAMETER   One of the input args was NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterGraphicsOutputQueryMode (\r
@@ -162,25 +177,6 @@ ConSpliterGraphicsOutputQueryMode (
   OUT UINTN                                 *SizeOfInfo,\r
   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Return the current video mode information.\r
-\r
-  Arguments:\r
-    This                  - Protocol instance pointer.\r
-    ModeNumber            - The mode number to return information on.\r
-    Info                  - Caller allocated buffer that returns information about ModeNumber.\r
-    SizeOfInfo            - A pointer to the size, in bytes, of the Info buffer.\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - Mode information returned.\r
-    EFI_BUFFER_TOO_SMALL  - The Info buffer was too small.\r
-    EFI_DEVICE_ERROR      - A hardware error occurred trying to retrieve the video mode.\r
-    EFI_NOT_STARTED       - Video display is not initialized. Call SetMode ()\r
-    EFI_INVALID_PARAMETER - One of the input args was NULL.\r
-\r
---*/\r
 {\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
 \r
@@ -210,28 +206,25 @@ ConSpliterGraphicsOutputQueryMode (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Graphics output protocol interface to set video mode.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  ModeNumber              The mode number to be set.\r
+\r
+  @retval EFI_SUCCESS             Graphics mode was changed.\r
+  @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
+                                  the request.\r
+  @retval EFI_UNSUPPORTED         ModeNumber is not supported by this device.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterGraphicsOutputSetMode (\r
   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r
   IN  UINT32                       ModeNumber\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Graphics output protocol interface to set video mode\r
-\r
-  Arguments:\r
-    This             - Protocol instance pointer.\r
-    ModeNumber       - The mode number to be set.\r
-\r
-  Returns:\r
-    EFI_SUCCESS      - Graphics mode was changed.\r
-    EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r
-    EFI_UNSUPPORTED  - ModeNumber is not supported by this device.\r
-\r
---*/\r
 {\r
   EFI_STATUS                             Status;\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA         *Private;\r
@@ -255,9 +248,6 @@ Routine Description:
 \r
   Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
 \r
-  //\r
-  // GopDevNullSetMode ()\r
-  //\r
   ReturnStatus = EFI_SUCCESS;\r
 \r
   //\r
@@ -338,7 +328,52 @@ Routine Description:
   return ReturnStatus;\r
 }\r
 \r
-STATIC\r
+/**\r
+  The following table defines actions for BltOperations.\r
+\r
+  EfiBltVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
+  directly to every pixel of the video display rectangle\r
+  (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+  EfiBltVideoToBltBuffer - Read data from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+  the BltBuffer rectangle (DestinationX, DestinationY )\r
+  (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+  DestinationY is not zero then Delta must be set to the length in bytes\r
+  of a row in the BltBuffer.\r
+  EfiBltBufferToVideo - Write data from the  BltBuffer rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+  video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+  not zero then Delta must be set to the length in bytes of a row in the\r
+  BltBuffer.\r
+  EfiBltVideoToVideo - Copy from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+  to the video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  Private                 Protocol instance pointer.\r
+  @param  BltBuffer               Buffer containing data to blit into video buffer.\r
+                                  This buffer has a size of\r
+                                  Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
+  @param  BltOperation            Operation to perform on BlitBuffer and video\r
+                                  memory\r
+  @param  SourceX                 X coordinate of source for the BltBuffer.\r
+  @param  SourceY                 Y coordinate of source for the BltBuffer.\r
+  @param  DestinationX            X coordinate of destination for the BltBuffer.\r
+  @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
+  @param  Width                   Width of rectangle in BltBuffer in pixels.\r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels. \r
+  @param  Delta                   OPTIONAL.\r
+\r
+  @retval EFI_SUCCESS             The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video\r
+                                  buffer.\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullGraphicsOutputBlt (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA                *Private,\r
@@ -393,7 +428,7 @@ DevNullGraphicsOutputBlt (
 \r
     BltPtr    = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
     ScreenPtr = &Private->GraphicsOutputBlt[SourceY * HorizontalResolution + SourceX];\r
-    while (Height) {\r
+    while (Height > 0) {\r
       CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
       BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltPtr + Delta);\r
       ScreenPtr += HorizontalResolution;\r
@@ -456,6 +491,53 @@ DevNullGraphicsOutputBlt (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  The following table defines actions for BltOperations.\r
+\r
+  EfiBltVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
+  directly to every pixel of the video display rectangle\r
+  (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+  EfiBltVideoToBltBuffer - Read data from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+  the BltBuffer rectangle (DestinationX, DestinationY )\r
+  (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+  DestinationY is not zero then Delta must be set to the length in bytes\r
+  of a row in the BltBuffer.\r
+  EfiBltBufferToVideo - Write data from the  BltBuffer rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+  video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+  not zero then Delta must be set to the length in bytes of a row in the\r
+  BltBuffer.\r
+  EfiBltVideoToVideo - Copy from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+  to the video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  BltBuffer               Buffer containing data to blit into video buffer.\r
+                                  This buffer has a size of\r
+                                  Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
+  @param  BltOperation            Operation to perform on BlitBuffer and video\r
+                                  memory\r
+  @param  SourceX                 X coordinate of source for the BltBuffer.\r
+  @param  SourceY                 Y coordinate of source for the BltBuffer.\r
+  @param  DestinationX            X coordinate of destination for the BltBuffer.\r
+  @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
+  @param  Width                   Width of rectangle in BltBuffer in pixels.\r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels. \r
+  @param  Delta                   OPTIONAL.\r
+\r
+  @retval EFI_SUCCESS             The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video\r
+                                  buffer.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterGraphicsOutputBlt (\r
@@ -470,53 +552,6 @@ ConSpliterGraphicsOutputBlt (
   IN  UINTN                                         Height,\r
   IN  UINTN                                         Delta         OPTIONAL\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    The following table defines actions for BltOperations:\r
-    EfiBltVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
-      directly to every pixel of the video display rectangle\r
-      (DestinationX, DestinationY)\r
-      (DestinationX + Width, DestinationY + Height).\r
-      Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
-    EfiBltVideoToBltBuffer - Read data from the video display rectangle\r
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
-      the BltBuffer rectangle (DestinationX, DestinationY )\r
-      (DestinationX + Width, DestinationY + Height). If DestinationX or\r
-      DestinationY is not zero then Delta must be set to the length in bytes\r
-      of a row in the BltBuffer.\r
-    EfiBltBufferToVideo - Write data from the  BltBuffer rectangle\r
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
-      video display rectangle (DestinationX, DestinationY)\r
-      (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
-      not zero then Delta must be set to the length in bytes of a row in the\r
-      BltBuffer.\r
-    EfiBltVideoToVideo - Copy from the video display rectangle\r
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
-      to the video display rectangle (DestinationX, DestinationY)\r
-      (DestinationX + Width, DestinationY + Height).\r
-     The BltBuffer and Delta  are not used in this mode.\r
-\r
-  Arguments:\r
-    This          - Protocol instance pointer.\r
-    BltBuffer     - Buffer containing data to blit into video buffer. This\r
-                    buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
-    BltOperation  - Operation to perform on BlitBuffer and video memory\r
-    SourceX       - X coordinate of source for the BltBuffer.\r
-    SourceY       - Y coordinate of source for the BltBuffer.\r
-    DestinationX  - X coordinate of destination for the BltBuffer.\r
-    DestinationY  - Y coordinate of destination for the BltBuffer.\r
-    Width         - Width of rectangle in BltBuffer in pixels.\r
-    Height        - Hight of rectangle in BltBuffer in pixels.\r
-    Delta         -\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - The Blt operation completed.\r
-    EFI_INVALID_PARAMETER - BltOperation is not valid.\r
-    EFI_DEVICE_ERROR      - A hardware error occured writting to the video\r
-                             buffer.\r
-\r
---*/\r
 {\r
   EFI_STATUS                      Status;\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
@@ -602,6 +637,20 @@ ConSpliterGraphicsOutputBlt (
   return ReturnStatus;\r
 }\r
 \r
+/**\r
+  Write data from the buffer to video display based on Graphics Output setting. \r
+\r
+  @param  Private                 Consplitter Text Out pointer.\r
+  @param  GraphicsOutput          Graphics Output protocol pointer.\r
+  @param  UgaDraw                 UGA Draw protocol pointer.\r
+\r
+  @retval EFI_UNSUPPORTED         No graphics devcie available .\r
+  @retval EFI_SUCCESS             The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video buffer.\r
+                 \r
+\r
+**/\r
 EFI_STATUS\r
 DevNullGopSync (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
@@ -640,6 +689,21 @@ DevNullGopSync (
   }\r
 }\r
 \r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  HorizontalResolution    Current video horizontal resolution in pixels\r
+  @param  VerticalResolution      Current video vertical resolution in pixels\r
+  @param  ColorDepth              Current video color depth in bits per pixel\r
+  @param  RefreshRate             Current video refresh rate in Hz.\r
+\r
+  @retval EFI_SUCCESS             Mode information returned.\r
+  @retval EFI_NOT_STARTED         Video display is not initialized. Call SetMode ()\r
+  @retval EFI_INVALID_PARAMETER   One of the input args was NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterUgaDrawGetMode (\r
@@ -649,28 +713,13 @@ ConSpliterUgaDrawGetMode (
   OUT UINT32                          *ColorDepth,\r
   OUT UINT32                          *RefreshRate\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Return the current video mode information.\r
-\r
-  Arguments:\r
-    This                  - Protocol instance pointer.\r
-    HorizontalResolution  - Current video horizontal resolution in pixels\r
-    VerticalResolution    - Current video vertical resolution in pixels\r
-    ColorDepth            - Current video color depth in bits per pixel\r
-    RefreshRate           - Current video refresh rate in Hz.\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - Mode information returned.\r
-    EFI_NOT_STARTED       - Video display is not initialized. Call SetMode ()\r
-    EFI_INVALID_PARAMETER - One of the input args was NULL.\r
-\r
---*/\r
 {\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
 \r
-  if (!(HorizontalResolution && VerticalResolution && RefreshRate && ColorDepth)) {\r
+  if ((HorizontalResolution == NULL) ||\r
+         (VerticalResolution   == NULL) ||\r
+         (RefreshRate          == NULL) ||\r
+         (ColorDepth           == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   //\r
@@ -686,6 +735,21 @@ ConSpliterUgaDrawGetMode (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  HorizontalResolution    Current video horizontal resolution in pixels\r
+  @param  VerticalResolution      Current video vertical resolution in pixels\r
+  @param  ColorDepth              Current video color depth in bits per pixel\r
+  @param  RefreshRate             Current video refresh rate in Hz.\r
+\r
+  @retval EFI_SUCCESS             Mode information returned.\r
+  @retval EFI_NOT_STARTED         Video display is not initialized. Call SetMode ()\r
+  @retval EFI_OUT_OF_RESOURCES    Out of resources.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterUgaDrawSetMode (\r
@@ -695,24 +759,6 @@ ConSpliterUgaDrawSetMode (
   IN UINT32                           ColorDepth,\r
   IN UINT32                           RefreshRate\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Return the current video mode information.\r
-\r
-  Arguments:\r
-    This                  - Protocol instance pointer.\r
-    HorizontalResolution  - Current video horizontal resolution in pixels\r
-    VerticalResolution    - Current video vertical resolution in pixels\r
-    ColorDepth            - Current video color depth in bits per pixel\r
-    RefreshRate           - Current video refresh rate in Hz.\r
-\r
-  Returns:\r
-    EFI_SUCCESS     - Mode information returned.\r
-    EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
-    EFI_OUT_OF_RESOURCES - Out of resources.\r
-\r
---*/\r
 {\r
   EFI_STATUS                             Status;\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA         *Private;\r
@@ -811,6 +857,52 @@ ConSpliterUgaDrawSetMode (
   return ReturnStatus;\r
 }\r
 \r
+/**\r
+  The following table defines actions for BltOperations.\r
+\r
+  EfiBltVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
+  directly to every pixel of the video display rectangle\r
+  (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+  EfiBltVideoToBltBuffer - Read data from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+  the BltBuffer rectangle (DestinationX, DestinationY )\r
+  (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+  DestinationY is not zero then Delta must be set to the length in bytes\r
+  of a row in the BltBuffer.\r
+  EfiBltBufferToVideo - Write data from the  BltBuffer rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+  video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+  not zero then Delta must be set to the length in bytes of a row in the\r
+  BltBuffer.\r
+  EfiBltVideoToVideo - Copy from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+  to the video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  Private                 Protocol instance pointer.\r
+  @param  BltBuffer               Buffer containing data to blit into video buffer.\r
+                                  This buffer has a size of\r
+                                  Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
+  @param  BltOperation            Operation to perform on BlitBuffer and video\r
+                                  memory\r
+  @param  SourceX                 X coordinate of source for the BltBuffer.\r
+  @param  SourceY                 Y coordinate of source for the BltBuffer.\r
+  @param  DestinationX            X coordinate of destination for the BltBuffer.\r
+  @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
+  @param  Width                   Width of rectangle in BltBuffer in pixels.\r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels. \r
+  @param  Delta                   OPTIONAL.\r
+\r
+  @retval EFI_SUCCESS             The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video\r
+                                  buffer.\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullUgaBlt (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA                *Private,\r
@@ -865,7 +957,7 @@ DevNullUgaBlt (
 \r
     BltPtr    = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_UGA_PIXEL));\r
     ScreenPtr = &Private->UgaBlt[SourceY * HorizontalResolution + SourceX];\r
-    while (Height) {\r
+    while (Height > 0) {\r
       CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_UGA_PIXEL));\r
       BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltPtr + Delta);\r
       ScreenPtr += HorizontalResolution;\r
@@ -928,6 +1020,53 @@ DevNullUgaBlt (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  The following table defines actions for BltOperations.\r
+\r
+  EfiUgaVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
+  directly to every pixel of the video display rectangle\r
+  (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+  EfiUgaVideoToBltBuffer - Read data from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+  the BltBuffer rectangle (DestinationX, DestinationY )\r
+  (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+  DestinationY is not zero then Delta must be set to the length in bytes\r
+  of a row in the BltBuffer.\r
+  EfiUgaBltBufferToVideo - Write data from the  BltBuffer rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+  video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+  not zero then Delta must be set to the length in bytes of a row in the\r
+  BltBuffer.\r
+  EfiUgaVideoToVideo - Copy from the video display rectangle\r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+  to the video display rectangle (DestinationX, DestinationY)\r
+  (DestinationX + Width, DestinationY + Height).\r
+  The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  This                    Protocol instance pointer.\r
+  @param  BltBuffer               Buffer containing data to blit into video buffer.\r
+                                  This buffer has a size of\r
+                                  Width*Height*sizeof(EFI_UGA_PIXEL)\r
+  @param  BltOperation            Operation to perform on BlitBuffer and video\r
+                                  memory\r
+  @param  SourceX                 X coordinate of source for the BltBuffer.\r
+  @param  SourceY                 Y coordinate of source for the BltBuffer.\r
+  @param  DestinationX            X coordinate of destination for the BltBuffer.\r
+  @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
+  @param  Width                   Width of rectangle in BltBuffer in pixels.\r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels.\r
+  @param  Delta                   OPTIONAL.\r
+\r
+  @retval EFI_SUCCESS             The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video\r
+                                  buffer.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterUgaDrawBlt (\r
@@ -942,53 +1081,6 @@ ConSpliterUgaDrawBlt (
   IN  UINTN                                         Height,\r
   IN  UINTN                                         Delta         OPTIONAL\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    The following table defines actions for BltOperations:\r
-    EfiUgaVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
-      directly to every pixel of the video display rectangle\r
-      (DestinationX, DestinationY)\r
-      (DestinationX + Width, DestinationY + Height).\r
-      Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
-    EfiUgaVideoToBltBuffer - Read data from the video display rectangle\r
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
-      the BltBuffer rectangle (DestinationX, DestinationY )\r
-      (DestinationX + Width, DestinationY + Height). If DestinationX or\r
-      DestinationY is not zero then Delta must be set to the length in bytes\r
-      of a row in the BltBuffer.\r
-    EfiUgaBltBufferToVideo - Write data from the  BltBuffer rectangle\r
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
-      video display rectangle (DestinationX, DestinationY)\r
-      (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
-      not zero then Delta must be set to the length in bytes of a row in the\r
-      BltBuffer.\r
-    EfiUgaVideoToVideo - Copy from the video display rectangle\r
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
-      to the video display rectangle (DestinationX, DestinationY)\r
-      (DestinationX + Width, DestinationY + Height).\r
-     The BltBuffer and Delta  are not used in this mode.\r
-\r
-  Arguments:\r
-    This          - Protocol instance pointer.\r
-    BltBuffer     - Buffer containing data to blit into video buffer. This\r
-                    buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
-    BltOperation  - Operation to perform on BlitBuffer and video memory\r
-    SourceX       - X coordinate of source for the BltBuffer.\r
-    SourceY       - Y coordinate of source for the BltBuffer.\r
-    DestinationX  - X coordinate of destination for the BltBuffer.\r
-    DestinationY  - Y coordinate of destination for the BltBuffer.\r
-    Width         - Width of rectangle in BltBuffer in pixels.\r
-    Height        - Hight of rectangle in BltBuffer in pixels.\r
-    Delta         -\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - The Blt operation completed.\r
-    EFI_INVALID_PARAMETER - BltOperation is not valid.\r
-    EFI_DEVICE_ERROR      - A hardware error occured writting to the video\r
-                             buffer.\r
-\r
---*/\r
 {\r
   EFI_STATUS                      Status;\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
@@ -1071,6 +1163,19 @@ ConSpliterUgaDrawBlt (
   return ReturnStatus;\r
 }\r
 \r
+/**\r
+  Write data from the buffer to video display based on UGA Draw setting. \r
+\r
+  @param  Private                 Consplitter Text Out pointer.\r
+  @param  GraphicsOutput          Graphics Output protocol pointer.\r
+  @param  UgaDraw                 UGA Draw protocol pointer.\r
+\r
+  @retval EFI_UNSUPPORTED         No graphics devcie available .\r
+  @retval EFI_SUCCESS             The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video buffer.\r
+                  \r
+**/\r
 EFI_STATUS\r
 DevNullUgaSync (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
@@ -1109,34 +1214,32 @@ DevNullUgaSync (
   }\r
 }\r
 \r
+\r
+/**\r
+  Write a Unicode string to the output device.\r
+\r
+  @param  Private                 Pointer to the console output splitter's private\r
+                                  data. It indicates the calling context.\r
+  @param  WString                 The NULL-terminated Unicode string to be\r
+                                  displayed on the output device(s). All output\r
+                                  devices must also support the Unicode drawing\r
+                                  defined in this file.\r
+\r
+  @retval EFI_SUCCESS             The string was output to the device.\r
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting to\r
+                                  output the text.\r
+  @retval EFI_UNSUPPORTED         The output device's mode is not currently in a\r
+                                  defined text mode.\r
+  @retval EFI_WARN_UNKNOWN_GLYPH  This warning code indicates that some of the\r
+                                  characters in the Unicode string could not be\r
+                                  rendered and were skipped.\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullTextOutOutputString (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
   IN  CHAR16                          *WString\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Write a Unicode string to the output device.\r
-\r
-  Arguments:\r
-    Private - Pointer to the console output splitter's private data. It\r
-              indicates the calling context.\r
-    WString - The NULL-terminated Unicode string to be displayed on the output\r
-              device(s). All output devices must also support the Unicode\r
-              drawing defined in this file.\r
-\r
-  Returns:\r
-    EFI_SUCCESS            - The string was output to the device.\r
-    EFI_DEVICE_ERROR       - The device reported an error while attempting to\r
-                              output the text.\r
-    EFI_UNSUPPORTED        - The output device's mode is not currently in a\r
-                              defined text mode.\r
-    EFI_WARN_UNKNOWN_GLYPH - This warning code indicates that some of the\r
-                              characters in the Unicode string could not be\r
-                              rendered and were skipped.\r
-\r
---*/\r
 {\r
   UINTN                       SizeScreen;\r
   UINTN                       SizeAttribute;\r
@@ -1165,7 +1268,7 @@ DevNullTextOutOutputString (
     CurrentWidth = 1;\r
   }\r
 \r
-  while (*WString) {\r
+  while (*WString != L'\0') {\r
 \r
     if (*WString == CHAR_BACKSPACE) {\r
       //\r
@@ -1193,7 +1296,7 @@ DevNullTextOutOutputString (
           //\r
           InsertChar  = CHAR_BACKSPACE;\r
           PStr        = WString + 1;\r
-          while (*PStr) {\r
+          while (*PStr != L'\0') {\r
             TempChar    = *PStr;\r
             *PStr       = InsertChar;\r
             InsertChar  = TempChar;\r
@@ -1244,7 +1347,7 @@ DevNullTextOutOutputString (
         Attribute = NullAttributes + SizeAttribute;\r
 \r
         for (Index = 0; Index < MaxColumn; Index++, Screen++, Attribute++) {\r
-          *Screen     = ' ';\r
+          *Screen     = L' ';\r
           *Attribute  = Mode->Attribute;\r
         }\r
       } else {\r
@@ -1329,28 +1432,25 @@ DevNullTextOutOutputString (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Sets the output device(s) to a specified mode.\r
+\r
+  @param  Private                 Private data structure pointer.\r
+  @param  ModeNumber              The mode number to set.\r
+\r
+  @retval EFI_SUCCESS             The requested text mode was set.\r
+  @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
+                                  the request.\r
+  @retval EFI_UNSUPPORTED         The mode number was not valid.\r
+  @retval EFI_OUT_OF_RESOURCES    Out of resources.\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullTextOutSetMode (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
   IN  UINTN                           ModeNumber\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Sets the output device(s) to a specified mode.\r
-\r
-  Arguments:\r
-    Private    - Private data structure pointer.\r
-    ModeNumber - The mode number to set.\r
-\r
-  Returns:\r
-    EFI_SUCCESS      - The requested text mode was set.\r
-    EFI_DEVICE_ERROR - The device had an error and\r
-                       could not complete the request.\r
-    EFI_UNSUPPORTED - The mode number was not valid.\r
-    EFI_OUT_OF_RESOURCES - Out of resources.\r
-\r
---*/\r
 {\r
   UINTN                         Size;\r
   INT32                         CurrentMode;\r
@@ -1366,7 +1466,7 @@ DevNullTextOutSetMode (
   if (Private->TextOutModeMap != NULL) {\r
     CurrentMode = *(Private->TextOutModeMap + Private->TextOutListCount * ModeNumber);\r
   } else {\r
-    CurrentMode = (INT32)(ModeNumber);\r
+    CurrentMode = (INT32) (ModeNumber);\r
   }\r
   Mode    = &(Private->TextOutQueryData[CurrentMode]);\r
   Row     = Mode->Rows;\r
@@ -1408,26 +1508,23 @@ DevNullTextOutSetMode (
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-DevNullTextOutClearScreen (\r
-  IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private\r
-  )\r
-/*++\r
 \r
-  Routine Description:\r
-    Clears the output device(s) display to the currently selected background\r
-    color.\r
+/**\r
+  Clears the output device(s) display to the currently selected background\r
+  color.\r
 \r
-  Arguments:\r
-    Private     - Protocol instance pointer.\r
+  @param  Private                 Protocol instance pointer.\r
 \r
-  Returns:\r
-    EFI_SUCCESS      - The operation completed successfully.\r
-    EFI_DEVICE_ERROR - The device had an error and\r
-                       could not complete the request.\r
-    EFI_UNSUPPORTED - The output device is not in a valid text mode.\r
+  @retval EFI_SUCCESS             The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
+                                  the request.\r
+  @retval EFI_UNSUPPORTED         The output device is not in a valid text mode.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+DevNullTextOutClearScreen (\r
+  IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private\r
+  )\r
 {\r
   UINTN   Row;\r
   UINTN   Column;\r
@@ -1446,7 +1543,7 @@ DevNullTextOutClearScreen (
 \r
   for (Row = 0; Row < Private->DevNullRows; Row++) {\r
     for (Column = 0; Column < Private->DevNullColumns; Column++, Screen++, Attributes++) {\r
-      *Screen     = ' ';\r
+      *Screen     = L' ';\r
       *Attributes = CurrentAttribute;\r
     }\r
     //\r
@@ -1460,31 +1557,30 @@ DevNullTextOutClearScreen (
   return DevNullTextOutEnableCursor (Private, TRUE);\r
 }\r
 \r
+\r
+/**\r
+  Sets the current coordinates of the cursor position.\r
+\r
+  @param  Private                 Protocol instance pointer.\r
+  @param  Column                  \r
+  @param  Row                     the position to set the cursor to. Must be\r
+                                  greater than or equal to zero and less than the\r
+                                  number of columns and rows by QueryMode ().\r
+\r
+  @retval EFI_SUCCESS             The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
+                                  the request.\r
+  @retval EFI_UNSUPPORTED         The output device is not in a valid text mode, or\r
+                                  the cursor position is invalid for the current\r
+                                  mode.\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullTextOutSetCursorPosition (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
   IN  UINTN                           Column,\r
   IN  UINTN                           Row\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Sets the current coordinates of the cursor position\r
-\r
-  Arguments:\r
-    Private       - Protocol instance pointer.\r
-    Column, Row - the position to set the cursor to. Must be greater than or\r
-                  equal to zero and less than the number of columns and rows\r
-                  by QueryMode ().\r
-\r
-  Returns:\r
-    EFI_SUCCESS      - The operation completed successfully.\r
-    EFI_DEVICE_ERROR - The device had an error and\r
-                       could not complete the request.\r
-    EFI_UNSUPPORTED - The output device is not in a valid text mode, or the\r
-                       cursor position is invalid for the current mode.\r
-\r
---*/\r
 {\r
   //\r
   // No need to do extra check here as whether (Column, Row) is valid has\r
@@ -1497,53 +1593,44 @@ DevNullTextOutSetCursorPosition (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
+  In this driver, the cursor cannot be hidden.\r
+\r
+  @param  Private                 Indicates the calling context.\r
+  @param  Visible                 If TRUE, the cursor is set to be visible, If\r
+                                  FALSE, the cursor is set to be invisible.\r
+\r
+  @retval EFI_SUCCESS             The request is valid.\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullTextOutEnableCursor (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\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
-    Private - Indicates the calling context.\r
-\r
-    Visible - If TRUE, the cursor is set to be visible, If FALSE, the cursor\r
-              is set to be invisible.\r
-\r
-  Returns:\r
-\r
-    EFI_SUCCESS - The request is valid.\r
-\r
-\r
---*/\r
 {\r
   Private->TextOutMode.CursorVisible = Visible;\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Take the DevNull TextOut device and update the Simple Text Out on every\r
+  UGA device.\r
+\r
+  @param  Private                 Indicates the calling context.\r
+\r
+  @retval EFI_SUCCESS             The request is valid.\r
+  @retval other                   Return status of TextOut->OutputString ()\r
+\r
+**/\r
 EFI_STATUS\r
 DevNullSyncStdOut (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private\r
   )\r
-/*++\r
-  Routine Description:\r
-    Take the DevNull TextOut device and update the Simple Text Out on every\r
-    UGA device.\r
-\r
-  Arguments:\r
-    Private - Indicates the calling context.\r
-\r
-  Returns:\r
-    EFI_SUCCESS - The request is valid.\r
-    other       - Return status of TextOut->OutputString ()\r
-\r
---*/\r
 {\r
   EFI_STATUS                       Status;\r
   EFI_STATUS                       ReturnStatus;\r
@@ -1607,7 +1694,7 @@ DevNullSyncStdOut (
 \r
     Column = 0;\r
     while (Column < MaxColumn) {\r
-      if (Screen[Column]) {\r
+      if (Screen[Column] > 0) {\r
         CurrentAttribute  = Attributes[Column];\r
         CurrentColumn     = Column;\r
         ScreenStart       = &Screen[Column];\r
@@ -1625,7 +1712,7 @@ DevNullSyncStdOut (
 \r
           *BufferTail = *Str;\r
           BufferTail++;\r
-          if (Attributes[Column] & EFI_WIDE_ATTRIBUTE) {\r
+          if ((Attributes[Column] & EFI_WIDE_ATTRIBUTE) != 0) {\r
             Str++;\r
             Column++;\r
           }\r