From mboxrd@z Thu Jan 1 00:00:00 1970 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 5D0F6C54EE9 for ; Sun, 25 Sep 2022 15:10:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B564484DB3; Sun, 25 Sep 2022 17:05:21 +0200 (CEST) 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="bwO+V5JT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B25384C3A; Sun, 25 Sep 2022 17:04:02 +0200 (CEST) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (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 BBD0F84CE2 for ; Sun, 25 Sep 2022 17:03:58 +0200 (CEST) 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-xd2f.google.com with SMTP id y141so3432567iof.5 for ; Sun, 25 Sep 2022 08:03:58 -0700 (PDT) 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; bh=e53YhkdDe0qqWDG2f8iEZWSFyR7tbVLNrn5m+d5pme8=; b=bwO+V5JTXGu/fRqFPCM7llew8l0ruvo2vGM08v6XNSx5eTwNa5MLEc8Woo36yNC4L7 tssi7MGfdn7p2jfxBbqLtEvx3+zIQOm1hmn13Lfj6FNUxjZMQ5/OzKbyIjP/eZex/nnk k7JwoWMUkPESxF5OAHlHBFRbrNcYwgDu5m8s0= 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; bh=e53YhkdDe0qqWDG2f8iEZWSFyR7tbVLNrn5m+d5pme8=; b=nrqeD7WGGxzms+X5lKyd8kpCigiXd8f/8NCGyxOZ2AtUsO6lpwDZWyXZM3FlM9scry l25QMbqgoxHa8hCK8A+kd/AS5fb8bRRO2RxOXLuBz7tkmmkBzf1U8OoF415PMNp+ZPw7 5B8zPgoUKM5ixEyqP87VMmcV+GrpK5+UDb0jSp0znMv2mK2OG2E5PHIf/rLVYfsFK0EJ +u0vHCNnNw1UgaDDOVEpy1tsCalTqaGvg/l6lTpGLBcXrGyniwP/Z5Js+1HlQWovqUdY mWTjWj9dY+g2eH1LmDuVzlkdU5IxO34wUvmt+5vbzLdSSaOQW2ZwlOhDJGMJAu2zEEPL +HGg== X-Gm-Message-State: ACrzQf32wesJ3Q8cfOCWJLseNoEnV+yFwsd/81jjwSjAQaySencFAaR6 pD2DO2eb5VAHIMqhqriq0aoRigertizN5A== X-Google-Smtp-Source: AMsMyM6YK5KqZuSE+l9/M3Vk0xCA+m2BVsVLjYVOZc+QCGWrWO+sZNzz8m0cshFyf0PHeG6CqA5NTw== X-Received: by 2002:a05:6602:3ca:b0:6a4:16a0:9862 with SMTP id g10-20020a05660203ca00b006a416a09862mr6212950iov.217.1664118225251; Sun, 25 Sep 2022 08:03:45 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u19-20020a926013000000b002f19d9838c6sm5360578ilb.25.2022.09.25.08.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 08:03:44 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 33/45] vbe: Support selecting operations by SPL phase Date: Sun, 25 Sep 2022 09:02:36 -0600 Message-Id: <20220925150248.2524421-34-sjg@chromium.org> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220925150248.2524421-1-sjg@chromium.org> References: <20220925150248.2524421-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 VBE supports booting firmware during the SPL phases, i.e. so that VPL can start SPL, then SPL can start U-Boot. It also supports booting an OS, when in U-Boot. As a first step towards these features, add functions to indicate the current VBE phase. The firmware selection is done in VPL and the OS selection is done in U-Boot proper. Signed-off-by: Simon Glass --- include/vbe.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/vbe.h b/include/vbe.h index b83f6f0c519..ece2697b5dc 100644 --- a/include/vbe.h +++ b/include/vbe.h @@ -10,6 +10,34 @@ #ifndef __VBE_H #define __VBE_H +/** + * enum vbe_phase_t - current phase of VBE + * + * VBE operates in two distinct phases. In VPL it has to choose which firmware + * to run (SPL, U-Boot, OP-TEE, etc.). It then carries on running until it gets + * to U-Boot, where it decides which OS to run + * + * @VBE_PHASE_FIRMWARE: Selecting the firmware to run + * @VBE_PHASE_OS: Selecting the Operating System to run + */ +enum vbe_phase_t { + VBE_PHASE_FIRMWARE, + VBE_PHASE_OS, +}; + +/** + * vbe_phase() - get current VBE phase + * + * Returns: Current VBE phase + */ +static inline enum vbe_phase_t vbe_phase(void) +{ + if (IS_ENABLED(CONFIG_SPL_BUILD)) + return VBE_PHASE_FIRMWARE; + + return VBE_PHASE_OS; +} + /** * vbe_list() - List the VBE bootmeths * -- 2.37.3.998.g577e59143f-goog