}\r
}\r
\r
+/**\r
+ Fill console handle in System Table if there are no valid console handle in.\r
+\r
+ Firstly, check the validation of console handle in System Table. If it is invalid,\r
+ update it by the first console device handle from EFI console variable. \r
+\r
+ @param VarName The name of the EFI console variable.\r
+ @param ConsoleGuid Specified Console protocol GUID.\r
+ @param ConsoleHandle On IN, console handle in System Table to be checked. \r
+ On OUT, new console hanlde in system table.\r
+ @param ProtocolInterface On IN, console protocol on console handle in System Table to be checked. \r
+ On OUT, new console protocol on new console hanlde in system table.\r
+**/\r
+VOID \r
+UpdateSystemTableConsole (\r
+ IN CHAR16 *VarName,\r
+ IN EFI_GUID *ConsoleGuid,\r
+ IN OUT EFI_HANDLE *ConsoleHandle,\r
+ IN OUT VOID **ProtocolInterface\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN DevicePathSize;\r
+ EFI_DEVICE_PATH_PROTOCOL *FullDevicePath;\r
+ EFI_DEVICE_PATH_PROTOCOL *VarConsole;\r
+ EFI_DEVICE_PATH_PROTOCOL *Instance;\r
+ VOID *Interface;\r
+ EFI_HANDLE NewHandle;\r
+\r
+ ASSERT (VarName != NULL);\r
+ ASSERT (ConsoleHandle != NULL);\r
+ ASSERT (ConsoleGuid != NULL);\r
+ ASSERT (ProtocolInterface != NULL);\r
+\r
+ if (*ConsoleHandle != NULL) {\r
+ Status = gBS->HandleProtocol (\r
+ *ConsoleHandle,\r
+ ConsoleGuid,\r
+ &Interface\r
+ );\r
+ if (Status == EFI_SUCCESS && Interface == *ProtocolInterface) {\r
+ //\r
+ // If ConsoleHandle is valid and console protocol on this handle also\r
+ // also matched, just return.\r
+ //\r
+ return;\r
+ }\r
+ }\r
+ \r
+ //\r
+ // Get all possible consoles device path from EFI variable\r
+ //\r
+ VarConsole = BdsLibGetVariableAndSize (\r
+ VarName,\r
+ &gEfiGlobalVariableGuid,\r
+ &DevicePathSize\r
+ );\r
+ if (VarConsole == NULL) {\r
+ //\r
+ // If there is no any console device, just return.\r
+ //\r
+ return ;\r
+ }\r
+\r
+ FullDevicePath = VarConsole;\r
+\r
+ do {\r
+ //\r
+ // Check every instance of the console variable\r
+ //\r
+ Instance = GetNextDevicePathInstance (&VarConsole, &DevicePathSize);\r
+ if (Instance == NULL) {\r
+ FreePool (FullDevicePath);\r
+ ASSERT (FALSE);\r
+ }\r
+ \r
+ //\r
+ // Find console device handle by device path instance\r
+ //\r
+ Status = gBS->LocateDevicePath (\r
+ ConsoleGuid,\r
+ &Instance,\r
+ &NewHandle\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Get the console protocol on this console device handle\r
+ //\r
+ Status = gBS->HandleProtocol (\r
+ NewHandle,\r
+ ConsoleGuid,\r
+ &Interface\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Update new console handle in System Table.\r
+ //\r
+ *ConsoleHandle = NewHandle;\r
+ *ProtocolInterface = Interface;\r
+ return ;\r
+ }\r
+ }\r
+\r
+ } while (Instance != NULL);\r
+\r
+ //\r
+ // No any available console devcie found.\r
+ //\r
+ ASSERT (FALSE); \r
+}\r
+\r
/**\r
This function update console variable based on ConVarName, it can\r
add or remove one specific console device path from the variable\r
//\r
BdsLibConnectConsoleVariable (L"ErrOut");\r
\r
+ //\r
+ // Fill console handles in System Table if no console device assignd.\r
+ //\r
+ UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn);\r
+ UpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut);\r
+ UpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr);\r
+\r
return EFI_SUCCESS;\r
\r
}\r
//\r
PERF_END (0, "BdsTimeOut", "BDS", 0);\r
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
- ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
-\r
+ if (Status == EFI_SUCCESS) {\r
+ ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
+ }\r
}\r
+++ /dev/null
-/** @file\r
- This guid is used to specify the primary console in device.\r
- It will be installed as the protocol guid into the virtual device handle for ConIn Splitter.\r
-\r
-Copyright (c) 2006 - 2009, Intel Corporation\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
-http://opensource.org/licenses/bsd-license.php\r
-\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
-**/\r
-\r
-#ifndef __PRIMARY_CONSOLE_IN_DEVICE_H__\r
-#define __PRIMARY_CONSOLE_IN_DEVICE_H__\r
-\r
-#define EFI_PRIMARY_CONSOLE_IN_DEVICE_GUID \\r
- { 0xe451dcbe, 0x96a1, 0x4729, {0xa5, 0xcf, 0x6b, 0x9c, 0x2c, 0xff, 0x47, 0xfd } }\r
-\r
-extern EFI_GUID gEfiPrimaryConsoleInDeviceGuid;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- This guid is used to specify the primary console out device.\r
- It will be installed as the protocol guid into the virtual device handle for ConOut Splitter.\r
-\r
-Copyright (c) 2006 - 2009, Intel Corporation\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
-http://opensource.org/licenses/bsd-license.php\r
-\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
-**/\r
-\r
-#ifndef __PRIMARY_CONSOLE_OUT_DEVICE_H__\r
-#define __PRIMARY_CONSOLE_OUT_DEVICE_H__\r
-\r
-#define EFI_PRIMARY_CONSOLE_OUT_DEVICE_GUID \\r
- { 0x62bdf38a, 0xe3d5, 0x492c, {0x95, 0xc, 0x23, 0xa7, 0xf6, 0x6e, 0x67, 0x2e } }\r
-\r
-extern EFI_GUID gEfiPrimaryConsoleOutDeviceGuid;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- This guid is used to specify the primary StdErr device.\r
- It will be installed as the protocol guid into the virtual device handle for StdErr Splitter.\r
-\r
-Copyright (c) 2006 - 2009, Intel Corporation\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
-http://opensource.org/licenses/bsd-license.php\r
-\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
-**/\r
-\r
-#ifndef __PRIMARY_STANDARD_ERROR_DEVICE_H__\r
-#define __PRIMARY_STANDARD_ERROR_DEVICE_H__\r
-\r
-#define EFI_PRIMARY_STANDARD_ERROR_DEVICE_GUID \\r
- { 0x5a68191b, 0x9b97, 0x4752, {0x99, 0x46, 0xe3, 0x6a, 0x5d, 0xa9, 0x42, 0xb1 } }\r
-\r
-extern EFI_GUID gEfiPrimaryStandardErrorDeviceGuid;\r
-\r
-#endif\r
## Include/Guid/ConsoleInDevice.h\r
gEfiConsoleInDeviceGuid = { 0xD3B36F2B, 0xD551, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}\r
\r
- ## Guid specify the primary console out device.\r
- ## Include/Guid/PrimaryConsoleOutDevice.h\r
- gEfiPrimaryConsoleOutDeviceGuid = { 0x62BDF38A, 0xE3D5, 0x492C, { 0x95, 0x0C, 0x23, 0xA7, 0xF6, 0x6E, 0x67, 0x2E }}\r
- \r
- ## Guid specify the primary console in device.\r
- ## Include/Guid/PrimaryConsoleInDevice.h\r
- gEfiPrimaryConsoleInDeviceGuid = { 0xE451DCBE, 0x96A1, 0x4729, { 0xA5, 0xCF, 0x6B, 0x9C, 0x2C, 0xFF, 0x47, 0xFD }}\r
- \r
- ## Guid specify the primary StdErr device.\r
- ## Include/Guid/PrimaryStandardErrorDevice.h\r
- gEfiPrimaryStandardErrorDeviceGuid = { 0x5A68191B, 0x9B97, 0x4752, { 0x99, 0x46, 0xE3, 0x6A, 0x5D, 0xA9, 0x42, 0xB1 }}\r
- \r
## Hob and Variable guid specify the platform memory type information.\r
## Include/Guid/MemoryTypeInformation.h\r
gEfiMemoryTypeInformationGuid = { 0x4C19049F, 0x4137, 0x4DD3, { 0x9C, 0x10, 0x8B, 0x97, 0xA8, 0x3F, 0xFD, 0xFA }}\r
&mStdErr.VirtualHandle,\r
&gEfiSimpleTextOutProtocolGuid,\r
&mStdErr.TextOut,\r
- &gEfiPrimaryStandardErrorDeviceGuid,\r
- NULL,\r
NULL\r
);\r
}\r
&mConIn.SimplePointer,\r
&gEfiAbsolutePointerProtocolGuid,\r
&mConIn.AbsolutePointer,\r
- &gEfiPrimaryConsoleInDeviceGuid,\r
- NULL,\r
NULL\r
);\r
if (!EFI_ERROR (Status)) {\r
&mConOut.UgaDraw,\r
&gEfiConsoleControlProtocolGuid,\r
&mConOut.ConsoleControl,\r
- &gEfiPrimaryConsoleOutDeviceGuid,\r
- NULL,\r
NULL\r
);\r
} else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
&mConOut.GraphicsOutput,\r
&gEfiConsoleControlProtocolGuid,\r
&mConOut.ConsoleControl,\r
- &gEfiPrimaryConsoleOutDeviceGuid,\r
- NULL,\r
NULL\r
);\r
} else {\r
&mConOut.UgaDraw,\r
&gEfiConsoleControlProtocolGuid,\r
&mConOut.ConsoleControl,\r
- &gEfiPrimaryConsoleOutDeviceGuid,\r
- NULL,\r
NULL\r
);\r
}\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/ConsoleInDevice.h>\r
#include <Guid/StandardErrorDevice.h>\r
#include <Guid/ConsoleOutDevice.h>\r
gEfiConsoleInDeviceGuid ## SOMETIMES_CONSUMES\r
gEfiStandardErrorDeviceGuid ## SOMETIMES_CONSUMES\r
gEfiConsoleOutDeviceGuid ## SOMETIMES_CONSUMES\r
- gEfiPrimaryConsoleOutDeviceGuid ## PRODUCES\r
- gEfiPrimaryConsoleInDeviceGuid ## PRODUCES\r
- gEfiPrimaryStandardErrorDeviceGuid ## PRODUCES\r
+\r
\r
[Protocols]\r
gEfiConsoleControlProtocolGuid ## PRODUCES\r