From patchwork Sun Feb 26 01:32:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748038 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.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=iQQlC68a; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR3x6LH3z240p for ; Sun, 26 Feb 2023 12:33:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1E5A085931; Sun, 26 Feb 2023 02:33:32 +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="iQQlC68a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4426185925; Sun, 26 Feb 2023 02:33:18 +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.1 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-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 112D885930 for ; Sun, 26 Feb 2023 02:33:15 +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-il1-x12f.google.com with SMTP id a1so2080886iln.9 for ; Sat, 25 Feb 2023 17:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6t/k2HKT7Dx/g/C+g9qBuL9HjDcllQ1zxfcUuyNiKdc=; b=iQQlC68aWThFDvLWS4APEQvUqvDbKyOlCl75dQZ9j4vCbTkDBng7KETlTFIKJUAE1R jgBCzKd8R7PGDTmj85qrXMrN7hxnjxahK7HH7sOT3MNI01yYgg5rGOtiASdXBIQhEDsy /7m5bIrFUnmP44VsxVQ4BO4j6rSKGTJbQqaPM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6t/k2HKT7Dx/g/C+g9qBuL9HjDcllQ1zxfcUuyNiKdc=; b=nVZ7H38FGckRbAS5xZ+0+eWHN80/1bfVJo+bHakimUQltNgIle8a7LMMxJuo0vH3PJ cd4lAxj2jSxb3hgOZAjZCwX/GMzQqMzUDmTtw+Ey31swtyudfi5rp4HRqKQVo/datNWo seBWahkOGYWL3xWVH4Pn/OxwFmDSpsURPYW9FsAVyvJpCb3pK2f+PQcB3PSaP0zRRDyW Phc+tOLPaFVZCLXEj3B6RBPwyyOSqMa7I6iw0shVwUN5JgGM4t1gASs6o24BxmYtyZ7R aR8ush9lkWX7TevMy/P187ErAKCy7uqwMqHZExnEJX5ClpfYtFHHjhyl80zHnOkQ8XKy nsrw== X-Gm-Message-State: AO0yUKVc3bT6x9x/Ty3ayZI5U+7jmCovJbNjEgW0E5FdLvH6EpdrqEUN M5FRwk1wBNHdYvxXaTQ2tZrYTQoykOIsJwXW X-Google-Smtp-Source: AK7set9XM9M2EaZgTLq9us2MtF/lbRVzLTc7lyaiXdp5ZpTcLEG9a1nHVpTZDOmkcsQZ8WaDXgZF0Q== X-Received: by 2002:a05:6e02:1806:b0:315:3eac:6293 with SMTP id a6-20020a056e02180600b003153eac6293mr4135219ilv.4.1677375193636; Sat, 25 Feb 2023 17:33:13 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:13 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Bin Meng Subject: [PATCH 01/10] efi: Set RUN_64BIT correctly for the EFI app Date: Sat, 25 Feb 2023 18:32:56 -0700 Message-Id: <20230226013305.2251638-2-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean The U-Boot EFI app can run as a 64-bit program, so set the Kconfig correctly in that case. Make sure it doesn't build SPL, since there is no need to switch from 32 to 64 bit when running. Signed-off-by: Simon Glass --- arch/x86/Kconfig | 4 ++-- configs/efi-x86_app64_defconfig | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 07be5cd05ec..99e59d94c60 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -32,8 +32,8 @@ config X86_RUN_32BIT config X86_RUN_64BIT bool "64-bit" select X86_64 - select SPL - select SPL_SEPARATE_BSS + select SPL if !EFI_APP + select SPL_SEPARATE_BSS if !EFI_APP help Build U-Boot as a 64-bit binary with a 32-bit SPL. This is experimental and many features are missing. U-Boot SPL starts up, diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index dae48840493..f1cf43c1ef6 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -4,6 +4,7 @@ CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app" CONFIG_DEBUG_UART_BASE=0 CONFIG_DEBUG_UART_CLOCK=0 +CONFIG_X86_RUN_64BIT=y CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_APP64=y CONFIG_DEBUG_UART=y From patchwork Sun Feb 26 01:32:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748039 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.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=Ea02URiH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR490pxVz240p for ; Sun, 26 Feb 2023 12:34:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 43B2785996; Sun, 26 Feb 2023 02:33:38 +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="Ea02URiH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A790985950; Sun, 26 Feb 2023 02:33:20 +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.1 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-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (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 49A0285935 for ; Sun, 26 Feb 2023 02:33:16 +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-il1-x132.google.com with SMTP id u6so2071485ilk.12 for ; Sat, 25 Feb 2023 17:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RXZ5XYR/f1Bh0id69lYanbnBVmSpFovI09xBU/1dhgA=; b=Ea02URiHh3gjnsM2rHx306hax3S2uSx2LsT75m9GQzDLPOUl22Uj2pKgQ496c+6h7a l6EVzib5Lt2k6izM+5smDeyCr0F6ifne6hrfvub4MaUpzvSexon1JjdyCYf4Woc6SH6c tuT9RC9PgH7FnDHoda60wIyT9Q17dSw9O6QL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RXZ5XYR/f1Bh0id69lYanbnBVmSpFovI09xBU/1dhgA=; b=TsMjTION0TGFI0YoVnCC8N9XMDaPseJOQGflqBchlPWdAMxE2FnGqus3vyisy5blvX tEfxogiTppLzKaMiPB2TeNXKikXGSINktR/XL21/iCdtMb5T+kz+Dz/nagLAq5zG5suU s0oITR51ZeAkl/dOQ+KHgWwNwnnomn6Y79ta245oA/NrEvbwV1ZnMndykTfxUd/WQgDQ tUpg7xLf0xMO7bVpsq+Wt+eRZg/yGdmceiBTA3suU2qks+mKcmMJ5dEBiwNY2NkKd2qI lpmUcmTQ1aFJ3QzeH+PDIqgxhPTaNBvFRur6MCDU6mHymrpbeYOfwrzhLK2SD1n3vL0z Lrqg== X-Gm-Message-State: AO0yUKX05Hib1Jf4qjDhhv/vDaJpRs8js59hn4Ny4AOM2jpfc1gVlOSi iwr2ubNzWOI6/WGKWew1LzIiC/u0S8ZxqghF X-Google-Smtp-Source: AK7set9Yk0X3/SgXz2Qoe5nbG1lVRgEFJJiiowm6XND9LewVCffyIxIaj2RXdUeUhxrFmuXKbOd1uA== X-Received: by 2002:a05:6e02:1541:b0:310:c6f7:c1e9 with SMTP id j1-20020a056e02154100b00310c6f7c1e9mr19777216ilu.5.1677375194740; Sat, 25 Feb 2023 17:33:14 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:14 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Bin Meng Subject: [PATCH 02/10] x86: Adjust bootparam.h to be more like linux Date: Sat, 25 Feb 2023 18:32:57 -0700 Message-Id: <20230226013305.2251638-3-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean This likely came from Linux originally, so update it to match v6.2 more. This has no functional change. Signed-off-by: Simon Glass --- arch/x86/include/asm/bootparam.h | 70 +++++++++++++++++++++----------- arch/x86/lib/zimage.c | 2 +- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h index 7a3c1f51554..ea816ca7469 100644 --- a/arch/x86/include/asm/bootparam.h +++ b/arch/x86/include/asm/bootparam.h @@ -9,19 +9,54 @@ #include #include -/* setup data types */ -enum { - SETUP_NONE = 0, - SETUP_E820_EXT, - SETUP_DTB, -}; +/* setup_data/setup_indirect types */ +#define SETUP_NONE 0 +#define SETUP_E820_EXT 1 +#define SETUP_DTB 2 +#define SETUP_PCI 3 +#define SETUP_EFI 4 +#define SETUP_APPLE_PROPERTIES 5 +#define SETUP_JAILHOUSE 6 +#define SETUP_CC_BLOB 7 +#define SETUP_IMA 8 +#define SETUP_RNG_SEED 9 +#define SETUP_ENUM_MAX SETUP_RNG_SEED + +#define SETUP_INDIRECT BIT(31) +#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT) + +/* ram_size flags */ +#define RAMDISK_IMAGE_START_MASK 0x07FF +#define RAMDISK_PROMPT_FLAG 0x8000 +#define RAMDISK_LOAD_FLAG 0x4000 + +/* loadflags */ +#define LOADED_HIGH BIT(0) +#define KASLR_FLAG BIT(1) +#define QUIET_FLAG BIT(5) +#define KEEP_SEGMENTS BIT(6) +#define CAN_USE_HEAP BIT(7) + +#define XLF_KERNEL_64 BIT(0) +#define XLF_CAN_BE_LOADED_ABOVE_4G BIT(1) +#define XLF_EFI_HANDOVER_32 BIT(2) +#define XLF_EFI_HANDOVER_64 BIT(3) +#define XLF_EFI_KEXEC BIT(4) /* extensible setup data list node */ struct setup_data { __u64 next; __u32 type; __u32 len; - __u8 data[0]; + __u8 data[]; +}; + +/* extensible setup indirect data node */ +struct setup_indirect { + __u32 type; + __u32 reserved; /* Reserved, must be set to zero. */ + __u64 len; + __u64 addr; }; /** @@ -34,9 +69,6 @@ struct setup_header { __u16 root_flags; __u32 syssize; __u16 ram_size; -#define RAMDISK_IMAGE_START_MASK 0x07FF -#define RAMDISK_PROMPT_FLAG 0x8000 -#define RAMDISK_LOAD_FLAG 0x4000 __u16 vid_mode; __u16 root_dev; __u16 boot_flag; @@ -44,15 +76,10 @@ struct setup_header { __u32 header; __u16 version; __u32 realmode_swtch; - __u16 start_sys; + __u16 start_sys_seg; __u16 kernel_version; __u8 type_of_loader; __u8 loadflags; -#define LOADED_HIGH BIT(0) -#define KASLR_FLAG BIT(1) -#define QUIET_FLAG BIT(5) -#define KEEP_SEGMENTS BIT(6) /* Obsolete */ -#define CAN_USE_HEAP BIT(7) __u16 setup_move_size; __u32 code32_start; __u32 ramdisk_image; @@ -65,13 +92,8 @@ struct setup_header { __u32 initrd_addr_max; __u32 kernel_alignment; __u8 relocatable_kernel; - u8 min_alignment; -#define XLF_KERNEL_64 BIT(0) -#define XLF_CAN_BE_LOADED_ABOVE_4G BIT(1) -#define XLF_EFI_HANDOVER_32 BIT(2) -#define XLF_EFI_HANDOVER_64 BIT(3) -#define XLF_EFI_KEXEC BIT(4) - u16 xloadflags; + __u8 min_alignment; + __u16 xloadflags; __u32 cmdline_size; __u32 hardware_subarch; __u64 hardware_subarch_data; @@ -81,7 +103,7 @@ struct setup_header { __u64 pref_address; __u32 init_size; __u32 handover_offset; - u32 kernel_info_offset; + __u32 kernel_info_offset; } __attribute__((packed)); struct sys_desc_table { diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 9cc04490307..a6d9151c324 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -655,7 +655,7 @@ void zimage_dump(struct boot_params *base_ptr) printf("%-20s %s\n", "", "Ancient kernel, using version 100"); print_num("Version", hdr->version); print_num("Real mode switch", hdr->realmode_swtch); - print_num("Start sys", hdr->start_sys); + print_num("Start sys seg", hdr->start_sys_seg); print_num("Kernel version", hdr->kernel_version); version = get_kernel_version(base_ptr, (void *)state.bzimage_addr); if (version) From patchwork Sun Feb 26 01:32:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748040 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=D5v+LQCl; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR4Q6r4Nz240p for ; Sun, 26 Feb 2023 12:34:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72B2285B84; Sun, 26 Feb 2023 02:33:41 +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="D5v+LQCl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 731F285969; Sun, 26 Feb 2023 02:33:22 +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.1 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-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 1561A85927 for ; Sun, 26 Feb 2023 02:33:17 +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-xd32.google.com with SMTP id m22so794992ioy.4 for ; Sat, 25 Feb 2023 17:33:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lefc7HeKVVlEP1/tBVtV/xN7TZJvBrDo3/WMb86Q31Y=; b=D5v+LQClzQWxHlucJTheU74rBTtLOdebKLViXg4StqNyzyH3DR5UukSHkhdJB0CgEB hEktylykLmsObMSl3L17ramyAUCKWeeaWT9AR92dRmz+xJmpO0eU8L7I/CdAj5J0v1Ap p3nCz5NdwhdtrI044uJ2j5JujGYMGiS1P9S0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lefc7HeKVVlEP1/tBVtV/xN7TZJvBrDo3/WMb86Q31Y=; b=GeM2cmFCdPhSttbBdmbizG5mDuxjCghxd0DPbrvkz6mIYpqoN1NO6b7CVQmNancRtO x86R6cVaAUcvLYzorhd1ALpZhl01RnWZHHil59yscSCzp6o8ta9SgNQB7hvDYkeRihWS T+qaadhHXobJBOBOhQEqle09zCCS9fJq6DwLiwFB+tt5Wyq+YFCSZRlsGoM/GIEmfJLb uyxxXCKOkmUC/0Lacvfus9jLE7cuOisZf2lapk/UnfqP/WN2LzyML575lb+HuIPpFjqZ Hla4VCfYct9uJ8SIDGGXZaYJSlWPWAiMXMIPbrxbDaxZHwksKCxiy3+nZtNLgAuIDOvG paQw== X-Gm-Message-State: AO0yUKU76o+tPpCqnGWNAKVQTjVSfr1/VRdL/U93gUmbQGzINK8m+AMM ZHPhsD8+7cXhUpiwU8EglmRD/c5qvHuAUuf6 X-Google-Smtp-Source: AK7set+EhKodJ5HuLJfju9TiVL/DVMtqplcavGNUrxM832yJdmRBqkLQSCDArZ2VzlrkNqB3Gufj3g== X-Received: by 2002:a05:6602:2a49:b0:723:8cb5:6705 with SMTP id k9-20020a0566022a4900b007238cb56705mr3562371iov.4.1677375195633; Sat, 25 Feb 2023 17:33:15 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:15 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Bin Meng Subject: [PATCH 03/10] x86: Add return-value comment to cpu_jump_to_64bit() Date: Sat, 25 Feb 2023 18:32:58 -0700 Message-Id: <20230226013305.2251638-4-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean This does not mention what it returns. Add the missing documentation. Signed-off-by: Simon Glass --- arch/x86/include/asm/cpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 3346012d335..aa03ef598e1 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -262,6 +262,7 @@ void cpu_call32(ulong code_seg32, ulong target, ulong table); * * @setup_base: Pointer to the setup.bin information for the kernel * @target: Pointer to the start of the kernel image + * Returns: -EFAULT if the kernel returned; otherwise does not return */ int cpu_jump_to_64bit(ulong setup_base, ulong target); From patchwork Sun Feb 26 01:32:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748041 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.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=Nmjsl3p/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR4h2nRNz240p for ; Sun, 26 Feb 2023 12:34:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BD8385B83; Sun, 26 Feb 2023 02:33:46 +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="Nmjsl3p/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8BF5985927; Sun, 26 Feb 2023 02:33:24 +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.1 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-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 BEF0F85931 for ; Sun, 26 Feb 2023 02:33:18 +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-il1-x134.google.com with SMTP id b16so2107473iln.3 for ; Sat, 25 Feb 2023 17:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TvVdUuRtWSzxaC+WKsNLEZk5OMWqLy8uTkemg3cGccE=; b=Nmjsl3p/gwJm/Q+9znAiSEWhI4up5aHOEPCXjpBxwfcyp8b2hrnijaJK1x5YQN0x14 v9vclGgC4n+Zd69msAAuVOtgZiMGMsZjkc/oHqTFb8fp+uvan0wX1/TM/fRYMuieuKNO Wg4I1hwU4N89rgxrB4Jqwc0XzsT72R1IOlYys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TvVdUuRtWSzxaC+WKsNLEZk5OMWqLy8uTkemg3cGccE=; b=Cc8223RbjwjnnFtZQ6nR+cdDPe99tvO0aEvkttncHrJTAPUUwbGGNciJNRhcDOPhDw ZtR39zRd5u0Y8DmmyfIy7DjMxScwo+1okuqMrcAc2uCSspyKSJXIj3FjZNN154dvoSZD kjVtvSMIsFZjjQhMu+deLGfWdjUZ1Tb6VvGr3JTCmfJgzcYZkit9tG6iD4ynJKPRUSKr L0kDxLZgZkRlU6UXXQKTIYX6GjS0FjC/gVGCM6JhaeaufQIHVKyeMwI2x3TH2ZfDBc6R nGPqbNspEcgaesx7tnXr9FtwBau4jndInwtTDTATk7tTGPJJT4/y0FHI2J/iDjNY+U8P 6joA== X-Gm-Message-State: AO0yUKWIa2SCUEXUUYPbrz4LJsWzTaNLWxReuFGLAvHJPLPZPux+xz4p SX0ct6BI8epor9XlT2Aqem+X00phMASTke3X X-Google-Smtp-Source: AK7set87dUI/46VJOfHDsQvMj2zs1bumRJicS9PNVQ+KMqNxEcb8teBMg0p5N9m7ZuMmsVeeUZHdfw== X-Received: by 2002:a05:6e02:18cf:b0:313:dd5c:e55f with SMTP id s15-20020a056e0218cf00b00313dd5ce55fmr3606811ilu.6.1677375196895; Sat, 25 Feb 2023 17:33:16 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:16 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Ashok Reddy Soma , Bin Meng , Michal Simek Subject: [PATCH 04/10] x86: Support booting a 64-bit kernel from 64-bit U-Boot Date: Sat, 25 Feb 2023 18:32:59 -0700 Message-Id: <20230226013305.2251638-5-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Add the missing code to handle this. For a 64-bit kernel the entry address is 0x200 bytes after the normal entry. Rename the parameter to boot_linux_kernel() accordingly. Update the comments to indicate that these are addresses, not pointers. Signed-off-by: Simon Glass --- arch/x86/include/asm/bootm.h | 12 ++++++------ arch/x86/lib/bootm.c | 25 +++++++++++++++++-------- arch/x86/lib/zimage.c | 15 +++++++++++++-- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/bootm.h b/arch/x86/include/asm/bootm.h index 109f686f740..3b641783b9c 100644 --- a/arch/x86/include/asm/bootm.h +++ b/arch/x86/include/asm/bootm.h @@ -14,14 +14,14 @@ void bootm_announce_and_cleanup(void); * This boots a kernel image, either 32-bit or 64-bit. It will also work with * a self-extracting kernel, if you set @image_64bit to false. * - * @setup_base: Pointer to the setup.bin information for the kernel - * @load_address: Pointer to the start of the kernel image - * @image_64bit: true if the image is a raw 64-bit kernel, false if it - * is raw 32-bit or any type of self-extracting kernel - * such as a bzImage. + * @setup_base: Address of the setup.bin information for the kernel + * @entry: Address of the kernel entry point + * @image_64bit: true if the image is a raw 64-bit kernel, or a kernel + * which supports booting in 64-bit mode; false if it is raw 32-bit or any type + * of self-extracting kernel such as a bzImage. * Return: -ve error code. This function does not return if the kernel was * booted successfully. */ -int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit); +int boot_linux_kernel(ulong setup_base, ulong entry, bool image_64bit); #endif diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 873e2bc176f..9beb376bb9c 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -149,7 +149,7 @@ error: return 1; } -int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit) +int boot_linux_kernel(ulong setup_base, ulong entry, bool image_64bit) { bootm_announce_and_cleanup(); @@ -161,14 +161,23 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit) puts("Cannot boot 64-bit kernel on 32-bit machine\n"); return -EFAULT; } - /* At present 64-bit U-Boot does not support booting a + /* + * At present 64-bit U-Boot only supports booting a 64-bit * kernel. - * TODO(sjg@chromium.org): Support booting both 32-bit and - * 64-bit kernels from 64-bit U-Boot. + * + * TODO(sjg@chromium.org): Support booting 32-bit kernels from + * 64-bit U-Boot */ -#if !CONFIG_IS_ENABLED(X86_64) - return cpu_jump_to_64bit(setup_base, load_address); -#endif + if (CONFIG_IS_ENABLED(X86_64)) { + typedef void (*h_func)(ulong zero, ulong setup); + h_func func; + + /* jump to Linux with rdi=0, rsi=setup_base */ + func = (h_func)entry; + func(0, setup_base); + } else { + return cpu_jump_to_64bit(setup_base, entry); + } } else { /* * Set %ebx, %ebp, and %edi to 0, %esi to point to the @@ -190,7 +199,7 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit) "movl $0, %%ebp\n" "cli\n" "jmp *%[kernel_entry]\n" - :: [kernel_entry]"a"(load_address), + :: [kernel_entry]"a"(entry), [boot_params] "S"(setup_base), "b"(0), "D"(0) ); diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index a6d9151c324..e5ea5129c1e 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -504,13 +504,24 @@ static int do_zboot_info(struct cmd_tbl *cmdtp, int flag, int argc, static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + struct boot_params *params = state.base_ptr; + struct setup_header *hdr = ¶ms->hdr; + bool image_64bit; + ulong entry; int ret; disable_interrupts(); + entry = state.load_address; + image_64bit = false; + if (IS_ENABLED(CONFIG_X86_RUN_64BIT) && + (hdr->xloadflags & XLF_KERNEL_64)) { + entry += 0x200; + image_64bit = true; + } + /* we assume that the kernel is in place */ - ret = boot_linux_kernel((ulong)state.base_ptr, state.load_address, - false); + ret = boot_linux_kernel((ulong)state.base_ptr, entry, image_64bit); printf("Kernel returned! (err=%d)\n", ret); return CMD_RET_FAILURE; From patchwork Sun Feb 26 01:33:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748042 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=Oa8/C0B1; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR4x6VSnz240p for ; Sun, 26 Feb 2023 12:34:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8FED85950; Sun, 26 Feb 2023 02:33:49 +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="Oa8/C0B1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE7E285996; Sun, 26 Feb 2023 02:33:24 +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.1 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-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 CF8A585947 for ; Sun, 26 Feb 2023 02:33:19 +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-il1-x12d.google.com with SMTP id r4so2103444ila.2 for ; Sat, 25 Feb 2023 17:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WFFOiMM04mwpcmWoM7lDFIH4OaL8DhPTMO9/aHjhKUQ=; b=Oa8/C0B1dPyrP6yecUi0W30LQ8paFQcQsxonSgXDYHO/x7PX2Bu8p+MXyZt2NlH9g3 R+XRgdZol0fOtVHJkIKycWm5tnJRXp0iWhqIZgQ99NmW3QYXuW+8w10KREHxHXBM2pFD /ScVuyNJFVqKItMgDbh+ycwy/iT6zWn8zfadY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WFFOiMM04mwpcmWoM7lDFIH4OaL8DhPTMO9/aHjhKUQ=; b=MgYUOu4//6E0l5y4ALZu8ARjUmW/7dtnhIfMYh6HbX0EQgE2C6Z3wHP0EMWjlEQhNv uJwrgSyzr5coF2Q6DO4f0TTTAPvVn0vlZVWjciQks3ay0JtymYB8VF7zTtUAjGSLjI7P /2Jxv7qKcBrjtALunQj+jRWIrjnc6oCb7uLw9m7TQEpUBEKpyT1dPrOCE7IjHvoo+ol7 UJV19dWaGgC65AKJ41yUoRWYCBjr7qG0AXPlTmqTtw26lMyNGWhPt9Xfjc9K5sJKzYRn 9ED8FV4BP9eSprNCDO2i27Hfvb2Ya273MqZXMpXPdssuaKAXIve9gAlUUWjGQT5ohhBO hrug== X-Gm-Message-State: AO0yUKUm8DcGAELOhALdskcFmECj8U2iExfh0Ueljx7XniLU6OS7cKLR b1VXodEBLdQqSq8GFmMx0koEVaFzYyUhy1SV X-Google-Smtp-Source: AK7set9euK0ADf8sYtfM5tXqXbeUjAPFMYncYerkVCDk4eP7DAKgs92F8rHS3nU8S4a37x/2MycNqg== X-Received: by 2002:a92:444e:0:b0:315:cefa:f75e with SMTP id a14-20020a92444e000000b00315cefaf75emr15067887ilm.27.1677375198106; Sat, 25 Feb 2023 17:33:18 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:17 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Ashok Reddy Soma , Bin Meng , Michal Simek Subject: [PATCH 05/10] x86: Exit EFI boot services before starting kernel Date: Sat, 25 Feb 2023 18:33:00 -0700 Message-Id: <20230226013305.2251638-6-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean When running the EFI app, we need to exit boot services before jumping to Linux. At some point it may be possible to jump to Linux and pass on the boot services, so that the Linux efistub can be used. For now, this is not implemented. Signed-off-by: Simon Glass --- arch/x86/lib/bootm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 9beb376bb9c..61cb7bc6116 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -156,6 +157,23 @@ int boot_linux_kernel(ulong setup_base, ulong entry, bool image_64bit) #ifdef CONFIG_SYS_COREBOOT timestamp_add_now(TS_U_BOOT_START_KERNEL); #endif + + /* + * Exit EFI boot services just before jumping, after all console + * output, since the console won't be available afterwards. + */ + if (IS_ENABLED(CONFIG_EFI_APP)) { + int ret; + + ret = efi_store_memory_map(efi_get_priv()); + if (ret) + return ret; + printf("Exiting EFI boot services\n"); + ret = efi_call_exit_boot_services(); + if (ret) + return ret; + } + if (image_64bit) { if (!cpu_has_64bit()) { puts("Cannot boot 64-bit kernel on 32-bit machine\n"); From patchwork Sun Feb 26 01:33:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748043 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=O9zWLpST; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR5D17qKz240p for ; Sun, 26 Feb 2023 12:34:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C6ECB85B90; Sun, 26 Feb 2023 02:33:53 +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="O9zWLpST"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D551C85947; Sun, 26 Feb 2023 02:33:25 +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.1 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-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 E410685935 for ; Sun, 26 Feb 2023 02:33:20 +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-xd32.google.com with SMTP id e17so1203758iot.1 for ; Sat, 25 Feb 2023 17:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/VuPcZu/T8sk9RmBMmjI7b9/xnZOzgmDkRFFg3m8R3Y=; b=O9zWLpSTCyP5U48cd83j3l5I+hz6vYwKXSchE0slKHTttjYhzxOFIMsdMKLqwqnMXz 7f0Og+Y5SxqQWZEtzD9VvTtGNbmH9VKC6Jvm6rCn82b7PNDnjpogTqB4pv+o18l5LMAZ S3mtaUmiAAqNWO5Ngjx5VtUYQYCI7o+uD+iac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/VuPcZu/T8sk9RmBMmjI7b9/xnZOzgmDkRFFg3m8R3Y=; b=E8IrmSpwLNAZI9iBVdR8/MtA8NHY6tmesdHEOWsMoGg0wVpDE8RjnhG3+XQIDSGQwR rjvWMQ1ywb0mMSpG9RJD44/YiNyziCVXcnjqvHPN6x+uLVk9KRgXuhYTBzQx8YcFnGlp uODsdX8PqeYKjaIZVMNi2KNK7FaSIQmly51Mxc/0w6SagvyuCM3VwKme5lx6qvSX2m8E bKOsIrA0b9pXkBksr14e4keyQ33vfm9uRS/Zwfk/fFCQOYnp4qzJ4k+K1WJapwFAvSu7 hkRkvqSuEgoIA8LLE8JCnTjZXpb8slN3mXkee70cd2G2ltfwjSZ6ncEJcN64SK73iJCA Rk9g== X-Gm-Message-State: AO0yUKW9HF9NTg/UYGCwlMA3wzPTcqtvUTwI42o8zHGzSBbiro6V2/ux KTwhg7bdlTA2XYqwDVcuSlhjqTdcILA11EbQ X-Google-Smtp-Source: AK7set/fVawS2hjaKf0vS1QnDCevF2IRkENJDD3fcJ8LiGvbj9pVW9RC6y2lUQzidqOY1KqQ3gR1xA== X-Received: by 2002:a05:6602:1850:b0:734:e7c0:2058 with SMTP id d16-20020a056602185000b00734e7c02058mr13079662ioi.9.1677375199080; Sat, 25 Feb 2023 17:33:19 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:18 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Bin Meng Subject: [PATCH 06/10] x86: Support zboot and bootm in the EFI app Date: Sat, 25 Feb 2023 18:33:01 -0700 Message-Id: <20230226013305.2251638-7-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean These have been disabled due to the rudimentary support available. It is a little better now, so enable these options. Signed-off-by: Simon Glass --- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/efi-x86_app32_defconfig b/configs/efi-x86_app32_defconfig index 905f375a3ef..50975dbfaaf 100644 --- a/configs/efi-x86_app32_defconfig +++ b/configs/efi-x86_app32_defconfig @@ -19,7 +19,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 -# CONFIG_CMD_BOOTM is not set +CONFIG_CMD_BOOTZ=y CONFIG_CMD_PART=y # CONFIG_CMD_NET is not set CONFIG_CMD_TIME=y diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index f1cf43c1ef6..0fc358ddcdf 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -20,7 +20,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 -# CONFIG_CMD_BOOTM is not set +CONFIG_CMD_BOOTZ=y CONFIG_CMD_PART=y # CONFIG_CMD_NET is not set CONFIG_CMD_CACHE=y From patchwork Sun Feb 26 01:33:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748044 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.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=PBK4jbKV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR5V02n5z2466 for ; Sun, 26 Feb 2023 12:35:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1B22485B99; Sun, 26 Feb 2023 02:33:58 +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="PBK4jbKV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E0B885927; Sun, 26 Feb 2023 02:33:26 +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.1 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-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (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 B46EA85950 for ; Sun, 26 Feb 2023 02:33:21 +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-xd33.google.com with SMTP id 76so1186386iou.9 for ; Sat, 25 Feb 2023 17:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C0GrKrdTI83fLJrQrFlyQ7aeUl3tD8Jv3QC3RVw1MOY=; b=PBK4jbKVpRiNKAo+Ujj1R0Lb8mUR6SwFpZLj+xTzjAhLdU5wl6DrJLS3DrwQIGKDSn YsSF7g3mGAclbQ4UGvJd9e/BLTUiPIhaJ4sowh9WxjsgPuPl8CdovzRRisbu1Tc58+Ld CkH0jNihovqidp2bLl1g35vCX8VfWhv976Egg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C0GrKrdTI83fLJrQrFlyQ7aeUl3tD8Jv3QC3RVw1MOY=; b=kgpfWmJ+IhLfm8OQtThwkF4Jb/jCRHueK8/3unucCLyXx9+VDunaMeCL8lo7fjFXVj s9CQNF9lUiqOPAalnTuQunrbyS3BnyJQwOqpkCXNTCA/68g8kQP6uvoG3+m4ww6IM4kp jIPdwENsyNFFdKPlih8WbrGrYt9gj7lNIlpBjRbaps1MXHyIAwC8datUZKZ0UYOqBG9v d9dOfv6fq0QLw9JB45F+C1Z2TxG3d/CYB5bh5Hfdryzsa5ZkT2w+fwiWuZ8nxOxbdCsy evUVqgkjKeXx/Ga5h5FB9I9jU+1m3nwDuN0qhe8yDuTsdbIFZTTbJMlsA8NtSXuv964N dOpQ== X-Gm-Message-State: AO0yUKXnC66CvXInKfQVtn9cZLGS7raWq07R/yZATAXcmuJtwBLOr6SO UGPnrAqWG3v5af0plRy4dPiCoZ4J5+JHTcwF X-Google-Smtp-Source: AK7set9ZXSvGNcir57EJwoAae5+rwPoNCfj5J0szNbEeP0/Ea0zrj3Ib3CsMsPnLUaSmhVjSzX+OjA== X-Received: by 2002:a05:6602:2c82:b0:74c:deb9:54d with SMTP id i2-20020a0566022c8200b0074cdeb9054dmr581939iow.5.1677375200095; Sat, 25 Feb 2023 17:33:20 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:19 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Ilias Apalodimas , Jose Marinho Subject: [PATCH 07/10] efi: Add another tranch of GUIDs Date: Sat, 25 Feb 2023 18:33:02 -0700 Message-Id: <20230226013305.2251638-8-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Provide information about the GUIDs supplied by QEMU, so far as it is known. Signed-off-by: Simon Glass --- include/efi_api.h | 28 ++++++++++++++++++++++++++++ lib/uuid.c | 12 ++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/efi_api.h b/include/efi_api.h index 2d18d25a713..90caee4038c 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1909,6 +1909,34 @@ struct efi_system_resource_table { EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \ 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) +#define EFI_LZMA_COMPRESSED \ + EFI_GUID(0xee4e5898, 0x3914, 0x4259, 0x9d, 0x6e, \ + 0xdc, 0x7b, 0xd7, 0x94, 0x03, 0xcf) +#define EFI_DXE_SERVICES \ + EFI_GUID(0x05ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, \ + 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9) +#define EFI_HOB_LIST \ + EFI_GUID(0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a, \ + 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +#define EFI_MEMORY_TYPE \ + EFI_GUID(0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, \ + 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa) +#define EFI_SMBIOS \ + EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, \ + 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +#define EFI_MEM_STATUS_CODE_REC \ + EFI_GUID(0x060cc026, 0x4c0d, 0x4dda, 0x8f, 0x41, \ + 0x59, 0x5f, 0xef, 0x00, 0xa5, 0x02) +#define EFI_GUID_SNBIOS \ + EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, \ + 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +#define EFI_GUID_EFI_ACPI1 \ + EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, \ + 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +#define EFI_GUID_EFI_ACPI2 \ + EFI_GUID(0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, \ + 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81) + /** * struct win_certificate_uefi_guid - A certificate that encapsulates * a GUID-specific signature diff --git a/lib/uuid.c b/lib/uuid.c index 465e1ac38f5..77aef746a2e 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -255,6 +255,18 @@ static const struct { EFI_CERT_TYPE_PKCS7_GUID, }, #endif +#ifdef CONFIG_EFI_APP +#endif + { "EFI_LZMA_COMPRESSED", EFI_LZMA_COMPRESSED }, + { "EFI_DXE_SERVICES", EFI_DXE_SERVICES }, + { "EFI_HOB_LIST", EFI_HOB_LIST }, + { "EFI_MEMORY_TYPE", EFI_MEMORY_TYPE }, + { "EFI_SMBIOS", EFI_SMBIOS }, + { "EFI_MEM_STATUS_CODE_REC", EFI_MEM_STATUS_CODE_REC }, + { "EFI_GUID_SNBIOS", EFI_GUID_SNBIOS }, + { "EFI_GUID_EFI_ACPI1", EFI_GUID_EFI_ACPI1 }, + { "EFI_GUID_EFI_ACPI2", EFI_GUID_EFI_ACPI2 }, + }; /* From patchwork Sun Feb 26 01:33:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748045 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.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=oXvqbzBf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR5k733Bz2466 for ; Sun, 26 Feb 2023 12:35:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5FC0F85B92; Sun, 26 Feb 2023 02:34:06 +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="oXvqbzBf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4BA6285925; Sun, 26 Feb 2023 02:33:31 +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.1 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-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 2A6198589B for ; Sun, 26 Feb 2023 02:33:23 +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-il1-x12b.google.com with SMTP id b12so2085191ils.8 for ; Sat, 25 Feb 2023 17:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qub4Z9FAuRc3GUe/r4qjVjFHTyGlPqM7FtfAGxxa2UE=; b=oXvqbzBfO8F6buDn4SmxCxPXK0C82a3ZfzQJK1x2TTEWRKCKSRkhHwYeUXRGhcIadM 0rswhoEt99x8FTttsGq+inuA1YA9rzZCtnwepU6TSzaSP1OrXf1E2xIZBp3Z4fUjJ64C /4MxxnFypfa1s7To8d9i3ECCCYHR7w9KbAUNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qub4Z9FAuRc3GUe/r4qjVjFHTyGlPqM7FtfAGxxa2UE=; b=oj80PQyvNtky8AUMehGrDsGsMKrSuiMAdyfR6UZbXISjdbezIstYLYCjXfxixcd25U cCPF12y33es9KgiEXVMjPOwN448BXOrGtCsMmkW3KwDjBnAWyUubX24wewDfapDtAEbb Hoc8RZyumB+N8w5+lJsS263OOglxG7QQ1rDRy+1hvscjpcSkzr4O7EgdHIQbHdAPe4aw OrNRvekm07MB3wvhpYyiHXAJmncafCiurYZhtMfxapXM6dJoiEwB031h+2MLnzBuHRuZ TXkxgoE+d/x4LYLzCYPv5WNBtxE8IbYoGBFVH1gY3QKKAPubW2/OXZ3PtlNI5t5B0mCW XF9A== X-Gm-Message-State: AO0yUKV6ZZBaNGkLJg3rZmOnVCzwak8fIppGvwHP+OscQbN+gQmvH9G9 n8cY2Xa7kmGo7RduzC9ukjRL3t53Mu6umw4f X-Google-Smtp-Source: AK7set/s17xAvNyVab3wPnohbHNDbFHlv6UKqbWZ0UHT9FKpyJuwrgwSdBN2Ijk9+XzQNlvYp6CyDg== X-Received: by 2002:a05:6e02:20e7:b0:316:d9fa:f4fe with SMTP id q7-20020a056e0220e700b00316d9faf4femr16199609ilv.24.1677375201202; Sat, 25 Feb 2023 17:33:21 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:20 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Bin Meng , Ilias Apalodimas Subject: [PATCH 08/10] doc: Add help for the efi command Date: Sat, 25 Feb 2023 18:33:03 -0700 Message-Id: <20230226013305.2251638-9-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean This command currently has no help. Add some. Signed-off-by: Simon Glass --- doc/usage/cmd/efi.rst | 197 ++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + 2 files changed, 198 insertions(+) create mode 100644 doc/usage/cmd/efi.rst diff --git a/doc/usage/cmd/efi.rst b/doc/usage/cmd/efi.rst new file mode 100644 index 00000000000..c029c423879 --- /dev/null +++ b/doc/usage/cmd/efi.rst @@ -0,0 +1,197 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2020, Heinrich Schuchardt + +efi command +=========== + +Synopsis +-------- + +:: + + efi mem [all] + +Description +----------- + +The *efi* command provides information about the EFI environment U-Boot is +running in, when it is started from EFI. + +When running as an EFI app, this command queries EFI boot services for the +information. When running as an EFI payload, EFI boot services have been +stopped, so it uses the information collected by the boot stub before that +happened. + +efi mem +~~~~~~~ + +This shows the EFI memory map, sorted in order of physical address. + +This is normally a very large table. To help reduce the amount of detritus, +boot-time memory is normally merged with conventional memory. Use the 'all' +argument to show everything. + +The fields are as follows: + +# + Entry number (sequentially from 0) + +Type + Memory type. EFI has a large number of memory types. The type is shown in + the format : where in is the format number in hex and is the + name. + +Physical + Physical address + +Virtual + Virtual address + +Size + Size of memory area in bytes + +Attributes + Shows a code for memory attributes. The key for this is shown below the + table. + +Example +------- + +:: + + => efi mem + EFI table at 0, memory map 000000001ad38b60, size 1260, key a79, version 1, descr. size 0x30 + # Type Physical Virtual Size Attributes + 0 7:conv 0000000000 0000000000 00000a0000 f + 00000a0000 0000060000 + 1 7:conv 0000100000 0000000000 0000700000 f + 2 a:acpi_nvs 0000800000 0000000000 0000008000 f + 3 7:conv 0000808000 0000000000 0000008000 f + 4 a:acpi_nvs 0000810000 0000000000 00000f0000 f + 5 7:conv 0000900000 0000000000 001efef000 f + 6 6:rt_data 001f8ef000 0000000000 0000100000 rf + 7 5:rt_code 001f9ef000 0000000000 0000100000 rf + 8 0:reserved 001faef000 0000000000 0000080000 f + 9 9:acpi_reclaim 001fb6f000 0000000000 0000010000 f + 10 a:acpi_nvs 001fb7f000 0000000000 0000080000 f + 11 7:conv 001fbff000 0000000000 0000359000 f + 12 6:rt_data 001ff58000 0000000000 0000020000 rf + 13 a:acpi_nvs 001ff78000 0000000000 0000088000 f + 0020000000 0090000000 + 14 0:reserved 00b0000000 0000000000 0010000000 1 + + Attributes key: + f: uncached, write-coalescing, write-through, write-back + rf: uncached, write-coalescing, write-through, write-back, needs runtime mapping + 1: uncached + *Some areas are merged (use 'all' to see) + + + => efi mem all + EFI table at 0, memory map 000000001ad38bb0, size 1260, key a79, version 1, descr. size 0x30 + # Type Physical Virtual Size Attributes + 0 3:bs_code 0000000000 0000000000 0000001000 f + 1 7:conv 0000001000 0000000000 000009f000 f + 00000a0000 0000060000 + 2 7:conv 0000100000 0000000000 0000700000 f + 3 a:acpi_nvs 0000800000 0000000000 0000008000 f + 4 7:conv 0000808000 0000000000 0000008000 f + 5 a:acpi_nvs 0000810000 0000000000 00000f0000 f + 6 4:bs_data 0000900000 0000000000 0000c00000 f + 7 7:conv 0001500000 0000000000 000aa36000 f + 8 2:loader_data 000bf36000 0000000000 0010000000 f + 9 4:bs_data 001bf36000 0000000000 0000020000 f + 10 7:conv 001bf56000 0000000000 00021e1000 f + 11 1:loader_code 001e137000 0000000000 00000c4000 f + 12 7:conv 001e1fb000 0000000000 000009b000 f + 13 1:loader_code 001e296000 0000000000 00000e2000 f + 14 7:conv 001e378000 0000000000 000005b000 f + 15 4:bs_data 001e3d3000 0000000000 000001e000 f + 16 7:conv 001e3f1000 0000000000 0000016000 f + 17 4:bs_data 001e407000 0000000000 0000016000 f + 18 2:loader_data 001e41d000 0000000000 0000002000 f + 19 4:bs_data 001e41f000 0000000000 0000828000 f + 20 3:bs_code 001ec47000 0000000000 0000045000 f + 21 4:bs_data 001ec8c000 0000000000 0000001000 f + 22 3:bs_code 001ec8d000 0000000000 000000e000 f + 23 4:bs_data 001ec9b000 0000000000 0000001000 f + 24 3:bs_code 001ec9c000 0000000000 000002c000 f + 25 4:bs_data 001ecc8000 0000000000 0000001000 f + 26 3:bs_code 001ecc9000 0000000000 000000c000 f + 27 4:bs_data 001ecd5000 0000000000 0000006000 f + 28 3:bs_code 001ecdb000 0000000000 0000014000 f + 29 4:bs_data 001ecef000 0000000000 0000001000 f + 30 3:bs_code 001ecf0000 0000000000 000005b000 f + 31 4:bs_data 001ed4b000 0000000000 000000b000 f + 32 3:bs_code 001ed56000 0000000000 0000024000 f + 33 4:bs_data 001ed7a000 0000000000 0000006000 f + 34 3:bs_code 001ed80000 0000000000 0000010000 f + 35 4:bs_data 001ed90000 0000000000 0000002000 f + 36 3:bs_code 001ed92000 0000000000 0000025000 f + 37 4:bs_data 001edb7000 0000000000 0000003000 f + 38 3:bs_code 001edba000 0000000000 0000011000 f + 39 4:bs_data 001edcb000 0000000000 0000008000 f + 40 3:bs_code 001edd3000 0000000000 000002d000 f + 41 4:bs_data 001ee00000 0000000000 0000201000 f + 42 3:bs_code 001f001000 0000000000 0000024000 f + 43 4:bs_data 001f025000 0000000000 0000002000 f + 44 3:bs_code 001f027000 0000000000 0000009000 f + 45 4:bs_data 001f030000 0000000000 0000005000 f + 46 3:bs_code 001f035000 0000000000 000002f000 f + 47 4:bs_data 001f064000 0000000000 0000001000 f + 48 3:bs_code 001f065000 0000000000 0000005000 f + 49 4:bs_data 001f06a000 0000000000 0000005000 f + 50 3:bs_code 001f06f000 0000000000 0000007000 f + 51 4:bs_data 001f076000 0000000000 0000007000 f + 52 3:bs_code 001f07d000 0000000000 000000d000 f + 53 4:bs_data 001f08a000 0000000000 0000001000 f + 54 3:bs_code 001f08b000 0000000000 0000006000 f + 55 4:bs_data 001f091000 0000000000 0000004000 f + 56 3:bs_code 001f095000 0000000000 000000d000 f + 57 4:bs_data 001f0a2000 0000000000 0000003000 f + 58 3:bs_code 001f0a5000 0000000000 0000026000 f + 59 4:bs_data 001f0cb000 0000000000 0000005000 f + 60 3:bs_code 001f0d0000 0000000000 0000019000 f + 61 4:bs_data 001f0e9000 0000000000 0000004000 f + 62 3:bs_code 001f0ed000 0000000000 0000024000 f + 63 4:bs_data 001f111000 0000000000 0000008000 f + 64 3:bs_code 001f119000 0000000000 000000b000 f + 65 4:bs_data 001f124000 0000000000 0000001000 f + 66 3:bs_code 001f125000 0000000000 0000002000 f + 67 4:bs_data 001f127000 0000000000 0000002000 f + 68 3:bs_code 001f129000 0000000000 0000009000 f + 69 4:bs_data 001f132000 0000000000 0000003000 f + 70 3:bs_code 001f135000 0000000000 0000005000 f + 71 4:bs_data 001f13a000 0000000000 0000003000 f + 72 3:bs_code 001f13d000 0000000000 0000005000 f + 73 4:bs_data 001f142000 0000000000 0000003000 f + 74 3:bs_code 001f145000 0000000000 0000011000 f + 75 4:bs_data 001f156000 0000000000 000000b000 f + 76 3:bs_code 001f161000 0000000000 0000009000 f + 77 4:bs_data 001f16a000 0000000000 0000400000 f + 78 3:bs_code 001f56a000 0000000000 0000006000 f + 79 4:bs_data 001f570000 0000000000 0000001000 f + 80 3:bs_code 001f571000 0000000000 0000001000 f + 81 4:bs_data 001f572000 0000000000 0000002000 f + 82 3:bs_code 001f574000 0000000000 0000017000 f + 83 4:bs_data 001f58b000 0000000000 0000364000 f + 84 6:rt_data 001f8ef000 0000000000 0000100000 rf + 85 5:rt_code 001f9ef000 0000000000 0000100000 rf + 86 0:reserved 001faef000 0000000000 0000080000 f + 87 9:acpi_reclaim 001fb6f000 0000000000 0000010000 f + 88 a:acpi_nvs 001fb7f000 0000000000 0000080000 f + 89 4:bs_data 001fbff000 0000000000 0000201000 f + 90 7:conv 001fe00000 0000000000 00000e8000 f + 91 4:bs_data 001fee8000 0000000000 0000020000 f + 92 3:bs_code 001ff08000 0000000000 0000026000 f + 93 4:bs_data 001ff2e000 0000000000 0000009000 f + 94 3:bs_code 001ff37000 0000000000 0000021000 f + 95 6:rt_data 001ff58000 0000000000 0000020000 rf + 96 a:acpi_nvs 001ff78000 0000000000 0000088000 f + 0020000000 0090000000 + 97 0:reserved 00b0000000 0000000000 0010000000 1 + + Attributes key: + f: uncached, write-coalescing, write-through, write-back + rf: uncached, write-coalescing, write-through, write-back, needs runtime mapping + 1: uncached diff --git a/doc/usage/index.rst b/doc/usage/index.rst index cde7dcb14a6..68522c18c04 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -42,6 +42,7 @@ Shell commands cmd/cyclic cmd/dm cmd/echo + cmd/efi cmd/eficonfig cmd/env cmd/event From patchwork Sun Feb 26 01:33:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748047 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.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=AXf2Rqvj; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR6F34THz2466 for ; Sun, 26 Feb 2023 12:35:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D69B785BA5; Sun, 26 Feb 2023 02:34:15 +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="AXf2Rqvj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2AF4085927; Sun, 26 Feb 2023 02:33:30 +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.1 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-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 03C3985B7A for ; Sun, 26 Feb 2023 02:33:24 +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-il1-x12c.google.com with SMTP id b12so2085204ils.8 for ; Sat, 25 Feb 2023 17:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BMpXV/JeVJRY2/TLLN78jYNNai8eSd4to7gdhr2ve4U=; b=AXf2RqvjOAXHjFqizyk0WTlH/Bqp5JDSi+yc6oMf6C1bogZ4JiEf4tnIjp+eDFlbba RHZFMU6x07oJ5Xokh1ATcRfnvCNtU+YlXVOmzLOBsaZbzk+WjlRDYeVDs2hIlY5SpSAO Hz6JRu+6gZLchpQFQGJrI9Ur4cbjLtzTzfIQ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BMpXV/JeVJRY2/TLLN78jYNNai8eSd4to7gdhr2ve4U=; b=MGnQ4zDOnPRUirxLpoVsd6UEXK29bfc9AMM+w+Awd1zSqOQKz0hrbBy5ZpFF3bVg7j avDDQige73OY98pLfIfDtOvpX7GIL6Vc5aA2Oo6bgjCnIUtlOucspGp+n6wHZqYVW76v tYG9VgOhTjA5NP0yUTJvQtDv0Q27pOlNMBt8CyftOmVDCqGuoLSAZdGvkG7hJ9IX0RYK c5ruWowZfoyNJPjCTZi9ru77hOEqvcXNCR3g86DeaB4vGQ5ARCtsG0fmebxIsGhxKO+B wCepebCe+14FR9KheLzp8YXGtmLzJvsy6dR5cNM5NUdQaVpD5DAFk4RoEGuc17ugWiQ8 BYHQ== X-Gm-Message-State: AO0yUKVP5qvIBlhmfiHYbaLOPnBQGKvmpDNaQiw1Wltqx6+0CuFJ/tCO BlDHHlmPo7E8D00bX5RRuS+1nGdKj7kp0XiM X-Google-Smtp-Source: AK7set9X0pcypR8u7LzDJ2/VAwymCZUqDc6G3bNbzntppfsragoVX6zFWomU+/To1QIA9bDrox7oPw== X-Received: by 2002:a05:6e02:16c5:b0:315:4b70:8376 with SMTP id 5-20020a056e0216c500b003154b708376mr19598012ilx.29.1677375202098; Sat, 25 Feb 2023 17:33:22 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass Subject: [PATCH 09/10] efi: Support showing tables Date: Sat, 25 Feb 2023 18:33:04 -0700 Message-Id: <20230226013305.2251638-10-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Add a command to display the tables provided by EFI. Signed-off-by: Simon Glass --- cmd/efi.c | 40 +++++++++++++++++++++++++++++++++++++++- doc/usage/cmd/efi.rst | 22 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/cmd/efi.c b/cmd/efi.c index c0384e0db28..86988d9e9e2 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -7,10 +7,12 @@ #include #include #include +#include #include #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -273,8 +275,43 @@ done: return ret ? CMD_RET_FAILURE : 0; } +static int do_efi_tables(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct efi_system_table *systab; + int i; + + if (IS_ENABLED(CONFIG_EFI_APP)) { + systab = efi_get_sys_table(); + if (!systab) { + printf("Cannot read system table\n"); + return CMD_RET_FAILURE; + } + } else { + int size; + int ret; + + ret = efi_info_get(EFIET_SYS_TABLE, (void **)&systab, &size); + if (ret) { + printf("Cannot find EFI system table (err=%d)\n", ret); + return CMD_RET_FAILURE; + } + } + for (i = 0; i < systab->nr_tables; i++) { + struct efi_configuration_table *tab = &systab->tables[i]; + char guid_str[37]; + + uuid_bin_to_str(tab->guid.b, guid_str, 1); + printf("%p %s %s\n", tab->table, guid_str, + uuid_guid_get_str(tab->guid.b)); + } + + return 0; +} + static struct cmd_tbl efi_commands[] = { U_BOOT_CMD_MKENT(mem, 1, 1, do_efi_mem, "", ""), + U_BOOT_CMD_MKENT(tables, 1, 1, do_efi_tables, "", ""), }; static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -298,5 +335,6 @@ static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) U_BOOT_CMD( efi, 3, 1, do_efi, "EFI access", - "mem [all] Dump memory information [include boot services]" + "mem [all] Dump memory information [include boot services]\n" + "tables Dump tables" ); diff --git a/doc/usage/cmd/efi.rst b/doc/usage/cmd/efi.rst index c029c423879..2424d3bb587 100644 --- a/doc/usage/cmd/efi.rst +++ b/doc/usage/cmd/efi.rst @@ -10,6 +10,7 @@ Synopsis :: efi mem [all] + efi tables Description ----------- @@ -54,6 +55,14 @@ Attributes Shows a code for memory attributes. The key for this is shown below the table. +efi tables +~~~~~~~~~~ + +This shows a list of the EFI tables provided in the system table. These use +GUIDs so it is not possible in general to show the name of a table. But some +effort is made to provide a useful table, where the GUID is known by U-Boot. + + Example ------- @@ -195,3 +204,16 @@ Example f: uncached, write-coalescing, write-through, write-back rf: uncached, write-coalescing, write-through, write-back, needs runtime mapping 1: uncached + + + => efi tables + 000000001f8eda98 ee4e5898-3914-4259-9d6e-dc7bd79403cf EFI_LZMA_COMPRESSED + 000000001ff2ace0 05ad34ba-6f02-4214-952e-4da0398e2bb9 EFI_DXE_SERVICES + 000000001f8ea018 7739f24c-93d7-11d4-9a3a-0090273fc14d EFI_HOB_LIST + 000000001ff2bac0 4c19049f-4137-4dd3-9c10-8b97a83ffdfa EFI_MEMORY_TYPE + 000000001ff2cb10 49152e77-1ada-4764-b7a2-7afefed95e8b + 000000001f9ac018 060cc026-4c0d-4dda-8f41-595fef00a502 EFI_MEM_STATUS_CODE_REC + 000000001f9ab000 eb9d2d31-2d88-11d3-9a16-0090273fc14d EFI_SMBIOS + 000000001fb7e000 eb9d2d30-2d88-11d3-9a16-0090273fc14d EFI_GUID_EFI_ACPI1 + 000000001fb7e014 8868e871-e4f1-11d3-bc22-0080c73c8881 EFI_GUID_EFI_ACPI2 + 000000001e550018 dcfa911d-26eb-469f-a220-38b7dc461220 From patchwork Sun Feb 26 01:33:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1748046 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=Qngq4dFp; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PPR5z740xz2466 for ; Sun, 26 Feb 2023 12:35:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8C6A85BB6; Sun, 26 Feb 2023 02:34: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="Qngq4dFp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AF27685930; Sun, 26 Feb 2023 02:33:30 +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.1 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-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 8CA6785B68 for ; Sun, 26 Feb 2023 02:33:23 +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-il1-x12b.google.com with SMTP id s8so2080084ilv.10 for ; Sat, 25 Feb 2023 17:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uc/q/nj3S5w7ZJFDsqmFKhd1fvRl07HLzdV4JfKh3eE=; b=Qngq4dFp2t+f+xuvmPrdhmcpjA1M6ONaf5D9m9tVl3aun56jQ5j5/yI+x+kOgQO4S1 WbnCF3sYE6l3cF1dtweUd0BVnjXL6vVJLK4UipU2HF5/KJtwOPAMXADrvgPCvwVuQ+Tu 4T8fPn7cyBO4fe32fiKi2ZiIWm4qXwafmHD6w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uc/q/nj3S5w7ZJFDsqmFKhd1fvRl07HLzdV4JfKh3eE=; b=nk1cgiSwGzqQcpSPBH5rPsdK9/Ov1RuHzhDiXknVQE0pCiZqA995m8+1A2Hl63+5u1 WmALwwowz5nOM8MuGIu8c1pNn+DV5805EEDMnc6+/i7bVuC9yEpxXo3pPY20fF1B7cLn jjKXe3I9B42bC2L6dn7J3E5tav3GkUGgT5BOmAY19OALouqF7ZrbtpCaiH9isFrWd6Zs FrYQscTQJPa3kdSW6lxLBTpbrSpyuRed2af/ff5nrComRVIa0stctsN7/doWVTAYw/bx xgV4cb3QpRhLNwceBpQxKOLE/8wz83MTtEgZk2rfkhYNJdOwPNbHNzSLARI9A1OCX6bU 05kg== X-Gm-Message-State: AO0yUKW+++YRDrUzkihG15h5+ABQt92i7dVznRnRikvUbU63BECNYlv6 C++vuenJTbbyjPwMMdStrRq5xCEcyBwMMrJ+ X-Google-Smtp-Source: AK7set+AXU6YTT+OIROwF7TvPd5AAY5yBE2yxBUTZ02SBocaOXu43OtF0u8z5RkihllZ1NrxSwu1Dw== X-Received: by 2002:a92:6701:0:b0:315:4f67:7054 with SMTP id b1-20020a926701000000b003154f677054mr12633928ilc.19.1677375202935; Sat, 25 Feb 2023 17:33:22 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r5-20020a92ce85000000b00316e3a38becsm932699ilo.18.2023.02.25.17.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 17:33:22 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass Subject: [PATCH 10/10] efI: Allow packaging a kernel in the debugging script Date: Sat, 25 Feb 2023 18:33:05 -0700 Message-Id: <20230226013305.2251638-11-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230226013305.2251638-1-sjg@chromium.org> References: <20230226013305.2251638-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Add an option to package a kernel into the debugging script used for EFI. The name of the kernel must be added to the script. Bd efault it is assumed that the kernel is built in the /tmp/kernel directory. Signed-off-by: Simon Glass --- scripts/build-efi.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/build-efi.sh b/scripts/build-efi.sh index 46c28807ef1..6b7df2e9bfe 100755 --- a/scripts/build-efi.sh +++ b/scripts/build-efi.sh @@ -18,12 +18,15 @@ # OVMF-pure-efi.x64.fd at # https://drive.google.com/file/d/1c39YI9QtpByGQ4V0UNNQtGqttEzS-eFV/view?usp=sharing +bzimage_fname=/tmp/kernel/arch/x86/boot/bzImage + set -e usage() { echo "Usage: $0 [-a | -p] [other opts]" 1>&2 echo 1>&2 echo " -a - Package up the app" 1>&2 + echo " -k - Add a kernel" 1>&2 echo " -o - Use old EFI app build (before 32/64 split)" 1>&2 echo " -p - Package up the payload" 1>&2 echo " -P - Create a partition table" 1>&2 @@ -52,11 +55,14 @@ serial= # before the 32/64 split of the app old= +# package up a kernel as well +kernel= + # Set ubdir to the build directory where you build U-Boot out-of-tree # We avoid in-tree build because it gets confusing trying different builds ubdir=/tmp/b/ -while getopts "aopPrsw" opt; do +while getopts "akopPrsw" opt; do case "${opt}" in a) type=app @@ -64,6 +70,9 @@ while getopts "aopPrsw" opt; do p) type=payload ;; + k) + kernel=1 + ;; r) run=1 ;; @@ -124,6 +133,9 @@ EOF # Copy files into the filesystem copy_files() { sudo cp $TMP/* $MNT + if [[ -n "${kernel}" ]]; then + sudo cp ${bzimage_fname} $MNT/vmlinuz + fi } # Create a filesystem on a raw device and copy in the files