]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ConPlatform.c
index 1ee8acf9e880303e590f94e8bce5831f3e5d6eb1..6b53e8ac74e36c480bb989086529993c39e9b7c1 100644 (file)
@@ -2,7 +2,7 @@
   Console Platform DXE Driver, install Console Device Guids and update Console\r
   Environment Variables.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -1094,10 +1094,6 @@ ConPlatformUpdateGopCandidate (
   EFI_STATUS                           Status;\r
   EFI_HANDLE                           PciHandle;\r
   EFI_HANDLE                           GopHandle;\r
-  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY  *OpenInfoBuffer;\r
-  UINTN                                EntryCount;\r
-  UINTN                                Index;\r
-  EFI_DEVICE_PATH_PROTOCOL             *ChildDevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL             *TempDevicePath;\r
 \r
   //\r
@@ -1115,40 +1111,10 @@ ConPlatformUpdateGopCandidate (
   if (EFI_ERROR (Status)) {\r
     return FALSE;\r
   }\r
-\r
-  Status = gBS->OpenProtocolInformation (\r
-                  PciHandle,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  &OpenInfoBuffer,\r
-                  &EntryCount\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return FALSE;\r
-  }\r
-\r
-  for (Index = 0; Index < EntryCount; Index++) {\r
-    //\r
-    // Query all the children created by the GOP driver\r
-    //\r
-    if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {\r
-      Status = gBS->OpenProtocol (\r
-                      OpenInfoBuffer[Index].ControllerHandle,\r
-                      &gEfiDevicePathProtocolGuid,\r
-                      (VOID **) &ChildDevicePath,\r
-                      NULL,\r
-                      NULL,\r
-                      EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                      );\r
-      if (!EFI_ERROR (Status)) {\r
-        //\r
-        // Append the device path to ConOutDev and ErrOutDev\r
-        //\r
-        ConPlatformUpdateDeviceVariable (L"ConOutDev", ChildDevicePath, Append);\r
-        ConPlatformUpdateDeviceVariable (L"ErrOutDev", ChildDevicePath, Append);\r
-      }\r
-    }\r
+  TempDevicePath = EfiBootManagerGetGopDevicePath (PciHandle);\r
+  if (TempDevicePath != NULL) {\r
+    ConPlatformUpdateDeviceVariable (L"ConOutDev", TempDevicePath, Append);\r
+    ConPlatformUpdateDeviceVariable (L"ErrOutDev", TempDevicePath, Append);\r
   }\r
-  FreePool (OpenInfoBuffer);\r
-\r
   return TRUE;\r
 }\r