From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA2BAC54EE9 for ; Sun, 25 Sep 2022 15:11:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A54F684DC8; Sun, 25 Sep 2022 17:05: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="cIirLWa5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1456B84D6B; Sun, 25 Sep 2022 17:04:13 +0200 (CEST) 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 406AC84CE3 for ; Sun, 25 Sep 2022 17:04: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-xd30.google.com with SMTP id p3so3395724iof.13 for ; Sun, 25 Sep 2022 08:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=9NSC4CBJnmokdiB1xArfGs8hfquMPwSdii/0bRvj1KA=; b=cIirLWa5PTvzn4poB6+V30YlVyWyW5/fm07zuXhn+gyFcBZgyGKsRP2wEIP4r9twR4 HZyBEzk3ubtQD7GhP/CUkNwYyuUHVzvvS1ikrQf2b5YKGXFY9j3GdjtaSULwkbH1si58 ajG7AKDcmapV0H9etLx9w/nIxVqwb/kw/tYSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=9NSC4CBJnmokdiB1xArfGs8hfquMPwSdii/0bRvj1KA=; b=2XWHTgjtEXbHHFUyYrAxNlflrMy8lv4TbNIbjsJPpc5pAkoahKByEXfj2p/fsR/dTi v6PY42LrYJ+5KBUncqLtmyCzg99aHorvALs4ePWKnx1f5G2VmC2XYW8XF/PsszVOR9/i 7dXnAN6yCKe3Mh/0iqhQEH9M8Z0amY+m4dgMkZfSdKZRsA9MGDlZrm2wlTHu7YZ5F6ZE eSwKPBRNhxauphuoZNd3N2SEjJS2H68iN7WGFH7mOg7aPYj0GFI9XIWSl1M4nN724KID Xjw9Ue9yXmbbGKlvz/Drqo7D6l1ecGizsMTDz+MWdV6Rv7VYKTGN8Y3kOVh9NLljFgI1 ArMw== X-Gm-Message-State: ACrzQf2fSeWOCYVCoE73Tf+Xt2hYqI25Za+ZtfySec/sKXDDcj4VsBce VnKDqLQg1JyLPbIzeLJSesZ4cIkyXxwurA== X-Google-Smtp-Source: AMsMyM7iPusnD3pJTgJqyt18PIw64BZibwDnjPZJ2WSPtQMDiZT6v5kYsIax+LEGTF6Dc1Ji4eoTsQ== X-Received: by 2002:a05:6638:5a7:b0:35a:5354:9d6b with SMTP id b7-20020a05663805a700b0035a53549d6bmr9429431jar.53.1664118236108; Sun, 25 Sep 2022 08:03:56 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u19-20020a926013000000b002f19d9838c6sm5360578ilb.25.2022.09.25.08.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 08:03:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng , Heinrich Schuchardt , Ilias Apalodimas , =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH 43/45] vbe: Add docs and a test for the VBE command Date: Sun, 25 Sep 2022 09:02:46 -0600 Message-Id: <20220925150248.2524421-44-sjg@chromium.org> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220925150248.2524421-1-sjg@chromium.org> References: <20220925150248.2524421-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean After further development this seems to be useful for debugging and testing. Add documentation and a test. Signed-off-by: Simon Glass --- doc/usage/cmd/vbe.rst | 90 +++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + test/boot/Makefile | 1 + test/boot/vbe.c | 69 +++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 doc/usage/cmd/vbe.rst create mode 100644 test/boot/vbe.c diff --git a/doc/usage/cmd/vbe.rst b/doc/usage/cmd/vbe.rst new file mode 100644 index 00000000000..2b5cdd7d411 --- /dev/null +++ b/doc/usage/cmd/vbe.rst @@ -0,0 +1,90 @@ +vbe command +=========== + +Synopsis +-------- + +:: + + vbe list + vbe select + +Description +----------- + +The vbe command provides a way to interact with :doc:`../../develop/vbe`. It has +subcommands for different purposes. + +vbe list +~~~~~~~~ + +Lists the available VBE bootmeths. These are a subset of all bootmeths, as +accessed via the :doc:`bootmeth`. + +The fields are as follows: + +#: + Shows the bootmeth sequence number, Use the `bootmeth list` command to see + all available bootmeths. + +Sel: + Indicates the selected bootmeth with an asterisk (`*`). + +Device: + Name of VBE device, which is taken from the name of its device tree node. + +Driver: + Name of the VBE driver + +Description: + Description of the VBE driver + + +vbe select +~~~~~~~~~~ + +Allows a particular bootmeth to be selected. Either a sequence number or a +device name can be provided. + +Without any arguments, any selected device is deselected. + + +Examples +-------- + +This shows listing and selecting devices:: + + => vbe list + # Sel Device Driver Description + --- --- -------------- -------------- ----------- + 2 firmware0 vbe_simple VBE simple + --- --- -------------- -------------- ----------- + => vbe sel 2 + => vbe list + # Sel Device Driver Description + --- --- -------------- -------------- ----------- + 2 * firmware0 vbe_simple VBE simple + --- --- -------------- -------------- ----------- + => vbe sel + => vbe list + # Sel Device Driver Description + --- --- -------------- -------------- ----------- + 2 firmware0 vbe_simple VBE simple + --- --- -------------- -------------- ----------- + +This shows selecting a VBE device by its name:: + + => vbe sel firmware0 + => vbe list + # Sel Device Driver Description + --- --- -------------- -------------- ----------- + 2 * firmware0 vbe_simple VBE simple + --- --- -------------- -------------- ----------- + => + + +Return value +------------ + +The return value $? is set to 0 (true) on success, or 1 (failure) if something +goes wrong, such as failing to find the bootmeth with `vbe select`. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 73966c6e012..62c898c3575 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -68,6 +68,7 @@ Shell commands cmd/size cmd/true cmd/ums + cmd/vbe cmd/wdt Booting OS diff --git a/test/boot/Makefile b/test/boot/Makefile index d724629d3b0..167629a03ee 100644 --- a/test/boot/Makefile +++ b/test/boot/Makefile @@ -9,3 +9,4 @@ ifdef CONFIG_OF_LIVE obj-$(CONFIG_BOOTMETH_VBE_SIMPLE) += vbe_simple.o endif obj-$(CONFIG_BOOTMETH_VBE) += vbe_fixup.o +obj-$(CONFIG_CMD_VBE) += vbe.o diff --git a/test/boot/vbe.c b/test/boot/vbe.c new file mode 100644 index 00000000000..9653ac5d94b --- /dev/null +++ b/test/boot/vbe.c @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test for `vbe` command + * + * Copyright 2022 Google LLC + * Written by Simon Glass + */ + +#include +#include +#include +#include +#include +#include "bootstd_common.h" + +/* Check 'vbe list' command */ +static int vbe_cmd_list(struct unit_test_state *uts) +{ + console_record_reset_enable(); + ut_assertok(run_command("vbe list", 0)); + ut_assert_nextline(" # Sel Device Driver Description"); + ut_assert_nextlinen("---"); + ut_assert_nextline(" 2 firmware0 vbe_simple VBE simple"); + ut_assert_nextlinen("---"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(vbe_cmd_list, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + +/* Check 'vbe select' command */ +static int vbe_cmd_select(struct unit_test_state *uts) +{ + /* select a device */ + console_record_reset_enable(); + ut_assertok(run_command("vbe select 2", 0)); + ut_assert_console_end(); + + ut_assertok(run_command("vbe list", 0)); + ut_assert_nextline(" # Sel Device Driver Description"); + ut_assert_nextlinen("---"); + ut_assert_nextline(" 2 * firmware0 vbe_simple VBE simple"); + ut_assert_nextlinen("---"); + ut_assert_console_end(); + + /* deselect it */ + ut_assertok(run_command("vbe select", 0)); + ut_assert_console_end(); + ut_assertok(run_command("vbe list", 0)); + ut_assert_nextline(" # Sel Device Driver Description"); + ut_assert_nextlinen("---"); + ut_assert_nextline(" 2 firmware0 vbe_simple VBE simple"); + ut_assert_nextlinen("---"); + ut_assert_console_end(); + + /* select a device by name */ + console_record_reset_enable(); + ut_assertok(run_command("vbe select firmware0", 0)); + ut_assert_console_end(); + ut_assertok(run_command("vbe list", 0)); + ut_assert_nextline(" # Sel Device Driver Description"); + ut_assert_nextlinen("---"); + ut_assert_nextline(" 2 * firmware0 vbe_simple VBE simple"); + ut_assert_nextlinen("---"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(vbe_cmd_select, UT_TESTF_DM | UT_TESTF_SCAN_FDT); -- 2.37.3.998.g577e59143f-goog