Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 026DAC6FA99 for ; Fri, 10 Mar 2023 20:52:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6EACA85FC2; Fri, 10 Mar 2023 21:49:57 +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="aivdH6Xd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EAA9385FAA; Fri, 10 Mar 2023 21:49:27 +0100 (CET) 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 A9E4E85F9D for ; Fri, 10 Mar 2023 21:49: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-il1-x12b.google.com with SMTP id 4so3667228ilz.6 for ; Fri, 10 Mar 2023 12:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678481358; 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=ixwXlBR6pJWYp9FtG2bi2y79diguhBx1xqoAqDopzo8=; b=aivdH6XdhEkpxd/SM5iv9lhcAMakUT6v6WkM8DLuGcOPcr45UOkMobpF/w90LytY60 N2igMWbMyq6S5rxhpEE7t28Ncxsk/9PsqSi8Rae2K+qPrMJdBZg1prhe/gnYrZLDpDDV st+UM+mGBXp7nUULRyxOB5pWncSKH9Ly2JD5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678481358; 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=ixwXlBR6pJWYp9FtG2bi2y79diguhBx1xqoAqDopzo8=; b=Zo+EQLLYjizw0Lgw/uQvi7a6klCAPfVmzj2s4GGpXIEocxVM1ZnhsD+0F+RQAGz+AQ vre4X6AnU1pJbfWNqp6nFMmR3j324Xl+alwK2q10o5++mn4d+V8wHQjXynmo8DDHBXl6 MQgGl/miRttpPBQeZo5lzS/nCzKbMlNTlPSBi+ASINRm5o/XnuyDj14vGgWcP8SkWf7N 0A1vbew+OToN+dugXvzD77GrQBmvEwW55LnVp+JYPqzeUs54eCpYIhaCS+Eqr8OKD7Oy yzCWtjuqrlc0JFq+zGHgDlCSuouNv7lrvNnmKZyubGHeKPpEzwDOxZVXAI8ZA0OXuNnI sUAQ== X-Gm-Message-State: AO0yUKXv/N5GZSgisJO+ozoetW7LdMF5U24CUfh7GaINskTdf8MhLVhc +8zmoLLp3LkMAN/5wXQ8mdnxWPP76KWbXNiidHs= X-Google-Smtp-Source: AK7set9BZKtR8tjPAubCswWxj+jNkQfWpQPMk4hWlDaneriVcrY7DcGMT7JiSL+MqxnGfuQ+oNalCw== X-Received: by 2002:a05:6e02:18ce:b0:315:9b3a:2f56 with SMTP id s14-20020a056e0218ce00b003159b3a2f56mr4437512ilu.28.1678481358124; Fri, 10 Mar 2023 12:49:18 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id a7-20020a056e020e0700b00315785bfabfsm273817ilk.47.2023.03.10.12.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 12:49:16 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Simon Glass , Bin Meng Subject: [PATCH v2 05/12] x86: Exit EFI boot services before starting kernel Date: Fri, 10 Mar 2023 12:48:55 -0800 Message-Id: <20230310204903.416969-6-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230310204903.416969-1-sjg@chromium.org> References: <20230310204903.416969-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 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 --- (no changes since v1) 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"); -- 2.40.0.rc1.284.g88254d51c5-goog