diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c index 8858668543..5632b5da75 100644 --- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c +++ b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c @@ -148,12 +148,23 @@ InitializeConsolePipe ( Status = BdsLibConnectDevicePath (DevicePath); if (!EFI_ERROR (Status)) { + // - // If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL - // value. So ASSERT that this is the case. + // We connect all supplied console device paths, but only return the first + // one that connects successfully via *Handle/*Interface. Note that this + // may imply that *Handle/*Interface are not updated at all if they have + // been connected already, e.g., by the console splitter driver. // - gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle); - ASSERT (*Handle != NULL); + if (*Interface == NULL) { + // + // If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL + // value. So ASSERT that this is the case. + // + gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle); + ASSERT (*Handle != NULL); + + gBS->HandleProtocol (*Handle, Protocol, Interface); + } } DEBUG_CODE_BEGIN(); if (EFI_ERROR(Status)) { @@ -172,12 +183,6 @@ InitializeConsolePipe ( } } 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