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 DAA9DC6FA8E for ; Sun, 26 Feb 2023 01:34:39 +0000 (UTC) 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) 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 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.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"); -- 2.39.2.637.g21b0678d19-goog