From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZOsnI-0003fg-4B for mharc-grub-devel@gnu.org; Mon, 10 Aug 2015 15:31:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOsnF-0003en-FR for grub-devel@gnu.org; Mon, 10 Aug 2015 15:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOsnC-0000WF-4C for grub-devel@gnu.org; Mon, 10 Aug 2015 15:31:33 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:34121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOsnB-0000WB-TJ for grub-devel@gnu.org; Mon, 10 Aug 2015 15:31:30 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7AJVJee020834 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Aug 2015 19:31:20 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7AJVJdu008738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 10 Aug 2015 19:31:19 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t7AJVIXp012403; Mon, 10 Aug 2015 19:31:18 GMT Received: from l.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Aug 2015 12:31:17 -0700 Received: by l.oracle.com (Postfix, from userid 1000) id 3F2896A3C73; Mon, 10 Aug 2015 15:31:16 -0400 (EDT) Date: Mon, 10 Aug 2015 15:31:16 -0400 From: Konrad Rzeszutek Wilk To: Daniel Kiper Subject: Re: [Xen-devel] [PATCH v2 14/23] efi: split out efi_find_gop_mode() Message-ID: <20150810193116.GK13576@l.oracle.com> References: <1437402558-7313-1-git-send-email-daniel.kiper@oracle.com> <1437402558-7313-15-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-15-git-send-email-daniel.kiper@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0021.oracle.com [156.151.31.71] 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:31:34 -0000 On Mon, Jul 20, 2015 at 04:29:09PM +0200, Daniel Kiper wrote: > ..which finds suitable GOP mode. 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 | 94 ++++++++++++++++++++++++++++--------------------- > 1 file changed, 54 insertions(+), 40 deletions(-) > > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c > index 6fad230..8d16470 100644 > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -665,6 +665,58 @@ static EFI_GRAPHICS_OUTPUT_PROTOCOL __init *efi_get_gop(void) > return gop; > } > > +static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, > + UINTN cols, UINTN rows, UINTN depth) > +{ > + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; > + EFI_STATUS status; > + UINTN gop_mode = ~0, info_size, size; > + unsigned int i; > + > + if ( !gop ) > + return gop_mode; > + > + for ( i = size = 0; i < gop->Mode->MaxMode; ++i ) > + { > + unsigned int bpp = 0; > + > + status = gop->QueryMode(gop, i, &info_size, &mode_info); > + if ( EFI_ERROR(status) ) > + continue; > + switch ( mode_info->PixelFormat ) > + { > + case PixelBitMask: > + bpp = hweight32(mode_info->PixelInformation.RedMask | > + mode_info->PixelInformation.GreenMask | > + mode_info->PixelInformation.BlueMask); > + break; > + case PixelRedGreenBlueReserved8BitPerColor: > + case PixelBlueGreenRedReserved8BitPerColor: > + bpp = 24; > + break; > + default: > + continue; > + } > + if ( cols == mode_info->HorizontalResolution && > + rows == mode_info->VerticalResolution && > + (!depth || bpp == depth) ) > + { > + gop_mode = i; > + break; > + } > + if ( !cols && !rows && > + mode_info->HorizontalResolution * > + mode_info->VerticalResolution > size ) > + { > + size = mode_info->HorizontalResolution * > + mode_info->VerticalResolution; > + gop_mode = i; > + } > + } > + > + return gop_mode; > +} > + > static void __init setup_efi_pci(void) > { > EFI_STATUS status; > @@ -978,46 +1030,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) > > dir_handle->Close(dir_handle); > > - if ( gop && !base_video ) > - { > - for ( i = size = 0; i < gop->Mode->MaxMode; ++i ) > - { > - unsigned int bpp = 0; > - > - status = gop->QueryMode(gop, i, &info_size, &mode_info); > - if ( EFI_ERROR(status) ) > - continue; > - switch ( mode_info->PixelFormat ) > - { > - case PixelBitMask: > - bpp = hweight32(mode_info->PixelInformation.RedMask | > - mode_info->PixelInformation.GreenMask | > - mode_info->PixelInformation.BlueMask); > - break; > - case PixelRedGreenBlueReserved8BitPerColor: > - case PixelBlueGreenRedReserved8BitPerColor: > - bpp = 24; > - break; > - default: > - continue; > - } > - if ( cols == mode_info->HorizontalResolution && > - rows == mode_info->VerticalResolution && > - (!depth || bpp == depth) ) > - { > - gop_mode = i; > - break; > - } > - if ( !cols && !rows && > - mode_info->HorizontalResolution * > - mode_info->VerticalResolution > size ) > - { > - size = mode_info->HorizontalResolution * > - mode_info->VerticalResolution; > - gop_mode = i; > - } > - } > - } > + if ( !base_video ) > + gop_mode = efi_find_gop_mode(gop, cols, rows, depth); > } > > efi_arch_edd(); > -- > 1.7.10.4 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel