From patchwork Mon Oct 21 23:26:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1180926 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="F+X5YvnN"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xtCJ67jgz9sCJ for ; Tue, 22 Oct 2019 10:29:48 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 79488C21DD7; Mon, 21 Oct 2019 23:28:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B059FC21DFA; Mon, 21 Oct 2019 23:28:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DCC2AC21DED; Mon, 21 Oct 2019 23:27:17 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id B80BAC21E31 for ; Mon, 21 Oct 2019 23:27:14 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id u8so18084706iom.5 for ; Mon, 21 Oct 2019 16:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FaBlr8Xp2BoKCHk5I4ccJn8olNKnX0yvSJ87awROoGA=; b=F+X5YvnNPbIalAfmwQAT5EiOt20b4tubJL2hhNXAYVthxbWhXkUdtgYi62ndfDuLEM AHnXEC+IyhVVYne2yTUmYTtkqMvDGEVNMl4ia8LEYEtFhYzapGehVWaHH5x72pQKGT5c wLAVxWFlsM0uk0Hk2kpjPpOCtHv6WJQbGXqb8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FaBlr8Xp2BoKCHk5I4ccJn8olNKnX0yvSJ87awROoGA=; b=CM2OtIi+kN1xds60XsdDxUmhdLrcMTs4w9O9Lrf0xDZINrDZ8hF9+gBHOXbSGivW7j JEXv154jnp7rFVpJBy9fT52xtaoCfWrVPo01O8Op8/lIV+AKa097vql++Q5DRQFfNyDM RU7rZiR/7KvQhJe0NSF/4OnslRes51mkR4QmrGBD2J4vExrb9CTtpmIlsEUG5vZgItOY Khztxe9JWj8n7QBa2K6mx5My/1HHTqX29RxjGC/Z99JazSUy1ovZRZqanSUaUhCGQ0KF xeVtJm3jD3KSnGJvV6YYyR8T895YyGyL7gA6cHkEsdrc+CXTf7+ZRxIgWihSouE93UWO dmpA== X-Gm-Message-State: APjAAAU43ffFvcDem2KlDnwjEI0TNa1vse10Ogl68M0q6Fr32hQd9OQW PQkr+Zgrlh5ZbjEOXXlh8GFucSBJP23cig== X-Google-Smtp-Source: APXvYqyjTJiyYzX6iWCoEm6oquShgA7fzajRb5oB59b0FTqmzuMlG345q8ZIaIshAlkC4hr7fvql9A== X-Received: by 2002:a6b:8d12:: with SMTP id p18mr814487iod.263.1571700433586; Mon, 21 Oct 2019 16:27:13 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id u190sm6879206ilc.36.2019.10.21.16.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 16:27:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 21 Oct 2019 17:26:52 -0600 Message-Id: <20191021232652.132164-11-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021232652.132164-1-sjg@chromium.org> References: <20191021232652.132164-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Marek Vasut , Stefan Roese Subject: [U-Boot] [PATCH v2 10/10] bootstage: Allow SPL to obtain bootstage info from TPL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" It is possible to enable bootstage in TPL. TPL can stash the info for SPL. But at present this information is then lost because SPL does not read from the stash. Add support for SPL not being the first phase to enable bootstage. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: - Adjust SPL logic to avoid failing if TPL does not provide bootstage data - Add a new patch to support %p without DEBUG in tiny-printf common/spl/spl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index eabb1fbc138..f1ad8dc9dab 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -396,12 +397,23 @@ static int spl_common_init(bool setup_malloc) gd->malloc_ptr = 0; } #endif - ret = bootstage_init(true); + ret = bootstage_init(u_boot_first_phase()); if (ret) { debug("%s: Failed to set up bootstage: ret=%d\n", __func__, ret); return ret; } +#ifdef CONFIG_BOOTSTAGE_STASH + if (!u_boot_first_phase()) { + const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR, + CONFIG_BOOTSTAGE_STASH_SIZE); + + ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE); + if (ret) + debug("%s: Failed to unstash bootstage: ret=%d\n", + __func__, ret); + } +#endif /* CONFIG_BOOTSTAGE_STASH */ bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_START_TPL : BOOTSTAGE_ID_START_SPL, SPL_TPL_NAME); #if CONFIG_IS_ENABLED(LOG)