* [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson
@ 2017-03-16 5:14 Ruiyu Ni
2017-03-16 6:03 ` Fan, Jeff
0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-03-16 5:14 UTC (permalink / raw)
To: edk2-devel; +Cc: Jeff Fan
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>
Cc: Jeff Fan <jeff.fan@intel.com>
---
.../Universal/Console/ConPlatformDxe/ConPlatform.c | 44 +++-------------------
.../Universal/Console/ConPlatformDxe/ConPlatform.h | 3 +-
.../Console/ConPlatformDxe/ConPlatformDxe.inf | 3 +-
3 files changed, 9 insertions(+), 41 deletions(-)
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
index 1ee8acf..6b53e8a 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
@@ -2,7 +2,7 @@
Console Platform DXE Driver, install Console Device Guids and update Console
Environment Variables.
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1094,10 +1094,6 @@ ConPlatformUpdateGopCandidate (
EFI_STATUS Status;
EFI_HANDLE PciHandle;
EFI_HANDLE GopHandle;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
//
@@ -1115,40 +1111,10 @@ ConPlatformUpdateGopCandidate (
if (EFI_ERROR (Status)) {
return FALSE;
}
-
- Status = gBS->OpenProtocolInformation (
- PciHandle,
- &gEfiPciIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- for (Index = 0; Index < EntryCount; Index++) {
- //
- // Query all the children created by the GOP driver
- //
- if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->OpenProtocol (
- OpenInfoBuffer[Index].ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ChildDevicePath,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Append the device path to ConOutDev and ErrOutDev
- //
- ConPlatformUpdateDeviceVariable (L"ConOutDev", ChildDevicePath, Append);
- ConPlatformUpdateDeviceVariable (L"ErrOutDev", ChildDevicePath, Append);
- }
- }
+ TempDevicePath = EfiBootManagerGetGopDevicePath (PciHandle);
+ if (TempDevicePath != NULL) {
+ ConPlatformUpdateDeviceVariable (L"ConOutDev", TempDevicePath, Append);
+ ConPlatformUpdateDeviceVariable (L"ErrOutDev", TempDevicePath, Append);
}
- FreePool (OpenInfoBuffer);
-
return TRUE;
}
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
index 4b88e97..6d853c1 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
@@ -1,7 +1,7 @@
/** @file
Header file for Console Platfrom DXE Driver.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -36,6 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootManagerLib.h>
//
// Driver Binding Externs
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
index de66b46..1d404df 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
@@ -4,7 +4,7 @@
# Console Platfrom DXE Driver that specifies whether device can be used as console
# input/output device or error output device and update global variables accordingly.
#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -56,6 +56,7 @@ [LibraryClasses]
UefiLib
UefiDriverEntryPoint
DebugLib
+ UefiBootManagerLib
[Guids]
#
--
2.9.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson
2017-03-16 5:14 [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson Ruiyu Ni
@ 2017-03-16 6:03 ` Fan, Jeff
0 siblings, 0 replies; 2+ messages in thread
From: Fan, Jeff @ 2017-03-16 6:03 UTC (permalink / raw)
To: Ni, Ruiyu, edk2-devel@lists.01.org
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
-----Original Message-----
From: Ni, Ruiyu
Sent: Thursday, March 16, 2017 1:15 PM
To: edk2-devel@lists.01.org
Cc: Fan, Jeff
Subject: [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson
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>
Cc: Jeff Fan <jeff.fan@intel.com>
---
.../Universal/Console/ConPlatformDxe/ConPlatform.c | 44 +++------------------- .../Universal/Console/ConPlatformDxe/ConPlatform.h | 3 +-
.../Console/ConPlatformDxe/ConPlatformDxe.inf | 3 +-
3 files changed, 9 insertions(+), 41 deletions(-)
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
index 1ee8acf..6b53e8a 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
@@ -2,7 +2,7 @@
Console Platform DXE Driver, install Console Device Guids and update Console
Environment Variables.
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1094,10 +1094,6 @@ ConPlatformUpdateGopCandidate (
EFI_STATUS Status;
EFI_HANDLE PciHandle;
EFI_HANDLE GopHandle;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
//
@@ -1115,40 +1111,10 @@ ConPlatformUpdateGopCandidate (
if (EFI_ERROR (Status)) {
return FALSE;
}
-
- Status = gBS->OpenProtocolInformation (
- PciHandle,
- &gEfiPciIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- for (Index = 0; Index < EntryCount; Index++) {
- //
- // Query all the children created by the GOP driver
- //
- if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->OpenProtocol (
- OpenInfoBuffer[Index].ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ChildDevicePath,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Append the device path to ConOutDev and ErrOutDev
- //
- ConPlatformUpdateDeviceVariable (L"ConOutDev", ChildDevicePath, Append);
- ConPlatformUpdateDeviceVariable (L"ErrOutDev", ChildDevicePath, Append);
- }
- }
+ TempDevicePath = EfiBootManagerGetGopDevicePath (PciHandle); if
+ (TempDevicePath != NULL) {
+ ConPlatformUpdateDeviceVariable (L"ConOutDev", TempDevicePath, Append);
+ ConPlatformUpdateDeviceVariable (L"ErrOutDev", TempDevicePath,
+ Append);
}
- FreePool (OpenInfoBuffer);
-
return TRUE;
}
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
index 4b88e97..6d853c1 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
@@ -1,7 +1,7 @@
/** @file
Header file for Console Platfrom DXE Driver.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -36,6 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootManagerLib.h>
//
// Driver Binding Externs
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
index de66b46..1d404df 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
@@ -4,7 +4,7 @@
# Console Platfrom DXE Driver that specifies whether device can be used as console # input/output device or error output device and update global variables accordingly.
#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights
+reserved.<BR>
#
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -56,6 +56,7 @@ [LibraryClasses]
UefiLib
UefiDriverEntryPoint
DebugLib
+ UefiBootManagerLib
[Guids]
#
--
2.9.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-16 6:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 5:14 [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson Ruiyu Ni
2017-03-16 6:03 ` Fan, Jeff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox