Re: [PATCH v2 14/23] efi: split out efi_find_gop_mode()

2015-08-20 Thread Jan Beulich
>>> On 20.07.15 at 16:29,  wrote:
> --- 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;

Please drop this in favor of ...

> @@ -978,46 +1030,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
> *SystemTable)
>  
>  dir_handle->Close(dir_handle);
>  
> -if ( gop && !base_video )

... keeping the original check here.

Similarly in patch 17.

With these minor adjustments, all the "efi: split out efi_..." patches
Acked-by: Jan Beulich 

Jan


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [Xen-devel] [PATCH v2 14/23] efi: split out efi_find_gop_mode()

2015-08-10 Thread Konrad Rzeszutek Wilk
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-de...@lists.xen.org
> http://lists.xen.org/xen-devel

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH v2 14/23] efi: split out efi_find_gop_mode()

2015-07-20 Thread Daniel Kiper
..which finds suitable GOP mode. We want to re-use this
code to support multiboot2 protocol on EFI platforms.

Signed-off-by: Daniel Kiper 
---
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


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel