]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
apply for doxgen format.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ConPlatform.c
index 178be23ca52cb583fb6b2b95c53233389ca946a0..af2d2221fe7e97549eae71012aeb87a25912d413 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  Console Platfrom DXE Driver, install Console protocols.\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2007, Intel Corporation. <BR>\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
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,13 +10,7 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-    ConPlatform.c\r
-\r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
 #include <ConPlatform.h>\r
 \r
@@ -41,9 +36,9 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
 /**\r
   The user Entry Point for module ConPlatform. The user code starts with this function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
   @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
 \r
@@ -60,25 +55,23 @@ InitializeConPlatform(
   //\r
   // Install driver model protocol(s).\r
   //\r
-  Status = EfiLibInstallAllDriverProtocols (\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r
              &gConPlatformTextInDriverBinding,\r
              ImageHandle,\r
              &gConPlatformComponentName,\r
-             NULL,\r
-             NULL\r
+             &gConPlatformComponentName2\r
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  Status = EfiLibInstallAllDriverProtocols (\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r
              &gConPlatformTextOutDriverBinding,\r
              NULL,\r
              &gConPlatformComponentName,\r
-             NULL,\r
-             NULL\r
+             &gConPlatformComponentName2\r
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -279,7 +272,7 @@ Returns:
     // Append the device path to the ConInDev environment variable\r
     //\r
     ConPlatformUpdateDeviceVariable (\r
-      VarConsoleInpDev,\r
+      L"ConInDev",\r
       DevicePath,\r
       APPEND\r
       );\r
@@ -289,7 +282,7 @@ Returns:
     // then install EfiConsoleInDeviceGuid onto ControllerHandle\r
     //\r
     Status = ConPlatformUpdateDeviceVariable (\r
-              VarConsoleInp,\r
+              L"ConIn",\r
               DevicePath,\r
               CHECK\r
               );\r
@@ -387,7 +380,7 @@ Returns:
     // Append the device path to the ConOutDev environment variable\r
     //\r
     ConPlatformUpdateDeviceVariable (\r
-      VarConsoleOutDev,\r
+      L"ConOutDev",\r
       DevicePath,\r
       APPEND\r
       );\r
@@ -395,7 +388,7 @@ Returns:
     // Append the device path to the StdErrDev environment variable\r
     //\r
     ConPlatformUpdateDeviceVariable (\r
-      VarErrorOutDev,\r
+      L"ErrOutDev",\r
       DevicePath,\r
       APPEND\r
       );\r
@@ -405,7 +398,7 @@ Returns:
     // then install EfiConsoleOutDeviceGuid onto ControllerHandle\r
     //\r
     Status = ConPlatformUpdateDeviceVariable (\r
-              VarConsoleOut,\r
+              L"ConOut",\r
               DevicePath,\r
               CHECK\r
               );\r
@@ -424,7 +417,7 @@ Returns:
     // then install EfiStandardErrorDeviceGuid onto ControllerHandle\r
     //\r
     Status = ConPlatformUpdateDeviceVariable (\r
-              VarErrorOut,\r
+              L"ErrOut",\r
               DevicePath,\r
               CHECK\r
               );\r
@@ -496,7 +489,7 @@ Returns:
       // Remove DevicePath from ConInDev\r
       //\r
       ConPlatformUpdateDeviceVariable (\r
-        VarConsoleInpDev,\r
+        L"ConInDev",\r
         DevicePath,\r
         DELETE\r
         );\r
@@ -569,12 +562,12 @@ Returns:
       // Remove DevicePath from ConOutDev, and StdErrDev\r
       //\r
       ConPlatformUpdateDeviceVariable (\r
-        VarConsoleOutDev,\r
+        L"ConOutDev",\r
         DevicePath,\r
         DELETE\r
         );\r
       ConPlatformUpdateDeviceVariable (\r
-        VarErrorOutDev,\r
+        L"ErrOutDev",\r
         DevicePath,\r
         DELETE\r
         );\r
@@ -739,8 +732,7 @@ Returns:
 --*/\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath1;\r
-  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath2;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;\r
   UINTN                     Size;\r
 \r
@@ -753,7 +745,7 @@ Returns:
   //\r
   // if performing Delete operation, the NewDevicePath must not be NULL.\r
   //\r
-  TempDevicePath1 = NULL;\r
+  TempDevicePath  = NULL;\r
 \r
   DevicePath      = Multi;\r
   DevicePathInst  = GetNextDevicePathInstance (&DevicePath, &Size);\r
@@ -769,14 +761,10 @@ Returns:
       }\r
     } else {\r
       if (Delete) {\r
-        TempDevicePath2 = AppendDevicePathInstance (\r
-                            TempDevicePath1,\r
+        TempDevicePath = AppendDevicePathInstance (\r
+                            NULL,\r
                             DevicePathInst\r
                             );\r
-        if (TempDevicePath1 != NULL) {\r
-          FreePool (TempDevicePath1);\r
-        }\r
-        TempDevicePath1 = TempDevicePath2;\r
       }\r
     }\r
 \r
@@ -785,7 +773,7 @@ Returns:
   }\r
 \r
   if (Delete) {\r
-    *NewDevicePath = TempDevicePath1;\r
+    *NewDevicePath = TempDevicePath;\r
     return EFI_SUCCESS;\r
   }\r
 \r
@@ -878,15 +866,17 @@ Returns:
     return Status;\r
   }\r
 \r
-  Status = gRT->SetVariable (\r
-                  VariableName,\r
-                  &gEfiGlobalVariableGuid,\r
-                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                  GetDevicePathSize (NewVariableDevicePath),\r
-                  NewVariableDevicePath\r
-                  );\r
+  if (NewVariableDevicePath != NULL) {\r
+    Status = gRT->SetVariable (\r
+                    VariableName,\r
+                    &gEfiGlobalVariableGuid,\r
+                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                    GetDevicePathSize (NewVariableDevicePath),\r
+                    NewVariableDevicePath\r
+                    );\r
 \r
-  FreePool (NewVariableDevicePath);\r
+    FreePool (NewVariableDevicePath);\r
+  }\r
 \r
   return Status;\r
 }\r