File 0006-efi_loader-gop-Expose-fb-when-32bpp.patch of Package u-boot-highbank

From 9dca5c94e20c8939368352d337a27d37260d3e42 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 6 Jun 2016 17:35:10 +0200
Subject: [PATCH] efi_loader: gop: Expose fb when 32bpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When we're running in 32bpp mode, expose the frame buffer address
to our payloads so that Linux efifb can pick it up.

Signed-off-by: Alexander Graf <agraf@suse.de>
[AF: Backport v2 (fb_base, fb_size) as build fix]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 lib/efi_loader/efi_gop.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 33a3d71..286ad83 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -129,6 +129,7 @@ int efi_gop_register(void)
 {
 	struct efi_gop_obj *gopobj;
 	u32 bpix, col, row;
+	u64 fb_base, fb_size;
 
 #ifdef CONFIG_DM_VIDEO
 	struct udevice *vdev;
@@ -141,11 +142,16 @@ int efi_gop_register(void)
 	bpix = priv->bpix;
 	col = video_get_xsize(vdev);
 	row = video_get_ysize(vdev);
+	fb_base = (uintptr_t)priv->fb;
+	fb_size = priv->fb_size;
 #else
+	int line_len;
 
 	bpix = panel_info.vl_bpix;
 	col = panel_info.vl_col;
 	row = panel_info.vl_row;
+	fb_base = gd->fb_base;
+	fb_size = lcd_get_size(&line_len);
 #endif
 
 	switch (bpix) {
@@ -177,6 +183,16 @@ int efi_gop_register(void)
 	gopobj->mode.info = &gopobj->info;
 	gopobj->mode.info_size = sizeof(gopobj->info);
 
+#ifdef CONFIG_DM_VIDEO
+	if (bpix == VIDEO_BPP32) {
+#else
+	if (bpix == LCD_COLOR32) {
+#endif
+		/* With 32bit color space we can directly expose the fb */
+		gopobj->mode.fb_base = fb_base;
+		gopobj->mode.fb_size = fb_size;
+	}
+
 	gopobj->info.version = 0;
 	gopobj->info.width = col;
 	gopobj->info.height = row;
openSUSE Build Service is sponsored by