]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
Clean up BootMaint module in BdsDxe.
[mirror_edk2.git] / MdeModulePkg / Universal / BdsDxe / BootMaint / ConsoleOption.c
index 270948633b682fbcee47d11882677c5f793099db..0364ba64d36a9e2b5d5cf5ae37221252910afad5 100644 (file)
@@ -15,11 +15,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "BootMaint.h"\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Function creates a device path data structure that identically matches the\r
+  device path passed in.\r
 \r
-  @param DevPath         EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param DevPath         A pointer to a device path data structure.\r
+\r
+  @return        The new copy of DevPath is created to identically match the input.\r
+  @retval  NULL  Otherwise, NULL is returned.\r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL  *\r
@@ -28,11 +31,12 @@ DevicePathInstanceDup (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update Com Ports attributes from DevicePath\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param DevicePath      DevicePath that contains Com ports\r
+\r
+  @retval EFI_SUCCESS   The update is successful.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -41,18 +45,21 @@ UpdateComAttributeFromVariable (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the multi-instance device path of Terminal Device based on\r
+  the global TerminalMenu. If ChangeTernimal is TRUE, the terminal \r
+  device path in the Terminal Device in TerminalMenu is also updated.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
-  @param ChangeTerminal  EDES_TODO: Add parameter description\r
+  @param DevicePath      The multi-instance device path.\r
+  @param ChangeTerminal  TRUE, then device path in the Terminal Device \r
+                         in TerminalMenu is also updated; FALSE, no update.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return EFI_SUCCESS    The function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
 ChangeTerminalDevicePath (\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
-  BOOLEAN                   ChangeTerminal\r
+  IN BOOLEAN                   ChangeTerminal\r
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *Node;\r
@@ -78,9 +85,6 @@ ChangeTerminalDevicePath (
     }\r
 \r
     NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);\r
-    if (NULL == NewMenuEntry) {\r
-      return EFI_NOT_FOUND;\r
-    }\r
 \r
     NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
     if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {\r
@@ -162,16 +166,18 @@ ChangeTerminalDevicePath (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the device path that describing a terminal device\r
+  based on the new BaudRate, Data Bits, parity and Stop Bits\r
+  set.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
+  @param DevicePath\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
 ChangeVariableDevicePath (\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *Node;\r
@@ -237,8 +243,8 @@ ChangeVariableDevicePath (
   Retrieve ACPI UID of UART from device path\r
 \r
 \r
-  @param Handle          EDES_TODO: Add parameter description\r
-  @param AcpiUid         EDES_TODO: Add parameter description\r
+  @param Handle          The handle for the UART device.\r
+  @param AcpiUid         The ACPI UID on output.\r
 \r
   @retval  TRUE   Find valid UID from device path\r
   @retval  FALSE  Can't find\r
@@ -287,7 +293,7 @@ RetrieveUartUid (
   @param Handles         EFI_SERIAL_IO_PROTOCOL handle buffer\r
   @param NoHandles       EFI_SERIAL_IO_PROTOCOL handle count\r
 \r
-           EDES_TODO: Incomplete Descriptions  None\r
+  @retval VOID\r
 \r
 **/\r
 VOID\r
@@ -328,13 +334,15 @@ SortedUartHandle (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Test whether DevicePath is a valid Terminal\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
-  @param Termi           EDES_TODO: Add parameter description\r
-  @param Com             EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param DevicePath      DevicePath to be checked\r
+  @param Termi           If DevicePath is valid Terminal, terminal type is returned.\r
+  @param Com             If DevicePath is valid Terminal, Com Port type is returned.\r
+\r
+  @retval  TRUE         If DevicePath point to a Terminal.\r
+  @retval  FALSE        If DevicePath does not point to a Terminal.\r
 \r
 **/\r
 BOOLEAN\r
@@ -511,7 +519,7 @@ LocateSerialIo (
     Vendor.Header.SubType             = MSG_VENDOR_DP;\r
 \r
     for (Index2 = 0; Index2 < 4; Index2++) {\r
-      CopyMem (&Vendor.Guid, &Guid[Index2], sizeof (EFI_GUID));\r
+      CopyMem (&Vendor.Guid, &TerminalTypeGuid[Index2], sizeof (EFI_GUID));\r
       SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));\r
       NewDevicePath = AppendDevicePathNode (\r
                         NewTerminalContext->DevicePath,\r
@@ -550,7 +558,7 @@ LocateSerialIo (
 \r
   @param DevicePath      DevicePath that contains Com ports\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS   The update is successful.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -672,8 +680,8 @@ UpdateComAttributeFromVariable (
 \r
   @param DevPath         A pointer to a device path data structure.\r
 \r
-           EDES_TODO: Incomplete Descriptions  The new copy of DevPath is created to identically match the input.\r
-           EDES_TODO: Incomplete Descriptions  Otherwise, NULL is returned.\r
+  @return        The new copy of DevPath is created to identically match the input.\r
+  @retval  NULL  Otherwise, NULL is returned.\r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
@@ -698,7 +706,7 @@ DevicePathInstanceDup (
   //\r
   NewDevPath = NULL;\r
   if (Size != 0) {\r
-    NewDevPath = EfiAllocateZeroPool (Size);\r
+    NewDevPath = AllocateZeroPool (Size);\r
     ASSERT (NewDevPath != NULL);\r
   }\r
 \r
@@ -714,11 +722,18 @@ DevicePathInstanceDup (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Build up Console Menu based on types passed in. The type can\r
+  be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT\r
+  and BM_CONSOLE_ERR_CONTEXT_SELECT.\r
 \r
-  @param ConsoleMenuType EDES_TODO: Add parameter description\r
+  @param ConsoleMenuType Can be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT\r
+                         and BM_CONSOLE_ERR_CONTEXT_SELECT.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_UNSUPPORTED The type passed in is not in the 3 types defined.\r
+  @retval EFI_NOT_FOUND   If the EFI Variable defined in UEFI spec with name "ConOutDev", \r
+                          "ConInDev" or "ConErrDev" doesn't exists.\r
+  @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operations.\r
+  @retval EFI_SUCCESS          Function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -796,7 +811,7 @@ GetConsoleMenu (
   AllCount                = EfiDevicePathInstanceCount (AllDevicePath);\r
   ConsoleMenu->MenuNumber = 0;\r
   //\r
-  // Following is menu building up for Console Out Devices\r
+  // Following is menu building up for Console Devices selected.\r
   //\r
   MultiDevicePath = AllDevicePath;\r
   Index2          = 0;\r
@@ -844,10 +859,9 @@ GetConsoleMenu (
   Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
+  @retval EFI_SUCCESS    The function always complete successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -867,9 +881,7 @@ GetAllConsoles (
 \r
   @param VOID            EDES_TODO: Add parameter description\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
-\r
+  @retval EFI_SUCCESS    The function always complete successfully.\r
 **/\r
 EFI_STATUS\r
 FreeAllConsoles (\r
@@ -888,11 +900,11 @@ FreeAllConsoles (
 \r
 \r
   @param DevicePath      DevicePath to be checked\r
-  @param Termi           If is terminal, give its type\r
-  @param Com             If is Com Port, give its type\r
+  @param Termi           If DevicePath is valid Terminal, terminal type is returned.\r
+  @param Com             If DevicePath is valid Terminal, Com Port type is returned.\r
 \r
-  @retval  TRUE         If DevicePath point to a Terminal\r
-                        FALSE\r
+  @retval  TRUE         If DevicePath point to a Terminal.\r
+  @retval  FALSE        If DevicePath does not point to a Terminal.\r
 \r
 **/\r
 BOOLEAN\r
@@ -929,19 +941,19 @@ IsTerminalDevicePath (
   //\r
   CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));\r
 \r
-  if (CompareGuid (&TempGuid, &Guid[0])) {\r
+  if (CompareGuid (&TempGuid, &TerminalTypeGuid[0])) {\r
     *Termi      = PC_ANSI;\r
     IsTerminal  = TRUE;\r
   } else {\r
-    if (CompareGuid (&TempGuid, &Guid[1])) {\r
+    if (CompareGuid (&TempGuid, &TerminalTypeGuid[1])) {\r
       *Termi      = VT_100;\r
       IsTerminal  = TRUE;\r
     } else {\r
-      if (CompareGuid (&TempGuid, &Guid[2])) {\r
+      if (CompareGuid (&TempGuid, &TerminalTypeGuid[2])) {\r
         *Termi      = VT_100_PLUS;\r
         IsTerminal  = TRUE;\r
       } else {\r
-        if (CompareGuid (&TempGuid, &Guid[3])) {\r
+        if (CompareGuid (&TempGuid, &TerminalTypeGuid[3])) {\r
           *Termi      = VT_UTF8;\r
           IsTerminal  = TRUE;\r
         } else {\r
@@ -971,9 +983,9 @@ IsTerminalDevicePath (
   Get mode number according to column and row\r
 \r
 \r
-  @param CallbackData    BMM_CALLBACK_DATA\r
+  @param CallbackData    The BMM context data.\r
 \r
-           EDES_TODO: Incomplete Descriptions  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r