From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZOsjI-0002Pw-Es for mharc-grub-devel@gnu.org; Mon, 10 Aug 2015 15:27:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOsjF-0002PQ-34 for grub-devel@gnu.org; Mon, 10 Aug 2015 15:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOsjA-0007Ma-R4 for grub-devel@gnu.org; Mon, 10 Aug 2015 15:27:25 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOsjA-0007MR-JO for grub-devel@gnu.org; Mon, 10 Aug 2015 15:27:20 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7AJRBWp015142 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Aug 2015 19:27:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7AJRAQd010860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 10 Aug 2015 19:27:10 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7AJRA2Y002643; Mon, 10 Aug 2015 19:27:10 GMT Received: from l.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Aug 2015 12:27:10 -0700 Received: by l.oracle.com (Postfix, from userid 1000) id 30A236A3C73; Mon, 10 Aug 2015 15:27:07 -0400 (EDT) Date: Mon, 10 Aug 2015 15:27:07 -0400 From: Konrad Rzeszutek Wilk To: Daniel Kiper Subject: Re: [Xen-devel] [PATCH v2 13/23] efi: split out efi_get_gop() Message-ID: <20150810192707.GJ13576@l.oracle.com> References: <1437402558-7313-1-git-send-email-daniel.kiper@oracle.com> <1437402558-7313-14-git-send-email-daniel.kiper@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1437402558-7313-14-git-send-email-daniel.kiper@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 Cc: jgross@suse.com, grub-devel@gnu.org, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, gang.wei@intel.com, roy.franz@linaro.org, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, phcoder@gmail.com, xen-devel@lists.xenproject.org, wei.liu2@citrix.com, richard.l.maliszewski@intel.com, qiaowei.ren@intel.com, fu.wei@linaro.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 19:27:26 -0000 On Mon, Jul 20, 2015 at 04:29:08PM +0200, Daniel Kiper wrote: > ..which gets pointer to GOP device. We want to re-use this > code to support multiboot2 protocol on EFI platforms. > > Signed-off-by: Daniel Kiper Reviewed-by: Konrad Rzeszutek Wilk > --- > v2 - suggestions/fixes: > - improve commit message > (suggested by Jan Beulich). > --- > xen/common/efi/boot.c | 59 ++++++++++++++++++++++++++++++------------------- > 1 file changed, 36 insertions(+), 23 deletions(-) > > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c > index 4614146..6fad230 100644 > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -630,6 +630,41 @@ static void __init efi_console_set_mode(void) > StdOut->SetMode(StdOut, best); > } > > +static EFI_GRAPHICS_OUTPUT_PROTOCOL __init *efi_get_gop(void) > +{ > + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; > + EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; > + EFI_HANDLE *handles; > + EFI_STATUS status; > + UINTN info_size, size = 0; > + static EFI_GUID __initdata gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; > + unsigned int i; > + > + status = efi_bs->LocateHandle(ByProtocol, &gop_guid, NULL, &size, NULL); > + if ( status == EFI_BUFFER_TOO_SMALL ) > + status = efi_bs->AllocatePool(EfiLoaderData, size, (void **)&handles); > + if ( !EFI_ERROR(status) ) > + status = efi_bs->LocateHandle(ByProtocol, &gop_guid, NULL, &size, > + handles); > + if ( EFI_ERROR(status) ) > + size = 0; > + for ( i = 0; i < size / sizeof(*handles); ++i ) > + { > + status = efi_bs->HandleProtocol(handles[i], &gop_guid, (void **)&gop); > + if ( EFI_ERROR(status) ) > + continue; > + status = gop->QueryMode(gop, gop->Mode->Mode, &info_size, &mode_info); > + if ( !EFI_ERROR(status) ) > + break; > + } > + if ( handles ) > + efi_bs->FreePool(handles); > + if ( EFI_ERROR(status) ) > + gop = NULL; > + > + return gop; > +} > + > static void __init setup_efi_pci(void) > { > EFI_STATUS status; > @@ -736,14 +771,12 @@ void EFIAPI __init noreturn > efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) > { > static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL; > - static EFI_GUID __initdata gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; > static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID; > EFI_LOADED_IMAGE *loaded_image; > EFI_STATUS status; > unsigned int i, argc; > CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL; > UINTN map_key, info_size, gop_mode = ~0; > - EFI_HANDLE *handles = NULL; > EFI_SHIM_LOCK_PROTOCOL *shim_lock; > EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL; > EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; > @@ -837,27 +870,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) > &cols, &rows) == EFI_SUCCESS ) > efi_arch_console_init(cols, rows); > > - status = efi_bs->LocateHandle(ByProtocol, &gop_guid, NULL, &size, NULL); > - if ( status == EFI_BUFFER_TOO_SMALL ) > - status = efi_bs->AllocatePool(EfiLoaderData, size, (void **)&handles); > - if ( !EFI_ERROR(status) ) > - status = efi_bs->LocateHandle(ByProtocol, &gop_guid, NULL, &size, > - handles); > - if ( EFI_ERROR(status) ) > - size = 0; > - for ( i = 0; i < size / sizeof(*handles); ++i ) > - { > - status = efi_bs->HandleProtocol(handles[i], &gop_guid, (void **)&gop); > - if ( EFI_ERROR(status) ) > - continue; > - status = gop->QueryMode(gop, gop->Mode->Mode, &info_size, &mode_info); > - if ( !EFI_ERROR(status) ) > - break; > - } > - if ( handles ) > - efi_bs->FreePool(handles); > - if ( EFI_ERROR(status) ) > - gop = NULL; > + gop = efi_get_gop(); > > /* Get the file system interface. */ > dir_handle = get_parent_handle(loaded_image, &file_name); > -- > 1.7.10.4 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel