From patchwork Tue Jan 16 09:16:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124643 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948633lje; Tue, 16 Jan 2018 01:25:21 -0800 (PST) X-Google-Smtp-Source: ACJfBotKdu+YmRkunrHlwfG63t34uaUtxFXIdjPXyacRxuj9W3Sy9tfqA+5MUVzYUvZvzZFOHAGr X-Received: by 10.80.246.21 with SMTP id c21mr33884681edn.271.1516094721351; Tue, 16 Jan 2018 01:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094721; cv=none; d=google.com; s=arc-20160816; b=PLjLK5p2XKNlBhyP/VqwkdTJRAiTHr/3u/OSYFl39q6vHgu0k8ceufwaGjYtFpopQq iajopOfOKCJ/ZLaYGIeljwRPqx4gGNPp78c6HeZKfOBVQZJ8Q8Nj9vajSY6tQH4OK+SY OdFZPay+mulIBBAKE0HQhQPAioY/Ie+dBfeI6TDZLxUsB5TFpxgZMM7gYrQq5o97lFUE 5txS/QgitykjtNScDYAwgzgfUQdhmXetnt+O6HLnQH50JcksmRTBSRlbkeG4gl2BoxbQ p/MCwb9NGHhhul10oR2BO6zsA528Vwi9VUzWG8volvJ9VD/RUN6vPKNvX0kEU9bcyoi6 3RpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=olmVkPtQUpCd6/0LgGcBiBRXX+R7DJmzVP+YOZETsko=; b=kwHWMLi13Zx2pvR89nxf5aSeaHwXdH+X0o4ep1V1mT9me1/o6ZXhJkHly0TmKYXGEw G4QryvIiOcxV7q5mZn9E7qcpA8hrCiUaRWPwfwlB9jppd0AT85EChn6kjoqFgr6jARfp DL8SWv4/PHJRa/6Z+AlMVU/8vZPT9CmPYsG9EXFgYopJNHWTnRlxbYMNjN312wbfxQpb Qaoiu2PrqF3T4nV1bzVephj8vYKVLZXrpc06Jr5aVk8CmszdOF5aBWAYxfxQ4E2WGTME HMHloZBCc9uUHSmHyc6Ispel9Pcqbq2DTl/Ce5OaLJuqJKSuNbKJMza4t9lBHl6hM6y7 qxQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 6si1719651edm.187.2018.01.16.01.25.21; Tue, 16 Jan 2018 01:25:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id F22D2C21E4B; Tue, 16 Jan 2018 09:17:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 574BDC21DF3; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7FD29C21DB5; Tue, 16 Jan 2018 09:16:55 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 34BACC21C4A for ; Tue, 16 Jan 2018 09:16:55 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 00EF0208BB; Tue, 16 Jan 2018 10:16:53 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id C08FE20725; Tue, 16 Jan 2018 10:16:53 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:37 +0100 Message-Id: <8c0b36130b265e429f5ad0887c339776e4d47912.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 01/15] cmd: nvedit: Get rid of the env lookup X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The nvedit command is the only user of env_driver_lookup_default outside of the environment code itself, and it uses it only to print the environment it's about to save to during env save. As we're about to rework the environment to be able to handle multiple environment sources, we might not have an idea of what environment backend is going to be used before trying (and possibly failing for some). Therefore, it makes sense to remove that message and move it to the env_save function itself. As a side effect, we also can get rid of the call to env_driver_lookup_default that is also about to get refactored. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- cmd/nvedit.c | 4 ---- env/env.c | 4 +++- include/environment.h | 7 ------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4e79d03856fe..a690d743cd46 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -708,10 +708,6 @@ ulong env_get_ulong(const char *name, int base, ulong default_val) static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - struct env_driver *env = env_driver_lookup_default(); - - printf("Saving Environment to %s...\n", env->name); - return env_save() ? 1 : 0; } diff --git a/env/env.c b/env/env.c index 76a5608628fc..094538ff5b62 100644 --- a/env/env.c +++ b/env/env.c @@ -52,7 +52,7 @@ static enum env_location env_get_default_location(void) return ENVL_UNKNOWN; } -struct env_driver *env_driver_lookup_default(void) +static struct env_driver *env_driver_lookup_default(void) { enum env_location loc = env_get_default_location(); struct env_driver *drv; @@ -115,6 +115,8 @@ int env_save(void) return -ENODEV; if (!drv->save) return -ENOSYS; + + printf("Saving Environment to %s...\n", drv->name); ret = drv->save(); if (ret) { debug("%s: Environment failed to save (err=%d)\n", __func__, diff --git a/include/environment.h b/include/environment.h index d29f82cb5d6f..a2015c299aa9 100644 --- a/include/environment.h +++ b/include/environment.h @@ -293,13 +293,6 @@ int env_import_redund(const char *buf1, const char *buf2); #endif /** - * env_driver_lookup_default() - Look up the default environment driver - * - * @return pointer to driver, or NULL if none (which should not happen) - */ -struct env_driver *env_driver_lookup_default(void); - -/** * env_get_char() - Get a character from the early environment * * This reads from the pre-relocation environemnt From patchwork Tue Jan 16 09:16:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124637 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp947832lje; Tue, 16 Jan 2018 01:21:26 -0800 (PST) X-Google-Smtp-Source: ACJfBovL1zWcoWofWmpFYc6pgVEOug5VAYWAKxJki1gMMKtXVC25gxh2PVHxPaCTQuzj4kM2TUfJ X-Received: by 10.80.204.4 with SMTP id m4mr6538128edi.146.1516094486666; Tue, 16 Jan 2018 01:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094486; cv=none; d=google.com; s=arc-20160816; b=R01pgXRSLMirDKpkk9R2hnlhR6f0GLEG1P76FVplPyWoS1op+TFLB+w6w59UTSE+TR X9NuRf9QxlYdpUXfyWiigVB7ly3wCaRnvH2fx6GgS+aHOLqLtx+i3mFH+N3zZSmUAuVG SmgLy3NXgNkwNCKwwrlVK8SWKB03kNxa1igd/wCa9sgyImC5d3wXjpFA4k95HF0NSfYk AS7ZHpfRZT77I998efXhGodT9rCO+RL/irMLo+Yb6VPjQF1Elc6dLI0+Uel6meJgiOUc +t6MB5qUvjEiOq8GvdGPKSCipigoEEDv1yxmJk2pJRNQNBq++GfIskGF+axSB8sbWpeH d8Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=vlMiHPcoPAC+98M2hyduRHT+hzVYtAfDocwS/Q1vIWI=; b=nn2c7IhBIzILYSdVs+WawS3e5ZJgYDGYQSkHO+ak4xuHLlqKM76semVFtmqTPIgKp3 h2emW2TVW6/w9Zf0VEXGWVAAaWy3OvRat+QRjtApGjK3I77GdyQ+YrSZH9MjVehmT43b 8atixFerSULMq7KWjB1c+eOnv3+fQcZ8Te1/fTEm4NgHKPOMIocGymWd+XX5P9RhkiZ0 QmyuplzKbCJZiDXxlupGqiBQ3M5GSDpO5Hwgs6hn3m2/IJ3+TEKMRhoRBGZ+0qB8c5+o 7hGO1WKFfeEGeR02YheLNwU4ltNj5M3mTdZE3CwvUzWTJMT2dSriK435dYU9oLcbpFem hxIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id y4si534594edi.180.2018.01.16.01.21.26; Tue, 16 Jan 2018 01:21:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 2777FC21DD9; Tue, 16 Jan 2018 09:18:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 371EFC21E14; Tue, 16 Jan 2018 09:17:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AF486C21DFA; Tue, 16 Jan 2018 09:16:56 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 814D1C21C4A for ; Tue, 16 Jan 2018 09:16:55 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 5B54B208B5; Tue, 16 Jan 2018 10:16:54 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 28D5620725; Tue, 16 Jan 2018 10:16:54 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:38 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 02/15] env: Rename env_driver_lookup_default and env_get_default_location X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The env_driver_lookup_default and env_get_default_location functions are about to get refactored to support loading from multiple environment. The name is therefore not really well suited anymore. Drop the default part to be a bit more relevant. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/env/env.c b/env/env.c index 094538ff5b62..97ada5b5a6fd 100644 --- a/env/env.c +++ b/env/env.c @@ -10,7 +10,7 @@ DECLARE_GLOBAL_DATA_PTR; -static struct env_driver *env_driver_lookup(enum env_location loc) +static struct env_driver *_env_driver_lookup(enum env_location loc) { struct env_driver *drv; const int n_ents = ll_entry_count(struct env_driver, env_driver); @@ -26,7 +26,7 @@ static struct env_driver *env_driver_lookup(enum env_location loc) return NULL; } -static enum env_location env_get_default_location(void) +static enum env_location env_get_location(void) { if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) return ENVL_EEPROM; @@ -52,12 +52,12 @@ static enum env_location env_get_default_location(void) return ENVL_UNKNOWN; } -static struct env_driver *env_driver_lookup_default(void) +static struct env_driver *env_driver_lookup(void) { - enum env_location loc = env_get_default_location(); + enum env_location loc = env_get_location(); struct env_driver *drv; - drv = env_driver_lookup(loc); + drv = _env_driver_lookup(loc); if (!drv) { debug("%s: No environment driver for location %d\n", __func__, loc); @@ -69,7 +69,7 @@ static struct env_driver *env_driver_lookup_default(void) int env_get_char(int index) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret; if (gd->env_valid == ENV_INVALID) @@ -89,7 +89,7 @@ int env_get_char(int index) int env_load(void) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret = 0; if (!drv) @@ -108,7 +108,7 @@ int env_load(void) int env_save(void) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret; if (!drv) @@ -129,7 +129,7 @@ int env_save(void) int env_init(void) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret = -ENOENT; if (!drv) From patchwork Tue Jan 16 09:16:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124644 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948686lje; Tue, 16 Jan 2018 01:25:38 -0800 (PST) X-Google-Smtp-Source: ACJfBovqbO4LxgSaCbK2XGdj00L2qRY11JMOrwc/QdU4TptzAfIFLX+LOSpGya4ieng8biQN3uA3 X-Received: by 10.80.179.106 with SMTP id r39mr18510171edd.75.1516094738852; Tue, 16 Jan 2018 01:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094738; cv=none; d=google.com; s=arc-20160816; b=BoGOaFl1yeophtlH5r5ytbD6T+CAGH039LV7k4MHJK07bH4/15zHZsgLWnTInkDBvD +FbvQvPizzMt4MyYyxwwihjWdnbgW0qN3yhW1X0oArMAKLamGUei5zUYny7+ag7vZmvR pnYlcxqsWVyr8htK1ApjvEuNJozY0+6/9tBftKWIyBCiOytexBbWGdgYPytNqit3h+Ha SRPzDxjh2XardaYCLdIDv8rA8bCFN++v0SBYLLrQEF3n70TecTZCHykV+zooFAivjdLN ht0ecXLWUNkDBTKbMKfuisokeq7keVR9CuRVFSG9P+SwbHCQCKc8h4zxJiGAJDkv7R2l Bgog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=mHoPq4a+MzlhfkpZvXquyTue9EchOFla0EzVz1Cgc9U=; b=ZIUd8hf+IxdyDFep1wTZacf2CifJjGyq1sozjIPpRN6zEFXyotPu1Hi5B236tmVWJd cvNKAE5AVfPxFndF6Wo1yXxn5q0GnotaxXGzoMSl9L05tIToKoPdzBMKRrmEohBgBZSS UpHAOR/5lMQUxtPxGldyFtgqd2LgewBNcmoMRHHJBjiJPq5FUygeXFd4+vITsBlK2y+j UfizT3361bVESVujfQWjOa8DZpLSilBSvqnLFYomUPzd6/WP7xnVW9QwdWaxU8XZ9wTV R4iaKKRtUoVvlrohAt0UjCj24ReKeZMyzpEAiu04pD1annNd2itlUGk4K4PQiJq9WTMv LH+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id e20si2001862edd.37.2018.01.16.01.25.38; Tue, 16 Jan 2018 01:25:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 63C32C21E18; Tue, 16 Jan 2018 09:18:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4E94DC21E08; Tue, 16 Jan 2018 09:17:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9FDD0C21E28; Tue, 16 Jan 2018 09:17:00 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id E17F1C21DCE for ; Tue, 16 Jan 2018 09:16:55 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id BB6FD208B6; Tue, 16 Jan 2018 10:16:54 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8A6A820725; Tue, 16 Jan 2018 10:16:54 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:39 +0100 Message-Id: <4c663f0b6b4bd6f8c15f23527ff02d7e9eebb2ac.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 03/15] env: Pass additional parameters to the env lookup function X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In preparation for the multiple environment support, let's introduce two new parameters to the environment driver lookup function: the priority and operation. The operation parameter is meant to identify, obviously, the operation you might want to perform on the environment. The priority is a number passed to identify the environment priority you want to retrieve. The lowest priority parameter (0) will be the primary source. Combining the two parameters allow you to support multiple environments through different priorities, and to change those priorities between read and writes operations. This is especially useful to implement migration mechanisms where you want to always use the same environment first, be it to read or write, while the common case is more likely to use the same environment it has read from to write it to. Signed-off-by: Maxime Ripard --- env/env.c | 135 +++++++++++++++++++++++++++---------------- include/environment.h | 8 +++- 2 files changed, 94 insertions(+), 49 deletions(-) diff --git a/env/env.c b/env/env.c index 97ada5b5a6fd..4dc39b384c1e 100644 --- a/env/env.c +++ b/env/env.c @@ -26,8 +26,11 @@ static struct env_driver *_env_driver_lookup(enum env_location loc) return NULL; } -static enum env_location env_get_location(void) +static enum env_location env_get_location(enum env_operation op, int prio) { + if (prio >= 1) + return ENVL_UNKNOWN; + if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) return ENVL_EEPROM; else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT) @@ -52,11 +55,27 @@ static enum env_location env_get_location(void) return ENVL_UNKNOWN; } -static struct env_driver *env_driver_lookup(void) + +/** + * env_driver_lookup() - Finds the most suited environment location + * @op: operations performed on the environment + * @prio: priority between the multiple environments, 0 being the + * highest priority + * + * This will try to find the available environment with the highest + * priority in the system. + * + * Returns: + * NULL on error, a pointer to a struct env_driver otherwise + */ +static struct env_driver *env_driver_lookup(enum env_operation op, int prio) { - enum env_location loc = env_get_location(); + enum env_location loc = env_get_location(op, prio); struct env_driver *drv; + if (loc == ENVL_UNKNOWN) + return NULL; + drv = _env_driver_lookup(loc); if (!drv) { debug("%s: No environment driver for location %d\n", __func__, @@ -69,83 +88,101 @@ static struct env_driver *env_driver_lookup(void) int env_get_char(int index) { - struct env_driver *drv = env_driver_lookup(); - int ret; + struct env_driver *drv; + int prio; if (gd->env_valid == ENV_INVALID) return default_environment[index]; - if (!drv) - return -ENODEV; - if (!drv->get_char) - return *(uchar *)(gd->env_addr + index); - ret = drv->get_char(index); - if (ret < 0) { - debug("%s: Environment failed to load (err=%d)\n", - __func__, ret); + + for (prio = 0; (drv = env_driver_lookup(ENVOP_GET_CHAR, prio)); prio++) { + int ret; + + if (!drv->get_char) + continue; + + ret = drv->get_char(index); + if (!ret) + return 0; + + debug("%s: Environment %s failed to load (err=%d)\n", __func__, + drv->name, ret); } - return ret; + return -ENODEV; } int env_load(void) { - struct env_driver *drv = env_driver_lookup(); - int ret = 0; + struct env_driver *drv; + int prio; - if (!drv) - return -ENODEV; - if (!drv->load) - return 0; - ret = drv->load(); - if (ret) { - debug("%s: Environment failed to load (err=%d)\n", __func__, - ret); - return ret; + for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) { + int ret; + + if (!drv->load) + continue; + + ret = drv->load(); + if (!ret) + return 0; + + debug("%s: Environment %s failed to load (err=%d)\n", __func__, + drv->name, ret); } - return 0; + return -ENODEV; } int env_save(void) { - struct env_driver *drv = env_driver_lookup(); - int ret; + struct env_driver *drv; + int prio; - if (!drv) - return -ENODEV; - if (!drv->save) - return -ENOSYS; - - printf("Saving Environment to %s...\n", drv->name); - ret = drv->save(); - if (ret) { - debug("%s: Environment failed to save (err=%d)\n", __func__, - ret); - return ret; + for (prio = 0; (drv = env_driver_lookup(ENVOP_SAVE, prio)); prio++) { + int ret; + + if (!drv->save) + continue; + + printf("Saving Environment to %s...\n", drv->name); + ret = drv->save(); + if (!ret) + return 0; + + debug("%s: Environment %s failed to save (err=%d)\n", __func__, + drv->name, ret); } - return 0; + return -ENODEV; } int env_init(void) { - struct env_driver *drv = env_driver_lookup(); + struct env_driver *drv; int ret = -ENOENT; + int prio; + + for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) { + if (!drv->init) + continue; - if (!drv) - return -ENODEV; - if (drv->init) ret = drv->init(); + if (!ret) + return 0; + + debug("%s: Environment %s failed to init (err=%d)\n", __func__, + drv->name, ret); + } + + if (!prio) + return -ENODEV; + if (ret == -ENOENT) { gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = ENV_VALID; return 0; - } else if (ret) { - debug("%s: Environment failed to init (err=%d)\n", __func__, - ret); - return ret; } - return 0; + return ret; } diff --git a/include/environment.h b/include/environment.h index a2015c299aa9..a4060506fabb 100644 --- a/include/environment.h +++ b/include/environment.h @@ -205,6 +205,14 @@ enum env_location { ENVL_UNKNOWN, }; +/* value for the various operations we want to perform on the env */ +enum env_operation { + ENVOP_GET_CHAR, /* we want to call the get_char function */ + ENVOP_INIT, /* we want to call the init function */ + ENVOP_LOAD, /* we want to call the load function */ + ENVOP_SAVE, /* we want to call the save function */ +}; + struct env_driver { const char *name; enum env_location location; From patchwork Tue Jan 16 09:16:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124640 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948338lje; Tue, 16 Jan 2018 01:23:55 -0800 (PST) X-Google-Smtp-Source: ACJfBosaxxcruOXSnlFgpqejeMSh5iXLiw8E7vNCPPfH5bWneqnxS23KHP4+p/Hhe5t/CC+xhAwZ X-Received: by 10.80.214.8 with SMTP id x8mr5713495edi.129.1516094635338; Tue, 16 Jan 2018 01:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094635; cv=none; d=google.com; s=arc-20160816; b=cPCrENpkk8TNz889kn8PT56NyVMjel6y8/chPNcZwhlaqy/LeIScNAkei1iMGylI7m qBbi2VuZMVLjoRpjDgolv/fZXbSPNJO5C8ESMyZwZsBceUqfiAiUkKJy8bMbiRdGQmw4 30tjP2pMH9CArhG5DQJQaMZ5CDuwxvkRzTpP6xePi0AFtetfLoSwn9EDoP4JNOkSUM+Y 09PabNUxqrN8CPEMOt5ZegYtsaPYZC3sakrMZvr3eeyQ9j1TvcWgZ9NTxfWf1LN14twi 9oZwHsQdfRYIHp4VYiMn+l8IC9G3pIWNEC1RFSkGodCZEHceVEjDiORYCtoslHWfNR77 uQWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=h5bMrjVcFIXkceh6xGD5AAwl8Yu15XhKfEtA2eBKh+I=; b=go+sse1Wu0DheYDv5KQI88QOitZ/mF86Mx+p+Javhw4ydQ3Ys/lJgSjsooW6lZFD7V e8y/g8d168YFH4qUOxvV/dsdVbn/SdkYc3IQw9gH6SsA2j1vDNOmMhp/Rj3PoyFZr6yW ceWgGYl79unEuQwu3H4iRFcMZvJtq18jtY38P8CEOJVtuZukcMAqdoTs5FFnclKBp59o 1Eax9GIa0pWgBiknrxm+LjfEKOgmuErKNfzTyWDEjir/Jz6WFkI8ig8xm3Sx0kVcHR7j syQKmo+Tya3aMPi4svkGFyXcRFrX0w2RTOLYTNGN5koG9+9IKbFa5rvjwp7rMxlnkCtK qY+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id d38si133881ede.268.2018.01.16.01.23.55; Tue, 16 Jan 2018 01:23:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id DD64BC21DEF; Tue, 16 Jan 2018 09:19:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2E799C21E51; Tue, 16 Jan 2018 09:17:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 13004C21E43; Tue, 16 Jan 2018 09:17:00 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 50ABEC21DD9 for ; Tue, 16 Jan 2018 09:16:56 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 2CF23208B9; Tue, 16 Jan 2018 10:16:55 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id EC12B20725; Tue, 16 Jan 2018 10:16:54 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:40 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 04/15] env: Make the env save message a bit more explicit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we'll soon have support for multiple environments, the environment saving message might end up being printed multiple times if the higher priority environment cannot be used. That might confuse the user, so let's make it explicit if the operation failed or not. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 4dc39b384c1e..afffab4c002a 100644 --- a/env/env.c +++ b/env/env.c @@ -144,8 +144,9 @@ int env_save(void) if (!drv->save) continue; - printf("Saving Environment to %s...\n", drv->name); + printf("Saving Environment to %s... ", drv->name); ret = drv->save(); + printf("%s\n", ret ? "Failed" : "OK"); if (!ret) return 0; From patchwork Tue Jan 16 09:16:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124635 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp947735lje; Tue, 16 Jan 2018 01:20:54 -0800 (PST) X-Google-Smtp-Source: ACJfBouuzx7wtv8UwOeTZ+7Sy/jpZPPFZTwi7xScNahsFt8yj92u2LwzQ4hXclK3cYhAt3f83ejt X-Received: by 10.80.133.140 with SMTP id a12mr6072882edh.286.1516094454518; Tue, 16 Jan 2018 01:20:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094454; cv=none; d=google.com; s=arc-20160816; b=ymEs+ydLXSc0YKbvYxIfBaCWf0/BiqI6UX3cp5DRfcWCt6BHQJLuW1U9/hpGwI7rkU BM5mCbBTXlYKml7ZvtuEzgRrUz9F2Q3lMA6SXLg/dTOmPPPuCAGGr+pYqk2Cm3NN9Qen staNcO/zP6ygZnFj6cHeQYikJsPo/IPle+IyCdpy3YeWD444ElLI89Oc/1b25Aat5kmC AbsOowsxTHdsfWmHg8+NJJAXuDtzmFbDbnAgsbR58o7Yil9KlQRKGfJQBajbcFRpEvnE pivBFfTAoqQze3uEa3FU5/WrGJHVHkTzko41BbLFtM+RwixD7Dszzk79bD9NNdiTvxCh yS9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=/9OWVL1VT96Ro5/u8yADQVCfbrU8Ro5F38Lzt16imQk=; b=ulCmhAj6R9BV+fiWfZc0QKLuuPj67qYNU+j+RwZ9g+p2c7tb8wN2sANpQaFpX17LdD PhYl5eFkcW194kIqJlOd9RaFAgQpz6kWlIvmwSl5Eo5jkAkX2QZJ1RfXAHpjr1fs/9Gx Mi6nwqWAm00gTxgZMQnEbILzQwWWEKen9hYEoUnpdJ6PUYEjXfV2WKEnpYxrnT9FCIa4 CC3DnxoDLVKtz8B5XdEmso0SWkkKY2qnPjL4Tm4DggkkB0opmu057fTjlf/56FXzk+r/ T6zeyMFWAmBOY3J5aDrA9F51RV1BW+59JXPaT/qpKaKAOl1xkk14mvgiMysheQH+WOmQ ljhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id n5si205872edc.132.2018.01.16.01.20.54; Tue, 16 Jan 2018 01:20:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id E6902C21E10; Tue, 16 Jan 2018 09:18:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1EB93C21E5B; Tue, 16 Jan 2018 09:17:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 43AA1C21E2C; Tue, 16 Jan 2018 09:17:00 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id AF56DC21E08 for ; Tue, 16 Jan 2018 09:16:56 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 88CA4208BC; Tue, 16 Jan 2018 10:16:55 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5A52420725; Tue, 16 Jan 2018 10:16:55 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:41 +0100 Message-Id: <4f9f507c65d182e9e05cdfd46add9fd42a678a30.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 05/15] env: Make it explicit where we're loading our environment from X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we can have multiple environments now, it's better to provide a decent indication on what environments were tried and which were the one to fail and succeed. Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/env/env.c b/env/env.c index afffab4c002a..9dd4d4cb4d11 100644 --- a/env/env.c +++ b/env/env.c @@ -122,12 +122,15 @@ int env_load(void) if (!drv->load) continue; + printf("Loading Environment from %s... ", drv->name); ret = drv->load(); + if (ret) + printf("Failed (%d)\n", ret); + else + printf("OK\n"); + if (!ret) return 0; - - debug("%s: Environment %s failed to load (err=%d)\n", __func__, - drv->name, ret); } return -ENODEV; @@ -146,12 +149,13 @@ int env_save(void) printf("Saving Environment to %s... ", drv->name); ret = drv->save(); - printf("%s\n", ret ? "Failed" : "OK"); + if (ret) + printf("Failed (%d)\n", ret); + else + printf("OK\n"); + if (!ret) return 0; - - debug("%s: Environment %s failed to save (err=%d)\n", __func__, - drv->name, ret); } return -ENODEV; From patchwork Tue Jan 16 09:16:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124634 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp947563lje; Tue, 16 Jan 2018 01:20:03 -0800 (PST) X-Google-Smtp-Source: ACJfBovoP+0/71Co5YskXVtwuuBlqyNwOPjxGRkBup8NqTvTHCVTu7xKwEZGsa7hNvJTbfljYt4b X-Received: by 10.80.215.91 with SMTP id i27mr29502216edj.95.1516094403710; Tue, 16 Jan 2018 01:20:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094403; cv=none; d=google.com; s=arc-20160816; b=pKfuHanfBmlM1oSiclzvX4gv7BpSJTct0fVM/vc5fBvQl4nUbbjontTKBS5JqAsWkd huTlkTdChVxLFvmXDuFfgu45OF+8gCsvqwd7dKt/YBCYXL+hRUFNBnKjnKd/05MnR+QB A9HPKnDBtgOX2Owksi0L4V/S/imjKJx3kprBzpEqvMGbIuYm6wEvsdxR39bde1U8RVQs e1kJiJV04LUc+ATb8J+GpyBmynIUGsosFulGwQZFas/Yh1+onQvGuBtbcl+ntAHce+z6 c2Gyp4P8SDSNO7lmi7WKZ6OYnlDy0v6gs5iMAx6308pu+0PUw10qDwso6qYtcFVBwKN1 SlSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=iRCC2lxkddvXGqNWN69MabOKcurl6zpX6gwtVm67A+4=; b=gnxd39ysQNENRKeCOYBIaaDj8V49zAadvYKRwKB+rNLLn14vCkA5HE3HZdIE79l0vD 9XRcWGfExpBhSNMLjU7fLAlJmpNwytB+CpeHCVy0fsMlj5uwbclUJ3UG1Hk3QW6GYab/ 52gAkZXyuSHA586bTho3Zgs7cQvRNkjGd1dQw/K0hUipXWeqdC2eImh5YODv+3FXKGBx 71DOtnxOO7feiYwpQY51/u4/zBRxtqh5TUPaKPVF6KEpt1uBgX2GhooSsOHS/H6ACMqh 9m0m0UztwSq8oMyicwGTR8KxKVOwpWNdt5CSTw5+RcGOjHPFUhmRx5klBiPuPkSK7ofZ vYWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j61si1501405edc.27.2018.01.16.01.20.03; Tue, 16 Jan 2018 01:20:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 304D8C21E2C; Tue, 16 Jan 2018 09:19:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6A053C21E0A; Tue, 16 Jan 2018 09:17:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0A148C21E4C; Tue, 16 Jan 2018 09:17:01 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 1CAE8C21DE8 for ; Tue, 16 Jan 2018 09:16:57 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id EA1EE208BD; Tue, 16 Jan 2018 10:16:55 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id BAFA620725; Tue, 16 Jan 2018 10:16:55 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:42 +0100 Message-Id: <16d0c2060725654bb87a45e766b9752ef1d3b988.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 06/15] env: fat: Make the debug messages play a little nicer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we have global messages to indicate what's going on, the custom messages in the environment drivers only make the output less readable. Make FAT play a little nicer by removing all the extra \n and formatting that is redundant with the global output. Reviewed-by: Andre Przywara Signed-off-by: Maxime Ripard --- env/fat.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/env/fat.c b/env/fat.c index ec49c3905369..158a9a34357b 100644 --- a/env/fat.c +++ b/env/fat.c @@ -55,7 +55,11 @@ static int env_fat_save(void) dev = dev_desc->devnum; if (fat_set_blk_dev(dev_desc, &info) != 0) { - printf("\n** Unable to use %s %d:%d for saveenv **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to use %s %d:%d... ", CONFIG_ENV_FAT_INTERFACE, dev, part); return 1; } @@ -63,12 +67,15 @@ static int env_fat_save(void) err = file_fat_write(CONFIG_ENV_FAT_FILE, (void *)&env_new, 0, sizeof(env_t), &size); if (err == -1) { - printf("\n** Unable to write \"%s\" from %s%d:%d **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to write \"%s\" from %s%d:%d... ", CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part); return 1; } - puts("done\n"); return 0; } #endif /* CMD_SAVEENV */ @@ -90,14 +97,22 @@ static int env_fat_load(void) dev = dev_desc->devnum; if (fat_set_blk_dev(dev_desc, &info) != 0) { - printf("\n** Unable to use %s %d:%d for loading the env **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to use %s %d:%d... ", CONFIG_ENV_FAT_INTERFACE, dev, part); goto err_env_relocate; } err = file_fat_read(CONFIG_ENV_FAT_FILE, buf, CONFIG_ENV_SIZE); if (err == -1) { - printf("\n** Unable to read \"%s\" from %s%d:%d **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to read \"%s\" from %s%d:%d... ", CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part); goto err_env_relocate; } From patchwork Tue Jan 16 09:16:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124638 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948083lje; Tue, 16 Jan 2018 01:22:40 -0800 (PST) X-Google-Smtp-Source: ACJfBosotIKAYb6YQc/X5AbkOcW0WsEfRT0XUwD59Xf6JTn5ItlKYc2WuvnAqgc8LMWtm2lI+9xM X-Received: by 10.80.167.101 with SMTP id h92mr51862110edc.202.1516094560207; Tue, 16 Jan 2018 01:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094560; cv=none; d=google.com; s=arc-20160816; b=be5UaT1I+xiRKTYm6cCB7eHP+FVYkcK45N5CjpPB670PFAxNkOhAMyTd9nrsQX5DLS g4mRjXBAD2uxumRcrzneyX3X4KqSeJdJ5KZO5CxVN/y09Ue7ppRLZrHsZ8eZ6QTDAiss owA4HGfUWlZntWljmEp2K1EWQfNOS4cbF4mFXGWiCCkrSByOHYWlD+SAYyR2Tcg72NL/ dwMEZv/e6WbFH2ZXz4tkMYozrFmrAD9WsGmJd78Pi8QvAEypzSBXYhwoVuBuvGq2C197 r4QZ0oBaEAHYfZhjidvhUqrlvAmmDGsyBBSl5L6g5Yz2IcCvrJz6uuqR/X+8cNO0OXoy wbVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=AeBXlHknYyLtkPgfoI0knBB1outfbTUZCQpoqE67KII=; b=GTAWMvqNY1yripHeHm4aHrY6Dr+eyyjqF4CiTkPBK7sVk7ocjpFRJSUtYaFlWe2Ip0 jwnPJWiZsXBF1w3YkBVE0s6H4UC88IE1RcY77EhcvMdJPEB0hdRkAJXqP4tMsViBzFcM n09Mz5tKXY9kfDh1kay2H+5bL0K5rbfhzzlqRzCQq8edsGF+H15yiUyQSq1ZVoy4ehIm gZYymxAeUycLjW3Zfoo83O5On1pXwksR8biXE0T21FAYC0sVywZ3RkMEv9Ena/fVOA2V iK7mZfku8HwY7Hr03r8qyoq1ACy7Jn1M+RzIYaKB+VT1+aeGyD/IkRXzIY+SkNeyh6EM SuzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id s39si1351466edm.150.2018.01.16.01.22.39; Tue, 16 Jan 2018 01:22:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id D6CAFC21DBA; Tue, 16 Jan 2018 09:20:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E8E00C21DE8; Tue, 16 Jan 2018 09:17:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AC8D6C21E88; Tue, 16 Jan 2018 09:17:03 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 77959C21E11 for ; Tue, 16 Jan 2018 09:16:57 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 50630208B2; Tue, 16 Jan 2018 10:16:56 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2398F20725; Tue, 16 Jan 2018 10:16:56 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:43 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 07/15] env: mmc: Make the debug messages play a little nicer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we have global messages to indicate what's going on, the custom messages in the environment drivers only make the output less readable. Make MMC play a little nicer by removing all the extra \n and formatting that is redundant with the global output. Reviewed-by: Andre Przywara Signed-off-by: Maxime Ripard Reviewed-by: Simon Glass --- env/mmc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/env/mmc.c b/env/mmc.c index ed7bcf16ae0e..528fbf978162 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -233,7 +233,6 @@ static int env_mmc_save(void) goto fini; } - puts("done\n"); ret = 0; #ifdef CONFIG_ENV_OFFSET_REDUND From patchwork Tue Jan 16 09:16:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124642 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948628lje; Tue, 16 Jan 2018 01:25:20 -0800 (PST) X-Google-Smtp-Source: ACJfBouT0Em+/ifDj12HHjwr/ws2siH4SLGnH6KyxOHon2b2h9aY4/g32ITre9Etc5Fcwt1/9geQ X-Received: by 10.80.131.67 with SMTP id 61mr533970edh.16.1516094720595; Tue, 16 Jan 2018 01:25:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094720; cv=none; d=google.com; s=arc-20160816; b=Cml60HUyHzagAir3cxDkfhnRX+Dx8x8rb1zzwgFxdYzSPyrCWTkQQwdApDTm9XLyC+ xFuPulXqLiKCJCbt+Anprvk9NRPGncDjOVJmE+2XGLs0OvdnoW4PH/gBHEDMrFSV79y+ m3FTxDqB8wUYSq1n5dEWbHcgHGq2jNLZfcgZevtvyBwhHSYfrdcGhxJJiJIneut3++7a ed792PtlmnYeDPsFaX6ljYmtyP+xESrYlr28ZAW6kF91zPxyetxMikIb2h5FBRMtAIs3 Vz/n6CUSfFneyIM6biPcAci0as2Sz7/z1X7gdp5T+0Cyr9SV/RFUEoiiF9ffldQlpMhz 47Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=moGpK2o6SUX/RJEE+tgxT13LxM2lWnXU+AzzkSee2/M=; b=BEIqfxJWYNugRgmeD8+474/C0i/vsx23bhWAhlC95wTtl9sbjkDG/HZgJEcxTllnJB VMO+DFLGhasZ/tw/Gm7aQA/CTrHn7CnN8vwkquMtCA+wR01EswTU4b8RbKzQ8jwfvUk8 +4EM82Rp0mAHqUy3uM//vbRKGTjGaJItjWkQTSDlo1MZ/Ty11ZTInJEZ9RJq1EhiOUwK JFiXLu/9HIrAH4y0tVn5ZRbnKMqro15Lrnx9A6+5j4lKD+LymTbp/PRRh/Ltu2ldkQIg QWWgrWBgCai1NfG3uAwNazI+Jj+qBy3lvNdAqzI6Hpb7A0EeGkDdOt0zYXns3umBPOB+ iOgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id a4si1831028ede.29.2018.01.16.01.25.20; Tue, 16 Jan 2018 01:25:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 3D57AC21CA6; Tue, 16 Jan 2018 09:20:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D7145C21E64; Tue, 16 Jan 2018 09:17:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A528AC21CA6; Tue, 16 Jan 2018 09:17:03 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id D885BC21E24 for ; Tue, 16 Jan 2018 09:16:57 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id B24E0208BE; Tue, 16 Jan 2018 10:16:56 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 853EF20725; Tue, 16 Jan 2018 10:16:56 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:44 +0100 Message-Id: <15353dc08b0e32deaef9722f68cdc0f81a43752c.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 08/15] env: common: Make the debug messages play a little nicer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we have global messages to indicate what's going on, the custom messages in the environment drivers only make the output less readable. Make the common code play a little nicer by removing all the extra output in the standard case. Reviewed-by: Andre Przywara Signed-off-by: Maxime Ripard Reviewed-by: Simon Glass --- env/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/common.c b/env/common.c index 8167ea299264..c633502d68bb 100644 --- a/env/common.c +++ b/env/common.c @@ -78,7 +78,7 @@ void set_default_env(const char *s) puts(s); } } else { - puts("Using default environment\n\n"); + debug("Using default environment\n"); } if (himport_r(&env_htab, (char *)default_environment, From patchwork Tue Jan 16 09:16:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124636 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp947779lje; Tue, 16 Jan 2018 01:21:06 -0800 (PST) X-Google-Smtp-Source: ACJfBotHLEiNtiGBfSuR7kE851T+CpAUODvQtVX9SjyYWD5uV+/K1IKPpv/JbsZ9j3AlMDOIuypT X-Received: by 10.80.241.23 with SMTP id w23mr23328483edl.111.1516094466192; Tue, 16 Jan 2018 01:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094466; cv=none; d=google.com; s=arc-20160816; b=Z79GbgP+bwZVL+m3SHMuG9KzbAwnotQ/4pMysn9cP3eXJoHKMB6isIbnS/vaLKq86J Yc/zcoA/WbwhRJDur+WPfl9kevYN8FLQkEw5gxzh4zDP72ODmu3lk7mdI6zgj46K35ig y7fV/XIvUib2E71KKwNWhgN/uh1uM0FmdtdgLqdZk8+4r+nlTwsslW9aLDLv84DjPJ93 +zwG+YsuhLO1tQbb4OB9RJSdGJHbZepgaPp5U4b+rtMx4H1LyTvp0E+LlfAGU+6RS/dh mVPtjU2I0e40RxkPnr9YIvMofSDWcO2rJra0YnKdgOR5yG57Yq3c9P+wIFl2hFQVV8x5 4G9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=31LcMsSq81g2G6qCQt4f0OfACWyUK40zDD8C/Xdf3eQ=; b=yArAPuMUD9Mwp5A1TuHDI+3Qq0f8ZtvRUv5QUK8ihjN3gH3HWkHLhKOkZxQYlLoqIr Me8hE9NEO2rLipu4qiz0xFUJX6IIkYZvvhAqYvLkrOUiMO66f51vcNbkNzXhrb1InKCY vJbom2z0gzJvtUko04tGPeXFVYoVHzuvWXCL4MqhJPlcQyVMS4T7X2nTRe6AxC0pXrDR xBDdhIpHMydywKz7BKLlgWiBbpMzh0i6VHClGSYG/lsQHVCtGdd+wkIeO8vRiNVTjSJP iR66Qj4sK8HOakPBJ9PRh2RPmorMwjAFsqsfrQtzqLsTjpaJYX12MCDnXEaSlqM58j8A sxoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id n18si1881796edf.451.2018.01.16.01.21.05; Tue, 16 Jan 2018 01:21:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id A2711C21DB5; Tue, 16 Jan 2018 09:19:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BEE4AC21E6F; Tue, 16 Jan 2018 09:17:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A0AFFC21E33; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 4CC0BC21E16 for ; Tue, 16 Jan 2018 09:16:58 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 26426208B5; Tue, 16 Jan 2018 10:16:57 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id E8B0520725; Tue, 16 Jan 2018 10:16:56 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:45 +0100 Message-Id: <30edd1e4507d3818bd85070502b9a5819d0cdcc0.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 09/15] env: Support multiple environments X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that we have everything in place to support multiple environment, let's make sure the current code can use it. The priority used between the various environment is the same one that was used in the code previously. At read / init times, the highest priority environment is going to be detected, and we'll use the same one without lookup during writes. This should implement the same behaviour than we currently have. Reviewed-by: Andre Przywara Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 76 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/env/env.c b/env/env.c index 9dd4d4cb4d11..333fd71aad53 100644 --- a/env/env.c +++ b/env/env.c @@ -26,33 +26,59 @@ static struct env_driver *_env_driver_lookup(enum env_location loc) return NULL; } +static enum env_location env_locations[] = { +#ifdef CONFIG_ENV_IS_IN_EEPROM + ENVL_EEPROM, +#endif +#ifdef CONFIG_ENV_IS_IN_FAT + ENVL_FAT, +#endif +#ifdef CONFIG_ENV_IS_IN_FLASH + ENVL_FLASH, +#endif +#ifdef CONFIG_ENV_IS_IN_MMC + ENVL_MMC, +#endif +#ifdef CONFIG_ENV_IS_IN_NAND + ENVL_NAND, +#endif +#ifdef CONFIG_ENV_IS_IN_NVRAM + ENVL_NVRAM, +#endif +#ifdef CONFIG_ENV_IS_IN_REMOTE + ENVL_REMOTE, +#endif +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH + ENVL_SPI_FLASH, +#endif +#ifdef CONFIG_ENV_IS_IN_UBI + ENVL_UBI, +#endif +#ifdef CONFIG_ENV_IS_NOWHERE + ENVL_NOWHERE, +#endif + ENVL_UNKNOWN, +}; + +static enum env_location env_load_location; + static enum env_location env_get_location(enum env_operation op, int prio) { - if (prio >= 1) - return ENVL_UNKNOWN; - - if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) - return ENVL_EEPROM; - else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT) - return ENVL_FAT; - else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH) - return ENVL_FLASH; - else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC) - return ENVL_MMC; - else if IS_ENABLED(CONFIG_ENV_IS_IN_NAND) - return ENVL_NAND; - else if IS_ENABLED(CONFIG_ENV_IS_IN_NVRAM) - return ENVL_NVRAM; - else if IS_ENABLED(CONFIG_ENV_IS_IN_REMOTE) - return ENVL_REMOTE; - else if IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH) - return ENVL_SPI_FLASH; - else if IS_ENABLED(CONFIG_ENV_IS_IN_UBI) - return ENVL_UBI; - else if IS_ENABLED(CONFIG_ENV_IS_NOWHERE) - return ENVL_NOWHERE; - else - return ENVL_UNKNOWN; + switch (op) { + case ENVOP_GET_CHAR: + case ENVOP_INIT: + case ENVOP_LOAD: + if (prio >= ARRAY_SIZE(env_locations)) + return -ENODEV; + + env_load_location = env_locations[prio]; + return env_load_location; + + case ENVOP_SAVE: + return env_load_location; + } + + return ENVL_UNKNOWN; } From patchwork Tue Jan 16 09:16:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124632 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp947174lje; Tue, 16 Jan 2018 01:18:00 -0800 (PST) X-Google-Smtp-Source: ACJfBouBeBc5MAWWaayOIAH7l5C+vmaEYmsRGn6696Y9WSWeRaCwr0FGRur1teHA0Hv7VysrBYMD X-Received: by 10.80.150.35 with SMTP id y32mr52351451eda.175.1516094280096; Tue, 16 Jan 2018 01:18:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094280; cv=none; d=google.com; s=arc-20160816; b=L1pdkNYL+FqhMmZGr59PPJjI9bWqAA3Q8QmehMuJSzxyvzbU4tZDCObeXMWOj+dyb+ WTd7MTfQDkW7oougGfK+UZnektLXnGP5wHhVzINAYSksDB17ufsRjKUg1tsK302gIKx6 ZcFjytwk1eXKIMGqlfs87Tjg+Pb89Go4SKasnq300TLdL3J4YHmh5zjr083ebYkCRlwJ HGZrYQHENezqn4BflVBVoat2dvyV1kKoqg795dVyxrDEu/I5WvXs97Geo4CzQ+yQOrC4 a5NnCxrym36fAemQs81sf6BuPJ38H3JHAIGQheFCY0yjOkUGFQU8ZNrcLisJZrJ4UrWL Ed1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=yCFbq+T9n4PvzXu1vTuQvcedNi25C+jAIcdyewCZxzk=; b=FCdOnYVmbf5yI52n8bGA3223G6QbDtN/6IRe0i5++nUgH7yNR0Xv3SND1AMz6Y/tXS w6pXYfEv6t6ZGF8XjoVBL+/edoJU44DYncL9m4cRTwgbYKcr7CHhr2ibnpjDgK1bpMRV jrmGfC6+HFpIbNF1401JxIMw9Rzhxn9yElw+0oDv3CgoU459ZqX+QQ9msEUtGblkJKKU Bws2IQttAPcKSHooSp309cjhM+T6Uc2InC9dG/+zZ8aetdIvLpzjvmtPgqqbLPSunQZT O9tC/35Pt5Rsi8B0D0JDA1cEihCLlv12HTBweZQ1+RgpwVDlDiBs6cDU8opxkOLIvkw9 8x2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id o26si399846edf.195.2018.01.16.01.17.59; Tue, 16 Jan 2018 01:18:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id AAFE6C21E41; Tue, 16 Jan 2018 09:17:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 76A85C21E10; Tue, 16 Jan 2018 09:16:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B6633C21C4A; Tue, 16 Jan 2018 09:16:54 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 628F2C21CA6 for ; Tue, 16 Jan 2018 09:16:54 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 38C1D208B7; Tue, 16 Jan 2018 10:16:53 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0CF6720725; Tue, 16 Jan 2018 10:16:53 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:46 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 10/15] env: Initialise all the environments X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we want to have multiple environments, we will need to initialise all the environments since we don't know at init time what drivers might fail when calling load. Let's init all of them, and only consider for further operations the ones that have not reported any errors at init time. Signed-off-by: Maxime Ripard Reviewed-by: Simon Glass --- env/env.c | 36 +++++++++++++++++++++++++------- include/asm-generic/global_data.h | 1 +- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/env/env.c b/env/env.c index 333fd71aad53..75da2b921804 100644 --- a/env/env.c +++ b/env/env.c @@ -60,6 +60,23 @@ static enum env_location env_locations[] = { ENVL_UNKNOWN, }; +static bool env_has_inited(enum env_location location) +{ + return gd->env_has_init & BIT(location); +} + +static void env_set_inited(enum env_location location) +{ + /* + * We're using a 32-bits bitmask stored in gd (env_has_init) + * using the above enum value as the bit index. We need to + * make sure that we're not overflowing it. + */ + BUILD_BUG_ON(ARRAY_SIZE(env_locations) > BITS_PER_LONG); + + gd->env_has_init |= BIT(location); +} + static enum env_location env_load_location; static enum env_location env_get_location(enum env_operation op, int prio) @@ -126,6 +143,9 @@ int env_get_char(int index) if (!drv->get_char) continue; + if (!env_has_inited(drv->location)) + continue; + ret = drv->get_char(index); if (!ret) return 0; @@ -148,6 +168,9 @@ int env_load(void) if (!drv->load) continue; + if (!env_has_inited(drv->location)) + continue; + printf("Loading Environment from %s... ", drv->name); ret = drv->load(); if (ret) @@ -173,6 +196,9 @@ int env_save(void) if (!drv->save) continue; + if (!env_has_inited(drv->location)) + continue; + printf("Saving Environment to %s... ", drv->name); ret = drv->save(); if (ret) @@ -194,14 +220,10 @@ int env_init(void) int prio; for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) { - if (!drv->init) - continue; - - ret = drv->init(); - if (!ret) - return 0; + if (!drv->init || !(ret = drv->init())) + env_set_inited(drv->location); - debug("%s: Environment %s failed to init (err=%d)\n", __func__, + debug("%s: Environment %s init done (ret=%d)\n", __func__, drv->name, ret); } diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 73e036d6fd4a..fd8cd45b050e 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -50,6 +50,7 @@ typedef struct global_data { #endif unsigned long env_addr; /* Address of Environment struct */ unsigned long env_valid; /* Environment valid? enum env_valid */ + unsigned long env_has_init; /* Bitmask of boolean of struct env_location offsets */ unsigned long ram_top; /* Top address of RAM used by U-Boot */ unsigned long relocaddr; /* Start address of U-Boot in RAM */ From patchwork Tue Jan 16 09:16:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124631 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp947147lje; Tue, 16 Jan 2018 01:17:53 -0800 (PST) X-Google-Smtp-Source: ACJfBosPbcSqUJnmH7GtQBPuqHif7v0fU5yMOR6M+MMWZsRlaUjeQJDaKrobjW1dI05kX6YjDfTB X-Received: by 10.80.166.218 with SMTP id f26mr24581734edc.266.1516094273275; Tue, 16 Jan 2018 01:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094273; cv=none; d=google.com; s=arc-20160816; b=RuqC8yzVpFHDcngWkemiaaKDA75JSSq0qmCIXU2d5bX9FrGqagcrdqpIWv3ol7Z6Dn 96aL+KT9kINzOpxe05PeReUZYXhwRGc/TCQAJNGO4Vl8lXKBB2lVWhJt+5GjcjfPlmRq +z6M5dbCdIR1PtCuDdHucb+LzWpVvO21RIhT4ETCnSJBaj0RV3NrxxMGh1vtT6FdgTXe sMLZQP8KyJjsL25SvrrL/oBVwZndMzHDmqTSBHXsaLZEnhKlRHIxrK+F8Mm0s+2XVzK9 kCf6FEsN/x6LMvel0yya0MJOaLtzb/8uMbFBJ2GkqTeopW8eB4mvTKJuj0tHBpvUYSS5 fiFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=/PUPU+dz0sCykIIBS8N/mIr/BMmR9cnZFavVBW4cm8s=; b=d6QbTk6EYjl8Fp+qQfztSBI2mSmNiLY5FOAHaBwh54Kr6VNanzmluuZcH5lXbjwf+Q 3f3h6niNVTtgzG5oDNYi6OQT5zhqiCLS/hES6p18qgrYmS/gWCwot+4ywJcuxE7YEN4A 3N6gRGQo2fZDdihQxOAFy9+aOq/ChhezzKtbBUvKQ/fFjxoHYhnCjjyNCvt27+zLkTXM b7BTLT/eBJ5MlCKCAXkFclUeo/eRIgeduTZbjNLMf6aUaX/lc8eGe299td0I7SKhoUkc YQCnEmt9tofQ0SQK9XiLsUwSIiNq/6lRUSIjFbr0IX7Yz/FLaAYP35VIs3O6VNubvgG1 cDMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id w13si1953237edk.526.2018.01.16.01.17.52; Tue, 16 Jan 2018 01:17:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id A091CC21E1E; Tue, 16 Jan 2018 09:17:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3CFAAC21E30; Tue, 16 Jan 2018 09:16:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 075FDC21C4A; Tue, 16 Jan 2018 09:16:54 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id B8E49C21CA6 for ; Tue, 16 Jan 2018 09:16:54 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 859F1208BA; Tue, 16 Jan 2018 10:16:53 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5E54920725; Tue, 16 Jan 2018 10:16:53 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:47 +0100 Message-Id: <6e185efdebf7fb0138950441bf1667c5b1899803.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 11/15] env: mmc: depends on the MMC framework X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The raw MMC environment directly calls into the MMC framework. Make sure it's enabled before we can select it. Signed-off-by: Maxime Ripard Reviewed-by: Simon Glass --- env/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/env/Kconfig b/env/Kconfig index bef6e89bfc3c..ad5ccc253762 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -156,6 +156,7 @@ config ENV_IS_IN_FLASH config ENV_IS_IN_MMC bool "Environment in an MMC device" depends on !CHAIN_OF_TRUST + depends on MMC help Define this if you have an MMC device which you want to use for the environment. From patchwork Tue Jan 16 09:16:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124645 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948873lje; Tue, 16 Jan 2018 01:26:33 -0800 (PST) X-Google-Smtp-Source: ACJfBovHFySTJSnZDAWAy9Lu6FrETbdxViFxvMTHCQikAu7XtnF+gr7N7KpiRGJ7JVnpA96Dwrzt X-Received: by 10.80.241.215 with SMTP id y23mr24996911edl.204.1516094793816; Tue, 16 Jan 2018 01:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094793; cv=none; d=google.com; s=arc-20160816; b=NrqjrFbq+YQZQGJE4nZYYL49A0JPhkRc40gt14HEMEh6CUtH+WvAjt6HuXsRTtiNfG CEl3eJvTi39mEOtngNaXk+7aqHG5Pm5P6gUaBZDwAWwlT2Rc/dolGyvLL3nY8uM/rDD4 g//T0XAwqqHtzb/pOfwSlSxV3G1Wk6CglF9LypIwL1hkHYs1kmaL+lqE0o0xID1RoL7F tabV3DZxpEp3drD5XE5Zr3MY9Yyjf+kiLKx3lRrTSiqdza9VFBKyr/LfIRGhEotfCkO3 +n8gXtNxh5CoDam66k1GcXmAhuQyHO7wuTUSpckKyeMbTApNRhw8naHbqGqBnYROaLUI N9Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=JJD2lQnTgL1Qbokil7nNSg5A6zPsmoZCMqN4fd5oQRQ=; b=dQ/bjOjJNbLMxUWhPPAMVarvbrOjjkd1xEI1+2g1OCYPhzTxBD0nTCotKNSpFeOvH0 ZbNxmJ1T7KE/f57iofwzsrFOiAlhIpw0fHGj/Tk6vTeud26YjpXae83wvoaGneJn8jNX fi42yA0Ve8Qx6ZJqpRAPzNk1+T+1wQxrR8Z9LbS7uJtLnJcnVHsMUe71Z3AnRNmXmSRO 3lN9GDK/ZjfdKzHrfdwTudKPDmJJl4zyTUPYxLxiHunJL5ZX1Zi6MM3GKOKqOvlu9ovl b9qZ2PQhleTveTSX2LCVT5LsTg+uz1oPhrj3tAI9FFwDyYW7l+xXMAHH/APCyAlqSek9 NwNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id o63si1847622edb.23.2018.01.16.01.26.33; Tue, 16 Jan 2018 01:26:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 61E76C21E0A; Tue, 16 Jan 2018 09:20:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8C610C21DB0; Tue, 16 Jan 2018 09:17:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BEE02C21E64; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 50454C21E3E for ; Tue, 16 Jan 2018 09:17:00 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 2A455208BF; Tue, 16 Jan 2018 10:16:59 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id E5B2320725; Tue, 16 Jan 2018 10:16:58 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:48 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 12/15] env: Allow to build multiple environments in Kconfig X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that we have everything in place in the code, let's allow to build multiple environments backend through Kconfig. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- configs/MPC8313ERDB_NAND_33_defconfig | 1 +- configs/MPC8313ERDB_NAND_66_defconfig | 1 +- configs/cl-som-imx7_defconfig | 1 +- configs/microblaze-generic_defconfig | 1 +- env/Kconfig | 65 +++++++++++++--------------- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/configs/MPC8313ERDB_NAND_33_defconfig b/configs/MPC8313ERDB_NAND_33_defconfig index 823001583447..b761516d126a 100644 --- a/configs/MPC8313ERDB_NAND_33_defconfig +++ b/configs/MPC8313ERDB_NAND_33_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_DATE=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=e2800000.flash" CONFIG_MTDPARTS_DEFAULT="mtdparts=e2800000.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)" +# CONFIG_ENV_IS_IN_FLASH is not set CONFIG_ENV_IS_IN_NAND=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y diff --git a/configs/MPC8313ERDB_NAND_66_defconfig b/configs/MPC8313ERDB_NAND_66_defconfig index 2639926ab814..0f2a675ae2cf 100644 --- a/configs/MPC8313ERDB_NAND_66_defconfig +++ b/configs/MPC8313ERDB_NAND_66_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_DATE=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=e2800000.flash" CONFIG_MTDPARTS_DEFAULT="mtdparts=e2800000.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)" +# CONFIG_ENV_IS_IN_FLASH is not set CONFIG_ENV_IS_IN_NAND=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig index d37c82cafac1..0c93159032e5 100644 --- a/configs/cl-som-imx7_defconfig +++ b/configs/cl-som-imx7_defconfig @@ -41,6 +41,7 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y +# CONFIG_ENV_IS_IN_MMC is not set CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/microblaze-generic_defconfig b/configs/microblaze-generic_defconfig index 5254c0da790a..cc80e8a027c8 100644 --- a/configs/microblaze-generic_defconfig +++ b/configs/microblaze-generic_defconfig @@ -40,7 +40,6 @@ CONFIG_CMD_UBI=y # CONFIG_CMD_UBIFS is not set CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y -CONFIG_ENV_IS_IN_FLASH=y CONFIG_NETCONSOLE=y CONFIG_SPL_DM=y CONFIG_MTD_NOR_FLASH=y diff --git a/env/Kconfig b/env/Kconfig index ad5ccc253762..6e2fbf416c12 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -1,38 +1,18 @@ menu "Environment" -choice - prompt "Select the location of the environment" - default ENV_IS_IN_MMC if ARCH_SUNXI - default ENV_IS_IN_MMC if ARCH_EXYNOS4 - default ENV_IS_IN_MMC if MX6SX || MX7D - default ENV_IS_IN_MMC if TEGRA30 || TEGRA124 - default ENV_IS_IN_MMC if TEGRA_ARMV8_COMMON - default ENV_IS_IN_FLASH if ARCH_CINTEGRATOR - default ENV_IS_IN_FLASH if ARCH_INTEGRATOR_CP - default ENV_IS_IN_FLASH if M548x || M547x || M5282 || MCF547x_8x - default ENV_IS_IN_FLASH if MCF532x || MCF52x2 - default ENV_IS_IN_FLASH if MPC86xx || MPC83xx - default ENV_IS_IN_FLASH if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641 - default ENV_IS_IN_FLASH if SH && !CPU_SH4 - default ENV_IS_IN_SPI_FLASH if ARMADA_XP - default ENV_IS_IN_SPI_FLASH if INTEL_BAYTRAIL - default ENV_IS_IN_SPI_FLASH if INTEL_BRASWELL - default ENV_IS_IN_SPI_FLASH if INTEL_BROADWELL - default ENV_IS_IN_SPI_FLASH if NORTHBRIDGE_INTEL_IVYBRIDGE - default ENV_IS_IN_SPI_FLASH if INTEL_QUARK - default ENV_IS_IN_SPI_FLASH if INTEL_QUEENSBAY - default ENV_IS_IN_FAT if ARCH_BCM283X - default ENV_IS_IN_FAT if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS - default ENV_IS_NOWHERE - help - At present the environment can be stored in only one place. Use this - option to select the location. This is either a device (where the - environemnt information is simply written to a fixed location or - partition on the device) or a filesystem (where the environment - information is written to a file). - config ENV_IS_NOWHERE bool "Environment is not stored" + depends on !ENV_IS_IN_EEPROM + depends on !ENV_IS_IN_FAT + depends on !ENV_IS_IN_FLASH + depends on !ENV_IS_IN_MMC + depends on !ENV_IS_IN_NAND + depends on !ENV_IS_IN_NVRAM + depends on !ENV_IS_IN_ONENAND + depends on !ENV_IS_IN_REMOTE + depends on !ENV_IS_IN_SPI_FLASH + depends on !ENV_IS_IN_UBI + default y help Define this if you don't want to or can't have an environment stored on a storage medium. In this case the environemnt will still exist @@ -74,6 +54,8 @@ config ENV_IS_IN_EEPROM config ENV_IS_IN_FAT bool "Environment is in a FAT filesystem" depends on !CHAIN_OF_TRUST + default y if ARCH_BCM283X + default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS select FAT_WRITE help Define this if you want to use the FAT file system for the environment. @@ -84,6 +66,13 @@ config ENV_IS_IN_FAT config ENV_IS_IN_FLASH bool "Environment in flash memory" depends on !CHAIN_OF_TRUST + default y if ARCH_CINTEGRATOR + default y if ARCH_INTEGRATOR_CP + default y if M548x || M547x || M5282 || MCF547x_8x + default y if MCF532x || MCF52x2 + default y if MPC86xx || MPC83xx + default y if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641 + default y if SH && !CPU_SH4 help Define this if you have a flash device which you want to use for the environment. @@ -157,6 +146,11 @@ config ENV_IS_IN_MMC bool "Environment in an MMC device" depends on !CHAIN_OF_TRUST depends on MMC + default y if ARCH_SUNXI + default y if ARCH_EXYNOS4 + default y if MX6SX || MX7D + default y if TEGRA30 || TEGRA124 + default y if TEGRA_ARMV8_COMMON help Define this if you have an MMC device which you want to use for the environment. @@ -294,6 +288,13 @@ config ENV_IS_IN_REMOTE config ENV_IS_IN_SPI_FLASH bool "Environment is in SPI flash" depends on !CHAIN_OF_TRUST + default y if ARMADA_XP + default y if INTEL_BAYTRAIL + default y if INTEL_BRASWELL + default y if INTEL_BROADWELL + default y if NORTHBRIDGE_INTEL_IVYBRIDGE + default y if INTEL_QUARK + default y if INTEL_QUEENSBAY help Define this if you have a SPI Flash memory device which you want to use for the environment. @@ -359,8 +360,6 @@ config ENV_IS_IN_UBI You will probably want to define these to avoid a really noisy system when storing the env in UBI. -endchoice - config ENV_FAT_INTERFACE string "Name of the block device for the environment" depends on ENV_IS_IN_FAT From patchwork Tue Jan 16 09:16:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124639 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948178lje; Tue, 16 Jan 2018 01:23:06 -0800 (PST) X-Google-Smtp-Source: ACJfBovvqFKu3HRQrnTUvxnQto4sNsIQhh9ZqHplm6Aw8AXwIyGXhu0w04lqZP67i79qUpXhkSPx X-Received: by 10.80.144.233 with SMTP id d38mr17468239eda.291.1516094586502; Tue, 16 Jan 2018 01:23:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094586; cv=none; d=google.com; s=arc-20160816; b=XR8doI/FDKx2z6cZGJs54wkFAE3La61kXu/l1qowphN7EbFebBLY1myof1kE5XHbco 7WduQEtPugrctBWLWOQCZwoQgYFX5f642/CWW+ca1KGnMQSGG42/EKZYf+S3R8VSQsFT JpgGC8u3OQD6tme9CG0Qpg+fyau1CmaQk9MjR1KIkBoMyKyRT+fJ5Kn2PQW6dqrJNT3e RWQge1iPSF8kGJnspRNaXc7vd0iRum9mHonUBxJc2UvHI3D4hAno++1e2v1Paf66H2HD lUs0Rmf2aD7TVZm3xxV7Kg0LeAYEAN3y+XBBX4ibGW7Xix+JGi0ejkCpQl1Mh+leMocT NwXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=T7eUVOM9gzltrbPDPoivD5KkFupNAa6370EQWhHJE2k=; b=BKiSrPvb3WapRU+pYgqcUJ+HgME3+lMsax20W8N38Yxv+IlwIuFRR0uZ7RxDc7MCfp UKnuKNpxrk4hZtp/qfkApivs73QcNjzbuE4+ILN8TQA07DPJxxcLj1y4Eb4ymAwEyYqD JXA7dyNEWokwdnCdCXnrJ4qi084h5TfYXVDEhA4xkMitppuJlZRuiV0Dn6Qe91Lj2C9j JREhTWszchlaNR8lbLYHu3xouoG78aXUbaed6REbZyx8yIcmQMyKejSiJSDu0fu4WJIA ijaVRxtdaWc1ulMRpG+7zSTtAn0RjwdW0n9LYFGZ7YG/qH/1wblIQIZeKQsPEtCfcC+s mVxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 5si1838746edy.276.2018.01.16.01.23.06; Tue, 16 Jan 2018 01:23:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 19380C21E57; Tue, 16 Jan 2018 09:21:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4D90BC21E9C; Tue, 16 Jan 2018 09:17:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 48B46C21E31; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 140DBC21E0F for ; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E0C11208B7; Tue, 16 Jan 2018 10:16:57 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id B3B1420725; Tue, 16 Jan 2018 10:16:57 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:49 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 13/15] env: Mark env_get_location as weak X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Allow boards and architectures to override the default environment lookup code by overriding env_get_location. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Signed-off-by: Maxime Ripard Reviewed-by: Simon Glass --- env/env.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 75da2b921804..6d0ab8ebe1a4 100644 --- a/env/env.c +++ b/env/env.c @@ -79,7 +79,25 @@ static void env_set_inited(enum env_location location) static enum env_location env_load_location; -static enum env_location env_get_location(enum env_operation op, int prio) +/** + * env_get_location() - Returns the best env location for a board + * @op: operations performed on the environment + * @prio: priority between the multiple environments, 0 being the + * highest priority + * + * This will return the preferred environment for the given + * priority. This is overridable by boards if they need to. + * + * All implementations are free to use the operation, the priority and + * any other data relevant to their choice, but must take into account + * the fact that the lowest prority (0) is the most important location + * in the system. The following locations should be returned by order + * of descending priorities, from the highest to the lowest priority. + * + * Returns: + * an enum env_location value on success, a negative error code otherwise + */ +__weak enum env_location env_get_location(enum env_operation op, int prio) { switch (op) { case ENVOP_GET_CHAR: From patchwork Tue Jan 16 09:16:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124641 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948551lje; Tue, 16 Jan 2018 01:24:59 -0800 (PST) X-Google-Smtp-Source: ACJfBotXJA6GTpj9xV19RCZF6T/9Om9nTjVyY1hxMWvBuyRTagxRuXw1qzGBUeLhWn+8LJLCeryp X-Received: by 10.80.173.45 with SMTP id y42mr23183513edc.247.1516094699669; Tue, 16 Jan 2018 01:24:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094699; cv=none; d=google.com; s=arc-20160816; b=gLxYcmM5R9EBRFwYwfID3lh25wc7y0kpp+4C0gXdGsKsG4Qg5l0D78u9fnwcGgMStC BiWFnJGF9azehOk2eWZTuR3xyKbWiXqems3giqb2x2n+K0BtNygW4MzHbo94UEzUQF+Y 1yM7kS+/8/XMJJFmwkQJ4vuF+hoMGTh+1Lf8WWEhcQ/Iq/CgjtIq8xI25YQsUM6Niixb U/NIAtW0n+Q00731YY7+HpZqq1nMCra+1JDW/d40Ig7flfhUpUpTodzfi6hddK6x7409 kCZwa+rppAf5Ie4IPTzfOsvWLEKWCS+k7C9bWROiszIsP4E72UKIDnBbdayw4GW9Um5T QI9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=qJ/06Su1fCfvNMjpHEPcY1JIrzz+FtNAjhQ0cjKxU1Y=; b=Po4gmL3Yw8K5X7U3ZpZZ3Z5bFC7sKPqRBLYr96ClmLs/+GJjSEP9auX5S6JUciOiGl 2vbchXJ/IsHRiOuZSazahb/0v/bKe+tjN2KSCWfQfhIGxcrNWIkjWlUO2pOdjuvTl9fd 3uw3W2eyexb9fYtLzDuflRW+YwKzvkYKrurnecSltm7eTmzP+c40IOyB360pxnKJrWTY XMET5ncs0GETKC5W5FJ9IfNxvkQ5HpJOY1WiQFjaqFP8jGRQeACAg4FHSI/qEFxyoDtK dyADedAxP6Jce5QULoo+B3teWFpc7287+JKxxFjq8bz0THDOvvmM2Z6S/K/ipEWHEHTU GnZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 35si1024862edl.30.2018.01.16.01.24.59; Tue, 16 Jan 2018 01:24:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 300EAC21E0A; Tue, 16 Jan 2018 09:21:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9CB6AC21E99; Tue, 16 Jan 2018 09:17:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0327CC21E26; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 769A5C21E31 for ; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 51384208BB; Tue, 16 Jan 2018 10:16:58 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 231C720725; Tue, 16 Jan 2018 10:16:58 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:50 +0100 Message-Id: <679e3edb8433e93229fbbce13b563b2ad440d612.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 14/15] sunxi: Transition from the MMC to a FAT-based environment X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The current environment has been hardcoded to an offset that starts to be an issue given the current size of our main U-Boot binary. By implementing a custom environment location routine, we can always favor the FAT-based environment, and fallback to the MMC if we don't find something in the FAT partition. We also implement the same order when saving the environment, so that hopefully we can slowly migrate the users over to FAT-based environment and away from the raw MMC one. Eventually, and hopefully before we reach that limit again, we will have most of our users using that setup, and we'll be able to retire the raw environment, and gain more room for the U-Boot binary. Reviewed-by: Lukasz Majewski Signed-off-by: Maxime Ripard --- board/sunxi/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index dcacdf3e626d..8891961dcc6b 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -173,6 +173,22 @@ void i2c_init_board(void) #endif } +#if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT) +enum env_location env_get_location(enum env_operation op, int prio) +{ + switch (prio) { + case 0: + return ENVL_FAT; + + case 1: + return ENVL_MMC; + + default: + return ENVL_UNKNOWN; + } +} +#endif + /* add board specific code here */ int board_init(void) { From patchwork Tue Jan 16 09:16:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124646 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948982lje; Tue, 16 Jan 2018 01:27:05 -0800 (PST) X-Google-Smtp-Source: ACJfBov2GB4W7vrrk763kBUoDd6K6D4SGX1Dry0e/os+9yd3FqCizWcnCM2Usr0I+1P742zvloL5 X-Received: by 10.80.202.193 with SMTP id f1mr10020841edi.30.1516094825869; Tue, 16 Jan 2018 01:27:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094825; cv=none; d=google.com; s=arc-20160816; b=qo7BE6ol4zMGgbsFl7f0yyHaIKngm0d1jiZbMvyMrVcwwL35IOij8L6xd3ooe6i4Hr 5raxiVRY2rfCFXr3qDp+s3KJwWL6ajbN4ifUPjH7en9j1Bu9B2kTh4zD2hg5Dr0bXNJ6 9ULpsxd9njg72xYVxro8yiZrUeghn8rioZrelCmHlnaTSrn7ZTHXtE9RyNf/g0cOK9j2 JmwGk3DufYNpcPFqs62CLWbESoIvyMWSwwvtuSwGI6rTTZBU7h3oog+k6DxzmXIN8g/b rHr6F3lsgWqvYtUL1eEyjArK59Dh+a2D8CUaemBa/8bYkE33i82dV3lclNaG2fKxkbhu K70Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=slCPTX+MOUChmi/qMMX6PfbnM4bmc5ROJAH/7G7G1Bw=; b=GIXwT/MbE6dUQqVepOuZB78B9DIWQpgmMBMfCvBZkLBaFskWprPqicE2zHawbEkBM+ fhprn3NQBf2ywMtxoCJlHRduueBO8AX9AiXnoNYISu0YBnmaWWh8VTO3X96S13/lg+f6 a3KpWxzv8OTEzhuOmkSUaKGBS+MDv33CgqZetlY89oPNK5C4MZg1e/tc/FUcqkoFaP7U PmngLG/gLF48/5S9KqyYs96CqHKf6piOcVSaGibOEU53Jq6fncA//yGoCxFnahx7c3oJ iFaQk9JEHuYTjimpY6a1h9QC+9ZbfgixmXMZb1gCNqx/Xu90K3T0N6RdxLg/bsJQ81eT OBLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id g3si165724edc.336.2018.01.16.01.27.05; Tue, 16 Jan 2018 01:27:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 5B75FC21DCE; Tue, 16 Jan 2018 09:20:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 29E4DC21E97; Tue, 16 Jan 2018 09:17:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 31228C21DE4; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id D63ACC21E40 for ; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id B26AA208BA; Tue, 16 Jan 2018 10:16:58 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 868A220725; Tue, 16 Jan 2018 10:16:58 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:51 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 15/15] env: sunxi: Enable FAT-based environment support by default X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that we have everything in place to implement the transition scheme, let's enable it by default. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Signed-off-by: Maxime Ripard --- env/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/env/Kconfig b/env/Kconfig index 6e2fbf416c12..d1bf75ab41ca 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -55,6 +55,7 @@ config ENV_IS_IN_FAT bool "Environment is in a FAT filesystem" depends on !CHAIN_OF_TRUST default y if ARCH_BCM283X + default y if ARCH_SUNXI && MMC default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS select FAT_WRITE help @@ -363,6 +364,7 @@ config ENV_IS_IN_UBI config ENV_FAT_INTERFACE string "Name of the block device for the environment" depends on ENV_IS_IN_FAT + default "mmc" if ARCH_SUNXI default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91 help Define this to a string that is the name of the block device. @@ -372,6 +374,8 @@ config ENV_FAT_DEVICE_AND_PART depends on ENV_IS_IN_FAT default "0:1" if TI_COMMON_CMD_OPTIONS default "0:auto" if ARCH_ZYNQMP + default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 + default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 default "0" if ARCH_AT91 help Define this to a string to specify the partition of the device. It can