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=-7.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 5547CC4338F for ; Fri, 13 Aug 2021 10:02:51 +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 A7EC060E09 for ; Fri, 13 Aug 2021 10:02:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A7EC060E09 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 017C782D73; Fri, 13 Aug 2021 12:02:47 +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="C3Qkoku4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 049C182DC3; Fri, 13 Aug 2021 12:02:46 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (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 460B482D13 for ; Fri, 13 Aug 2021 12:02:41 +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=1628848959; bh=Qtr63BlnuqOuEfrWEmoYi4ZK6hHNgb4MM7yocXrSlKo=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=C3Qkoku4SNNokVhjaXy9KDTbrzfYAVRR+lZaw/MudYKBGghbPQ9XmxOI6P7r6QrhK OXxnKlPBNn6fioXhA1ulUrUcH6hWMNRUGkkckc1rF1cc9ly8Y5ArTG9vBBhzIj7nQg nirJtc7oARJ9vYk/0H0f9W6Fg+rlItVM/EvbdkTg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.157]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MvbG2-1n3hYv1XgU-00sgXV; Fri, 13 Aug 2021 12:02:39 +0200 Subject: Re: Hints on how to use efi_driver/efi_block_device.c To: Christian Melki Cc: U-Boot Mailing List , Simon Glass , takahiro.akashi@linaro.org References: <63da56b7-85d2-c39e-2112-9d1296d87aad@t2data.com> <985f1960-868f-83b3-6b1e-a90f682be0a4@gmx.de> <24b70edf-dc17-f135-7fa7-260fc6127dc7@t2data.com> From: Heinrich Schuchardt Message-ID: Date: Fri, 13 Aug 2021 12:02:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <24b70edf-dc17-f135-7fa7-260fc6127dc7@t2data.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:CG0pXc/V/8LG7Q4cPz9lDuzcMThQzcBDWbZops+3SDD9sxGO5TQ 2sBtH/xwW2eRr28XEMwUgPVVFWLEE469C4ClJqAoT85g1PPS1DqLeWGXAVFJvKyZinXH6ve sZVl8iqy6C0hS/vY/eBNMdxW+y1p9T9EsZL1epQZ5/l4v0f+/cb/coTtJ+qPWLkFMD+spMN ueNhv+HbHTgLcFggfEYHA== X-UI-Out-Filterresults: notjunk:1;V03:K0:dP/ps+QXlCs=:6eGiTej2tl5k0zfaCm3iZM nbeEBs5cvrN8T7aeXF1jniF912WIbOP/led59xrjpTo8B3aXvuJXbZrqpQDuOJrqXJB5EjVaE J/IQtRUMuoWmI/MsE89eh/Pmnv7rjbL//MUgXNeA2DMvpr+uNJxgBDSyazDuy8gLPZteARTgh 9RWgxXfnCbgzjJXd7BQ1utPLoRDkVRG5kLpw7n1KB7Ed8EIbngX5MYt2/7PrhEqx15eSCe+AG ol46dRXxlwBd4kZio6rbVD43bxdDutyI3sMprjvuK3bE/Up+R4MPC2+5qHlQX6Vh0ThQ97Q1k 1eVT9Hmd2bbI5JUVBnG0f5okOhYMljXX3Wgwrcbi5PeJixi5aQzJZ74qXZ00y2F5t5HsnbXgV ILwd2d/KzoyBZg6A2q8SePPiu7TRUpEcXcURVXCfnvgEBgNy+9FrW/t8tCvAOHhHVI9wLvJNZ 0Ve/ZEAvBoBo4LEwaXMAQ2t01GlrlR5xjU0uYO+91q70moO7cckec0v5wCMhYxA99OXeLMDPX 8jOW9T5gXUVDU1QftyRd+36VP+gCMH/Oa9fSlrRGafPEHAfcazBIX6w5WycODHa/aMDWJYaoJ WCTsKSL+awSgQfXEgjaasylkKr7c/TA7OGXNjPpwuEsQqjWR63G5OpTPr6BUNIC7Ddln6TZq9 i/0ZXqPljWWrGRMxs1O6vnO0rQdOfIsZ+hjCFtDM6svfAmYSJWzTj8KrGpPHhYFmhJywxr3b3 Kut4rYp0aAvJo8DovOwc/G3bD5ADCctahlVS/dfSQUsrgpJc8MLdP/4Mi1M0JKYQeeYwQ7Q41 3uO0TIBS6n6qBhmkbGajN+xxqOxYL+qnmOfGt1++89Lqe1mJibaP328pe4kgaOPld3xyXrhZl T/UXid/ZvVY21IgvngqsHGXhiVV6dNxNW45Th9AJwgVORzQJ8QTuINSai8narFVEBJUobEaNc X2WBnHOyz1q6bvzdi05+iJR0G1JsgvjslZKIGLNGAW+lB8B1h2QMLXpeyySdbz+LDafz3oW0c K14f0BU++slr2C53fb424Mc9/Ad+QyvwVMSHo9H//WbILL2x8id2OnVe9d50AJjgBNlZ8bowF 3M5kwrAAfxqlLYA72j+gG1SBWbtPlYPUH6DDnZBhx+6SwHQOn7IcTW1cw== 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 8/13/21 9:56 AM, Christian Melki wrote: > > > On 8/13/21 2:36 AM, Heinrich Schuchardt wrote: >> On 8/12/21 11:49 PM, Simon Glass wrote: >>> +Heinrich Schuchardt too >>> >>> On Thu, 12 Aug 2021 at 08:35, Christian Melki >>> wrote: >>>> >>>> I was hoping that U-boot would detect BLOCK_IO devices provided by UE= FI >>>> automatically. But I can't see anything attached under lsblk or find >>>> some other information about this. >>>> For example, Barebox works just fine on both Virtualbox and real >>>> hardware in this regard. >>>> >>>> Barebox does not have an emmc driver for the real hardware but >>>> piggybacks off the UEFI protocol for this. >> >> Hello Christian, >> >> U-Boot can be used in two scenarios: >> >> 1) U-Boot is the firmware providing the UEFI API >> 2) U-Boot is running as an application consuming the UEFI API. >> >> Barebox only supports scenario 2). >> > > Ok. > >>>> >>>> I'm sure that the idea with this U-boot driver is something like that= , >>>> but would appreciate some hints on how to use it. >> >> efi_driver/efi_block_device.c is used in scenario 1). >> >> When a UEFI payload like iPXE provides an EFI_BLOCK_IO_PROTOCOL on a >> handle and calls ConnectController() U-Boot will install the >> EFI_SIMPLE_FILE_PROTOCOL for each partition on the block device. >> >> You can find a detailed description of this use case in: >> >> * https://u-boot.readthedocs.io/en/latest/develop/uefi/iscsi.html >> * https://archive.fosdem.org/2020/schedule/event/firmware_duwu/ >> > > I read the fosdem presentation, but apparently did not understand it > correctly, as I thought it could be used for presenting the UEFI block > IO protocol. > >>>> >>>> Ie, standard usage. UEFI boots of a drive, posts some handles(?) to a >>>> block device and U-boot picks it up, not knowing more about the >>>> abstracted hardware. >> >> Here you seem be referring to scenario 2). >> >> For scenario 2) support for UEFI block devices has not been implemented= , >> yet. As operating systems like Linux, BSD, Windows all can be booted vi= a >> UEFI there has not been any use case driving further development of thi= s >> scenario. >> >> Please, describe what you want to do with U-Boot. > > I have an x86 board (DFI GHF51, AMD Ryzen R1000) with an ACPI presented > eMMC. AMDI0040. U-boot does not seem to recognize this device (Linux > works fine. > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/= drivers/mmc/host/sdhci-acpi.c). > > So I thought the UEFI block IO protocol could come in handy as a generic > abstraction. The device works fine under Barebox with this mechanism. So > without a native or an UEFI block IO driver I have no disc access in > U-boot. > > I know that UEFI can boot a EFI-stubbed kernel directly. But I am more > comfortable with the U-boot "ecosystem" than UEFI, also it is easier to > merge more platforms under the same (existing) boot > mechanism/behavior/environment using U-boot as an intermediate than just > UEFI (older ARM/PPC etc). There are two ways U-Boot can run on U-Boot: CONFIG_EFI_STUB, efi-x86_payload64_defconfig: efi_main() calls ExitBootServices(). After this point U-Boot cannot consume any EFI boot services and protocols but has to rely on its own drivers. CONFIG_EFI_APP, efi-x86_app_defconfig: U-Boot drivers use the UEFI API. Currently the only drivers implemented in this way are: - console: drivers/serial/serial_efi.c, "efi,uart" - system reset: lib/efi/efi_app.c, "efi,reset" - video: drivers/video/efi.c, "efi-fb" drivers/video/efi.c is assuming that you have a VESA compatible graphics card and is bypassing the UEFI API to access the framebuffer. To be portable it would have been preferable to provide a UCLASS_VIDEO_CONSOLE driver based on the graphical output protocol. setup_memory() is another function that is not portable because it tries to access global_data_ptr directly. This variable only exists on x86_64. On ARM and RISC-V set_gd() should be used. Best regards Heinrich > > So definitely an use-case for me. > > Thanks in advance, > Christian > >> >> Best regards >> >> Heinrich