diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-03-01 18:34:33 +0000 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-03-03 21:42:38 +0000 |
commit | 3858b4a1ff09d3243fea8d07bd135478237cb8f7 (patch) | |
tree | 5f36fdd0f6610407d512ddeddd33cb37c633f915 /ArmPlatformPkg | |
parent | f1bbd4e3cc57c59a5d0efc9bf4f27cbc80810b36 (diff) | |
download | edk2-platforms-3858b4a1ff09d3243fea8d07bd135478237cb8f7.tar.xz |
ArmPlatformPkg/PlatformIntelBdsLib: don't clobber ConSplitter handle
The InitializeConsolePipe() routine takes care to only set its output
argument *Interface if it is not already set, to prevent overwriting
the ConSplitter interface pointer that may have already been assigned.
However, the associated OUT argument 'Handle' is clobbered by the
subsequent unnecessary LocateDevicePath() invocation, which should
similarly be made dependent on whether *Interface has been set
already.
Reported-by: "Lee, Terry Ping-Chung" <terry.lee@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r-- | ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c | 25 |
1 files changed, 15 insertions, 10 deletions
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
|