]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
ArmPlatformPkg/PlatformIntelBdsLib: don't clobber ConSplitter handle
[mirror_edk2.git] / ArmPlatformPkg / Library / PlatformIntelBdsLib / IntelBdsPlatform.c
index 8858668543294830a193985847043f2dc6de018f..5632b5da7500a2ce57d2b8309b7a8ce5eee14a8e 100644 (file)
@@ -148,12 +148,23 @@ InitializeConsolePipe (
 \r
     Status = BdsLibConnectDevicePath (DevicePath);\r
     if (!EFI_ERROR (Status)) {\r
+\r
       //\r
-      // If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL\r
-      // value. So ASSERT that this is the case.\r
+      // We connect all supplied console device paths, but only return the first\r
+      // one that connects successfully via *Handle/*Interface. Note that this\r
+      // may imply that *Handle/*Interface are not updated at all if they have\r
+      // been connected already, e.g., by the console splitter driver.\r
       //\r
-      gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle);\r
-      ASSERT (*Handle != NULL);\r
+      if (*Interface == NULL) {\r
+        //\r
+        // If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL\r
+        // value. So ASSERT that this is the case.\r
+        //\r
+        gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle);\r
+        ASSERT (*Handle != NULL);\r
+\r
+        gBS->HandleProtocol (*Handle, Protocol, Interface);\r
+      }\r
     }\r
     DEBUG_CODE_BEGIN();\r
       if (EFI_ERROR(Status)) {\r
@@ -172,12 +183,6 @@ InitializeConsolePipe (
         }\r
       }\r
     DEBUG_CODE_END();\r
-\r
-    // If the console splitter driver is not supported by the platform then use the first Device Path\r
-    // instance for the console interface.\r
-    if (!EFI_ERROR(Status) && (*Interface == NULL)) {\r
-      Status = gBS->HandleProtocol (*Handle, Protocol, Interface);\r
-    }\r
   }\r
 \r
   // No Device Path has been defined for this console interface. We take the first protocol implementation\r