]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
ECC clean up.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / Terminal.c
index a8e4a1a0b21ea6ee271ef1fefd44072526d0b065..2e8ea670097f25cf448659e0b389cc5e12ca7bd9 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
-  Produces Simple Text Input Protocl, Simple Text Input Extended Protocol and\r
+  Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and\r
   Simple Text Output Protocol upon Serial IO Protocol.\r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
@@ -62,30 +62,30 @@ TERMINAL_DEV  mTerminalDevTemplate = {
   },\r
   {   // SimpleTextOutputMode\r
     1,                                           // MaxMode\r
-    0,                                           // Mode?\r
+    0,                                           // Mode\r
     EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK),    // Attribute\r
     0,                                           // CursorColumn\r
     0,                                           // CursorRow\r
     TRUE                                         // CursorVisible\r
   },\r
-  0,\r
-  {\r
+  0,  // SerialInTimeOut\r
+  {   // RawFiFo\r
     0,\r
     0,\r
     { 0 }\r
   },\r
-  {\r
+  {  // UnicodeFiFo\r
     0,\r
     0,\r
     { 0 }\r
   },\r
-  {\r
+  {  // EfiKeyFiFo\r
     0,\r
     0,\r
     { {0} }\r
   },\r
   NULL, // ControllerNameTable\r
-  NULL,\r
+  NULL, // TwoSecondTimeOut\r
   INPUT_STATE_DEFAULT,\r
   RESET_STATE_DEFAULT,\r
   FALSE,\r
@@ -97,29 +97,14 @@ TERMINAL_DEV  mTerminalDevTemplate = {
     TerminalConInRegisterKeyNotify,\r
     TerminalConInUnregisterKeyNotify,\r
   },\r
-  {\r
+  {   // NotifyList\r
     NULL,\r
     NULL,\r
   }\r
 };\r
 \r
-\r
 /**\r
-  Free notify functions list.\r
-\r
-  @param  ListHead               The list head\r
-\r
-  @retval EFI_SUCCESS            Free the notify list successfully.\r
-  @retval EFI_INVALID_PARAMETER  ListHead is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-TerminalFreeNotifyList (\r
-  IN OUT LIST_ENTRY           *ListHead\r
-  );\r
-\r
-/**\r
-  Test to see if this driver supports Controller. \r
+  Test to see if this driver supports Controller.\r
 \r
   @param  This                Protocol instance pointer.\r
   @param  Controller          Handle of device to test\r
@@ -266,6 +251,7 @@ TerminalDriverBindingStart (
   UINTN                               EntryCount;\r
   UINTN                               Index;\r
   EFI_DEVICE_PATH_PROTOCOL            *DevicePath;\r
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     *SimpleTextOutput;\r
 \r
   TerminalDevice = NULL;\r
   DefaultNode    = NULL;\r
@@ -356,7 +342,7 @@ TerminalDriverBindingStart (
   if (!EFI_ERROR (Status)) {\r
     Status = EFI_SUCCESS;\r
     for (Index = 0; Index < EntryCount; Index++) {\r
-      if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {\r
+      if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {\r
         Status = EFI_ALREADY_STARTED;\r
       }\r
     }\r
@@ -502,52 +488,39 @@ TerminalDriverBindingStart (
     goto ReportError;\r
   }\r
   //\r
-  // Simple Text Output Protocol\r
+  // Set Simple Text Output Protocol from template.\r
   //\r
-  TerminalDevice->SimpleTextOutput.Reset              = TerminalConOutReset;\r
-  TerminalDevice->SimpleTextOutput.OutputString       = TerminalConOutOutputString;\r
-  TerminalDevice->SimpleTextOutput.TestString         = TerminalConOutTestString;\r
-  TerminalDevice->SimpleTextOutput.QueryMode          = TerminalConOutQueryMode;\r
-  TerminalDevice->SimpleTextOutput.SetMode            = TerminalConOutSetMode;\r
-  TerminalDevice->SimpleTextOutput.SetAttribute       = TerminalConOutSetAttribute;\r
-  TerminalDevice->SimpleTextOutput.ClearScreen        = TerminalConOutClearScreen;\r
-  TerminalDevice->SimpleTextOutput.SetCursorPosition  = TerminalConOutSetCursorPosition;\r
-  TerminalDevice->SimpleTextOutput.EnableCursor       = TerminalConOutEnableCursor;\r
-  TerminalDevice->SimpleTextOutput.Mode               = &TerminalDevice->SimpleTextOutputMode;\r
+  SimpleTextOutput = CopyMem (\r
+                       &TerminalDevice->SimpleTextOutput,\r
+                       &mTerminalDevTemplate.SimpleTextOutput,\r
+                       sizeof (mTerminalDevTemplate.SimpleTextOutput)\r
+                       );\r
+  SimpleTextOutput->Mode = &TerminalDevice->SimpleTextOutputMode;\r
 \r
   TerminalDevice->SimpleTextOutputMode.MaxMode        = 3;\r
   //\r
   // For terminal devices, cursor is always visible\r
   //\r
   TerminalDevice->SimpleTextOutputMode.CursorVisible  = TRUE;\r
-  Status = TerminalDevice->SimpleTextOutput.SetAttribute (\r
-                                                      &TerminalDevice->SimpleTextOutput,\r
-                                                      EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)\r
-                                                      );\r
+  Status = TerminalConOutSetAttribute (\r
+             SimpleTextOutput,\r
+             EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     goto ReportError;\r
   }\r
 \r
-  Status = TerminalDevice->SimpleTextOutput.Reset (\r
-                                              &TerminalDevice->SimpleTextOutput,\r
-                                              FALSE\r
-                                              );\r
+  Status = TerminalConOutReset (SimpleTextOutput, FALSE);\r
   if (EFI_ERROR (Status)) {\r
     goto ReportError;\r
   }\r
 \r
-  Status = TerminalDevice->SimpleTextOutput.SetMode (\r
-                                              &TerminalDevice->SimpleTextOutput,\r
-                                              0\r
-                                              );\r
+  Status = TerminalConOutSetMode (SimpleTextOutput, 0);\r
   if (EFI_ERROR (Status)) {\r
     goto ReportError;\r
   }\r
 \r
-  Status = TerminalDevice->SimpleTextOutput.EnableCursor (\r
-                                              &TerminalDevice->SimpleTextOutput,\r
-                                              TRUE\r
-                                              );\r
+  Status = TerminalConOutEnableCursor (SimpleTextOutput, TRUE);\r
   if (EFI_ERROR (Status)) {\r
     goto ReportError;\r
   }\r
@@ -755,7 +728,7 @@ Error:
 /**\r
   Stop this driver on Controller by closing Simple Text In, Simple Text\r
   In Ex, Simple Text Out protocol, and removing parent device path from\r
-  Console Device Environment Variables.    \r
+  Console Device Environment Variables.\r
 \r
   @param  This              Protocol instance pointer.\r
   @param  Controller        Handle of device to stop driver on\r
@@ -983,9 +956,7 @@ TerminalFreeNotifyList (
   Update terminal device path in Console Device Environment Variables.\r
 \r
   @param  VariableName           The Console Device Environment Variable.\r
-  @param  ParentDevicePath       The terminal devcie path to be updated.\r
-\r
-  @return None.\r
+  @param  ParentDevicePath       The terminal device path to be updated.\r
 \r
 **/\r
 VOID\r
@@ -1048,9 +1019,7 @@ TerminalUpdateConsoleDevVariable (
   Remove terminal device path from Console Device Environment Variables.\r
 \r
   @param  VariableName           Console Device Environment Variables.\r
-  @param  ParentDevicePath       The terminal devcie path to be updated.\r
-\r
-  @return None.\r
+  @param  ParentDevicePath       The terminal device path to be updated.\r
 \r
 **/\r
 VOID\r
@@ -1112,7 +1081,7 @@ TerminalRemoveConsoleDevVariable (
       SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);\r
 \r
       //\r
-      // Compare the genterated device path to the current device path instance\r
+      // Compare the generated device path to the current device path instance\r
       //\r
       if (TempDevicePath != NULL) {\r
         if (CompareMem (Instance, TempDevicePath, InstanceSize) == 0) {\r
@@ -1172,8 +1141,8 @@ TerminalRemoveConsoleDevVariable (
   @param  VariableSize           Returns the size of the EFI variable that was read\r
 \r
   @return Dynamically allocated memory that contains a copy of the EFI variable.\r
-          Caller is repsoncible freeing the buffer. If variable was not read, \r
-          NULL regturned.\r
+          Caller is responsible freeing the buffer. If variable was not read,\r
+          NULL returned.\r
 \r
 **/\r
 VOID *\r
@@ -1238,10 +1207,10 @@ TerminalGetVariableAndSize (
 }\r
 \r
 /**\r
-  Build termial device path according to terminal type.\r
+  Build terminal device path according to terminal type.\r
 \r
   @param  TerminalType           The terminal type is PC ANSI, VT100, VT100+ or VT-UTF8.\r
-  @param  ParentDevicePath       Parent devcie path.\r
+  @param  ParentDevicePath       Parent device path.\r
   @param  TerminalDevicePath     Returned terminal device path, if building successfully.\r
 \r
   @retval EFI_UNSUPPORTED        Terminal does not belong to the supported type.\r
@@ -1315,8 +1284,6 @@ SetTerminalDevicePath (
 \r
   @param TerminalDevice          The terminal device.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 InitializeRawFiFo (\r
@@ -1324,7 +1291,7 @@ InitializeRawFiFo (
   )\r
 {\r
   //\r
-  // Make the raw fifo empty.\r
+  // Make the raw FIFO empty.\r
   //\r
   TerminalDevice->RawFiFo.Head = TerminalDevice->RawFiFo.Tail;\r
 }\r
@@ -1334,8 +1301,6 @@ InitializeRawFiFo (
 \r
   @param TerminalDevice          The terminal device.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 InitializeUnicodeFiFo (\r
@@ -1343,7 +1308,7 @@ InitializeUnicodeFiFo (
   )\r
 {\r
   //\r
-  // Make the unicode fifo empty\r
+  // Make the unicode FIFO empty\r
   //\r
   TerminalDevice->UnicodeFiFo.Head = TerminalDevice->UnicodeFiFo.Tail;\r
 }\r
@@ -1353,8 +1318,6 @@ InitializeUnicodeFiFo (
 \r
   @param TerminalDevice          The terminal device.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 InitializeEfiKeyFiFo (\r
@@ -1362,7 +1325,7 @@ InitializeEfiKeyFiFo (
   )\r
 {\r
   //\r
-  // Make the efi key fifo empty\r
+  // Make the efi key FIFO empty\r
   //\r
   TerminalDevice->EfiKeyFiFo.Head = TerminalDevice->EfiKeyFiFo.Tail;\r
 }\r
@@ -1400,6 +1363,5 @@ InitializeTerminal(
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-\r
   return Status;\r
 }\r