From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92243C43334 for ; Mon, 20 Jun 2022 16:08:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B151280F7C; Mon, 20 Jun 2022 18:08:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=hitachienergy.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=hitachienergy.com header.i=@hitachienergy.com header.b="bnkX02lz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B7E4182064; Mon, 20 Jun 2022 18:08:37 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0703.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::703]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C215880166 for ; Mon, 20 Jun 2022 18:08:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=hitachienergy.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=holger.brunck@hitachienergy.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OwX9apqcxWBvg42ncAwWwd001e9lu3ySeET57KJns9Elg/rwnltzfwyy1nGHhih0VZT5PmKPiOr9tPtKdbanOGvTBE9Z1hzfra/KNZzS9RmJ9R0vw+frIdpAXuC7nqvDVz8Nrv/xVYTVdPuba4LcdKlW0/pxLkSZO3kynL5msh1DoGfjFV19FgMqw1muQ31laB06lZkVeuB4xVxCSh3jsHOAwpm9OqnZ/Y6GfDrZo8jJ6D7d1NOW9ZXwdofb1BFc7b+ABPeaSDvAmrNKD3NTSlZFhm6SWOWmd4qq7BfL+7RjP0q9UCjfMdV7HJETKm3PNagveO1j/HgHBT6zstWb/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tqLvedvkOqHIDDT1hpcYMCYD2Vrt4XH36FfaY1HUQMg=; b=QsJ9pijht3IMZnT3HVrkAS5bBtufn0fDqtyTTQTl+NxslZxEhUaoHyYcl7WIjPKQHsH3lUZxyQ73B0mL0HkyYU+Y1SztOqQMEk4X9UKaKeZ0IZpPOMGyclfAdDLg5yLtG0BJHn3aL1iAamvi+3LYQrs2C/yUBmZG/63QPwwJmO2ic3GXxqLS8fY91T84jxbVFcUMYN2N03rlMsTfSqGQMd0sGiaVuh5b+bkLZ3SocA8PJ2dhrgcjrMyRZ3P9S0EAsrUthskT8OzaqJorEPqwZ3/O3Qvsyooz8Len1Z8/ehxL90I8KrzvGcSqg9uRmGzzch00eEul+tZ9CzlagKjaqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hitachienergy.com; dmarc=pass action=none header.from=hitachienergy.com; dkim=pass header.d=hitachienergy.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hitachienergy.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tqLvedvkOqHIDDT1hpcYMCYD2Vrt4XH36FfaY1HUQMg=; b=bnkX02lzAq5p8xqg7ofuLDQSaJAid+OX3rlh63MduvrbF+O9IyaXdvUN+oH7NuoYWYgGhIsXLxy1l05cWWJfS83K5Kpx1EQadquXS8+F+wIA0i4kOxO93/UR9Tn5OGFmNh346kWjveNmsf4k5GaJ59HTn7PCqO9MaH+FaguoHWsBBS6dsR8TIZE5vetqIYckm9D2nsEF5qt/UFzonkRIiZxFCtZ/6ttjvdCq2aeVRSMLvB/uePaVp5K412y33DW1yWploY9cF1tdcmk/nfeczx2Bc9bF2I7fLRmscOH+tHioAsMe1qo/L4EIoEzORDAeg3e2QSRNl1oXvq0/SD621w== Received: from DB9PR06MB7289.eurprd06.prod.outlook.com (2603:10a6:10:218::16) by PR3PR06MB7019.eurprd06.prod.outlook.com (2603:10a6:102:8a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Mon, 20 Jun 2022 16:08:33 +0000 Received: from DB9PR06MB7289.eurprd06.prod.outlook.com ([fe80::a9d8:d42f:5b3b:87ec]) by DB9PR06MB7289.eurprd06.prod.outlook.com ([fe80::a9d8:d42f:5b3b:87ec%8]) with mapi id 15.20.5353.016; Mon, 20 Jun 2022 16:08:33 +0000 From: Holger Brunck To: Tom Rini CC: Aleksandar Gerasimovski , Francis Laniel , "u-boot@lists.denx.de" , Marek Behun , Michael Nazzareno Trimarchi , Simon Glass , Wolfgang Denk , Harald Seiler , Heiko Schocher Subject: RE: [RFC PATCH v4 28/28] board: keymile: common: Use environment to store IVM_* variables. Thread-Topic: [RFC PATCH v4 28/28] board: keymile: common: Use environment to store IVM_* variables. Thread-Index: AQHYgllNGRN573t22UOy9tEnL/tDKa1YY/zAgAADp7CAAApIgIAABiAw Date: Mon, 20 Jun 2022 16:08:32 +0000 Message-ID: References: <20220616223158.9225-1-francis.laniel@amarulasolutions.com> <20220616223158.9225-29-francis.laniel@amarulasolutions.com> <20220617144821.GY2484912@bill-the-cat> <20220620153503.GN2484912@bill-the-cat> In-Reply-To: <20220620153503.GN2484912@bill-the-cat> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-processedbytemplafy: true authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=hitachienergy.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5203b2ef-46c9-46c5-9075-08da52d71ff7 x-ms-traffictypediagnostic: PR3PR06MB7019:EE_ x-microsoft-antispam-prvs: x-he-o365-outbound: HEO365Out x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FDf0HymCYKT3VRu3hY/kK+LAQZrTepAWpvRj2FbkJlsuDwRgE6SQ4lpGf/lRGGjmI9Y8WXCYWeJ6yECAnvS8E1VljcnlL3ttJHCR1TEYjO3DkaC4M9IhZ50aK7YNh7ccB+qIarRyTW72AYYqxRbE7pk2E78sNmb9nEX8KFa1CU9rZiaiUFWVIhV+4b+BXhGtZuUPsfZymK11tt7kNNHEP6xivhSbJ0OrqfaFuDspTKEg2RfMa0IMFH+IdCl8CAqtGq3+qJoGyUkIc041KKLF+aE05R0N03PL83G7TtYTESt1AKOzp3sh5ExyCRp6g0N+EP9HO+2vQT+qq88NWrPpZWvFDE0xcsLJme7/hpIsEM+Lj2vXlRxLMQhrstXpixmE7gbTDUi2d/rr9s8GK+0xPv0j3+wp2VzTAoD+4CwaFQV9bO+olu4kubMMdn5c0YYvGTczUbmOnYTjJ6+ynRmsMvwe60rgeuUhDyrhJ5R08QH5TvFkS06Y972jyNXXVM9FwOpuLjnk34/WelUvqjF6WS+hgtcBcACSJTdlb+59IcpYm3LTUv3DoRudFiHrt3M2eqBndXYGG+Z9Eq7BXMdiagEk6iStzszgvpT+kgUQ6DDmL5lnUlSVUr9pUXFc5qaOxCvBaIFsURoLBU/Uv7VamVxZDKKYarqpEETCWOnJEXoF56F2A2UkENJzkpP529hirGcu5yC2UOPczJxCNhsdIg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR06MB7289.eurprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(39860400002)(366004)(396003)(346002)(6506007)(38100700002)(9686003)(26005)(5660300002)(54906003)(7696005)(55016003)(41300700001)(2906002)(6916009)(33656002)(8936002)(44832011)(52536014)(66946007)(8676002)(76116006)(66446008)(83380400001)(478600001)(71200400001)(4326008)(66556008)(38070700005)(82960400001)(86362001)(186003)(122000001)(66476007)(64756008)(316002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?SQGrt1qJ1zukHifcSLae8w6a1EBjBu5epDf6FxNdW8yiSRsJyAFy/mIkBki4?= =?us-ascii?Q?HiKGP4BZbk/0EuwJidyEI2Q/Qu0QlDcntmuzKieWoWi8J72HlPFcdn/+ryt9?= =?us-ascii?Q?N1CVsorL/KjLSoXF5UTxu/FZXgkaUHvnsRjiDKi4rv50ULuyRVbbpryUIp/k?= =?us-ascii?Q?V56AyrHK/ZFqEvzHG2IEtsDHPXQktNv10LZu/QR3hbLmIRXRgry2rDTKJbIP?= =?us-ascii?Q?QDhWirdrhSakIpo+jdjpep8pGpAaS8aVHgpNC4T3mq/wrIF6GxeeevkiEHV8?= =?us-ascii?Q?bAw9/ycLwE9fMG2bqKT9FqvYMIDclK5/hTQtkTth/4FiQrPt8sJ+6sR44GnM?= =?us-ascii?Q?8pv3Xr4dYvRNG0i8oPA0vOYHT/EmxPeksWWpA6SaYzEnqTRRJDDNY9z9c4ki?= =?us-ascii?Q?qlDrcEHxqeDwcHhOFodI8K6Gcc2GNC9uN8S6oGJIl57hQGGL8ABXBPlSC/rY?= =?us-ascii?Q?DGCBTLhJ9urykV1E2UrbAY8WPSoBLUWoh9RmHof6oA5jvNZU0sHf5JNPDPhF?= =?us-ascii?Q?v6N3QTBVV8mvSs9aP0arrZ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ii?Q?XSHHX24t41XW0vPe/00j2i2IC3urqKnLxoImtwV6RWk0EWh54VSBBoC/3cVD?= =?us-ascii?Q?OuS036By5+0SXKZYMA0Gd7DbPtrdBKIF+SnO1KmNoYxfzeWbeAlIsvDNqSrW?= =?us-ascii?Q?KiulcaI/iOea6A+kjYZAM8NnK1Hq1coDYBwRYDUDgP2OTg54wTIngrY2SALs?= =?us-ascii?Q?QUl8nZAZxuv6B7bjJ2fdIcfSRgkyb0rCrUzpMteRZpUKAdknCOClORZ4hdhi?= =?us-ascii?Q?AmXU7DY2xaJ3Ua/5Ew0H+QrnEG6J+V6E3eznTqj+DtfLyHtDuGP739/geFxp?= =?us-ascii?Q?PKGfs7tehhXRMfdGQhkmhC0O4Pt+924=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hitachienergy.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DB9PR06MB7289.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5203b2ef-46c9-46c5-9075-08da52d71ff7 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2022 16:08:33.3485 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7831e6d9-dc6c-4cd1-9ec6-1dc2b4133195 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6qW/Zy/DJxxqrjHCIZTEQSriOdta/N+bOvoYyjAzSg88niq6smvme3g83p3LgaxCdhhvVv1Iz7bf+85Em1XaX4H+IMqnudVxe5tMCMZBvSU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR06MB7019 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean > > > On Fri, Jun 17, 2022 at 12:31:58AM +0200, Francis Laniel wrote: > > > > > > > These boards used set_local_var() to store some variables as local = shell. > > > > They then used get_local_var() to retrieve the variables values. > > > > > > > > Instead of using local shell variables, they should use > > > > environment ones (like a majority of board). > > > > So, this patch converts using local variables to environment ones. > > > > > > > > why do we need to change that? It is intended that we use this hush > > variable infrastructure from u-boot (common/hush.c) for our IVM data > > and not the standard env. We read the IVM at boot time and store these > > values in RAM. It is not intended to store them permanently in the > > flash or wherever the environment is saved. Especially in our case we > > have some boards where the environment is in a i2c EEPROM and we don't > > want to write down to the EEPROM each time when the board is starting. >=20 > So, the whole series is about updating hush to bring in a new baseline ve= rsion of > the shell, from busybox. >=20 Ok. > > > > Signed-off-by: Francis Laniel > > > > > > > > --- > > > > board/keymile/common/common.c | 8 ++++---- > > > > board/keymile/common/ivm.c | 9 +-------- > > > > 2 files changed, 5 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/board/keymile/common/common.c > > > > b/board/keymile/common/common.c index 3999f48719..72939af36e > > > > 100644 > > > > --- a/board/keymile/common/common.c > > > > +++ b/board/keymile/common/common.c > > > > @@ -219,7 +219,7 @@ static int do_setboardid(struct cmd_tbl > > > > *cmdtp, int > > > flag, int argc, > > > > unsigned char buf[32]; > > > > char *p; > > > > > > > > - p =3D get_local_var("IVM_BoardId"); > > > > + p =3D env_get("IVM_BoardId"); > > > > if (!p) { > > > > printf("can't get the IVM_Boardid\n"); > > > > return 1; > > > > @@ -228,7 +228,7 @@ static int do_setboardid(struct cmd_tbl > > > > *cmdtp, int > > > flag, int argc, > > > > env_set("boardid", (char *)buf); > > > > printf("set boardid=3D%s\n", buf); > > > > > > > > - p =3D get_local_var("IVM_HWKey"); > > > > + p =3D env_get("IVM_HWKey"); > > > > if (!p) { > > > > printf("can't get the IVM_HWKey\n"); > > > > return 1; > > > > @@ -272,14 +272,14 @@ static int do_checkboardidhwk(struct cmd_tbl > > > *cmdtp, int flag, int argc, > > > > * first read out the real inventory values, these values are > > > > * already stored in the local hush variables > > > > */ > > > > - p =3D get_local_var("IVM_BoardId"); > > > > + p =3D env_get("IVM_BoardId"); > > > > if (!p) { > > > > printf("can't get the IVM_Boardid\n"); > > > > return 1; > > > > } > > > > rc =3D strict_strtoul(p, 16, &ivmbid); > > > > > > > > - p =3D get_local_var("IVM_HWKey"); > > > > + p =3D env_get("IVM_HWKey"); > > > > if (!p) { > > > > printf("can't get the IVM_HWKey\n"); > > > > return 1; > > > > diff --git a/board/keymile/common/ivm.c > > > > b/board/keymile/common/ivm.c index 67db0c50f4..e266d7ce81 100644 > > > > --- a/board/keymile/common/ivm.c > > > > +++ b/board/keymile/common/ivm.c > > > > @@ -44,14 +44,7 @@ static int ivm_calc_crc(unsigned char *buf, int > > > > len) > > > > > > > > static int ivm_set_value(char *name, char *value) { > > > > - char tempbuf[256]; > > > > - > > > > - if (value) { > > > > - sprintf(tempbuf, "%s=3D%s", name, value); > > > > - return set_local_var(tempbuf, 0); > > > > - } > > > > - unset_local_var(name); > > > > - return 0; > > > > + return env_set(name, value); > > > > this means we are now writing always down to the permanent environment > > or? And this I would really like to avoid in our case. >=20 > Note that "env_set" does not force a save of the running environment. Ah yes you are right. But still for the first boot of our board we will cal= l saveenv to store an initial environment and with this change it would also write do= wn the IVM data which is currently only stored temporary in RAM. > These variables will be exposed to the CLI run-time, which I am not sure = if they > are today, so if the user then does "saveenv" they will be written. That= I think > would be a functional difference. >=20 yes exactly and I wonder if this functionality will be also possible after = the rework. I mean our use case (even it seems we are the only ones using it) is quite = useful I think. We read out inventory data from an EEPROM and they are parsed and temporary stored in RAM and then we are able to use them as any other environment variables without the need to store them permanently. I also wo= uld like to avoid this as the data should be permanently in the IVM only and no= t stored a second time permanently in flash. Best regards Holger