From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E47BC433F5 for ; Wed, 8 Sep 2021 17:40:28 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67C7761059 for ; Wed, 8 Sep 2021 17:40:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 67C7761059 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C8DE3833FB; Wed, 8 Sep 2021 19:40:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="i5lZ7hZ7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5890083414; Wed, 8 Sep 2021 19:40:24 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B265C833AB for ; Wed, 8 Sep 2021 19:40:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1631122817; bh=cLNqnYCPKbznvirfjydpW46GYM7d9uQ2s5IFJ+v1nmg=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=i5lZ7hZ7crinfMfjc+Yi0sqMxe6FFWg84ItjxdZR8/6dOdDsOgvlzaEbyjCWPzlaK CbRy/gIiVItJZJJSSZCWHRIJoFmJz9SYafI8xR2AQuSRnN3pkENBo1I1oS11ZtByCf +FwnSdqI3yXKRlLm/fIcvObbnRJXp4DCY59cAKws= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.157]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N6bfw-1n0out263y-0185py; Wed, 08 Sep 2021 19:40:17 +0200 Subject: Re: [PATCH 10/35] efi: Add video support to the app To: Simon Glass Cc: Ilias Apalodimas , Bin Meng , Tom Rini , Christian Melki , Alexander Graf , U-Boot Mailing List References: <20210908133405.696481-1-sjg@chromium.org> <20210908073355.10.Ibf877904b58b5ba17bdd00f80dcd3f8b8e0c1f39@changeid> From: Heinrich Schuchardt Message-ID: <7c9010f7-afdd-ebf4-f534-9579d9c2e5d3@gmx.de> Date: Wed, 8 Sep 2021 19:40:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210908073355.10.Ibf877904b58b5ba17bdd00f80dcd3f8b8e0c1f39@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:3k8wmmzCE5YEiruRSj8UDNyHfLS8599dH5t+9Kzz7WBKvHny8VA 0/3puC6eaHQBzFV1RDT+67+Klxm/SDiDx8+IYeZ9mqfZPkefxfBTvhBKNRCNhuGFLJPY6gz jc/if/tNWNsuGgDMHx2SjxkdqgbjvELzn90eWq86zSUEB6lH4cVOGMjprGrVpHVhmhrL41K Di5td38p8BBL/OY3oLUsQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:bXw7eF8dLe4=:gSkWkIzfuZutO5U+jbGL0L SKgH2ZJzUp8A6wty1gNGHVHenh0BdeU9oz9R6uYkXQMU2tCysrwGLQGmUQY5Cy2zJiChibmCB 4fLUEe493Ar0CgfOE1f0W7cO9gWbxwWITHCjM4JGL7auBzh9I5pjGmTuBECbBtUnqswryU/z5 Z+1hRU6VJ0b24JbGh2ZASriUYL3ILfn3Zd0e2vex/gC048aBAijL16XNNiBbHr3gCnxUB1Xrl noGD4Q9g+EIMt7071gYeLy/Zd/n5x/jc/qbGWdYdq03EVrfr2JMrDmDKa4MGqfkH96GOaOs4+ E6F9eK+1XJL/M2rhTG79fD0M++xt7aVDxAtoSWub3K2nheQ/JsFCGAj9+KXECuMk4kIIC8aQp vd9YyVgcmTmD3JuxiTlaoKmCx4aPowAIj+tsDoq5ZoSlUGk+1IuKTEYMu2Fe98zWAUhs8brYl k5OqqxsEKtAe7lP48xc8gmqz6o//PmyPXGIBrkCdFWb0oGZkSpKx7Tcc5VOjuXrG05NUDStgW SHcCKHOhbXsMSmsd705ySo7uhobPW7m/AM/+k9vE1/XBH+slZQmPEq5H7GP+rgsxib6ZFHWQM z7ve8pTzEjAuDODgeK6Cwf4Izcj2v1OFilGOUY0QlZXUMd7WYo2h5dAzKhKiCvlHzNqDhI/1B eMYxMxPkAu7/VAyKwlZApay5ozYb9VzVTnlbFsGnaXTg2IF0v78F6D/86q0r0MRq8YGY9HsVG Dpk4NBc6E8tOKz0O89i12HOn9vAhUFD/WNnunfWfD68xpsUFewPPouA7Aw95RRUb0zOJOqGud E8gUspfMNZCmwxwCjo584DVphoMzGsV3/yGnjppRX5RhTATRRnpupLHdWTFXYfjGjgsCf4juO MGyZEsNJfFLU/4L4PteQPKbpCjUd+xG9k7OPd49ytLdwRxNSgNbzPx1a4HHvtha3OWv+RwIw+ 7In2Zn7hJO3f0TNkl/1j656nEiA1F5ztU6azwz13a97nc+ozodEByNEng0wlcAM79xY3BGRgI Y87/hsMfHZ9rEr8V1L81IQbtuIfy4sc0dJmBN0uqt3E/RJ/S8jpMVBAwtz2LhMk/XgtvpTnCw WWUu1q4n45NHQw= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 9/8/21 3:33 PM, Simon Glass wrote: > The current EFI video driver only works when running in the stub. In tha= t > case the stub calls boot services (before jumping to U-Boot proper) and > copies the graphics info over to the efi table. This is necessary becaus= e > the stub exits boot services before jumping to U-Boot. > > The app maintains access to boot services throughout its life, so does n= ot > need to do this. Update the driver to support calling boot services > directly. > > Enable video output for the app. Please, use the EFI_GRAPHICS_OUTPUT_PROTOCOL to implement video. Don't assume any VESA or VGA compatible card. This would not be portable to other architectures. Best regards Heinrich > > A sample qemu command-line for this case is: > > qemu-system-x86_64 -bios /usr/share/edk2.git/ovmf-ia32/OVMF-pure-efi= .fd > -drive id=3Ddisk,file=3Dtry.img,if=3Dnone,format=3Draw -nic none > -device ahci,id=3Dahci -device ide-hd,drive=3Ddisk,bus=3Dahci.0 > > Signed-off-by: Simon Glass > --- > > arch/x86/dts/efi-x86_app.dts | 4 ++++ > board/efi/efi-x86_app/Kconfig | 4 ++++ > drivers/video/Kconfig | 2 +- > drivers/video/efi.c | 45 ++++++++++++++++++++++++++++------- > include/configs/efi-x86_app.h | 6 ++--- > 5 files changed, 49 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/dts/efi-x86_app.dts b/arch/x86/dts/efi-x86_app.dts > index 04e044a07a8..a5316e2a1a7 100644 > --- a/arch/x86/dts/efi-x86_app.dts > +++ b/arch/x86/dts/efi-x86_app.dts > @@ -25,4 +25,8 @@ > compatible =3D "efi,reset"; > u-boot,dm-pre-reloc; > }; > + efi-fb { > + compatible =3D "efi-fb"; > + }; > + > }; > diff --git a/board/efi/efi-x86_app/Kconfig b/board/efi/efi-x86_app/Kconf= ig > index e412702eed7..ecd08d73146 100644 > --- a/board/efi/efi-x86_app/Kconfig > +++ b/board/efi/efi-x86_app/Kconfig > @@ -12,4 +12,8 @@ config SYS_SOC > config SYS_CONFIG_NAME > default "efi-x86_app" > > +config BOARD_SPECIFIC_OPTIONS # dummy > + def_bool y > + imply VIDEO_EFI > + > endif > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > index 8b940d70eb2..38a421690d9 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -250,7 +250,7 @@ config VIDEO_COREBOOT > > config VIDEO_EFI > bool "Enable EFI framebuffer driver support" > - depends on EFI_STUB > + depends on EFI_STUB || EFI_APP > help > Turn on this option to enable a framebuffeer driver when U-Boot is > loaded as a payload (see README.u-boot_on_efi) by an EFI BIOS where > diff --git a/drivers/video/efi.c b/drivers/video/efi.c > index c248bd352a7..4e13a3efcb1 100644 > --- a/drivers/video/efi.c > +++ b/drivers/video/efi.c > @@ -50,6 +50,28 @@ static void efi_find_pixel_bits(u32 mask, u8 *pos, u8= *size) > *size =3D len; > } > > +static int get_mode_info(struct vesa_mode_info *vesa) > +{ > + efi_guid_t efi_gop_guid =3D EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; > + struct efi_boot_services *boot =3D efi_get_boot(); > + struct efi_gop_mode *mode; > + struct efi_gop *gop; > + int ret; > + > + if (!boot) > + return log_msg_ret("sys", -ENOSYS); > + ret =3D boot->locate_protocol(&efi_gop_guid, NULL, (void **)&gop); > + if (ret) > + return log_msg_ret("prot", -ENOTSUPP); > + > + mode =3D gop->mode; > + vesa->phys_base_ptr =3D mode->fb_base; > + vesa->x_resolution =3D mode->info->width; > + vesa->y_resolution =3D mode->info->height; > + > + return 0; > +} > + > static int save_vesa_mode(struct vesa_mode_info *vesa) > { > struct efi_entry_gopmode *mode; > @@ -57,16 +79,23 @@ static int save_vesa_mode(struct vesa_mode_info *ves= a) > int size; > int ret; > > - ret =3D efi_info_get(EFIET_GOP_MODE, (void **)&mode, &size); > - if (ret =3D=3D -ENOENT) { > - debug("efi graphics output protocol mode not found\n"); > - return -ENXIO; > + if (IS_ENABLED(CONFIG_EFI_APP)) { > + ret =3D get_mode_info(vesa); > + if (ret) { > + printf("efi graphics output protocol not found\n"); > + return -ENXIO; > + } > + } else { > + ret =3D efi_info_get(EFIET_GOP_MODE, (void **)&mode, &size); > + if (ret =3D=3D -ENOENT) { > + printf("efi graphics output protocol mode not found\n"); > + return -ENXIO; > + } > + vesa->phys_base_ptr =3D mode->fb_base; > + vesa->x_resolution =3D mode->info->width; > + vesa->y_resolution =3D mode->info->height; > } > > - vesa->phys_base_ptr =3D mode->fb_base; > - vesa->x_resolution =3D mode->info->width; > - vesa->y_resolution =3D mode->info->height; > - > if (mode->info->pixel_format < EFI_GOT_BITMASK) { > fbinfo =3D &efi_framebuffer_format_map[mode->info->pixel_format]; > vesa->red_mask_size =3D fbinfo->red.size; > diff --git a/include/configs/efi-x86_app.h b/include/configs/efi-x86_app= .h > index 33418cfbec4..6061a6db0a4 100644 > --- a/include/configs/efi-x86_app.h > +++ b/include/configs/efi-x86_app.h > @@ -10,8 +10,8 @@ > > #undef CONFIG_TPM_TIS_BASE_ADDRESS > > -#define CONFIG_STD_DEVICES_SETTINGS "stdin=3Dusbkbd,vga,serial\0" \ > - "stdout=3Dvga,serial\0" \ > - "stderr=3Dvga,serial\0" > +#define CONFIG_STD_DEVICES_SETTINGS "stdin=3Dserial\0" \ > + "stdout=3Dvidconsole\0" \ > + "stderr=3Dvidconsole\0" > > #endif >