From patchwork Tue Feb 7 12:58:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 725097 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3vHktX3fhXz9ryb for ; Tue, 7 Feb 2017 23:58:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=aosc.xyz header.i=@aosc.xyz header.b="Zlr277w3"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4E4F14AE71; Tue, 7 Feb 2017 13:58:56 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0ZVHA-5n1zT5; Tue, 7 Feb 2017 13:58:56 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A99C4AD1F; Tue, 7 Feb 2017 13:58:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5633A4AD1F for ; Tue, 7 Feb 2017 13:58:52 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pl-QoQ3BNL6Z for ; Tue, 7 Feb 2017 13:58:52 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from forward12j.cmail.yandex.net (forward12j.cmail.yandex.net [5.255.227.176]) by theia.denx.de (Postfix) with ESMTPS id 04FE54ACF9 for ; Tue, 7 Feb 2017 13:58:48 +0100 (CET) Received: from smtp1m.mail.yandex.net (smtp1m.mail.yandex.net [77.88.61.132]) by forward12j.cmail.yandex.net (Yandex) with ESMTP id 27D82215DE; Tue, 7 Feb 2017 15:58:47 +0300 (MSK) Received: from smtp1m.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1m.mail.yandex.net (Yandex) with ESMTP id D23D263C0812; Tue, 7 Feb 2017 15:58:44 +0300 (MSK) Received: by smtp1m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Ik01QyVrxL-weZiCsxZ; Tue, 07 Feb 2017 15:58:43 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aosc.xyz; s=mail; t=1486472324; bh=7MibRLxGfPjXYSWCOFXQJXQSTIll+pDe2V7rtEfy+Bc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Zlr277w3u1LfVIFuoLWkDoC5fLjToWBFSD87kfwHj7UDIf3GP7+OpExpRr+uZQhnm AV+5C8ZJhqeA0Gl0+gA/nArNB2T9spdUCEDIn9J+BQI1U1pa7f1HHC64M27waVpL88 Fjcn924kO/lDiWTAA3PdB7XvT2nJ7Fpc3F5YAtJk= Authentication-Results: smtp1m.mail.yandex.net; dkim=pass header.i=@aosc.xyz X-Yandex-ForeignMX: DE X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0,1 1130000036118848 From: Icenowy Zheng To: Alexander Graf , Anatolij Gustschin , Simon Glass Date: Tue, 7 Feb 2017 20:58:12 +0800 Message-Id: <20170207125812.27167-2-icenowy@aosc.xyz> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170207125812.27167-1-icenowy@aosc.xyz> References: <20170207125812.27167-1-icenowy@aosc.xyz> Cc: u-boot@lists.denx.de, Icenowy Zheng Subject: [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" As cfb_console now can expose its GraphicDevice, use it in the implementation of EFI GOP protocol, so that the graphics framebuffer can be passed to EFI applications. Signed-off-by: Icenowy Zheng --- Tested on an Allwinner H3 board with out-of-tree display support. cmd/bootefi.c | 2 +- lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_gop.c | 29 ++++++++++++++++++++++++----- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 97a0fc9c7c..c0636ba5a3 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -210,7 +210,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt) #ifdef CONFIG_PARTITIONS efi_disk_register(); #endif -#ifdef CONFIG_LCD +#if defined CONFIG_LCD || defined CONFIG_CFB_CONSOLE efi_gop_register(); #endif #ifdef CONFIG_NET diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index fa8b91a526..e88c99528c 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o obj-y += efi_memory.o obj-$(CONFIG_LCD) += efi_gop.o +obj-$(CONFIG_CFB_CONSOLE) += efi_gop.o obj-$(CONFIG_PARTITIONS) += efi_disk.o obj-$(CONFIG_NET) += efi_net.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index 286ad83097..86f9aa2d70 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -80,8 +81,10 @@ static efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer, switch (gopobj->bpix) { #ifdef CONFIG_DM_VIDEO case VIDEO_BPP32: -#else +#elif defined CONFIG_LCD case LCD_COLOR32: +#elif defined CONFIG_CFB_CONSOLE + case GDF_32BIT_X888RGB: #endif for (i = 0; i < height; i++) { u32 *dest = fb + ((i + dy) * line_len32) + @@ -117,7 +120,7 @@ static efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer, #ifdef CONFIG_DM_VIDEO video_sync_all(); -#else +#elif defined CONFIG_LCD lcd_sync(); #endif @@ -144,7 +147,7 @@ int efi_gop_register(void) row = video_get_ysize(vdev); fb_base = (uintptr_t)priv->fb; fb_size = priv->fb_size; -#else +#elif defined CONFIG_LCD int line_len; bpix = panel_info.vl_bpix; @@ -152,15 +155,29 @@ int efi_gop_register(void) row = panel_info.vl_row; fb_base = gd->fb_base; fb_size = lcd_get_size(&line_len); +#elif defined CONFIG_CFB_CONSOLE + GraphicDevice *pGD; + + pGD = video_get_graphic_device(); + bpix = pGD->gdfIndex; + col = pGD->winSizeX; + row = pGD->winSizeY; + fb_base = pGD->frameAdrs; + if (pGD->memSize) + fb_size = pGD->memSize; + else + fb_size = pGD->plnSizeX * row; #endif switch (bpix) { #ifdef CONFIG_DM_VIDEO case VIDEO_BPP16: case VIDEO_BPP32: -#else +#elif defined CONFIG_LCD case LCD_COLOR32: case LCD_COLOR16: +#elif defined CONFIG_CFB_CONSOLE + case GDF_32BIT_X888RGB: #endif break; default: @@ -185,8 +202,10 @@ int efi_gop_register(void) #ifdef CONFIG_DM_VIDEO if (bpix == VIDEO_BPP32) { -#else +#elif defined CONFIG_LCD if (bpix == LCD_COLOR32) { +#elif defined CONFIG_CFB_CONSOLE + if (bpix == GDF_32BIT_X888RGB) { #endif /* With 32bit color space we can directly expose the fb */ gopobj->mode.fb_base = fb_base;