diff options
author | Laszlo Ersek <lersek@redhat.com> | 2015-02-23 16:04:21 +0000 |
---|---|---|
committer | lersek <lersek@Edk2> | 2015-02-23 16:04:21 +0000 |
commit | a8c2de1d7d1ba9261a77783737de29632e5bc7d2 (patch) | |
tree | 1fc93fc607a5bbfc8594314f33fbd6f3494ad089 /ArmPlatformPkg/ArmVirtualizationPkg/Library | |
parent | a78c4836ea0bae2598bcc3137cac7b1322e56bba (diff) | |
download | edk2-platforms-a8c2de1d7d1ba9261a77783737de29632e5bc7d2.tar.xz |
ArmVirtualizationPkg: PlatformIntelBdsLib: fix multiconsole setup
In the following call chain:
PlatformBdsPolicyBehavior()
PlatformBdsConnectConsole()
InitializeConsolePipe() x 3
BdsConnectDevicePath() [ArmPkg/Library/BdsLib/BdsFilePath.c]
the three InitializeConsolePipe() function calls pass through
- (&gST->ConsoleOutHandle, &gST->ConOut),
- (&gST->ConsoleInHandle, &gST->ConIn),
- (&gST->StandardErrorHandle, &gST->StdErr)
to BdsConnectDevicePath(), in ArmPkg's BdsLib.
At least when more than one console device paths are specified in the
ConIn / ConOut / ErrOut variables, the above resuls in:
- unchanged protocol interfaces (ConOut, ConIn, StdErr) in the system
table (because ConSplitterDxe installs its non-NULL interfaces first),
- but, changed handles in the system table.
This effectively separates the handle fields in the system table from the
protocol interfaces in the same that should always be associated with the
handles. The end result is that clients using the handles break (splitting
/ multiplexing doesn't work for them), while clients directly using the
protocol interfaces work.
Therefore, do not attempt to connect consoles separately. ConSplitterDxe
is dispatched before PlatformBdsPolicyBehavior() is called (the latter
happens in the BDS phase), and ConSplitterDxe installs virtual handles and
protocol interfaces for input / output / error.
BdsLibConnectAll() covers all devices, including consoles; as those
consoles are connected, ConPlatformDxe and ConSplitterDxe pick them up
nicely as "slaves". We just need to make sure that the variables are set
first, for the variables -> ConPlatformDxe -> ConSplitterDxe dependency
chain.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16912 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/ArmVirtualizationPkg/Library')
-rw-r--r-- | ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c | 101 |
1 files changed, 3 insertions, 98 deletions
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c index ae43f9c21d..667810fbb5 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c @@ -109,85 +109,8 @@ GetConsoleDevicePathFromVariable ( }
STATIC
-EFI_STATUS
-InitializeConsolePipe (
- IN EFI_DEVICE_PATH *ConsoleDevicePaths,
- IN EFI_GUID *Protocol,
- OUT EFI_HANDLE *Handle,
- OUT VOID* *Interface
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN NoHandles;
- EFI_HANDLE *Buffer;
- EFI_DEVICE_PATH_PROTOCOL* DevicePath;
-
- // Connect all the Device Path Consoles
- while (ConsoleDevicePaths != NULL) {
- DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);
-
- Status = BdsConnectDevicePath (DevicePath, Handle, NULL);
- DEBUG_CODE_BEGIN ();
- if (EFI_ERROR (Status)) {
- // We convert back to the text representation of the device Path
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- CHAR16* DevicePathTxt;
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- if (!EFI_ERROR (Status)) {
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE);
-
- DEBUG ((EFI_D_ERROR, "Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status));
-
- FreePool (DevicePathTxt);
- }
- }
- DEBUG_CODE_END ();
-
- // If the console splitter driver is not supported by the platform then use the first Device Path
- // instance for the console interface.
- if (!EFI_ERROR (Status) && (*Interface == NULL)) {
- Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
- }
- }
-
- // No Device Path has been defined for this console interface. We take the first protocol implementation
- if (*Interface == NULL) {
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
- if (EFI_ERROR (Status)) {
- BdsConnectAllDrivers ();
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
- }
-
- if (!EFI_ERROR (Status)) {
- *Handle = Buffer[0];
- Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
- ASSERT_EFI_ERROR (Status);
- }
- FreePool (Buffer);
- } else {
- Status = EFI_SUCCESS;
- }
-
- return Status;
-}
-
-/**
- Connect the predefined platform default console device. Always try to find
- and enable the vga device if have.
-
- @param PlatformConsole Predefined platform default console device array.
-
- @retval EFI_SUCCESS Success connect at least one ConIn and ConOut
- device, there must have one ConOut device is
- active vga device.
- @return Return the status of BdsLibConnectAllDefaultConsoles ()
-
-**/
-EFI_STATUS
-PlatformBdsConnectConsole (
+VOID
+SetConsoleVariables (
VOID
)
{
@@ -205,20 +128,6 @@ PlatformBdsConnectConsole ( ASSERT_EFI_ERROR (Status);
Status = GetConsoleDevicePathFromVariable (L"ErrOut", (CHAR16*)PcdGetPtr (PcdDefaultConOutPaths), &ConErrDevicePaths);
ASSERT_EFI_ERROR (Status);
-
- // Initialize the Consoles
- Status = InitializeConsolePipe (ConOutDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **)&gST->ConOut);
- ASSERT_EFI_ERROR (Status);
- Status = InitializeConsolePipe (ConInDevicePaths, &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **)&gST->ConIn);
- ASSERT_EFI_ERROR (Status);
- Status = InitializeConsolePipe (ConErrDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **)&gST->StdErr);
- if (EFI_ERROR (Status)) {
- // In case of error, we reuse the console output for the error output
- gST->StandardErrorHandle = gST->ConsoleOutHandle;
- gST->StdErr = gST->ConOut;
- }
-
- return Status;
}
/**
@@ -284,11 +193,7 @@ PlatformBdsPolicyBehavior ( IN BASEM_MEMORY_TEST BaseMemoryTest
)
{
- EFI_STATUS Status;
-
- Status = PlatformBdsConnectConsole ();
- ASSERT_EFI_ERROR (Status);
-
+ SetConsoleVariables ();
BdsLibConnectAll ();
//
|