From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 85E498036B for ; Wed, 15 Mar 2017 23:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489644235; x=1521180235; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=VUfPtgXvGabTQDghu2bvalTKdPW2kt7Aya7CDSZryY8=; b=NT/MVk6hAxCGUTgO3NBSYMr7kHJvzH/bws/LHgAQoNKU8J+FLSrfQ++T iQu5atkuv24OGuslb5iT5nx4Fw6l6A==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Mar 2017 23:03:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="1142925501" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 15 Mar 2017 23:03:53 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 15 Mar 2017 23:03:53 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 15 Mar 2017 23:03:53 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Thu, 16 Mar 2017 14:03:51 +0800 From: "Fan, Jeff" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson Thread-Index: AQHSnhRNcrTrUPUDfkiMuCuFEUBXtaGW+d1A Date: Thu, 16 Mar 2017 06:03:50 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4C561CC5@shsmsx102.ccr.corp.intel.com> References: <20170316051455.425108-1-ruiyu.ni@intel.com> In-Reply-To: <20170316051455.425108-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDRlNTEyNDAtYzE1Ny00ZTM4LTk2OTktOWI1OTM2Y2NjNDI4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InRhRGNUSERWdDA3eGVFZlhXNVJtNFBoTkJ5MkdEQUVHQmVYMmE2MUZ3Tmc9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Mar 2017 06:03:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jeff Fan -----Original Message----- From: Ni, Ruiyu=20 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 gra= ndson The original logic assumes GOP hande is son of PCI handle but it is not alw= ays 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 out= put 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 Cc: Jeff Fan --- .../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 Con= sole Environment Variables. =20 -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s 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; =20 // @@ -1115,40 +1111,10 @@ ConPlatformUpdateGopCandidate ( if (EFI_ERROR (Status)) { return FALSE; } - - Status =3D gBS->OpenProtocolInformation ( - PciHandle, - &gEfiPciIoProtocolGuid, - &OpenInfoBuffer, - &EntryCount - ); - if (EFI_ERROR (Status)) { - return FALSE; - } - - for (Index =3D 0; Index < EntryCount; Index++) { - // - // Query all the children created by the GOP driver - // - if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CON= TROLLER) !=3D 0) { - Status =3D 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, Ap= pend); - ConPlatformUpdateDeviceVariable (L"ErrOutDev", ChildDevicePath, Ap= pend); - } - } + TempDevicePath =3D EfiBootManagerGetGopDevicePath (PciHandle); if=20 + (TempDevicePath !=3D NULL) { + ConPlatformUpdateDeviceVariable (L"ConOutDev", TempDevicePath, Append)= ; + ConPlatformUpdateDeviceVariable (L"ErrOutDev", TempDevicePath,=20 + 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. =20 -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s 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 I= MPLIED. #include #include #include +#include =20 // // Driver Binding Externs diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.i= nf 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 va= riables accordingly. # -# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights=20 +reserved.
# # This program and the accompanying materials # are licensed and made a= vailable under the terms and conditions of the BSD License @@ -56,6 +56,7 @= @ [LibraryClasses] UefiLib UefiDriverEntryPoint DebugLib + UefiBootManagerLib =20 [Guids] # -- 2.9.0.windows.1