From patchwork Mon Mar 15 05:11:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452985 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=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: 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=OYOuX0Fy; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPfl62FQz9sR4 for ; Mon, 15 Mar 2021 16:11:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4874B829FB; Mon, 15 Mar 2021 06:11:55 +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="OYOuX0Fy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9E5B3829EE; Mon, 15 Mar 2021 06:11:53 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (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 9D087829E9 for ; Mon, 15 Mar 2021 06:11:50 +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-pg1-x52d.google.com with SMTP id o16so2784204pgu.3 for ; Sun, 14 Mar 2021 22:11:50 -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=4hzhDS/8nTcOPKFbijlweLlv/FIghw36KyHc3gZRVrQ=; b=OYOuX0FyyGkA/X8Dwui/gZcwJqjuwT6Ju7yun1OKWebi8k045AjY69ldMoMFF3cPmm MtesmbkXLaapAI8lvYuWC5cbKCqcWxUN2hlvPjmbfE6xTVB04YBbMc/xQsEefSk/Eunz Y3P88v9X+vb1BfoDZw0lA0w3OyBGaQVbxnFNw= 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=4hzhDS/8nTcOPKFbijlweLlv/FIghw36KyHc3gZRVrQ=; b=OC7mxIu3crgURbSC4v3bc9pNA+BKJ6gcMEK4QQ2OM4/x3tlngPyHxZKWoZ1BlDdy3E geVwa3slWFR0BcdqJEcs6NwaR23Qo+ihOpuexvaBtFbKa4QM0SQ7FyYSdEs1moyA8r1W q465OcFlbaAiEBC8IrdOCFgWQjSfllhO0i1+KsxZoxnLmIDAp+nBIS92l+ajBttI5uSX XGxofNNJGkCtWbMMGZVuMYKBf/P+scS+b19OtcoILyozs3kH+gMXiQjOuB3GJiycYTJC PhElngHQu5mBR+KNn7hVFrCMNOWtSaKtoF9T+UcflHNp1kYGwhQ05JiOGo1RM5BymR54 fF2A== X-Gm-Message-State: AOAM530NBFAHcEMeQ0fxl1wAiPJM3Ega2fn+/TaxFhmyBS/GQrCs3z79 ztA9mQs5xV9g3E3XZCUKpplRJcK0wKOJzXkQ X-Google-Smtp-Source: ABdhPJyRipvFbcjBlMR0VYCpEuwgGDhWJ8/1sQ597hOdKnsTOC0nR8Vggtvcfr1pemI6fFLRrillSA== X-Received: by 2002:a05:6a00:1681:b029:1ec:c756:7ec3 with SMTP id k1-20020a056a001681b02901ecc7567ec3mr8839669pfc.13.1615785108995; Sun, 14 Mar 2021 22:11:48 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:11:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Claudiu Beznea , Sean Anderson Subject: [PATCH 01/19] sandbox: Only call timer_timebase_fallback() if present Date: Mon, 15 Mar 2021 18:11:06 +1300 Message-Id: <20210315181056.1.I9ede5161ce79af261ff719410cbc1dc3e83366a2@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean This function only exists if CPU is enabled. Update the code to take account of this, so that it does not have to be enabled on all sandbox builds. Signed-off-by: Simon Glass Reviewed-by: Sean Anderson --- drivers/timer/sandbox_timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c index 2075cd4edda..c846bfb9f12 100644 --- a/drivers/timer/sandbox_timer.c +++ b/drivers/timer/sandbox_timer.c @@ -38,7 +38,8 @@ static int sandbox_timer_probe(struct udevice *dev) { struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); - if (dev_read_bool(dev, "sandbox,timebase-frequency-fallback")) + if (CONFIG_IS_ENABLED(CPU) && + dev_read_bool(dev, "sandbox,timebase-frequency-fallback")) return timer_timebase_fallback(dev); else if (!uc_priv->clock_rate) uc_priv->clock_rate = SANDBOX_TIMER_RATE; From patchwork Mon Mar 15 05:11:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452986 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=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: 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=ffcjoCJ9; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPfy3RLNz9sR4 for ; Mon, 15 Mar 2021 16:12:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A2F282A18; Mon, 15 Mar 2021 06:11:59 +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="ffcjoCJ9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1590882A16; Mon, 15 Mar 2021 06:11:57 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 A6BCB829E4 for ; Mon, 15 Mar 2021 06:11: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=sjg@chromium.org Received: by mail-pj1-x102f.google.com with SMTP id lr10-20020a17090b4b8ab02900dd61b95c5eso11448176pjb.4 for ; Sun, 14 Mar 2021 22:11:53 -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=H49VReAUNVr6pQqQVlMBebiDd2adgS+i7Ff67wv/JP8=; b=ffcjoCJ99bDHvnv6GiMqigOFCsp1H/5P0cN5mzg0Ej6gyltUvcs+nkLtXj6/chOUq2 uzfqjwJLb88rzV+5AnCdxKnbZNule6hdiXoIHkGcijIkxyFdHBLE6WrCO3EeZ1U0t1Ag HUiJw1RhsuO4NOccIpTZMucPs74PZhGDLCTzw= 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=H49VReAUNVr6pQqQVlMBebiDd2adgS+i7Ff67wv/JP8=; b=irxNEhy1d2PFo2QiLAiq5hA7MAd//xuSMl4Bh8eVPTCe1GMur8mN5k7HnN0yCAkE7/ dLht0ZwhS//821IZ1H4Mk55ghvfCWQJthnFvtpm8e/c329NVYmcfGqq6K+oH2r1FWJ4p y1xluRotQp/YnTo7ZgAY4wLRauEoua/LGjg6Ew0vwuuAm1UZpnhZPWhXwGWbxocc5ewu gReTr1k4K3vMUut/h/PFGgzAK5CoGs71Zsl0NcHyhtbDzCGL5kr4vpwJXkeA2pAZx4rC ybbhn/GKo/CJgCGs+j6rAQsGYqL72wdTK2dTQDwcEDNP0U89YhwOVTOJcb8dPpyd9Fk5 AN5A== X-Gm-Message-State: AOAM532KGehed+NIbGnPRpzrCX3Myc5tHRaz9r43TWgfMPrXToDiOzGL VoaIPiLLJrL0q3bGJPzUh6+lftJ6A7kD9Thp X-Google-Smtp-Source: ABdhPJyPmKoL1Dr+EOkcz6dwjnNmeXFLGXd39Q+JFseeoskzyZ6P1C2xuv/XkUntT0yAfmBI6NK+pQ== X-Received: by 2002:a17:90a:17ea:: with SMTP id q97mr11190637pja.71.1615785111984; Sun, 14 Mar 2021 22:11:51 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:11:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , Patrick Delaunay , Rasmus Villemoes Subject: [PATCH 02/19] sandbox: Only delete the executable if requested Date: Mon, 15 Mar 2021 18:11:07 +1300 Message-Id: <20210315181056.2.Ida1b0d3314a2d487fd877dc9615e1d152f63dfd6@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean At present sandbox removes its executable after failing to run it, since there is no other way that it would get cleaned up. However, this is actually only wanted if the image was created within sandbox. For the case where the image was generated by the build system, such as u-boot-spl, we don't want to delete it. Handle the two code paths accordingly. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 2d9583c17ca..9510def4526 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -711,7 +711,7 @@ static int add_args(char ***argvp, char *add_args[], int count) * @fname: Filename to exec * @return does not return on success, any return value is an error */ -static int os_jump_to_file(const char *fname) +static int os_jump_to_file(const char *fname, bool delete_it) { struct sandbox_state *state = state_get_current(); char mem_fname[30]; @@ -734,11 +734,13 @@ static int os_jump_to_file(const char *fname) os_fd_restore(); - extra_args[0] = "-j"; - extra_args[1] = (char *)fname; - extra_args[2] = "-m"; - extra_args[3] = mem_fname; - argc = 4; + argc = 0; + if (delete_it) { + extra_args[argc++] = "-j"; + extra_args[argc++] = (char *)fname; + } + extra_args[argc++] = "-m"; + extra_args[argc++] = mem_fname; if (state->ram_buf_rm) extra_args[argc++] = "--rm_memory"; err = add_args(&argv, extra_args, argc); @@ -762,7 +764,10 @@ static int os_jump_to_file(const char *fname) return err; } - return unlink(fname); + if (delete_it) + return unlink(fname); + + return -EFAULT; } int os_jump_to_image(const void *dest, int size) @@ -774,7 +779,7 @@ int os_jump_to_image(const void *dest, int size) if (err) return err; - return os_jump_to_file(fname); + return os_jump_to_file(fname, true); } int os_find_u_boot(char *fname, int maxlen, bool use_img) @@ -848,7 +853,8 @@ int os_spl_to_uboot(const char *fname) printf("%s\n", __func__); /* U-Boot will delete ram buffer after read: "--rm_memory"*/ state->ram_buf_rm = true; - return os_jump_to_file(fname); + + return os_jump_to_file(fname, false); } long os_get_time_offset(void) From patchwork Mon Mar 15 05:11:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452987 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=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: 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=Ym9chB0C; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPg946v0z9sR4 for ; Mon, 15 Mar 2021 16:12:21 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D9DC7829E4; Mon, 15 Mar 2021 06:12:10 +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="Ym9chB0C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD2F182A68; Mon, 15 Mar 2021 06:12:03 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 1F0B4829E4 for ; Mon, 15 Mar 2021 06:11: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=sjg@chromium.org Received: by mail-pl1-x62a.google.com with SMTP id u18so14676445plc.12 for ; Sun, 14 Mar 2021 22:11:57 -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=Z1sMxEcO/7jW6qw1U3CEFLEX6gnqkp7fI5zRBYl6QXg=; b=Ym9chB0C9BjqMI58MiKs1naL5X33OeIV/4SCtqJLWH6YY/7SQcMGs+G4UYwZDiBFKN 6E9SijH46URRfb7FTsyoe3U4T96aLXcFx62OqFzuUS0/tAyru1TI5o+TTtMawqlZVcXV g7WCiyn9vfJ+dvI/sOozsE2sYtxzkemI2rlWQ= 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=Z1sMxEcO/7jW6qw1U3CEFLEX6gnqkp7fI5zRBYl6QXg=; b=fy7iNqAKF8OOiR6rEkFeJmeJ1k+zuUIcSz3WuyAo8C7nVQt8eiNAsQIpCvjsRPF3zv l/8LS35l+GlMWA23dZVDn2h8zD7VoxMZewDvKMhHM46POAa95IiZdBXPYXuHaBGZpFZT 6jhMavjSt0g5tFp3p4Ubq9wPgqEQaEUYIxqylZYxDhLEGfxfCgxxfHyOPAGb1z11zhM+ lyXwvnTX0PhvH3Hxr0bCu3zLWRHK2EUZ93LxCkzDjDlCpLH+DrIK9eaYsUp4k2d0QNkr lkAXAzyC0GqqnZBSmzBWMKtnYuasSS825km6Y4s1/ItsTz729nNfw6cDnsp0MSY8adRb kgPw== X-Gm-Message-State: AOAM5321KIyecKvRi78IGFtVQQWgLLeIgZKN5BIJxfjDjss73YuJQRcR OE8YcVpvAM52nuBGq/kfFi79YdGxkgiwF/ue X-Google-Smtp-Source: ABdhPJxbLOBYkQo3erDf229mZ8ZV/htTS/J8VJla7ehrsjzEuWJk5foLYhTpnlBiVjfDAUTZElzUhQ== X-Received: by 2002:a17:90b:4017:: with SMTP id ie23mr11148708pjb.118.1615785115483; Sun, 14 Mar 2021 22:11:55 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:11:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alper Nebi Yasak , Andy Shevchenko , Heinrich Schuchardt , Pratyush Yadav , Walter Lozano Subject: [PATCH 03/19] sandbox: cros_ec: Only write EC state when the EC is probed Date: Mon, 15 Mar 2021 18:11:08 +1300 Message-Id: <20210315051124.1940496-2-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean This can crash if the EC has not yet been probed. Add a check to prevent this. Signed-off-by: Simon Glass --- drivers/misc/cros_ec_sandbox.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index cb8adc4495a..bc01df0904e 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -153,10 +153,14 @@ static int cros_ec_write_state(void *blob, int node) { struct ec_state *ec = g_state; + if (!g_state) + return 0; + /* We are guaranteed enough space to write basic properties */ fdt_setprop_u32(blob, node, "current-image", ec->current_image); fdt_setprop(blob, node, "vbnv-context", ec->vbnv_context, sizeof(ec->vbnv_context)); + return state_setprop(node, "flash-data", ec->flash_data, ec->ec_config.flash.length); } From patchwork Mon Mar 15 05:11:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452989 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=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: 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=RjncYuRl; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPgh4Nskz9sR4 for ; Mon, 15 Mar 2021 16:12:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AE1182AA3; Mon, 15 Mar 2021 06:12:37 +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="RjncYuRl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94BFC82AA1; Mon, 15 Mar 2021 06:12:14 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 8351782A2C for ; Mon, 15 Mar 2021 06:11:59 +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-pj1-x102e.google.com with SMTP id kr3-20020a17090b4903b02900c096fc01deso14079585pjb.4 for ; Sun, 14 Mar 2021 22:11:59 -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=J/YF7M162j9V6vvAey+y/E6lZDDDYmsYEivfx82d94Y=; b=RjncYuRlIgHOAzm3Sgt0r2foaOQB51RjI4p8KRHBx5D8Sm7aBWjtO4o2EWlNR1UPFN zzeqSnZM8746H0H53ehaDrW5KJ8JIZUGMm1j7cLpj0FCNIwVsHJZvoPTYy5G8EDDpoXF F2/rcsn9weCpMu6bQWnEayfWZQdiI3RBCVmq0= 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=J/YF7M162j9V6vvAey+y/E6lZDDDYmsYEivfx82d94Y=; b=XUS89oTOfFs43BSw/LceNAoDZYpASvqSzPurIoXt+gVZZLn/Eb0MMzIucAapgk35E8 M2zTWMrxfKgW/W3AuAwxXrASXT2CgtsEL9QWYqmnbwYx97U5kL2fCQAzve3weMAaKoo9 oMZRcdlVyzKR95PlGH+o6UfnGm9rzqhLSRKeHcZfymBIau43J1o4SBFFd8myF5vK6sxv pKv7P5KUgHlWQckFw2vj9qnOarZq6mmmEig5NHGVoNu0V0aZl6baXSoMaJaK7quE0Oc0 kiTYbil1hLLL2bxvl+frEHqAnyRAbbtdZyMiQmfl//ScIz2XcdNLxoK4buNpuAseTwqj b1Zg== X-Gm-Message-State: AOAM532Crlz3zmT2yIuCtxlZmuZ+RFnPonvtp2NerXuAI1GHE9I2TCvz x4SmpMnwXmjJ/+XM3h9WBYYhJg2sgsjZwFcd X-Google-Smtp-Source: ABdhPJyMa6G3Fk2FWcWNJa8ejkdHh6rqqFmvQkYwBLux+lItCSmRjLtIW1QK+7skk9Qx+U7yN2yRxQ== X-Received: by 2002:a17:90a:458b:: with SMTP id v11mr10582906pjg.189.1615785117852; Sun, 14 Mar 2021 22:11:57 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:11:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH 04/19] sandbox: Disintangle declarations in do_host_bind() Date: Mon, 15 Mar 2021 18:11:09 +1300 Message-Id: <20210315051124.1940496-3-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean This function has a strange mix of declarations and argument parsing which is a bit hard to follow and harder to modify. Separate out the declarations at the start of the function and adjust the ordering of the code slightly. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- cmd/host.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/host.c b/cmd/host.c index 1d21f796ac3..927c23d0d9d 100644 --- a/cmd/host.c +++ b/cmd/host.c @@ -41,16 +41,21 @@ static int do_host_save(struct cmd_tbl *cmdtp, int flag, int argc, static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + const char *dev_str; + char *file; + char *ep; + int dev; + if (argc < 2 || argc > 3) return CMD_RET_USAGE; - char *ep; - char *dev_str = argv[1]; - char *file = argc >= 3 ? argv[2] : NULL; - int dev = simple_strtoul(dev_str, &ep, 16); + dev_str = argv[1]; + dev = simple_strtoul(dev_str, &ep, 16); if (*ep) { printf("** Bad device specification %s **\n", dev_str); return CMD_RET_USAGE; } + file = argc >= 3 ? argv[2] : NULL; + return !!host_dev_bind(dev, file); } From patchwork Mon Mar 15 05:11:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452988 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=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: 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=aBxOaK9w; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPgQ3tpyz9sR4 for ; Mon, 15 Mar 2021 16:12:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F05AE82A6F; Mon, 15 Mar 2021 06:12:26 +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="aBxOaK9w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C64B582A7B; Mon, 15 Mar 2021 06:12:10 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 E2804829E4 for ; Mon, 15 Mar 2021 06:12:03 +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-pf1-x42f.google.com with SMTP id t85so5808992pfc.13 for ; Sun, 14 Mar 2021 22:12:02 -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=jdnScwoCYitR17TH85gi1J521roHslGyYp0On2WNFdY=; b=aBxOaK9wwL2un7hAlqHrzQxQIIYYlVCp8KXEGA/g0qlOblQ5FJw7eOJDMiTz5q8WqG zhhyv5uO48TQmN0zjfZqaC92CMATeRqKpnCt7S6Y/efkqTomSSa8x/8IN4dfqq/DEsNd AQ1EhMJY/RppozsSEmIN3Bsqzez5Ylt63ulyE= 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=jdnScwoCYitR17TH85gi1J521roHslGyYp0On2WNFdY=; b=j5CqLT8gwvsXPu08MgbQTIHE25f8PvKY6hT30lZcDw9+q4xLm/g0CA/UCV5zbb7Bec dCs7kQ8cGdSiV2p3kgPQVOhL3rzs8QurBS4OuEyTzxooqKSDMDg5TH3wWIL9y3dViYQh bQj1UmrwQP9DqwHor2ZgN/Ml9BJZZ9J5Xng49hdthwhKRe4gSmtb3zqwBK+5NmY/QMmB W7f8dynUKWG9VltLWxUwr3S2P+tSS3IdS2wF/iuVDZU3JAS4PiJnnnYj1uGe9c1rQVxR 3WAx2KtwyMiFtOw6ziEg6jqw20OtGkyJcZOohYcRdNX3hMZvjrWD8f1fV+/o/7nmgnYv PDvw== X-Gm-Message-State: AOAM530XoH6WYXuYod/qNQMo+s3kzrZxGhNqDHCAor0koex1jebGzY8E JB+5Hv63RTKqxbMAapzxvku8Cdd80QDxmH0w X-Google-Smtp-Source: ABdhPJx8j1xSzRPzSFtB+kvlmm2zckCHjFvJhtRSYdZdr0EAyLnY32JBrNgDBl6aXPrsHHvOmUY7pA== X-Received: by 2002:a62:cfc1:0:b029:200:1eed:462 with SMTP id b184-20020a62cfc10000b02902001eed0462mr16758519pfg.55.1615785120350; Sun, 14 Mar 2021 22:12:00 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH 05/19] sandbox: Update do_host_bind() argument counting Date: Mon, 15 Mar 2021 18:11:10 +1300 Message-Id: <20210315051124.1940496-4-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Remove the 'bind' subcommand before processing the arguments. This will make it easier to add an optional flag. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- cmd/host.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/host.c b/cmd/host.c index 927c23d0d9d..847bb1d3b5f 100644 --- a/cmd/host.c +++ b/cmd/host.c @@ -46,15 +46,18 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc, char *ep; int dev; - if (argc < 2 || argc > 3) + /* Skip 'bind' */ + argc--; + argv++; + if (argc < 1 || argv > 2) return CMD_RET_USAGE; - dev_str = argv[1]; + dev_str = argv[0]; dev = simple_strtoul(dev_str, &ep, 16); if (*ep) { printf("** Bad device specification %s **\n", dev_str); return CMD_RET_USAGE; } - file = argc >= 3 ? argv[2] : NULL; + file = argc > 1 ? argv[1] : NULL; return !!host_dev_bind(dev, file); } From patchwork Mon Mar 15 05:11:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452990 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=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: 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=DOVr9Ery; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPgv6yGSz9sR4 for ; Mon, 15 Mar 2021 16:12:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 12191829E9; Mon, 15 Mar 2021 06:12:48 +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="DOVr9Ery"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A09682AA9; Mon, 15 Mar 2021 06:12: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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (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 05E5C82A71 for ; Mon, 15 Mar 2021 06:12:04 +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-pg1-x52a.google.com with SMTP id v14so12839208pgq.2 for ; Sun, 14 Mar 2021 22:12:04 -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=T5OVFq98XSnfbExUGYB/SH01lH8FtihEq+erYTsDtng=; b=DOVr9EryCeFh2sK+oNn/lA5EhqGSTZCDuii65/XMYFct2rvb99cjSUQuSPTyyz4fDd qZnfeHeROsV9MdtXmIhChNnIuBTF8cEdxQBqDbOOogTIeMdXzSvPy640fOv0czp7GELf wQnRY+gasipLuocXOJ+lmIJLrhmn6QXsdh2hs= 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=T5OVFq98XSnfbExUGYB/SH01lH8FtihEq+erYTsDtng=; b=tlh0dTRIO96s2G6Cwi7dae5U7eNGv9pblAUUuraEWT6oUb0ttEMjdA/J6+IOS42P3E 6aHhX0VrInqOfnlHPs/hzZfvdByUOW2M1ePbC6LLnEh/A+TyPrEi9VOwaiOtm/Kg1aoF u1zxdVLh03s43HqRW2cby6ebOtEA+j4dHYk7vhfD9nmgt3NstZcKSQLZFSmYxXmWfq6s A4QWi8UMr2zpdmOoLgBAFBMAG9Phyq4X2NKSSgotMxLZ9paatdwk73aMj9p4M2mUMCtl 5QjyyUqNb96ljoKS3PcFmBMFRweEFfFSnj7t0jo1AcHA3/TRZrScvyVHbu6Qb6Ta8Akg hT2g== X-Gm-Message-State: AOAM532l0kaDT1YPOb/oaAcTXFmFvm7U1pmcRpT65QCaSFFu0uNjLAjI WppTZYJ61WGq2Sxic0lqEE+lDJtt2RhDSk47 X-Google-Smtp-Source: ABdhPJzkWCCkWo/znlphrfeS9BZ+qM9dT0ceH0UlFOK1ZgLGdCnV7yPUDRE0IUTKoBdDCl03v0wfFQ== X-Received: by 2002:a62:3507:0:b029:1ed:a492:fda6 with SMTP id c7-20020a6235070000b02901eda492fda6mr8704675pfa.37.1615785122687; Sun, 14 Mar 2021 22:12:02 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:02 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH 06/19] sandbox: Provide a way to bind fixed/removeable devices Date: Mon, 15 Mar 2021 18:11:11 +1300 Message-Id: <20210315051124.1940496-5-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean At present when a file is bound to a host device it is always marked as removeable. Arguably the device is removeable, since it can be unbound at will. However while it is bound, it is not considered removable by the user. Also it is useful to be able to model both fixed and removeable devices for code that distinguishes them. Add a -r flag to the 'host bind' command and plumb it through to provide this feature. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- cmd/host.c | 19 +++++++++++++++---- doc/arch/sandbox.rst | 2 ++ drivers/block/sandbox.c | 8 ++++---- include/sandboxblockdev.h | 9 ++++++++- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/cmd/host.c b/cmd/host.c index 847bb1d3b5f..6aa3d9167a4 100644 --- a/cmd/host.c +++ b/cmd/host.c @@ -41,6 +41,7 @@ static int do_host_save(struct cmd_tbl *cmdtp, int flag, int argc, static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + bool removable = false; const char *dev_str; char *file; char *ep; @@ -49,7 +50,16 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc, /* Skip 'bind' */ argc--; argv++; - if (argc < 1 || argv > 2) + if (argc < 2) + return CMD_RET_USAGE; + + if (!strcmp(argv[0], "-r")) { + removable = true; + argc--; + argv++; + } + + if (argc > 2) return CMD_RET_USAGE; dev_str = argv[0]; dev = simple_strtoul(dev_str, &ep, 16); @@ -59,7 +69,7 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc, } file = argc > 1 ? argv[1] : NULL; - return !!host_dev_bind(dev, file); + return !!host_dev_bind(dev, file, removable); } static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc, @@ -154,7 +164,7 @@ static struct cmd_tbl cmd_host_sub[] = { U_BOOT_CMD_MKENT(ls, 3, 0, do_host_ls, "", ""), U_BOOT_CMD_MKENT(save, 6, 0, do_host_save, "", ""), U_BOOT_CMD_MKENT(size, 3, 0, do_host_size, "", ""), - U_BOOT_CMD_MKENT(bind, 3, 0, do_host_bind, "", ""), + U_BOOT_CMD_MKENT(bind, 4, 0, do_host_bind, "", ""), U_BOOT_CMD_MKENT(info, 3, 0, do_host_info, "", ""), U_BOOT_CMD_MKENT(dev, 0, 1, do_host_dev, "", ""), }; @@ -186,7 +196,8 @@ U_BOOT_CMD( "host save hostfs - [] - " "save a file to host\n" "host size hostfs - - determine size of file on host\n" - "host bind [] - bind \"host\" device to file\n" + "host bind [-r] [] - bind \"host\" device to file\n" + " -r = mark as removable\n" "host info [] - show device binding & info\n" "host dev [] - Set or retrieve the current host device\n" "host commands use the \"hostfs\" device. The \"host\" device is used\n" diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst index 1638b050002..1912cb48f61 100644 --- a/doc/arch/sandbox.rst +++ b/doc/arch/sandbox.rst @@ -389,6 +389,8 @@ the contents of the root directory on the second partion of the image =>host bind 0 ./disk.raw =>ls host 0:2 +The device can be marked removeable with 'host bind -r'. + A disk image can be created using the following commands:: $> truncate -s 1200M ./disk.raw diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index 9d7d68c007f..e419e607c04 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -89,7 +89,7 @@ static unsigned long host_block_write(struct blk_desc *block_dev, } #ifdef CONFIG_BLK -int host_dev_bind(int devnum, char *filename) +int host_dev_bind(int devnum, char *filename, bool removable) { struct host_block_dev *host_dev; struct udevice *dev; @@ -146,7 +146,7 @@ int host_dev_bind(int devnum, char *filename) } desc = blk_get_devnum_by_type(IF_TYPE_HOST, devnum); - desc->removable = 1; + desc->removable = removable; snprintf(desc->vendor, BLK_VEN_SIZE, "U-Boot"); snprintf(desc->product, BLK_PRD_SIZE, "hostfile"); snprintf(desc->revision, BLK_REV_SIZE, "1.0"); @@ -160,7 +160,7 @@ err: return ret; } #else -int host_dev_bind(int dev, char *filename) +int host_dev_bind(int dev, char *filename, bool removable) { struct host_block_dev *host_dev = find_host_device(dev); @@ -195,7 +195,7 @@ int host_dev_bind(int dev, char *filename) blk_dev->block_write = host_block_write; blk_dev->devnum = dev; blk_dev->part_type = PART_TYPE_UNKNOWN; - blk_dev->removable = 1; + blk_dev->removable = removable; snprintf(blk_dev->vendor, BLK_VEN_SIZE, "U-Boot"); snprintf(blk_dev->product, BLK_PRD_SIZE, "hostfile"); snprintf(blk_dev->revision, BLK_REV_SIZE, "1.0"); diff --git a/include/sandboxblockdev.h b/include/sandboxblockdev.h index c1f0afb337d..4006e942a02 100644 --- a/include/sandboxblockdev.h +++ b/include/sandboxblockdev.h @@ -14,6 +14,13 @@ struct host_block_dev { int fd; }; -int host_dev_bind(int dev, char *filename); +/** + * host_dev_bind() - Bind or unbind a device + * + * @dev: Device number (0=first slot) + * @filename: Host filename to use, or NULL to unbind + * @removable: true if the block device should mark itself as removable + */ +int host_dev_bind(int dev, char *filename, bool removable); #endif From patchwork Mon Mar 15 05:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452992 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=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: 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=KSBbaA4N; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPhP1fkqz9sR4 for ; Mon, 15 Mar 2021 16:13:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B56382ACA; Mon, 15 Mar 2021 06:12: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="KSBbaA4N"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D58582A7B; Mon, 15 Mar 2021 06:12: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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 9C69082A6F for ; Mon, 15 Mar 2021 06:12: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=sjg@chromium.org Received: by mail-pj1-x1036.google.com with SMTP id kr3-20020a17090b4903b02900c096fc01deso14079823pjb.4 for ; Sun, 14 Mar 2021 22:12:11 -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=r1YcxOCehSGFmS/7Zia8ydjIHFG/zQ84w4Nw1/q7R+o=; b=KSBbaA4NM3z3EZzTVAdycGnyqISb7hFK/TM2HbUjHaCdOSFBWkbzyT3237cKOK6DAn oIJEoa1TXfdcqOlkfvyVGKNN6RgZsOY4jKuIFEhmkoGFBGDjpqnjlWcMohN11xzfGBeJ x91LBpzFmAOaWQXf33GzOMRw0dRqucmOEVEig= 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=r1YcxOCehSGFmS/7Zia8ydjIHFG/zQ84w4Nw1/q7R+o=; b=DQ2GtXkFvm+/OPCTb6+egnFFcVYEQ3Y8zz3gRIX+fM9CCwx8WjUqxwOXioIvFdun+1 1W9jV6tIjyMUzO72vEoNPxOeTEkor9RBI1mDwR1bcajbnYlnylmpdyQm4xQwi7L3xuFF enPhCB4pa7/u5BiIj81Ve6m5mfa+WTtnwuTaYXyf6sLac2OprwGxyHlhfMae+FPLFquC BBif9F+ACweMT09zVp6u6NHKzpN365T+Dy94uIkTJK7yXh7jtboj9cWSK2S5mw+iSvMn 5gJT1Q/tvu9auYc+VZcisz8NBSIFRaHbgYpO4j6iUQ5frQKEybiEBGOyuky8GrE7B9fR VfdQ== X-Gm-Message-State: AOAM533k3Libr8Y4Z+BTJ+pvDpkyVFbk7HgGh0dA77sm1IYdCTl4JXh3 qxkpC+uwwUPWpdvWVxiHnilpJvxSzEbWHLlD X-Google-Smtp-Source: ABdhPJwXun4eW9g7XG6OashudUUggR9A33K5gZYl/4JlgKCpMI3Mloyq6bR8CV5C17U1ryyRuBxaxw== X-Received: by 2002:a17:90a:7a8b:: with SMTP id q11mr11060188pjf.215.1615785129843; Sun, 14 Mar 2021 22:12:09 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , AKASHI Takahiro , Alexandru Gagniuc , Andre Przywara , Atish Patra , Bin Meng , Heinrich Schuchardt , Joe Hershberger , Joel Stanley , Lihua Zhao , Marek Vasut , Masahiro Yamada , Michal Simek , Naoki Hayama , Philippe Reynes , Reuben Dowle , Robert Marko , Sebastian Reichel Subject: [PATCH 07/19] sandbox: image: Allow sandbox to load any image Date: Mon, 15 Mar 2021 18:11:12 +1300 Message-Id: <20210315051124.1940496-6-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Sandbox is special in that it is used for testing and it does not match any particular target architecture. Allow it to load an image from any architecture, so that 'bootm' can be used as needed. Signed-off-by: Simon Glass --- common/image-fit.c | 4 ++++ include/image.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/common/image-fit.c b/common/image-fit.c index 28b3d2b1911..2d0ece61815 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1512,6 +1512,10 @@ int fit_image_check_arch(const void *fit, int noffset, uint8_t arch) uint8_t image_arch; int aarch32_support = 0; + /* Let's assume that sandbox can load any architecture */ + if (IS_ENABLED(CONFIG_SANDBOX)) + return true; + if (IS_ENABLED(CONFIG_ARM64_SUPPORT_AARCH32)) aarch32_support = 1; diff --git a/include/image.h b/include/image.h index 138c83dd28d..bcd126d262d 100644 --- a/include/image.h +++ b/include/image.h @@ -886,6 +886,11 @@ static inline int image_check_type(const image_header_t *hdr, uint8_t type) } static inline int image_check_arch(const image_header_t *hdr, uint8_t arch) { +#ifndef USE_HOSTCC + /* Let's assume that sandbox can load any architecture */ + if (IS_ENABLED(CONFIG_SANDBOX)) + return true; +#endif return (image_get_arch(hdr) == arch) || (image_get_arch(hdr) == IH_ARCH_ARM && arch == IH_ARCH_ARM64); } From patchwork Mon Mar 15 05:11:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452991 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=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: 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=NkdwFZr0; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPh82X5Gz9sR4 for ; Mon, 15 Mar 2021 16:13:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A4E8482AA8; Mon, 15 Mar 2021 06:12:50 +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="NkdwFZr0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D6D882A68; Mon, 15 Mar 2021 06:12: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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) (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 02B9882A50 for ; Mon, 15 Mar 2021 06:12:14 +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-pg1-x532.google.com with SMTP id o10so19774404pgg.4 for ; Sun, 14 Mar 2021 22:12:13 -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=ugIDq0YgKKNKkDXdwdgtgGET0zuXdKiNFQ3jbTgGi3Y=; b=NkdwFZr0jkVk9zb+FYf4o3itzcvjBHNOy3/jl0pVsKpSRVwIIQE6JnmSeD334je5LW 16/J8ZaE/Y9zTEOPoNdbwhTpSJEwVYouonkftqRMiL7udi4EgkhfWZAQmNEdTrLKZbxA GI9/GPW2x6D67aUOA6jBFVKnLHx+bExeKKGXA= 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=ugIDq0YgKKNKkDXdwdgtgGET0zuXdKiNFQ3jbTgGi3Y=; b=lqSLqCc/ci9ska3xvN0vqn5+9dX31BuU3PRLOB2xYdqKuMfjS7Xy5S96nSv8LBD6Qw Gb9S1AWgWgN0Ndop50AmmAFNjmbMlpLMlehZXJ0tUbqlsLW11Ex82tgEzUO4lQyx0Os7 AgyEnFO7ym7lBOg6kQc8CTLWx9NJYG/T5u3Mw9hzlEDMkmdV4Sls8AGS7Bwudhx1s8ez VUEMZvaoRad4kYHojUlUUIbocT9X5ZVqNUfENu75WttZtKQV+0tLbefLN+cNgVMKuaKU im8aEmHP7joggEpCXNs2fEGYfJwzgQQdU1Eva+HXMg/0CMUTgNravAXb2MpX9K2aMoxt PjUA== X-Gm-Message-State: AOAM533+YAv0w/xPgzNsYOfnz69lK+d1IGaUz/uMvhAqXoiZkJu5VDGM vjDw3YYFUR/99V0hfkskBUiyGKCFigt04M2x X-Google-Smtp-Source: ABdhPJwyToGuIxUWytpBb77qudAgH2zdqTB97nZWlyPaVvABV1bIgFCxKniTJ6VN1OEyJExf7gwsFg== X-Received: by 2002:a62:441:0:b029:1ff:9781:f999 with SMTP id 62-20020a6204410000b02901ff9781f999mr8712678pfe.66.1615785132187; Sun, 14 Mar 2021 22:12:12 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:11 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH 08/19] test: Silenece the echo and print tests Date: Mon, 15 Mar 2021 18:11:13 +1300 Message-Id: <20210315181056.8.Iaab6e28290d733d1fb53f483dbad27d01feba75a@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean These tests current produce unwanted output on sandbox. Use the correct functions to controller console output, to avoid this. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/cmd/test_echo.c | 3 ++- test/lib/test_print.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/cmd/test_echo.c b/test/cmd/test_echo.c index aa5cebc4e78..9d60d7d1a0b 100644 --- a/test/cmd/test_echo.c +++ b/test/cmd/test_echo.c @@ -44,9 +44,10 @@ static int lib_test_hush_echo(struct unit_test_state *uts) int i; for (i = 0; i < ARRAY_SIZE(echo_data); ++i) { + ut_silence_console(uts); console_record_reset_enable(); ut_assertok(run_command(echo_data[i].cmd, 0)); - gd->flags &= ~GD_FLG_RECORD; + ut_unsilence_console(uts); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str(echo_data[i].expected, uts->actual_str); diff --git a/test/lib/test_print.c b/test/lib/test_print.c index 12972f1bcd6..a60a5a51f12 100644 --- a/test/lib/test_print.c +++ b/test/lib/test_print.c @@ -18,12 +18,14 @@ DECLARE_GLOBAL_DATA_PTR; static int test_print_freq(struct unit_test_state *uts, uint64_t freq, char *expected) { + ut_silence_console(uts); console_record_reset_enable(); print_freq(freq, ";\n"); - gd->flags &= ~GD_FLG_RECORD; + ut_unsilence_console(uts); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str(expected, uts->actual_str); ut_assertok(ut_check_console_end(uts)); + return 0; } @@ -46,12 +48,14 @@ LIB_TEST(lib_test_print_freq, 0); static int test_print_size(struct unit_test_state *uts, uint64_t freq, char *expected) { + ut_silence_console(uts); console_record_reset_enable(); print_size(freq, ";\n"); - gd->flags &= ~GD_FLG_RECORD; + ut_unsilence_console(uts); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str(expected, uts->actual_str); ut_assertok(ut_check_console_end(uts)); + return 0; } From patchwork Mon Mar 15 05:11:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452993 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=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: 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=LPl2+CV0; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPhg2Rdfz9sR4 for ; Mon, 15 Mar 2021 16:13:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 61C9082AD2; Mon, 15 Mar 2021 06:12:55 +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="LPl2+CV0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5C76D82A7B; Mon, 15 Mar 2021 06:12:27 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 239BA82A96 for ; Mon, 15 Mar 2021 06:12: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-pg1-x534.google.com with SMTP id n10so19765611pgl.10 for ; Sun, 14 Mar 2021 22:12:18 -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=dc0RbdudO2yhu5ccUPG4kCKrxqFkt133YofkRKqjQkM=; b=LPl2+CV0JZEa/68fwuKvoRD66NKVKfHb0XFFLHYatDVpCOQSwQAfwWr8xRi6DEfqgT 3gA7oCUH9N9lZe9Dti0utsLwKUgwXnDiCcItWifPBNgP3LuLu6nF8ecBZVKVPgpOpaLA lif5JUSyDFHcHmMrjGXkTQMwoKbcY+uzpKDNQ= 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=dc0RbdudO2yhu5ccUPG4kCKrxqFkt133YofkRKqjQkM=; b=irqM1IPCG76/jM4/9MaSEDMad/LfywP20V/Djk6c4tnE2D6MBGWcQhWrix3DKKk8/8 j3gPowTSruZqAKZivV1qz/uLJvCjkwVQpdPDP/z0+XDoV/nM3ujx67H7fjg/YQ77OgWH wQKeMR4CJ+nmTQl9MtC17iO2T8Z6LTvwbRQt9gSsjf2uDXloSPc6b8seowQ/V2voV8ir gNdbG7ozzk9nIy6I/d/vmtHHwCRxJhthw3tCHs1LlMY8H0xiXpv+L60BPt9yiV/qwD8R GH+X7sJ5P4yH4Q2vU4C+ZOLssiZTUahEe+xqMpNmm3yzOPx7P9QBkQacxrBjze1P8yGI jEgg== X-Gm-Message-State: AOAM531ZsRpo302Oowi01WJlWzN+oRbVGN7KQc6BBSmVhjEGOUFIbdDl VKmgn27H0r5k9vpmTLzaG1aZ8w9Y6PhVlcH2 X-Google-Smtp-Source: ABdhPJz08g82lkcqRmHalKroID1jPRoZ/TJ5yJ3h96/szGV5k5CtYOPGpi3bpMvwoZE9aDwMB2UKQg== X-Received: by 2002:a63:c941:: with SMTP id y1mr21446957pgg.313.1615785134799; Sun, 14 Mar 2021 22:12:14 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:14 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Michal Simek Subject: [PATCH 09/19] binman: Show a message when changing subnodes Date: Mon, 15 Mar 2021 18:11:14 +1300 Message-Id: <20210315051124.1940496-7-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean This change seems important enough to warrant a visible message. Change the log_debug() to log_info(). Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- lib/binman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/binman.c b/lib/binman.c index 6040ec89241..530df6a4b4c 100644 --- a/lib/binman.c +++ b/lib/binman.c @@ -128,8 +128,8 @@ int binman_select_subnode(const char *name) if (!ofnode_valid(node)) return log_msg_ret("node", -ENOENT); binman->image = node; - log_debug("binman: Selected image subnode '%s'\n", - ofnode_get_name(binman->image)); + log_info("binman: Selected image subnode '%s'\n", + ofnode_get_name(binman->image)); return 0; } From patchwork Mon Mar 15 05:11:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452994 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=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: 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=fFxCzfL/; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPhw02X0z9sR4 for ; Mon, 15 Mar 2021 16:13:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AA40A82A98; Mon, 15 Mar 2021 06:12: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="fFxCzfL/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0648A82AA8; Mon, 15 Mar 2021 06:12:36 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (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 DBFDE82A71 for ; Mon, 15 Mar 2021 06:12: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-pf1-x436.google.com with SMTP id x21so4521322pfa.3 for ; Sun, 14 Mar 2021 22:12:20 -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=hagdHc/AzuJPhdWhZp6/CQ94hKU576eXmTOfHxeybo0=; b=fFxCzfL/p0TF95vZL2iE+bnXBXbRsdhrUWXpS5mDytkejNbzKp2/8MFsJbPRtVChAU 2aoFUxVJEP3pFjmxEry36Fik7UM8KdhvOcw3D1UzW9L4xbbywqnS4PL4Mke2Xag1yPZD w5VzsChrD2Vtg4dZDeBSVS9ybZei9kuNXu5Nk= 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=hagdHc/AzuJPhdWhZp6/CQ94hKU576eXmTOfHxeybo0=; b=KL95RroVhZYaAviHc1SbfiGhG0kE1VJ0rT6ev2rIRZoDLWFMuLnfKXDHIMpW63N7Bi gIg+QYPEvaJLv3KxY3VC3YhqW3vd9uyhm0H1kFQ1fE45SFkkmx966PE667hAMTZ0p2il 63Sbwt2kMKLwMsHXZAYIvfgt8UmpfAl6Li/cL0my1hI2qEl+k/3YgdLf5S2I7nwdnKLv 7VPpdd+tnLYdpb9omQBgb4V3DyIUrj/WGVYJ1iBmUMabJrrvt0A86pBdr0/750EctAFK cWobadIYN47WnzRb8DA0c6EdyDpB2sGrX8yV6BZBi0ZOGNr+lNZ0U2QkbQOaaTpOMYcz z+tA== X-Gm-Message-State: AOAM532QDidcW7ZbJxKZcSe737K0RSlANBvozJvv7P0japm75oPZYWg5 Zkj2yNlOn+otIqBvXVNZYFdLVBLe+GEC8WMV X-Google-Smtp-Source: ABdhPJw5Sy1NQYV1EOpKzRhrGv+AZ1MwoZU2s61hI91t/6MKt0cJoi5A7SdrwQIALcQU+vpYwBCUoQ== X-Received: by 2002:a63:c4c:: with SMTP id 12mr13862459pgm.320.1615785139109; Sun, 14 Mar 2021 22:12:19 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heiko Stuebner , Lokesh Vutla , Masahiro Yamada , Otavio Salvador , Philipp Tomsich , Philippe Reynes , Samuel Holland , Stefan Roese Subject: [PATCH 10/19] spl: Split out bootstage ID into a function Date: Mon, 15 Mar 2021 18:11:15 +1300 Message-Id: <20210315181056.10.I86e7e8f077d643ebf62f22ac131ea8cd65293e0f@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean We have two separate places that need to figure out the bootstage ID to use. Put this code in a function so that the logic is in one place. Signed-off-by: Simon Glass --- common/spl/spl.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 5f51098a88f..556a91ab53c 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -387,6 +387,22 @@ static inline int write_spl_handoff(void) { return 0; } #endif /* HANDOFF */ +/** + * get_bootstage_id() - Get the bootstage ID to emit + * + * @start: true if this is for starting SPL, false for ending it + * @return bootstage ID to use + */ +static enum bootstage_id get_bootstage_id(bool start) +{ + enum u_boot_phase phase = spl_phase(); + + if (IS_ENABLED(CONFIG_TPL_BUILD) && phase == PHASE_TPL) + return start ? BOOTSTAGE_ID_START_TPL : BOOTSTAGE_ID_END_TPL; + else + return start ? BOOTSTAGE_ID_START_SPL : BOOTSTAGE_ID_END_SPL; +} + static int spl_common_init(bool setup_malloc) { int ret; @@ -417,8 +433,8 @@ static int spl_common_init(bool setup_malloc) __func__, ret); } #endif /* CONFIG_BOOTSTAGE_STASH */ - bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_START_TPL : - BOOTSTAGE_ID_START_SPL, SPL_TPL_NAME); + bootstage_mark_name(get_bootstage_id(true), + spl_phase_name(spl_phase())); #if CONFIG_IS_ENABLED(LOG) ret = log_init(); if (ret) { @@ -733,8 +749,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr, gd->malloc_ptr / 1024); #endif - bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_END_TPL : - BOOTSTAGE_ID_END_SPL, "end " SPL_TPL_NAME); + bootstage_mark_name(get_bootstage_id(false), "end phase"); #ifdef CONFIG_BOOTSTAGE_STASH ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR, CONFIG_BOOTSTAGE_STASH_SIZE); From patchwork Mon Mar 15 05:11:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452995 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=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: 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=VV1xVeFv; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPj72p67z9sR4 for ; Mon, 15 Mar 2021 16:14:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6527782ADD; Mon, 15 Mar 2021 06:12:59 +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="VV1xVeFv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D4B982A9B; Mon, 15 Mar 2021 06:12:34 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (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 858B182A2C for ; Mon, 15 Mar 2021 06:12: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-pf1-x434.google.com with SMTP id 16so5840110pfn.5 for ; Sun, 14 Mar 2021 22:12:23 -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=IaxnavDOAaWFYxRSpSfHoJOjHaih/Sp2aumvcm2a2u0=; b=VV1xVeFv3ls7EkkCMZHptGYO1IVsoJkYrG7v1onyA0YY5rk1vDmXkRChwhtnfE+ZRU x6Fp8+DuXqyCcG2RGOAYyKyQDF/m9VKRHYQPSvYE2i8EUv/X8qezW0HIHXrUfJXMHwdh A/GOFiBMLj+aytL2Aj91R6VIQgN/eX5Qg0zfw= 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=IaxnavDOAaWFYxRSpSfHoJOjHaih/Sp2aumvcm2a2u0=; b=W6CsIdL0cmZNXrf0KOlxFAJNHWGEW4RAG/xyqr8VlcfZ2DO0SVfQ36aD/mMlOFUsUy IG0UtpDUP24bvKwYfZQNhiKLIZQiPJZLYJ+JgNCWBzpx1COOA4jdlTvh8TofbyC3+4cu liEVTvxHCQWxXKCZcmOLHU3eHZgRwX4jtHFQ5eyXxIF0gPmsYiuqklHTcwFkUX8pH5d9 MQXhs/bz8kg3XCRV1N3fKbywDfK74LCMG166w+TKsGM+rvH+c8SmrNFP6ETzlcN3u+V/ oqtn0Rh1hF+Jd29vY5Mh+lDddzB29GWiP20EsS7YZFtL67kiktck8am7SdDvfjXafi6R tSwA== X-Gm-Message-State: AOAM533ZSKpakoKzxw34bt8diCdyZsrS8xt4Nukg2dMug+jgqs9sa9Ck WpYnfR8kvEnu+PfuO9ejW8cYb1dTJ8Hg9f2B X-Google-Smtp-Source: ABdhPJyQnimodcMFLUlneKbxTQbKIZOvfrLDxA7hYW3D1exTBp+upmTYgJliAKeEjfzcRHuFvZIdJQ== X-Received: by 2002:a63:5416:: with SMTP id i22mr22200489pgb.43.1615785141151; Sun, 14 Mar 2021 22:12:21 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 11/19] bootstage: Warning if space is exhausted Date: Mon, 15 Mar 2021 18:11:16 +1300 Message-Id: <20210315181056.11.I0b88d9a68e66c2b2f6fdc3ac8e630a386a118a8e@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean At present bootstage silently ignores new records if it runs out of space. It is sometimes obvious by looking at the report, but the IDs are not contiguous, so it is easy to miss. Aad a message so that action can be taken. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- common/bootstage.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/common/bootstage.c b/common/bootstage.c index d5b78b9f487..0dc619e5da7 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -9,6 +9,8 @@ * permits accurate timestamping of each. */ +#define LOG_CATEGORY LOGC_BOOT + #include #include #include @@ -127,12 +129,16 @@ ulong bootstage_add_record(enum bootstage_id id, const char *name, /* Only record the first event for each */ rec = find_id(data, id); - if (!rec && data->rec_count < RECORD_COUNT) { - rec = &data->record[data->rec_count++]; - rec->time_us = mark; - rec->name = name; - rec->flags = flags; - rec->id = id; + if (!rec) { + if (data->rec_count < RECORD_COUNT) { + rec = &data->record[data->rec_count++]; + rec->time_us = mark; + rec->name = name; + rec->flags = flags; + rec->id = id; + } else { + log_warning("Bootstage space exhasuted\n"); + } } /* Tell the board about this progress */ From patchwork Mon Mar 15 05:11:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452996 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=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: 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=Hw6Etjnv; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPjN11lfz9sR4 for ; Mon, 15 Mar 2021 16:14:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39CE682AE5; Mon, 15 Mar 2021 06:13:02 +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="Hw6Etjnv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2562082A9B; Mon, 15 Mar 2021 06:12:44 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 D493D829D4 for ; Mon, 15 Mar 2021 06:12:25 +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-pj1-x102f.google.com with SMTP id gb6so8137909pjb.0 for ; Sun, 14 Mar 2021 22:12:25 -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=RfrIeMkhpQOck/bAYsBw+xAJEtfVm+KPCEM0W7nJxrc=; b=Hw6Etjnv3NyUFzb2hLSyvAzBUQTs6T8Q8KkB4rPrf4j7eJpgLlMleziMRIgl63pZqJ AwzZXbHZWAmGcbxpor7LdlC8XY+LFIA4omZXfkfhr/exPd//+41GiMUYVdp/qZtKD54Z JBrE91y+RNxdNinTPmW6lbIO/qc67Gw9s8ELw= 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=RfrIeMkhpQOck/bAYsBw+xAJEtfVm+KPCEM0W7nJxrc=; b=Go9JAPPgCxndCOgkzaHlKBwmzVO7tBAhrYawV1QVfoMfI6cf26eYwvmcBStPYgBkHi /5rifIxxc1aeaVB1gpStc7Eyi1X4V5061gP6y2zrruqxjTWNk4p8P/5ew6J8YBSckuAd JWJc1yoozyJ4ekuoYE1qSbDri0iz1XLceiRh3wm0iHP32Gj9MI4g16vAEDglOH+P2hxl AWhwhFEKwE9mFEDHd8OmoEBjxpELpkG313we/PGGoDLkKHjnZ8COMjeZ+y2ulg423hhp ZuwHpqaQ360/MqvkgmjL8/K5/qRsuCdCTCBm5ueIrOs+mS5JhJXZ/Wk7HDePiYcovAP5 pX7Q== X-Gm-Message-State: AOAM5312BAiXv8VR4QOQaZlZ1Dbh7CCkAK/lrEBriuoPh+KRhhjXdij4 9hZ+vldDL+bGz43v0QYv9nU++cZNqYIl663F X-Google-Smtp-Source: ABdhPJx1TRn8kcM/ZRINBz4MjdbFT0oSf01yi8gxWa3G5c5E0nc6y9plvmzeGHP/dEHUdCCAYE1a3w== X-Received: by 2002:a17:90a:be0e:: with SMTP id a14mr10424464pjs.131.1615785144078; Sun, 14 Mar 2021 22:12:24 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Jagan Teki , Mike Frysinger , Vignesh R Subject: [PATCH 12/19] sf: Support querying write-protect Date: Mon, 15 Mar 2021 18:11:17 +1300 Message-Id: <20210315181056.12.I145e35c98b7629f46b20ab96e5a950ebd94689f3@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean This feature was dropped from U-Boot some time ago: f12f96cfaf5 (sf: Drop spl_flash_get_sw_write_prot") However, we do need a way to see if a flash device is write-protected, since if it is, it may not be possible to write to do (i.e. failing to write is expected). I am not sure of the correct layer to implement this, so this patch is a stab at it. If spi-flash makes sense then I will add to the 'sf' also. Re the points mentioned in the removal commit: 1) This kind of requirement can be achieved using existing flash operations and flash locking API calls instead of making a separate flash API. Which uclass is this? 2) Technically there is no real hardware user for this API to use in the source tree. I do want coral (at least) to support this. 3) Having a flash operations API for simple register read bits also make difficult to extend the flash operations. This new patch only mentions write-protect being on or off, rather than the actual mechanism. 4) Instead of touching generic code, it is possible to have this functionality inside spinor operations in the form of flash hooks or fixups for associated flash chips. That sounds to me like what drivers are for. But we still need some sort of API for it to be accessible. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/mtd/spi/sf-uclass.c | 9 +++++++++ drivers/mtd/spi/sf_internal.h | 4 ++++ drivers/mtd/spi/sf_probe.c | 8 ++++++++ drivers/mtd/spi/spi-nor-core.c | 11 +++++++++++ drivers/mtd/spi/spi-nor-tiny.c | 6 ++++++ include/spi_flash.h | 27 +++++++++++++++++++++++++++ test/dm/sf.c | 10 +++++++++- 7 files changed, 74 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index 12d132152d3..980ac18ee96 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -31,6 +31,15 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len) return log_ret(sf_get_ops(dev)->erase(dev, offset, len)); } +int spl_flash_get_sw_write_prot(struct udevice *dev) +{ + struct dm_spi_flash_ops *ops = sf_get_ops(dev); + + if (!ops->get_sw_write_prot) + return -ENOSYS; + return log_ret(ops->get_sw_write_prot(dev)); +} + /* * TODO(sjg@chromium.org): This is an old-style function. We should remove * it when all SPI flash drivers use dm diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 9ceff0e7c12..786301ba4a9 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -75,6 +75,10 @@ extern const struct flash_info spi_nor_ids[]; #define JEDEC_MFR(info) ((info)->id[0]) #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2])) +/* Get software write-protect value (BP bits) */ +int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash); + + #if CONFIG_IS_ENABLED(SPI_FLASH_MTD) int spi_flash_mtd_register(struct spi_flash *flash); void spi_flash_mtd_unregister(void); diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 6c874348676..3befbe91cac 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -130,6 +130,13 @@ static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len) return mtd->_erase(mtd, &instr); } +static int spi_flash_std_get_sw_write_prot(struct udevice *dev) +{ + struct spi_flash *flash = dev_get_uclass_priv(dev); + + return spi_flash_cmd_get_sw_write_prot(flash); +} + int spi_flash_std_probe(struct udevice *dev) { struct spi_slave *slave = dev_get_parent_priv(dev); @@ -153,6 +160,7 @@ static const struct dm_spi_flash_ops spi_flash_std_ops = { .read = spi_flash_std_read, .write = spi_flash_std_write, .erase = spi_flash_std_erase, + .get_sw_write_prot = spi_flash_std_get_sw_write_prot, }; static const struct udevice_id spi_flash_std_ids[] = { diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index ef426dac02b..55cca609028 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -2644,3 +2644,14 @@ int spi_nor_scan(struct spi_nor *nor) return 0; } + +/* U-Boot specific functions, need to extend MTD to support these */ +int spi_flash_cmd_get_sw_write_prot(struct spi_nor *nor) +{ + int sr = read_sr(nor); + + if (sr < 0) + return sr; + + return (sr >> 2) & 7; +} diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index 07c8c7b82b1..1d5861d55cd 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -809,3 +809,9 @@ int spi_nor_scan(struct spi_nor *nor) return 0; } + +/* U-Boot specific functions, need to extend MTD to support these */ +int spi_flash_cmd_get_sw_write_prot(struct spi_nor *nor) +{ + return -ENOTSUPP; +} diff --git a/include/spi_flash.h b/include/spi_flash.h index 85cae32cc73..d1c073ac1fc 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -35,6 +35,19 @@ struct dm_spi_flash_ops { int (*write)(struct udevice *dev, u32 offset, size_t len, const void *buf); int (*erase)(struct udevice *dev, u32 offset, size_t len); + /** + * get_sw_write_prot() - Check state of software write-protect feature + * + * SPI flash chips can lock a region of the flash defined by a + * 'protected area'. This function checks if this protected area is + * defined. + * + * @dev: SPI flash device + * @return 0 if no region is write-protected, 1 if a region is + * write-protected, -ENOSYS if the driver does not implement this, + * other -ve value on error + */ + int (*get_sw_write_prot)(struct udevice *dev); }; /* Access the serial operations for a device */ @@ -76,6 +89,20 @@ int spi_flash_write_dm(struct udevice *dev, u32 offset, size_t len, */ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len); +/** + * spl_flash_get_sw_write_prot() - Check state of software write-protect feature + * + * SPI flash chips can lock a region of the flash defined by a + * 'protected area'. This function checks if this protected area is + * defined. + * + * @dev: SPI flash device + * @return 0 if no region is write-protected, 1 if a region is + * write-protected, -ENOSYS if the driver does not implement this, + * other -ve value on error + */ +int spl_flash_get_sw_write_prot(struct udevice *dev); + /** * spi_flash_std_probe() - Probe a SPI flash device * diff --git a/test/dm/sf.c b/test/dm/sf.c index cc1fc4d69af..17d43fef3bc 100644 --- a/test/dm/sf.c +++ b/test/dm/sf.c @@ -21,7 +21,7 @@ /* Simple test of sandbox SPI flash */ static int dm_test_spi_flash(struct unit_test_state *uts) { - struct udevice *dev; + struct udevice *dev, *emul; int full_size = 0x200000; int size = 0x10000; u8 *src, *dst; @@ -51,6 +51,14 @@ static int dm_test_spi_flash(struct unit_test_state *uts) ut_assertok(spi_flash_read_dm(dev, 0, size, dst)); ut_asserteq_mem(src, dst, size); + /* Try the write-protect stuff */ + ut_assertok(uclass_first_device_err(UCLASS_SPI_EMUL, &emul)); + ut_asserteq(0, spl_flash_get_sw_write_prot(dev)); + sandbox_sf_set_block_protect(emul, 1); + ut_asserteq(1, spl_flash_get_sw_write_prot(dev)); + sandbox_sf_set_block_protect(emul, 0); + ut_asserteq(0, spl_flash_get_sw_write_prot(dev)); + /* Check mapping */ ut_assertok(dm_spi_get_mmap(dev, &map_base, &map_size, &offset)); ut_asserteq(0x1000, map_base); From patchwork Mon Mar 15 05:11:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452997 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=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: 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=QlYOJMlu; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPjZ2s8Gz9sVm for ; Mon, 15 Mar 2021 16:14:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E34FF82A7A; Mon, 15 Mar 2021 06:13: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="QlYOJMlu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BB2A82AA8; Mon, 15 Mar 2021 06:12:48 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (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 71DE982A8C for ; Mon, 15 Mar 2021 06:12:34 +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-pj1-x102c.google.com with SMTP id lr10-20020a17090b4b8ab02900dd61b95c5eso11448872pjb.4 for ; Sun, 14 Mar 2021 22:12:34 -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=J+eaXkokbzmbI0Dk26A/u0WxJQfBwIGi6tjGOZBJsl0=; b=QlYOJMlu8OviuezNxa5OKnoRTGOAyDFPNTOcfhBjwioIpO1iRIUD6aW7+TqRPBmbJs rQ+JNbI4VsBVnJaw4iDcHJgOQqGl52bx4EO7CzS9m8XhRDPHVWNayoz4D2ZsKMW9MGIz egOwshaLGU1YMbDCXAKGKiLR3C2bxNJoVjRVQ= 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=J+eaXkokbzmbI0Dk26A/u0WxJQfBwIGi6tjGOZBJsl0=; b=hINsguuN5cU4vzF9wIxFTBrF8Z4NddkPpVfQ+RhM/vMpdAT9aTk/uRgl3g8nXpy9uM tvUyT/VknIToLYgEhRB2FbM1Up025QcCFfMkjsGgt/+q6RMOurE4WXmQAmRycqNmSkba G9Q8o/+87dl+lSaQXO8p+cGagjYQi1cTQ1egXXcSg5w4g/4pnk+6oZMfWPB5jZKxzvjK S1FXajId8IN+zMMniSLBASU2O84LuEx6D0tYSzBFc9SmctNiLa0wsaAQ3Evjoj0ruTCi +d/+a/mgSkso6qU3XjP8xhY3qXO+ZRagYaFmUkOgMLdyq/RuItK59tyk5UuEpYzwWB99 KKjQ== X-Gm-Message-State: AOAM531JdlSFQMYXrftsXEBZ+6k+N6e2i8oTLYjmV6+X15sV1wuukK3A rnO/9/AcgqkNL9TuwcnT6W0PjvyjQAtkEHkF X-Google-Smtp-Source: ABdhPJwHYMOi/Te7rfbz3DhhYyG82fibNVVYruAi5bFBoUS0mnLQa0veK+lQa6S0Y+ymJ99o9bp7XQ== X-Received: by 2002:a17:90a:7f92:: with SMTP id m18mr8817087pjl.156.1615785152334; Sun, 14 Mar 2021 22:12:32 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Adam Ford , Anastasiia Lukianenko , Andre Przywara , Andy Shevchenko , Bin Meng , Claudiu Beznea , Harald Seiler , Jagan Teki , Jean-Jacques Hiblot , Joel Johnson , Lukasz Majewski , Michael Walle , Michal Simek , Oleksandr Andrushchenko , Ovidiu Panait , Philippe Reynes , Pragnesh Patel , Reuben Dowle , Rick Chen , Samuel Holland , Sean Anderson Subject: [PATCH 13/19] cpu: Rename SPL_CPU_SUPPORT to SPL_CPU Date: Mon, 15 Mar 2021 18:11:18 +1300 Message-Id: <20210315181056.13.I9d3cb0d0f501004d3e64e367802f13f62951d70e@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean The _SUPPORT suffix is from an earlier time and interferes with use of the CONFIG_IS_ENABLED() macro. Rename the option to drop the suffix. Tidy up the TODO that prompted this. Signed-off-by: Simon Glass --- arch/riscv/cpu/ax25/Kconfig | 2 +- arch/riscv/cpu/fu540/Kconfig | 2 +- arch/riscv/cpu/generic/Kconfig | 2 +- arch/x86/lib/spl.c | 2 +- common/spl/Kconfig | 2 +- configs/chromebook_coral_defconfig | 2 +- configs/chromebook_link64_defconfig | 2 +- configs/qemu-x86_64_defconfig | 2 +- drivers/Makefile | 2 +- drivers/timer/timer-uclass.c | 6 +----- 10 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/riscv/cpu/ax25/Kconfig b/arch/riscv/cpu/ax25/Kconfig index 327b74e20a0..941d963ece4 100644 --- a/arch/riscv/cpu/ax25/Kconfig +++ b/arch/riscv/cpu/ax25/Kconfig @@ -6,7 +6,7 @@ config RISCV_NDS imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) imply ANDES_PLIC if (RISCV_MMODE || SPL_RISCV_MMODE) imply ANDES_PLMT_TIMER if (RISCV_MMODE || SPL_RISCV_MMODE) - imply SPL_CPU_SUPPORT + imply SPL_CPU imply SPL_OPENSBI imply SPL_LOAD_FIT help diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig index 61bd5c426ed..616b25650f0 100644 --- a/arch/riscv/cpu/fu540/Kconfig +++ b/arch/riscv/cpu/fu540/Kconfig @@ -13,7 +13,7 @@ config SIFIVE_FU540 imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) imply SIFIVE_CLINT if (RISCV_MMODE || SPL_RISCV_MMODE) imply CMD_CPU - imply SPL_CPU_SUPPORT + imply SPL_CPU imply SPL_OPENSBI imply SPL_LOAD_FIT imply SMP diff --git a/arch/riscv/cpu/generic/Kconfig b/arch/riscv/cpu/generic/Kconfig index f4c2e2643c9..198e36e969b 100644 --- a/arch/riscv/cpu/generic/Kconfig +++ b/arch/riscv/cpu/generic/Kconfig @@ -10,6 +10,6 @@ config GENERIC_RISCV imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) imply SIFIVE_CLINT if (RISCV_MMODE || SPL_RISCV_MMODE) imply CMD_CPU - imply SPL_CPU_SUPPORT + imply SPL_CPU imply SPL_OPENSBI imply SPL_LOAD_FIT diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c index 1bae1f4f321..b18c1cd6092 100644 --- a/arch/x86/lib/spl.c +++ b/arch/x86/lib/spl.c @@ -96,7 +96,7 @@ static int x86_spl_init(void) } #endif preloader_console_init(); -#ifndef CONFIG_TPL +#if !defined(CONFIG_TPL) && !CONFIG_IS_ENABLED(CPU) ret = print_cpuinfo(); if (ret) { debug("%s: print_cpuinfo() failed\n", __func__); diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 774541c02bc..2bd02210bab 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -487,7 +487,7 @@ config SPL_CACHE_SUPPORT future requests for that data can be served faster. Enable this option to build the drivers in drivers/cache as part of an SPL build. -config SPL_CPU_SUPPORT +config SPL_CPU bool "Support CPU drivers" help Enable this to support CPU drivers in SPL. These drivers can set diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig index ab73a0a88ce..a8be3498cfb 100644 --- a/configs/chromebook_coral_defconfig +++ b/configs/chromebook_coral_defconfig @@ -42,7 +42,7 @@ CONFIG_BLOBLIST_ADDR=0x100000 CONFIG_HANDOFF=y CONFIG_TPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SEPARATE_BSS=y -CONFIG_SPL_CPU_SUPPORT=y +CONFIG_SPL_CPU=y CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_PCI=y # CONFIG_SPL_SPI_FLASH_TINY is not set diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig index 8f56ee3476d..872e33d7571 100644 --- a/configs/chromebook_link64_defconfig +++ b/configs/chromebook_link64_defconfig @@ -31,7 +31,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y -CONFIG_SPL_CPU_SUPPORT=y +CONFIG_SPL_CPU=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_SPI_FLASH=y diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index 99a489cab42..4815d8af4e6 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -31,7 +31,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y -CONFIG_SPL_CPU_SUPPORT=y +CONFIG_SPL_CPU=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_NET_SUPPORT=y diff --git a/drivers/Makefile b/drivers/Makefile index c562a719f74..3510daba29f 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -38,7 +38,7 @@ ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_BOOTCOUNT_LIMIT) += bootcount/ obj-$(CONFIG_SPL_CACHE_SUPPORT) += cache/ -obj-$(CONFIG_SPL_CPU_SUPPORT) += cpu/ +obj-$(CONFIG_SPL_CPU) += cpu/ obj-$(CONFIG_SPL_CRYPTO_SUPPORT) += crypto/ obj-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/ obj-$(CONFIG_ARMADA_38X) += ddr/marvell/a38x/ diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 6f00a5d0dba..73b4a5cd27f 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -83,11 +83,7 @@ static int timer_post_probe(struct udevice *dev) return 0; } -/* - * TODO: should be CONFIG_IS_ENABLED(CPU), but the SPL config has _SUPPORT on - * the end... - */ -#if defined(CONFIG_CPU) || defined(CONFIG_SPL_CPU_SUPPORT) +#if CONFIG_IS_ENABLED(CPU) int timer_timebase_fallback(struct udevice *dev) { struct udevice *cpu; From patchwork Mon Mar 15 05:11:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452998 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=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: 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=njtatN+x; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPjm23Lmz9sR4 for ; Mon, 15 Mar 2021 16:14:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B0C9F82AF9; Mon, 15 Mar 2021 06:13:14 +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="njtatN+x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A66F182AA7; Mon, 15 Mar 2021 06:12:48 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (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 6732782A71 for ; Mon, 15 Mar 2021 06:12:36 +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-pj1-x1035.google.com with SMTP id kr3-20020a17090b4903b02900c096fc01deso14080287pjb.4 for ; Sun, 14 Mar 2021 22:12:36 -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=BgM3GPEm7k6chwJNJRK64KWqEXK5SKItk1d0k57GhoQ=; b=njtatN+x8rs1RI3yXmJTfumJf0ts3kCfwT6A3RSwknmE00mEFQqVaeQYAYdvT6qqr1 W8jsTWo3iY1A1aMUiwqlIP6+MSqq/bu7AEYBSd4K7F5adRgGYVBQq1x84fAl11XwDxam S8jg3SwdOYSFZ9mZVYe6Q+oWwk2YD/WwfgSF4= 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=BgM3GPEm7k6chwJNJRK64KWqEXK5SKItk1d0k57GhoQ=; b=kKqy5LNsDFzJuTz+kHgRRWmPJ+k/y+yn2qRaKhFssEWlKDNe/tWXVA4Nz4DYxJ+qlL X3o7Ybicj00O2v3kKyMCcbu2WnjDuqLeVncbTz42kRWgmc68ubu2v4iIzabD7EBKLvSz PbSzSTSENn873pQPmd7QjaW++fQBgmiP0nXpYnf73FrEudMnxTb/5uEW2akasx3R7o4/ wn6j9ERWHb2drKmCyMijfdT3fN931F6c7fQsl9nHMyX53bmZOQt4DujqK32GzUR9A66c TpAJ4zt1gGAYVHdxRWj+3cuOMFJX5ROsC349hLdyjLbvXJpKDgSt9KuaCHZPWtaBdwuH 0MFQ== X-Gm-Message-State: AOAM533/xH7CHTTjNH0lt0rKLi+xaG0eDRggzcpM9/vEfSimN3PXT8ny oVyzwbPmQSLUWOeZDUr7X82bqjeldsDKUmip X-Google-Smtp-Source: ABdhPJznjKGdnR473mv1zd8xQU6yEjWGxdXMV04aksOOgiysdS3abX9s5UcBjSDmGbWrdaPGjXNemA== X-Received: by 2002:a17:90a:f286:: with SMTP id fs6mr11014703pjb.183.1615785154657; Sun, 14 Mar 2021 22:12:34 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH 14/19] malloc: Export malloc_simple_info() Date: Mon, 15 Mar 2021 18:11:19 +1300 Message-Id: <20210315051124.1940496-8-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Export this function always so it can be used behind IS_ENABLED() instead of requiring an #ifdef. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/malloc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/malloc.h b/include/malloc.h index e15e528a2e3..024b18be00e 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -880,6 +880,8 @@ extern Void_t* sbrk(); #else +void malloc_simple_info(void); + #if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE) #define malloc malloc_simple #define realloc realloc_simple @@ -887,7 +889,6 @@ extern Void_t* sbrk(); static inline void free(void *ptr) {} void *calloc(size_t nmemb, size_t size); void *realloc_simple(void *ptr, size_t size); -void malloc_simple_info(void); #else # ifdef USE_DL_PREFIX From patchwork Mon Mar 15 05:11:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1453000 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=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: 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=DN0jumEq; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPkB4dZqz9sR4 for ; Mon, 15 Mar 2021 16:14:58 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3213482A9B; Mon, 15 Mar 2021 06:13: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=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="DN0jumEq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5E28982A98; Mon, 15 Mar 2021 06:12:54 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (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 B7EDA82A98 for ; Mon, 15 Mar 2021 06:12:40 +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-pf1-x434.google.com with SMTP id y67so5842760pfb.2 for ; Sun, 14 Mar 2021 22:12:40 -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=hdMndUmisKaecOkvn6eESIB9toxdvQ2AoVXzK9QVrR0=; b=DN0jumEqt6sEfizpURCioab5Re54nk9kYmP93A4nP+ctkm0WYe0uV5xFI1HX416/Is jAspsPJTGcD2YabxKAd+k5TnS9e/3Qk8rE3M6cZdQ6FDUYBdJSP7ZEwdemnBiC37uY/F zaOjjLZocAI2iVzN2enOAb/0fcnd/Oibkl4k8= 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=hdMndUmisKaecOkvn6eESIB9toxdvQ2AoVXzK9QVrR0=; b=Fi2OL+islDP53nnGKO1LJvmoPTZPxJ6+Z/zFZpZ0iks+8/nAi4vbQMNu9GAs5WKotu zI2KaopA5TR2MTFAF9UvnPFn0SUVELUV9N4vNXVjyscZB70nvWj368EG4XHm85WPBv8B Vkugq3wDXnt2hQvcm7Ars7IEjFST4VGv9cVhKFGdZWhHswfPuP7GH2ttIxuVWic6yHTu JgSDBRVJCQSCvj6AuOy2dXkgtrD6BydhtmTn3Ul8s/wOuLZSbkp+b+i5vKWHo3bbrath MuFBOuDVk2KM1IG/KLoCYfIKxOr+Dwukj0TTtmAdnQDTyI+ARRV78mTLvoEM+kQZzzGB 3DZg== X-Gm-Message-State: AOAM530OyBv2MFxN/OJ/whR3W1jRMMitFf/3pwYrQXkGX6H5jI3eZ2JV ds7f7Ad9DfnRufPssXmJCcmgeJkFyr+2+0NT X-Google-Smtp-Source: ABdhPJzv6j1cEkdVKbykh2o+x3sxknpDupk7WV6xmJmbnhHNrwvMviQjafpcYZzPCuQBbEZydJgqPw== X-Received: by 2002:a63:4e48:: with SMTP id o8mr2830502pgl.420.1615785158370; Sun, 14 Mar 2021 22:12:38 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= , Heinrich Schuchardt , Ilias Apalodimas , Wolfgang Wallner Subject: [PATCH 15/19] doc: Convert Chromium OS docs to rst Date: Mon, 15 Mar 2021 18:11:20 +1300 Message-Id: <20210315051124.1940496-9-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Move this documentation over to reST. Move the example files into a files/ directory so they are still separate. Do a few minor updates while we are here: - Tidy up sandbox build instructions - Update my github account name - Add some talks and links Signed-off-by: Simon Glass --- .../chainload.rst} | 80 ++++++++++------ doc/chromium/{ => files}/chromebook_jerry.its | 0 .../{ => files}/devkeys/kernel.keyblock | Bin .../devkeys/kernel_data_key.vbprivk | Bin doc/chromium/{ => files}/nyan-big.its | 0 doc/chromium/index.rst | 14 +++ doc/chromium/overview.rst | 74 ++++++++++++++ .../run_vboot.rst} | 90 ++++++++---------- doc/index.rst | 8 ++ 9 files changed, 183 insertions(+), 83 deletions(-) rename doc/{README.chromium-chainload => chromium/chainload.rst} (79%) rename doc/chromium/{ => files}/chromebook_jerry.its (100%) rename doc/chromium/{ => files}/devkeys/kernel.keyblock (100%) rename doc/chromium/{ => files}/devkeys/kernel_data_key.vbprivk (100%) rename doc/chromium/{ => files}/nyan-big.its (100%) create mode 100644 doc/chromium/index.rst create mode 100644 doc/chromium/overview.rst rename doc/{README.chromium => chromium/run_vboot.rst} (68%) diff --git a/doc/README.chromium-chainload b/doc/chromium/chainload.rst similarity index 79% rename from doc/README.chromium-chainload rename to doc/chromium/chainload.rst index 45eaeced2da..7b6bb10d36d 100644 --- a/doc/README.chromium-chainload +++ b/doc/chromium/chainload.rst @@ -1,3 +1,6 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2020 Google LLC + Running U-Boot from coreboot on Chromebooks =========================================== @@ -15,7 +18,7 @@ replace the ROM unless you have a servo board and cable to restore it with. For all of these the standard U-Boot build instructions apply. For example on -ARM: +ARM:: sudo apt install gcc-arm-linux-gnueabi mkdir b @@ -37,14 +40,17 @@ https://www.chromium.org/chromium-os/firmware-porting-guide/using-nv-u-boot-on-t Nyan-big -------- -Compiled based on information here: -https://lists.denx.de/pipermail/u-boot/2015-March/209530.html -https://git.collabora.com/cgit/user/tomeu/u-boot.git/commit/?h=nyan-big -https://lists.denx.de/pipermail/u-boot/2017-May/289491.html -https://github.com/chromeos-nvidia-androidtv/gnu-linux-on-acer-chromebook-13#copy-data-to-the-sd-card +Compiled based on information here:: + + https://lists.denx.de/pipermail/u-boot/2015-March/209530.html + https://git.collabora.com/cgit/user/tomeu/u-boot.git/commit/?h=nyan-big + https://lists.denx.de/pipermail/u-boot/2017-May/289491.html + https://github.com/chromeos-nvidia-androidtv/gnu-linux-on-acer-chromebook-13#copy-data-to-the-sd-card 1. Build U-Boot +Steps:: + mkdir b make -j8 O=b/nyan-big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all @@ -61,16 +67,21 @@ kernel, and crashes if it is not present. 3. Build and sign an image - ./b/nyan-big/tools/mkimage -f doc/chromium/nyan-big.its u-boot-chromium.fit +Steps:: + + ./b/nyan-big/tools/mkimage -f doc/chromium/files/nyan-big.its u-boot-chromium.fit echo test >dummy.txt - vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \ - --signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \ - --version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \ - --bootloader dummy.txt --pack u-boot.kpart + vbutil_kernel --arch arm \ + --keyblock doc/chromium/files/devkeys/kernel.keyblock \ + --signprivate doc/chromium/files/devkeys/kernel_data_key.vbprivk \ + --version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \ + --bootloader dummy.txt --pack u-boot.kpart 4. Prepare an SD card +Steps:: + DISK=/dev/sdc # Replace with your actual SD card device sudo cgpt create $DISK sudo cgpt add -b 34 -s 32768 -P 1 -S 1 -t kernel $DISK @@ -80,6 +91,8 @@ kernel, and crashes if it is not present. 5. Write U-Boot to the SD card +Steps:: + sudo dd if=u-boot.kpart of=/dev/sdc1; sync @@ -90,7 +103,7 @@ do this, login as root (via Ctrl-Alt-forward_arrow) and type 'enable_dev_usb_boot'. You only need to do this once. Reboot the device with the SD card inserted. Press Clrl-U at the developer -mode screen. It should show something like the following on the display: +mode screen. It should show something like the following on the display:: U-Boot 2017.07-00637-g242eb42-dirty (May 22 2017 - 06:14:21 -0600) @@ -104,9 +117,9 @@ mode screen. It should show something like the following on the display: 7. Known problems -On the serial console the word MMC is chopped at the start of the line: +On the serial console the word MMC is chopped at the start of the line:: -C: sdhci@700b0000: 2, sdhci@700b0400: 1, sdhci@700b0600: 0 + C: sdhci@700b0000: 2, sdhci@700b0400: 1, sdhci@700b0600: 0 This is likely due to some problem with change-over of the serial driver during relocation (or perhaps updating the clock setup in board_init()). @@ -116,7 +129,7 @@ during relocation (or perhaps updating the clock setup in board_init()). To check that you copied the u-boot.its file correctly, use these commands. You should see that the data at 0x100 in u-boot-chromium.fit is the first few -bytes of U-Boot: +bytes of U-Boot:: hd u-boot-chromium.fit |head -20 ... @@ -141,34 +154,39 @@ The instruction are similar to those for Nyan with changes as noted below: Open include/configs/rk3288_common.h -Change: +Change:: -#define CONFIG_SYS_TEXT_BASE 0x00100000 + #define CONFIG_SYS_TEXT_BASE 0x00100000 -to: +to:: -#define CONFIG_SYS_TEXT_BASE 0x02000100 + #define CONFIG_SYS_TEXT_BASE 0x02000100 2. Build U-Boot +Steps:: + mkdir b make -j8 O=b/chromebook_jerry CROSS_COMPILE=arm-linux-gnueabi- \ - chromebook_jerry_defconfig all + chromebook_jerry_defconfig all 3. See above 4. Build and sign an image +Steps:: + ./b/chromebook_jerry/tools/mkimage -f doc/chromium/chromebook_jerry.its \ - u-boot-chromium.fit + u-boot-chromium.fit echo test >dummy.txt - vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \ - --signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \ - --version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \ - --bootloader dummy.txt --pack u-boot.kpart + vbutil_kernel --arch arm \ + --keyblock doc/chromium/files/devkeys/kernel.keyblock \ + --signprivate doc/chromium/files/devkeys/kernel_data_key.vbprivk \ + --version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \ + --bootloader dummy.txt --pack u-boot.kpart 5. See above @@ -182,7 +200,7 @@ do this, login as root (via Ctrl-Alt-forward_arrow) and type 'enable_dev_usb_boot'. You only need to do this once. Reboot the device with the SD card inserted. Press Clrl-U at the developer -mode screen. It should show something like the following on the display: +mode screen. It should show something like the following on the display:: U-Boot 2017.05-00649-g72acdbf-dirty (May 29 2017 - 14:57:05 -0600) @@ -203,18 +221,18 @@ None as yet. Other notes -=========== +----------- flashrom --------- +~~~~~~~~ - Used to make a backup of your firmware, or to replace it. +Used to make a backup of your firmware, or to replace it. - See: https://www.chromium.org/chromium-os/packages/cros-flashrom +See: https://www.chromium.org/chromium-os/packages/cros-flashrom coreboot --------- +~~~~~~~~ Coreboot itself is not designed to actually boot an OS. Instead, a program called Depthcharge is used. This originally came out of U-Boot and was then diff --git a/doc/chromium/chromebook_jerry.its b/doc/chromium/files/chromebook_jerry.its similarity index 100% rename from doc/chromium/chromebook_jerry.its rename to doc/chromium/files/chromebook_jerry.its diff --git a/doc/chromium/devkeys/kernel.keyblock b/doc/chromium/files/devkeys/kernel.keyblock similarity index 100% rename from doc/chromium/devkeys/kernel.keyblock rename to doc/chromium/files/devkeys/kernel.keyblock diff --git a/doc/chromium/devkeys/kernel_data_key.vbprivk b/doc/chromium/files/devkeys/kernel_data_key.vbprivk similarity index 100% rename from doc/chromium/devkeys/kernel_data_key.vbprivk rename to doc/chromium/files/devkeys/kernel_data_key.vbprivk diff --git a/doc/chromium/nyan-big.its b/doc/chromium/files/nyan-big.its similarity index 100% rename from doc/chromium/nyan-big.its rename to doc/chromium/files/nyan-big.its diff --git a/doc/chromium/index.rst b/doc/chromium/index.rst new file mode 100644 index 00000000000..0722c250033 --- /dev/null +++ b/doc/chromium/index.rst @@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2020 Google LLC + +Chromium OS-specific doc +======================== + +This provides some information about Chromium OS and U-Boot. + +.. toctree:: + :maxdepth: 2 + + overview + run_vboot + chainload diff --git a/doc/chromium/overview.rst b/doc/chromium/overview.rst new file mode 100644 index 00000000000..5498ed9c16c --- /dev/null +++ b/doc/chromium/overview.rst @@ -0,0 +1,74 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2020 Google LLC + +Chromium OS Support in U-Boot +============================= + +Introduction +------------ + +This describes how to use U-Boot with Chromium OS. Several options are +available: + + - Running U-Boot from the 'altfw' feature, which is available on selected + Chromebooks from 2019 onwards (initially Grunt). Press '1' from the + developer-mode screen to get into U-Boot. See here for details: + https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_mode.md + + - Running U-Boot from the disk partition. This involves signing U-Boot and + placing it on the disk, for booting as a 'kernel'. See + :doc:`chainload` for information on this. This is the only + option on non-U-Boot Chromebooks from 2013 to 2018 and is somewhat + more involved. + + - Running U-Boot with Chromium OS verified boot. This allows U-Boot to be + used instead of either or both of depthcharge (a bootloader which forked + from U-Boot in 2013) and coreboot. See :doc:`run_vboot` for more + information on this. + + - Running U-Boot from coreboot. This allows U-Boot to run on more devices + since many of them only support coreboot as the bootloader and have + no bare-metal support in U-Boot. For this, use the 'coreboot' target. + + - Running U-Boot and booting into a Chrome OS image, but without verified + boot. This can be useful for testing. + + +Talks and documents +------------------- + +Here is some material relevant to Chromium OS verified boot with U-Boot: + + - "U-Boot with Chrome OS and firmware packaging" + + - Author: Simon Glass + - Presented at Open Source Firmware Conference 2018, Erlangen + - Describes the work in progress as at the end of 2018 + - Slides at `OSFC `_ + - Video on `Youtube `_ + + - "Verified Boot in Chrome OS and how to make it work for you" + + - Author: Simon Glass + - Presented at ELCE 2013, Edinburgh + - Describes the original 2013 implementation as shipped on snow (first + `ARM Chromebook was a Samsung Chromebook `_ + with Samsung Exynos5250 `review `_), + spring (`HP Chromebook 11 `_) + and pit/pi (`Samsung Chromebook 2 `_ + with Exynos 5 Octa 5420 in 2014). + - Slides at `Google research `_ + - Video at `Youtube `_ + + - "Chrome University 2018: Chrome OS Firmware and Verified Boot 201" + + - Author: Duncan Laurie + - Describes Chrome OS firmware as of 2018 and includes a wide range of + topics. This has no U-Boot information, but does cover coreboot and also + talks about the Chrome OS EC and Security chip. This is probably the + best introduction talk. + - Video at `YouTube `_ + + - `Chromium OS U-Boot `_ + + - `Firmware porting Guide `_ diff --git a/doc/README.chromium b/doc/chromium/run_vboot.rst similarity index 68% rename from doc/README.chromium rename to doc/chromium/run_vboot.rst index 75f2f24042c..41b4f631835 100644 --- a/doc/README.chromium +++ b/doc/chromium/run_vboot.rst @@ -1,42 +1,14 @@ -Chromium OS Support in U-Boot -============================= - -Introduction ------------- - -This describes how to use U-Boot with Chromium OS. Several options are -available: - - - Running U-Boot from the 'altfw' feature, which is available on selected - Chromebooks from 2019 onwards (initially Grunt). Press '1' from the - developer-mode screen to get into U-Boot. See here for details: - https://sites.google.com/a/chromium.org/dev/chromium-os/poking-around-your-chrome-os-device?pli=1 - - - Running U-Boot from the disk partition. This involves signing U-Boot and - placing it on the disk, for booting as a 'kernel'. See - README.chromium-chainload for information on this. This is the only - option on non-U-Boot Chromebooks from 2013 to 2018 and is somewhat - more involved. - - - Running U-Boot with Chromium OS verified boot. This allows U-Boot to be - used instead of either or both of depthcharge (a bootloader which forked - from U-Boot in 2013) and coreboot. See below for more information on - this. - - - Running U-Boot from coreboot. This allows U-Boot to run on more devices - since many of them only support coreboot as the bootloader and have - no bare-metal support in U-Boot. For this, use the 'coreboot' target. - - - Running U-Boot and booting into a Chrome OS image, but without verified - boot. This can be useful for testing. +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2020 Google LLC +.. sectionauthor:: Simon Glass -U-Boot with Chromium OS verified boot -------------------------------------- +Running U-Boot with Chromium OS verified boot +============================================= -To obtain: +To obtain:: - git clone https://github.com/sglass68/u-boot.git + git clone https://github.com/sjg20/u-boot.git cd u-boot git checkout cros-master @@ -46,28 +18,35 @@ To obtain: git checkout 45964294 # futility: updater: Correct output version for Snow -To build for sandbox: +To build for sandbox:: UB=/tmp/b/chromeos_sandbox # U-Boot build directory cd u-boot make O=$UB chromeos_sandbox_defconfig make O=$UB -j20 -s VBOOT_SOURCE=/path/to/vboot_reference \ - MAKEFLAGS_VBOOT=DEBUG=1 QUIET=1 + MAKEFLAGS_VBOOT=DEBUG=1 QUIET=1 Replace sandbox with another supported target. This produces $UB/image.bin which contains the firmware binaries in a SPI flash image. -To run on sandbox: +To run on sandbox:: + CROS=~/cosarm + IMG=$CROS/src/build/images/coral/latest/chromiumos_image.bin $UB/tpl/u-boot-tpl -d $UB/u-boot.dtb.out \ - -L6 -c "host bind 0 $CROS/src/build/images/cheza/latest/chromiumos_image.bin; vboot go auto" \ - -l -w -s state.dtb -r + -L6 -c "host bind 0 $IMG; vboot go auto" \ + -l -w -s state.dtb -r -n -m $UB/ram + + $UB/tpl/u-boot-tpl -d $UB/u-boot.dtb.out -L6 -l \ + -c "host bind 0 $IMG; vboot go auto" -w -s $UB/state.dtb -r -n -m $UB/mem + To run on other boards: - Install image.bin in the SPI flash of your device - Boot your system + + - Install image.bin in the SPI flash of your device + - Boot your system Sandbox @@ -83,7 +62,7 @@ a device tree and binding a Chromium OS disk image for use to find kernels phases into state.dtb and will automatically ensure that memory is shared between all phases. TPL will jump to SPL and then on to U-Boot proper. -It is possible to run with debugging on, e.g. +It is possible to run with debugging on, e.g.:: gdb --args $UB/tpl/u-boot-tpl -d .... @@ -95,7 +74,7 @@ Samus ----- Basic support is available for samus, using the chromeos_samus target. If you -have an em100, use: +have an em100, use:: sudo em100 -s -c W25Q128FW -d $UB/image.bin -t -r @@ -119,11 +98,20 @@ New uclasses Several uclasses are provided in cros/: - UCLASS_CROS_AUX_FW Chrome OS auxiliary firmware - UCLASS_CROS_FWSTORE Chrome OS firmware storage - UCLASS_CROS_NVDATA Chrome OS non-volatile data device - UCLASS_CROS_VBOOT_EC Chrome OS vboot EC operations - UCLASS_CROS_VBOOT_FLAG Chrome OS verified boot flag +UCLASS_CROS_AUX_FW + Chrome OS auxiliary firmware + +UCLASS_CROS_FWSTORE + Chrome OS firmware storage + +UCLASS_CROS_NVDATA + Chrome OS non-volatile data device + +UCLASS_CROS_VBOOT_EC + Chrome OS vboot EC operations + +UCLASS_CROS_VBOOT_FLAG + Chrome OS verified boot flag The existing UCLASS_CROS_EC is also used. @@ -181,7 +169,7 @@ detect problems that affect the flow or particular vboot features. U-Boot without Chromium OS verified boot ---------------------------------------- -The following script can be used to boot a Chrome OS image on coral: +The following script can be used to boot a Chrome OS image on coral:: # Read the image header and obtain the address of the kernel # The offset 4f0 is defined by verified boot and may change for other @@ -213,6 +201,4 @@ TO DO Get the full ACPI tables working with Coral -Simon Glass -sjg@chromium.org 7 October 2018 diff --git a/doc/index.rst b/doc/index.rst index 4c44955d67f..ce91a2a41ef 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -110,6 +110,14 @@ Android-specific features available in U-Boot. android/index +Chromium OS-specific doc +------------------------ + +.. toctree:: + :maxdepth: 2 + + chromium/index + Indices and tables ================== From patchwork Mon Mar 15 05:11:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452999 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=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: 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=fmBh9gLP; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPjy73w7z9sR4 for ; Mon, 15 Mar 2021 16:14:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A87E82ACC; Mon, 15 Mar 2021 06:13: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=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="fmBh9gLP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3BB882AAF; Mon, 15 Mar 2021 06:12:51 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (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 F2625829EE for ; Mon, 15 Mar 2021 06:12:42 +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-pg1-x52a.google.com with SMTP id x29so19766391pgk.6 for ; Sun, 14 Mar 2021 22:12:42 -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=MrjI77mPNRScpI6CAD/h0ciGdLQiIdPbOXY+BNrHFiA=; b=fmBh9gLPQVPuGWqYyydJcqmHemzaIma7rnCahrLoryq0pz1rXqPWVp6R8b+PEJSSrv FHGspd7V2aTYrVyXn792tMDcJRkmqwVyH2rszHqRhACyVqxasChWLBogwIjyNgo0A4Km VOvXoFprAN1LPWZ9LksYFbjbzHvFkmJjs9vHA= 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=MrjI77mPNRScpI6CAD/h0ciGdLQiIdPbOXY+BNrHFiA=; b=e9DhSCAxxDficoFJPjuQr1NaGMiTX3lf00Scj0y7m4/GkIP3e3mlcf9o+DzWnCSTqc vz0Z/kRj/Y0qsrEwi90wMTcyrBcAZN5xfG9+cej5eJpb8nMwDMAAhZArEMZcm1rHpZJV PEwwnfmqbQ7mhBbC9NRnPNgNiYtR2wc8y6ZcVMsZ6wwTsEzf1B0RyKcnEzF72dvigrNL iyHuENTvz3KH+sXsdP4KnS6HiX+kBoflEMCtFiIhho34EQJP/DmfJ854etLvKLTasUp9 jFrsQG+2VVo7Jd5D+SrUDBGcqWIfRj/AhFu8boCBcXQvDiKgVIVUXWO45Uhft3kgoqfT FpQQ== X-Gm-Message-State: AOAM5306084jyN485Ry05JSO3/1RG2kHF8dD1/ZHCDO9qHILVW1wGQfT CB0rUoF8a5vT3Fv1lvIHHCxqtIrl5liZpDLv X-Google-Smtp-Source: ABdhPJyWx9FA51x+6ljlL92zzZxv9niUKtTHFEC7zA1qbZuX0XnmYDKMP5IQ2rj3BkKT8N306Aq7Vw== X-Received: by 2002:a63:792:: with SMTP id 140mr21700016pgh.200.1615785161002; Sun, 14 Mar 2021 22:12:41 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Kory Maincent Subject: [PATCH 16/19] command: Fix operation of !CONFIG_CMDLINE Date: Mon, 15 Mar 2021 18:11:21 +1300 Message-Id: <20210315181056.16.I311920c145619e71f1d8ca081668f05301438485@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean The U_BOOT_CMDREP_COMPLETE() macro produces a build error if CONFIG_CMDLINE is not enabled. Fix this by updating the macro to provide the 'repeatable' arugment in this case. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/command.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/command.h b/include/command.h index 747f8f80958..137cfbc3231 100644 --- a/include/command.h +++ b/include/command.h @@ -389,6 +389,14 @@ int run_command_list(const char *cmd, int len, int flag); return 0; \ } +#define _CMD_REMOVE_REP(_name, _cmd) \ + int __remove_ ## _name(void) \ + { \ + if (0) \ + _cmd(NULL, 0, 0, NULL, NULL); \ + return 0; \ + } + #define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \ _usage, _help, _comp) \ { #_name, _maxargs, 0 ? _cmd_rep : NULL, NULL, _usage, \ @@ -405,7 +413,7 @@ int run_command_list(const char *cmd, int len, int flag); #define U_BOOT_CMDREP_COMPLETE(_name, _maxargs, _cmd_rep, _usage, \ _help, _comp) \ - _CMD_REMOVE(sub_ ## _name, _cmd_rep) + _CMD_REMOVE_REP(sub_ ## _name, _cmd_rep) #endif /* CONFIG_CMDLINE */ From patchwork Mon Mar 15 05:11:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1453001 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=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: 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=Lq9CclUR; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPkR6flbz9sR4 for ; Mon, 15 Mar 2021 16:15:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B05E282B04; Mon, 15 Mar 2021 06:13: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=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="Lq9CclUR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D0C8182AD3; Mon, 15 Mar 2021 06:12:57 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (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 EFEED82AA1 for ; Mon, 15 Mar 2021 06:12:47 +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-pf1-x430.google.com with SMTP id s21so5848852pfm.1 for ; Sun, 14 Mar 2021 22:12:47 -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=fmSwlP1Tr8uqOj/6CU8XOUj7MxY5DopZ/KsbYihF2j4=; b=Lq9CclURKcXpzl4j7A7/Uz37qkwADVgvGEQHVH4hpaWV7loT9bslZfk1VzUn9IpD5T he6n79Fka41bFUgzJ9xHvDpbtqMW+huuuPv+2ufxU7Opr91FNE+tOMjk39ByR2VTYc1y 2YYF4TjAogCRFhzDryppWOZIRp7unmlsZs69E= 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=fmSwlP1Tr8uqOj/6CU8XOUj7MxY5DopZ/KsbYihF2j4=; b=U6QnP060QdzeSxxlbTJpkmGLeCd/l3irZDykVZ/muWQJrhYzN8TSqTYYKmWV2pBtzo kRmTdG4qVW9IDzsI+XnsNizN/65NTuG39n9XUGy9t1bpGbG0597XEyvdLqIqDDNWAmKJ s+3e02mXwax/MvotTLdvUPh0BQkzl5EEdI4hVDoWsGY2dQROZLvuEZtDVKybUo0Ro/Ms KCq1sj1/gTRhSgrZyzrcnXSnQ7FuLGVvP1SLbHUjlb3IAf4iCtCR+cWPL7gMCINrxePi H+cicNLpdjV0VszbaN6HI868oSOcq3UFw3nYoR18uCcyj9xiMNT+4kguyK4CUzZHz9IR CkyQ== X-Gm-Message-State: AOAM531hBpUQEEU2C3Hyn4gkKeFr9NNtlQagQfSPOHmAoBvUZN2Fv6yH Vzv8/eo2K0PaE//g03oykeo7AOLg5w2PqmcF X-Google-Smtp-Source: ABdhPJzajqHLWF2HI0mxlaC+nFkGC/OCzikhOnUFM5M3GTXJnTSaMUObf8BLuRkmJbXeFx0EcFCkVQ== X-Received: by 2002:a05:6a00:2cd:b029:1f4:c3db:4191 with SMTP id b13-20020a056a0002cdb02901f4c3db4191mr8653439pft.71.1615785166138; Sun, 14 Mar 2021 22:12:46 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Aswath Govindraju , Atish Patra , Bin Meng , Heinrich Schuchardt , Joao Marcos Costa , Marcin Juszkiewicz , Marek Szyprowski , Patrick Delaunay , Reuben Dowle , Sean Anderson , Stefan Roese Subject: [PATCH 17/19] bloblist: Make BLOBLIST_TABLES depend on BLOBLIST Date: Mon, 15 Mar 2021 18:11:22 +1300 Message-Id: <20210315181056.17.I9f8f5034484af4779df6c80084c6c0a7ee4e908b@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Add an extra condition here since we cannot put x86 tables in a bloblist when bloblists are not supported. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- lib/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig b/lib/Kconfig index b35a71ac368..705196aef89 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -640,7 +640,7 @@ menu "System tables" config BLOBLIST_TABLES bool "Put tables in a bloblist" - depends on X86 + depends on X86 && BLOBLIST help Normally tables are placed at address 0xf0000 and can be up to 64KB long. With this option, tables are instead placed in the bloblist From patchwork Mon Mar 15 05:11:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1453002 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=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: 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=mxfYIiC2; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPkg1mMsz9sR4 for ; Mon, 15 Mar 2021 16:15:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C0D1B82B0F; Mon, 15 Mar 2021 06:13: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=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="mxfYIiC2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11C2A82A82; Mon, 15 Mar 2021 06:13:00 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 A9B5A82AB9 for ; Mon, 15 Mar 2021 06:12:50 +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-pj1-x1029.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso14078589pjb.3 for ; Sun, 14 Mar 2021 22:12:50 -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=+ljQOUciFMQbiEQEGOrA1UAs0o+F19ArHvXy7IVZhu4=; b=mxfYIiC2ViEkhyykP895i+wQQ4ruaFJJcWS+pVozJKgTanYU6Em5Y7mp54+veLAJSs n8St13vcjphe2R4rnxzcebUvdlBqBdDUqLOMBELMwOBIGBmylhp+3Vfl6WloG3zxkRJy KSCzZ/NllO7MZZBr9bOxovDSpLl5kpZJNRE1A= 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=+ljQOUciFMQbiEQEGOrA1UAs0o+F19ArHvXy7IVZhu4=; b=BB8VkEVXm3qiE9cUyzEhNdJzBaZ8xGqbXvRJ8Ubg+kg98bKSKfMh8EBHRndgf24Knh 6q4EkPfuev9lqQYg4EvTe8q14eFk6e1FbNCbLD818h8S4U70mnFtDXNiR8BCg80Ft6Lh 1L/e6Q9Pg1Cp9DyMrxqlJG9cJ3LQMQM3wiIsPuWUiOTTRrU0tzMkOB+5jCK2cCJCbJmS a5641vz2l2eCwFzK3Q/XuwYFRgwzAy0NTkYRuqJK7vigi2OCOuthvaLdw43ULV3KtSVr sPKqC8lNk1VLVYK/GrMZEy8hi+vX6o8w3x1JGNepuNlyTOcxYojCeafvWZJVJfY5jX3l E5Cg== X-Gm-Message-State: AOAM532b1Q5+BvqF1VBghQYil+GSAODT4nLuMTEUexCYv/2c5JFkgzrN MhDH7APcsNZVqwWx+xLuseHbzFO2VGUOX7IV X-Google-Smtp-Source: ABdhPJxsfqU/MaooTJ1ZK5F13FfF/goQN6X0R+KGZfDqwoE5JOfcvE0fUhwTzP1CCMWFtj+JfAkuGg== X-Received: by 2002:a17:90b:344c:: with SMTP id lj12mr11060904pjb.208.1615785169130; Sun, 14 Mar 2021 22:12:49 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Tero Kristo Subject: [PATCH 18/19] bootm: Skip command-line substitution if !CONFIG_CMDLINE Date: Mon, 15 Mar 2021 18:11:23 +1300 Message-Id: <20210315181056.18.Ia6e8ed7ce5b997c2493c3561a69ce90bcf564a4a@changeid> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean When there is no command line, we cannot enable this feature. Add a check to avoid a build error. Signed-off-by: Simon Glass --- common/bootm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/bootm.c b/common/bootm.c index dab7c3619fd..ea71522d0c9 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -583,7 +583,8 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags) if (ret) return log_msg_ret("silent", ret); } - if (IS_ENABLED(CONFIG_BOOTARGS_SUBST) && (flags & BOOTM_CL_SUBST)) { + if (IS_ENABLED(CONFIG_BOOTARGS_SUBST) && IS_ENABLED(CONFIG_CMDLINE) && + (flags & BOOTM_CL_SUBST)) { ret = process_subst(buf, maxlen); if (ret) return log_msg_ret("subst", ret); From patchwork Mon Mar 15 05:11:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1453003 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=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: 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=DklUems+; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPkv3zNxz9sR4 for ; Mon, 15 Mar 2021 16:15:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0CA0282B18; Mon, 15 Mar 2021 06:13:26 +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="DklUems+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3B12F82AB9; Mon, 15 Mar 2021 06:13:00 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 DB69782A16 for ; Mon, 15 Mar 2021 06:12:52 +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-pl1-x632.google.com with SMTP id c16so14718512ply.0 for ; Sun, 14 Mar 2021 22:12:52 -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=0AGrvWQy+6X26SVlNxB3rND3Jfzswo3NLe+dXWQO3qw=; b=DklUems+dJMTOWpFpPCQpfLUmHYbEbjCb74WLDRT90xwdctjK3TOWMmxAPyEHC0idf nAGj3+/KyidsTNaOEvx0Zp1ne6cvb0yuCYn/2eoSfa/IU9qXdDjZiRu+ZO633t9Gy9db tr5HruTmRLPXbtRBuApnbLQt7WeX1MK4OCQaI= 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=0AGrvWQy+6X26SVlNxB3rND3Jfzswo3NLe+dXWQO3qw=; b=ICpgX/cZoNEfroMgfmn5hfGu7j390uVMpPZUMmYUw93BXmD82fmDJ+kytESl72t5jz W1O2UwXGweC/Dnk2tyJjad46DRVXDD0xJUQYGMRQ9+d+uEmsc27blKi/A44HKbGJw6fA Us+DkrrYZcQiLJV1d6hJwyWPSj7DcKAM0K6iYH7G9PlLTGIu2jz2/8nvKxcHEJ+XgRu9 2hf3zoRAfOrtgDDxFXmSSZk+bz1i/cBrKrt1ryFrhs32gw3hMVpOctyQEDpNc17MJNBi K5sY72qwAUaEz7G9ED/G23uSS927y78BVkmLdsN29NhV/LSwooZWsB+iaTepqz/XuwxG ZQPQ== X-Gm-Message-State: AOAM531nkjdlVUQrNevve9HHlRJhO1v9T93Uutj37gQ2kiyHYI6bcLR9 ZfpEOiuBxsmOY70C1TC9FpDjPI0bpUnQ/s3w X-Google-Smtp-Source: ABdhPJzv2h5so3aNkDerDde9iovRLwBQE5oH/Kiq34Gcgu5SY7ilK7QXdxvfD+od7IDAnyX1X37+zA== X-Received: by 2002:a17:90b:e18:: with SMTP id ge24mr11010002pjb.199.1615785171304; Sun, 14 Mar 2021 22:12:51 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 19/19] sandbox: Correct uninit conflict Date: Mon, 15 Mar 2021 18:11:24 +1300 Message-Id: <20210315051124.1940496-10-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean It is not possible to remove the state before driver model is uninited, since the devices are allocated in the memory buffer. Also it is not possible to uninit driver model afterwards, since the RAM has been freed. Drop the uninit altogether, since it is not actually necessary. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- arch/sandbox/cpu/cpu.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index edd48e2c1b7..48636ab6391 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -17,7 +16,6 @@ #include #include #include -#include DECLARE_GLOBAL_DATA_PTR; @@ -34,10 +32,8 @@ void sandbox_exit(void) { /* Do this here while it still has an effect */ os_fd_restore(); - if (state_uninit()) - os_exit(2); - if (dm_uninit()) + if (state_uninit()) os_exit(2); /* This is considered normal termination for now */