]> git.proxmox.com Git - mirror_edk2.git/commitdiff
code scrub for consplitter module.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 22 Dec 2008 02:29:21 +0000 (02:29 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 22 Dec 2008 02:29:21 +0000 (02:29 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7085 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 746c27180f665153ada82cf69ed0d7a9c3031bc7..234f733bd63b00d9e16ef069ee15a19fd743bb28 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
-  Console Splitter Driver. Any Handle that attatched\r
-  EFI_CONSOLE_IDENTIFIER_PROTOCOL can be bound by this driver.\r
+  Console Splitter Driver. Any Handle that attatched console I/O protocols\r
+  (Console In device, Console Out device, Console Error device, Simple Pointer\r
+  protocol, Absolute Pointer protocol) can be bound by this driver.\r
 \r
   So far it works like any other driver by opening a SimpleTextIn and/or\r
   SimpleTextOut protocol with EFI_OPEN_PROTOCOL_BY_DRIVER attributes. The big\r
@@ -8,13 +9,12 @@
   handle, or construct a child handle like a standard device or bus driver.\r
   This driver produces three virtual handles as children, one for console input\r
   splitter, one for console output splitter and one for error output splitter.\r
-  EFI_CONSOLE_SPLIT_PROTOCOL will be attatched onto each virtual handle to\r
-  identify the splitter type.\r
+  These 3 virtual handles would be installed on gST.\r
 \r
-  Each virtual handle, that supports both the EFI_CONSOLE_SPLIT_PROTOCOL\r
-  and Console I/O protocol, will be produced in the driver entry point.\r
-  The virtual handle are added on driver entry and never removed.\r
-  Such design ensures sytem function well during none console device situation.\r
+  Each virtual handle, that supports the Console I/O protocol, will be produced\r
+  in the driver entry point. The virtual handle are added on driver entry and \r
+  never removed. Such design ensures sytem function well during none console \r
+  device situation.\r
 \r
 Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -30,9 +30,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "ConSplitter.h"\r
 \r
 //\r
-// Template for Text In Splitter\r
+// Text In Splitter Private Data template\r
 //\r
-TEXT_IN_SPLITTER_PRIVATE_DATA  mConIn = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA  mConIn = {\r
   TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE,\r
   (EFI_HANDLE) NULL,\r
   {\r
@@ -84,13 +84,13 @@ TEXT_IN_SPLITTER_PRIVATE_DATA  mConIn = {
   },\r
 \r
   {\r
-    0,       //AbsoluteMinX\r
-    0,       //AbsoluteMinY\r
-    0,       //AbsoluteMinZ\r
-    0x10000, //AbsoluteMaxX\r
-    0x10000, //AbsoluteMaxY\r
-    0x10000, //AbsoluteMaxZ\r
-    0        //Attributes\r
+    0,       // AbsoluteMinX\r
+    0,       // AbsoluteMinY\r
+    0,       // AbsoluteMinZ\r
+    0x10000, // AbsoluteMaxX\r
+    0x10000, // AbsoluteMaxY\r
+    0x10000, // AbsoluteMaxZ\r
+    0        // Attributes\r
   },\r
   0,\r
   (EFI_ABSOLUTE_POINTER_PROTOCOL **) NULL,\r
@@ -117,8 +117,9 @@ TEXT_IN_SPLITTER_PRIVATE_DATA  mConIn = {
   FALSE\r
 };\r
 \r
+\r
 //\r
-// Template for Uga Draw Protocol\r
+// Uga Draw Protocol Private Data template\r
 //\r
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UGA_DRAW_PROTOCOL mUgaDrawProtocolTemplate = {\r
   ConSpliterUgaDrawGetMode,\r
@@ -127,7 +128,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UGA_DRAW_PROTOCOL mUgaDrawProtocolTemplate = {
 };\r
 \r
 //\r
-// Template for Graphics Output Protocol\r
+// Graphics Output Protocol Private Data template\r
 //\r
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_PROTOCOL mGraphicsOutputProtocolTemplate = {\r
   ConSpliterGraphicsOutputQueryMode,\r
@@ -136,10 +137,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_PROTOCOL mGraphicsOutputProtoc
   NULL\r
 };\r
 \r
+\r
 //\r
-// Template for Text Out Splitter\r
+// Text Out Splitter Private Data template\r
 //\r
-TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,\r
   (EFI_HANDLE) NULL,\r
   {\r
@@ -204,9 +206,9 @@ TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
 };\r
 \r
 //\r
-// Template for Standard Error Text Out Splitter\r
+// Standard Error Text Out Splitter Data Template\r
 //\r
-TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {\r
   TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,\r
   (EFI_HANDLE) NULL,\r
   {\r
@@ -283,55 +285,55 @@ EFI_DRIVER_BINDING_PROTOCOL           gConSplitterConInDriverBinding = {
 };\r
 \r
 //\r
-// Driver binding instance for Simple Pointer protocol\r
+// Driver binding instance for Console Out device\r
 //\r
-EFI_DRIVER_BINDING_PROTOCOL           gConSplitterSimplePointerDriverBinding = {\r
-  ConSplitterSimplePointerDriverBindingSupported,\r
-  ConSplitterSimplePointerDriverBindingStart,\r
-  ConSplitterSimplePointerDriverBindingStop,\r
+EFI_DRIVER_BINDING_PROTOCOL           gConSplitterConOutDriverBinding = {\r
+  ConSplitterConOutDriverBindingSupported,\r
+  ConSplitterConOutDriverBindingStart,\r
+  ConSplitterConOutDriverBindingStop,\r
   0xa,\r
   NULL,\r
   NULL\r
 };\r
 \r
 //\r
-// Driver binding instance for Absolute Pointer protocol\r
+// Driver binding instance for Standard Error device\r
 //\r
-EFI_DRIVER_BINDING_PROTOCOL           gConSplitterAbsolutePointerDriverBinding = {\r
-  ConSplitterAbsolutePointerDriverBindingSupported,\r
-  ConSplitterAbsolutePointerDriverBindingStart,\r
-  ConSplitterAbsolutePointerDriverBindingStop,\r
+EFI_DRIVER_BINDING_PROTOCOL           gConSplitterStdErrDriverBinding = {\r
+  ConSplitterStdErrDriverBindingSupported,\r
+  ConSplitterStdErrDriverBindingStart,\r
+  ConSplitterStdErrDriverBindingStop,\r
   0xa,\r
   NULL,\r
   NULL\r
 };\r
 \r
 //\r
-// Driver binding instance for Console Out device\r
+// Driver binding instance for Simple Pointer protocol\r
 //\r
-EFI_DRIVER_BINDING_PROTOCOL           gConSplitterConOutDriverBinding = {\r
-  ConSplitterConOutDriverBindingSupported,\r
-  ConSplitterConOutDriverBindingStart,\r
-  ConSplitterConOutDriverBindingStop,\r
+EFI_DRIVER_BINDING_PROTOCOL           gConSplitterSimplePointerDriverBinding = {\r
+  ConSplitterSimplePointerDriverBindingSupported,\r
+  ConSplitterSimplePointerDriverBindingStart,\r
+  ConSplitterSimplePointerDriverBindingStop,\r
   0xa,\r
   NULL,\r
   NULL\r
 };\r
 \r
 //\r
-// Driver binding instance for Standard Error device\r
+// Driver binding instance for Absolute Pointer protocol\r
 //\r
-EFI_DRIVER_BINDING_PROTOCOL           gConSplitterStdErrDriverBinding = {\r
-  ConSplitterStdErrDriverBindingSupported,\r
-  ConSplitterStdErrDriverBindingStart,\r
-  ConSplitterStdErrDriverBindingStop,\r
+EFI_DRIVER_BINDING_PROTOCOL           gConSplitterAbsolutePointerDriverBinding = {\r
+  ConSplitterAbsolutePointerDriverBindingSupported,\r
+  ConSplitterAbsolutePointerDriverBindingStart,\r
+  ConSplitterAbsolutePointerDriverBindingStop,\r
   0xa,\r
   NULL,\r
   NULL\r
 };\r
 \r
 /**\r
-  The user Entry Point for module ConSplitter. The user code starts with this function.\r
+  The Entry Point for module ConSplitter. The user code starts with this function.\r
 \r
   Installs driver module protocols and. Creates virtual device handles for ConIn,\r
   ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol,\r
@@ -407,9 +409,12 @@ ConSplitterDriverEntry(
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-\r
+  //\r
+  // One of Either Graphics Output protocol and UGA Draw protocol must be supported.\r
+  //\r
   ASSERT (FeaturePcdGet (PcdConOutGopSupport) ||\r
           FeaturePcdGet (PcdConOutUgaSupport));\r
+\r
   //\r
   // The driver creates virtual handles for ConIn, ConOut, and StdErr.\r
   // The virtual handles will always exist even if no console exist in the\r
@@ -451,6 +456,7 @@ ConSplitterDriverEntry(
     if (!EFI_ERROR (Status)) {\r
       //\r
       // Update the EFI System Table with new virtual console\r
+      // and update the pointer to Simple Text Input protocol.\r
       //\r
       gST->ConsoleInHandle  = mConIn.VirtualHandle;\r
       gST->ConIn            = &mConIn.TextIn;\r
@@ -463,7 +469,8 @@ ConSplitterDriverEntry(
   if (!EFI_ERROR (Status)) {\r
     if (!FeaturePcdGet (PcdConOutGopSupport)) {\r
       //\r
-      // In EFI mode, UGA Draw protocol is installed\r
+      // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed \r
+      // on the virtual handle.\r
       //\r
       Status = gBS->InstallMultipleProtocolInterfaces (\r
                       &mConOut.VirtualHandle,\r
@@ -479,7 +486,8 @@ ConSplitterDriverEntry(
                       );\r
     } else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
       //\r
-      // In UEFI mode, Graphics Output Protocol is installed on virtual handle.\r
+      // If UGA Draw protocol not supported, Graphics Output Protocol is installed\r
+      // on virtual handle.\r
       //\r
       Status = gBS->InstallMultipleProtocolInterfaces (\r
                       &mConOut.VirtualHandle,\r
@@ -495,8 +503,8 @@ ConSplitterDriverEntry(
                       );\r
     } else {\r
       //\r
-      // In EFI and UEFI comptible mode, Graphics Output Protocol and UGA are\r
-      // installed on virtual handle.\r
+      // Boot Graphics Output protocol and UGA Draw protocol are supported,\r
+      // both they will be installed on virtual handle.\r
       //\r
       Status = gBS->InstallMultipleProtocolInterfaces (\r
                       &mConOut.VirtualHandle,\r
@@ -517,6 +525,7 @@ ConSplitterDriverEntry(
     if (!EFI_ERROR (Status)) {\r
       //\r
       // Update the EFI System Table with new virtual console\r
+      // and Update the pointer to Text Output protocol.\r
       //\r
       gST->ConsoleOutHandle = mConOut.VirtualHandle;\r
       gST->ConOut           = &mConOut.TextOut;\r
@@ -537,7 +546,6 @@ ConSplitterDriverEntry(
 \r
 }\r
 \r
-\r
 /**\r
   Construct console input devices' private data.\r
 \r
@@ -557,7 +565,7 @@ ConSplitterTextInConstructor (
   EFI_STATUS  Status;\r
 \r
   //\r
-  // Initilize console input splitter's private data.\r
+  // Allocate buffer for Simple Text Input device  \r
   //\r
   Status = ConSplitterGrowBuffer (\r
             sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *),\r
@@ -578,7 +586,9 @@ ConSplitterTextInConstructor (
                   &ConInPrivate->LockEvent\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
-\r
+  //\r
+  // Create Event to wait for a key \r
+  //\r
   Status = gBS->CreateEvent (\r
                   EVT_NOTIFY_WAIT,\r
                   TPL_NOTIFY,\r
@@ -589,7 +599,7 @@ ConSplitterTextInConstructor (
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
-  // Buffer for Simple Text Input Ex Protocol\r
+  // Allocate buffer for Simple Text Input Ex device  \r
   //\r
   Status = ConSplitterGrowBuffer (\r
              sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *),\r
@@ -599,7 +609,9 @@ ConSplitterTextInConstructor (
   if (EFI_ERROR (Status)) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-\r
+  //\r
+  // Create Event to wait for a key Ex\r
+  //\r
   Status = gBS->CreateEvent (\r
                   EVT_NOTIFY_WAIT,\r
                   TPL_NOTIFY,\r
@@ -611,11 +623,10 @@ ConSplitterTextInConstructor (
 \r
   InitializeListHead (&ConInPrivate->NotifyList);\r
 \r
+  ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode;\r
   //\r
-  // Allocate Buffer and Create Event for Absolute Pointer and Simple Pointer Protocols\r
+  // Allocate buffer for Absolute Pointer device  \r
   //\r
-  ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode;\r
-\r
   Status = ConSplitterGrowBuffer (\r
             sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),\r
             &ConInPrivate->AbsolutePointerListCount,\r
@@ -624,7 +635,9 @@ ConSplitterTextInConstructor (
   if (EFI_ERROR (Status)) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-\r
+  //\r
+  // Create Event to wait for device input for Absolute pointer device\r
+  //\r
   Status = gBS->CreateEvent (\r
             EVT_NOTIFY_WAIT,\r
             TPL_NOTIFY,\r
@@ -635,7 +648,9 @@ ConSplitterTextInConstructor (
   ASSERT_EFI_ERROR (Status);\r
 \r
   ConInPrivate->SimplePointer.Mode = &ConInPrivate->SimplePointerMode;\r
-\r
+  //\r
+  // Allocate buffer for Simple Pointer device  \r
+  //\r
   Status = ConSplitterGrowBuffer (\r
             sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),\r
             &ConInPrivate->PointerListCount,\r
@@ -644,7 +659,9 @@ ConSplitterTextInConstructor (
   if (EFI_ERROR (Status)) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-\r
+  //\r
+  // Create Event to wait for device input for Simple pointer device\r
+  //\r
   Status = gBS->CreateEvent (\r
                   EVT_NOTIFY_WAIT,\r
                   TPL_NOTIFY,\r
@@ -659,7 +676,7 @@ ConSplitterTextInConstructor (
 /**\r
   Construct console output devices' private data.\r
 \r
-  @param  ConOutPrivate            A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA\r
+  @param  ConOutPrivate            A pointer to the TEXT_OUT_SPLITTER_PRIVATE_DATA\r
                                    structure.\r
 \r
   @retval EFI_OUT_OF_RESOURCES     Out of resources.\r
@@ -680,7 +697,6 @@ ConSplitterTextOutConstructor (
   if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
     CopyMem (&ConOutPrivate->UgaDraw, &mUgaDrawProtocolTemplate, sizeof (EFI_UGA_DRAW_PROTOCOL));\r
   }\r
-\r
   if (FeaturePcdGet (PcdConOutGopSupport)) {\r
     CopyMem (&ConOutPrivate->GraphicsOutput, &mGraphicsOutputProtocolTemplate, sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL));\r
   }\r
@@ -695,7 +711,9 @@ ConSplitterTextOutConstructor (
   // so put current mode back to init state.\r
   //\r
   ConOutPrivate->TextOutMode.Mode = 0xFF;\r
-\r
+  //\r
+  // Allocate buffer for Console Out device  \r
+  //\r
   Status = ConSplitterGrowBuffer (\r
             sizeof (TEXT_OUT_AND_GOP_DATA),\r
             &ConOutPrivate->TextOutListCount,\r
@@ -704,7 +722,9 @@ ConSplitterTextOutConstructor (
   if (EFI_ERROR (Status)) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-\r
+  //\r
+  // Allocate buffer for Text Out query data\r
+  //\r
   Status = ConSplitterGrowBuffer (\r
             sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),\r
             &ConOutPrivate->TextOutQueryDataCount,\r
@@ -713,6 +733,7 @@ ConSplitterTextOutConstructor (
   if (EFI_ERROR (Status)) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
+\r
   //\r
   // Setup the DevNullTextOut console to 80 x 25\r
   //\r
@@ -722,7 +743,7 @@ ConSplitterTextOutConstructor (
 \r
   if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
     //\r
-    // Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel\r
+    // Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel, 60Hz.\r
     //\r
     ConSpliterUgaDrawSetMode (&ConOutPrivate->UgaDraw, 800, 600, 32, 60);\r
   }\r
@@ -772,14 +793,15 @@ ConSplitterTextOutConstructor (
 \r
 \r
 /**\r
-  Test to see if the specified protocol could be supported on the ControllerHandle. \r
+  Test to see if the specified protocol could be supported on the specified device. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
-  @param  Guid                The specified protocol guid.\r
+  @param  Guid                The specified protocol.\r
 \r
   @retval EFI_SUCCESS         The specified protocol is supported on this device.\r
-  @retval other               The specified protocol is not supported on this device.\r
+  @retval EFI_UNSUPPORTED     The specified protocol attempts to be installed on virtul handle.\r
+  @retval other               Failed to open specified protocol on this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -795,19 +817,15 @@ ConSplitterSupported (
   //\r
   // Make sure the Console Splitter does not attempt to attach to itself\r
   //\r
-  if (ControllerHandle == mConIn.VirtualHandle) {\r
+  if (ControllerHandle == mConIn.VirtualHandle  ||\r
+      ControllerHandle == mConOut.VirtualHandle ||\r
+      ControllerHandle == mStdErr.VirtualHandle \r
+      ) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
-  if (ControllerHandle == mConOut.VirtualHandle) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  if (ControllerHandle == mStdErr.VirtualHandle) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
   //\r
-  // Check to see whether the handle has the ConsoleInDevice GUID on it\r
+  // Check to see whether the specific protocol could be opened BY_DRIVER\r
   //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
@@ -833,9 +851,9 @@ ConSplitterSupported (
 }\r
 \r
 /**\r
-  Test to see if Console In Device could be supported on the ControllerHandle\r
+  Test to see if Console In Device could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -860,9 +878,9 @@ ConSplitterConInDriverBindingSupported (
 }\r
 \r
 /**\r
-  Test to see if Simple Pointer protocol could be supported on the ControllerHandle\r
+  Test to see if Simple Pointer protocol could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -886,11 +904,10 @@ ConSplitterSimplePointerDriverBindingSupported (
           );\r
 }\r
 \r
-\r
 /**\r
-  Test to see if Absolute Pointer protocol could be supported on the ControllerHandle\r
+  Test to see if Absolute Pointer protocol could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -916,9 +933,9 @@ ConSplitterAbsolutePointerDriverBindingSupported (
 \r
 \r
 /**\r
-  Test to see if Console Out Device could be supported on the ControllerHandle\r
+  Test to see if Console Out Device could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -943,9 +960,9 @@ ConSplitterConOutDriverBindingSupported (
 }\r
 \r
 /**\r
-  Test to see if Standard Error Device could be supported on the ControllerHandle\r
+  Test to see if Standard Error Device could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -974,7 +991,7 @@ ConSplitterStdErrDriverBindingSupported (
   Start ConSplitter on devcie handle by opening Console Device Guid on device handle \r
   and the console virtual handle. And Get the console interface on controller handle.\r
   \r
-  @param  This                      Protocol instance pointer.\r
+  @param  This                      Driver Binding protocol instance pointer.\r
   @param  ControllerHandle          Handle of device.\r
   @param  ConSplitterVirtualHandle  Console virtual Handle.\r
   @param  DeviceGuid                The specified Console Device, such as ConInDev,\r
@@ -1001,7 +1018,7 @@ ConSplitterStart (
   VOID        *Instance;\r
 \r
   //\r
-  // Check to see whether the ControllerHandle has the InterfaceGuid on it.\r
+  // Check to see whether the ControllerHandle has the DeviceGuid on it.\r
   //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
@@ -1014,7 +1031,10 @@ ConSplitterStart (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-\r
\r
+  //\r
+  // Create virtual handle and open DeviceGuid on the virtul handle.\r
+  //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
                   DeviceGuid,\r
@@ -1024,10 +1044,13 @@ ConSplitterStart (
                   EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    goto Err;\r
   }\r
 \r
-  return gBS->OpenProtocol (\r
+  //\r
+  // Open InterfaceGuid on the virtul handle.\r
+  //\r
+  Status =  gBS->OpenProtocol (\r
                 ControllerHandle,\r
                 InterfaceGuid,\r
                 Interface,\r
@@ -1035,13 +1058,40 @@ ConSplitterStart (
                 ConSplitterVirtualHandle,\r
                 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
                 );\r
+\r
+  if (!EFI_ERROR (Status)) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  //\r
+  // close the DeviceGuid on ConSplitter VirtualHandle.\r
+  //\r
+  gBS->CloseProtocol (\r
+        ControllerHandle,\r
+        DeviceGuid,\r
+        This->DriverBindingHandle,\r
+        ConSplitterVirtualHandle\r
+        );\r
+\r
+Err:\r
+  //\r
+  // close the DeviceGuid on ControllerHandle.\r
+  //\r
+  gBS->CloseProtocol (\r
+        ControllerHandle,\r
+        DeviceGuid,\r
+        This->DriverBindingHandle,\r
+        ControllerHandle\r
+        );\r
+\r
+  return Status;\r
 }\r
 \r
 \r
 /**\r
   Start Console In Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -1109,7 +1159,7 @@ ConSplitterConInDriverBindingStart (
 /**\r
   Start Simple Pointer Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -1155,7 +1205,7 @@ ConSplitterSimplePointerDriverBindingStart (
 /**\r
   Start Absolute Pointer Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -1202,7 +1252,7 @@ ConSplitterAbsolutePointerDriverBindingStart (
 /**\r
   Start Console Out Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -1302,7 +1352,7 @@ ConSplitterConOutDriverBindingStart (
 /**\r
   Start Standard Error Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -1435,7 +1485,7 @@ ConSplitterStop (
 /**\r
   Stop Console In ConSplitter on ControllerHandle by closing Console In Devcice GUID.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -1507,7 +1557,7 @@ ConSplitterConInDriverBindingStop (
   Stop Simple Pointer protocol ConSplitter on ControllerHandle by closing\r
   Simple Pointer protocol.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -1559,7 +1609,7 @@ ConSplitterSimplePointerDriverBindingStop (
   Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing\r
   Absolute Pointer protocol.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -1610,7 +1660,7 @@ ConSplitterAbsolutePointerDriverBindingStop (
 /**\r
   Stop Console Out ConSplitter on device handle by closing Console Out Devcice GUID.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -1661,7 +1711,7 @@ ConSplitterConOutDriverBindingStop (
 /**\r
   Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -1733,12 +1783,12 @@ ConSplitterStdErrDriverBindingStop (
   bytes. Copy the current data in Buffer to the new version of Buffer\r
   and free the old version of buffer.\r
 \r
-  @param  SizeOfCount              Size of element in array\r
-  @param  Count                    Current number of elements in array\r
+  @param  SizeOfCount              Size of element in array.\r
+  @param  Count                    Current number of elements in array.\r
   @param  Buffer                   Bigger version of passed in Buffer with all the\r
-                                   data\r
+                                   data.\r
 \r
-  @retval EFI_SUCCESS              Buffer size has grown\r
+  @retval EFI_SUCCESS              Buffer size has grown.\r
   @retval EFI_OUT_OF_RESOURCES     Could not grow the buffer size.\r
 \r
 **/\r
@@ -1789,7 +1839,7 @@ ConSplitterTextInAddDevice (
   EFI_STATUS  Status;\r
 \r
   //\r
-  // If the Text In List is full, enlarge it by calling growbuffer().\r
+  // If the Text In List is full, enlarge it by calling ConSplitterGrowBuffer().\r
   //\r
   if (Private->CurrentNumberOfConsoles >= Private->TextInListCount) {\r
     Status = ConSplitterGrowBuffer (\r
@@ -1808,7 +1858,7 @@ ConSplitterTextInAddDevice (
   Private->CurrentNumberOfConsoles++;\r
 \r
   //\r
-  // Extra CheckEvent added to reduce the double CheckEvent() in UI.c\r
+  // Extra CheckEvent added to reduce the double CheckEvent().\r
   //\r
   gBS->CheckEvent (TextIn->WaitForKey);\r
 \r
@@ -1817,7 +1867,7 @@ ConSplitterTextInAddDevice (
 \r
 \r
 /**\r
-  Remove Simple Text Device in Consplitter Absolute Pointer list.\r
+  Remove Text Input Device from Consplitter Text Input list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  TextIn                   Simple Text protocol pointer.\r
@@ -1855,7 +1905,7 @@ ConSplitterTextInDeleteDevice (
   Add Text Input Ex Device in Consplitter Text Input Ex list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
-  @param  TextInEx                 Simple Text Ex Input protocol pointer.\r
+  @param  TextInEx                 Simple Text Input Ex Input protocol pointer.\r
 \r
   @retval EFI_SUCCESS              Text Input Ex Device added successfully.\r
   @retval EFI_OUT_OF_RESOURCES     Could not grow the buffer size.\r
@@ -1870,7 +1920,7 @@ ConSplitterTextInExAddDevice (
   EFI_STATUS  Status;\r
 \r
   //\r
-  // If the TextInEx List is full, enlarge it by calling growbuffer().\r
+  // If the Text Input Ex List is full, enlarge it by calling ConSplitterGrowBuffer().\r
   //\r
   if (Private->CurrentNumberOfExConsoles >= Private->TextInExListCount) {\r
     Status = ConSplitterGrowBuffer (\r
@@ -1883,13 +1933,13 @@ ConSplitterTextInExAddDevice (
     }\r
   }\r
   //\r
-  // Add the new text-in device data structure into the Text In List.\r
+  // Add the new text-in device data structure into the Text Input Ex List.\r
   //\r
   Private->TextInExList[Private->CurrentNumberOfExConsoles] = TextInEx;\r
   Private->CurrentNumberOfExConsoles++;\r
 \r
   //\r
-  // Extra CheckEvent added to reduce the double CheckEvent() in UI.c\r
+  // Extra CheckEvent added to reduce the double CheckEvent().\r
   //\r
   gBS->CheckEvent (TextInEx->WaitForKeyEx);\r
 \r
@@ -1897,13 +1947,13 @@ ConSplitterTextInExAddDevice (
 }\r
 \r
 /**\r
-  Remove Simple Text Ex Device in Consplitter Absolute Pointer list.\r
+  Remove Text Ex Device from Consplitter Text Input Ex list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  TextInEx                 Simple Text Ex protocol pointer.\r
 \r
-  @retval EFI_SUCCESS              Simple Text Ex Device removed successfully.\r
-  @retval EFI_NOT_FOUND            No Simple Text Ex Device found.\r
+  @retval EFI_SUCCESS              Simple Text Input Ex Device removed successfully.\r
+  @retval EFI_NOT_FOUND            No Simple Text Input Ex Device found.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1914,7 +1964,7 @@ ConSplitterTextInExDeleteDevice (
 {\r
   UINTN Index;\r
   //\r
-  // Remove the specified text-in device data structure from the Text In List,\r
+  // Remove the specified text-in device data structure from the Text Input Ex List,\r
   // and rearrange the remaining data structures in the Text In List.\r
   //\r
   for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
@@ -1951,7 +2001,7 @@ ConSplitterSimplePointerAddDevice (
   EFI_STATUS  Status;\r
 \r
   //\r
-  // If the Text In List is full, enlarge it by calling growbuffer().\r
+  // If the Simple Pointer List is full, enlarge it by calling ConSplitterGrowBuffer().\r
   //\r
   if (Private->CurrentNumberOfPointers >= Private->PointerListCount) {\r
     Status = ConSplitterGrowBuffer (\r
@@ -1964,16 +2014,17 @@ ConSplitterSimplePointerAddDevice (
     }\r
   }\r
   //\r
-  // Add the new text-in device data structure into the Text In List.\r
+  // Add the new text-in device data structure into the Simple Pointer List.\r
   //\r
   Private->PointerList[Private->CurrentNumberOfPointers] = SimplePointer;\r
   Private->CurrentNumberOfPointers++;\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  Remove Simple Pointer Device in Consplitter Absolute Pointer list.\r
+  Remove Simple Pointer Device from Consplitter Simple Pointer list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  SimplePointer            Simple Pointer protocol pointer.\r
@@ -1990,7 +2041,7 @@ ConSplitterSimplePointerDeleteDevice (
 {\r
   UINTN Index;\r
   //\r
-  // Remove the specified text-in device data structure from the Text In List,\r
+  // Remove the specified text-in device data structure from the Simple Pointer List,\r
   // and rearrange the remaining data structures in the Text In List.\r
   //\r
   for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {\r
@@ -2027,7 +2078,7 @@ ConSplitterAbsolutePointerAddDevice (
   EFI_STATUS  Status;\r
 \r
   //\r
-  // If the Absolute Pointer List is full, enlarge it by calling growbuffer().\r
+  // If the Absolute Pointer List is full, enlarge it by calling ConSplitterGrowBuffer().\r
   //\r
   if (Private->CurrentNumberOfAbsolutePointers >= Private->AbsolutePointerListCount) {\r
     Status = ConSplitterGrowBuffer (\r
@@ -2040,16 +2091,17 @@ ConSplitterAbsolutePointerAddDevice (
     }\r
   }\r
   //\r
-  // Add the new text-in device data structure into the Text In List.\r
+  // Add the new text-in device data structure into the Absolute Pointer List.\r
   //\r
   Private->AbsolutePointerList[Private->CurrentNumberOfAbsolutePointers] = AbsolutePointer;\r
   Private->CurrentNumberOfAbsolutePointers++;\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  Remove Absolute Pointer Device in Consplitter Absolute Pointer list.\r
+  Remove Absolute Pointer Device from Consplitter Absolute Pointer list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  AbsolutePointer          Absolute Pointer protocol pointer.\r
@@ -2066,8 +2118,8 @@ ConSplitterAbsolutePointerDeleteDevice (
 {\r
   UINTN Index;\r
   //\r
-  // Remove the specified text-in device data structure from the Text In List,\r
-  // and rearrange the remaining data structures in the Text In List.\r
+  // Remove the specified text-in device data structure from the Absolute Pointer List,\r
+  // and rearrange the remaining data structures from the Absolute Pointer List.\r
   //\r
   for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {\r
     if (Private->AbsolutePointerList[Index] == AbsolutePointer) {\r
@@ -2086,6 +2138,8 @@ ConSplitterAbsolutePointerDeleteDevice (
 /**\r
   Reallocate Text Out mode map.\r
 \r
+  Allocate new buffer and copy original buffer into the new buffer.\r
+\r
   @param  Private                  Consplitter Text Out pointer.\r
 \r
   @retval EFI_SUCCESS              Buffer size has grown\r
@@ -2107,9 +2161,12 @@ ConSplitterGrowMapTable (
 \r
   NewSize           = Private->TextOutListCount * sizeof (INT32);\r
   OldTextOutModeMap = Private->TextOutModeMap;\r
-  TotalSize         = NewSize * Private->TextOutQueryDataCount;\r
+  TotalSize         = NewSize * (Private->TextOutQueryDataCount);\r
 \r
-  TextOutModeMap    = AllocateZeroPool (TotalSize);\r
+  //\r
+  // Allocate new buffer for Text Out List.\r
+  //\r
+  TextOutModeMap    = AllocatePool (TotalSize);\r
   if (TextOutModeMap == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -2159,7 +2216,7 @@ ConSplitterGrowMapTable (
 \r
 \r
 /**\r
-  Add the device's output mode to console splitter's mode list.\r
+  Add new 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
@@ -2243,24 +2300,25 @@ ConSplitterAddOutputMode (
   @param TextOutModeMap  Current text out mode map, begin with the mode 80x25\r
   @param NewlyAddedMap   New text out mode map, begin with the mode 80x25\r
   @param MapStepSize     Mode step size for one console device\r
-  @param NewMapStepSize  Mode step size for one console device\r
-  @param MaxMode         Current max text mode\r
-  @param CurrentMode     Current text mode\r
+  @param NewMapStepSize  New Mode step size for one console device\r
+  @param MaxMode         IN: Current max text mode, OUT: Updated max text mode.\r
+  @param CurrentMode     IN: Current text mode,     OUT: Updated current text mode.\r
 \r
 **/\r
 VOID\r
 ConSplitterGetIntersection (\r
-  IN  INT32                           *TextOutModeMap,\r
-  IN  INT32                           *NewlyAddedMap,\r
-  IN  UINTN                           MapStepSize,\r
-  IN  UINTN                           NewMapStepSize,\r
-  OUT INT32                           *MaxMode,\r
-  OUT INT32                           *CurrentMode\r
+  IN     INT32                        *TextOutModeMap,\r
+  IN     INT32                        *NewlyAddedMap,\r
+  IN     UINTN                        MapStepSize,\r
+  IN     UINTN                        NewMapStepSize,\r
+  IN OUT INT32                        *MaxMode,\r
+  IN OUT INT32                        *CurrentMode\r
   )\r
 {\r
   INT32 Index;\r
   INT32 *CurrentMapEntry;\r
   INT32 *NextMapEntry;\r
+  INT32 *NewMapEntry;\r
   INT32 CurrentMaxMode;\r
   INT32 Mode;\r
 \r
@@ -2271,14 +2329,14 @@ ConSplitterGetIntersection (
   //\r
   Index           = 2;\r
   CurrentMapEntry = &TextOutModeMap[MapStepSize * 2];\r
-  NextMapEntry    = &TextOutModeMap[MapStepSize * 2];\r
-  NewlyAddedMap   = &NewlyAddedMap[NewMapStepSize * 2];\r
+  NextMapEntry    = CurrentMapEntry;\r
+  NewMapEntry     = &NewlyAddedMap[NewMapStepSize * 2];\r
 \r
   CurrentMaxMode  = *MaxMode;\r
   Mode            = *CurrentMode;\r
 \r
   while (Index < CurrentMaxMode) {\r
-    if (*NewlyAddedMap == -1) {\r
+    if (*NewMapEntry == -1) {\r
       //\r
       // This mode is not supported any more. Remove it. Special care\r
       // must be taken as this remove will also affect current mode;\r
@@ -2298,7 +2356,7 @@ ConSplitterGetIntersection (
     }\r
 \r
     CurrentMapEntry += MapStepSize;\r
-    NewlyAddedMap += NewMapStepSize;\r
+    NewMapEntry     += NewMapStepSize;\r
     Index++;\r
   }\r
 \r
@@ -2307,15 +2365,12 @@ ConSplitterGetIntersection (
   return ;\r
 }\r
 \r
-\r
 /**\r
   Add 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
   \r
-  @return None\r
-\r
 **/\r
 VOID\r
 ConSplitterSyncOutputMode (\r
@@ -2350,8 +2405,13 @@ ConSplitterSyncOutputMode (
   MapTable  = TextOutModeMap + Private->CurrentNumberOfConsoles;\r
   while (Mode < TextOut->Mode->MaxMode) {\r
     Status = TextOut->QueryMode (TextOut, Mode, &Columns, &Rows);\r
+\r
     if (EFI_ERROR(Status)) {\r
       if (Mode == 1) {\r
+        //\r
+        // If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData\r
+        // is clear to 0x0.\r
+        //\r
         MapTable[StepSize] = Mode;\r
         TextOutQueryData[Mode].Columns = 0;\r
         TextOutQueryData[Mode].Rows = 0;\r
@@ -2369,10 +2429,8 @@ ConSplitterSyncOutputMode (
         MapTable[Index * StepSize] = Mode;\r
         break;\r
       }\r
-\r
       Index++;\r
     }\r
-\r
     Mode++;\r
   }\r
   //\r
@@ -2530,6 +2588,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr (
     &(mConOut.TextOutMode.MaxMode),\r
     &(mConOut.TextOutMode.Mode)\r
     );\r
+\r
   if (mConOut.TextOutMode.Mode < 0) {\r
     mConOut.TextOut.SetMode (&(mConOut.TextOut), 0);\r
   }\r
@@ -2542,6 +2601,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr (
     &(mStdErr.TextOutMode.MaxMode),\r
     &(mStdErr.TextOutMode.Mode)\r
     );\r
+\r
   if (mStdErr.TextOutMode.Mode < 0) {\r
     mStdErr.TextOut.SetMode (&(mStdErr.TextOut), 0);\r
   }\r
@@ -2554,7 +2614,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr (
 \r
 \r
 /**\r
-  Add GOP or UGA output mode into Consplitter Text Out list.\r
+  Add display (GOP or UGA) output modes into Consplitter Text Out list.\r
 \r
   @param  Private               Text Out Splitter pointer.\r
   @param  GraphicsOutput        Graphics Output protocol pointer.\r
@@ -2565,7 +2625,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr (
 \r
 **/\r
 EFI_STATUS\r
-ConSplitterAddGraphicsOutputMode (\r
+ConSplitterAddDisplayOutputMode (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private,\r
   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL    *GraphicsOutput,\r
   IN  EFI_UGA_DRAW_PROTOCOL           *UgaDraw\r
@@ -2621,7 +2681,7 @@ ConSplitterAddGraphicsOutputMode (
         //\r
         // Allocate resource for the private mode buffer\r
         //\r
-        ModeBuffer = AllocatePool (GraphicsOutput->Mode->SizeOfInfo * GraphicsOutput->Mode->MaxMode);\r
+        ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * GraphicsOutput->Mode->MaxMode);\r
         if (ModeBuffer == NULL) {\r
           return EFI_OUT_OF_RESOURCES;\r
         }\r
@@ -2633,10 +2693,14 @@ ConSplitterAddGraphicsOutputMode (
         //\r
         Mode = ModeBuffer;\r
         for (Index = 0; Index < GraphicsOutput->Mode->MaxMode; Index++) {\r
+          //\r
+          // The Info buffer would be allocated by callee\r
+          //\r
           Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) Index, &SizeOfInfo, &Info);\r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
+          ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
           CopyMem (Mode, Info, SizeOfInfo);\r
           Mode++;\r
           FreePool (Info);\r
@@ -2656,12 +2720,19 @@ ConSplitterAddGraphicsOutputMode (
         Match = FALSE;\r
 \r
         for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) {\r
+          //\r
+          // The Info buffer would be allocated by callee\r
+          //\r
           Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
           if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&\r
               (Info->VerticalResolution == Mode->VerticalResolution)) {\r
+            //\r
+            // If GOP device supports one mode in current mode buffer, \r
+            // it will be added into matched mode buffer\r
+            //\r
             Match = TRUE;\r
             FreePool (Info);\r
             break;\r
@@ -2671,7 +2742,10 @@ ConSplitterAddGraphicsOutputMode (
 \r
         if (Match) {\r
           AlreadyExist = FALSE;\r
-\r
+          \r
+          //\r
+          // Check if GOP mode has been in the mode buffer, ModeBuffer = MatchedMode at begin.\r
+          //\r
           for (Info = ModeBuffer; Info < MatchedMode; Info++) {\r
             if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&\r
                 (Info->VerticalResolution == Mode->VerticalResolution)) {\r
@@ -2795,11 +2869,10 @@ Done:
   // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.\r
   //\r
   Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);\r
-\r
-  //\r
-  // If user defined mode is not valid for UGA, set to the default mode 800x600.\r
-  //\r
   if (EFI_ERROR(Status)) {\r
+    //\r
+    // If user defined mode is not valid for display device, set to the default mode 800x600.\r
+    //\r
     (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;\r
     (Private->GraphicsOutputModeBuffer[0]).VerticalResolution   = 600;\r
     Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);\r
@@ -2816,8 +2889,6 @@ Done:
 \r
   @param  Private            Consplitter Text Out pointer.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 ConsplitterSetConsoleOutMode (\r
@@ -2942,7 +3013,7 @@ ConSplitterTextOutAddDevice (
   CurrentNumOfConsoles  = Private->CurrentNumberOfConsoles;\r
 \r
   //\r
-  // If the Text Out List is full, enlarge it by calling growbuffer().\r
+  // If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer().\r
   //\r
   while (CurrentNumOfConsoles >= Private->TextOutListCount) {\r
     Status = ConSplitterGrowBuffer (\r
@@ -3007,7 +3078,7 @@ ConSplitterTextOutAddDevice (
   //\r
   if (FeaturePcdGet (PcdConOutGopSupport)) {\r
     if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {\r
-      ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);\r
+      ConSplitterAddDisplayOutputMode (Private, GraphicsOutput, UgaDraw);\r
     }\r
   }\r
   if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
@@ -3265,13 +3336,10 @@ ConSplitterTextInPrivateReadKeyStroke (
   return EFI_NOT_READY;\r
 }\r
 \r
-\r
 /**\r
   Return TRUE if StdIn is locked. The ConIn device on the virtual handle is\r
   the only device locked.\r
 \r
-  NONE\r
-\r
   @retval TRUE                     StdIn locked\r
   @retval FALSE                    StdIn working normally\r
 \r
@@ -3294,9 +3362,6 @@ ConSpliterConssoleControlStdInLocked (
   @param  Event                  The Event this notify function registered to.\r
   @param  Context                Pointer to the context data registerd to the\r
                                  Event.\r
-\r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -3457,8 +3522,6 @@ ConSplitterTextInReadKeyStroke (
   @param  Event                    The Event assoicated with callback.\r
   @param  Context                  Context registered when Event was created.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -3760,12 +3823,7 @@ ConSplitterTextInRegisterKeyNotify (
   // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.\r
   //\r
   for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
-    CurrentNotify = CR (\r
-                      Link,\r
-                      TEXT_IN_EX_SPLITTER_NOTIFY,\r
-                      NotifyEntry,\r
-                      TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE\r
-                      );\r
+    CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
     if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {\r
       if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {\r
         *NotifyHandle = CurrentNotify->NotifyHandle;\r
@@ -3881,7 +3939,7 @@ ConSplitterTextInUnregisterKeyNotify (
   }\r
 \r
   for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
-    CurrentNotify = CR (Link, TEXT_IN_EX_SPLITTER_NOTIFY, NotifyEntry, TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE);\r
+    CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
     if (CurrentNotify->NotifyHandle == NotificationHandle) {\r
       for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
         Status = Private->TextInExList[Index]->UnregisterKeyNotify (\r
@@ -4081,8 +4139,6 @@ ConSplitterSimplePointerGetState (
   @param  Event                    The Event assoicated with callback.\r
   @param  Context                  Context registered when Event was created.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -4261,8 +4317,6 @@ ConSplitterAbsolutePointerGetState (
   @param  Event                    The Event assoicated with callback.\r
   @param  Context                  Context registered when Event was created.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
index f9601fc194c408361afde99a5ed23ae39bef6a69..db1212b83560b60fa41057f1f662a29b872d7723 100644 (file)
@@ -16,21 +16,27 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define _CON_SPLITTER_H_\r
 \r
 #include <Uefi.h>\r
-#include <Guid/PrimaryStandardErrorDevice.h>\r
-#include <Guid/PrimaryConsoleOutDevice.h>\r
-#include <Protocol/GraphicsOutput.h>\r
-#include <Guid/PrimaryConsoleInDevice.h>\r
-#include <Guid/GenericPlatformVariable.h>\r
+\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/ConsoleControl.h>\r
 #include <Protocol/SimplePointer.h>\r
 #include <Protocol/AbsolutePointer.h>\r
 #include <Protocol/SimpleTextOut.h>\r
-#include <Guid/ConsoleInDevice.h>\r
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/SimpleTextInEx.h>\r
-#include <Protocol/ConsoleControl.h>\r
+#include <Protocol/GraphicsOutput.h>\r
+#include <Protocol/UgaDraw.h>\r
+\r
+#include <Guid/PrimaryStandardErrorDevice.h>\r
+#include <Guid/PrimaryConsoleOutDevice.h>\r
+#include <Guid/PrimaryConsoleInDevice.h>\r
+#include <Guid/GenericPlatformVariable.h>\r
+#include <Guid/ConsoleInDevice.h>\r
 #include <Guid/StandardErrorDevice.h>\r
 #include <Guid/ConsoleOutDevice.h>\r
-#include <Protocol/UgaDraw.h>\r
+\r
 #include <Library/PcdLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -63,8 +69,10 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2;
 \r
 extern EFI_GUID                     gSimpleTextInExNotifyGuid;\r
 \r
+//\r
 // These definitions were in the old Hii protocol, but are not in the new UEFI\r
 // version. So they are defined locally.\r
+//\r
 #define UNICODE_NARROW_CHAR   0xFFF0\r
 #define UNICODE_WIDE_CHAR     0xFFF1\r
 \r
@@ -88,13 +96,12 @@ typedef struct {
   UINTN Rows;\r
 } TEXT_OUT_SPLITTER_QUERY_DATA;\r
 \r
-//\r
-// Private data for the EFI_SIMPLE_TEXT_INPUT_PROTOCOL splitter\r
-//\r
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'p')\r
 \r
-#define TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'n')\r
+#define TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE    SIGNATURE_32 ('T', 'i', 'S', 'n')\r
 \r
+//\r
+// Private data for Text In Ex Splitter Notify\r
+//\r
 typedef struct _TEXT_IN_EX_SPLITTER_NOTIFY {\r
   UINTN                                 Signature;\r
   EFI_HANDLE                            *NotifyHandleList;\r
@@ -104,6 +111,18 @@ typedef struct _TEXT_IN_EX_SPLITTER_NOTIFY {
   LIST_ENTRY                            NotifyEntry;\r
 } TEXT_IN_EX_SPLITTER_NOTIFY;\r
 \r
+#define TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS(a)  \\r
+  CR ((a),                                       \\r
+      TEXT_IN_EX_SPLITTER_NOTIFY,                \\r
+      NotifyEntry,                               \\r
+      TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE       \\r
+      )\r
+\r
+#define TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'p')\r
+\r
+//\r
+// Private data for the Console In splitter\r
+//\r
 typedef struct {\r
   UINT64                             Signature;\r
   EFI_HANDLE                         VirtualHandle;\r
@@ -144,35 +163,33 @@ typedef struct {
 } TEXT_IN_SPLITTER_PRIVATE_DATA;\r
 \r
 #define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS(a)  \\r
-  CR ((a),                                            \\r
+  CR ((a),                                          \\r
       TEXT_IN_SPLITTER_PRIVATE_DATA,                \\r
       TextIn,                                       \\r
       TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE       \\r
       )\r
 \r
 #define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS(a) \\r
-  CR ((a),                                                          \\r
+  CR ((a),                                                        \\r
       TEXT_IN_SPLITTER_PRIVATE_DATA,                              \\r
       SimplePointer,                                              \\r
       TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE                     \\r
       )\r
 #define TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
-  CR (a, \\r
-      TEXT_IN_SPLITTER_PRIVATE_DATA, \\r
-      TextInEx, \\r
-      TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
+  CR (a,                                              \\r
+      TEXT_IN_SPLITTER_PRIVATE_DATA,                  \\r
+      TextInEx,                                       \\r
+      TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE         \\r
       )\r
 \r
 #define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS(a) \\r
-  CR (a, \\r
-      TEXT_IN_SPLITTER_PRIVATE_DATA, \\r
-      AbsolutePointer, \\r
-      TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
+  CR (a,                                                            \\r
+      TEXT_IN_SPLITTER_PRIVATE_DATA,                                \\r
+      AbsolutePointer,                                              \\r
+      TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE                       \\r
       )\r
 \r
-//\r
-// Private data for the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL splitter\r
-//\r
+\r
 #define TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('T', 'o', 'S', 'p')\r
 \r
 typedef struct {\r
@@ -182,6 +199,9 @@ typedef struct {
   BOOLEAN                          TextOutEnabled;\r
 } TEXT_OUT_AND_GOP_DATA;\r
 \r
+//\r
+// Private data for the Console Out splitter\r
+//\r
 typedef struct {\r
   UINT64                                Signature;\r
   EFI_HANDLE                            VirtualHandle;\r
@@ -221,28 +241,28 @@ typedef struct {
 } TEXT_OUT_SPLITTER_PRIVATE_DATA;\r
 \r
 #define TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
-  CR ((a),                                            \\r
+  CR ((a),                                          \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA,               \\r
       TextOut,                                      \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE      \\r
       )\r
 \r
 #define GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a)  \\r
-  CR ((a),                                                    \\r
+  CR ((a),                                                  \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA,                       \\r
       GraphicsOutput,                                       \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE              \\r
       )\r
 \r
 #define UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
-  CR ((a),                                            \\r
+  CR ((a),                                          \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA,               \\r
       UgaDraw,                                      \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE      \\r
       )\r
 \r
 #define CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS(a)  \\r
-  CR ((a),                                                    \\r
+  CR ((a),                                                  \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA,                       \\r
       ConsoleControl,                                       \\r
       TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE              \\r
@@ -281,19 +301,19 @@ ConSplitterDriverEntry (
                                    structure.\r
 \r
   @retval EFI_OUT_OF_RESOURCES     Out of resources.\r
-  @retval EFI_SUCCESS              Console Input Devcie's private data has been constructed.\r
+  @retval EFI_SUCCESS              Text Input Devcie's private data has been constructed.\r
   @retval other                    Failed to construct private data.\r
 \r
 **/\r
 EFI_STATUS\r
 ConSplitterTextInConstructor (\r
-  TEXT_IN_SPLITTER_PRIVATE_DATA       *Private\r
+  TEXT_IN_SPLITTER_PRIVATE_DATA       *ConInPrivate\r
   );\r
 \r
 /**\r
   Construct console output devices' private data.\r
 \r
-  @param  ConOutPrivate            A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA\r
+  @param  ConOutPrivate            A pointer to the TEXT_OUT_SPLITTER_PRIVATE_DATA\r
                                    structure.\r
 \r
   @retval EFI_OUT_OF_RESOURCES     Out of resources.\r
@@ -302,7 +322,7 @@ ConSplitterTextInConstructor (
 **/\r
 EFI_STATUS\r
 ConSplitterTextOutConstructor (\r
-  TEXT_OUT_SPLITTER_PRIVATE_DATA      *Private\r
+  TEXT_OUT_SPLITTER_PRIVATE_DATA      *ConOutPrivate\r
   );\r
 \r
 //\r
@@ -310,9 +330,9 @@ ConSplitterTextOutConstructor (
 //\r
 \r
 /**\r
-  Test to see if Console In Device could be supported on the ControllerHandle\r
+  Test to see if Console In Device could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -330,9 +350,9 @@ ConSplitterConInDriverBindingSupported (
   );\r
 \r
 /**\r
-  Test to see if Simple Pointer protocol could be supported on the ControllerHandle\r
+  Test to see if Simple Pointer protocol could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -350,9 +370,9 @@ ConSplitterSimplePointerDriverBindingSupported (
   );\r
 \r
 /**\r
-  Test to see if Console Out Device could be supported on the ControllerHandle\r
+  Test to see if Console Out Device could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -370,9 +390,9 @@ ConSplitterConOutDriverBindingSupported (
   );\r
 \r
 /**\r
-  Test to see if Standard Error Device could be supported on the ControllerHandle\r
+  Test to see if Standard Error Device could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -392,7 +412,7 @@ ConSplitterStdErrDriverBindingSupported (
 /**\r
   Start Console In Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -412,7 +432,7 @@ ConSplitterConInDriverBindingStart (
 /**\r
   Start Simple Pointer Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -432,7 +452,7 @@ ConSplitterSimplePointerDriverBindingStart (
 /**\r
   Start Console Out Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -452,7 +472,7 @@ ConSplitterConOutDriverBindingStart (
 /**\r
   Start Standard Error Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -472,7 +492,7 @@ ConSplitterStdErrDriverBindingStart (
 /**\r
   Stop Console In ConSplitter on ControllerHandle by closing Console In Devcice GUID.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -495,7 +515,7 @@ ConSplitterConInDriverBindingStop (
   Stop Simple Pointer protocol ConSplitter on ControllerHandle by closing\r
   Simple Pointer protocol.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -515,9 +535,9 @@ ConSplitterSimplePointerDriverBindingStop (
   );\r
 \r
 /**\r
-  Stop Console Out ConSplitter on ControllerHandle by closing Console Out Devcice GUID.\r
+  Stop Console Out ConSplitter on device handle by closing Console Out Devcice GUID.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -539,7 +559,7 @@ ConSplitterConOutDriverBindingStop (
 /**\r
   Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -560,9 +580,9 @@ ConSplitterStdErrDriverBindingStop (
 \r
 \r
 /**\r
-  Test to see if Absolute Pointer protocol could be supported on the ControllerHandle\r
+  Test to see if Absolute Pointer protocol could be supported on the Controller. \r
 \r
-  @param  This                Protocol instance pointer.\r
+  @param  This                Driver Binding protocol instance pointer.\r
   @param  ControllerHandle    Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
@@ -582,7 +602,7 @@ ConSplitterAbsolutePointerDriverBindingSupported (
 /**\r
   Start Absolute Pointer Consplitter on device handle. \r
   \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Driver Binding protocol instance pointer.\r
   @param  ControllerHandle     Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
@@ -603,7 +623,7 @@ ConSplitterAbsolutePointerDriverBindingStart (
   Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing\r
   Absolute Pointer protocol.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Driver Binding protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
@@ -639,7 +659,7 @@ ConSplitterAbsolutePointerAddDevice (
   );\r
 \r
 /**\r
-  Remove Absolute Pointer Device in Consplitter Absolute Pointer list.\r
+  Remove Absolute Pointer Device from Consplitter Absolute Pointer list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  AbsolutePointer          Absolute Pointer protocol pointer.\r
@@ -710,8 +730,6 @@ ConSplitterAbsolutePointerGetState (
   @param  Event                    The Event assoicated with callback.\r
   @param  Context                  Context registered when Event was created.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -1153,12 +1171,12 @@ ConSplitterStdErrComponentNameGetControllerName (
 **/\r
 EFI_STATUS\r
 ConSplitterTextInAddDevice (\r
-  IN  TEXT_IN_SPLITTER_PRIVATE_DATA      *Private,\r
-  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL     *TextIn\r
+  IN  TEXT_IN_SPLITTER_PRIVATE_DATA   *Private,\r
+  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *TextIn\r
   );\r
 \r
 /**\r
-  Remove Simple Text Device in Consplitter Absolute Pointer list.\r
+  Remove Text Input Device from Consplitter Text Input list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  TextIn                   Simple Text protocol pointer.\r
@@ -1169,8 +1187,8 @@ ConSplitterTextInAddDevice (
 **/\r
 EFI_STATUS\r
 ConSplitterTextInDeleteDevice (\r
-  IN  TEXT_IN_SPLITTER_PRIVATE_DATA      *Private,\r
-  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL     *TextIn\r
+  IN  TEXT_IN_SPLITTER_PRIVATE_DATA   *Private,\r
+  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *TextIn\r
   );\r
 \r
 //\r
@@ -1194,7 +1212,7 @@ ConSplitterSimplePointerAddDevice (
   );\r
 \r
 /**\r
-  Remove Simple Pointer Device in Consplitter Absolute Pointer list.\r
+  Remove Simple Pointer Device from Consplitter Simple Pointer list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  SimplePointer            Simple Pointer protocol pointer.\r
@@ -1267,8 +1285,8 @@ ConSplitterTextOutDeleteDevice (
 EFI_STATUS\r
 EFIAPI\r
 ConSplitterTextInReset (\r
-  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL     *This,\r
-  IN  BOOLEAN                            ExtendedVerification\r
+  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *This,\r
+  IN  BOOLEAN                         ExtendedVerification\r
   );\r
 \r
 /**\r
@@ -1288,15 +1306,15 @@ ConSplitterTextInReset (
 EFI_STATUS\r
 EFIAPI\r
 ConSplitterTextInReadKeyStroke (\r
-  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL     *This,\r
-  OUT EFI_INPUT_KEY                      *Key\r
+  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *This,\r
+  OUT EFI_INPUT_KEY                   *Key\r
   );\r
 \r
 /**\r
   Add Text Input Ex Device in Consplitter Text Input Ex list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
-  @param  TextInEx                 Simple Text Ex Input protocol pointer.\r
+  @param  TextInEx                 Simple Text Input Ex Input protocol pointer.\r
 \r
   @retval EFI_SUCCESS              Text Input Ex Device added successfully.\r
   @retval EFI_OUT_OF_RESOURCES     Could not grow the buffer size.\r
@@ -1309,13 +1327,13 @@ ConSplitterTextInExAddDevice (
   );\r
 \r
 /**\r
-  Remove Simple Text Ex Device in Consplitter Absolute Pointer list.\r
+  Remove Text Ex Device from Consplitter Text Input Ex list.\r
 \r
   @param  Private                  Text In Splitter pointer.\r
   @param  TextInEx                 Simple Text Ex protocol pointer.\r
 \r
-  @retval EFI_SUCCESS              Simple Text Ex Device removed successfully.\r
-  @retval EFI_NOT_FOUND            No Simple Text Ex Device found.\r
+  @retval EFI_SUCCESS              Simple Text Input Ex Device removed successfully.\r
+  @retval EFI_NOT_FOUND            No Simple Text Input Ex Device found.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1454,8 +1472,6 @@ ConSplitterTextInUnregisterKeyNotify (
   @param  Event                    The Event assoicated with callback.\r
   @param  Context                  Context registered when Event was created.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -1467,8 +1483,6 @@ ConSplitterTextInWaitForKey (
   Return TRUE if StdIn is locked. The ConIn device on the virtual handle is\r
   the only device locked.\r
 \r
-  NONE\r
-\r
   @retval TRUE                     StdIn locked\r
   @retval FALSE                    StdIn working normally\r
 \r
@@ -1486,9 +1500,6 @@ ConSpliterConssoleControlStdInLocked (
   @param  Event                  The Event this notify function registered to.\r
   @param  Context                Pointer to the context data registerd to the\r
                                  Event.\r
-\r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -1586,8 +1597,6 @@ ConSplitterSimplePointerGetState (
   @param  Event                    The Event assoicated with callback.\r
   @param  Context                  Context registered when Event was created.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -1809,12 +1818,12 @@ ConSplitterTextOutEnableCursor (
   bytes. Copy the current data in Buffer to the new version of Buffer\r
   and free the old version of buffer.\r
 \r
-  @param  SizeOfCount              Size of element in array\r
-  @param  Count                    Current number of elements in array\r
+  @param  SizeOfCount              Size of element in array.\r
+  @param  Count                    Current number of elements in array.\r
   @param  Buffer                   Bigger version of passed in Buffer with all the\r
-                                   data\r
+                                   data.\r
 \r
-  @retval EFI_SUCCESS              Buffer size has grown\r
+  @retval EFI_SUCCESS              Buffer size has grown.\r
   @retval EFI_OUT_OF_RESOURCES     Could not grow the buffer size.\r
 \r
 **/\r
@@ -1832,7 +1841,7 @@ ConSplitterGrowBuffer (
 \r
   @param  This                    Protocol instance pointer.\r
   @param  Mode                    Are we in text of grahics mode.\r
-  @param  GopExists               TRUE if GOP Spliter has found a GOP/UGA device\r
+  @param  GopUgaExists            TRUE if Console Spliter has found a GOP or UGA device\r
   @param  StdInLocked             TRUE if StdIn device is keyboard locked\r
 \r
   @retval EFI_SUCCESS             Mode information returned.\r
@@ -1844,7 +1853,7 @@ EFIAPI
 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
@@ -1888,9 +1897,9 @@ ConSpliterConsoleControlSetMode (
 EFI_STATUS\r
 EFIAPI\r
 ConSpliterGraphicsOutputQueryMode (\r
-  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL        *This,\r
-  IN  UINT32                            ModeNumber,\r
-  OUT UINTN                              *SizeOfInfo,\r
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,\r
+  IN  UINT32                                ModeNumber,\r
+  OUT UINTN                                 *SizeOfInfo,\r
   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info\r
   );\r
 \r
@@ -2080,7 +2089,7 @@ ConSpliterUgaDrawSetMode (
   @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  Height                  Hight of rectangle in BltBuffer in pixels.\r
   @param  Delta                   OPTIONAL.\r
 \r
   @retval EFI_SUCCESS             The Blt operation completed.\r
index 74bc157ad8629b59fd80f68120b6d782fcc8e836..cb068cfa042fcea25a929c471a5255cc42b0801e 100644 (file)
@@ -1,8 +1,9 @@
 #/** @file\r
-# Component description file for ConSplitter module.\r
+# This driver provides multi console supports.\r
 #\r
-# Any Handle that attatched EFI_CONSOLE_IDENTIFIER_PROTOCOL can be bound by this driver.\r
-# Copyright (c) 2006 - 2007, Intel Corporation\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
+# Copyright (c) 2006 - 2008, Intel Corporation\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
index 5d0cb42ae76baa34f292c5cec4467cec5cf70f83..d67fdb2f50a48cd119d5c81c1a42226fd1f58274 100644 (file)
@@ -1465,7 +1465,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