]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. code scrub for ConSplitterDxe.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Dec 2008 00:15:20 +0000 (00:15 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Dec 2008 00:15:20 +0000 (00:15 +0000)
2. fixed some bugs when thunking UGA based on GOP.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7107 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c

index b61f7bdc280bc5e689bf816ea80081cf659189c6..cb993d7b6694cb5c689610d0976d6304acd8f2a7 100644 (file)
@@ -410,7 +410,7 @@ ConSplitterDriverEntry(
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
-  // One of Either Graphics Output protocol and UGA Draw protocol must be supported.\r
+  // Either Graphics Output protocol or UGA Draw protocol must be supported.\r
   //\r
   ASSERT (FeaturePcdGet (PcdConOutGopSupport) ||\r
           FeaturePcdGet (PcdConOutUgaSupport));\r
@@ -1269,10 +1269,12 @@ ConSplitterConOutDriverBindingStart (
   IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath\r
   )\r
 {\r
-  EFI_STATUS                       Status;\r
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *TextOut;\r
-  EFI_GRAPHICS_OUTPUT_PROTOCOL     *GraphicsOutput;\r
-  EFI_UGA_DRAW_PROTOCOL            *UgaDraw;\r
+  EFI_STATUS                           Status;\r
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL      *TextOut;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL         *GraphicsOutput;\r
+  EFI_UGA_DRAW_PROTOCOL                *UgaDraw;\r
+  UINTN                                SizeOfInfo;\r
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
 \r
   //\r
   // Start ConSplitter on ControllerHandle, and create the virtual\r
@@ -1308,14 +1310,14 @@ ConSplitterConOutDriverBindingStart (
     //\r
     // Open UGA DRAW protocol\r
     //\r
-    Status = gBS->OpenProtocol (\r
-                    ControllerHandle,\r
-                    &gEfiUgaDrawProtocolGuid,\r
-                    (VOID **) &UgaDraw,\r
-                    This->DriverBindingHandle,\r
-                    mConOut.VirtualHandle,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
+    gBS->OpenProtocol (\r
+           ControllerHandle,\r
+           &gEfiUgaDrawProtocolGuid,\r
+           (VOID **) &UgaDraw,\r
+           This->DriverBindingHandle,\r
+           mConOut.VirtualHandle,\r
+           EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+           );\r
   }\r
 \r
   //\r
@@ -1331,12 +1333,26 @@ ConSplitterConOutDriverBindingStart (
   Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);\r
   ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
 \r
-  if (FeaturePcdGet (PcdConOutUgaSupport) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+  if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
     //\r
-    // Match the UGA mode data of ConOut with the current mode\r
+    // Get the UGA mode data of ConOut from the current mode\r
     //\r
-    if (UgaDraw != NULL) {\r
-      UgaDraw->GetMode (\r
+    if (GraphicsOutput != NULL) {\r
+      Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info);\r
+      if (EFI_ERROR (Status)) {\r
+        return Status;\r
+      }\r
+      ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
+        \r
+      mConOut.UgaHorizontalResolution = Info->HorizontalResolution;\r
+      mConOut.UgaVerticalResolution   = Info->VerticalResolution;\r
+      mConOut.UgaColorDepth           = 32;        \r
+      mConOut.UgaRefreshRate          = 60;\r
+\r
+      FreePool (Info);\r
+\r
+    } else if (UgaDraw != NULL  && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+      Status = UgaDraw->GetMode (\r
                  UgaDraw,\r
                  &mConOut.UgaHorizontalResolution,\r
                  &mConOut.UgaVerticalResolution,\r
@@ -1345,6 +1361,7 @@ ConSplitterConOutDriverBindingStart (
                  );\r
     }\r
   }\r
+\r
   return Status;\r
 }\r
 \r
@@ -2366,7 +2383,7 @@ ConSplitterGetIntersection (
 }\r
 \r
 /**\r
-  Add the device's output mode to console splitter's mode list.\r
+  Sync the device's output mode to console splitter's mode list.\r
 \r
   @param  Private               Text Out Splitter pointer.\r
   @param  TextOut               Simple Text Output protocol pointer.\r
@@ -2614,7 +2631,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr (
 \r
 \r
 /**\r
-  Add display (GOP or UGA) output modes into Consplitter Text Out list.\r
+  Add Grahpics Output modes into Consplitter Text Out list.\r
 \r
   @param  Private               Text Out Splitter pointer.\r
   @param  GraphicsOutput        Graphics Output protocol pointer.\r
@@ -2625,7 +2642,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr (
 \r
 **/\r
 EFI_STATUS\r
-ConSplitterAddDisplayOutputMode (\r
+ConSplitterAddGraphicsOutputMode (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL    *GraphicsOutput,\r
   IN  EFI_UGA_DRAW_PROTOCOL           *UgaDraw\r
@@ -2648,9 +2665,7 @@ ConSplitterAddDisplayOutputMode (
   UINT32                               UgaColorDepth;\r
   UINT32                               UgaRefreshRate;\r
 \r
-  if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
+  ASSERT (GraphicsOutput != NULL || UgaDraw != NULL);\r
 \r
   CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;\r
 \r
@@ -2671,12 +2686,8 @@ ConSplitterAddDisplayOutputMode (
         //\r
         // This is the first Graphics Output device added\r
         //\r
-        CurrentGraphicsOutputMode->MaxMode = GraphicsOutput->Mode->MaxMode;\r
-        CurrentGraphicsOutputMode->Mode = GraphicsOutput->Mode->Mode;\r
+        CopyMem (CurrentGraphicsOutputMode, GraphicsOutput->Mode, sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE));\r
         CopyMem (CurrentGraphicsOutputMode->Info, GraphicsOutput->Mode->Info, GraphicsOutput->Mode->SizeOfInfo);\r
-        CurrentGraphicsOutputMode->SizeOfInfo = GraphicsOutput->Mode->SizeOfInfo;\r
-        CurrentGraphicsOutputMode->FrameBufferBase = GraphicsOutput->Mode->FrameBufferBase;\r
-        CurrentGraphicsOutputMode->FrameBufferSize = GraphicsOutput->Mode->FrameBufferSize;\r
 \r
         //\r
         // Allocate resource for the private mode buffer\r
@@ -2811,8 +2822,7 @@ ConSplitterAddDisplayOutputMode (
         }\r
       }\r
     }\r
-  }\r
-  if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     //\r
     // Graphics console driver can ensure the same mode for all GOP devices\r
     // so we can get the current mode from this video device\r
@@ -2828,11 +2838,11 @@ ConSplitterAddDisplayOutputMode (
     CurrentGraphicsOutputMode->MaxMode = 1;\r
     Info = CurrentGraphicsOutputMode->Info;\r
     Info->Version = 0;\r
-    Info->HorizontalResolution = UgaHorizontalResolution;\r
-    Info->VerticalResolution = UgaVerticalResolution;\r
-    Info->PixelFormat = PixelBltOnly;\r
-    Info->PixelsPerScanLine = UgaHorizontalResolution;\r
-    CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
+    Info->HorizontalResolution                 = UgaHorizontalResolution;\r
+    Info->VerticalResolution                   = UgaVerticalResolution;\r
+    Info->PixelFormat                          = PixelBltOnly;\r
+    Info->PixelsPerScanLine                    = UgaHorizontalResolution;\r
+    CurrentGraphicsOutputMode->SizeOfInfo      = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
     CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;\r
     CurrentGraphicsOutputMode->FrameBufferSize = 0;\r
 \r
@@ -2881,8 +2891,9 @@ Done:
   return Status;\r
 }\r
 \r
-\r
 /**\r
+  Set the current console out mode.\r
+\r
   This routine will get the current console mode information (column, row)\r
   from ConsoleOutMode variable and set it; if the variable does not exist,\r
   set to user defined console mode.\r
@@ -2895,54 +2906,55 @@ ConsplitterSetConsoleOutMode (
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private\r
   )\r
 {\r
-  UINTN                         Col;\r
-  UINTN                         Row;\r
-  UINTN                         Mode;\r
-  UINTN                         PreferMode;\r
-  UINTN                         BaseMode;\r
-  UINTN                         ModeInfoSize;\r
-  UINTN                         MaxMode;\r
-  EFI_STATUS                    Status;\r
-  CONSOLE_OUT_MODE              *ModeInfo;\r
+  UINTN                            Col;\r
+  UINTN                            Row;\r
+  UINTN                            Mode;\r
+  UINTN                            PreferMode;\r
+  UINTN                            BaseMode;\r
+  UINTN                            MaxMode;\r
+  EFI_STATUS                       Status;\r
+  CONSOLE_OUT_MODE                 ModeInfo;\r
+  UINTN                            ModeInfoSize;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *TextOut;\r
 \r
   PreferMode   = 0xFF;\r
   BaseMode     = 0xFF;\r
   TextOut      = &Private->TextOut;\r
   MaxMode      = (UINTN) (TextOut->Mode->MaxMode);\r
-  ModeInfoSize = sizeof (CONSOLE_OUT_MODE);\r
-\r
-  ModeInfo = AllocateZeroPool (sizeof(CONSOLE_OUT_MODE));\r
-  ASSERT(ModeInfo != NULL);\r
 \r
+  ModeInfoSize = sizeof (CONSOLE_OUT_MODE);\r
   Status = gRT->GetVariable (\r
                    VARCONOUTMODE,\r
                    &gEfiGenericPlatformVariableGuid,\r
                    NULL,\r
                    &ModeInfoSize,\r
-                   ModeInfo\r
+                   &ModeInfo\r
                    );\r
 \r
-  //\r
-  // Set to the default mode 80 x 25 required by EFI/UEFI spec;\r
-  // user can also define other valid default console mode here.\r
-  //\r
   if (EFI_ERROR(Status)) {\r
-    ModeInfo->Column = 80;\r
-    ModeInfo->Row    = 25;\r
-    Status = gRT->SetVariable (\r
-                    VARCONOUTMODE,\r
-                    &gEfiGenericPlatformVariableGuid,\r
-                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
-                    sizeof (CONSOLE_OUT_MODE),\r
-                    ModeInfo\r
-                    );\r
+    //\r
+    // If fail to get variable, set variable to the default mode 80 x 25\r
+    // required by UEFI spec;\r
+    //\r
+    ModeInfo.Column = 80;\r
+    ModeInfo.Row    = 25;\r
+\r
+    gRT->SetVariable (\r
+           VARCONOUTMODE,\r
+           &gEfiGenericPlatformVariableGuid,\r
+           EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+           sizeof (CONSOLE_OUT_MODE),\r
+           &ModeInfo\r
+           );\r
   }\r
 \r
+  //\r
+  // To find the prefer mode and basic mode from Text Out mode list\r
+  //\r
   for (Mode = 0; Mode < MaxMode; Mode++) {\r
     Status = TextOut->QueryMode (TextOut, Mode, &Col, &Row);\r
     if (!EFI_ERROR(Status)) {\r
-      if (Col == ModeInfo->Column && Row == ModeInfo->Row) {\r
+      if (Col == ModeInfo.Column && Row == ModeInfo.Row) {\r
         PreferMode = Mode;\r
       }\r
       if (Col == 80 && Row == 25) {\r
@@ -2951,31 +2963,33 @@ ConsplitterSetConsoleOutMode (
     }\r
   }\r
 \r
-  Status = TextOut->SetMode (TextOut, PreferMode);\r
-\r
   //\r
-  // if current mode setting is failed, default 80x25 mode will be set.\r
+  // Set perfer mode to Text Out devices.\r
   //\r
+  Status = TextOut->SetMode (TextOut, PreferMode);\r
   if (EFI_ERROR(Status)) {\r
+    //\r
+    // if current mode setting is failed, default 80x25 mode will be set.\r
+    //\r
     Status = TextOut->SetMode (TextOut, BaseMode);\r
     ASSERT(!EFI_ERROR(Status));\r
 \r
-    ModeInfo->Column = 80;\r
-    ModeInfo->Row    = 25;\r
+    ModeInfo.Column = 80;\r
+    ModeInfo.Row    = 25;\r
 \r
     //\r
     // Update ConOutMode variable\r
     //\r
-    Status = gRT->SetVariable (\r
-                    VARCONOUTMODE,\r
-                    &gEfiGenericPlatformVariableGuid,\r
-                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
-                    sizeof (CONSOLE_OUT_MODE),\r
-                    ModeInfo\r
-                    );\r
+    gRT->SetVariable (\r
+           VARCONOUTMODE,\r
+           &gEfiGenericPlatformVariableGuid,\r
+           EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+           sizeof (CONSOLE_OUT_MODE),\r
+           &ModeInfo\r
+           );\r
   }\r
 \r
-  gBS->FreePool (ModeInfo);\r
+  return ;\r
 }\r
 \r
 \r
@@ -2999,15 +3013,17 @@ ConSplitterTextOutAddDevice (
   IN  EFI_UGA_DRAW_PROTOCOL              *UgaDraw\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  UINTN                 CurrentNumOfConsoles;\r
-  INT32                 CurrentMode;\r
-  INT32                 MaxMode;\r
-  UINT32                UgaHorizontalResolution;\r
-  UINT32                UgaVerticalResolution;\r
-  UINT32                UgaColorDepth;\r
-  UINT32                UgaRefreshRate;\r
-  TEXT_OUT_AND_GOP_DATA *TextAndGop;\r
+  EFI_STATUS                           Status;\r
+  UINTN                                CurrentNumOfConsoles;\r
+  INT32                                CurrentMode;\r
+  INT32                                MaxMode;\r
+  UINT32                               UgaHorizontalResolution;\r
+  UINT32                               UgaVerticalResolution;\r
+  UINT32                               UgaColorDepth;\r
+  UINT32                               UgaRefreshRate;\r
+  TEXT_OUT_AND_GOP_DATA                *TextAndGop;\r
+  UINTN                                SizeOfInfo;\r
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
 \r
   Status                = EFI_SUCCESS;\r
   CurrentNumOfConsoles  = Private->CurrentNumberOfConsoles;\r
@@ -3035,9 +3051,9 @@ ConSplitterTextOutAddDevice (
 \r
   TextAndGop          = &Private->TextOutList[CurrentNumOfConsoles];\r
 \r
-  TextAndGop->TextOut = TextOut;\r
+  TextAndGop->TextOut        = TextOut;\r
   TextAndGop->GraphicsOutput = GraphicsOutput;\r
-  TextAndGop->UgaDraw = UgaDraw;\r
+  TextAndGop->UgaDraw        = UgaDraw;\r
 \r
   if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {\r
     //\r
@@ -3073,16 +3089,38 @@ ConSplitterTextOutAddDevice (
   MaxMode     = Private->TextOutMode.MaxMode;\r
   ASSERT (MaxMode >= 1);\r
 \r
-  //\r
-  // Update DevNull mode according to current video device\r
-  //\r
   if (FeaturePcdGet (PcdConOutGopSupport)) {\r
-    if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {\r
-      ConSplitterAddDisplayOutputMode (Private, GraphicsOutput, UgaDraw);\r
+    //\r
+    // If GOP is produced by Consplitter, this device display mode will be added into Graphics Ouput modes.\r
+    //\r
+    if ((GraphicsOutput != NULL) || (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport))) {\r
+      ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);\r
     }\r
   }\r
+\r
   if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
-    if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    UgaHorizontalResolution = 800;\r
+    UgaVerticalResolution   = 600;\r
+    UgaColorDepth           = 32;        \r
+    UgaRefreshRate          = 60;\r
+\r
+    Status = EFI_DEVICE_ERROR;\r
+    //\r
+    // If UGA is produced by Consplitter\r
+    //\r
+    if (GraphicsOutput != NULL) {\r
+      Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info);\r
+      if (EFI_ERROR (Status)) {\r
+        return Status;\r
+      }\r
+      ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
+\r
+      UgaHorizontalResolution = Info->HorizontalResolution;\r
+      UgaVerticalResolution   = Info->VerticalResolution;\r
+\r
+      FreePool (Info);\r
+    \r
+    } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       Status = UgaDraw->GetMode (\r
                     UgaDraw,\r
                     &UgaHorizontalResolution,\r
@@ -3090,28 +3128,19 @@ ConSplitterTextOutAddDevice (
                     &UgaColorDepth,\r
                     &UgaRefreshRate\r
                     );\r
-      if (!EFI_ERROR (Status)) {\r
-        Status = ConSpliterUgaDrawSetMode (\r
-                    &Private->UgaDraw,\r
-                    UgaHorizontalResolution,\r
-                    UgaVerticalResolution,\r
-                    UgaColorDepth,\r
-                    UgaRefreshRate\r
-                    );\r
-      }\r
-      //\r
-      // If GetMode/SetMode is failed, set to 800x600 mode\r
-      //\r
-      if(EFI_ERROR (Status)) {\r
-        Status = ConSpliterUgaDrawSetMode (\r
-                    &Private->UgaDraw,\r
-                    800,\r
-                    600,\r
-                    32,\r
-                    60\r
-                    );\r
-      }\r
     }\r
+    \r
+    //\r
+    //  Set UGA Draw mode,\r
+    //  if GetMode is failed, set to 800x600 mode\r
+    //\r
+    Status = ConSpliterUgaDrawSetMode (\r
+                &Private->UgaDraw,\r
+                UgaHorizontalResolution,\r
+                UgaVerticalResolution,\r
+                UgaColorDepth,\r
+                UgaRefreshRate\r
+                );\r
   }\r
 \r
   if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) {\r
@@ -3119,8 +3148,14 @@ ConSplitterTextOutAddDevice (
     // We just added a new GOP or UGA device in graphics mode\r
     //\r
     if (FeaturePcdGet (PcdConOutGopSupport)) {\r
+      //\r
+      // Sync display output on new device based on GOP settings.\r
+      //\r
       DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
     } else if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
+      //\r
+      // Sync display output on new device based on UGA settings.\r
+      //\r
       DevNullUgaSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
     }\r
   } else if ((CurrentMode >= 0) && ((GraphicsOutput != NULL) || (UgaDraw != NULL)) && (CurrentMode < Private->TextOutMode.MaxMode)) {\r
index db1212b83560b60fa41057f1f662a29b872d7723..75df3555d7bca4ae64050fe8647b2dfe5c9407bf 100644 (file)
@@ -92,8 +92,8 @@ typedef struct {
 } CONSOLE_OUT_MODE;\r
 \r
 typedef struct {\r
-  UINTN Columns;\r
-  UINTN Rows;\r
+  UINTN   Columns;\r
+  UINTN   Rows;\r
 } TEXT_OUT_SPLITTER_QUERY_DATA;\r
 \r
 \r
@@ -1861,8 +1861,8 @@ ConSpliterConsoleControlGetMode (
   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
+  @param  This                    Console Control Protocol instance pointer.\r
+  @param  Mode                    Mode to set.\r
 \r
   @retval EFI_SUCCESS             Mode information returned.\r
   @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
@@ -1877,21 +1877,20 @@ ConSpliterConsoleControlSetMode (
   );\r
 \r
 /**\r
-  Return the current video mode information.\r
+  Returns information for an available graphics mode that the graphics device\r
+  and the set of active video output devices supports.\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
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber            The mode number to return information on.\r
+  @param  SizeOfInfo            A pointer to the size, in bytes, of the Info buffer.\r
+  @param  Info                  A pointer to callee allocated buffer that returns information 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
+  @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 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
+  @retval EFI_OUT_OF_RESOURCES  No resource available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1904,15 +1903,16 @@ ConSpliterGraphicsOutputQueryMode (
   );\r
 \r
 /**\r
-  Graphics output protocol interface to set video mode.\r
+  Set the video device into the specified mode and clears the visible portions of \r
+  the output display to black.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  ModeNumber              The mode number to be set.\r
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber            Abstraction that defines the current video mode.\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
+  @retval EFI_SUCCESS           The graphics mode specified by ModeNumber was selected.\r
+  @retval EFI_DEVICE_ERROR      The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED       ModeNumber is not supported by this device.\r
+  @retval EFI_OUT_OF_RESOURCES  No resource available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -2007,15 +2007,15 @@ DevNullGopSync (
 /**\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
+  @param  This                  The EFI_UGA_DRAW_PROTOCOL instance.\r
+  @param  HorizontalResolution  The size of video screen in pixels in the X dimension.\r
+  @param  VerticalResolution    The size of video screen in pixels in the Y dimension.\r
+  @param  ColorDepth            Number of bits per pixel, currently defined to be 32.\r
+  @param  RefreshRate           The refresh rate of the monitor in Hertz.\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
+  @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
@@ -2029,17 +2029,17 @@ ConSpliterUgaDrawGetMode (
   );\r
 \r
 /**\r
-  Return the current video mode information.\r
+  Set 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
+  @param  This                 The EFI_UGA_DRAW_PROTOCOL instance.\r
+  @param  HorizontalResolution The size of video screen in pixels in the X dimension.\r
+  @param  VerticalResolution   The size of video screen in pixels in the Y dimension.\r
+  @param  ColorDepth           Number of bits per pixel, currently defined to be 32.\r
+  @param  RefreshRate          The refresh rate of the monitor in Hertz.\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
+  @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
@@ -2053,49 +2053,52 @@ ConSpliterUgaDrawSetMode (
   );\r
 \r
 /**\r
-  The following table defines actions for BltOperations.\r
+  Blt a rectangle of pixels on the graphics screen.\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
+  The following table defines actions for BltOperations.\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
+  EfiUgaVideoFill:\r
+    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: \r
+    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:\r
+    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:\r
+    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. This\r
+                         buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
+  @param  BltOperation   Operation to perform on BlitBuffer and video 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 buffer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -2162,7 +2165,7 @@ DevNullTextOutOutputString (
 /**\r
   Sets the output device(s) to a specified mode.\r
 \r
-  @param  Private                 Private data structure pointer.\r
+  @param  Private                 Text Out Splitter pointer.\r
   @param  ModeNumber              The mode number to set.\r
 \r
   @retval EFI_SUCCESS             The requested text mode was set.\r
@@ -2182,7 +2185,7 @@ DevNullTextOutSetMode (
   Clears the output device(s) display to the currently selected background\r
   color.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  @param  Private                 Text Out Splitter pointer.\r
 \r
   @retval EFI_SUCCESS             The operation completed successfully.\r
   @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
@@ -2198,7 +2201,7 @@ DevNullTextOutClearScreen (
 /**\r
   Sets the current coordinates of the cursor position.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  @param  Private                 Text Out Splitter 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
@@ -2220,14 +2223,13 @@ DevNullTextOutSetCursorPosition (
   );\r
 \r
 /**\r
-  Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
-  In this driver, the cursor cannot be hidden.\r
+  Set cursor visibility property.\r
 \r
-  @param  Private                 Indicates the calling context.\r
+  @param  Private                 Text Out Splitter pointer.\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
+  @retval EFI_SUCCESS             Returns always.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -2240,7 +2242,7 @@ DevNullTextOutEnableCursor (
   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
+  @param  Private                 Text Out Splitter pointer.\r
 \r
   @retval EFI_SUCCESS             The request is valid.\r
   @retval other                   Return status of TextOut->OutputString ()\r
index cb068cfa042fcea25a929c471a5255cc42b0801e..595b6f043daa1488c01e0fffbef7be6f59389ceb 100644 (file)
@@ -3,6 +3,13 @@
 #\r
 # This driver acts as a virtual console, takes over the console I/O control from selected \r
 # standard console devices, and transmits console I/O to related console device drivers.\r
+# Consplitter could install Graphics Output protocol and/or UGA Draw protocol in system\r
+# table according PCD settings(PcdConOutGopSupport, and PcdConOutUgaSupport). It always\r
+# consumes Graphics Output protocol which is produced by display device, and consumes UGA Draw \r
+# protocol which is produced by display device according to PcdUgaConsumeSupport value. \r
+# Note: If only UGA Draw protocol is installed in system table, PcdUgaConsumeSupport \r
+# should be set to TRUE.\r
+#\r
 # Copyright (c) 2006 - 2008, Intel Corporation\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
index 1a0715e1417e480cbdfe457c27c7f453d3411ba9..686a47331ff81a264c2e695b3adb46280eca7eb6 100644 (file)
@@ -16,7 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-\r
 #include "ConSplitter.h"\r
 \r
 \r
@@ -80,8 +79,8 @@ ConSpliterConsoleControlGetMode (
   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
+  @param  This                    Console Control Protocol instance pointer.\r
+  @param  Mode                    Mode to set.\r
 \r
   @retval EFI_SUCCESS             Mode information returned.\r
   @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
@@ -152,21 +151,20 @@ ConSpliterConsoleControlSetMode (
 \r
 \r
 /**\r
-  Return the current video mode information.\r
+  Returns information for an available graphics mode that the graphics device\r
+  and the set of active video output devices supports.\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
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber            The mode number to return information on.\r
+  @param  SizeOfInfo            A pointer to the size, in bytes, of the Info buffer.\r
+  @param  Info                  A pointer to callee allocated buffer that returns information 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
+  @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 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
+  @retval EFI_OUT_OF_RESOURCES  No resource available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -194,7 +192,6 @@ ConSpliterGraphicsOutputQueryMode (
   }\r
 \r
   *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
-\r
   if (*Info == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -208,15 +205,16 @@ ConSpliterGraphicsOutputQueryMode (
 \r
 \r
 /**\r
-  Graphics output protocol interface to set video mode.\r
+  Set the video device into the specified mode and clears the visible portions of \r
+  the output display to black.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  ModeNumber              The mode number to be set.\r
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber            Abstraction that defines the current video mode.\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
+  @retval EFI_SUCCESS           The graphics mode specified by ModeNumber was selected.\r
+  @retval EFI_DEVICE_ERROR      The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED       ModeNumber is not supported by this device.\r
+  @retval EFI_OUT_OF_RESOURCES  No resource available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -293,9 +291,7 @@ ConSpliterGraphicsOutputSetMode (
       if (EFI_ERROR (Status)) {\r
         ReturnStatus = Status;\r
       }\r
-    }\r
-\r
-    if (EFI_ERROR (ReturnStatus) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       UgaDraw = Private->TextOutList[Index].UgaDraw;\r
       if (UgaDraw != NULL) {\r
         Status = UgaDraw->SetMode (\r
@@ -671,7 +667,7 @@ DevNullGopSync (
                       Private->GraphicsOutput.Mode->Info->VerticalResolution,\r
                       0\r
                       );\r
-  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     return UgaDraw->Blt (\r
                       UgaDraw,\r
                       (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt,\r
@@ -689,19 +685,18 @@ 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
+  @param  This                  The EFI_UGA_DRAW_PROTOCOL instance.\r
+  @param  HorizontalResolution  The size of video screen in pixels in the X dimension.\r
+  @param  VerticalResolution    The size of video screen in pixels in the Y dimension.\r
+  @param  ColorDepth            Number of bits per pixel, currently defined to be 32.\r
+  @param  RefreshRate           The refresh rate of the monitor in Hertz.\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
+  @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
@@ -717,9 +712,9 @@ ConSpliterUgaDrawGetMode (
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
 \r
   if ((HorizontalResolution == NULL) ||\r
-         (VerticalResolution   == NULL) ||\r
-         (RefreshRate          == NULL) ||\r
-         (ColorDepth           == NULL)) {\r
+      (VerticalResolution   == NULL) ||\r
+      (RefreshRate          == NULL) ||\r
+      (ColorDepth           == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   //\r
@@ -737,17 +732,17 @@ ConSpliterUgaDrawGetMode (
 \r
 \r
 /**\r
-  Return the current video mode information.\r
+  Set 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
+  @param  This                 The EFI_UGA_DRAW_PROTOCOL instance.\r
+  @param  HorizontalResolution The size of video screen in pixels in the X dimension.\r
+  @param  VerticalResolution   The size of video screen in pixels in the Y dimension.\r
+  @param  ColorDepth           Number of bits per pixel, currently defined to be 32.\r
+  @param  RefreshRate          The refresh rate of the monitor in Hertz.\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
+  @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
@@ -812,78 +807,80 @@ ConSpliterUgaDrawSetMode (
 \r
     ReturnStatus = EFI_UNSUPPORTED;\r
 \r
-    if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-      UgaDraw = Private->TextOutList[Index].UgaDraw;\r
-      if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-        Status = UgaDraw->SetMode (\r
-                            UgaDraw,\r
-                            HorizontalResolution,\r
-                            VerticalResolution,\r
-                            ColorDepth,\r
-                            RefreshRate\r
-                            );\r
+    GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r
+    if (GraphicsOutput != NULL) {\r
+      //\r
+      // Find corresponding ModeNumber of this GraphicsOutput instance\r
+      //\r
+      for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r
+        Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
         if (EFI_ERROR (Status)) {\r
-          ReturnStatus = Status;\r
+          return Status;\r
         }\r
-      }\r
-    }\r
-\r
-    if (EFI_ERROR (ReturnStatus)) {\r
-      GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r
-      if (GraphicsOutput != NULL) {\r
-        //\r
-        // Find corresponding ModeNumber of this GraphicsOutput instance\r
-        //\r
-        for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r
-          Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
-          if (EFI_ERROR (Status)) {\r
-            return Status;\r
-          }\r
-          if ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {\r
-            FreePool (Info);\r
-            break;\r
-          }\r
+        if ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {\r
           FreePool (Info);\r
+          break;\r
         }\r
+        FreePool (Info);\r
+      }\r
 \r
-        Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
+      Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
+      if (EFI_ERROR (Status)) {\r
+        ReturnStatus = Status;\r
+      }\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)){\r
+      UgaDraw = Private->TextOutList[Index].UgaDraw;\r
+      if (UgaDraw != NULL) {\r
+        Status = UgaDraw->SetMode (\r
+                          UgaDraw,\r
+                          HorizontalResolution,\r
+                          VerticalResolution,\r
+                          ColorDepth,\r
+                          RefreshRate\r
+                          );\r
         if (EFI_ERROR (Status)) {\r
           ReturnStatus = Status;\r
         }\r
       }\r
-    }\r
+    } \r
   }\r
 \r
   return ReturnStatus;\r
 }\r
 \r
 /**\r
-  The following table defines actions for BltOperations.\r
+  Blt a rectangle of pixels on the graphics screen.\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
+  The following table defines actions for BltOperations.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  EfiUgaVideoFill:\r
+    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: \r
+    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:\r
+    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:\r
+    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                 Text Out Splitter 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
@@ -1020,51 +1017,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
+  Blt a rectangle of pixels on the graphics screen.\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
+  The following table defines actions for BltOperations.\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
+  EfiUgaVideoFill:\r
+    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: \r
+    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:\r
+    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:\r
+    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. This\r
+                         buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
+  @param  BltOperation   Operation to perform on BlitBuffer and video 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 buffer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1183,31 +1182,31 @@ DevNullUgaSync (
   IN  EFI_UGA_DRAW_PROTOCOL           *UgaDraw\r
   )\r
 {\r
-  if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-    return UgaDraw->Blt (\r
-                      UgaDraw,\r
-                      Private->UgaBlt,\r
-                      EfiUgaBltBufferToVideo,\r
+  if (GraphicsOutput != NULL) {\r
+    return GraphicsOutput->Blt (\r
+                      GraphicsOutput,\r
+                      (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,\r
+                      EfiBltBufferToVideo,\r
                       0,\r
                       0,\r
                       0,\r
                       0,\r
                       Private->UgaHorizontalResolution,\r
                       Private->UgaVerticalResolution,\r
-                      Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)\r
+                      0\r
                       );\r
-  } else if (GraphicsOutput != NULL) {\r
-    return GraphicsOutput->Blt (\r
-                      GraphicsOutput,\r
-                      (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,\r
-                      EfiBltBufferToVideo,\r
+  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    return UgaDraw->Blt (\r
+                      UgaDraw,\r
+                      Private->UgaBlt,\r
+                      EfiUgaBltBufferToVideo,\r
                       0,\r
                       0,\r
                       0,\r
                       0,\r
                       Private->UgaHorizontalResolution,\r
                       Private->UgaVerticalResolution,\r
-                      0\r
+                      Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)\r
                       );\r
   } else {\r
     return EFI_UNSUPPORTED;\r
@@ -1436,7 +1435,7 @@ DevNullTextOutOutputString (
 /**\r
   Sets the output device(s) to a specified mode.\r
 \r
-  @param  Private                 Private data structure pointer.\r
+  @param  Private                 Text Out Splitter pointer.\r
   @param  ModeNumber              The mode number to set.\r
 \r
   @retval EFI_SUCCESS             The requested text mode was set.\r
@@ -1513,7 +1512,7 @@ DevNullTextOutSetMode (
   Clears the output device(s) display to the currently selected background\r
   color.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  @param  Private                 Text Out Splitter pointer.\r
 \r
   @retval EFI_SUCCESS             The operation completed successfully.\r
   @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
@@ -1561,7 +1560,7 @@ DevNullTextOutClearScreen (
 /**\r
   Sets the current coordinates of the cursor position.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  @param  Private                 Text Out Splitter 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
@@ -1595,14 +1594,13 @@ DevNullTextOutSetCursorPosition (
 \r
 \r
 /**\r
-  Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
-  In this driver, the cursor cannot be hidden.\r
+  Set cursor visibility property.\r
 \r
-  @param  Private                 Indicates the calling context.\r
+  @param  Private                 Text Out Splitter pointer.\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
+  @retval EFI_SUCCESS             Returns always.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1621,7 +1619,7 @@ DevNullTextOutEnableCursor (
   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
+  @param  Private                 Text Out Splitter pointer.\r
 \r
   @retval EFI_SUCCESS             The request is valid.\r
   @retval other                   Return status of TextOut->OutputString ()\r