From patchwork Mon Oct 2 01:15:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841880 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=h4SYp1RU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNhn16v6z1ypx for ; Mon, 2 Oct 2023 12:31:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C7D7B8714F; Mon, 2 Oct 2023 03:17:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="h4SYp1RU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 41398870CE; Mon, 2 Oct 2023 03:17:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A25F687213 for ; Mon, 2 Oct 2023 03:16:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-3513fa06bafso39326805ab.3 for ; Sun, 01 Oct 2023 18:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209364; x=1696814164; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2hfv81wnUOYZOEjODEIzSWXAm1vxcGBUol+0KBIOf2M=; b=h4SYp1RUG7VcP4fzRwcsfBlOTbyt7FNJEkjr79V/4i2c8MldWwZ235uqnVJSK1M4Gs dbLdv30IsWSe4dAACiefzZ2S38e21uM95+spxMa2zIGtxZmA5nrp6xtpf0XM00/Zw+Tp VfVO41Pt9e2OR1lOArhOKRje+ooF15jnACh9I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209364; x=1696814164; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2hfv81wnUOYZOEjODEIzSWXAm1vxcGBUol+0KBIOf2M=; b=DsdIaY7MWXDVwiHeYFpXKrJQEth+DT90qZe3C3pBGVKywYc6tilehF2/Vvqh1JlJsw peBcwhNM+5K6BI7YUIvsuLzPV8eR1umticqMQXsmzI3WJUn21YXzmDGzazR7dWiZkXVb 6FGZxfLtDV2RvchNDUUcSYZWcHMDYtQFZ9Dp7tg9HbpiAwWn/jqrWLHPRfl8PpWvQARC jrSsYJeO5H6EQjaATgTpCCkNwnQ50ZGy8P1r+wWed8wmm/ZC71liJ2T+RUNzCIekkxvE AkVxxFWPndjHpCNddyq75acs5OGDT/SBw2h11mjVv3EKidTH/LmkRZTSF1tZ/nVYKt1i U2xA== X-Gm-Message-State: AOJu0Yx80XrgQpaHpNBicNtXDq8iaBzBDlod1rNdG4rlIKKv67vyJVKB VgBPVM2LMgZHL0Phzrh3ls8rSvMZ3QgJVEw4Fxc= X-Google-Smtp-Source: AGHT+IG3pRrbYeCXeBeu+604ipbsNLlKv6QC+SmHorlPhPkye59sUQ1T51+VfSoRfzZP+WjEK+IFxg== X-Received: by 2002:a05:6e02:1561:b0:351:4f0c:b968 with SMTP id k1-20020a056e02156100b003514f0cb968mr13243018ilu.19.1696209364034; Sun, 01 Oct 2023 18:16:04 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , AKASHI Takahiro , Michal Suchanek , Rasmus Villemoes , Sean Anderson , Stefan Roese Subject: [PATCH 01/34] test: Run tests that don't need devices Date: Sun, 1 Oct 2023 19:15:11 -0600 Message-ID: <20231002011553.463514-2-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Tests without the UT_TESTF_SCAN_FDT flag are currently skipped unless OF_LIVE is enabled. Drop this condition, so that they can run on non-sandbox builds, which often don't have OF_LIVE enabled. Signed-off-by: Simon Glass --- test/test-main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test-main.c b/test/test-main.c index 778bf0a18a0f..2a3b2ba364a8 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -476,8 +476,7 @@ static int ut_run_test_live_flat(struct unit_test_state *uts, * (for sandbox we handle this by copying the tree, but not for other * boards) */ - if ((test->flags & UT_TESTF_SCAN_FDT) && - !(test->flags & UT_TESTF_LIVE_TREE) && + if (!(test->flags & UT_TESTF_LIVE_TREE) && (CONFIG_IS_ENABLED(OFNODE_MULTI_TREE) || !(test->flags & UT_TESTF_OTHER_FDT)) && (!runs || ut_test_run_on_flattree(test)) && From patchwork Mon Oct 2 01:15:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841879 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=OSCXiSB9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNhg3Yrxz1ypx for ; Mon, 2 Oct 2023 12:31:31 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D7FEC8721C; Mon, 2 Oct 2023 03:17:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OSCXiSB9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E7DF8710D; Mon, 2 Oct 2023 03:17:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A2DDB87218 for ; Mon, 2 Oct 2023 03:16:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-79f915e5b47so569158939f.2 for ; Sun, 01 Oct 2023 18:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209365; x=1696814165; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YQRWKTaaVOcyC320SbnsGQnJs1jpbb/W3zNOBkrkx6I=; b=OSCXiSB9B/7c6DK9v7sOGizPNs6ZfOg8R6aU48yyXLfEFA0kcSef6+qHXBlqc24B77 kpikJlEWY3l6m23RpM3LAPnUCi3kAR/7cU+3GD1tkCMNHzjSRbWSHXGfRhE2wE1Qg4LI NHi0CcZb/SmbrZSPpm2wiAmh6zmva74PxT+i8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209365; x=1696814165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YQRWKTaaVOcyC320SbnsGQnJs1jpbb/W3zNOBkrkx6I=; b=e96nj9GlvR6L7fNYtU/dsT/EYY1I+RnpFoSlR6qCGLWqqMrOsTmkDWDWPuwKG705jZ 2bVv1uYf0alPeBm4jkqycsS98L5dED3JdNUfwTzFL+Gge/E1dcxzTl3gVQSzXKyojynp 2Vqnzf9WUWQ/WQLpoBEn55XjfhSBGK1tM9wionYc3IZRmdYSszSRas0uKu1sIEGTgW0y c8K9TRjcTaXjF28p6eMja7VNsfvqiJyX8PXMA1bGjdaNkM8E3y8o8ZxAD7NW+/dUWnXH XllpT/yDR/0KkwV6AzgJGhxc6Il5X0MyJiPt/UeoYGaFN0nArTEm1FYxFRovdLIEAjQo 7gWw== X-Gm-Message-State: AOJu0Yw2qtYOP1r9EOCe3Eb6E5QIlgVAA0puoVoYTwnwWyK0qaT+Ae+V oU/Evn/MjpsdCPyiH/KJzQ2vMJh/QfycurlxaxM= X-Google-Smtp-Source: AGHT+IEdfaRJ5s0wgzlAocODMVEa2dHMjqTTwdWho2BQNKRRoMfB4TGZpMfyemnp3WO7tCe2sAdUZg== X-Received: by 2002:a5e:8712:0:b0:780:ce72:ac55 with SMTP id y18-20020a5e8712000000b00780ce72ac55mr13059722ioj.10.1696209365439; Sun, 01 Oct 2023 18:16:05 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:04 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Abdellatif El Khlifi , Heinrich Schuchardt , Linus Walleij , Marek Vasut , Rasmus Villemoes , Stephen Carlson Subject: [PATCH 02/34] test: Add a new suite for commands Date: Sun, 1 Oct 2023 19:15:12 -0600 Message-ID: <20231002011553.463514-3-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Add a new suite for 'cmd' tests, used for testing commands. These are kept in the test/cmd directory. For now it is empty, but it will be used for coreboot-command tests. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/test/cmd.h | 15 +++++++++++++++ include/test/suites.h | 1 + test/cmd/Makefile | 2 ++ test/cmd/cmd_ut_cmd.c | 21 +++++++++++++++++++++ test/cmd_ut.c | 6 ++++++ 5 files changed, 45 insertions(+) create mode 100644 include/test/cmd.h create mode 100644 test/cmd/cmd_ut_cmd.c diff --git a/include/test/cmd.h b/include/test/cmd.h new file mode 100644 index 000000000000..c200570e423d --- /dev/null +++ b/include/test/cmd.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2023 Google LLC + * Written by Simon Glass + */ + +#ifndef __TEST_CMD_H__ +#define __TEST_CMD_H__ + +#include + +/* Declare a new command test */ +#define CMD_TEST(_name, _flags) UNIT_TEST(_name, _flags, cmd_test) + +#endif /* __TEST_CMD_H__ */ diff --git a/include/test/suites.h b/include/test/suites.h index 1c7dc65966a1..2d4897d46b8e 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -34,6 +34,7 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); +int do_ut_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_common(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 8d70ac510a53..0be2cec89018 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -3,6 +3,8 @@ # Copyright (c) 2013 Google, Inc # Copyright 2022-2023 Arm Limited and/or its affiliates +obj-y += cmd_ut_cmd.o + ifdef CONFIG_HUSH_PARSER obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o endif diff --git a/test/cmd/cmd_ut_cmd.c b/test/cmd/cmd_ut_cmd.c new file mode 100644 index 000000000000..1a5bfdb4a183 --- /dev/null +++ b/test/cmd/cmd_ut_cmd.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2023 Google LLC + * Written by Simon Glass + * + * Unit tests for command functions + */ + +#include +#include +#include +#include +#include + +int do_ut_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + struct unit_test *tests = UNIT_TEST_SUITE_START(cmd_test); + const int n_ents = UNIT_TEST_SUITE_COUNT(cmd_test); + + return cmd_ut_category("cmd", "cmd_test_", tests, n_ents, argc, argv); +} diff --git a/test/cmd_ut.c b/test/cmd_ut.c index 0f56409e8031..d3505fe8d97e 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -60,6 +60,9 @@ static struct cmd_tbl cmd_ut_sub[] = { #ifdef CONFIG_BOOTSTD U_BOOT_CMD_MKENT(bootstd, CONFIG_SYS_MAXARGS, 1, do_ut_bootstd, "", ""), +#endif +#ifdef CONFIG_CMDLINE + U_BOOT_CMD_MKENT(cmd, CONFIG_SYS_MAXARGS, 1, do_ut_cmd, "", ""), #endif U_BOOT_CMD_MKENT(common, CONFIG_SYS_MAXARGS, 1, do_ut_common, "", ""), #if defined(CONFIG_UT_DM) @@ -188,6 +191,9 @@ static char ut_help_text[] = #ifdef CONFIG_BOOTSTD "\nbootstd - standard boot implementation" #endif +#ifdef CONFIG_CMDLINE + "\ncmd - test various commands" +#endif #ifdef CONFIG_SANDBOX "\ncompression - compressors and bootm decompression" #endif From patchwork Mon Oct 2 01:15:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841878 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=j/Iij5Bf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNhQ4ZNhz1ypx for ; Mon, 2 Oct 2023 12:31:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4BBE787165; Mon, 2 Oct 2023 03:17:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="j/Iij5Bf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 984AC87118; Mon, 2 Oct 2023 03:17:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A42B88721A for ; Mon, 2 Oct 2023 03:16:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-79fc3d32a2fso415777639f.1 for ; Sun, 01 Oct 2023 18:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209366; x=1696814166; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q5gB0bGiHFVxRqphlEfn3vbaOPFW4YgSKWgq+oB0pL8=; b=j/Iij5BfSX/spir1SXHY71PhFqXQxHU3JWMg7t+2GEAMYQAypl9iAfxQS3Y3u4lW91 Zam5gJcL8fzNWT3yeATywgfYWz+5l6t/BHbfk0sj8Hr7nSIGDez7/EaX1vJNuUQvJOlz o66O7RxroiI8socUsTDBMwZCXD9yghaWvr/eU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209366; x=1696814166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q5gB0bGiHFVxRqphlEfn3vbaOPFW4YgSKWgq+oB0pL8=; b=jP5beZE7i/auHgqhlM2f+Hwl4a0FJqXrL2oSKRBVkK2En/f79jLdC2UibDpM6U7LEZ WaxINEm4Dh9ybRJJsuqkqL4pjNpK/uFkTBH9udBP7+xrO/6fX3biOhDzx6dOj065eN2a vYBb7s94B1W0eCsNeM5Ma670GLNB7FaAcnpB4hd3iXJ5dq2VKOuk90mnZBhDApYysqzP V+mAqL2fmkFwrGJkVH+xC8YM9Ze2qsya8G5jlG+9mDjhwUcAtAij2X2+igPH7y4XbOI+ F05CCCVVg/PgWhFEHGwHsrVcDHKEt27euqep5aW0RqACTC5wuBGBX3Gu7jukzmN34F6m iuKw== X-Gm-Message-State: AOJu0Yzr0KbzTK0Ot6sbdM+1mDdqM6lIvPExePlaIzwxpGa2iDG6eUfF caYjIzObdeoUcAnXbQk5lLQAttqTL5kA220mIfI= X-Google-Smtp-Source: AGHT+IF69MSEJ5P/b8Go46UW+fikbEQS2eYS76KE/tdWvvUEbwbTmPsICM035je8x8hcuIQfDiV+mQ== X-Received: by 2002:a05:6602:1b10:b0:792:82f8:7402 with SMTP id dk16-20020a0566021b1000b0079282f87402mr11825164iob.16.1696209366358; Sun, 01 Oct 2023 18:16:06 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Marek Vasut Subject: [PATCH 03/34] test: Add helper to skip to partial console line Date: Sun, 1 Oct 2023 19:15:13 -0600 Message-ID: <20231002011553.463514-4-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Sometimes we need to skip to a line but it includes addresses or other information which can vary depending on the runtime conditions. Add a new ut_assert_skip_to_linen() which is similar to the existing ut_assert_skip_to_line() function but only checks that the console line matches up to the length of the provided string. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/test/ut.h | 30 ++++++++++++++++++++++++++++++ test/ut.c | 27 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/include/test/ut.h b/include/test/ut.h index ea6ee95d7344..d3172af8083f 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -97,6 +97,23 @@ int ut_check_skipline(struct unit_test_state *uts); */ int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...); +/** + * ut_check_skip_to_linen() - skip output until a partial line is found + * + * This creates a string and then checks it against the following lines of + * console output obtained with console_record_readline() until it is found. + * Only the characters up to the length of the string are checked, so the line + * may extend further + * + * After the function returns, uts->expect_str holds the expected string and + * uts->actual_str holds the actual string read from the console. + * + * @uts: Test state + * @fmt: printf() format string to look for, followed by args + * Return: 0 if OK, -ENOENT if not found, other value on error + */ +int ut_check_skip_to_linen(struct unit_test_state *uts, const char *fmt, ...); + /** * ut_check_console_end() - Check there is no more console output * @@ -359,6 +376,19 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) +/* Assert that a following console output line matches */ +#define ut_assert_skip_to_linen(fmt, args...) ({ \ + int __ret = 0; \ + \ + if (ut_check_skip_to_linen(uts, fmt, ##args)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "\nExpected '%s',\n got to '%s'", \ + uts->expect_str, uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + __ret; \ +}) + /* Assert that there is no more console output */ #define ut_assert_console_end() ({ \ int __ret = 0; \ diff --git a/test/ut.c b/test/ut.c index 28da417686e4..628e9dc98050 100644 --- a/test/ut.c +++ b/test/ut.c @@ -121,6 +121,33 @@ int ut_check_skipline(struct unit_test_state *uts) return 0; } +int ut_check_skip_to_linen(struct unit_test_state *uts, const char *fmt, ...) +{ + va_list args; + int len; + int ret; + + va_start(args, fmt); + len = vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args); + va_end(args); + if (len >= sizeof(uts->expect_str)) { + ut_fail(uts, __FILE__, __LINE__, __func__, + "unit_test_state->expect_str too small"); + return -EOVERFLOW; + } + while (1) { + if (!console_record_avail()) + return -ENOENT; + ret = readline_check(uts); + if (ret < 0) + return ret; + + if (!strncmp(uts->expect_str, uts->actual_str, + strlen(uts->expect_str))) + return 0; + } +} + int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...) { va_list args; From patchwork Mon Oct 2 01:15:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841882 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=einh0d1D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNj81RHyz1ypx for ; Mon, 2 Oct 2023 12:31:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 14D76871B9; Mon, 2 Oct 2023 03:17:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="einh0d1D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A31968715A; Mon, 2 Oct 2023 03:17:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 31A998715A for ; Mon, 2 Oct 2023 03:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-34deefc2016so49919465ab.2 for ; Sun, 01 Oct 2023 18:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209367; x=1696814167; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M+XmaRqpHgye7n3Tnv0Yuxass1aeP6m7haqFeL6TSwQ=; b=einh0d1D19FLW1Af5x6xP7AFXPX+cyW7piN2e8cdb5mZ9sDiX12xXn6cdUz2iR0GiP h27SmOyTXNHaAv/VY3pfE38gF2f8cTVvWODYyihGnmqw7trB6U/9PI1/6o08rJaGcmDL ZZgOA3hyRtAOW8BLqu4bJp1JsNF9TdtWPyF9o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209367; x=1696814167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M+XmaRqpHgye7n3Tnv0Yuxass1aeP6m7haqFeL6TSwQ=; b=vgA27KBHS0E2B37yiAcoITzTrxA59NstnQtcuacwqVAKA2yP67v5PsN9Yo8AOVgOkO KX6u44rvFRUdcWDt+x2Ij4BsB0bGBiVL4mEaPKuMn/TqWQP1/72Y+mCkgmL2IrfmlyNP S0oHa2zbr+SaxBOPmBd2YpgbPS2pGbV2lS/0JasFhXaIXKpx6euVueEm2Byezcyi0c89 NrQA2TcwsQi1dm9xfqKjhJPWGpCYDkma7xv6g35tjvlnB0wmND/VPkdL37LmmGtFsR8a KgKr049JJDbIyhdfEFoqqqqdXSb2NrGW+S5una4sjdemWtur/TUNmttoHh0xJ9iA7aUV 3ofw== X-Gm-Message-State: AOJu0YzHFrGFVjikO3kqB0gADfpq71LpUSgnG07ECtyABqEazdIZrV3I LWFCEt0MuzPKXWwyqsD+sYgAwbFi11LSnYIGb3Q= X-Google-Smtp-Source: AGHT+IGFW7YUotXkH1PLkclkEZmqNhDGhkzK4YrCXQEAqABjBWFrJpuf1zdhA7KmN28rUuu87yo3Aw== X-Received: by 2002:a05:6e02:1ba9:b0:34a:c2e2:b2a7 with SMTP id n9-20020a056e021ba900b0034ac2e2b2a7mr12135413ili.25.1696209367308; Sun, 01 Oct 2023 18:16:07 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Brandon Maier , Heinrich Schuchardt Subject: [PATCH 04/34] test: Make UT_LIB_ASN1 depend on sandbox Date: Sun, 1 Oct 2023 19:15:14 -0600 Message-ID: <20231002011553.463514-5-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This doesn't seem to work on a real board, so use the test on sandbox only. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Kconfig b/test/Kconfig index 830245b6f9a9..69d63a5ff7dd 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -31,6 +31,7 @@ if UT_LIB config UT_LIB_ASN1 bool "Unit test for asn1 compiler and decoder function" + depends on SANDBOX default y imply ASYMMETRIC_KEY_TYPE imply ASYMMETRIC_PUBLIC_KEY_SUBTYPE From patchwork Mon Oct 2 01:15:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841885 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Lw4PJysp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNjh3fzwz1ypx for ; Mon, 2 Oct 2023 12:32:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2856387217; Mon, 2 Oct 2023 03:17:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Lw4PJysp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C188B87172; Mon, 2 Oct 2023 03:17:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4FAA987161 for ; Mon, 2 Oct 2023 03:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-79f915e5b47so569159939f.2 for ; Sun, 01 Oct 2023 18:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209368; x=1696814168; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7NLg7qhMgIm/t9UJwgFKNekIyWrp6N8OiU8q+Pk/P6k=; b=Lw4PJyspXaHQUyep/lM4HBUjUir8bW5mhWJ0rOSgCQimn8Q5lAjgjSKIHMbyWquMPn G+YdS35sClRlvBedOIMgEg3umJdg/8/w0AEVKIrgLNF4KGx2PklEGIapdPyWCJe1wt0n IKNm0KNh8hYViu0p17GjfJLVR0BGmMMfw230s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209368; x=1696814168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7NLg7qhMgIm/t9UJwgFKNekIyWrp6N8OiU8q+Pk/P6k=; b=SzxQYiy1SDJRn3aI3yMBiwHAJtF4N2qFZr0QVJ7fLy+fHXAE+6S3ZfBJUeUHbRrdZg IKxgKrY46PaAYy0BH/SMFNNSNT34AvtKrBOaFjpaIwmRbmM2xcAamS1GKYcHDAtE9Xyy hb9ME2tKGLT2MuyQJPOJDpCtGP5g7YYOxb90yDtvu95QNNdbziyQC1ATd/tQCh7QVXB0 qr7J44WGw1iNPZ/7e/qJjPTDCETeyjrifwsHmj8HVNwhRm34TPJTlig6muV+HUvwQu2b Qq2gOB47FS5rb/EUuQEuxx3Uxue8RKHgLLAPbLfVQJtn8XO3Ah7mkjgdBE0+N72HEpZV Tupg== X-Gm-Message-State: AOJu0YxkwwlOd+QQCFB3S668tneVVn+cMbVkLwHmhUTG8nF82KV6CBcz D8RS4d7/bZd7XfPViu2LAx15gyIuS9HFvypCDqw= X-Google-Smtp-Source: AGHT+IFTSS48EJOVFs/7uILoyQ5PVyTR520C8mqedjDkpWFXVnUt4q13hH4HnGqpTbq1p+x3it9TNA== X-Received: by 2002:a05:6602:2288:b0:794:efb0:83d6 with SMTP id d8-20020a056602228800b00794efb083d6mr11471228iod.12.1696209368281; Sun, 01 Oct 2023 18:16:08 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:08 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Brandon Maier , Heinrich Schuchardt , Linus Walleij , Marek Vasut , Stephen Carlson Subject: [PATCH 05/34] test: Run bootstd tests only on sandbox Date: Sun, 1 Oct 2023 19:15:15 -0600 Message-ID: <20231002011553.463514-6-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean These make use of disk images which are not available on reak boards. Add a new Kconfig to ensure these tests only run where they are valid. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/Kconfig | 5 +++++ test/Makefile | 2 +- test/cmd_ut.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/Kconfig b/test/Kconfig index 69d63a5ff7dd..022395e489bb 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -64,6 +64,11 @@ config UT_LIB_RSA endif +config UT_BOOTSTD + bool "Unit tests for standard boot" + depends on UNIT_TEST && SANDBOX + default y + config UT_COMPRESSION bool "Unit test for compression" depends on UNIT_TEST diff --git a/test/Makefile b/test/Makefile index 178773647a82..4e179cb3930a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_UT_TIME) += time_ut.o obj-y += ut.o ifeq ($(CONFIG_SPL_BUILD),) -obj-$(CONFIG_UNIT_TEST) += boot/ +obj-$(CONFIG_$(SPL_)UT_BOOTSTD) += boot/ obj-$(CONFIG_UNIT_TEST) += common/ obj-y += log/ obj-$(CONFIG_$(SPL_)UT_UNICODE) += unicode_ut.o diff --git a/test/cmd_ut.c b/test/cmd_ut.c index d3505fe8d97e..f74930a7ecbe 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -57,7 +57,7 @@ static struct cmd_tbl cmd_ut_sub[] = { #ifdef CONFIG_CMD_BDI U_BOOT_CMD_MKENT(bdinfo, CONFIG_SYS_MAXARGS, 1, do_ut_bdinfo, "", ""), #endif -#ifdef CONFIG_BOOTSTD +#ifdef CONFIG_UT_BOOTSTD U_BOOT_CMD_MKENT(bootstd, CONFIG_SYS_MAXARGS, 1, do_ut_bootstd, "", ""), #endif From patchwork Mon Oct 2 01:15:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841884 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JN7iq1JW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNjW50bMz1ypx for ; Mon, 2 Oct 2023 12:32:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D5598871A0; Mon, 2 Oct 2023 03:17:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JN7iq1JW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 463E987107; Mon, 2 Oct 2023 03:17:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3578E87215 for ; Mon, 2 Oct 2023 03:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-79fa387fb96so506234539f.1 for ; Sun, 01 Oct 2023 18:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209369; x=1696814169; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h1CZ4oNuHFyI4faPd7cDlzaEevH4Mv+IwSEcZwYcgyM=; b=JN7iq1JWo/G8t+LWIVxen0vwhr0MVPv7BHYUNrflPY5Q96kBOKhmT4JA5aYRVqSJf3 hiXoFF0WdyRNT2FprcEbr7J/yaJAK5ZGdbyTtUx6mtrc40bwAlhqtmBh4kyNrkNI3c2z vpEPbVdZ6Euh1vfLhSDAZfX61tQefvVS6ntHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209369; x=1696814169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h1CZ4oNuHFyI4faPd7cDlzaEevH4Mv+IwSEcZwYcgyM=; b=aLseCA3mPE8Fl6eECCVRY2tsF/QzHjctm8uqOxeqLXDNVyRvy8wu5/uSbhDVb/VZMO dkFFb9cP72v3mSJM4ef/Ow0QW4OTF6bC4niFUnDlYrOCVIzV4RHfV5OpvJ8usEhGIclz TH+LvjxF1Q8VM7cBArM+hUN8uo99pwOu7tgfJRMhnaZEZt2y30TLrkpEBOQ6/NNkfMvr SN2DP0s6TEf7dOsqHlGoZqS4l++aQ8kYBEM86A7X8qpm+zkZAjwDTqa2oChEyy/jKhwC FtylK3Eie4UnTTaIVtP60gZZO8m2nF2mQeoU4lJOF7QfwIOYfmj4/xoqhSDdorj77IW7 m/cA== X-Gm-Message-State: AOJu0Yxyhv1H9UiIiDKp/AKLS3mkg8sBs7FJlzZtXXFwzFwrXRdHvha3 /OPe8kLwBf8toHc+mfHbPhBp/+MUWbEQ1KeRDKw= X-Google-Smtp-Source: AGHT+IGzIBHt7x+w0tEc8nu0non7gxyP6wQJ5Jowzj/FJN+FUoF/VL+HdPGao1Hm/WrgIfTC4qGgkg== X-Received: by 2002:a5e:a71a:0:b0:77e:249e:d84 with SMTP id b26-20020a5ea71a000000b0077e249e0d84mr11789333iod.5.1696209369331; Sun, 01 Oct 2023 18:16:09 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:08 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Marek Vasut , Nikhil M Jain Subject: [PATCH 06/34] test: Handle use of stack pointer in bdinfo Date: Sun, 1 Oct 2023 19:15:16 -0600 Message-ID: <20231002011553.463514-7-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This test assumes that the stack pointer is the same across two calls to lmb_init_and_reserve() but this is not the case on x86, for example. Add a special case to handle this, along with a detailed comment. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/cmd/bdinfo.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 8c09281cac0d..0f09a5a3e1db 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -114,6 +114,18 @@ static int lmb_test_dump_region(struct unit_test_state *uts, end = base + size - 1; flags = rgn->region[i].flags; + /* + * this entry includes the stack (get_sp()) on many platforms + * so will different each time lmb_init_and_reserve() is called. + * We could instead have the bdinfo command put its lmb region + * in a known location, so we can check it directly, rather than + * calling lmb_init_and_reserve() to create a new (and hopefully + * identical one). But for now this seems good enough. + */ + if (!IS_ENABLED(CONFIG_SANDBOX) && i == 3) { + ut_assert_nextlinen(" %s[%d]\t[", name, i); + continue; + } ut_assert_nextline(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: %x", name, i, base, end, size, flags); } From patchwork Mon Oct 2 01:15:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841881 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=P3Is6o1w; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNhz0VqKz1ypx for ; Mon, 2 Oct 2023 12:31:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F383870E9; Mon, 2 Oct 2023 03:17:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="P3Is6o1w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D1D86870CE; Mon, 2 Oct 2023 03:17:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 43EFE87217 for ; Mon, 2 Oct 2023 03:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-35130c8bc79so43206775ab.1 for ; Sun, 01 Oct 2023 18:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209370; x=1696814170; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YaXyl8l9IE1Ay3mZ4aDEW89FI2M64gvXbwCJx6dVXaM=; b=P3Is6o1wGpVIry7i5W08F+pY9JQSggJib7Op954SvMGgS1G9iwtmkf51NV6smhAimK dsTfTL21S/clAlezyDYONNHHhTTjbkWEeQx18Q7nLsD2v5iFGwE9ubXl4+zSyeKTxhvb wJm8P0m0rf7Bh8Af1H8IZSB5XOOz4UgqzCayw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209370; x=1696814170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YaXyl8l9IE1Ay3mZ4aDEW89FI2M64gvXbwCJx6dVXaM=; b=Hnb9uXMcPr3U6K/RwO0UXNG/NUAgQuoe9NgOwUil7hLJZBgjsKX1LS1TXnGH8Xk5q8 zSvi4mx7cjKALEokE6TtHta1s7QyaUW4kmA11bNCuot9CRqf1xhEaIhj8vxeMMCZjSZm qa5anmqlY0h1Z4u0xEFgQanSDZHsh41riJA0pro62BCEr0VT0qQc3e0Irfhb3Pa+hSPr 7iIaP2qNWTvbxfSaAKiNOrx8Bt1D76JFzGHih9hbdo+IYVULB2JkA91X3oG2rWPqbs43 NJaToefZ+w4CCAfnUFvBoYKph7gGH5vzYkRTl5sMleP1S5iR1pFNCCE9IKm4pQxCQxjO 545A== X-Gm-Message-State: AOJu0Yz7v6PKZflSGdCJe2H0yGxCP4HV2gskelyzZjmuXzk+e8PC0xuF COaLkwSTpN1XBPJHLFkgYOcMB1nIKqxvXVv+s9g= X-Google-Smtp-Source: AGHT+IEnH7WbdMi8BF09xJtY3kryQECYXgHGRk+CY6HqbvHS4Gzt8r9WPw6Nv6PkHXv3TZRR/3D0LQ== X-Received: by 2002:a05:6e02:1a62:b0:34f:bac9:f53d with SMTP id w2-20020a056e021a6200b0034fbac9f53dmr12776003ilv.17.1696209370365; Sun, 01 Oct 2023 18:16:10 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Marek Vasut , Nikhil M Jain Subject: [PATCH 07/34] test: bdinfo: Add missing asserts Date: Sun, 1 Oct 2023 19:15:17 -0600 Message-ID: <20231002011553.463514-8-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Calling into sub-test functions should be done using ut_assertok() so that the test exits immediately on failure. Add those which are missing. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/cmd/bdinfo.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 0f09a5a3e1db..9ada7523fc27 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -136,8 +136,8 @@ static int lmb_test_dump_region(struct unit_test_state *uts, static int lmb_test_dump_all(struct unit_test_state *uts, struct lmb *lmb) { ut_assert_nextline("lmb_dump_all:"); - lmb_test_dump_region(uts, &lmb->memory, "memory"); - lmb_test_dump_region(uts, &lmb->reserved, "reserved"); + ut_assertok(lmb_test_dump_region(uts, &lmb->memory, "memory")); + ut_assertok(lmb_test_dump_region(uts, &lmb->reserved, "reserved")); return 0; } @@ -188,7 +188,7 @@ static int bdinfo_test_move(struct unit_test_state *uts) ut_assertok(test_num_l(uts, "fdt_size", (ulong)gd->fdt_size)); if (IS_ENABLED(CONFIG_VIDEO)) - test_video_info(uts); + ut_assertok(test_video_info(uts)); /* The gd->multi_dtb_fit may not be available, hence, #if below. */ #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) @@ -199,7 +199,7 @@ static int bdinfo_test_move(struct unit_test_state *uts) struct lmb lmb; lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); - lmb_test_dump_all(uts, &lmb); + ut_assertok(lmb_test_dump_all(uts, &lmb)); if (IS_ENABLED(CONFIG_OF_REAL)) ut_assert_nextline("devicetree = %s", fdtdec_get_srcname()); } @@ -224,6 +224,9 @@ static int bdinfo_test_move(struct unit_test_state *uts) ut_assertok(test_num_l(uts, "malloc base", gd_malloc_start())); } + if (IS_ENABLED(CONFIG_X86)) + ut_check_skip_to_linen(uts, " high end ="); + ut_assertok(ut_check_console_end(uts)); return 0; From patchwork Mon Oct 2 01:15:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841883 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=lAobuaT4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNjM5MzFz1ypx for ; Mon, 2 Oct 2023 12:32:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6BD7D87112; Mon, 2 Oct 2023 03:17:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="lAobuaT4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 50CD6871B9; Mon, 2 Oct 2023 03:17:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 420DC87216 for ; Mon, 2 Oct 2023 03:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3ae2f8bf865so8345290b6e.2 for ; Sun, 01 Oct 2023 18:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209371; x=1696814171; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hzWoLU82ZBP++/p5qoxT3KLuipt2x8gX6kAgSIZ6vZ8=; b=lAobuaT44n+Odtf6qc/z+sNdVSjBM1o0dYoNndjZry1v0NU5OnUN13FfZZWS8h9GcI HshqUYQEj1w3LW1B7nFf52XPGujxjaDrk6ZUQSHXYy1borDnmIVhJD2TsIs78GJYmjHv vUMrm2+6oWMumiXWOPd1JGRVpsMM9o/rafmhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209371; x=1696814171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hzWoLU82ZBP++/p5qoxT3KLuipt2x8gX6kAgSIZ6vZ8=; b=qvGhnuxYZsrDWJrpkNsn/Q/BpDamwa4pBZtSfPhtAjVlATCaFaoe5ioZm4hb8x53XT 7oFn7li4ttpApuFl26Qf4MOjIK4p80rFCP/peSBxz9JeCNQ/sW8D6J+0xJpVN8PxOTAV qxyvg5Z0Y1onXgy+w7wNH6l8gZzdMqbTodTpWO22xrOXYO8fgxiF5ISh0g1vWcghSc7A 6/R9iQJf30TjlzfB8Vuaxl0cSnNHjkm72B8qjPm2RijZQhyJcZuYEBxjOWTYGH+UzAkS NlB5GV38plSFy7rFjtaWPzBGZsDWV0m9uVn7fOlRe3bBAtXciCarV3NqtG8cBM+S78Lj Y4VA== X-Gm-Message-State: AOJu0YzTvZ77qpbS1n7/N+CiinmVxe6ZquvVA9aaTtIPp0GNdWMu8xuF ZBgAde/kL2Y/1LEx7NVr0JDwELPqIiC1I3i5RlY= X-Google-Smtp-Source: AGHT+IH7TPzhy5rdQB0v1fBySB+2I5kTgeR+k2UVPkdxMWBsFXabz1Jo4/X+xdHin5WTlI/vnAG6Tg== X-Received: by 2002:a05:6808:d4d:b0:3a7:c2e8:5e7c with SMTP id w13-20020a0568080d4d00b003a7c2e85e7cmr13855666oik.43.1696209371317; Sun, 01 Oct 2023 18:16:11 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:11 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Evgeny Bachinin , Jerry Van Baren , Marek Vasut Subject: [PATCH 08/34] test: fdt: Add a special case for real boards Date: Sun, 1 Oct 2023 19:15:18 -0600 Message-ID: <20231002011553.463514-9-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean The error that this test checks for is only shown on sandbox. For real boards, there is normally no error. Add a special case to handle this. Signed-off-by: Simon Glass --- test/cmd/fdt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index 1f103a1d7eb4..547085521758 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -160,7 +160,13 @@ static int fdt_test_addr(struct unit_test_state *uts) set_working_fdt_addr(0); ut_assert_nextline("Working FDT set to 0"); ut_asserteq(CMD_RET_FAILURE, run_command("fdt addr", 0)); - ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); + + /* + * sandbox fails the check for !blob since the 0 pointer is mapped to + * memory somewhere other than at 0x0 + */ + if (IS_ENABLED(CONFIG_SANDBOX)) + ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); ut_assertok(ut_check_console_end(uts)); /* Set up a working FDT and try again */ From patchwork Mon Oct 2 01:15:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841893 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bipOWjAs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNl844Bcz1ypx for ; Mon, 2 Oct 2023 12:33:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E1F6587442; Mon, 2 Oct 2023 03:18:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bipOWjAs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 026F687135; Mon, 2 Oct 2023 03:18:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6C25487241 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3ae1916ba69so8922657b6e.2 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209372; x=1696814172; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=spYLSsXkWbQLVCs1v7fwmZoRkg58aBXWIr65dQdWTxQ=; b=bipOWjAswZn1lnpyJ90eoSMgY7i8/xAxJkw+erioFYPsFp7Hx827jrz4lsKmX4ACwI PjvazXFJIAdSKOi4VRBwJt3X0V9Fv9dmy2O5Kf4MSt+Niv2WoKWrNMdw2tyoCVQvF58a 5hcm2VCqbZQegr6H8eIipk6YJXMbLMjwWkL3U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209372; x=1696814172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=spYLSsXkWbQLVCs1v7fwmZoRkg58aBXWIr65dQdWTxQ=; b=JXkfbUENXJ4/JjbgkfQM0S/1Caq+Ypq6LPnupXUo7midQaAe8rySMq5ESSLnA9E4TG 3+juJNHk5WDQ8fYT5kwd2tbcQ4YqnA1zDgN4TdrU5AZoqSRrgqC7iPW/mvAV6Lfh5vjC 8UdDPelQtf+tHgDiJX0HRG7lg4bUP/AeugIy559jAPJzDFWyLDBo813W4Vuxr2OY6GGz vd/dA6QC1Z+T73nM4Ex0mqlB2z1hijYgV0S72yz2daw8wIRTd3t1Fu55IackG345E3SO 5ioqrw2g8QcvCYXa83IrwcoTXC0nZDuklPZt0c/wGMW+lBP8Zs7dbr1AaEnFPJw+GOPr uuJw== X-Gm-Message-State: AOJu0YwTK4zaAVi12fsGJeZZsTDPlyh0YmVIV/9Mx7KjQWLE6no42ZZq 9eriQ+q3UY/n17ZGRt1+Q/xVW94ruQr/8fOjhvU= X-Google-Smtp-Source: AGHT+IFsS0hAsZDZylZwLpTp+MqC4faIhUcfNqd+x1AS/3NV5DY4c6U8xEYrs9tQoRPuwZ8INOOHEA== X-Received: by 2002:a05:6808:1a13:b0:3a7:6213:6899 with SMTP id bk19-20020a0568081a1300b003a762136899mr13345558oib.24.1696209372435; Sun, 01 Oct 2023 18:16:12 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:11 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Dzmitry Sankouski Subject: [PATCH 09/34] test: font: Add dependencies on fonts Date: Sun, 1 Oct 2023 19:15:19 -0600 Message-ID: <20231002011553.463514-10-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean The font test needs two fonts. If one is not available, skip out early, to avoid an error. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/cmd/font.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/cmd/font.c b/test/cmd/font.c index 40682e5ce495..1fe05c1ead51 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -30,13 +30,17 @@ static int font_test_base(struct unit_test_state *uts) ut_assertok(console_record_reset_enable()); ut_assertok(run_command("font list", 0)); ut_assert_nextline("nimbus_sans_l_regular"); - ut_assert_nextline("cantoraone_regular"); + if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE)) + ut_assert_nextline("cantoraone_regular"); ut_assertok(ut_check_console_end(uts)); ut_assertok(vidconsole_get_font_size(dev, &name, &size)); ut_asserteq_str("nimbus_sans_l_regular", name); ut_asserteq(18, size); + if (!IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE)) + return 0; + max_metrics = 1; if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE)) max_metrics = IF_ENABLED_INT(CONFIG_CONSOLE_TRUETYPE, From patchwork Mon Oct 2 01:15:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841888 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=eh1Et1+V; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNkF6hwbz1ypx for ; Mon, 2 Oct 2023 12:32:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8FFD187251; Mon, 2 Oct 2023 03:17:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="eh1Et1+V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C461186D5E; Mon, 2 Oct 2023 03:17:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4548887233 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-79f82b26abfso561332239f.1 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209373; x=1696814173; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G636tRYiSlUg8KjM9n50D9zqNh5Wwt3oWbHuGv2i76A=; b=eh1Et1+VgJCf117fbdv27Mk34w9BSxdz5QwYsT0Dt5snUyqxuFeS2n1dn6W5VuDwUw qapjvYRwLw1veRF7tMRdiZd+wAM7J9UaM382JeNHVTKAzwACteUJWAJADpiMzUhF3cnL m27JAULHkLdhrxuyNCWPmAM2ZChgetKTHJpws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209373; x=1696814173; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G636tRYiSlUg8KjM9n50D9zqNh5Wwt3oWbHuGv2i76A=; b=SEIYmMmTNHr15U3OB7xX/FUmLEBNPX/FsKb6Y/N9FS6AWVo79NgPLqXQUetLbEiHdg 35Brw1jk0dxnq+va/pjshHaYtW8l+V7RHlgo7pzLaeuBSl1z+IgVMDx4Bqw9ZR9uJdz2 vpSw2sxIjlw8BUvqeXz11iJgV2ld7wSDLnmH2weW/yNehtERokbMgKcUpeaz/TKXW/pN HcCRFsnAN5EP/hrQD6+RAgzd2BHvLJyWO8LIgUby+bekVxtqBb8Mm2ac0Vtnn+7dPfyU ZI4Nme4bo6e0Ffx0iu8BjhSyIYyKfGMERvNCYWupwUeDrGWKNd4PFqWp1l2iWwXXiIm0 iu2A== X-Gm-Message-State: AOJu0Yznk/6+c+aMrjlzMD7drLrV2The1hrgy678sdDmYuMCh0JTUuwe dVYovMLIvRJIohRb28mQMQ+6bl+AWxhIL36ujC4= X-Google-Smtp-Source: AGHT+IFNFj0y08iPJkYxdP7tbz1Vt4mtzpbNvMe9r7aa8QnfYRrf8SUPxG1N1v+Gl1nyDzSG7sRplA== X-Received: by 2002:a5e:8c18:0:b0:786:ca40:cc88 with SMTP id n24-20020a5e8c18000000b00786ca40cc88mr12074054ioj.11.1696209373380; Sun, 01 Oct 2023 18:16:13 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 10/34] test: event: Only run test_event_probe() on sandbox Date: Sun, 1 Oct 2023 19:15:20 -0600 Message-ID: <20231002011553.463514-11-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This needs test devices which are only present on sandbox. Add a check for this and skip just this test if running on a real board. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/common/event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/common/event.c b/test/common/event.c index c0912a3437bb..b462694fc3b6 100644 --- a/test/common/event.c +++ b/test/common/event.c @@ -92,6 +92,9 @@ static int test_event_probe(struct unit_test_state *uts) struct test_state state; struct udevice *dev; + if (!IS_ENABLED(SANDBOX)) + return -EAGAIN; + state.val = 0; ut_assertok(event_register("pre", EVT_DM_PRE_PROBE, h_probe, &state)); ut_assertok(event_register("post", EVT_DM_POST_PROBE, h_probe, &state)); From patchwork Mon Oct 2 01:15:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841892 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=mw6av7to; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNl113p7z1ypx for ; Mon, 2 Oct 2023 12:33:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4B96587272; Mon, 2 Oct 2023 03:18:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mw6av7to"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1AE378709C; Mon, 2 Oct 2023 03:18:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4C95387238 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-352308c0799so17524085ab.2 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209374; x=1696814174; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=avxd/J4FHw7l+by9QQKXOqvFjf/TZKRr9aaJCq0SzGI=; b=mw6av7tomx36PV59C32NMtNHKCri65rOxn19VYaH6vfMgJUeP/g1XmjNXskJXJ5j7u U3sSHQZwH+ov47vl0miFcpMzS8uMoInMaF1Cs3EoOXGlnZ0T1V3Zs1V9STpy3pJ4bq00 Seqo08wEXEW61o7iH4xuRJymAFbfZwQ98yZYw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209374; x=1696814174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=avxd/J4FHw7l+by9QQKXOqvFjf/TZKRr9aaJCq0SzGI=; b=s1BJSgmEcv57pnd7o0LUDJEpdiWQhuW4sv0lmzQdfg3MQK0fMUmKBBb2zEuYN/z8/b jdaeWBoujqSTgLkfsSGWDQez77fBAHepymo0P34gl5ITy7nBYTWj11gJu6lcqC2AS4mo dA3+unNQ1WyZmSPtQfXqa85398vAoIlSNvlzPwsTGXDzegQfdktb/9T6s9zF/Zw6p1Uo WscK2C2GqJS21asQn3yWPdA8XjKuDKAvHIZEcDd7ulI7qecaS8wUkgvd0uAEN3TFY8Cu Q7praHv8Glc+S5Tosdverm+5307xN2TKueJtcJhOdCozVNxMwu3q03hRNvioNytgzJDm Vn3w== X-Gm-Message-State: AOJu0YwaZMTXgNwZJmmeiXOmQRfa18swtFcBZD4/V00JXO1/AsNPa5O+ 1EbYYDERzEtGysH13SozgVqWTvwcbbHcL4fgmJA= X-Google-Smtp-Source: AGHT+IFj8IzwGcnPnFRiCmIasiy9wGENm5ekwE9+wh4vFcD4kTRFaMAamU7Mmd/aqFekuf8CJqCdFw== X-Received: by 2002:a05:6e02:214a:b0:349:7663:566c with SMTP id d10-20020a056e02214a00b003497663566cmr12482138ilv.30.1696209374268; Sun, 01 Oct 2023 18:16:14 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:14 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 11/34] test: lmb: Move tests into the lib suite Date: Sun, 1 Oct 2023 19:15:21 -0600 Message-ID: <20231002011553.463514-12-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean These tests are marked as driver model tests, but have nothing to do with driver model. As a result, they are run as part of 'ut dm' which only exists for sandbox. Move them to the 'lib' suite and drop the requirement for initing devices, since they don't use devices. Also put the lib_test_lmb_max_regions() macro inside the same #ifdef as its function, to avoid a build error if the condition is false. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/lib/lmb.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/test/lib/lmb.c b/test/lib/lmb.c index 162887503588..0eccd77114e1 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -205,8 +206,7 @@ static int lib_test_lmb_simple(struct unit_test_state *uts) /* simulate 512 MiB RAM beginning at 1.5GiB */ return test_multi_alloc_512mb(uts, 0xE0000000); } - -DM_TEST(lib_test_lmb_simple, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_simple, 0); /* Create two memory regions with one reserved region and allocate */ static int lib_test_lmb_simple_x2(struct unit_test_state *uts) @@ -221,8 +221,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state *uts) /* simulate 512 MiB RAM beginning at 3.5GiB and 1 GiB */ return test_multi_alloc_512mb_x2(uts, 0xE0000000, 0x40000000); } - -DM_TEST(lib_test_lmb_simple_x2, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_simple_x2, 0); /* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */ static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram) @@ -288,8 +287,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts) /* simulate 512 MiB RAM beginning at 1.5GiB */ return test_bigblock(uts, 0xE0000000); } - -DM_TEST(lib_test_lmb_big, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_big, 0); /* Simulate 512 MiB RAM, allocate a block without previous reservation */ static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram, @@ -364,7 +362,7 @@ static int lib_test_lmb_noreserved(struct unit_test_state *uts) return test_noreserved(uts, 0xE0000000, 4, 1); } -DM_TEST(lib_test_lmb_noreserved, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_noreserved, 0); static int lib_test_lmb_unaligned_size(struct unit_test_state *uts) { @@ -378,8 +376,8 @@ static int lib_test_lmb_unaligned_size(struct unit_test_state *uts) /* simulate 512 MiB RAM beginning at 1.5GiB */ return test_noreserved(uts, 0xE0000000, 5, 8); } +LIB_TEST(lib_test_lmb_unaligned_size, 0); -DM_TEST(lib_test_lmb_unaligned_size, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* * Simulate a RAM that starts at 0 and allocate down to address 0, which must * fail as '0' means failure for the lmb_alloc functions. @@ -421,8 +419,7 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts) return 0; } - -DM_TEST(lib_test_lmb_at_0, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_at_0, 0); /* Check that calling lmb_reserve with overlapping regions fails. */ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts) @@ -459,9 +456,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts) return 0; } - -DM_TEST(lib_test_lmb_overlapping_reserve, - UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_overlapping_reserve, 0); /* * Simulate 512 MiB RAM, reserve 3 blocks, allocate addresses in between. @@ -590,8 +585,7 @@ static int lib_test_lmb_alloc_addr(struct unit_test_state *uts) /* simulate 512 MiB RAM beginning at 1.5GiB */ return test_alloc_addr(uts, 0xE0000000); } - -DM_TEST(lib_test_lmb_alloc_addr, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_alloc_addr, 0); /* Simulate 512 MiB RAM, reserve 3 blocks, check addresses in between */ static int test_get_unreserved_size(struct unit_test_state *uts, @@ -661,9 +655,7 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts) /* simulate 512 MiB RAM beginning at 1.5GiB */ return test_get_unreserved_size(uts, 0xE0000000); } - -DM_TEST(lib_test_lmb_get_free_size, - UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_get_free_size, 0); #ifdef CONFIG_LMB_USE_MAX_REGIONS static int lib_test_lmb_max_regions(struct unit_test_state *uts) @@ -732,11 +724,9 @@ static int lib_test_lmb_max_regions(struct unit_test_state *uts) return 0; } +LIB_TEST(lib_test_lmb_max_regions, 0); #endif -DM_TEST(lib_test_lmb_max_regions, - UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); - static int lib_test_lmb_flags(struct unit_test_state *uts) { const phys_addr_t ram = 0x40000000; @@ -822,6 +812,4 @@ static int lib_test_lmb_flags(struct unit_test_state *uts) return 0; } - -DM_TEST(lib_test_lmb_flags, - UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +LIB_TEST(lib_test_lmb_flags, 0); From patchwork Mon Oct 2 01:15:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841891 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=GVILjJC0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNkz61HVz1ypx for ; Mon, 2 Oct 2023 12:33:31 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B1D2387242; Mon, 2 Oct 2023 03:18:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="GVILjJC0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75B5887253; Mon, 2 Oct 2023 03:18:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6A8A08723E for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3512740906dso46299855ab.0 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209375; x=1696814175; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EMpGCSnSZSuNOcfUgEMpTMWGM0trZQFTZzt1Dvzh63s=; b=GVILjJC0Kp8xB/REkzBsRgS7QL407ZxyqrGmp88EukE9n1fHNo75G844NNePw8J+Kn Eu3XJ6flnbiPVE2cEm2hFQv88veHLwSxs5VvjRoYpeBpO5EmwyeiWXDwc0n5Rk1lu0u/ hYC1TVp6PSuIu0AVUWqwfSEZ6JMryROmHvS8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209375; x=1696814175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EMpGCSnSZSuNOcfUgEMpTMWGM0trZQFTZzt1Dvzh63s=; b=NUyuQSFnNWnQ6mDwar+OMUQhiryzlJHu4MdO/YQUgWcEhTpG7mYLEmwnGuBWmEB3c8 NSMrZ+ZmHT6Qf6eH+dirIi+HNF8A1qBcCjums3eAdveqnUxisGB/5P53SzEj/SYPCBNd hQtWiaqpRpaqpq/K/9XAEF8Qql1LquDc7o89k42NfgvDXRY6EN5B0ttbQtLv91VqRPpP PR3CoPkHA2x3CbFLvdY0MfylnblJ7FAdgWKxYBAheHup34G4H3d7QgcyLdW5Y5z081Yb ShGp5N7z3/H5Dzt1RSAP+xSHo5ZRI6/CPV1r0HJECt7l+M5ko6SH+foft5T+OvWiUj3q q9Ug== X-Gm-Message-State: AOJu0YzGQRqkJ3dLHELWXQOVGZZFTOzcTu10KMvch/fNN7p2HTyscq6G vl7kqa1tTmoXtDOO0tXnO62KSPxvt2LJ+qOXdNk= X-Google-Smtp-Source: AGHT+IFcmONtRZOBktuiZi6lomJr3a0RKHlxNAvwEFOGIsuqPA6hwtSHy5uVm/yT7rj4mdVxWk6M7A== X-Received: by 2002:a05:6e02:12e3:b0:351:4bf9:5b02 with SMTP id l3-20020a056e0212e300b003514bf95b02mr13448343iln.7.1696209375353; Sun, 01 Oct 2023 18:16:15 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:14 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Marek Vasut Subject: [PATCH 12/34] test: print: Skip test on x86 Date: Sun, 1 Oct 2023 19:15:22 -0600 Message-ID: <20231002011553.463514-13-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean These tests cannot work on x86 machines as memory at address zero is not writable. Add a condition to skip these. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/print_ut.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/print_ut.c b/test/print_ut.c index b26f6281b013..bb844d2542b7 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -170,6 +170,10 @@ static int print_display_buffer(struct unit_test_state *uts) u8 *buf; int i; + /* This test requires writable memory at zero */ + if (IS_ENABLED(CONFIG_X86)) + return -EAGAIN; + buf = map_sysmem(0, BUF_SIZE); memset(buf, '\0', BUF_SIZE); for (i = 0; i < 0x11; i++) @@ -275,6 +279,10 @@ static int print_do_hex_dump(struct unit_test_state *uts) u8 *buf; int i; + /* This test requires writable memory at zero */ + if (IS_ENABLED(CONFIG_X86)) + return -EAGAIN; + buf = map_sysmem(0, BUF_SIZE); memset(buf, '\0', BUF_SIZE); for (i = 0; i < 0x11; i++) From patchwork Mon Oct 2 01:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841896 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=em9FT1RD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNlr5QYqz1ypx for ; Mon, 2 Oct 2023 12:34:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF8EB8744C; Mon, 2 Oct 2023 03:18:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="em9FT1RD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9B2F87236; Mon, 2 Oct 2023 03:18:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6F17B87242 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-351574aca7bso27037625ab.3 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209376; x=1696814176; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ef+FG1laRf6GpXs0zPc0HbqvD3FXNBHO3i/3EhSvTp8=; b=em9FT1RDRo2V2ijZdaQbrSKMiqdAXVQmlzIx0qqwIS566rn2dhD3buy+63IwjnADq5 tCVlpfi3Uips1Tq65w2m5qEOSzO3CdhUUxfbFt1E7DeKfj56krFgKyb7kY/POLInYj+s duEGzCPoQUrXdZPVTrJTtKJL1F/YyUIJH+1fA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209376; x=1696814176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ef+FG1laRf6GpXs0zPc0HbqvD3FXNBHO3i/3EhSvTp8=; b=U55mI53i9qwzXEGg6ahNiIvg5f/4qTW5gtrnKn9iPu4VE4flyPYrOaxwJZwFIt9074 zi+9lkfbc+D/ZkTzCCRDjKFwFsesG4OAsaex6Pf7nQ16iOB1BSFRSJHmVSGVzN6qLres cy2p+UME5AHXn+HVt+I/acitJKcLhTLuFjYML8FRWVoVGOWZ9RcUZwFNHBKfAJQm6R0k d+Eadk7oAdGerPYsAutMvSQwvUuIpdkO2VlWid912b/XnRGNzPlBqj0Ka110oe09y/n0 hll1VNze8JefTPOuKA2r/+SdaT8j463JEjQ5NlKurUq0u3F8ih4azipzEDSyVXXquVTr bjrQ== X-Gm-Message-State: AOJu0YyEJD+KFVLxgWDtfGWqnXLVdcyMkw3eDVPH2cMh+kom0SaIaQmx 3lOO892JdYiulHj1oF7RzIV0IeaDpVsJBFhRmGU= X-Google-Smtp-Source: AGHT+IF8WR7+6uE6LkO3YTEPhw8mHxCHgA33zVEw59vuChLhXlXhUwyJvbK51RsqjW3RZWtw44qj8g== X-Received: by 2002:a05:6e02:1bc9:b0:34b:aa34:a5c4 with SMTP id x9-20020a056e021bc900b0034baa34a5c4mr11963622ilv.30.1696209376554; Sun, 01 Oct 2023 18:16:16 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:16 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Bin Meng , Harald Seiler , Heinrich Schuchardt , Marek Vasut Subject: [PATCH 13/34] video: Add a function to clear the display Date: Sun, 1 Oct 2023 19:15:23 -0600 Message-ID: <20231002011553.463514-14-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Move the code from the 'cls' command into the console file, so it can be called from elsewhere. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- cmd/cls.c | 25 +++---------------------- common/console.c | 31 +++++++++++++++++++++++++++++++ include/console.h | 10 ++++++++++ 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/cmd/cls.c b/cmd/cls.c index 1125a3f81bbb..80d0558d4679 100644 --- a/cmd/cls.c +++ b/cmd/cls.c @@ -7,33 +7,14 @@ */ #include #include +#include #include -#include - -#define CSI "\x1b[" static int do_video_clear(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - __maybe_unused struct udevice *dev; - - /* - * Send clear screen and home - * - * FIXME(Heinrich Schuchardt ): This should go - * through an API and only be written to serial terminals, not video - * displays - */ - printf(CSI "2J" CSI "1;1H"); - if (IS_ENABLED(CONFIG_VIDEO_ANSI)) - return 0; - - if (IS_ENABLED(CONFIG_VIDEO)) { - if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) - return CMD_RET_FAILURE; - if (vidconsole_clear_and_reset(dev)) - return CMD_RET_FAILURE; - } + if (console_clear()) + return CMD_RET_FAILURE; return CMD_RET_SUCCESS; } diff --git a/common/console.c b/common/console.c index 98c3ee6ca6b8..1ffda49c87e0 100644 --- a/common/console.c +++ b/common/console.c @@ -19,12 +19,15 @@ #include #include #include +#include #include #include #include DECLARE_GLOBAL_DATA_PTR; +#define CSI "\x1b[" + static int on_console(const char *name, const char *value, enum env_op op, int flags) { @@ -1010,6 +1013,34 @@ int console_init_f(void) return 0; } +int console_clear(void) +{ + /* + * Send clear screen and home + * + * FIXME(Heinrich Schuchardt ): This should go + * through an API and only be written to serial terminals, not video + * displays + */ + printf(CSI "2J" CSI "1;1H"); + if (IS_ENABLED(CONFIG_VIDEO_ANSI)) + return 0; + + if (IS_ENABLED(CONFIG_VIDEO)) { + struct udevice *dev; + int ret; + + ret = uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev); + if (ret) + return ret; + ret = vidconsole_clear_and_reset(dev); + if (ret) + return ret; + } + + return 0; +} + static void stdio_print_current_devices(void) { char *stdinname, *stdoutname, *stderrname; diff --git a/include/console.h b/include/console.h index ceb733b5cb69..e29817e57b00 100644 --- a/include/console.h +++ b/include/console.h @@ -156,6 +156,16 @@ int console_announce_r(void); */ void console_puts_select_stderr(bool serial_only, const char *s); +/** + * console_clear() - Clear the console + * + * Uses an ANSI sequence to clear the display, failing back to clearing the + * video display directly if !CONFIG_VIDEO_ANSI + * + * Return: 0 if OK, -ve on error + */ +int console_clear(void); + /* * CONSOLE multiplexing. */ From patchwork Mon Oct 2 01:15:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841889 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=WwMM/bS3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNkT2cMbz1ypx for ; Mon, 2 Oct 2023 12:33:05 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A085B87256; Mon, 2 Oct 2023 03:18:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="WwMM/bS3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9224C87254; Mon, 2 Oct 2023 03:17:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 456B087234 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-79f82b26abfso561333639f.1 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209377; x=1696814177; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gl3X0xI53XjBuGVwFhWPktFYHy255FHxFMP1grC5Qvs=; b=WwMM/bS3M3b4WZ3fbNvUAfDqxq8mElF0AM4vwknW38t73rMp1I3GTi2JbhUusjcm3M nYYcPqyXxmu11N6KCNNyTW/eaUFJOmjrX5jzsai/7i03UWrYbl4FNak0z+s6ZXvVgSbt kiIY6MQydkN+guD2hCPn9wXi5z1bMsMsepI1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209377; x=1696814177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gl3X0xI53XjBuGVwFhWPktFYHy255FHxFMP1grC5Qvs=; b=DnL+oLcWdSY5Q7Kq+WsEBCzoBo1jbWDJonjj607duxtEYSgSOlZg9obYb76yXaM8bE NngPxC8kKnVDWo1hjdAETmmWamA6C6JC1Wsnz2uCn+II4hgE5S7X5zS+M8QcXaGjgqDb eDG0yy6qsT63Ty06ZI9G5cMbyp26yOk7g8ZGjRnmY7Spfmkd5rb3AVxglQ8ZWAjNwn9r 1gO4iHhIBLpxhrL8Zhen6DuckNhyZQredAqOUSzg5fkmxO7twOsYCeQRKDDQUUFtQ8z5 ZQFiutb/QGD/+buLM4GIjigrNTUqvycrM5lrOd9h3+RFn4yLQn/Ci6ilPFrACy1Wei68 DVNQ== X-Gm-Message-State: AOJu0Yx1C9HPnVFPG6Yo8UBMIZMBgKWxggvrrQwDBkOUuJAMFgn8OvdM wDbVfUBHVvY3IsPrBysojWVBalpiKPQrmyQLGR8= X-Google-Smtp-Source: AGHT+IFZ9i1TqOGCSfhiyK24TNInqHW44Gnz1/La0QlU40oeK5eWp0CvlU8IxpmJQEU0kgWtzj9yxw== X-Received: by 2002:a5d:8851:0:b0:794:d7e8:d239 with SMTP id t17-20020a5d8851000000b00794d7e8d239mr11782380ios.17.1696209377720; Sun, 01 Oct 2023 18:16:17 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:17 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Abdellatif El Khlifi , Heinrich Schuchardt , Ilias Apalodimas , Ramon Fried , Sean Edmond , Tobias Waldekranz Subject: [PATCH 14/34] sandbox: Add a dummy booti command Date: Sun, 1 Oct 2023 19:15:24 -0600 Message-ID: <20231002011553.463514-15-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Add basic sandbox support for 'booti' so we can start to boot the test ARMbian image. This is helpful in checking that it is parsed correctly. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- arch/sandbox/lib/bootm.c | 7 +++++++ cmd/Kconfig | 2 +- cmd/booti.c | 2 +- configs/tools-only_defconfig | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c index dc8b8e46cb41..a748ba650b12 100644 --- a/arch/sandbox/lib/bootm.c +++ b/arch/sandbox/lib/bootm.c @@ -78,3 +78,10 @@ int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *image return 0; } + +/* used for testing 'booti' command */ +int booti_setup(ulong image, ulong *relocated_addr, ulong *size, + bool force_reloc) +{ + return 0; +} diff --git a/cmd/Kconfig b/cmd/Kconfig index 34e1c91a15a9..987f7d8cf623 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -305,7 +305,7 @@ config CMD_BOOTZ config CMD_BOOTI bool "booti" - depends on ARM64 || RISCV + depends on ARM64 || RISCV || SANDBOX default y help Boot an AArch64 Linux Kernel image from memory. diff --git a/cmd/booti.c b/cmd/booti.c index 6ac39193db80..a20e65196f72 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -75,7 +75,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc, unmap_sysmem((void *)ld); ret = booti_setup(ld, &relocated_addr, &image_size, false); - if (ret != 0) + if (ret || IS_ENABLED(CONFIG_SANDBOX)) return 1; /* Handle BOOTM_STATE_LOADOS */ diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index 3f588ea69bee..b54d2cefa100 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -6,8 +6,8 @@ CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y # CONFIG_SANDBOX_SDL is not set CONFIG_ANDROID_BOOT_IMAGE=y -CONFIG_FIT=y CONFIG_TIMESTAMP=y +CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y # CONFIG_BOOTSTD_FULL is not set # CONFIG_BOOTMETH_CROS is not set @@ -16,6 +16,7 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd" # CONFIG_CMD_BOOTD is not set # CONFIG_CMD_BOOTM is not set +# CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_EXTENSION is not set # CONFIG_CMD_DATE is not set From patchwork Mon Oct 2 01:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841886 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=QF4ahdZe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNjs5Lt2z1ypx for ; Mon, 2 Oct 2023 12:32:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75E958720E; Mon, 2 Oct 2023 03:17:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="QF4ahdZe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3B512870F7; Mon, 2 Oct 2023 03:17:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 55C9F8722C for ; Mon, 2 Oct 2023 03:17:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3515deaa7c1so23375005ab.2 for ; Sun, 01 Oct 2023 18:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209379; x=1696814179; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J48Mn5wbsUERptAMWNXHdljGIN8T1gmxnN9MjhXeU2I=; b=QF4ahdZeNgDiGU7TyqQYxMB2QBirp50r0P5Lpl6GAc5sDfxnEhYm3tk2itoyXqBeff qKx1G6unBAkqCDOQqSjpO2spsQ9j/EVvlCT058+I3EugwFOSOK1TlE+wrCF+H0GB3AfB 8uCJjTEvTC34/5Z9xMYsRtnWClSJYAsG3qkdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209379; x=1696814179; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J48Mn5wbsUERptAMWNXHdljGIN8T1gmxnN9MjhXeU2I=; b=bvY9n1luxDjFayCklHcxk6A3Vm+4B73uc10kkNqmo1l+5++WbQWxzHLTr1+WdjBBbZ K8eQKVlq5cxOo+bCpchW4mmNOUk63ZrKl748hgc3dWSbfG77TFjaYo50JDV2CCfSFOfT gbHRVchttXi6s3ROPjpuTxA8rzLIx6vpSNZRgkjdOCVZ5kWB/ZsACy7ryfxoXVqGrsdg xjCRR+fSgIg+ydqtd/UYm8Hwv5gr2VAQILD722yXLEomTgwvzPqZlvmqwyHEFGh4bHeP Nf3BVYJq5o1CiqUtvjCVj6o/ZlOUTITizl17RkQ9xQfLhU49wzik5DemoLgq38YQX95L dSdw== X-Gm-Message-State: AOJu0Yz571vfdd9Og6JEl8XHTBNux2oBFkfOrGcDnzqZ/WRWqw9w33eo X+feGj4s/k+CY5dNtB9d6pgwi8Q33aoMKVQKmo8= X-Google-Smtp-Source: AGHT+IH5zgM+f0SKgwfkkO5/+5LF6wX2Pff7hQSogzZCUTKDfAqhy+krDTKjpLXHvRZuKeqjIEr/SQ== X-Received: by 2002:a05:6e02:1112:b0:351:80c:bc29 with SMTP id u18-20020a056e02111200b00351080cbc29mr10109408ilk.17.1696209379272; Sun, 01 Oct 2023 18:16:19 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 15/34] bootstd: Add a menu option to bootflow scan Date: Sun, 1 Oct 2023 19:15:25 -0600 Message-ID: <20231002011553.463514-16-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Allow showing a menu and automatically booting, with 'bootflow scan'. This is more convenient than using a script. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- cmd/bootflow.c | 27 +++++++++++-- doc/usage/cmd/bootflow.rst | 5 +++ test/boot/bootflow.c | 82 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 4 deletions(-) diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 1516f8a4193b..e4ed4ab83d9d 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -135,7 +135,7 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc, struct udevice *dev = NULL; struct bootflow bflow; bool all = false, boot = false, errors = false, no_global = false; - bool list = false, no_hunter = false; + bool list = false, no_hunter = false, menu = false, text_mode = false; int num_valid = 0; const char *label = NULL; bool has_args; @@ -155,6 +155,8 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc, no_global = strchr(argv[1], 'G'); list = strchr(argv[1], 'l'); no_hunter = strchr(argv[1], 'H'); + menu = strchr(argv[1], 'm'); + text_mode = strchr(argv[1], 't'); argc--; argv++; } @@ -213,15 +215,32 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc, } if (list) show_bootflow(i, &bflow, errors); - if (boot && !bflow.err) + if (!menu && boot && !bflow.err) bootflow_run_boot(&iter, &bflow); } bootflow_iter_uninit(&iter); if (list) show_footer(i, num_valid); - if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && !num_valid && !list) - printf("No bootflows found; try again with -l\n"); + if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && IS_ENABLED(CONFIG_EXPO)) { + if (!num_valid && !list) { + printf("No bootflows found; try again with -l\n"); + } else if (menu) { + struct bootflow *sel_bflow; + + ret = bootflow_handle_menu(std, text_mode, &sel_bflow); + if (!ret && boot) { + ret = console_clear(); + if (ret) { + log_err("Failed to clear console: %dE\n", + ret); + return ret; + } + + bootflow_run_boot(NULL, sel_bflow); + } + } + } return 0; } diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index 6a0645c28d07..795d5990bdc3 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -52,6 +52,8 @@ Flags are: matters, since by then the system boots in the OS and U-Boot is no-longer running. `bootflow scan -b` is a quick way to boot the first available OS. A valid bootflow is one that made it all the way to the `loaded` state. + Note that if `-m` is provided as well, booting is delayed until the user + selects a bootflow. -e Used with -l to also show errors for each bootflow. The shows detailed error @@ -71,6 +73,9 @@ Flags are: priority or label is tried, to see if more bootdevs can be discovered, but this flag disables that process. +-m + Show a menu of available bootflows for the user to select. When used with + -b it then boots the one that was selected, if any. The optional argument specifies a particular bootdev to scan. This can either be the name of a bootdev or its sequence number (both shown with `bootdev list`). diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 04a5bd5d7a80..a57f5017364a 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -637,6 +637,88 @@ static int bootflow_cmd_menu(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_cmd_menu, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +/* Check 'bootflow scan -m' to select a bootflow using a menu */ +static int bootflow_scan_menu(struct unit_test_state *uts) +{ + struct bootstd_priv *std; + const char **old_order, **new_order; + char prev[3]; + + /* get access to the current bootflow */ + ut_assertok(bootstd_get_priv(&std)); + + ut_assertok(prep_mmc_bootdev(uts, "mmc4", false, &old_order)); + + /* Add keypresses to move to and select the second one in the list */ + prev[0] = CTL_CH('n'); + prev[1] = '\r'; + prev[2] = '\0'; + ut_asserteq(2, console_in_puts(prev)); + + ut_assertok(run_command("bootflow scan -lm", 0)); + new_order = std->bootdev_order; + std->bootdev_order = old_order; + + ut_assert_skip_to_line("No more bootdevs"); + ut_assert_nextlinen("--"); + ut_assert_nextline("(2 bootflows, 2 valid)"); + + ut_assert_nextline("Selected: Armbian"); + ut_assertnonnull(std->cur_bootflow); + ut_assert_console_end(); + + /* Check not selecting anything */ + prev[0] = '\e'; + prev[1] = '\0'; + ut_asserteq(1, console_in_puts(prev)); + + std->bootdev_order = new_order; /* Blue Monday */ + ut_assertok(run_command("bootflow scan -lm", 0)); + std->bootdev_order = old_order; + + ut_assertnull(std->cur_bootflow); + ut_assert_skip_to_line("(2 bootflows, 2 valid)"); + ut_assert_nextline("Nothing chosen"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_scan_menu, + UT_TESTF_DM | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); + +/* Check 'bootflow scan -mb' to select and boot a bootflow using a menu */ +static int bootflow_scan_menu_boot(struct unit_test_state *uts) +{ + struct bootstd_priv *std; + const char **old_order; + char prev[3]; + + /* get access to the current bootflow */ + ut_assertok(bootstd_get_priv(&std)); + + ut_assertok(prep_mmc_bootdev(uts, "mmc4", false, &old_order)); + + /* Add keypresses to move to and select the second one in the list */ + prev[0] = CTL_CH('n'); + prev[1] = '\r'; + prev[2] = '\0'; + ut_asserteq(2, console_in_puts(prev)); + + ut_assertok(run_command("bootflow scan -lmb", 0)); + std->bootdev_order = old_order; + + ut_assert_skip_to_line("(2 bootflows, 2 valid)"); + + ut_assert_nextline("Selected: Armbian"); + ut_assert_skip_to_line("Boot failed (err=-14)"); + ut_assertnonnull(std->cur_bootflow); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_scan_menu_boot, + UT_TESTF_DM | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); + /* Check searching for a single bootdev using the hunters */ static int bootflow_cmd_hunt_single(struct unit_test_state *uts) { From patchwork Mon Oct 2 01:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841898 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KkpGqER/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNmD3tt8z1ypx for ; Mon, 2 Oct 2023 12:34:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 06A668724F; Mon, 2 Oct 2023 03:18:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KkpGqER/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F68B87237; Mon, 2 Oct 2023 03:18:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6A2CC8723C for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-3513b5a9e8eso38279685ab.0 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209380; x=1696814180; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PqJ3k6eq+fONjC6XAXk7qX5shaMeXvNPDIB9TpkZMUA=; b=KkpGqER/qoP0CmlLVlRE4UfKX5lx2W2ySylk1YcJy8i2lKEhZRfablF8IJtiuq61eZ 4QcUoT6rC30+My/bphCMi0X1v5RfpeMomcXzXqawJlNAzhx1TXiq62ZXWQai7lw++pSh 7B1fF/CBfMlfTU7iLLVVH8lkDtMQuKE7jIlI4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209380; x=1696814180; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PqJ3k6eq+fONjC6XAXk7qX5shaMeXvNPDIB9TpkZMUA=; b=td4Fpqb9eE4NSuuPnVwmEIljoYGJowlGH0M7FUifoh/8onrv63fIY5nUgGxM8ckJeL ExTam8kTWtnvPAooyLMAX8DmZBbjBd2i2kdAF/WQ6X6hw9KALv97vkyiNzDIpsQwzFK5 r/6+R9MrEl6Sgaq8C9iIb6NmpREaOfetTm6LIrqDsnKGvYRbx0qExQg2FZXsD2zpW4X/ eLc0x0utGJJJ7/ooa377Uv7AP+DVASyRv/ZdlfT06pDKBwVyLdMjUhgYyrv9Q4EMWoXf rNL87vvKZfuTk5kogcK+6Y3Pl1RF2RgastQ8LuV09yfPjTt2QEs1K4cQSGsD11MvihI/ Dtmg== X-Gm-Message-State: AOJu0Yz5zXBfiZm9ztL5O0boUs9QkWNsMEY3TbzuMJV+mnhDnXzg4hvF 1PpzmeIre1oAjvqnpL/kubuSBx7hkYMtnvl0wuQ= X-Google-Smtp-Source: AGHT+IFSOMnLgItpjQ0UpwlvgMzRyHr4Y1nAXHXWSk/3DuWrXGHr1kjWS2swiUk7nh7UdJwyZZLdMA== X-Received: by 2002:a92:d249:0:b0:352:609f:e4af with SMTP id v9-20020a92d249000000b00352609fe4afmr9138186ilg.24.1696209380276; Sun, 01 Oct 2023 18:16:20 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 16/34] video: Add a dark-grey console colour Date: Sun, 1 Oct 2023 19:15:26 -0600 Message-ID: <20231002011553.463514-17-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This is useful for highlighting something with a black background, as is needed with cedit when using a white-on-black console. Add this as a new colour. Signed-off-by: Simon Glass --- boot/scene.c | 2 +- drivers/video/video-uclass.c | 3 +++ include/video.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/boot/scene.c b/boot/scene.c index d4dfb49ada15..0b37971b1ff4 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -346,7 +346,7 @@ static void scene_render_background(struct scene_obj *obj, bool box_only) /* draw a background for the object */ if (CONFIG_IS_ENABLED(SYS_WHITE_ON_BLACK)) { - fore = VID_BLACK; + fore = VID_DARK_GREY; back = VID_WHITE; } else { fore = VID_LIGHT_GRAY; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index f743ed74c818..51fafbb21747 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -281,6 +281,9 @@ static const struct vid_rgb colours[VID_COLOUR_COUNT] = { { 0xff, 0x00, 0xff }, /* bright magenta */ { 0x00, 0xff, 0xff }, /* bright cyan */ { 0xff, 0xff, 0xff }, /* white */ + + /* an extra one for menus */ + { 0x40, 0x40, 0x40 }, /* dark gray */ }; u32 video_index_to_colour(struct video_priv *priv, enum colour_idx idx) diff --git a/include/video.h b/include/video.h index 4d8df9baaada..ae9ce03f5bfa 100644 --- a/include/video.h +++ b/include/video.h @@ -179,6 +179,7 @@ enum colour_idx { VID_LIGHT_MAGENTA, VID_LIGHT_CYAN, VID_WHITE, + VID_DARK_GREY, VID_COLOUR_COUNT }; From patchwork Mon Oct 2 01:15:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841887 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=QwlHYzNt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNk2513mz1ypx for ; Mon, 2 Oct 2023 12:32:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 08E828722B; Mon, 2 Oct 2023 03:17:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="QwlHYzNt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 828BC870F7; Mon, 2 Oct 2023 03:17:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 543128722B for ; Mon, 2 Oct 2023 03:17:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-79f915e5b47so569164439f.2 for ; Sun, 01 Oct 2023 18:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209381; x=1696814181; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SDNfNlWmelUXYrbhlsuE5MbymORdCwHI6pICU8wVXLg=; b=QwlHYzNtccr88S2tCX8ZAMiO2cT48kq7uT6tIUHLazEadR8vMzlM7US66fnmCtcon2 dWg9l+ppzJ7z5DBVxHIDs2vhpC5TMqdgX9wpPWkUyYmwr/xcaS+q2or0v8xP3Zsn+ZEC u9rE6cZKJI8gthkzSUaJNsRWHn28Z/bNT+jjs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209381; x=1696814181; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SDNfNlWmelUXYrbhlsuE5MbymORdCwHI6pICU8wVXLg=; b=i6U+fR8V6nxU4AklDZEGCKGnAj6rl+gaQAfeZewj0QV9PXMSDjPKXSQExZ+z2ZkdJH 0miDhFqjiwyDyPWrau3zmoc2J0pN+KVZyK3Onjx/S9Op4ls6Yw3PkTbM2vXt1DCCvxkK Xf5453hJzE/wpzJmm3/jEeaY6oq7tgBzCK8b8H/eHimqMgyQVBNphnnOEgdAWmVFj68e ZEhFARyDFZcxJ9zRjIKcc8x9ubMIS5VSzkx6M+kdXxfVjVzdqPUO24jAzoDn1lWxjTYA Nfsr75nmUF6p8eS4OpKdjr1VAQtID6b+spdksv5N4FZ441f2kD3mey4lRo4s1HyjjOjr 5dIg== X-Gm-Message-State: AOJu0YxutW4yXoIxnDVRv51qeXivmvYU2fy8HvXUAeJBAFYUNYqWloyT cyf5+fiJyji9fQ3OW/wihbHI1Dq6relXs4lpBWw= X-Google-Smtp-Source: AGHT+IElLEvB5NRwxf1Q4n0KjuJ3jaAjmYIF6tAerpi3tEx9hqzopfl+xWjK6m3XN73q8UHNWj66rw== X-Received: by 2002:a5d:9cda:0:b0:785:ca70:46a2 with SMTP id w26-20020a5d9cda000000b00785ca7046a2mr12452870iow.4.1696209381199; Sun, 01 Oct 2023 18:16:21 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 17/34] video: Avoid starting a new line to close to the bottom Date: Sun, 1 Oct 2023 19:15:27 -0600 Message-ID: <20231002011553.463514-18-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean When starting a new text line, an assumption is made that the current vertical position is a multiple of the character height. When this is not true, characters can be written after the end of the framebuffer. This can causes crashes and strange errors from QEMU. Adjust the scrolling check when processing a newline character, to avoid any problems. Add some comments to make things a little clearer. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 4 +++- include/video.h | 3 ++- include/video_console.h | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index a312a1985242..a8d2199147dd 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -94,7 +94,9 @@ static void vidconsole_newline(struct udevice *dev) priv->ycur += priv->y_charsize; /* Check if we need to scroll the terminal */ - if ((priv->ycur + priv->y_charsize) / priv->y_charsize > priv->rows) { + if (vid_priv->rot % 2 ? + priv->ycur + priv->x_charsize > vid_priv->xsize : + priv->ycur + priv->y_charsize > vid_priv->ysize) { vidconsole_move_rows(dev, 0, rows, priv->rows - rows); for (i = 0; i < rows; i++) vidconsole_set_row(dev, priv->rows - i - 1, diff --git a/include/video.h b/include/video.h index ae9ce03f5bfa..e20f1173762e 100644 --- a/include/video.h +++ b/include/video.h @@ -78,7 +78,8 @@ enum video_format { * * @xsize: Number of pixel columns (e.g. 1366) * @ysize: Number of pixels rows (e.g.. 768) - * @rot: Display rotation (0=none, 1=90 degrees clockwise, etc.) + * @rot: Display rotation (0=none, 1=90 degrees clockwise, etc.). THis + * does not affect @xsize and @ysize * @bpix: Encoded bits per pixel (enum video_log2_bpp) * @format: Pixel format (enum video_format) * @vidconsole_drv_name: Driver to use for the text console, NULL to diff --git a/include/video_console.h b/include/video_console.h index bde67fa9a5a9..ecbf183b3d03 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -27,6 +27,14 @@ enum { * Drivers must set up @rows, @cols, @x_charsize, @y_charsize in their probe() * method. Drivers may set up @xstart_frac if desired. * + * Note that these values relate to the rotated console, so that an 80x25 + * console which is rotated 90 degrees will have rows=80 and cols=25 + * + * The xcur_frac and ycur values refer to the unrotated coordinates, that is + * xcur_frac always advances with each character, even if its limit might be + * vid_priv->ysize instead of vid_priv->xsize if the console is rotated 90 or + * 270 degrees. + * * @sdev: stdio device, acting as an output sink * @xcur_frac: Current X position, in fractional units (VID_TO_POS(x)) * @ycur: Current Y position in pixels (0=top) From patchwork Mon Oct 2 01:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841890 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=etZ4u59r; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNkd3RY7z1ypx for ; Mon, 2 Oct 2023 12:33:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E905787257; Mon, 2 Oct 2023 03:18:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="etZ4u59r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 691DD87252; Mon, 2 Oct 2023 03:17:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 45A4987235 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3526c9c401aso3803175ab.1 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209382; x=1696814182; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g4ZAtvULpjRGWlNvdw15pitwhS7O+DxpeQt9tVtQFu0=; b=etZ4u59rfhPzR/B548xtb3dxTUr9wUZFtNx2soYCvpgdN4IXFheUk+tnVkbHdYwt8W jrzUcfgmHc2utG6my/SsLsvhmRpAeaZO9lK/koSRuyoLchFqGLO85e7dh1mG6s4aY5nI /FLgXR0c1gweuICUNvImz/J9pKk52g0Jq74Jw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209382; x=1696814182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g4ZAtvULpjRGWlNvdw15pitwhS7O+DxpeQt9tVtQFu0=; b=BFJmMHXkH2LF1QIOywtpMiFdkxTS+PDUJS8azT3asiSexP7jERviNUnUdl6ktXZrFC ROhBz8+vSIYnz4+ULk4h6RKS5o4UuvogCcSvl2zBXdRG1lbBv18snUhZ67qJq2myiXge yNzfYEPRPCeqOJt7FDvNZkTqt7IgeS/xomz5eygb9y1uKZQlSREaIJFnqmjmmdlH9JHw 3nflrwdEAGAOPm6mvu2zEV0ls+amfHYzuZZ92/xtXhZXbOHh6a2FdrP4VAY1vEqye/O4 p32nv+3qrduw24835PDQin5XVnETL0E/TdYk7T383zc17rpt5fnYlZCz1kmt+fpCzLIr jKeQ== X-Gm-Message-State: AOJu0Yx6yPpb5hLH9U1lhdjR4D49XjhChFUwBUN3XYw4cA0y8PwkhmES qzwyMbCp79Oc9x+v6KyTfHyFblR/vlnpgN3E1Bw= X-Google-Smtp-Source: AGHT+IGxPaVfb6QBA0Nox7v3nGWEVOGYsO68Rl0ko4GjdfjBWZGmge4Q7CyPNsriAstlSeVynKOVEg== X-Received: by 2002:a05:6e02:1d12:b0:34f:30f0:d4e6 with SMTP id i18-20020a056e021d1200b0034f30f0d4e6mr8328754ila.1.1696209382329; Sun, 01 Oct 2023 18:16:22 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Dan Carpenter Subject: [PATCH 18/34] expo: Place menu items to the right of all labels Date: Sun, 1 Oct 2023 19:15:28 -0600 Message-ID: <20231002011553.463514-19-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean At present a fixed position is used for menu items, 200 pixels to the right of the left side of the labels. This means that a menu item with a very long label may overlap the items. It seems better to calculate the maximum label width and then place the items to the right of all of them. To implement this, add a new struct to containing arrangement information. Calculate it before doing the actual arrangement. Add a new style item which sets the amount of space from the right side of the labels to left side of the items. Signed-off-by: Simon Glass --- boot/cedit.c | 13 ++++++++--- boot/expo.c | 2 ++ boot/scene.c | 52 +++++++++++++++++++++++++++++++++++++++++-- boot/scene_internal.h | 20 +++++++++++++++-- boot/scene_menu.c | 9 +++++--- boot/scene_textline.c | 3 ++- doc/develop/expo.rst | 4 ++++ include/expo.h | 12 ++++++++++ 8 files changed, 104 insertions(+), 11 deletions(-) diff --git a/boot/cedit.c b/boot/cedit.c index 8c654dba6dc3..b5f89e945bce 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -52,10 +52,11 @@ struct cedit_iter_priv { int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) { + struct expo_arrange_info arr; struct scene_obj_txt *txt; struct scene_obj *obj; struct scene *scn; - int y; + int y, ret; scn = expo_lookup_scene_id(exp, scene_id); if (!scn) @@ -69,6 +70,11 @@ int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) if (txt) scene_obj_set_pos(scn, txt->obj.id, 200, 10); + memset(&arr, '\0', sizeof(arr)); + ret = scene_calc_arrange(scn, &arr); + if (ret < 0) + return log_msg_ret("arr", ret); + y = 100; list_for_each_entry(obj, &scn->obj_head, sibling) { switch (obj->type) { @@ -78,12 +84,13 @@ int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) break; case SCENEOBJT_MENU: scene_obj_set_pos(scn, obj->id, 50, y); - scene_menu_arrange(scn, (struct scene_obj_menu *)obj); + scene_menu_arrange(scn, &arr, + (struct scene_obj_menu *)obj); y += 50; break; case SCENEOBJT_TEXTLINE: scene_obj_set_pos(scn, obj->id, 50, y); - scene_textline_arrange(scn, + scene_textline_arrange(scn, &arr, (struct scene_obj_textline *)obj); y += 50; break; diff --git a/boot/expo.c b/boot/expo.c index cadb6a0ad6e3..d030820e77ca 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -259,6 +259,8 @@ int expo_apply_theme(struct expo *exp, ofnode node) ofnode_read_u32(node, "font-size", &theme->font_size); ofnode_read_u32(node, "menu-inset", &theme->menu_inset); ofnode_read_u32(node, "menuitem-gap-y", &theme->menuitem_gap_y); + ofnode_read_u32(node, "menu-title-margin-x", + &theme->menu_title_margin_x); list_for_each_entry(scn, &exp->scene_head, sibling) { ret = scene_apply_theme(scn, theme); diff --git a/boot/scene.c b/boot/scene.c index 0b37971b1ff4..56569e76e9f2 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -478,11 +478,59 @@ static int scene_obj_render(struct scene_obj *obj, bool text_mode) return 0; } +int scene_calc_arrange(struct scene *scn, struct expo_arrange_info *arr) +{ + struct scene_obj *obj; + + arr->label_width = 0; + list_for_each_entry(obj, &scn->obj_head, sibling) { + uint label_id = 0; + int width; + + switch (obj->type) { + case SCENEOBJT_NONE: + case SCENEOBJT_IMAGE: + case SCENEOBJT_TEXT: + break; + case SCENEOBJT_MENU: { + struct scene_obj_menu *menu; + + menu = (struct scene_obj_menu *)obj, + label_id = menu->title_id; + break; + } + case SCENEOBJT_TEXTLINE: { + struct scene_obj_textline *tline; + + tline = (struct scene_obj_textline *)obj, + label_id = tline->label_id; + break; + } + } + + if (label_id) { + int ret; + + ret = scene_obj_get_hw(scn, label_id, &width); + if (ret < 0) + return log_msg_ret("hei", ret); + arr->label_width = max(arr->label_width, width); + } + } + + return 0; +} + int scene_arrange(struct scene *scn) { + struct expo_arrange_info arr; struct scene_obj *obj; int ret; + ret = scene_calc_arrange(scn, &arr); + if (ret < 0) + return log_msg_ret("arr", ret); + list_for_each_entry(obj, &scn->obj_head, sibling) { switch (obj->type) { case SCENEOBJT_NONE: @@ -493,7 +541,7 @@ int scene_arrange(struct scene *scn) struct scene_obj_menu *menu; menu = (struct scene_obj_menu *)obj, - ret = scene_menu_arrange(scn, menu); + ret = scene_menu_arrange(scn, &arr, menu); if (ret) return log_msg_ret("arr", ret); break; @@ -502,7 +550,7 @@ int scene_arrange(struct scene *scn) struct scene_obj_textline *tline; tline = (struct scene_obj_textline *)obj, - ret = scene_textline_arrange(scn, tline); + ret = scene_textline_arrange(scn, &arr, tline); if (ret) return log_msg_ret("arr", ret); break; diff --git a/boot/scene_internal.h b/boot/scene_internal.h index e72202c98213..be25f6a8b967 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -96,10 +96,12 @@ int scene_calc_dims(struct scene *scn, bool do_menus); * if not already done * * @scn: Scene to update + * @arr: Arrangement information * @menu: Menu to process * Returns: 0 if OK, -ve on error */ -int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu); +int scene_menu_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj_menu *menu); /** * scene_textline_arrange() - Set the position of things in a textline @@ -108,10 +110,12 @@ int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu); * positioned correctly relative to the textline. * * @scn: Scene to update + * @arr: Arrangement information * @tline: textline to process * Returns: 0 if OK, -ve on error */ -int scene_textline_arrange(struct scene *scn, struct scene_obj_textline *tline); +int scene_textline_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj_textline *tline); /** * scene_apply_theme() - Apply a theme to a scene @@ -358,4 +362,16 @@ int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline); */ int scene_textline_close(struct scene *scn, struct scene_obj_textline *tline); +/** + * scene_calc_arrange() - Calculate sizes needed to arrange a scene + * + * Checks the size of some objects and stores this info to help with a later + * scene arrangement + * + * @scn: Scene to check + * @arr: Place to put scene-arrangement info + * Returns: 0 if OK, -ve on error + */ +int scene_calc_arrange(struct scene *scn, struct expo_arrange_info *arr); + #endif /* __SCENE_INTERNAL_H */ diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 63994165efba..dbf6eacb2983 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -169,7 +169,8 @@ int scene_menu_calc_dims(struct scene_obj_menu *menu) return 0; } -int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu) +int scene_menu_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj_menu *menu) { const bool open = menu->obj.flags & SCENEOF_OPEN; struct expo *exp = scn->expo; @@ -183,16 +184,18 @@ int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu) x = menu->obj.dim.x; y = menu->obj.dim.y; if (menu->title_id) { + int width; + ret = scene_obj_set_pos(scn, menu->title_id, menu->obj.dim.x, y); if (ret < 0) return log_msg_ret("tit", ret); - ret = scene_obj_get_hw(scn, menu->title_id, NULL); + ret = scene_obj_get_hw(scn, menu->title_id, &width); if (ret < 0) return log_msg_ret("hei", ret); if (stack) - x += 200; + x += arr->label_width + theme->menu_title_margin_x; else y += ret * 2; } diff --git a/boot/scene_textline.c b/boot/scene_textline.c index 6ea072a1c268..576a402a688d 100644 --- a/boot/scene_textline.c +++ b/boot/scene_textline.c @@ -85,7 +85,8 @@ int scene_textline_calc_dims(struct scene_obj_textline *tline) return 0; } -int scene_textline_arrange(struct scene *scn, struct scene_obj_textline *tline) +int scene_textline_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj_textline *tline) { const bool open = tline->obj.flags & SCENEOF_OPEN; bool point; diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index c87b6ec81285..f7b636e5fc62 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -176,6 +176,10 @@ menu-inset menuitem-gap-y Number of pixels between menu items +menu-title-margin-x + Number of pixels between right side of menu title to the left size of the + menu labels + Pop-up mode ----------- diff --git a/include/expo.h b/include/expo.h index 3260703a7a01..4f62ee077e1f 100644 --- a/include/expo.h +++ b/include/expo.h @@ -59,11 +59,14 @@ struct expo_action { * @font_size: Default font size for all text * @menu_inset: Inset width (on each side and top/bottom) for menu items * @menuitem_gap_y: Gap between menu items in pixels + * @menu_title_margin_x: Gap between right side of menu title and left size of + * menu label */ struct expo_theme { u32 font_size; u32 menu_inset; u32 menuitem_gap_y; + u32 menu_title_margin_x; }; /** @@ -341,6 +344,15 @@ struct scene_obj_textline { uint pos; }; +/** + * struct expo_arrange_info - Information used when arranging a scene + * + * @label_width: Maximum width of labels in scene + */ +struct expo_arrange_info { + int label_width; +}; + /** * expo_new() - create a new expo * From patchwork Mon Oct 2 01:15:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841894 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=K83X2xud; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNlN3pf4z1ypx for ; Mon, 2 Oct 2023 12:33:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F8DC87269; Mon, 2 Oct 2023 03:18:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="K83X2xud"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9986D870EA; Mon, 2 Oct 2023 03:18:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7054B87243 for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-79fa2125e19so506084139f.0 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209383; x=1696814183; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MMZt3NAo41qXyBI7M75GvdM9AhkhHzy9jzVE4YbMLmU=; b=K83X2xud1vV+tY+8ePINOoBq0yKi67CXesaHP7HykWwFaXZjw7CWsK+nMQZGC6eRzG 4P3dkO77ehiaPtgvijMMLKxI+lstVaM9NFoaB6h7nJV6WxiYEktzpYzMzGlF/TyAIPvh /6hYdydGLfrvSXqjLd+5+tswI5KinRNjaetGo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209383; x=1696814183; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MMZt3NAo41qXyBI7M75GvdM9AhkhHzy9jzVE4YbMLmU=; b=KkJ2GDh6XqtG3lwJv2tZudIYqUXsT1qqmyV+zgDCLRdXztXdkD/0aLs2B8+YYXeAQ9 5hkK3HwsQ9C1tfwepXAhuPG+Up6lFE2zptLBHpBa2OH1vfnTnUWQ6KyIgw8wUa8pY5Q2 THNum7zMKOLdk2UPkDqv1uPAyJ/LlNT6vIn8hA6Rk7cOWyh34321HHxaE5zXF5sFlOGH TadzTZr8mMGc+DZTEAHb8F6G35dxxhIWdu6Cz6eC9KJR5LlmInIIUwl7U7SXRivumb9M 1KY19g89geCvnmnxwMgnIX042I1ttEpO1Tyi3XbjjsdNGqLUazn5TcXXC1AZ3LLCtU6q AWZg== X-Gm-Message-State: AOJu0YxnAYRmYh1tapSKs7fqGaQjGLXXMbV9mJNqCEq87spITH5swfMJ 0r3xvayHwG+ktMBQFbCXIahCryyPzowMQp2ElKE= X-Google-Smtp-Source: AGHT+IGTM8hz+9pJrIKDmFkL6IjoQIFd+8iQQ4yIlmI6VS99bTBTrQn4PHbpoUvqoloSHv1aTmvZSA== X-Received: by 2002:a05:6e02:1112:b0:351:80c:bc29 with SMTP id u18-20020a056e02111200b00351080cbc29mr10109521ilk.17.1696209383347; Sun, 01 Oct 2023 18:16:23 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 19/34] expo: Set the initial next_id to 1 Date: Sun, 1 Oct 2023 19:15:29 -0600 Message-ID: <20231002011553.463514-20-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean If expo_set_dynamic_start() is never called, the first scene created will have an ID of 0, which is invalid. Correct this by setting a default value. Add a test to check this. Signed-off-by: Simon Glass --- boot/expo.c | 1 + test/boot/expo.c | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index d030820e77ca..20ca0b9bfa0a 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -30,6 +30,7 @@ int expo_new(const char *name, void *priv, struct expo **expp) exp->priv = priv; INIT_LIST_HEAD(&exp->scene_head); INIT_LIST_HEAD(&exp->str_head); + exp->next_id = 1; *expp = exp; diff --git a/test/boot/expo.c b/test/boot/expo.c index 714fdfa415d1..8a84cbc71032 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -92,7 +92,7 @@ static int expo_base(struct unit_test_state *uts) *name = '\0'; ut_assertnonnull(exp); ut_asserteq(0, exp->scene_id); - ut_asserteq(0, exp->next_id); + ut_asserteq(1, exp->next_id); /* Make sure the name was allocated */ ut_assertnonnull(exp->name); @@ -131,7 +131,7 @@ static int expo_scene(struct unit_test_state *uts) ut_assertok(expo_new(EXPO_NAME, NULL, &exp)); scn = NULL; - ut_asserteq(0, exp->next_id); + ut_asserteq(1, exp->next_id); strcpy(name, SCENE_NAME1); id = scene_new(exp, name, SCENE1, &scn); *name = '\0'; @@ -168,6 +168,25 @@ static int expo_scene(struct unit_test_state *uts) } BOOTSTD_TEST(expo_scene, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +/* Check creating a scene with no ID */ +static int expo_scene_no_id(struct unit_test_state *uts) +{ + struct scene *scn; + struct expo *exp; + char name[100]; + int id; + + ut_assertok(expo_new(EXPO_NAME, NULL, &exp)); + ut_asserteq(1, exp->next_id); + + strcpy(name, SCENE_NAME1); + id = scene_new(exp, SCENE_NAME1, 0, &scn); + ut_asserteq(1, scn->id); + + return 0; +} +BOOTSTD_TEST(expo_scene_no_id, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + /* Check creating a scene with objects */ static int expo_object(struct unit_test_state *uts) { From patchwork Mon Oct 2 01:15:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841895 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=iqaSDiOq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNlq1tDZz1ypx for ; Mon, 2 Oct 2023 12:34:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 765BE87451; Mon, 2 Oct 2023 03:18:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="iqaSDiOq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5EADB87239; Mon, 2 Oct 2023 03:18:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7FAD18724B for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-79f95cd15dfso527756939f.0 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209384; x=1696814184; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qe3GQjoyQdT3lX4h6Ltw6z+qTY9lauHEC+qNK+0EqxI=; b=iqaSDiOqzQs8rMAkZM/uLXpk8WnZEKC/dYAW2kkYMXUrWpv/n6nZCDofayiNCOJY2f N+2ueJUxHfDHy0jD6xqtMgAoY9NDBPfj0bfh0jgBxOYN3bZawwUK5zNENpxVKaXb8+fn mrOoHj+JaSbUvkIjIk3lmCml6CgEEOkI5SICA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209384; x=1696814184; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qe3GQjoyQdT3lX4h6Ltw6z+qTY9lauHEC+qNK+0EqxI=; b=tuMMs1upDC55kcFP8tgMowh7jems+/982bUHEUYzczjDKkFuCrpjZw7vCtx1dG4J0s lgkssVWmOmvc4Uino7iAt5xrYG9X1jrgLPAJStCNWtmQwbsxebmSVv7u6kuzheMoRC4B /8jf01cVu4uqEBxeTgEJ+isofh3sy48Dw1YM4a3Yy+II9gStGUzGcBnjBTME552dxL9E 26SqhVMF9DrqPmUHJQHBeeFBhCsm1R5pIiXPdlHZqEIDEQ7L4zkbvDQwuPrr66BOBaun LIaJy3xBACK59RtB6s2fdgJyG9WqnMtydhVLEejx3ic60CBhKLjatBA9CQ5lMhRkm3Ls E9sA== X-Gm-Message-State: AOJu0Yyae3DItY8lFEbX8F8s3nFN9bjl34BPLhv5YNMN2tTi1QH7rvuY Nu2ve5MJpZot7GrDPSXgPNr9z/KGD2uHXxmU70I= X-Google-Smtp-Source: AGHT+IGC1w09NMutwnuYk/D4lQISIlf1rqvtDDIOMCK2onsuMnDJHvHm2/m9xjBwXaQGsPgTb71fNA== X-Received: by 2002:a6b:e005:0:b0:785:d4f5:2225 with SMTP id z5-20020a6be005000000b00785d4f52225mr12511373iog.19.1696209384339; Sun, 01 Oct 2023 18:16:24 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 20/34] expo: Use standard numbering for save and discard Date: Sun, 1 Oct 2023 19:15:30 -0600 Message-ID: <20231002011553.463514-21-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Set aside some expo IDs for 'save' and 'discard' buttons. This avoids needing to store the IDs for these. Adjust the documentation and expo tool for the new EXPOID_BASE_ID value. Ignore these objects when saving and loading the cedit, since they do not contain real data. Adjust 'cedit run' to return failure when the user exits the expo without saving. Update the test for this change as well. Signed-off-by: Simon Glass --- boot/cedit.c | 24 +++++++++++++++++++++--- boot/expo.c | 2 +- doc/develop/cedit.rst | 7 ++++++- doc/develop/expo.rst | 12 ++++++++---- include/expo.h | 20 ++++++++++++++++++++ include/test/cedit-test.h | 30 +++++++++++++++--------------- test/boot/cedit.c | 14 ++++++++------ test/boot/expo.c | 8 ++++---- test/boot/files/expo_ids.h | 3 +-- tools/expo.py | 33 ++++++++++++++++++++++++++++----- 10 files changed, 112 insertions(+), 41 deletions(-) diff --git a/boot/cedit.c b/boot/cedit.c index b5f89e945bce..a53a4f289906 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -155,7 +155,7 @@ int cedit_run(struct expo *exp) struct video_priv *vid_priv; uint scene_id; struct scene *scn; - bool done; + bool done, save; int ret; cli_ch_init(cch); @@ -165,6 +165,7 @@ int cedit_run(struct expo *exp) scene_id = ret; done = false; + save = false; do { struct expo_action act; int ichar, key; @@ -209,6 +210,15 @@ int cedit_run(struct expo *exp) case EXPOACT_OPEN: scene_set_open(scn, act.select.id, true); cedit_arange(exp, vid_priv, scene_id); + switch (scn->highlight_id) { + case EXPOID_SAVE: + done = true; + save = true; + break; + case EXPOID_DISCARD: + done = true; + break; + } break; case EXPOACT_CLOSE: scene_set_open(scn, act.select.id, false); @@ -230,6 +240,8 @@ int cedit_run(struct expo *exp) if (ret) return log_msg_ret("end", ret); + if (!save) + return -EACCES; return 0; } @@ -478,6 +490,9 @@ static int h_write_settings_env(struct scene_obj *obj, void *vpriv) const char *str; int val, ret; + if (obj->id < EXPOID_BASE_ID) + return 0; + snprintf(var, sizeof(var), "c.%s", obj->name); switch (obj->type) { @@ -550,6 +565,9 @@ static int h_read_settings_env(struct scene_obj *obj, void *vpriv) char var[60]; int val; + if (obj->id < EXPOID_BASE_ID) + return 0; + snprintf(var, sizeof(var), "c.%s", obj->name); switch (obj->type) { @@ -645,7 +663,7 @@ static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv) int val, ret; uint i, seq; - if (obj->type != SCENEOBJT_MENU) + if (obj->type != SCENEOBJT_MENU || obj->id < EXPOID_BASE_ID) return 0; menu = (struct scene_obj_menu *)obj; @@ -735,7 +753,7 @@ static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv) int val, ret; uint i; - if (obj->type != SCENEOBJT_MENU) + if (obj->type != SCENEOBJT_MENU || obj->id < EXPOID_BASE_ID) return 0; menu = (struct scene_obj_menu *)obj; diff --git a/boot/expo.c b/boot/expo.c index 20ca0b9bfa0a..2a1591cce6a4 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -30,7 +30,7 @@ int expo_new(const char *name, void *priv, struct expo **expp) exp->priv = priv; INIT_LIST_HEAD(&exp->scene_head); INIT_LIST_HEAD(&exp->str_head); - exp->next_id = 1; + exp->next_id = EXPOID_BASE_ID; *expp = exp; diff --git a/doc/develop/cedit.rst b/doc/develop/cedit.rst index 82305b921f0a..310be8892404 100644 --- a/doc/develop/cedit.rst +++ b/doc/develop/cedit.rst @@ -94,7 +94,7 @@ them. Expo supports doing this with an enum, where every ID is listed in the enum:: enum { - ZERO, + ID_PROMPT = EXPOID_BASE_ID, ID_PROMPT, @@ -130,6 +130,11 @@ that means that something is wrong with your syntax, or perhaps you have an ID in the `.dts` file that is not mentioned in your enum. Check both files and try again. +Note that the first ID in your file must be no less that `EXPOID_BASE_ID` since +IDs before that are reserved. The `expo.py` tool automatically obtains this +value from the `expo.h` header file, but you must set the first ID to this +enum value. + Use the command interface ------------------------- diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index f7b636e5fc62..d8115c463c1b 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -88,8 +88,13 @@ or even the IDs of objects. Programmatic creation of many items in a loop can be handled by allocating space in the enum for a maximum number of items, then adding the loop count to the enum values to obtain unique IDs. -Where dynamic IDs are need, use expo_set_dynamic_start() to set the start value, -so that they are allocated above the starting (enum) IDs. +Some standard IDs are reserved for certain purposes. These are defined by +`enum expo_id_t` and start at 1. `EXPOID_BASE_ID` defines the first ID which +can be used for an expo. + +An ID of 0 is invalid. If this is specified in an expo call then a valid +'dynamic IDs is allocated. Use expo_set_dynamic_start() to set the start +value, so that they are allocated above the starting (enum) IDs. All text strings are stored in a structure attached to the expo, referenced by a text ID. This makes it easier at some point to implement multiple languages or @@ -417,8 +422,7 @@ strings are provided inline in the nodes where they are used. /* this comment is parsed by the expo.py tool to insert the values below enum { - ZERO, - ID_PROMPT, + ID_PROMPT = EXPOID_BASE_ID, ID_SCENE1, ID_SCENE1_TITLE, diff --git a/include/expo.h b/include/expo.h index 4f62ee077e1f..4198c96adaa6 100644 --- a/include/expo.h +++ b/include/expo.h @@ -15,6 +15,26 @@ struct udevice; #include +/** + * enum expo_id_t - standard expo IDs + * + * These are assumed to be in use at all times. Expos should use IDs starting + * from EXPOID_BASE_ID, + * + * @EXPOID_NONE: Not used, invalid ID 0 + * @EXPOID_SAVE: User has requested that the expo data be saved + * @EXPOID_DISCARD: User has requested that the expo data be discarded + * @EXPOID_BASE_ID: First ID which can be used for expo objects + */ +enum expo_id_t { + EXPOID_NONE, + + EXPOID_SAVE, + EXPOID_DISCARD, + + EXPOID_BASE_ID = 5, +}; + /** * enum expoact_type - types of actions reported by the expo * diff --git a/include/test/cedit-test.h b/include/test/cedit-test.h index 475ecc9c2dc2..0d38a9534156 100644 --- a/include/test/cedit-test.h +++ b/include/test/cedit-test.h @@ -9,24 +9,24 @@ #ifndef __cedit_test_h #define __cedit_test_h -#define ID_PROMPT 1 -#define ID_SCENE1 2 -#define ID_SCENE1_TITLE 3 +#define ID_PROMPT 5 +#define ID_SCENE1 6 +#define ID_SCENE1_TITLE 7 -#define ID_CPU_SPEED 4 -#define ID_CPU_SPEED_TITLE 5 -#define ID_CPU_SPEED_1 6 -#define ID_CPU_SPEED_2 7 -#define ID_CPU_SPEED_3 8 +#define ID_CPU_SPEED 8 +#define ID_CPU_SPEED_TITLE 9 +#define ID_CPU_SPEED_1 10 +#define ID_CPU_SPEED_2 11 +#define ID_CPU_SPEED_3 12 -#define ID_POWER_LOSS 9 -#define ID_AC_OFF 10 -#define ID_AC_ON 11 -#define ID_AC_MEMORY 12 +#define ID_POWER_LOSS 13 +#define ID_AC_OFF 14 +#define ID_AC_ON 15 +#define ID_AC_MEMORY 16 -#define ID_MACHINE_NAME 13 -#define ID_MACHINE_NAME_EDIT 14 +#define ID_MACHINE_NAME 17 +#define ID_MACHINE_NAME_EDIT 18 -#define ID_DYNAMIC_START 15 +#define ID_DYNAMIC_START 19 #endif diff --git a/test/boot/cedit.c b/test/boot/cedit.c index aa4171904864..37807f9a9818 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -34,9 +34,11 @@ static int cedit_base(struct unit_test_state *uts) * ^N Move down to second item * ^M Select item * \e Quit + * + * cedit_run() returns -EACCESS so this command returns CMD_RET_FAILURE */ console_in_puts("\x0e\x0d\x0e\x0d\e"); - ut_assertok(run_command("cedit run", 0)); + ut_asserteq(1, run_command("cedit run", 0)); exp = cur_exp; scn = expo_lookup_scene_id(exp, exp->scene_id); @@ -152,14 +154,14 @@ static int cedit_env(struct unit_test_state *uts) strcpy(str, "my-machine"); ut_assertok(run_command("cedit write_env -v", 0)); - ut_assert_nextlinen("c.cpu-speed=7"); + ut_assert_nextlinen("c.cpu-speed=11"); ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz"); - ut_assert_nextlinen("c.power-loss=10"); + ut_assert_nextlinen("c.power-loss=14"); ut_assert_nextlinen("c.power-loss-str=Always Off"); ut_assert_nextlinen("c.machine-name=my-machine"); ut_assert_console_end(); - ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0)); + ut_asserteq(11, env_get_ulong("c.cpu-speed", 10, 0)); ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str")); ut_asserteq_str("my-machine", env_get("c.machine-name")); @@ -168,8 +170,8 @@ static int cedit_env(struct unit_test_state *uts) *str = '\0'; ut_assertok(run_command("cedit read_env -v", 0)); - ut_assert_nextlinen("c.cpu-speed=7"); - ut_assert_nextlinen("c.power-loss=10"); + ut_assert_nextlinen("c.cpu-speed=11"); + ut_assert_nextlinen("c.power-loss=14"); ut_assert_nextlinen("c.machine-name=my-machine"); ut_assert_console_end(); diff --git a/test/boot/expo.c b/test/boot/expo.c index 8a84cbc71032..2e8acac07313 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -92,7 +92,7 @@ static int expo_base(struct unit_test_state *uts) *name = '\0'; ut_assertnonnull(exp); ut_asserteq(0, exp->scene_id); - ut_asserteq(1, exp->next_id); + ut_asserteq(EXPOID_BASE_ID, exp->next_id); /* Make sure the name was allocated */ ut_assertnonnull(exp->name); @@ -131,7 +131,7 @@ static int expo_scene(struct unit_test_state *uts) ut_assertok(expo_new(EXPO_NAME, NULL, &exp)); scn = NULL; - ut_asserteq(1, exp->next_id); + ut_asserteq(EXPOID_BASE_ID, exp->next_id); strcpy(name, SCENE_NAME1); id = scene_new(exp, name, SCENE1, &scn); *name = '\0'; @@ -177,11 +177,11 @@ static int expo_scene_no_id(struct unit_test_state *uts) int id; ut_assertok(expo_new(EXPO_NAME, NULL, &exp)); - ut_asserteq(1, exp->next_id); + ut_asserteq(EXPOID_BASE_ID, exp->next_id); strcpy(name, SCENE_NAME1); id = scene_new(exp, SCENE_NAME1, 0, &scn); - ut_asserteq(1, scn->id); + ut_asserteq(EXPOID_BASE_ID, scn->id); return 0; } diff --git a/test/boot/files/expo_ids.h b/test/boot/files/expo_ids.h index a86e0d06f6b5..ffb511364b1f 100644 --- a/test/boot/files/expo_ids.h +++ b/test/boot/files/expo_ids.h @@ -4,8 +4,7 @@ */ enum { - ZERO, - ID_PROMPT, + ID_PROMPT = EXPOID_BASE_ID, ID_SCENE1, ID_SCENE1_TITLE, diff --git a/tools/expo.py b/tools/expo.py index ea80c70f04e3..44995f28a382 100755 --- a/tools/expo.py +++ b/tools/expo.py @@ -20,17 +20,22 @@ from u_boot_pylib import tools # Parse: # SCENE1 = 7, +# or SCENE1 = EXPOID_BASE_ID, # or SCENE2, -RE_ENUM = re.compile(r'(\S*)(\s*= (\d))?,') +RE_ENUM = re.compile(r'(\S*)(\s*= ([0-9A-Z_]+))?,') # Parse #define "string" RE_DEF = re.compile(r'#define (\S*)\s*"(.*)"') -def calc_ids(fname): +# Parse EXPOID_BASE_ID = 5, +RE_BASE_ID = re.compile(r'\s*EXPOID_BASE_ID\s*= (\d+),') + +def calc_ids(fname, base_id): """Figure out the value of the enums in a C file Args: fname (str): Filename to parse + base_id (int): Base ID (value of EXPOID_BASE_ID) Returns: OrderedDict(): @@ -55,8 +60,12 @@ def calc_ids(fname): if not line or line.startswith('/*'): continue m_enum = RE_ENUM.match(line) - if m_enum.group(3): - cur_id = int(m_enum.group(3)) + enum_name = m_enum.group(3) + if enum_name: + if enum_name == 'EXPOID_BASE_ID': + cur_id = base_id + else: + cur_id = int(enum_name) vals[m_enum.group(1)] = cur_id cur_id += 1 else: @@ -67,10 +76,24 @@ def calc_ids(fname): return vals +def find_base_id(): + fname = 'include/expo.h' + base_id = None + with open(fname, 'r', encoding='utf-8') as inf: + for line in inf.readlines(): + m_base_id = RE_BASE_ID.match(line) + if m_base_id: + base_id = int(m_base_id.group(1)) + if base_id is None: + raise ValueError('EXPOID_BASE_ID not found in expo.h') + #print(f'EXPOID_BASE_ID={base_id}') + return base_id + def run_expo(args): """Run the expo program""" + base_id = find_base_id() fname = args.enum_fname or args.layout - ids = calc_ids(fname) + ids = calc_ids(fname, base_id) if not ids: print(f"Warning: No enum ID values found in file '{fname}'") From patchwork Mon Oct 2 01:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841899 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=UIHVfkjC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNmJ3sMSz1ypx for ; Mon, 2 Oct 2023 12:34:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BBC5787455; Mon, 2 Oct 2023 03:18:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UIHVfkjC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D590E8711F; Mon, 2 Oct 2023 03:18:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 82E298724F for ; Mon, 2 Oct 2023 03:17:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-79fe87cd74eso265624139f.3 for ; Sun, 01 Oct 2023 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209385; x=1696814185; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fu0RN5KSJakvqZw6WdG2vVEajrsGWtzLYlJxUtCmxQ8=; b=UIHVfkjCxlQCgAm7GAC9BUyvAalAae/QaOkHBsqDwSDZQlzVgR7ysG5ompUJxShefW B1ZX3CwG82ngHjynaNtwPn+vGhBRO79/8DreIqmx5YsgdctO4j+a7ULl1tgu2MQYzNLH xMIPjdtfhC6BNGtWWgPVJM+3ei2Ht/VLEwPJA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209385; x=1696814185; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fu0RN5KSJakvqZw6WdG2vVEajrsGWtzLYlJxUtCmxQ8=; b=B6pg4B1EcR06abiuO0KLHKwrt0HuprHiJoCPHw2ZAlRdZQVYAyVx8T4EdAJxiPIyiQ CjaWjhP3Tmx87Huz2S5j5CiG2FyxHK0ly7JieTAmh0MIbFmMsjDD2AAYHbSWUfQVpeWG 2DGAwKup/ol+JpLVKTSQkObsTFgmxI8drzdIxrOjm0sd7WfLFxAMQO7aI1YWPnzaBNXr E8ko7lma6w7V/MAztIzdYcyoK3I25cKI+cDZYiZvJCXsKCXbXBWOfLR0PAZyT6DIbB5L 3b8qrg5UXP5IdFg0lksw6IeJrlnJbKS+FetL2WJYcSA62uQ+Dv1Qr2B8VZWVT6Kytx0o 2ocw== X-Gm-Message-State: AOJu0Yx0E/ofkRdn4qT7xwiEKMP87YpJoFdDgLtU9HLmKlzKWKGpR4Nc l/T0A46LJKExmSmMF1RmXdWNGjKistiQGTxFjBk= X-Google-Smtp-Source: AGHT+IEqk2QP0AwPt1IaKAbuVZHY6a5YVciwjVcxZL/QDi/bjrsdsleSnL856i6wcPEilYm4jdgHfg== X-Received: by 2002:a5d:87c1:0:b0:787:34d:f1ea with SMTP id q1-20020a5d87c1000000b00787034df1eamr11773094ios.8.1696209385264; Sun, 01 Oct 2023 18:16:25 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Dan Carpenter Subject: [PATCH 21/34] expo: Allow menu items to have values Date: Sun, 1 Oct 2023 19:15:31 -0600 Message-ID: <20231002011553.463514-22-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean At present menu items are stored according to their sequence number in the menu. In some cases we may want to have holes in that sequence, or not use a sequence at all. Add a new 'value' property for menu items. This will be used for reading and writing, if present. If there is no 'value' property, then the normal sequence number will be used instead. Signed-off-by: Simon Glass --- arch/sandbox/dts/cedit.dtsi | 3 +++ boot/expo_build.c | 16 ++++++++++++---- boot/scene_internal.h | 10 ++++++++++ boot/scene_menu.c | 17 +++++++++++++++++ doc/develop/expo.rst | 10 ++++++++++ include/expo.h | 2 ++ test/boot/expo.c | 1 + test/boot/files/expo_layout.dts | 3 +++ 8 files changed, 58 insertions(+), 4 deletions(-) diff --git a/arch/sandbox/dts/cedit.dtsi b/arch/sandbox/dts/cedit.dtsi index 9bd84e629367..facd7a49befc 100644 --- a/arch/sandbox/dts/cedit.dtsi +++ b/arch/sandbox/dts/cedit.dtsi @@ -39,6 +39,9 @@ /* IDs for the menu items */ item-id = ; + + /* values for the menu items */ + item-value = <0 3 6>; }; power-loss { diff --git a/boot/expo_build.c b/boot/expo_build.c index d66d619911df..24ec4fc542a7 100644 --- a/boot/expo_build.c +++ b/boot/expo_build.c @@ -228,10 +228,10 @@ static void list_strings(struct build_info *info) static int menu_build(struct build_info *info, ofnode node, struct scene *scn, uint id, struct scene_obj **objp) { + const u32 *item_ids, *item_values; struct scene_obj_menu *menu; + int ret, size, i, num_items; uint title_id, menu_id; - const u32 *item_ids; - int ret, size, i; const char *name; name = ofnode_get_name(node); @@ -255,9 +255,15 @@ static int menu_build(struct build_info *info, ofnode node, struct scene *scn, return log_msg_ret("itm", -EINVAL); if (!size || size % sizeof(u32)) return log_msg_ret("isz", -EINVAL); - size /= sizeof(u32); + num_items = size / sizeof(u32); - for (i = 0; i < size; i++) { + item_values = ofnode_read_prop(node, "item-value", &size); + if (item_values) { + if (size != num_items * sizeof(u32)) + return log_msg_ret("vsz", -EINVAL); + } + + for (i = 0; i < num_items; i++) { struct scene_menitem *item; uint label, key, desc; @@ -281,6 +287,8 @@ static int menu_build(struct build_info *info, ofnode node, struct scene *scn, desc, 0, 0, &item); if (ret < 0) return log_msg_ret("mi", ret); + if (item_values) + item->value = fdt32_to_cpu(item_values[i]); } *objp = &menu->obj; diff --git a/boot/scene_internal.h b/boot/scene_internal.h index be25f6a8b967..ec9008ea593b 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -281,6 +281,16 @@ struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu, struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu, uint seq); +/** + * scene_menuitem_find_val() - Find the menu item with a given value + * + * @menu: Menu to check + * @find_val: Value to look for + * Return: menu item if found, else NULL + */ +struct scene_menitem *scene_menuitem_find_val(const struct scene_obj_menu *menu, + int val); + /** * scene_bbox_union() - update bouding box with the demensions of an object * diff --git a/boot/scene_menu.c b/boot/scene_menu.c index dbf6eacb2983..002821ec1f59 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -62,6 +62,22 @@ struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu, return NULL; } +struct scene_menitem *scene_menuitem_find_val(const struct scene_obj_menu *menu, + int val) +{ + struct scene_menitem *item; + uint i; + + i = 0; + list_for_each_entry(item, &menu->item_head, sibling) { + if (item->value == val) + return item; + i++; + } + + return NULL; +} + /** * update_pointers() - Update the pointer object and handle highlights * @@ -417,6 +433,7 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id, item->desc_id = desc_id; item->preview_id = preview_id; item->flags = flags; + item->value = INT_MAX; list_add_tail(&item->sibling, &menu->item_head); if (itemp) diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index d8115c463c1b..cc7c36173dbe 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -361,6 +361,13 @@ item-id Specifies the ID for each menu item. These are used for checking which item has been selected. +item-value + type: u32 list, optional + + Specifies the value for each menu item. These are used for saving and + loading. If this is omitted the value is its position in the menu (0..n-1). + Valid values are positive and negative integers INT_MIN...(INT_MAX - 1). + item-label / item-label-id type: string list / u32 list, required @@ -474,6 +481,9 @@ strings are provided inline in the nodes where they are used. /* IDs for the menu items */ item-id = ; + + /* values for the menu items */ + item-value = <(-1) 3 6>; }; power-loss { diff --git a/include/expo.h b/include/expo.h index 4198c96adaa6..bb329b9776dd 100644 --- a/include/expo.h +++ b/include/expo.h @@ -330,6 +330,7 @@ enum scene_menuitem_flags_t { * @desc_id: ID of text object to use as the description text * @preview_id: ID of the preview object, or 0 if none * @flags: Flags for this item + * @value: Value for this item, or INT_MAX to use sequence * @sibling: Node to link this item to its siblings */ struct scene_menitem { @@ -340,6 +341,7 @@ struct scene_menitem { uint desc_id; uint preview_id; uint flags; + int value; struct list_head sibling; }; diff --git a/test/boot/expo.c b/test/boot/expo.c index 2e8acac07313..75f31fe66907 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -719,6 +719,7 @@ static int expo_test_build(struct unit_test_state *uts) ut_asserteq(0, item->desc_id); ut_asserteq(0, item->preview_id); ut_asserteq(0, item->flags); + ut_asserteq(0, item->value); txt = scene_obj_find(scn, item->label_id, SCENEOBJT_NONE); ut_asserteq_str("2 GHz", expo_get_str(exp, txt->str_id)); diff --git a/test/boot/files/expo_layout.dts b/test/boot/files/expo_layout.dts index bed552288f4c..ebe5adb27bbe 100644 --- a/test/boot/files/expo_layout.dts +++ b/test/boot/files/expo_layout.dts @@ -39,6 +39,9 @@ item-id = ; + /* values for the menu items */ + item-value = <(-1) 3 6>; + start-bit = <0x400>; bit-length = <2>; }; From patchwork Mon Oct 2 01:15:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841897 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=QKPVwxu+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNm336n2z1ypx for ; Mon, 2 Oct 2023 12:34:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39222870D2; Mon, 2 Oct 2023 03:18:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="QKPVwxu+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39E9687239; Mon, 2 Oct 2023 03:18:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9E54B87178 for ; Mon, 2 Oct 2023 03:17:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-79fe99a5f29so249065439f.1 for ; Sun, 01 Oct 2023 18:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209386; x=1696814186; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UFsbFVKzTmwa7dFIkPaqueMQ/NY3xdCxttMz4X04WWk=; b=QKPVwxu+gfiwoMYhqRmuoJ+l1n7cQbzZpKuuYNybE6zMsKPYVhg3OKepgIHLatRthF 24muhzq1ICuXziqHzqewq9ycYdE06G/hV9HLgfR5p7sCu0tBxWLaejZrFljCuJdPmLGS IKfg4ffSSdQn4vJOhtUfxqahV4ktrlQ3HBdNY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209386; x=1696814186; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UFsbFVKzTmwa7dFIkPaqueMQ/NY3xdCxttMz4X04WWk=; b=m5PHoeDXSD2YjDceEBUesvF8blaFompaCBB/dKu8k71tdLYf1IT2CkvRLTAJ6hR9DN quir2FUWDOvLriwqqHWheZ0Y2iHLITpWj6ceoJ7CcFMdiV2Uuo1fkyA6w/SKvcQIkFUX s7QJiUtmd2KLMPQSzBH6SlIKME61ZhiNdsuZiDuvl+kJ8xpqYTn10IKHBT6odXrAb8xd hO4HrOpeNVAECO7ZJxqYstEi6XcSXUdSWrnvu2rmEBE8bEfXX9s4FwFTNThClF7J3cGj 3I61Mrwx6JKQA6ElhtiouWuL+6XUAz1sfaBg5gKsSoPJcJVio6N0Ojym3m5EMdCjr73C AICg== X-Gm-Message-State: AOJu0YySFAGnEJd6kMyTs/mKU5Joy8O0YLpgON+Jnml5EQlh63/0g+91 FEaQcbZwVdEF3+jK1Jp/BLEII4UbkyBkliLNRAo= X-Google-Smtp-Source: AGHT+IHBm0uyuAo4h0Q9hCMP55apggYgQSI+HyOKW+tKpeWho4owRxybclU25olQrtNIGBH/e+nxmg== X-Received: by 2002:a5e:8705:0:b0:787:1990:d2ec with SMTP id y5-20020a5e8705000000b007871990d2ecmr11038258ioj.12.1696209385958; Sun, 01 Oct 2023 18:16:25 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 22/34] expo: Add a little more cedit CMOS logging Date: Sun, 1 Oct 2023 19:15:32 -0600 Message-ID: <20231002011553.463514-23-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Add some more logging in the CMOS read/write code. Tidy up a few comments while we are here. Signed-off-by: Simon Glass --- boot/cedit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/boot/cedit.c b/boot/cedit.c index a53a4f289906..cc1d5b763577 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -585,7 +585,7 @@ static int h_read_settings_env(struct scene_obj *obj, void *vpriv) /* * note that no validation is done here, to make sure the ID is - * valid * and actually points to a menu item + * valid and actually points to a menu item */ menu->cur_item_id = val; break; @@ -719,6 +719,7 @@ int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, } /* write the data to the RTC */ + log_debug("Writing CMOS\n"); first = CMOS_MAX_BYTES; last = -1; for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) { @@ -786,6 +787,7 @@ static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv) } /* update the current item */ + log_debug("look for menuitem value %d in menu %d\n", val, menu->obj.id); mi = scene_menuitem_find_seq(menu, val); if (!mi) return log_msg_ret("seq", -ENOENT); @@ -820,7 +822,7 @@ int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, goto done; } - /* read the data to the RTC */ + /* indicate what bytes were read from the RTC */ first = CMOS_MAX_BYTES; last = -1; for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) { From patchwork Mon Oct 2 01:15:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841901 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JgK81Br+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNmt1fqpz1yp0 for ; Mon, 2 Oct 2023 12:35:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A91E08745E; Mon, 2 Oct 2023 03:18:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JgK81Br+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F26A28711F; Mon, 2 Oct 2023 03:18:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A210A87255 for ; Mon, 2 Oct 2023 03:17:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-79fc3d32a2fso415782539f.1 for ; Sun, 01 Oct 2023 18:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209387; x=1696814187; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FRPjUX38KMeoB/DAbeiNIBfOxYQzqsEfgyIsLdYBo/Q=; b=JgK81Br+eBFaZkfyPJ358yiaM3dQIj+puNk9V0Pzt9Gi17R6SbPCjLlK41U9aaRx2g SBizEIWY2YJbrKTUr/cNaAxc3gEoxr7TM/nfsC1PcN8lpRpdCJAlpKnRrhsqVreBtZHZ gdiAV4xhFO6F/yft3OfqEm3Lva3WAPGZ6KtVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209387; x=1696814187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FRPjUX38KMeoB/DAbeiNIBfOxYQzqsEfgyIsLdYBo/Q=; b=IVF35Bnrx8gpxJ9CUdBREd4gGtiReZZwF7BcaKoAshkUlaRRcE4tilW4HY7WE3RcMo tM47oJfscIqJ02BBYAkRKChvVmEnjFsfOvU/z5R4u9/DxGWt1/DxwMyjA9GUgl+H1uUl wYaNvHcp4+I/Bbg1dpgOqS8vY0xIsQiaMPKA7c8VMB7lzLye7pI2dfw6eayhlSAox3y1 tkPRkFTigaTQL4PzegHBvq0bh8e1cFmmKPBZetA34THOMkgKJvPcmvkUvuWRf1kKpxPP f1NLePgw8uqQP+Dtz5E4OPYP3g1Cr3TH5KRHnRt8u8TMlEa3Fh8MDqN/QsxK8Ky25EPK A7HA== X-Gm-Message-State: AOJu0Yx3vsjeYB7p/jbkNwSmVAIoxBE8spxPq2F7l1SwXjNL5jfShQvp nbqlEfb/bPMA3OL89zhA8ZksMRA+7tEG6f0feg0= X-Google-Smtp-Source: AGHT+IE4dRBrGzZGjC4uNQNVYqNApwEv8JmYatNWl/ues3oWTq4nK77wg3GPoLxi7+Yhu9FH+2Q30Q== X-Received: by 2002:a6b:d602:0:b0:79f:9b45:3365 with SMTP id w2-20020a6bd602000000b0079f9b453365mr10834570ioa.17.1696209386676; Sun, 01 Oct 2023 18:16:26 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Dan Carpenter Subject: [PATCH 23/34] expo: Support menu-item values in cedit Date: Sun, 1 Oct 2023 19:15:33 -0600 Message-ID: <20231002011553.463514-24-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Update the cedit read/write functions to support menu items with values. Signed-off-by: Simon Glass --- boot/cedit.c | 148 +++++++++++++++++++++----------- boot/scene_menu.c | 2 +- doc/usage/cmd/cedit.rst | 15 +++- test/boot/cedit.c | 8 +- test/boot/files/expo_layout.dts | 4 +- 5 files changed, 117 insertions(+), 60 deletions(-) diff --git a/boot/cedit.c b/boot/cedit.c index cc1d5b763577..7fc800940fbe 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -294,11 +294,49 @@ static int get_cur_menuitem_text(const struct scene_obj_menu *menu, return 0; } +/** + * get_cur_menuitem_val() - Get the value of a menu's current item + * + * Obtains the value of the current item in the menu. If no value, then + * enumerates the items of a menu (0, 1, 2) and returns the sequence number of + * the currently selected item. If the first item is selected, this returns 0; + * if the second, 1; etc. + * + * @menu: Menu to check + * @valp: Returns current-item value / sequence number + * Return: 0 on success, else -ve error value + */ +static int get_cur_menuitem_val(const struct scene_obj_menu *menu, int *valp) +{ + const struct scene_menitem *mi; + int seq; + + seq = 0; + list_for_each_entry(mi, &menu->item_head, sibling) { + if (mi->id == menu->cur_item_id) { + *valp = mi->value == INT_MAX ? seq : mi->value; + return 0; + } + seq++; + } + + return log_msg_ret("nf", -ENOENT); +} + +/** + * write_dt_string() - Write a string to the devicetree, expanding if needed + * + * If this fails, it tries again after expanding the devicetree a little + * + * @buf: Buffer containing the devicetree + * @name: Property name to use + * @str: String value + * Return: 0 if OK, -EFAULT if something went horribly wrong + */ static int write_dt_string(struct abuf *buf, const char *name, const char *str) { int ret, i; - /* write the text of the current item */ ret = -EAGAIN; for (i = 0; ret && i < 2; i++) { ret = fdt_property_string(abuf_data(buf), name, str); @@ -316,6 +354,38 @@ static int write_dt_string(struct abuf *buf, const char *name, const char *str) return 0; } +/** + * write_dt_u32() - Write an int to the devicetree, expanding if needed + * + * If this fails, it tries again after expanding the devicetree a little + * + * @buf: Buffer containing the devicetree + * @name: Property name to use + * @lva: Integer value + * Return: 0 if OK, -EFAULT if something went horribly wrong + */ +static int write_dt_u32(struct abuf *buf, const char *name, uint val) +{ + int ret, i; + + /* write the text of the current item */ + ret = -EAGAIN; + for (i = 0; ret && i < 2; i++) { + ret = fdt_property_u32(abuf_data(buf), name, val); + if (!i) { + ret = check_space(ret, buf); + if (ret) + return log_msg_ret("rs2", -ENOMEM); + } + } + + /* this should not happen */ + if (ret) + return log_msg_ret("str", -EFAULT); + + return 0; +} + static int h_write_settings(struct scene_obj *obj, void *vpriv) { struct cedit_iter_priv *priv = vpriv; @@ -340,23 +410,21 @@ static int h_write_settings(struct scene_obj *obj, void *vpriv) const struct scene_obj_menu *menu; const char *str; char name[80]; - int i; + int val; /* write the ID of the current item */ menu = (struct scene_obj_menu *)obj; - ret = -EAGAIN; - for (i = 0; ret && i < 2; i++) { - ret = fdt_property_u32(abuf_data(buf), obj->name, - menu->cur_item_id); - if (!i) { - ret = check_space(ret, buf); - if (ret) - return log_msg_ret("res", -ENOMEM); - } - } - /* this should not happen */ + ret = write_dt_u32(buf, obj->name, menu->cur_item_id); if (ret) - return log_msg_ret("wrt", -EFAULT); + return log_msg_ret("wrt", ret); + + snprintf(name, sizeof(name), "%s-value", obj->name); + ret = get_cur_menuitem_val(menu, &val); + if (ret < 0) + return log_msg_ret("cur", ret); + ret = write_dt_u32(buf, name, val); + if (ret) + return log_msg_ret("wr2", ret); ret = get_cur_menuitem_text(menu, &str); if (ret) @@ -522,6 +590,14 @@ static int h_write_settings_env(struct scene_obj *obj, void *vpriv) ret = env_set(name, str); if (ret) return log_msg_ret("st2", ret); + + ret = get_cur_menuitem_val(menu, &val); + if (ret < 0) + return log_msg_ret("cur", ret); + snprintf(name, sizeof(name), "c.%s-value", obj->name); + if (priv->verbose) + printf("%s=%d\n", name, val); + break; case SCENEOBJT_TEXTLINE: { const struct scene_obj_textline *tline; @@ -625,43 +701,12 @@ int cedit_read_settings_env(struct expo *exp, bool verbose) return 0; } -/** - * get_cur_menuitem_seq() - Get the sequence number of a menu's current item - * - * Enumerates the items of a menu (0, 1, 2) and returns the sequence number of - * the currently selected item. If the first item is selected, this returns 0; - * if the second, 1; etc. - * - * @menu: Menu to check - * Return: Sequence number on success, else -ve error value - */ -static int get_cur_menuitem_seq(const struct scene_obj_menu *menu) -{ - const struct scene_menitem *mi; - int seq, found; - - seq = 0; - found = -1; - list_for_each_entry(mi, &menu->item_head, sibling) { - if (mi->id == menu->cur_item_id) { - found = seq; - break; - } - seq++; - } - - if (found == -1) - return log_msg_ret("nf", -ENOENT); - - return found; -} - static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv) { const struct scene_obj_menu *menu; struct cedit_iter_priv *priv = vpriv; int val, ret; - uint i, seq; + uint i; if (obj->type != SCENEOBJT_MENU || obj->id < EXPOID_BASE_ID) return 0; @@ -669,11 +714,10 @@ static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv) menu = (struct scene_obj_menu *)obj; val = menu->cur_item_id; - ret = get_cur_menuitem_seq(menu); + ret = get_cur_menuitem_val(menu, &val); if (ret < 0) return log_msg_ret("cur", ret); - seq = ret; - log_debug("%s: seq=%d\n", menu->obj.name, seq); + log_debug("%s: val=%d\n", menu->obj.name, val); /* figure out where to place this item */ if (!obj->bit_length) @@ -681,11 +725,11 @@ static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv) if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS) return log_msg_ret("bit", -E2BIG); - for (i = 0; i < obj->bit_length; i++, seq >>= 1) { + for (i = 0; i < obj->bit_length; i++, val >>= 1) { uint bitnum = obj->start_bit + i; priv->mask[CMOS_BYTE(bitnum)] |= 1 << CMOS_BIT(bitnum); - if (seq & 1) + if (val & 1) priv->value[CMOS_BYTE(bitnum)] |= BIT(CMOS_BIT(bitnum)); log_debug("bit %x %x %x\n", bitnum, priv->mask[CMOS_BYTE(bitnum)], @@ -788,7 +832,7 @@ static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv) /* update the current item */ log_debug("look for menuitem value %d in menu %d\n", val, menu->obj.id); - mi = scene_menuitem_find_seq(menu, val); + mi = scene_menuitem_find_val(menu, val); if (!mi) return log_msg_ret("seq", -ENOENT); diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 002821ec1f59..86f5fd88804e 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -70,7 +70,7 @@ struct scene_menitem *scene_menuitem_find_val(const struct scene_obj_menu *menu, i = 0; list_for_each_entry(item, &menu->item_head, sibling) { - if (item->value == val) + if (item->value == INT_MAX ? val == i : item->value == val) return item; i++; } diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index f415b48699ea..0f0cc26e74ba 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -104,8 +104,10 @@ That results in:: / { cedit-values { cpu-speed = <0x00000006>; + cpu-speed-value = <0x00000003>; cpu-speed-str = "2 GHz"; power-loss = <0x0000000a>; + power-loss-value = <0x00000000>; power-loss-str = "Always Off"; }; } @@ -115,16 +117,23 @@ That results in:: This shows settings being stored in the environment:: => cedit write_env -v - c.cpu-speed=7 + c.cpu-speed=11 c.cpu-speed-str=2.5 GHz - c.power-loss=12 - c.power-loss-str=Memory + c.cpu-speed-value=3 + c.power-loss=14 + c.power-loss-str=Always Off + c.power-loss-value=0 + c.machine-name=my-machine + c.cpu-speed=11 + c.power-loss=14 + c.machine-name=my-machine => print ... c.cpu-speed=6 c.cpu-speed-str=2 GHz c.power-loss=10 c.power-loss-str=Always Off + c.machine-name=my-machine ... => cedit read_env -v diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 37807f9a9818..876503befe0b 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -100,14 +100,16 @@ static int cedit_fdt(struct unit_test_state *uts) ut_asserteq(ID_CPU_SPEED_2, ofnode_read_u32_default(node, "cpu-speed", 0)); + ut_asserteq(3, + ofnode_read_u32_default(node, "cpu-speed-value", 0)); ut_asserteq_str("2.5 GHz", ofnode_read_string(node, "cpu-speed-str")); ut_asserteq_str("my-machine", ofnode_read_string(node, "machine-name")); - /* There should only be 5 properties */ + /* There should only be 7 properties */ for (i = 0, ofnode_first_property(node, &prop); ofprop_valid(&prop); i++, ofnode_next_property(&prop)) ; - ut_asserteq(5, i); + ut_asserteq(7, i); ut_assert_console_end(); @@ -156,8 +158,10 @@ static int cedit_env(struct unit_test_state *uts) ut_assertok(run_command("cedit write_env -v", 0)); ut_assert_nextlinen("c.cpu-speed=11"); ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz"); + ut_assert_nextlinen("c.cpu-speed-value=3"); ut_assert_nextlinen("c.power-loss=14"); ut_assert_nextlinen("c.power-loss-str=Always Off"); + ut_assert_nextlinen("c.power-loss-value=0"); ut_assert_nextlinen("c.machine-name=my-machine"); ut_assert_console_end(); diff --git a/test/boot/files/expo_layout.dts b/test/boot/files/expo_layout.dts index ebe5adb27bbe..9bc1e4950b96 100644 --- a/test/boot/files/expo_layout.dts +++ b/test/boot/files/expo_layout.dts @@ -40,10 +40,10 @@ ID_CPU_SPEED_3>; /* values for the menu items */ - item-value = <(-1) 3 6>; + item-value = <0 3 6>; start-bit = <0x400>; - bit-length = <2>; + bit-length = <3>; }; power-loss { From patchwork Mon Oct 2 01:15:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841900 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=X7nt10Up; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNmT4PtYz1ypx for ; Mon, 2 Oct 2023 12:34:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C4C08725C; Mon, 2 Oct 2023 03:18:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="X7nt10Up"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 336D18723E; Mon, 2 Oct 2023 03:18:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9DE988711F for ; Mon, 2 Oct 2023 03:17:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-352753fb42eso5157925ab.1 for ; Sun, 01 Oct 2023 18:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209387; x=1696814187; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fJJPDhr8gJza++eiXv19GVrUFPV/DjDHyJwGOGzmmIw=; b=X7nt10UpF/8Peqi4C7C7FcNETNTCIcwu7usvO73AYIzKrdH3DpquQsjY9OFgutXPbg S4SraneLSPyrbTsesyCgFSTIKtNhxreEUfi42l4SLz6wcA+PI7fdBQ7atu9dozzx0or2 f0ukhvuhIu2ymZJkJA4n3bdM1CaeiqMoysDtE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209387; x=1696814187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fJJPDhr8gJza++eiXv19GVrUFPV/DjDHyJwGOGzmmIw=; b=ajlKPQKLij7MdpFc2XLLG9YvrPxK6qqUZ9q0zjLiAO/6LUcHtXHltIw2fxOUVJ52F3 TOHtflV9g8dt81dvbcCn/EHkA7oaIxbQfOJuz/C+C8/Pp1j6aFFvqkSI5d43iboE17bT vYVseMHKVZ1KTipChlqHF9XwO1L/L/OStyV/9w9h5ln8z0af7w9O9sWWQ0jp7VPnwHpT UTorsO4co9I3c+U5Gt9G1bpNABO32T7c58RQu4bcurdeJrQ8RL6Rtn4gLBT0u6gJBYUe uU/MCNyHT0YX+acIV/YJf+LAewAvmcsnS5xln0VcO+vkaIk0m1cdjYiY1Q9v6FkFPEeK kk1w== X-Gm-Message-State: AOJu0YzhNDsRLFGKd5mkttMagYrUQuEfrx28stHdwbEWLPgs5KSPCrzv E228BEu09f7Rorqr2tPo831ET+ZG4vfo5z2hK2c= X-Google-Smtp-Source: AGHT+IGEB5tKvOWsLjvUDR37yWHdlh2QOKvYJOVpSIi3s7hueE4kxoBw0AttXG0IgLegEVVIqpxHVA== X-Received: by 2002:a05:6e02:1d01:b0:34f:b7b7:11a5 with SMTP id i1-20020a056e021d0100b0034fb7b711a5mr12669176ila.2.1696209387414; Sun, 01 Oct 2023 18:16:27 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 24/34] expo: Drop unneceesary calls to expo_str() Date: Sun, 1 Oct 2023 19:15:34 -0600 Message-ID: <20231002011553.463514-25-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean The scene_txt_str() function calls expo_str() so there is no need to call it beforehand. Drop this unnecessary code. Signed-off-by: Simon Glass --- boot/expo_build.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/boot/expo_build.c b/boot/expo_build.c index 24ec4fc542a7..88b6f2ea7eb4 100644 --- a/boot/expo_build.c +++ b/boot/expo_build.c @@ -47,7 +47,6 @@ int add_txt_str(struct build_info *info, ofnode node, struct scene *scn, const char *find_name, uint obj_id) { const char *text; - uint str_id; int ret; info->err_prop = find_name; @@ -68,12 +67,7 @@ int add_txt_str(struct build_info *info, ofnode node, struct scene *scn, return log_msg_ret("id", -EINVAL); } - ret = expo_str(scn->expo, find_name, 0, text); - if (ret < 0) - return log_msg_ret("add", ret); - str_id = ret; - - ret = scene_txt_str(scn, find_name, obj_id, str_id, text, NULL); + ret = scene_txt_str(scn, find_name, obj_id, 0, text, NULL); if (ret < 0) return log_msg_ret("add", ret); @@ -95,7 +89,6 @@ int add_txt_str_list(struct build_info *info, ofnode node, struct scene *scn, const char *find_name, int index, uint obj_id) { const char *text; - uint str_id; int ret; ret = ofnode_read_string_index(node, find_name, index, &text); @@ -115,12 +108,7 @@ int add_txt_str_list(struct build_info *info, ofnode node, struct scene *scn, return log_msg_ret("id", -EINVAL); } - ret = expo_str(scn->expo, find_name, 0, text); - if (ret < 0) - return log_msg_ret("add", ret); - str_id = ret; - - ret = scene_txt_str(scn, find_name, obj_id, str_id, text, NULL); + ret = scene_txt_str(scn, find_name, obj_id, 0, text, NULL); if (ret < 0) return log_msg_ret("add", ret); From patchwork Mon Oct 2 01:15:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841904 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Pe3W3q+M; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNnQ5mgHz1yp0 for ; Mon, 2 Oct 2023 12:35:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F2D787213; Mon, 2 Oct 2023 03:18:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Pe3W3q+M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB3FB8725E; Mon, 2 Oct 2023 03:18:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8E6E087260 for ; Mon, 2 Oct 2023 03:17:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-79fb64b5265so463113939f.1 for ; Sun, 01 Oct 2023 18:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209388; x=1696814188; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w5i4GDWU+8KfUVfdN2pN5i2Uhz3iH/pttz7Vw6HUaYM=; b=Pe3W3q+Mk0Zgbz1sJHqfA0b8r74yVKMeStCaSBCAbcRJRJRSXZUk8ORiDF3OoLNURT f4QdbocVR6PSJcvbN8yqNLK5XdDoyRtjRUCuAZniBq4s0ZqzNQ3C6U5vD24WN/jkel7b flfhvSxDnMFdSWE+1KVIw3OK/vsCqRzpstCyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209388; x=1696814188; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w5i4GDWU+8KfUVfdN2pN5i2Uhz3iH/pttz7Vw6HUaYM=; b=nXNuS86MqLGFr9Clalrr57+f2SPailfoYoC/1eI5KKZ1WYL1YJEbwMU62VC9mTwSjW f7762t56BS2sE6Le6E1XD/Vs+cEFbAWyYuNaaIIxOweLcgqvGCPknM0t5GdZuxdvcPJu jUFkA0aaCIgg6lbnCOlmWNNIywSFuh9frXwnerMauHdY9IDUZMHaIJ1Ovf9IVYjwv/xk UMeLTpxlFp39EnLGYoyJQkHWNin+K9n9R4u5p0BrvsRXtsMXd9UECzqWEkxIXYx0sJkS J4r59Y7oKRk6s7D8+7lrVGzKgm8naL7HfpzXY3upKBV4n4t5v1MyczPr3l6Q4caugEJ2 J1kA== X-Gm-Message-State: AOJu0YzlfaYZFuEI/w3LIAaMefnGKzhBK6cZgkRSJ1dJOKZlzAAaaYD5 NPLeRwkNkz7BJ82r7ZNuIpYBI6JKi1Ha3gyJm8Q= X-Google-Smtp-Source: AGHT+IGiakEVwrSEqKkaxUBxsvydoRTO3mI6kFjwjwIWNcNa3Z/iE2MNm6dRZAw6eLVugx7fVsG0ew== X-Received: by 2002:a6b:fe07:0:b0:790:f866:d717 with SMTP id x7-20020a6bfe07000000b00790f866d717mr11020378ioh.10.1696209388162; Sun, 01 Oct 2023 18:16:28 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 25/34] expo: Drop scene_title_set() Date: Sun, 1 Oct 2023 19:15:35 -0600 Message-ID: <20231002011553.463514-26-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This function is really just an assignment, so serves no useful purpose. Drop it. Signed-off-by: Simon Glass --- boot/expo_build.c | 4 ++-- boot/scene.c | 7 ------- include/expo.h | 9 --------- test/boot/expo.c | 2 +- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/boot/expo_build.c b/boot/expo_build.c index 88b6f2ea7eb4..b2a651a314b6 100644 --- a/boot/expo_build.c +++ b/boot/expo_build.c @@ -405,7 +405,7 @@ static int scene_build(struct build_info *info, ofnode scn_node, if (ret < 0) return log_msg_ret("tit", ret); title_id = ret; - scene_title_set(scn, title_id); + scn->title_id = title_id; ret = add_txt_str(info, scn_node, scn, "prompt", 0); if (ret < 0) @@ -421,7 +421,7 @@ static int scene_build(struct build_info *info, ofnode scn_node, return 0; } -int build_it(struct build_info *info, ofnode root, struct expo **expp) +static int build_it(struct build_info *info, ofnode root, struct expo **expp) { ofnode scenes, node; struct expo *exp; diff --git a/boot/scene.c b/boot/scene.c index 56569e76e9f2..1369bcda13b8 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -71,13 +71,6 @@ void scene_destroy(struct scene *scn) free(scn); } -int scene_title_set(struct scene *scn, uint id) -{ - scn->title_id = id; - - return 0; -} - int scene_obj_count(struct scene *scn) { struct scene_obj *obj; diff --git a/include/expo.h b/include/expo.h index bb329b9776dd..74b45606efe6 100644 --- a/include/expo.h +++ b/include/expo.h @@ -540,15 +540,6 @@ void scene_set_highlight_id(struct scene *scn, uint id); */ int scene_set_open(struct scene *scn, uint id, bool open); -/** - * scene_title_set() - set the scene title - * - * @scn: Scene to update - * @title_id: Title ID to set - * Returns: 0 if OK - */ -int scene_title_set(struct scene *scn, uint title_id); - /** * scene_obj_count() - Count the number of objects in a scene * diff --git a/test/boot/expo.c b/test/boot/expo.c index 75f31fe66907..c7b8e9ba6749 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -152,7 +152,7 @@ static int expo_scene(struct unit_test_state *uts) scn = NULL; id = scene_new(exp, SCENE_NAME2, 0, &scn); ut_assertnonnull(scn); - ut_assertok(scene_title_set(scn, title_id)); + scn->title_id = title_id; ut_asserteq(STR_SCENE_TITLE + 1, id); ut_asserteq(STR_SCENE_TITLE + 2, exp->next_id); ut_asserteq_ptr(exp, scn->expo); From patchwork Mon Oct 2 01:15:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841903 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=fipC1E3+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNnD0813z1yqQ for ; Mon, 2 Oct 2023 12:35:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E9B6E8723D; Mon, 2 Oct 2023 03:18:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fipC1E3+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 365F887250; Mon, 2 Oct 2023 03:18:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9F7BF8717B for ; Mon, 2 Oct 2023 03:17:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-79fe612beabso283896739f.3 for ; Sun, 01 Oct 2023 18:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209389; x=1696814189; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1oPrOx/bgRaxZ++FLJQHTtWd2RQsoItTwrtmh9NDeto=; b=fipC1E3+6JHOmewLpzuxZ+5ImseHSThUG5nfAYnbHmIKBzcTRk1AZ4jqdZyaJCto+m Z0ZpulpwoD3XRX7DPSQXERheNDAVD8CZOLFxLzOEzeP8u7KIC93S+UE8lc59uNXu5vr6 peccAqXkdGTt6DNKMyRZKOiz/FHTiSBa2joig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209389; x=1696814189; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1oPrOx/bgRaxZ++FLJQHTtWd2RQsoItTwrtmh9NDeto=; b=ilA7MWZ9qvftXAxpJurs5X+pfDyHuan1LWrWS+jFABT7z/T/sOPJpEJv6O///r/eh4 FgrK9e26U9xWKA8M7Q5zFZ+t0C94pEq0iEE9IXDc/ecFel8qzb/1QfpOa+rUMpHzUm4R xM4Lx4hQGWuVf+FiWtdDi8YjbM9QP2OaWGXOOSWLeSs3eSbU3uFVZa6Q6GtdgYmRGd7b fIEuVHY8HwHrdx8WIMIbyozNDblXsqW4ZzDFUM38y/Zugek+GsMKGLC16eMFi0OA0R5O 7q2iznKoyXh9ifSbBwC25Vmlq1uXsTeqlyg0d0WxBHhfSPdaCZDQT0G6mpfweBt/fbuc HeNw== X-Gm-Message-State: AOJu0YxV9KHF7tfEfE/YzMC+qlOP/wf556Wsv42niSPBrQrJEctbe4Qa 2bX9dq7U7JI+YxVaEn52XyMP3VB5lEuqG9DLMjs= X-Google-Smtp-Source: AGHT+IGuNvFBGOMCxBE3tPsTh5ZK9dvKCpyfg8U/jqc7ctKKEVMxENr3DsoDIfbHqWbpekfXu2GMCg== X-Received: by 2002:a6b:6119:0:b0:798:2415:1189 with SMTP id v25-20020a6b6119000000b0079824151189mr11779880iob.12.1696209389238; Sun, 01 Oct 2023 18:16:29 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 26/34] expo: Add forward declaration for udevice to cedit Date: Sun, 1 Oct 2023 19:15:36 -0600 Message-ID: <20231002011553.463514-27-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Some files may include this header file without first including dm.h so add a forward declaration. Signed-off-by: Simon Glass --- include/cedit.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/cedit.h b/include/cedit.h index f43cafa5aa24..f9a4a6d9e8eb 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -12,6 +12,7 @@ struct abuf; struct expo; struct scene; +struct udevice; struct video_priv; enum { From patchwork Mon Oct 2 01:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841902 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=DcjISb+T; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNnB6SDQz1yp0 for ; Mon, 2 Oct 2023 12:35:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 20A2287241; Mon, 2 Oct 2023 03:18:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DcjISb+T"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1559B8745C; Mon, 2 Oct 2023 03:18:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A3E628725C for ; Mon, 2 Oct 2023 03:17:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-351435e9fd4so36757565ab.1 for ; Sun, 01 Oct 2023 18:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209390; x=1696814190; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Yn1Hl9v6iOY0Bf7grMkijoKyMllmQKxXpVhCiPWJkXg=; b=DcjISb+THmrZ5CXokBwVHF4ZtoPwJoKxxk4fhpHdPwTpBpDBqhYpHdYh6nK31TjRd8 tz1/rvMNl6wOhuB62bnIA+ugyn7ZinmPyzAKsAxFi86HBPv8FIun/btpRQhoiIMndYkQ jqBe0asGbXVKUvvVF/INmC/srFzpnPORUcbsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209390; x=1696814190; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yn1Hl9v6iOY0Bf7grMkijoKyMllmQKxXpVhCiPWJkXg=; b=lV4QWpHw5qo2FkIdRFtTJKt+eC+DxQpFkhBenHfemPQpSiGW4B/LFDCSRrSCz57gT8 OSYCaxJBN2Nv0ZWWFjAThWgy9zoMmCdm88LXBU2ra9V1W73ElvcmsN6/Vcz6E7pplP2v 5gXrL6EsYCpYw8CGoXiByau5chFoX3/Sz8kLLnBcCXtQAkLvmyGGc/u8O60eFkN72kki yQXQYZTOykLV49LyLqJt0EofmNE+mkArLccwr5XLIh+Gv6OyqUPu5LPo6W7ttXtXx3SO 3PQwB8/mNh7ii1A6ZVcBV+NMBYHv5GsfmidQmogHiWg3gEVwgX/z2ve91DsG0gZ0Cw0Y oXwg== X-Gm-Message-State: AOJu0YyqcFTWjQaBbSBopWNRU/UYwr0STu1oN3oClnP/eZphi//M55Sa g/+RXGPOGldBJ65uZH/+OIduVgQbv3adyOjaZm8= X-Google-Smtp-Source: AGHT+IFUpGwhRwuIz8Sw9dB2Ir7OsihIlwtOwIozcww26G8QVkpX8bqnmp14Z9Ym68XfRgm69CfiQQ== X-Received: by 2002:a05:6e02:118d:b0:351:526a:499 with SMTP id y13-20020a056e02118d00b00351526a0499mr9685748ili.20.1696209389922; Sun, 01 Oct 2023 18:16:29 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:29 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 27/34] x86: coreboot: Enable unit tests Date: Sun, 1 Oct 2023 19:15:37 -0600 Message-ID: <20231002011553.463514-28-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Enable unit tests so we can run command-line tests in coreboot. Enable console recording, with enough space for the 'cbsysinfo' command. Add to the pre-relocation malloc() space to make room for this. Signed-off-by: Simon Glass --- configs/coreboot_defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 7d744e9962ae..5433a5ae0c2d 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -1,6 +1,7 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0x1110000 CONFIG_SYS_MALLOC_LEN=0x2000000 +CONFIG_SYS_MALLOC_F_LEN=0x1000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="coreboot" @@ -16,6 +17,8 @@ CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" CONFIG_BOOTCOMMAND="bootflow scan -l; if bootflow menu; then cls; bootflow boot; fi" +CONFIG_CONSOLE_RECORD=y +CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_LOG=y @@ -60,3 +63,4 @@ CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set CONFIG_SMBIOS_PARSER=y +CONFIG_UNIT_TEST=y From patchwork Mon Oct 2 01:15:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841907 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NPN7XS92; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNp10hn9z1yp0 for ; Mon, 2 Oct 2023 12:36:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6E6C68727E; Mon, 2 Oct 2023 03:18:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NPN7XS92"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 523B287464; Mon, 2 Oct 2023 03:18:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB4FD8727E for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-79fa2125e19so506086439f.0 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209391; x=1696814191; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EKqdt2yye0Iw3/e7rgu6pQgMxRVx14kpOsTfFe5cQkY=; b=NPN7XS92O2RZXaWzdykJx1phDvWtLVhvCiitXd6tugP/0KSEvDDecJJfbgE92c1Cz7 hzv9NzypJDrp6OJMSRJNEYIGQwi7APU4V/BPR4a8zgY0uQUBUNvPjHosmgpqAC+whrVK ww+3Uipkft3+RLywIv0roEDawB5FyGqjzHpGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209391; x=1696814191; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EKqdt2yye0Iw3/e7rgu6pQgMxRVx14kpOsTfFe5cQkY=; b=uvfxps5e15X3muvrmwQDwoLTdxo0IIarVgZ+Tc0NvF/Kj1UX8AMrK9gJKJKotoi8U7 PTUDdpJccdStmF8UdQYvy6bnYZxp+oCiuFEvOSbhtg/aoiVuD08+6BMQpQuYpOabMfs+ Bkahu8ao4V7fcBeGM2sm9HPqCIADID9xbGdPLAtBaAdWU2ydLOp/YUf1std+0RMnPAuI HxbOGzbtJKnHJwUI6bzajHMv4TfhB68ThWbqDpFZ91j523640xliK5T8CShXoutHolkT jvm93hCbY4//xXX/4zqZTMfMHJ4S3/O2/eRqY8W9M7VJupw0zqfrhS0yeso3DXGgXpH2 VrfA== X-Gm-Message-State: AOJu0YxlgJ0UlDjsp4C7YhOxNDj+AGTF1l3VR/hq01kZCLXyDhrsURZf LwzxFGD3Nbkn8SykQmqVva+DvXdygoFimSvVll8= X-Google-Smtp-Source: AGHT+IHIgvRQUCHlOBDg9tI4Fv7suySNAHCiqnerXzCNH4V/HHZY5cpMA7i6e1pBfmBjWm3z7il+4w== X-Received: by 2002:a6b:5b15:0:b0:79f:99f5:fadd with SMTP id v21-20020a6b5b15000000b0079f99f5faddmr11424397ioh.6.1696209390933; Sun, 01 Oct 2023 18:16:30 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Heinrich Schuchardt , Marek Vasut , Peter Hoyes Subject: [PATCH 28/34] x86: CI: Update coreboot Date: Sun, 1 Oct 2023 19:15:38 -0600 Message-ID: <20231002011553.463514-29-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Update to a newer version which supports settings in CMOS RAM. Signed-off-by: Simon Glass --- .azure-pipelines.yml | 2 +- .gitlab-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 421c5018b40b..83491e38f70c 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -255,7 +255,7 @@ stages: cp images/spi-nor.img \${UBOOT_TRAVIS_BUILD_DIR}/; fi if [[ "\${TEST_PY_BD}" == "coreboot" ]]; then - wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >\${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; + wget -O - "https://drive.google.com/uc?id=1RWzwnrha-wsj8WgO2XHByo7vttxb62pJ&export=download" |xz -dc >\${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool; chmod a+x cbfstool; ./cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6efbd8021c8c..a9c2e578ce16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,7 +69,7 @@ stages: fi - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then wget -O - - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" | + "https://drive.google.com/uc?id=1RWzwnrha-wsj8WgO2XHByo7vttxb62pJ&export=download" | xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" > From patchwork Mon Oct 2 01:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841909 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Pker/Avr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNpM423Wz1yp0 for ; Mon, 2 Oct 2023 12:36:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 850F087282; Mon, 2 Oct 2023 03:18:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Pker/Avr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B40C58709C; Mon, 2 Oct 2023 03:18:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB77587282 for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-79fb70402a7so454598439f.0 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209392; x=1696814192; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cA/EZOAekU5quaUDhV+pr1sPxRXL0A2uVdeAKP1x6K4=; b=Pker/AvrO3k6mx7s5MPlYkSpq2n+9WNFgcUY66ADWXwoIX9ynbqUoGwaOlHtuxXq3r 1vs2ozZRDsqoXPnHVBMzeaWWRYTY4ozuDh5rGo55lh5NWZDG55wHlx2Xn4Lo5ojhZO8U MzP36bqbfA2DH2Vfmsx/S20ZmE3A6Hq3p0lfs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209392; x=1696814192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cA/EZOAekU5quaUDhV+pr1sPxRXL0A2uVdeAKP1x6K4=; b=lscX9rdNlAYpNUGX9FWS0JO0422vLNyoDy+yZVb4kLuFvahNbH2YSZ3+qH1WQp+ZzJ tUH3/C34/hzpVCDafynJvPOLdTZhUy0WhQ+5NLZZq3sWrMjZZJs8ctpXOWkP1v3S8k42 a+W4nr2SCEN8brhdZct5aR665vZJelUBbkl4IHYZQVzogKuAD3UkaSpDy08syYhJ+RrB ykq8jUqThepxRv6OqQY39m+ROMkjBOl8BuS1TGJ6Q34pKTyYXNbAJhYVTqiB7SlMd1ZM QVZi4xpTFHmWfBa/8JOeo2w6SUPEG79UCndkPZShaDC2yJZLgKRV3GzCvxYwjpgyBMoc l6Zw== X-Gm-Message-State: AOJu0Yx0Wu4hWhzpAA9BqPKbs3miMLug+qCFNHQy/NPWzXDFf/4tIfVI ZmHyb1cpv9OxM594BdWlUY+RX+9GZWyDPXwViWE= X-Google-Smtp-Source: AGHT+IFV2cFqkkqy3+b79diYQ8HKc3ByEyXu7HEqJx+lr71iOG+6fTLzZdn4+fTb/eXYXMBXtMUd9w== X-Received: by 2002:a5e:8804:0:b0:791:1e87:b47e with SMTP id l4-20020a5e8804000000b007911e87b47emr10076904ioj.15.1696209392067; Sun, 01 Oct 2023 18:16:32 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Abdellatif El Khlifi , Heinrich Schuchardt , Marek Vasut , Ramon Fried , Rasmus Villemoes , Robert Marko , Stephen Carlson Subject: [PATCH 29/34] x86: coreboot: Add a test for cbsysinfo command Date: Sun, 1 Oct 2023 19:15:39 -0600 Message-ID: <20231002011553.463514-30-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Add a simple test for this command, checking that coreboot has the required features. Signed-off-by: Simon Glass --- test/cmd/Makefile | 1 + test/cmd/coreboot.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/cmd/coreboot.c diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 0be2cec89018..d6460b2ae5b9 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -14,6 +14,7 @@ endif obj-y += exit.o mem.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_BDI) += bdinfo.o +obj-$(CONFIG_COREBOOT_SYSINFO) += coreboot.o obj-$(CONFIG_CMD_FDT) += fdt.o obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o obj-$(CONFIG_CMD_HISTORY) += history.o diff --git a/test/cmd/coreboot.c b/test/cmd/coreboot.c new file mode 100644 index 000000000000..277c670c15e9 --- /dev/null +++ b/test/cmd/coreboot.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test for coreboot commands + * + * Copyright 2023 Google LLC + * Written by Simon Glass + */ + +#include +#include +#include +#include +#include + +/** + * test_cmd_cbsysinfo() - test the cbsysinfo command produces expected output + * + * This includes ensuring that the coreboot build has the expected options + * enabled + */ +static int test_cmd_cbsysinfo(struct unit_test_state *uts) +{ + ut_assertok(run_command("cbsysinfo", 0)); + ut_assert_nextlinen("Coreboot table at"); + + /* Make sure the linear frame buffer is enabled */ + ut_assert_skip_to_linen("Framebuffer"); + ut_assert_nextlinen(" Phys addr"); + + ut_assert_skip_to_line("Chrome OS VPD: 00000000"); + ut_assert_nextlinen("RSDP"); + ut_assert_nextlinen("Unimpl."); + ut_assert_console_end(); + + return 0; +} +CMD_TEST(test_cmd_cbsysinfo, UT_TESTF_CONSOLE_REC); From patchwork Mon Oct 2 01:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841905 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=TqX59/dJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNnb3rtWz1yp0 for ; Mon, 2 Oct 2023 12:35:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09B9C8743C; Mon, 2 Oct 2023 03:18:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TqX59/dJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94E228726A; Mon, 2 Oct 2023 03:18:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB69F87280 for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7a269637b98so111505539f.3 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209393; x=1696814193; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Paja1OfNXvWTCdn0ELzhwWtRsQOeo1IC3tUlj/D3MX4=; b=TqX59/dJkn1G6YpEq6n0HsSXrpXbEPcK9wwoEOPBFSUMyOFMjd/+niFFnixNKO1GOH vRI5exvmg+/Gj0Dbarlq+eWtbCD9QayVEgAuSiH4uf1J4cHYxGUI0eLtJrLAd+CNb6eC EX16SLP7HAJOr3aZGFO95UpejKEF2qVf17Fso= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209393; x=1696814193; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Paja1OfNXvWTCdn0ELzhwWtRsQOeo1IC3tUlj/D3MX4=; b=JvgULEntn7kvFOY/8veFAlYRi9QJG1gz1vqC67u+0Q6BLHhs4JiIRxAF4Z5tzmi6uY Ep4PWtA/U+k7cJVKtMnRDbRGY3cDocCPnpu+tvyRQ+dq6ol9qMvJr7T4RiywklPgfHQc JtL+lXXyXqgqo205JxweMUlMkjIpK0IeMMA40sXRv6C9TRKIlD1PgAx9+T5bdrILvxNg yes6PJ3bLz+T9hAfjZE0M8lPdYAnzHtxo5E0L6MALsSI+Ls85rvRoV4wcoR1QTnlQ0Of XSbq1HAScTVV3Ea/hensog7o9w+F6Y7krArd2blHOgD2dn4wmqSEaMQ+ob4AGHugvmWj JVjQ== X-Gm-Message-State: AOJu0Yxxo00CGllMOLfbLb6hm6vFKwdioc4JrXRIN83QawS3/qk1o9Xa JUF9RKmuvi7Rkj7oV5PCd5RLDZ+4FDyB47P4pjU= X-Google-Smtp-Source: AGHT+IEhz4pzFvYX0++8d9BxeGVxu9UHlR5MoLrLep84Eo7F1Gw1Jw6HutDaRvuUy3uiTb3/mh11bg== X-Received: by 2002:a05:6602:420d:b0:79f:d194:d6ea with SMTP id cb13-20020a056602420d00b0079fd194d6eamr12162595iob.5.1696209393134; Sun, 01 Oct 2023 18:16:33 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:32 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 30/34] x86: coreboot: Show the option table Date: Sun, 1 Oct 2023 19:15:40 -0600 Message-ID: <20231002011553.463514-31-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Update the cbsysinfo command to show the contents of the CMOS option table. While we are here, add some example output for this command, along with mention of what the unimplemented tags are. Signed-off-by: Simon Glass --- cmd/x86/cbsysinfo.c | 73 ++++++++++++++++++++++++++- doc/usage/cmd/cbsysinfo.rst | 99 +++++++++++++++++++++++++++++++++++++ test/cmd/coreboot.c | 7 +++ 3 files changed, 178 insertions(+), 1 deletion(-) diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c index 84822a3e3211..8c46203e1afa 100644 --- a/cmd/x86/cbsysinfo.c +++ b/cmd/x86/cbsysinfo.c @@ -185,6 +185,77 @@ static const char *timestamp_name(uint32_t id) return ""; } +static void show_option_vals(const struct cb_cmos_option_table *tab, + uint id) +{ + const void *ptr, *end; + bool found = false; + + end = (void *)tab + tab->size; + for (ptr = (void *)tab + tab->header_length; ptr < end;) { + const struct cb_record *rec = ptr; + + switch (rec->tag) { + case CB_TAG_OPTION_ENUM: { + const struct cb_cmos_enums *enums = ptr; + + if (enums->config_id == id) { + if (!found) + printf(" "); + printf(" %d:%s", enums->value, enums->text); + found = true; + } + break; + } + break; + case CB_TAG_OPTION_DEFAULTS: + case CB_TAG_OPTION_CHECKSUM: + case CB_TAG_OPTION: + break; + default: + printf("tag %x\n", rec->tag); + break; + } + ptr += rec->size; + } +} + +static void show_option_table(const struct cb_cmos_option_table *tab) +{ + const void *ptr, *end; + + print_ptr("option_table", tab); + if (!tab->size) + return; + + printf(" Bit Len Cfg ID Name\n"); + end = (void *)tab + tab->size; + for (ptr = (void *)tab + tab->header_length; ptr < end;) { + const struct cb_record *rec = ptr; + + switch (rec->tag) { + case CB_TAG_OPTION: { + const struct cb_cmos_entries *entry = ptr; + + printf("%4x %4x %3c %3x %-20s", entry->bit, + entry->length, entry->config, entry->config_id, + entry->name); + show_option_vals(tab, entry->config_id); + printf("\n"); + break; + } + case CB_TAG_OPTION_ENUM: + case CB_TAG_OPTION_DEFAULTS: + case CB_TAG_OPTION_CHECKSUM: + break; + default: + printf("tag %x\n", rec->tag); + break; + } + ptr += rec->size; + } +} + static void show_table(struct sysinfo_t *info, bool verbose) { struct cb_serial *ser = info->serial; @@ -219,7 +290,7 @@ static void show_table(struct sysinfo_t *info, bool verbose) printf("%12d: %02x:%-8s %016llx %016llx\n", i, mr->type, get_mem_name(mr->type), mr->base, mr->size); } - print_ptr("option_table", info->option_table); + show_option_table(info->option_table); print_hex("CMOS start", info->cmos_range_start); if (info->cmos_range_start) { diff --git a/doc/usage/cmd/cbsysinfo.rst b/doc/usage/cmd/cbsysinfo.rst index 8c03a85169dc..ea6878e54232 100644 --- a/doc/usage/cmd/cbsysinfo.rst +++ b/doc/usage/cmd/cbsysinfo.rst @@ -23,3 +23,102 @@ Example :: => cbsysinfo + Coreboot table at 500, size 5c4, records 1d (dec 29), decoded to 000000007dce4520, forwarded to 000000007ff9a000 + + CPU KHz : 0 + Serial I/O port: 00000000 + base : 00000000 + pointer : 000000007ff9a370 + type : 1 + base : 000003f8 + baud : 0d115200 + regwidth : 1 + input_hz : 0d1843200 + PCI addr : 00000010 + Mem ranges : 7 + id: type || base || size + 0: 10:table 0000000000000000 0000000000001000 + 1: 01:ram 0000000000001000 000000000009f000 + 2: 02:reserved 00000000000a0000 0000000000060000 + 3: 01:ram 0000000000100000 000000007fe6d000 + 4: 10:table 000000007ff6d000 0000000000093000 + 5: 02:reserved 00000000fec00000 0000000000001000 + 6: 02:reserved 00000000ff800000 0000000000800000 + option_table: 000000007ff9a018 + Bit Len Cfg ID Name + 0 180 r 0 reserved_memory + 180 1 e 4 boot_option 0:Fallback 1:Normal + 184 4 h 0 reboot_counter + 190 8 r 0 reserved_century + 1b8 8 r 0 reserved_ibm_ps2_century + 1c0 1 e 1 power_on_after_fail 0:Disable 1:Enable + 1c4 4 e 6 debug_level 5:Notice 6:Info 7:Debug 8:Spew + 1d0 80 r 0 vbnv + 3f0 10 h 0 check_sum + CMOS start : 1c0 + CMOS end : 1cf + CMOS csum loc: 3f0 + VBNV start : ffffffff + VBNV size : ffffffff + CB version : 4.21-5-g7e6eae9679e3-dirty + Extra : + Build : Thu Sep 07 14:52:41 UTC 2023 + Time : 14:52:41 + Framebuffer : 000000007ff9a410 + Phys addr : fd000000 + X res : 0d800 + X res : 0d600 + Bytes / line: c80 + Bpp : 0d32 + pos/size red 16/8, green 8/8, blue 0/8, reserved 24/8 + GPIOs : 0 + id: port polarity val name + MACs : 0d10 + 0: 12:00:00:00:28:00 + 1: 00:00:00:fd:00:00 + 2: 20:03:00:00:58:02 + 3: 80:0c:00:00:20:10 + 4: 08:00:08:18:08:00 + 5: 16:00:00:00:10:00 + 6: 00:d0:fd:7f:00:00 + 7: 17:00:00:00:10:00 + 8: 00:e0:fd:7f:00:00 + 9: 37:00:00:00:10:00 + Multiboot tab: 0000000000000000 + CB header : 000000007ff9a000 + CB mainboard: 000000007ff9a344 + vendor : 0: Emulation + part_number : 10: QEMU x86 i440fx/piix4 + vboot handoff: 0000000000000000 + size : 0 + vdat addr : 0000000000000000 + size : 0 + SMBIOS : 7ff6d000 + size : 8000 + ROM MTRR : 0 + Tstamp table: 000000007ffdd000 + CBmem cons : 000000007ffde000 + Size : 1fff8 + Cursor : 3332 + MRC cache : 0000000000000000 + ACPI GNVS : 0000000000000000 + Board ID : ffffffff + RAM code : ffffffff + WiFi calib : 0000000000000000 + Ramoops buff: 0 + size : 0 + SF size : 0 + SF sector : 0 + SF erase cmd: 0 + FMAP offset : 0 + CBFS offset : 200 + CBFS size : 3ffe00 + Boot media size: 400000 + MTC start : 0 + MTC size : 0 + Chrome OS VPD: 0000000000000000 + RSDP : 000000007ff75000 + Unimpl. : 10 37 40 + => + +Note that "Unimpl." shows tags which U-Boot does not currently implement. diff --git a/test/cmd/coreboot.c b/test/cmd/coreboot.c index 277c670c15e9..eb3d8905986d 100644 --- a/test/cmd/coreboot.c +++ b/test/cmd/coreboot.c @@ -23,6 +23,13 @@ static int test_cmd_cbsysinfo(struct unit_test_state *uts) ut_assertok(run_command("cbsysinfo", 0)); ut_assert_nextlinen("Coreboot table at"); + /* Make sure CMOS options are enabled */ + ut_assert_skip_to_line( + " 1c0 1 e 1 power_on_after_fail 0:Disable 1:Enable"); + ut_assert_skip_to_line("CMOS start : 1c0"); + ut_assert_nextline(" CMOS end : 1cf"); + ut_assert_nextline(" CMOS csum loc: 3f0"); + /* Make sure the linear frame buffer is enabled */ ut_assert_skip_to_linen("Framebuffer"); ut_assert_nextlinen(" Phys addr"); From patchwork Mon Oct 2 01:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841908 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ThztSO4L; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNpB31C9z1yp0 for ; Mon, 2 Oct 2023 12:36:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 065FE87236; Mon, 2 Oct 2023 03:18:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ThztSO4L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CBAD87135; Mon, 2 Oct 2023 03:18:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DD452872AD for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3513fa06bafso39328195ab.3 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209394; x=1696814194; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n8BV9m61QvUY5NcRfZ/+1HTYuSII0pJHLzchhd2Ig1g=; b=ThztSO4LMDetAbzV2VNj7cTdU0t7EkTOPI3VdQBx4XGEXmT5nbno0xmYqARL6kPcui cANK3cHd+S4XXrwbRH7Ry4cId+Tu/oUAgZIIXOiQOAJLlEei/3E9Rp7e0ckd6v9ZnuoY TpKJF3rVnpdTR0YEyhDm06U3RznEb4dqallZo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209394; x=1696814194; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n8BV9m61QvUY5NcRfZ/+1HTYuSII0pJHLzchhd2Ig1g=; b=ib/zRHTLSSkGCZHFrJLyXSCUCltJWGVmp6YVlXy9FYhPlnaeSVC73sMQKsSA6YyqaR tRxHZVHq5eueboR1JqsXCrkChv9zv38vAJ5pQiPwsLvlFrPA6ir1HHLZcirg03ZNcG3D MxSxsFwtJn5zJd2Xk2madk5nVXjlB1Tw+KBu9zstvt80m1twMLsDfg9doR4iKlkwHXNq K3sHhSBNgCKZPqkONANTyeDVuGXYUk0wuci2/BeJurwiF0NT7p0d9oj1PiFL9kRsLtfy sqn3ItYMKF4rXj0YzFmHusxaMyzTwusXa/x/DHp+jP72mLM19GrJJviIfjAxVLodDOsE XnWA== X-Gm-Message-State: AOJu0YzkeYG715kg4yByKnOrRTxCuJRiyj9kXMOOAXbFXJGsr3fgP1Db Pqhv/biXVhOss4dtzT8gIUJjEJStPbacS3iVs2s= X-Google-Smtp-Source: AGHT+IHMBnwpI5DdiDrq0heFG67xHJ6SapFqGUw2OruM8IiMQP07jHoeWrArmgCrTuUl8WPblWuNLg== X-Received: by 2002:a05:6e02:ee8:b0:34f:1e9c:45e0 with SMTP id j8-20020a056e020ee800b0034f1e9c45e0mr9612228ilk.3.1696209394147; Sun, 01 Oct 2023 18:16:34 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin Subject: [PATCH 31/34] x86: coreboot: Enable support for the configuration editor Date: Sun, 1 Oct 2023 19:15:41 -0600 Message-ID: <20231002011553.463514-32-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Enable cedit support along with required options and a simple style. Signed-off-by: Simon Glass --- arch/x86/dts/coreboot.dts | 7 +++++++ configs/coreboot64_defconfig | 2 ++ configs/coreboot_defconfig | 2 ++ 3 files changed, 11 insertions(+) diff --git a/arch/x86/dts/coreboot.dts b/arch/x86/dts/coreboot.dts index 83beb82f37c7..78ca00d64db4 100644 --- a/arch/x86/dts/coreboot.dts +++ b/arch/x86/dts/coreboot.dts @@ -54,5 +54,12 @@ menu-inset = <3>; menuitem-gap-y = <1>; }; + + cedit-theme { + font-size = <30>; + menu-inset = <3>; + menuitem-gap-y = <1>; + menu-title-margin-x = <30>; + }; }; }; diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig index 42b46ba0d9b9..23b88b55663f 100644 --- a/configs/coreboot64_defconfig +++ b/configs/coreboot64_defconfig @@ -18,6 +18,7 @@ CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" CONFIG_BOOTCOMMAND="bootflow scan -l; if bootflow menu; then cls; bootflow boot; fi" +CONFIG_CEDIT=y CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_LOG=y @@ -47,6 +48,7 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_OFNODE_MULTI_TREE=y # CONFIG_ACPIGEN is not set CONFIG_SYS_IDE_MAXDEVICE=4 CONFIG_SYS_ATA_DATA_OFFSET=0 diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 5433a5ae0c2d..d4e44e00dcab 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -17,6 +17,7 @@ CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" CONFIG_BOOTCOMMAND="bootflow scan -l; if bootflow menu; then cls; bootflow boot; fi" +CONFIG_CEDIT=y CONFIG_CONSOLE_RECORD=y CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 CONFIG_PRE_CONSOLE_BUFFER=y @@ -44,6 +45,7 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_OFNODE_MULTI_TREE=y # CONFIG_ACPIGEN is not set CONFIG_SYS_IDE_MAXDEVICE=4 CONFIG_SYS_ATA_DATA_OFFSET=0 From patchwork Mon Oct 2 01:15:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841911 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=DrDN+VSA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNpk1pblz1yp0 for ; Mon, 2 Oct 2023 12:36:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 893D387288; Mon, 2 Oct 2023 03:18:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DrDN+VSA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1AB988723F; Mon, 2 Oct 2023 03:18:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB9DD87284 for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-79faba5fe12so472568439f.3 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209395; x=1696814195; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UYOC1FFMdjyk6Uj2eBLK1Yq3rLn+SE5HQU037SnuMLg=; b=DrDN+VSAVF7/40cA1GiAO/Az7CLo4A55c6GgEGJ084AFyza02gKQvh+F2/tSb+VhkR Cq+TXWueKKcDY9diqo5+wZIW2q9NngGnU1cVXnclmeYV9J58ulUIBWW9Owg8cp32xLFO 4v7LFggZ0tQm6FpVpJAZ3btlh7z+c8q9vFD0o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209395; x=1696814195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UYOC1FFMdjyk6Uj2eBLK1Yq3rLn+SE5HQU037SnuMLg=; b=mTPdUA2R+0CIUedNwZEsbAaKohu/pbMT5H7Rag0uwjbNEJyYePlwt75RhkaN1wo1a9 eg1HQt1dp11PqrHEoUi/4SGqcLodhVCmCedfa68gGn2mcFbiGlSYqybnhaUPzTYvMfOZ LAIuqioH+svbJMsDDIvv6X8jdZz7wJr8T1D4dIMFZVzs4w45P8kJcWqPna0Y8lL4dbvH FjO3Le8phjcpzVoKkcakXkOaKctt5Jq9z080W+DIUYLwSK8Rpems5RLtX+sgiBNPw7CC vv5s4vej9NwCnZFSN4UyovX5r60ZupFEInDDTwRhueuP0b5q3dsIdm0giw3ibTacjE6l fYjg== X-Gm-Message-State: AOJu0Yw/T/21zBzIhD2UAyKLXY/Mkie6zWW6bdic1kHtc7AXFWBvlrV+ bhrsfr1HZQ8rb06BhtMb9eJLxxsMnlvcE/nwZGA= X-Google-Smtp-Source: AGHT+IG/rxs0M/49qIAg2JsdvJOhiUucUr7YDGOv64etM0L2D8whEJjHcQZ5SmuQrwInO0e0/kz7tw== X-Received: by 2002:a05:6e02:1107:b0:351:2227:28d1 with SMTP id u7-20020a056e02110700b00351222728d1mr10982557ilk.17.1696209395275; Sun, 01 Oct 2023 18:16:35 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Abdellatif El Khlifi , Heinrich Schuchardt , Ilias Apalodimas , Ramon Fried , Sean Edmond , Tobias Waldekranz Subject: [PATCH 32/34] x86: coreboot: Add a command to check and update CMOS RAM Date: Sun, 1 Oct 2023 19:15:42 -0600 Message-ID: <20231002011553.463514-33-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Coreboot tables provide information about the CMOS-RAM checksum. Add a command which can check and update this. With this it is possible to adjust CMOS-RAM settings and tidy up the checksum afterwards. Signed-off-by: Simon Glass --- cmd/Kconfig | 11 +++ cmd/x86/Makefile | 1 + cmd/x86/cbcmos.c | 141 +++++++++++++++++++++++++++++++++++++++ doc/usage/cmd/cbcmos.rst | 42 ++++++++++++ doc/usage/index.rst | 1 + test/cmd/coreboot.c | 42 ++++++++++++ 6 files changed, 238 insertions(+) create mode 100644 cmd/x86/cbcmos.c create mode 100644 doc/usage/cmd/cbcmos.rst diff --git a/cmd/Kconfig b/cmd/Kconfig index 987f7d8cf623..e6977dc91bb2 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2742,6 +2742,17 @@ config CMD_CBSYSINFO memory by coreboot before jumping to U-Boot. It can be useful for debugging the beaaviour of coreboot or U-Boot. +config CMD_CBCMOS + bool "cbcmos" + depends on X86 + default y if SYS_COREBOOT + help + This provides information options to check the CMOS RAM checksum, + if present, as well as to update it. + + It is useful when coreboot CMOS-RAM settings must be examined or + updated. + config CMD_CYCLIC bool "cyclic - Show information about cyclic functions" depends on CYCLIC diff --git a/cmd/x86/Makefile b/cmd/x86/Makefile index 5f82204c87e6..565e20776755 100644 --- a/cmd/x86/Makefile +++ b/cmd/x86/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ obj-$(CONFIG_CMD_CBSYSINFO) += cbsysinfo.o +obj-$(CONFIG_CMD_CBCMOS) += cbcmos.o obj-y += mtrr.o obj-$(CONFIG_CMD_EXCEPTION) += exception.o obj-$(CONFIG_USE_HOB) += hob.o diff --git a/cmd/x86/cbcmos.c b/cmd/x86/cbcmos.c new file mode 100644 index 000000000000..8d2f85fd0ec6 --- /dev/null +++ b/cmd/x86/cbcmos.c @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Support for booting from coreboot + * + * Copyright 2021 Google LLC + */ + +#define LOG_CATEGORY UCLASS_RTC + +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +const struct sysinfo_t *get_table(void) +{ + if (!gd->arch.coreboot_table) { + printf("No coreboot sysinfo table found\n"); + return NULL; + } + + return &lib_sysinfo; +} + +static int calc_sum(struct udevice *dev, uint start_bit, uint bit_count) +{ + uint start_byte = start_bit / 8; + uint byte_count = bit_count / 8; + int ret, i; + uint sum; + + log_debug("Calc sum from %x: %x bytes\n", start_byte, byte_count); + sum = 0; + for (i = 0; i < bit_count / 8; i++) { + ret = rtc_read8(dev, start_bit / 8 + i); + if (ret < 0) + return ret; + sum += ret; + } + + return (sum & 0xff) << 8 | (sum & 0xff00) >> 8; +} + +/** + * prep_cbcmos() - Prepare for a CMOS-RAM command + * + * @tab: coreboot table + * @devnum: RTC device name to use, or NULL for the first one + * @dep: Returns RTC device on success + * Return: calculated checksum for CMOS RAM or -ve on error + */ +static int prep_cbcmos(const struct sysinfo_t *tab, const char *devname, + struct udevice **devp) +{ + struct udevice *dev; + int ret; + + if (!tab) + return CMD_RET_FAILURE; + if (devname) + ret = uclass_get_device_by_name(UCLASS_RTC, devname, &dev); + else + ret = uclass_first_device_err(UCLASS_RTC, &dev); + if (ret) { + printf("Failed to get RTC device: %dE\n", ret); + return ret; + } + + ret = calc_sum(dev, tab->cmos_range_start, + tab->cmos_range_end + 1 - tab->cmos_range_start); + if (ret < 0) { + printf("Failed to read RTC device: %dE\n", ret); + return ret; + } + *devp = dev; + + return ret; +} + +static int do_cbcmos_check(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + const struct sysinfo_t *tab = get_table(); + struct udevice *dev; + u16 cur, sum; + int ret; + + ret = prep_cbcmos(tab, argv[1], &dev); + if (ret < 0) + return CMD_RET_FAILURE; + sum = ret; + + ret = rtc_read16(dev, tab->cmos_checksum_location / 8, &cur); + if (ret < 0) { + printf("Failed to read RTC device: %dE\n", ret); + return CMD_RET_FAILURE; + } + if (sum != cur) { + printf("Checksum %04x error: calculated %04x\n", cur, sum); + return CMD_RET_FAILURE; + } + + return 0; +} + +static int do_cbcmos_update(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + const struct sysinfo_t *tab = get_table(); + struct udevice *dev; + u16 sum; + int ret; + + ret = prep_cbcmos(tab, argv[1], &dev); + if (ret < 0) + return CMD_RET_FAILURE; + sum = ret; + + ret = rtc_write16(dev, tab->cmos_checksum_location / 8, sum); + if (ret < 0) { + printf("Failed to read RTC device: %dE\n", ret); + return CMD_RET_FAILURE; + } + printf("Checksum %04x written\n", sum); + + return 0; +} + +#ifdef CONFIG_SYS_LONGHELP +static char cbcmos_help_text[] = + "check - check CMOS RAM\n" + "cbcmos update - Update CMOS-RAM checksum"; +#endif /* CONFIG_SYS_LONGHELP */ + +U_BOOT_CMD_WITH_SUBCMDS(cbcmos, "coreboot CMOS RAM", cbcmos_help_text, + U_BOOT_SUBCMD_MKENT(check, 2, 1, do_cbcmos_check), + U_BOOT_SUBCMD_MKENT(update, 2, 1, do_cbcmos_update)); diff --git a/doc/usage/cmd/cbcmos.rst b/doc/usage/cmd/cbcmos.rst new file mode 100644 index 000000000000..156521dd02b9 --- /dev/null +++ b/doc/usage/cmd/cbcmos.rst @@ -0,0 +1,42 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +cbcmos +====== + +Synopis +------- + +:: + + cbcmos check [] + cbcmos update [] + + +Description +----------- + +This checks or updates the CMOS-RAM checksum value against the CMOS-RAM +contents. It is used with coreboot, which provides information about where to +find the checksum and what part of the CMOS RAM it covers. + +If `` is provided then the named real-time clock (RTC) device is used. +Otherwise the default RTC is used. + +Example +------- + +This shows checking and updating a checksum across bytes 38 and 39 of the +CMOS RAM:: + + => rtc read 38 2 + 00000038: 71 00 q. + => cbc check + => rtc write 38 66 + => rtc read 38 2 + 00000038: 66 00 f. + => cbc check + Checksum 7100 error: calculated 6600 + => cbc update + Checksum 6600 written + => cbc check + => diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 98b4719c4088..ae908e92327a 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -40,6 +40,7 @@ Shell commands cmd/button cmd/bootz cmd/cat + cmd/cbcmos cmd/cbsysinfo cmd/cedit cmd/cls diff --git a/test/cmd/coreboot.c b/test/cmd/coreboot.c index eb3d8905986d..0c49aca9f58a 100644 --- a/test/cmd/coreboot.c +++ b/test/cmd/coreboot.c @@ -8,10 +8,16 @@ #include #include +#include +#include #include #include #include +enum { + CSUM_LOC = 0x3f0 / 8, +}; + /** * test_cmd_cbsysinfo() - test the cbsysinfo command produces expected output * @@ -42,3 +48,39 @@ static int test_cmd_cbsysinfo(struct unit_test_state *uts) return 0; } CMD_TEST(test_cmd_cbsysinfo, UT_TESTF_CONSOLE_REC); + +/* test cbcmos command */ +static int test_cmd_cbcmos(struct unit_test_state *uts) +{ + u16 old_csum, new_csum; + struct udevice *dev; + + /* initially the checksum should be correct */ + ut_assertok(run_command("cbcmos check", 0)); + ut_assert_console_end(); + + /* make a change to the checksum */ + ut_assertok(uclass_first_device_err(UCLASS_RTC, &dev)); + ut_assertok(rtc_read16(dev, CSUM_LOC, &old_csum)); + ut_assertok(rtc_write16(dev, CSUM_LOC, old_csum + 1)); + + /* now the command should fail */ + ut_asserteq(1, run_command("cbcmos check", 0)); + ut_assert_nextline("Checksum %04x error: calculated %04x", + old_csum + 1, old_csum); + ut_assert_console_end(); + + /* now get it to fix the checksum */ + ut_assertok(run_command("cbcmos update", 0)); + ut_assert_nextline("Checksum %04x written", old_csum); + ut_assert_console_end(); + + /* check the RTC looks right */ + ut_assertok(rtc_read16(dev, CSUM_LOC, &new_csum)); + ut_asserteq(old_csum, new_csum); + ut_assert_console_end(); + + return 0; +} +CMD_TEST(test_cmd_cbcmos, UT_TESTF_CONSOLE_REC); + From patchwork Mon Oct 2 01:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841906 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JAOJWSzm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNnn2fZgz1yp0 for ; Mon, 2 Oct 2023 12:35:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 931EA87281; Mon, 2 Oct 2023 03:18:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JAOJWSzm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D52D58717F; Mon, 2 Oct 2023 03:18:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB6BE87281 for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-79fe87cd74eso265628039f.3 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209396; x=1696814196; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bx1eySv0Gr9sU04pkXAchLrCwaaqBuJmFG4Tr12rlH8=; b=JAOJWSzmu1AbRrrU4OGde6Sq7qc/0ZsTeit9oL6KeeVQwMDMnbu4PbwhVsXA9TJbEU Q4NVk9/Bxgte/1VM/V6KQQgXzjuGn9Pq81j+ErQ4at99S7WYioqKVoJ2TARetNjog9bN lawYzpbmt8sgBd9HYzrbzYeL+MVshgy28qE5k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209396; x=1696814196; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bx1eySv0Gr9sU04pkXAchLrCwaaqBuJmFG4Tr12rlH8=; b=M7SVhLlErrl8lzp9TbFFzKYZDIwRk9ZLY8EYh/ica9zyIb7ySYztJ1daf9l5Rdl/ss kFGW/hbjmLctSo8vqToR7nCN22KHlsruoRuPqyaWfRQdDuN/5wAuWo31+L6nWW+bln4V Oy6UBMD3jkxtY7Ud17iwo7T7sYkvm+0FiRqZfhXTMpbaKVlGvtR82PlJiRMuKx9W0mVt dero0Edj8cqgmn8W6ryADkG2OvaWEAGaCPZAOelsdcw+dc55slzx4dihNPbVRaoZEhR/ Jp8hLS8UyYMKOUzRDZgPprG4fIvkEJdlAuwdRg2dVbikghqzLH+kspTfORSmy3IzMYm8 Li+A== X-Gm-Message-State: AOJu0Yz4tYQhGJ1aG0m0pfygyt/N0ApFaQ4zyRwljb0pO210OzSC1Ot+ XWaJQO1dIopmgXsM1280X65pOXG/R5ZaBXWUS0E= X-Google-Smtp-Source: AGHT+IFULb96xwXgVVg8qLrOY1WAVht71fQN1gnf7RKbMzGuvsJ3parTBACo17gvGXdbd5hfmLFbPA== X-Received: by 2002:a6b:dc10:0:b0:790:9728:4014 with SMTP id s16-20020a6bdc10000000b0079097284014mr11699848ioc.11.1696209396234; Sun, 01 Oct 2023 18:16:36 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Heinrich Schuchardt Subject: [PATCH 33/34] x86: coreboot: Allow building an expo for editing CMOS config Date: Sun, 1 Oct 2023 19:15:43 -0600 Message-ID: <20231002011553.463514-34-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Coreboot provides the CMOS layout in the tables it passes to U-Boot. Use that to build an editor for the CMOS settings. Signed-off-by: Simon Glass --- boot/Makefile | 4 + boot/expo_build_cb.c | 244 ++++++++++++++++++++++++++++++++ cmd/cedit.c | 28 ++++ doc/board/coreboot/coreboot.rst | 6 + doc/develop/cedit.rst | 2 +- doc/usage/cmd/cbcmos.rst | 3 + doc/usage/cmd/cedit.rst | 76 ++++++++++ include/expo.h | 8 ++ test/cmd/coreboot.c | 34 +++++ 9 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 boot/expo_build_cb.c diff --git a/boot/Makefile b/boot/Makefile index ad608598d298..7fd39833e5b6 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -59,6 +59,10 @@ endif obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo.o scene.o expo_build.o obj-$(CONFIG_$(SPL_TPL_)EXPO) += scene_menu.o scene_textline.o +ifdef CONFIG_COREBOOT_SYSINFO +obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo_build_cb.o +endif + obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_REQUEST) += vbe_request.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o diff --git a/boot/expo_build_cb.c b/boot/expo_build_cb.c new file mode 100644 index 000000000000..88b74b090f00 --- /dev/null +++ b/boot/expo_build_cb.c @@ -0,0 +1,244 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Building an expo from an FDT description + * + * Copyright 2022 Google LLC + * Written by Simon Glass + */ + +#define LOG_CATEGORY LOGC_EXPO + +#include +#include +#include +#include +#include +#include +#include + +/** + * struct build_info - Information to use when building + */ +struct build_info { + const struct cb_cmos_option_table *tab; + struct cedit_priv *priv; +}; + +/** + * convert_to_title() - Convert text to 'title' format and allocate a string + * + * Converts "this_is_a_test" to "This is a test" so it looks better + * + * @text: Text to convert + * Return: Allocated string, or NULL if out of memory + */ +static char *convert_to_title(const char *text) +{ + int len = strlen(text); + char *buf, *s; + + buf = malloc(len + 1); + if (!buf) + return NULL; + + for (s = buf; *text; s++, text++) { + if (s == buf) + *s = toupper(*text); + else if (*text == '_') + *s = ' '; + else + *s = *text; + } + *s = '\0'; + + return buf; +} + +/** + * menu_build() - Build a menu and add it to a scene + * + * See doc/developer/expo.rst for a description of the format + * + * @info: Build information + * @entry: CMOS entry to build a menu for + * @scn: Scene to add the menu to + * @objp: Returns the object pointer + * Returns: 0 if OK, -ENOMEM if out of memory, -EINVAL if there is a format + * error, -ENOENT if there is a references to a non-existent string + */ +static int menu_build(struct build_info *info, + const struct cb_cmos_entries *entry, struct scene *scn, + struct scene_obj **objp) +{ + struct scene_obj_menu *menu; + const void *ptr, *end; + uint menu_id; + char *title; + int ret, i; + + ret = scene_menu(scn, entry->name, 0, &menu); + if (ret < 0) + return log_msg_ret("men", ret); + menu_id = ret; + + title = convert_to_title(entry->name); + if (!title) + return log_msg_ret("con", -ENOMEM); + + /* Set the title */ + ret = scene_txt_str(scn, "title", 0, 0, title, NULL); + if (ret < 0) + return log_msg_ret("tit", ret); + menu->title_id = ret; + + end = (void *)info->tab + info->tab->size; + for (ptr = (void *)info->tab + info->tab->header_length, i = 0; + ptr < end; i++) { + const struct cb_cmos_enums *enums = ptr; + struct scene_menitem *item; + uint label; + + ptr += enums->size; + if (enums->tag != CB_TAG_OPTION_ENUM || + enums->config_id != entry->config_id) + continue; + + ret = scene_txt_str(scn, enums->text, 0, 0, enums->text, NULL); + if (ret < 0) + return log_msg_ret("tit", ret); + label = ret; + + ret = scene_menuitem(scn, menu_id, simple_xtoa(i), 0, 0, label, + 0, 0, 0, &item); + if (ret < 0) + return log_msg_ret("mi", ret); + item->value = enums->value; + } + *objp = &menu->obj; + + return 0; +} + +/** + * scene_build() - Build a scene and all its objects + * + * See doc/developer/expo.rst for a description of the format + * + * @info: Build information + * @scn: Scene to add the object to + * Returns: 0 if OK, -ENOMEM if out of memory, -EINVAL if there is a format + * error, -ENOENT if there is a references to a non-existent string + */ +static int scene_build(struct build_info *info, struct expo *exp) +{ + struct scene_obj_menu *menu; + const void *ptr, *end; + struct scene_obj *obj; + struct scene *scn; + uint label, menu_id; + int ret; + + ret = scene_new(exp, "cmos", 0, &scn); + if (ret < 0) + return log_msg_ret("scn", ret); + + ret = scene_txt_str(scn, "title", 0, 0, "CMOS RAM settings", NULL); + if (ret < 0) + return log_msg_ret("add", ret); + scn->title_id = ret; + + ret = scene_txt_str(scn, "prompt", 0, 0, + "UP and DOWN to choose, ENTER to select", NULL); + if (ret < 0) + return log_msg_ret("add", ret); + + end = (void *)info->tab + info->tab->size; + for (ptr = (void *)info->tab + info->tab->header_length; ptr < end;) { + const struct cb_cmos_entries *entry; + const struct cb_record *rec = ptr; + + entry = ptr; + ptr += rec->size; + if (rec->tag != CB_TAG_OPTION) + continue; + switch (entry->config) { + case 'e': + ret = menu_build(info, entry, scn, &obj); + break; + default: + continue; + } + if (ret < 0) + return log_msg_ret("add", ret); + + obj->start_bit = entry->bit; + obj->bit_length = entry->length; + } + + ret = scene_menu(scn, "save", EXPOID_SAVE, &menu); + if (ret < 0) + return log_msg_ret("men", ret); + menu_id = ret; + + ret = scene_txt_str(scn, "save", 0, 0, "Save and exit", NULL); + if (ret < 0) + return log_msg_ret("sav", ret); + label = ret; + ret = scene_menuitem(scn, menu_id, "save", 0, 0, label, + 0, 0, 0, NULL); + if (ret < 0) + return log_msg_ret("mi", ret); + + ret = scene_menu(scn, "nosave", EXPOID_DISCARD, &menu); + if (ret < 0) + return log_msg_ret("men", ret); + menu_id = ret; + + ret = scene_txt_str(scn, "nosave", 0, 0, "Exit without saving", NULL); + if (ret < 0) + return log_msg_ret("nos", ret); + label = ret; + ret = scene_menuitem(scn, menu_id, "exit", 0, 0, label, + 0, 0, 0, NULL); + if (ret < 0) + return log_msg_ret("mi", ret); + + return 0; +} + +static int build_it(struct build_info *info, struct expo **expp) +{ + struct expo *exp; + int ret; + + ret = expo_new("coreboot", NULL, &exp); + if (ret) + return log_msg_ret("exp", ret); + expo_set_dynamic_start(exp, EXPOID_BASE_ID); + + ret = scene_build(info, exp); + if (ret < 0) + return log_msg_ret("scn", ret); + + *expp = exp; + + return 0; +} + +int cb_expo_build(struct expo **expp) +{ + struct build_info info; + struct expo *exp; + int ret; + + info.tab = lib_sysinfo.option_table; + if (!info.tab) + return log_msg_ret("tab", -ENOENT); + + ret = build_it(&info, &exp); + if (ret) + return log_msg_ret("bui", ret); + *expp = exp; + + return 0; +} diff --git a/cmd/cedit.c b/cmd/cedit.c index 2ff284f4cde6..baa1d5cbadbb 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -68,6 +68,28 @@ static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +#ifdef CONFIG_COREBOOT_SYSINFO +static int do_cedit_cb_load(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct expo *exp; + int ret; + + if (argc > 1) + return CMD_RET_USAGE; + + ret = cb_expo_build(&exp); + if (ret) { + printf("Failed to build expo: %dE\n", ret); + return CMD_RET_FAILURE; + } + + cur_exp = exp; + + return 0; +} +#endif /* CONFIG_COREBOOT_SYSINFO */ + static int do_cedit_write_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -273,6 +295,9 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, #ifdef CONFIG_SYS_LONGHELP static char cedit_help_text[] = "load - load config editor\n" +#ifdef CONFIG_COREBOOT_SYSINFO + "cb_load - load coreboot CMOS editor\n" +#endif "cedit read_fdt - read settings\n" "cedit write_fdt - write settings\n" "cedit read_env [-v] - read settings from env vars\n" @@ -284,6 +309,9 @@ static char cedit_help_text[] = U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load), +#ifdef CONFIG_COREBOOT_SYSINFO + U_BOOT_SUBCMD_MKENT(cb_load, 5, 1, do_cedit_cb_load), +#endif U_BOOT_SUBCMD_MKENT(read_fdt, 5, 1, do_cedit_read_fdt), U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), U_BOOT_SUBCMD_MKENT(read_env, 2, 1, do_cedit_read_env), diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst index 10a251c2b64f..f2c6452b5b94 100644 --- a/doc/board/coreboot/coreboot.rst +++ b/doc/board/coreboot/coreboot.rst @@ -195,3 +195,9 @@ To update the `coreboot.rom` file which is used: #. Upload the file to Google drive #. Send a patch to change the file ID used by wget in the CI yaml files. + +Editing CMOS RAM settings +------------------------- + +U-Boot supports creating a configuration editor to edit coreboot CMOS-RAM +settings. See :ref:`cedit_cb_load`. diff --git a/doc/develop/cedit.rst b/doc/develop/cedit.rst index 310be8892404..1ac55ab1219b 100644 --- a/doc/develop/cedit.rst +++ b/doc/develop/cedit.rst @@ -172,4 +172,4 @@ Cedit provides several options for persistent settings: For now, reading and writing settings is not automatic. See the :doc:`../usage/cmd/cedit` for how to do this on the command line or in a -script. +script. For x86 devices, see :ref:`cedit_cb_load`. diff --git a/doc/usage/cmd/cbcmos.rst b/doc/usage/cmd/cbcmos.rst index 156521dd02b9..9395cf1cbd71 100644 --- a/doc/usage/cmd/cbcmos.rst +++ b/doc/usage/cmd/cbcmos.rst @@ -40,3 +40,6 @@ CMOS RAM:: Checksum 6600 written => cbc check => + +See also :ref:`cedit_cb_load` which shows an example that includes the +configuration editor. diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 0f0cc26e74ba..fbad0a9b1475 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -15,6 +15,7 @@ Synopis cedit write_env [-v] cedit read_env [-v] cedit write_cmos [-v] [dev] + cedit cb_load Description ----------- @@ -89,6 +90,13 @@ updated. Normally the first RTC device is used to hold the data. You can specify a different device by name using the `dev` parameter. +.. _cedit_cb_load: + +cedit cb_load +~~~~~~~~~~~~~ + +This is supported only on x86 devices booted from coreboot. It creates a new +configuration editor which can be used to edit CMOS settings. Example ------- @@ -155,3 +163,71 @@ Here is an example with the device specified:: => cedit write_cmos rtc@43 => + +This example shows editing coreboot CMOS-RAM settings. A script could be used +to automate this:: + + => cbsysinfo + Coreboot table at 500, size 5c4, records 1d (dec 29), decoded to 000000007dce3f40, forwarded to 000000007ff9a000 + + CPU KHz : 0 + Serial I/O port: 00000000 + base : 00000000 + pointer : 000000007ff9a370 + type : 1 + base : 000003f8 + baud : 0d115200 + regwidth : 1 + input_hz : 0d1843200 + PCI addr : 00000010 + Mem ranges : 7 + id: type || base || size + 0: 10:table 0000000000000000 0000000000001000 + 1: 01:ram 0000000000001000 000000000009f000 + 2: 02:reserved 00000000000a0000 0000000000060000 + 3: 01:ram 0000000000100000 000000007fe6d000 + 4: 10:table 000000007ff6d000 0000000000093000 + 5: 02:reserved 00000000fec00000 0000000000001000 + 6: 02:reserved 00000000ff800000 0000000000800000 + option_table: 000000007ff9a018 + Bit Len Cfg ID Name + 0 180 r 0 reserved_memory + 180 1 e 4 boot_option 0:Fallback 1:Normal + 184 4 h 0 reboot_counter + 190 8 r 0 reserved_century + 1b8 8 r 0 reserved_ibm_ps2_century + 1c0 1 e 1 power_on_after_fail 0:Disable 1:Enable + 1c4 4 e 6 debug_level 5:Notice 6:Info 7:Debug 8:Spew + 1d0 80 r 0 vbnv + 3f0 10 h 0 check_sum + CMOS start : 1c0 + CMOS end : 1cf + CMOS csum loc: 3f0 + VBNV start : ffffffff + VBNV size : ffffffff + ... + Unimpl. : 10 37 40 + +Check that the CMOS RAM checksum is correct, then create a configuration editor +and load the settings from CMOS RAM:: + + => cbcmos check + => cedit cb + => cedit read_cmos + +Now run the cedit. In this case the user selected 'save' so `cedit run` returns +success:: + + => if cedit run; then cedit write_cmos -v; fi + Write 2 bytes from offset 30 to 38 + => echo $? + 0 + +Update the checksum in CMOS RAM:: + + => cbcmos check + Checksum 6100 error: calculated 7100 + => cbcmos update + Checksum 7100 written + => cbcmos check + => diff --git a/include/expo.h b/include/expo.h index 74b45606efe6..19ee19b37430 100644 --- a/include/expo.h +++ b/include/expo.h @@ -762,4 +762,12 @@ int expo_apply_theme(struct expo *exp, ofnode node); */ int expo_build(ofnode root, struct expo **expp); +/** + * cb_expo_build() - Build an expo for coreboot CMOS RAM + * + * @expp: Returns the expo created + * Return: 0 if OK, -ve on error + */ +int cb_expo_build(struct expo **expp); + #endif /*__EXPO_H */ diff --git a/test/cmd/coreboot.c b/test/cmd/coreboot.c index 0c49aca9f58a..72c3f10a92ae 100644 --- a/test/cmd/coreboot.c +++ b/test/cmd/coreboot.c @@ -7,12 +7,16 @@ */ #include +#include #include #include +#include #include +#include #include #include #include +#include "../../boot/scene_internal.h" enum { CSUM_LOC = 0x3f0 / 8, @@ -84,3 +88,33 @@ static int test_cmd_cbcmos(struct unit_test_state *uts) } CMD_TEST(test_cmd_cbcmos, UT_TESTF_CONSOLE_REC); +/* test 'cedit cb_load' command */ +static int test_cmd_cedit_cb_load(struct unit_test_state *uts) +{ + struct scene_obj_menu *menu; + struct video_priv *vid_priv; + struct scene_obj_txt *txt; + struct scene *scn; + struct expo *exp; + int scn_id; + + ut_assertok(run_command("cedit cb_load", 0)); + ut_assertok(run_command("cedit read_cmos", 0)); + ut_assert_console_end(); + + exp = cur_exp; + scn_id = cedit_prepare(exp, &vid_priv, &scn); + ut_assert(scn_id > 0); + ut_assertnonnull(scn); + + /* just do a very basic test that the first menu is present */ + menu = scene_obj_find(scn, scn->highlight_id, SCENEOBJT_NONE); + ut_assertnonnull(menu); + + txt = scene_obj_find(scn, menu->title_id, SCENEOBJT_NONE); + ut_assertnonnull(txt); + ut_asserteq_str("Boot option", expo_get_str(exp, txt->str_id)); + + return 0; +} +CMD_TEST(test_cmd_cedit_cb_load, UT_TESTF_CONSOLE_REC); From patchwork Mon Oct 2 01:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1841910 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=UMBqvEO7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzNpX6fpZz1yp0 for ; Mon, 2 Oct 2023 12:36:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1481A8723F; Mon, 2 Oct 2023 03:18:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UMBqvEO7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 00A17871A4; Mon, 2 Oct 2023 03:18:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCEE987288 for ; Mon, 2 Oct 2023 03:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7a26fbfcf8eso90126839f.2 for ; Sun, 01 Oct 2023 18:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696209397; x=1696814197; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JLYEiPejhXznmzYRrJ1pqI6+La8HHBtZLoM/W9cvp2g=; b=UMBqvEO7Ocl2tGztzvb+IchwzLsMR9KVRX5GhgRx79lGPf1WLroaLyaBQoCDJFHhmC lKykA6ODHDMfTLrzxLfZBnD/+VmgF8nGdcn/14jv4hIyeYjeh+p6EZpF5DP+5WJNRL66 bNUFv+5adjtlVF79kTMu06r844ScO0xUCPGvM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696209397; x=1696814197; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JLYEiPejhXznmzYRrJ1pqI6+La8HHBtZLoM/W9cvp2g=; b=HbBvgmptRsy/pfCHHubW8y4e+Wy1d95PNcjU3o8f5Uzm8mEoH5W85F0OUzXzoQW1gD kh075dzaXPbqZgQTcR7T/ZOHYIkLK1Vy0fVUmMNNfKl6wApUK8Xxu/tC8mi7N3Xyzjp1 +YTYO+D1ICCkQ8MR/TcTAEckpaCccz0KR7zIdQpegIYgilxK5dlNfBQ7+mL1dw1JCSh/ sLR75u6O/UnTTPYakFwskC48YqtF0SYk+ZY71HUl82AVYIPWiYg56KZkFoUpQoDKt0hE LTYF9WeRdfLIJFUxGZM0LRrPIlih4+oZWE3mfU4iUms+VEVHfGOsZSLaRtVxLpWl8Wvx D5KA== X-Gm-Message-State: AOJu0YxP4doPvHJcKvAV8Bk4sJ2MofaUo4n4svwIBf2UrrOL40PEMUXy Dj5IE/su51TjeE+sXC6bsmZyBRXoCvAw6Y3awvA= X-Google-Smtp-Source: AGHT+IFI7254PSqKpoi9eEexbFkQX+t1nCvLYEHQoM/vYBzjMxlX9+QLUny0WyGFOeK0oo0qeJ+SKA== X-Received: by 2002:a05:6e02:1646:b0:34b:ad80:61c1 with SMTP id v6-20020a056e02164600b0034bad8061c1mr14288345ilu.26.1696209397253; Sun, 01 Oct 2023 18:16:37 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l26-20020a02a89a000000b0041d859c5721sm6819619jam.64.2023.10.01.18.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 18:16:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Tom Rini , Anatolij Gustschin , Abdellatif El Khlifi , Heinrich Schuchardt , Ilias Apalodimas , Ramon Fried , Sean Edmond , Tobias Waldekranz Subject: [PATCH 34/34] x86: Enable RTC command by default Date: Sun, 1 Oct 2023 19:15:44 -0600 Message-ID: <20231002011553.463514-35-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20231002011553.463514-1-sjg@chromium.org> References: <20231002011553.463514-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean The real-time clock is needed for most X86 systems and it is useful to be able to read from it. Enable the rtc command by default. Signed-off-by: Simon Glass --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index e6977dc91bb2..080e104f9d76 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2164,6 +2164,7 @@ config CMD_DATE config CMD_RTC bool "rtc" depends on DM_RTC + default y if X86 help Enable the 'rtc' command for low-level access to RTC devices.