]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 16 Mar 2017 05:14:25 +0000 (13:14 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 17 Mar 2017 04:25:14 +0000 (12:25 +0800)
The original logic assumes GOP hande is son of PCI handle but it
is not always true.
Below wordings are from UEFI Spec:
If a graphics device supports multiple frame buffers, then
handles for the frame buffers must be created first, and then the
handles for the video output devices can be created as children of
the frame buffer handles.

So the GOP handle could be grandson of the PCI handle.

EfiBootManagerGetGopDevicePath(VideoController) is used to fix
this bug.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf

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
index 4b88e9781d02036ff53241ac1cb18853a4d629c5..6d853c136010a1157d541f317a1029b1d23ccb9d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for Console Platfrom DXE Driver.\r
 \r
-Copyright (c) 2006 - 2011, 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
@@ -36,6 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootManagerLib.h>\r
 \r
 //\r
 // Driver Binding Externs\r
index de66b468e49781d319e158f8627b0b20d091a31e..1d404dfc6f957f55fcfe3e5b93651b7dbf515bce 100644 (file)
@@ -4,7 +4,7 @@
 # Console Platfrom DXE Driver that specifies whether device can be used as console\r
 # input/output device or error output device and update global variables accordingly.\r
 #\r
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -56,6 +56,7 @@
   UefiLib\r
   UefiDriverEntryPoint\r
   DebugLib\r
+  UefiBootManagerLib\r
 \r
 [Guids]\r
   #\r