From patchwork Fri Dec 17 19:40:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1570305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ZW4oM4x1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFzqw2JYzz9sXM for ; Sat, 18 Dec 2021 06:41:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 568F2830CE; Fri, 17 Dec 2021 20:41:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZW4oM4x1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D6FF8835A5; Fri, 17 Dec 2021 20:41:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5E06783037 for ; Fri, 17 Dec 2021 20:41:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id z26so4439686iod.10 for ; Fri, 17 Dec 2021 11:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gzcY5NibXuGwwpsZBjwBELOd46KivUYuTp3fxAN8c14=; b=ZW4oM4x1JvfiO4soEqeMfcxvfdAfZGBte8DkzPtTcbihCyWsALgBaOfsQNh9l2isNK PXHoGysy8UU3eQCi9AK0rvqPg9F0u4L907PyfJI1LrhDoTNvYNezN/BRO0hgRt/GCYFQ R1JtvCAkYyhHzVzGfURsHwiyRgZERVIfZW4DQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gzcY5NibXuGwwpsZBjwBELOd46KivUYuTp3fxAN8c14=; b=1ymAjqGqPYDbXmlYk3XaQzVlToO/+NCe2abVo/gKcgQKu2yd9JUoOugQ5z8RzxDhpJ Zr4sAYIQvrOPF2GLyyzK0M2pM8v1Zbq98grD/wP4MrzyIBKH2N0d6/KN3C6kjapAFGNf vgw5Yg24BmBO17fWLK3j2LL944YspiSyYqaq6e3H8FfZPxRfjIKjj8fWsaOE0s5yV6zy GZu1WRXmi8uiKl5AnALPH845oeLfOB7leEjqGFF9etqBIfn5jbajEUqrkKWH1ipODRgP Fx2Od6pUSmQNLKhGDduIIU80tcwlWNspW+hYMX4bjfEOnx0R3FWZjMCdgBztlF1Wb6id qYmg== X-Gm-Message-State: AOAM533BrRB9Jvc5JGYMrKd0b9A6jadtnuyTQUsyb4hu4UnUnlFAyd7A xm1WIdS8mwAltAR63qgrHyXeJfgfrsOFRw== X-Google-Smtp-Source: ABdhPJyYTGTEQgM5yteAshD+am6A2kZxLkBoYtoarUo7z96VPf59Q9NNgPcJNKoG4XPOePgYAjduxw== X-Received: by 2002:a05:6638:16c5:: with SMTP id g5mr3015137jat.11.1639770063913; Fri, 17 Dec 2021 11:41:03 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id w19sm6079605iov.12.2021.12.17.11.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 11:41:03 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Heinrich Schuchardt , Tom Rini , Ilias Apalodimas , Christian Melki , Simon Glass , Alexander Graf Subject: [PATCH v6 00/27] efi: Improvements to U-Boot running on top of UEFI Date: Fri, 17 Dec 2021 12:40:32 -0700 Message-Id: <20211217194059.858580-1-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 At present U-Boot can be built as an EFI app, but it is really just for testing, with very few features. Instead, the payload build is used for booting on top of UEFI, where U-Boot takes over the machine immediately and supplies its own drivers. But the app could be made more useful. This series provides access to EFI block devices and the video console within U-Boot. It also restructures the app to make it possible to boot a kernel, although further work is needed to implement this. This can be thought of as making U-Boot perform a little like 'grub', in that it runs purely based on UEFI-provided services. Of course a lot more work is required, but this is a start. Note: It would be very useful to include qemu tests of the app and stub in CI. This is available at u-boot-dm/efi-working Changes in v6: - Add comment for dm_scan_other() - Add comment for free_memory() - Drop setup_disks() as U-Boot does not support it - Fix 'have have' typo - Fix 'stuff' typo in comment - Fix Alo typo in commit message - Fix comment style in setup_info_table() - Fix typo in function comment - Reword commit message - Update comment for UCLASS_EFI_MEDIA (within space constraints) - Update comment format for devpath_is_partition() - Update comment to UCLASS_EFI_LOADER - Update to 'This function' in comment - Use 'U-Boot' instead of 'ARP' typo Changes in v5: - Add new patch to avoid setting up global_data again with EFI - Add new patch to avoid using the 64-bit link script for the EFI app - Add new patch to build the 64-bit app properly - Add new patch to resolve EFI/EFI_LOADER conflict - Add new patch to round out the link script for 64-bit EFI - Add new patch to set the correct link flags for the 64-bit EFI app - Add new patch to tweak the code used for the 64-bit EFI app - Add various patches to fix up the 64-bit app so that it boots - Fix grammar in commit message Changes in v3: - Add new patch to show the system-table revision - Drop comments that confuse sphinx - Move device_path path change to its own patch Changes in v2: - Add MAINTAINERS entry - Add a better boot command too - Add a sentence about what the patch does - Add new patch to support the efi command in the app - Don't export efi_bind_block() - Drop mention of partitions from the commit message - Fix 'as' typo - Only bind devices for media devices, not for partitions - Show devices that are processed - Show the correct interface type with 'part list' - Store device path in struct efi_media_plat - Update documentation - Update the commit message to explain things better - Use log_info() instead of printf() Simon Glass (27): efi: Rename UCLASS_EFI and IF_TYPE_EFI efi: Add EFI uclass for media efi: Add a media/block driver for EFI block devices efi: Locate all block devices in the app efi: serial: Support arrow keys x86: Allow booting a kernel from the EFI app x86: Don't process the kernel command line unless enabled x86: efi: Add room for the binman definition in the dtb efi: Drop device_path from struct efi_priv efi: Add comments to struct efi_priv efi: Fix ll_boot_init() operation with the app efi: Add a few comments to the stub efi: Share struct efi_priv between the app and stub code efi: Move exit_boot_services into a function efi: Check for failure when initing the app efi: Mention that efi_info_get() is only used in the stub efi: Show when allocated pages are used efi: Allow easy selection of serial-only operation x86: efi: Update efi_get_next_mem_desc() to avoid needing a map efi: Support the efi command in the app x86: efi: Show the system-table revision x86: efi: Don't set up global_data again with EFI x86: efi: Tweak the code used for the 64-bit EFI app x86: efi: Round out the link script for 64-bit EFI x86: efi: Don't use the 64-bit link script for the EFI app x86: efi: Set the correct link flags for the 64-bit EFI app efi: Build the 64-bit app properly MAINTAINERS | 3 + Makefile | 4 +- arch/sandbox/dts/test.dts | 4 + arch/x86/config.mk | 15 +- arch/x86/cpu/config.mk | 2 +- arch/x86/cpu/efi/payload.c | 17 +- arch/x86/cpu/x86_64/cpu.c | 5 + arch/x86/dts/Makefile | 2 +- arch/x86/lib/Makefile | 5 +- arch/x86/lib/bootm.c | 11 +- arch/x86/lib/elf_x86_64_efi.lds | 5 +- arch/x86/lib/relocate.c | 2 + arch/x86/lib/zimage.c | 13 +- cmd/Makefile | 2 +- cmd/efi.c | 78 +++++---- common/board_r.c | 5 +- disk/part.c | 5 +- doc/develop/uefi/u-boot_on_efi.rst | 6 +- doc/develop/uefi/uefi.rst | 8 +- drivers/block/Kconfig | 33 ++++ drivers/block/Makefile | 4 + drivers/block/blk-uclass.c | 6 +- drivers/block/efi-media-uclass.c | 15 ++ drivers/block/efi_blk.c | 115 ++++++++++++ drivers/block/sb_efi_media.c | 20 +++ drivers/serial/serial_efi.c | 11 +- include/blk.h | 3 +- include/configs/efi-x86_app.h | 25 +++ include/dm/uclass-id.h | 3 +- include/efi.h | 113 +++++++++++- include/efi_api.h | 15 ++ include/init.h | 2 +- lib/efi/efi.c | 97 +++++++++++ lib/efi/efi_app.c | 269 +++++++++++++++++++++++++++-- lib/efi/efi_stub.c | 95 ++++------ lib/efi_driver/efi_block_device.c | 8 +- lib/efi_driver/efi_uclass.c | 8 +- test/dm/Makefile | 1 + test/dm/efi_media.c | 24 +++ 39 files changed, 901 insertions(+), 158 deletions(-) create mode 100644 drivers/block/efi-media-uclass.c create mode 100644 drivers/block/efi_blk.c create mode 100644 drivers/block/sb_efi_media.c create mode 100644 test/dm/efi_media.c