-/*++\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
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
/**\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
//\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
// Append the device path to the ConInDev environment variable\r
//\r
ConPlatformUpdateDeviceVariable (\r
- VarConsoleInpDev,\r
+ L"ConInDev",\r
DevicePath,\r
APPEND\r
);\r
// then install EfiConsoleInDeviceGuid onto ControllerHandle\r
//\r
Status = ConPlatformUpdateDeviceVariable (\r
- VarConsoleInp,\r
+ L"ConIn",\r
DevicePath,\r
CHECK\r
);\r
// Append the device path to the ConOutDev environment variable\r
//\r
ConPlatformUpdateDeviceVariable (\r
- VarConsoleOutDev,\r
+ L"ConOutDev",\r
DevicePath,\r
APPEND\r
);\r
// Append the device path to the StdErrDev environment variable\r
//\r
ConPlatformUpdateDeviceVariable (\r
- VarErrorOutDev,\r
+ L"ErrOutDev",\r
DevicePath,\r
APPEND\r
);\r
// then install EfiConsoleOutDeviceGuid onto ControllerHandle\r
//\r
Status = ConPlatformUpdateDeviceVariable (\r
- VarConsoleOut,\r
+ L"ConOut",\r
DevicePath,\r
CHECK\r
);\r
// then install EfiStandardErrorDeviceGuid onto ControllerHandle\r
//\r
Status = ConPlatformUpdateDeviceVariable (\r
- VarErrorOut,\r
+ L"ErrOut",\r
DevicePath,\r
CHECK\r
);\r
// Remove DevicePath from ConInDev\r
//\r
ConPlatformUpdateDeviceVariable (\r
- VarConsoleInpDev,\r
+ L"ConInDev",\r
DevicePath,\r
DELETE\r
);\r
// 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
--*/\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
//\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
}\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
}\r
\r
if (Delete) {\r
- *NewDevicePath = TempDevicePath1;\r
+ *NewDevicePath = TempDevicePath;\r
return EFI_SUCCESS;\r
}\r
\r
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