Commit graph

2129 commits

Author SHA1 Message Date
Marek Vasut
9d019f5106 cmd: fdt: Check argc before accessing argv in fdt bootcpu
On case 'fdt bootcpu' is invoked without parameters, argv[2] is not
valid and this command would SEGFAULT in sandbox environment. Add
missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:57 -08:00
Marek Vasut
778c7ab5a7 cmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space
In case 'fdt rsvmem delete index' is passed a non-existent index, one
which does not exist in 'fdt rsvmem print', then the following command
triggers a print of help message for 'fdt' command instead of erroring
out:
=> fdt rsvmem delete 1234
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_del_mem_rsv() and fdt_add_mem_rsv() in error message with the rest
of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:57 -08:00
Marek Vasut
9597637f93 cmd: fdt: Fix fdt rm behavior on non-existent property and error message space
In case an FDT contains a node '/test-node@1234' , with no property
called 'noprop' in that node, the following command triggers a print
of help message for 'fdt' command instead of erroring out:
=> fdt rm /test-node@1234 noprop
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_delprop() in error message with the rest of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:57 -08:00
Marek Vasut
45d20f55a1 cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
It is perfectly valid to request an address or size of FDT property
without value, the only special case if requesting of the value of
FDT property without value. Invert the test such, that properties
without value still set the variable from 'fdt get addr/size' to
address of the property or size of the property, where the later
is 0.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:57 -08:00
Marek Vasut
56915fa4cc cmd: fdt: Import is_printable_string() from DTC to fix u32 misprint
Import is_printable_string() implementation from DTC 1.7.0 as of
DTC commit 039a994 ("Bump version to v1.7.0") . This fixes a print
of u32 property which so far used to be printed as string by U-Boot
fdt print command.

We might see the case where the parsed property value, in this case
it is a 32-bit integer, identified as a printable string or a null byte
(concatenated strings) because of its last character happens to be:
  0x00 (null character), 0xB (vertical tab character) or
  0x10 (line feed character)
In this situation, if the string is identified as printable string,
it will be displayed as character instead of hex value

When the isprint() condition is true, there are two possibilities:
  1) The character is ASCII character (except the first 32)
  2) The character is extended ASCII character

For example,
NG property in device tree:
    clock-frequency = <16640000>;
by default, would be displayed as
    clock-frequency = "", "ýè";
and with this patch applied, would be displayed as
    clock-frequency = <0x00fde800>;

Full investigation was done by Nam and Hai, patch reworked by Marek
to use common code from DTC.

Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:56 -08:00
Simon Glass
4f806f31fc bootflow: Rename bootflow_flags_t
These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:49 -08:00
Dzmitry Sankouski
e7ee1fd567 video console: allow font size configuration at runtime
Allow font size configuration at runtime for console_simple.c
driver. This needed for unit testing different fonts.

Configuring is done by `font` command, also used for font
selection in true type console.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-07 15:59:35 +01:00
Dzmitry Sankouski
4f6e34811d video console: move vidconsole_get_font_size() logic to driver ops
Since multiple vidconsole drivers exists, vidconsole_get_font_size()
implementation cannot longer live in vidconsole_uclass.c file.

Move current vidconsole_get_font_size logic to truetype driver ops.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-07 15:59:21 +01:00
Pali Rohár
4941652df5 cmd: mvebu/bubt: Enable command by default
This makes updating of u-boot/firmware on Marvell boards easier.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
c624c1cbcf cmd: mvebu/bubt: Fix warnings: unused variable 'secure_mode' and 'fuse_read_u64' defined but not used
'secure_mode' and 'fuse_read_u64' are used only on A38x and A37xx.

Fixes: f7b0bbca2b ("cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure boot")
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
329393f17f cmd: mvebu/bubt: Better guess default MVEBU_*_BOOT option
For 32-bit Armada boards which use SPL we can determinate boot device from
existing MVEBU_SPL_BOOT_DEVICE_* option. For all other boards (e.g. 64-bit
Armada) default option still needs to be set manually.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
c766c097ef cmd: mvebu/bubt: Set correct default image name for 32-bit Armada SoCs
32-bit Armada SoCs uses u-boot binary packed in kwbimage format. Name of
the image is in CONFIG_BUILD_TARGET option. So use it as a default option
in Kconfig.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
f5860c567b cmd: mvebu/bubt: Check also A8K boot image checksum
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
7d9c083844 cmd: mvebu/bubt: Do not modify image in A8K check_image_header()
Change checksum verification code so it does require to modify image.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
40e3204c62 cmd: mvebu/bubt: Mark all local symbols as static
There is no need to export these local functions and structures.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
e7813da07a cmd: mvebu/bubt: Rename variable image_size to hdr_size
Variable image_size contains size of the header, not size of the whole
image. Rename this variable to reflect content.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
4bf91e2203 cmd: mvebu/bubt: Add support for reading image from the SATA disk partition
This change allows to load boot image from the first SATA/SCSI device
partition and burn it to board boot location (e.g. SPI-NOR). This is
particularly when storage device is not handled by U-Boot as USB mass
storage (which is already supported by bubt) but as SATA/SCSI device.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
c8f5009029 cmd: mvebu/bubt: Add support for writing image to SATA disk
All 32-bit Armada SoCs and also 64-bit Armada 3720 SoC can load and boot
firmware from SATA disk. This adds support for updating firmware binary for
these SoCs. On 32-bit Armada SoC is firmware stored at sector 1 and on
Armada 3720 is stored at MBR partition 0x4d or GPT partition with type GUID
6828311A-BA55-42A4-BCDE-A89BB5EDECAE (Marvell Armada 3700 Boot partition).

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
fc10a926ec cmd: mvebu/bubt: Add support for selecting eMMC HW partition
Support for burning into the correct eMMC HW boot partition was broken and
removed in commit 96be2f0727 ("mvebu: bubt: Drop dead code"). Reimplement
this functionality and bring it back again.

Fixes: 96be2f0727 ("mvebu: bubt: Drop dead code")
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
a2cd076b7f cmd: mvebu/bubt: Fix parsing SATA kwbimage
Despite the official specification, Marvell BootROM does not interpret
srcaddr from SATA image as number of sectors the beginning of the hard
drive, but as number of sectors relative to the main header.

Reject invalid and accept valid SATA images.

Fixes: 5a06534933 ("cmd: mvebu/bubt: Check for A38x image data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
eb2c8f3805 cmd: mvebu/bubt: Fix parsing SDIO kwbimage
Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To ensure that we do not store invalid SDIO image to the boot location
(read by the Marvell BootROM), we need to check that image is valid
and srcaddr is intepreted in bytes, in the same way as it is done by
Marvell BootROM.

This fixes rejecting valid and accepting invalid SDIO images by bubt command.

Fixes: 5a06534933 ("cmd: mvebu/bubt: Check for A38x image data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Ashok Reddy Soma
cfb82f7c12 mtd: nand: Mark reserved blocks
Reserved blocks are used for storing bad block tables. With "nand bad"
command, these reserved blocks are shown as bad blocks. This is leading
to confusion when compared with Linux bad blocks. Hence, display
"bbt reserved" when printing reserved blocks with "nand bad" command.

To acheive this, return 2 which represents reserved from nand_isbad_bbt()
instead of 1 in case of reserved blocks and catch it in cmd/nand.c.

"nand bad" command display's hexadecimal numbers, so add "0x" prefix.

Example log will show up as below.

ZynqMP> nand bad

Device 0 bad blocks:
  0x00400000
  0x16800000
  0x16c00000
  0x17000000
  0x3d800000
  0x3e400000
  0xe8400000
  0xff000000	 (bbt reserved)
  0xff400000	 (bbt reserved)
  0xff800000	 (bbt reserved)
  0xffc00000	 (bbt reserved)
  0x116800000
  0x116c00000
  0x1ff000000	 (bbt reserved)
  0x1ff400000	 (bbt reserved)
  0x1ff800000	 (bbt reserved)
  0x1ffc00000	 (bbt reserved)

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-By: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2023-02-27 16:28:30 +01:00
Etienne Carriere
aa2d3945ce efi_loader: Measure the loaded DTB
Measures the DTB passed to the EFI application upon new boolean config
switch CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB. For platforms where the
content of the DTB passed to the OS can change across reboots, there is
not point measuring it hence the config switch to allow platform to not
embed this feature.

Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-19 21:15:15 +01:00
Tom Rini
be9399b399 Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- mvebu: Support for 2 new Armada 385 boards (Tony)
- mvebu: Minor misc board enhancements (Tony)
- kirkwood: Serial driver fixes (Kconfig & dtsi) (Tony)
- cmd: return code when tlv_eeprom incorrectly called (Heinrich)
2023-02-13 09:39:15 -05:00
Heinrich Schuchardt
93a80c1515 cmd: return code when tlv_eeprom incorrectly called
A command called with incorrect parameters should set $? to 1 (false).
Instead of calling cmd_usage(cmdtp) and then returning 0 just return
CMD_RET_FAILURE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
2023-02-13 10:14:50 +01:00
Andre Przywara
4ee85df9ce cmd: fdt: allow standalone "fdt move"
At the moment every subcommand of "fdt", except "addr" itself, requires
the DT address to be set first. We explicitly check for that before even
comparing against the subcommands' string.
This early bailout also affects the "move" subcommand, even though that
does not require or rely on a previous call to "fdt addr". In fact it
even sets the FDT address to the target of the move command, so is a
perfect beginning for a sequence of fdt commands.

Move the check for a previously set FDT address to after we handle the
"move" command also, so we don't need a dummy call to "fdt addr" first,
before being able to move the devicetree.

This skips one pointless "fdt addr" call in scripts which aim to alter
the control DT, but need to copy it to a safe location first (for
instance to $fdt_addr_r).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-12 17:33:51 -07:00
Andre Przywara
6459734619 cmd: fdt: move: Use map_sysmem to convert pointers
The "fdt move" subcommand was using the provided DTB addresses directly,
without trying to "map" them into U-Boot's address space. This happened
to work since on the vast majority of "real" platforms there is a simple
1:1 mapping of VA to PAs, so either value works fine.

However this is not true on the sandbox, so the "fdt move" command fails
there miserably:
=> fdt addr $fdtcontroladdr
=> cp.l $fdtcontroladdr $fdt_addr_r 40  # simple memcpy works
=> fdt move $fdtcontroladdr $fdt_addr_r
Segmentation fault

Use the proper "map_sysmem" call to convert PAs to VAs, to make this
more robust in general and to enable operation in the sandbox.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-12 17:33:51 -07:00
Patrick Delaunay
c40251c120 cmd: clk: probe the clock before dump them
The clock UCLASS need to be probed to allow availability of the
private data (struct clk *), get in show_clks() with dev_get_clk_ptr()
before use them.

Without this patch the clock dump can cause crash because all the
private data are not available before calling the API clk_get_rate().

It is the case for the SCMI clocks, priv->channel is needed for
scmi_clk_get_rate() and it is initialized only in scmi_clk_probe().
This issue causes a crash for "clk dump" command on STM32MP135F-DK board
for SCMI clock not yet probed.

Fixes: 1a725e2290 ("clk: fix clock tree dump to properly dump out every registered clock")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20221213145708.v2.1.Ia0bc6b272f1e2e3f37873c61d79138c2663c4055@changeid
2023-02-12 13:37:56 -05:00
Tom Rini
c34009d5a9 Pull request for efi-2023-04-rc2
Documentation:
 
 * Provide page with links to talks on U-Boot
 
 UEFI:
 
 * Enable CTRL+S to save the boot order in eficonfig command
 * Run attribute check for QueryVariableInfo() only for the file store
 * Bug fixes
 
 Others:
 
 * Improve output formatting of the coninfo command
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmPme8EACgkQxIHbvCwF
 GsTJ6RAAiDVG2OFTodxLFVhzxoorrIf/piMZDxtc1ClRxF7CPe5CET18bHp0hvvw
 qKJW+dk3aCUSr+E1Ma9ndAHI+/mKmEXudZj/XuUyxlVhm9P8Fw2EQRGZFeogdp0v
 /tMB8c7DjW5kTg39/U3z3F7qo6ifs1I8rGcxAhvU38iuOmmIai6AZH1cEq2P2zY9
 JdHPzSCVz4TOGzmhJD3wxYMn+DjsLxIT0tggGPRJzXGaAdZdLS7cl/X52rabV/Tq
 aJXhjpWNl7RUiNiQbKMtltbmkJQ2MpHkhLGDj2/3H2W5sbpIx0GwDs7r0GSKJ0Ba
 6ycn5NBjP3C3gcl91oWJXrzux6LN2aWqe45lgOLpL2H2pPaRlDebBEdDA+oNQKoo
 mqX8pMbLfpb3nhg/fOXo/YDZ5Uug42fmpjj3Vu5+imjq9jL+tr5lxZ2oDpsUyT51
 MvQXohYTfsYNHQm7M4BzGIuA66WwCJ5TJ3D/YmwdDWPnCCN+QAUMI2/d8Osbct6W
 OBGaoZQoRpPZV62+mrHloXW9j8sapcQfJGejdby7S1bxagF/KG/BLXGCWH/HdWCc
 TsnW+bOOF4N9gIyyyu3yRfHyE7pIyszWlNwRAuPzjwG0dxEbkboA/JdLIFic3Qsj
 fk/65FSvvAeOuvNYEgsEA5VYXJzhD4oNtcNQZHIHjhSTGKBrJF4=
 =HVHT
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc2

Documentation:

* Provide page with links to talks on U-Boot

UEFI:

* Enable CTRL+S to save the boot order in eficonfig command
* Run attribute check for QueryVariableInfo() only for the file store
* Bug fixes

Others:

* Improve output formatting of the coninfo command

# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Feb 2023 12:15:45 PM EST
# gpg:                using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4
# gpg: Good signature from "Heinrich Schuchardt <xypron.glpk@gmx.de>" [unknown]
# gpg:                 aka "[jpeg image of size 1389]" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7  6D33 C481 DBBC 2C05 1AC4
2023-02-10 13:45:15 -05:00
Simon Glass
2c0b0c3182 Correct SPL use of EFI_SECURE_BOOT
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_SECURE_BOOT defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10 11:24:08 -05:00
Simon Glass
83f3d121dd Correct SPL use of EFI_MM_COMM_TEE
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_MM_COMM_TEE defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10 07:41:41 -05:00
Simon Glass
2fe2ac139f Correct SPL use of VIDEO_ANSI
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_VIDEO_ANSI defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10 07:41:40 -05:00
Simon Glass
1f69cbe1f1 Correct SPL uses of VIDEO
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_VIDEO defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10 07:41:40 -05:00
Simon Glass
37407ac2f1 Correct SPL use of USB_FUNCTION_FASTBOOT
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_USB_FUNCTION_FASTBOOT defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-02-10 07:41:40 -05:00
Simon Glass
942b309609 Correct SPL use of UDP_FUNCTION_FASTBOOT
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_UDP_FUNCTION_FASTBOOT defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-02-10 07:41:40 -05:00
Simon Glass
5b4d810de7 Correct SPL uses of SYS_LONGHELP
This converts 5 usages of this option to the non-SPL form, since there is
no SPL_SYS_LONGHELP defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10 07:41:40 -05:00
Heinrich Schuchardt
8925f0ee7e efi_loader: enable eficonfig command by default
The eficonfig command is required to set boot options.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
75d494df01 cmd: CONFIG_CMD_EFICONFIG requires CONFIG_MENU
The eficonfig command invokes functions implemented in common/menu.c like

* menu_default_set()
* menu_get_choice()
* menu_destroy()
* menu_item_add()

Fixes: 87d791423a ("eficonfig: menu-driven addition of UEFI boot option")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-10 13:05:39 +01:00
Masahisa Kojima
88df36346c eficonfig: CTRL+S to save the boot order
The change boot order menu in eficonfig can have at most INT_MAX lines
and it is troublesome to scroll down to the "Save" entry.

This commit assigns CTRL+S to save the boot order.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:39 +01:00
Masahisa Kojima
45f5319fa6 menu: remove CTRL+C to quit
On the sandbox called without "--terminal raw" CTRL+C leaves U-Boot,
"ESC/CTRL+C to quit" is misleading.

Let's remove CTRL+C to quit key handling from bootmenu and eficonfig menu.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:39 +01:00
Heinrich Schuchardt
fe34e163e0 cmd: improve coninfo output formatting
Device name are typically longer than 8 characters. This leads to ragged
output.
Only the I and O bit of the device flags are of interest for the user.
Writing a hexadecimal number is just confusing.

Before the patch the output looked like this:

    => coninfo
    List of available devices:
    pl011@9000000 00000007 IO stdin stdout stderr
    serial   00000003 IO
    usbkbd   00000001 I.

With the patch the output looks like this:

    => coninfo
    List of available devices
    |-- pl011@9000000 (IO)
    |   |-- stdin
    |   |-- stdout
    |   |-- stderr
    |-- serial (IO)
    |-- usbkbd (I)

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-10 13:05:39 +01:00
Simon Glass
b15a4af810 Correct SPL uses of CMD_TFTPPUT
This converts 3 usages of this option to the non-SPL form, since there is
no SPL_CMD_TFTPPUT defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
ddeac15e01 Correct SPL use of CMD_NVEDIT_EFI
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_CMD_NVEDIT_EFI defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
6cd3a797ee Correct SPL uses of CMD_EFICONFIG
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_CMD_EFICONFIG defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:25 -05:00
Simon Glass
65a7310de6 env: Drop ENV_IS_IN_SATA
This is not used anywhere, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:48 -05:00
Simon Glass
867552b51b Drop dataflash_mmc_mux command
This is not used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-02-07 14:33:48 -05:00
Simon Glass
f85a271cf3 cmd: Drop mfsl command
This is not used anywhere. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:48 -05:00
Simon Glass
e158c94883 cmd: Add an option to enable the ini command
This command has no Kconfig option at present, but seems useful enough to
keep around. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:48 -05:00
Linus Walleij
41a29f284c cmd: Add a SEAMA image load command
Add a command to load SEAMA (Seattle Image), a NAND flash
on-flash storage format.

This type of flash image is found in some D-Link routers such
as DIR-645, DIR-842, DIR-859, DIR-860L, DIR-885L, DIR890L and
DCH-M225, as well as in WD and NEC routers on the ath79
(MIPS), Broadcom BCM53xx, and RAMIPS platforms.

This U-Boot command will read and decode a SEAMA image from
raw NAND flash on any platform. As it is always using big endian
format for the data decoding is always necessary on platforms
such as ARM.

The command is needed to read a SEAMA-encoded boot image on the
D-Link DIR-890L router for boot from NAND flash in an upcoming
port of U-Boot to the Broadcom Northstar (BCM4709, BCM53xx)
architecture.

A basic test and documentation is added as well. The test must
be run on a target with NAND flash support and at least one
resident SEAMA image in flash.

Cc: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2023-02-06 17:10:15 -05:00
Simon Glass
00fa989eab qemu: Move qfw kernel setup into a common file
This is currently in the cmd/ file but we want to call it from a driver.
Move it into a common place. Tidy up the header-file order while we are
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06 13:04:53 -05:00
Simon Glass
e08e6ea67d qemu: Update qfw command to use addresses
This uses casts all over the place. Use the correct type so that these
can be avoided, as is done with other commands. Also simplify a few
conditionals.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06 13:04:53 -05:00
Simon Glass
0041b1c09a bootstd: Allow enabling BOOTSTD_FULL without needing EXPO
It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06 13:04:53 -05:00
Tom Rini
73a3f51391 Merge https://source.denx.de/u-boot/custodians/u-boot-mmc 2023-01-31 18:28:07 -05:00
Tom Rini
095d909cf1 - jethub j100: add rescue boot from microSD
- move meson sm command to cmd/meson and add efusedump sub-command
 - switch dwc2 otg to DM for G12A, GXL & AXG
 - Add new boards:
  - Odroid Go Ultra
  - Odroid-N2L
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPVPGJshWBf4d9CyLd9zb2sjISdEFAmPY1OsACgkQd9zb2sjI
 SdEo4w//WU0siViTHkco8GH7eZDrRKbsxgMZpmjih2gblDKfxmMPYFFtciXPH3wg
 isBu+qfLFtTIg5oEvwS42G4RzNQPV8HDcpc7Md/3n3GtxF1l/dCo0nvfIi9PsuLB
 x1GYAJ5yphgOC85DB55Gnq7sj7L2/7z6dd/HFGO691+3Bcbq8RH6DDZ0MNZpiiUK
 Ns43u+A6Ydc2/fpX9U7X2wf7CoEk77qWmiN2N1egVIeRsBallPxs/DPNLI2q7AGZ
 OGY+M3lVynRlNJULdgljqvVm1/KjlsVGHRwDAFD7Gl6HhGymxhXJJuNTh+le4ruw
 f5KLpUI9mEEmST6NfKqj+8Ozd3q8c1EHD0baKupIeTaherWi/sD9DpnMli4efrUj
 CkrBPqgxScxauuYAbMjRmKJgICRzNMJAsKX57q8s0TjhWyAfoTKIPWHUpSjAeDRE
 1pWblV0WZWFErMmdHllINFtFYl+XBCi/1qp2t8AYA06DPnBrY2s/eY9pxih0G7nB
 tzNkqWTwMAJ7PYOzDA7mv80n2Q2zjqJV55dzjRRehA3XSuP920qFVMVShSYv28O6
 fh8t84rdqfvFMSnQy6zHaxGEJIwaH9C6aFM8MGak2WLI1EYLIxVi79qf+T3iMbdj
 gkKvt5m4kF7Ul8nB/7Az7nNH1JdHgVRXLIzo+lam4AdYccONvVI=
 =cmt7
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-amlogic-20230131' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- jethub j100: add rescue boot from microSD
- move meson sm command to cmd/meson and add efusedump sub-command
- switch dwc2 otg to DM for G12A, GXL & AXG
- Add new boards:
 - Odroid Go Ultra
 - Odroid-N2L
2023-01-31 10:15:39 -05:00
Marek Vasut
cf1f7355ae cmd: mmc: Expand bkops handling
Add more capable "bkops" command which allows enabling and disabling both
manual and automatic bkops. The existing 'mmc bkops-enable' subcommand is
poorly named to cover all the possibilities, hence the new-ish subcommand.
Note that both commands are wrappers around the same common code.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-01-31 22:02:27 +09:00
Masahisa Kojima
8dbd0a0f8e eficonfig: add vertical scroll support
The current eficonfig menu does not support vertical scroll,
so it can not display the menu entries greater than
the console row size.

This commit add the vertial scroll support.
The console size is retrieved by
SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode() service, then
calculates the row size for menu entry by subtracting
menu header and description row size from the console row size.
"start" and "end" are added in the efimenu structure.
"start" keeps the menu entry index at the top, "end" keeps
the bottom menu entry index. item_data_print() menu function
only draws the menu entry between "start" and "end".

This commit also fixes the issue that "Save" and "Quit"
entries can be moved by BKEY_PLUS in change boot order menu.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-01-27 18:32:00 +01:00
Masahisa Kojima
0d59085235 eficonfig: refactor change boot order implementation
This commit removes the change boot order specific
menu implementation. The change boot order implementation
calls eficonfig_process_common() same as other menus.

The change boot order menu requires own item_data_print
and item_choice implementation, but display_statusline
function can be a same function as other menus.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-01-27 18:32:00 +01:00
Masahisa Kojima
cd160b27bd eficonfig: refactor eficonfig_process_common function
Current change boot order implementation does not call
eficonfig_process_common() and call own menu functions
for display_statusline, item_data_print and item_choice.
Change boot order functionality should call
eficonfig_process_common() to improve maintenanceability.

This commit is a preparation to remove the change boot
order specific implementation. The menu functions
(display_statusline, item_data_print and item_choice) are
added as argument of eficonfig_process_common().
The menu description string displayed at the bottom of
the menu is also added as argument.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-01-27 18:32:00 +01:00
Heinrich Schuchardt
5c3ea29e43 cmd: fix mtest on 64 bit systems
* Use 16 digits on 64 bit systems.
* Use 64 bit patterns on 64 bit systems.
* Expect the sign bit in bit 63 on 64 bit systems.
* Adjust the formatting of a constant.
* Always print result on new line

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2023-01-27 18:31:58 +01:00
Heinrich Schuchardt
ee0b0be204 cmd: fix return code of 'sf erase'
If the offset or the size passed to the 'sf erase' command exceeds
the size of the SPI flash displaying the command usage is not
helpful. Return CMD_RET_FAILURE instead of CMD_RET_USAGE.

Use the CMD_RET_* constants instead of 0, 1, -1.

Simplify a logical expression in the final return statement.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-01-26 21:05:13 +05:30
Heinrich Schuchardt
8c8df67609 cmd: simplify do_spi_flash()
CMD_RET_USAGE == -1. The special handling of this value at the end of
do_spi_flash() does not make any sense.

To avoid future confusion use the CMD_RET_* constants and simplify the
code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-01-26 21:04:40 +05:30
Heinrich Schuchardt
fa3b38d4c4 cmd: fix return code of 'sf write' and 'sf read'
If the offset or the size passed to the 'sf write' or 'sf read' command
exceeds the size of the SPI flash displaying the command usage is not
helpful. Return CMD_RET_FAILURE instead of CMD_RET_USAGE.

Use the CMD_RET_* constants instead of 0, 1, -1.

Simplify a logical expression in the final return statement.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-01-26 21:04:16 +05:30
Simon Glass
4b7cb058df bootstd: Drop the old bootflow_scan_first()
This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:41 -05:00
Simon Glass
91943ff703 bootstd: Allow scanning a single bootdev label
We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:41 -05:00
Simon Glass
18552d2a72 bootstd: Add a hunter for the extension feature
This needs to run before any bootdev is used, so add a hunter for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:41 -05:00
Simon Glass
35ce14617e extension: Refactor to allow non-command usage
The current extension code is designed to be used from commands. We want
to add a boot driver which uses it. To help with this, split the code into
the command processing and a function which actually does the scan.

Really the extension code should be in common/ or use driver model, but
this is a start.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:41 -05:00
Simon Glass
d73420e4fe bootstd: Use hunters when scanning for bootflows
Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:41 -05:00
Simon Glass
d9f48579dc bootstd: Treat DHCP and PXE as bootdev labels
These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:41 -05:00
Simon Glass
7638c85190 bootstd: Include the device tree in the bootflow
Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:40 -05:00
Simon Glass
c8c3fd24cc net: Add a function to run dhcp
At present this must be done by executing the command. Also it involves
fiddling with the environment to determine the correct autoload behaviour.

Ideally it should be possible to run network operations without even
having the command line present (CONFIG_CMDLINE).

For now, add a function to handle DHCP, so it can be called from a bootdev
more easily.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-01-23 18:11:40 -05:00
Simon Glass
c7b63d500d bootstd: Support running bootdev hunters
Add a way to run a bootdev hunter to find bootdevs of a certain type. Add
this to the 'bootdev hunt' command. Test for this are added in a later
patch, since a useful test needs some hunters to work with.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:40 -05:00
Simon Glass
bd90b09288 bootstd: Add the concept of a bootdev hunter
Some bootdevs must be enumerated before they appear. For example, USB
bootdevs are not visible until USB is enumerated.

With standard boot this needs to happen automatically, since we only
want to enumerate a bus if it is needed.

Add a way to define bootdev 'hunters' which can be used to hunt for
bootdevs of a given type. Track which ones have been used and add a
command to list them.

Include a clang work-around which seems to be needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:40 -05:00
Simon Glass
f1779f2cc3 vbe: Avoid a build failure when bloblist is not enabled
This needs to be able to work (at least partially) without the bloblist
active. Add a condition for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:39 -05:00
Simon Glass
3d01254140 dm: core: Support sorting devices with dm tree
Add a -s flag to sort the top-level devices in order of uclass ID.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:39 -05:00
Tom Rini
6e7df1d151 global: Finish CONFIG -> CFG migration
At this point, the remaining places where we have a symbol that is
defined as CONFIG_... are in fairly odd locations. While as much dead
code has been removed as possible, some of these locations are simply
less obvious at first. In other cases, this code is used, but was
defined in such a way as to have been missed by earlier checks.  Perform
a rename of all such remaining symbols to be CFG_... rather than
CONFIG_...

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-20 12:27:24 -05:00
Enric Balletbo i Serra
22e7f1d108 cmd: part: Add partition-related type command
This implements the following command:

    part type mmc 0:1
      -> print partition type UUID
    part type mmc 0:1 uuid
      -> set environment variable to partition type UUID

"part type" can be useful when writing a bootcmd which searches for a
specific partition type to enable automatic discovery of partitions and
their intended usage or mount point.

Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Fix when CONFIG_PARTITION_TYPE_GUID is disabled and have the
command check for "types" before "type"]
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-18 13:10:41 -05:00
Tom Rini
448e2b6327 event: Correct dependencies on the EVENT framework
The event framework is just that, a framework. Enabling it by itself
does nothing, so we shouldn't ask the user about it. Reword (and correct
typos) around this the option and help text. This also applies to
DM_EVENT and EVENT_DYNAMIC. Only EVENT_DEBUG and CMD_EVENT should be
visible to the user to select, when EVENT is selected.

With this, it's time to address the larger problems. When functionality
uses events, typically via EVENT_SPY, the appropriate framework then
must be select'd and NOT imply'd. As the functionality will cease to
work (and so, platforms will fail to boot) this is non-optional and
where select is appropriate. Audit the current users of EVENT_SPY to
have a more fine-grained approach to select'ing the framework where
used. Also ensure the current users of event_register and also select
EVENT_DYNAMIC.

Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reported-by: Oliver Graute <Oliver.Graute@kococonnector.com>
Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Fixes: 7fe32b3442 ("event: Convert arch_cpu_init_dm() to use events")
Fixes: 42fdcebf85 ("event: Convert misc_init_f() to use events")
Fixes: c5ef202557 ("dm: fix DM_EVENT dependencies")
Signed-off-by: Tom Rini <trini@konsulko.com>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-01-18 12:46:13 -05:00
Michal Simek
5c006e7cb3 cmd: event: Remove additional event description
The first name is taken from command name that's why shouldn't be listed in
help. The similar change was also done by commit a84d3b6c56 ("cmd: pwm:
Remove additional pwm description").
Also remove additional spaces in help message.

Before:
event event list   - list event spies

After:
event list   - list event spies

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-18 12:46:13 -05:00
Alexey Romanov
ac7fdbc35d cmd/arm: meson: sm: introduce efusedump command
Using this command user can print efuse memory:

$ sm efusedump 0 10
  00000000: ff 00 31 00 00 ff 66 00 00 00      ..1...f...

Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230110105650.54580-5-avromanov@sberdevices.ru
[narmstrong: added display_options.h include for print_buffer()]
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-01-17 09:26:42 +01:00
Simon Glass
02d929bfb2 bootstd: Support creating a boot menu
Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00
Simon Glass
24d8e1b37b bootstd: Allow reading a logo for the OS
Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00
Simon Glass
2175e76a51 bootstd: Read the Operating System name for distro/scripts
Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00
Simon Glass
0e38bd848d video: Add font functions to the vidconsole API
Support for fonts currently depends on the type of vidconsole in use. Add
two new methods to enumerate fonts and to set the font.

Fix a few other method comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00
Simon Glass
30f3333d88 image: Move common image code to image_board and command
We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list()  so
seems to belong better in the command library. Move and rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00
Simon Glass
858fefd5fc image: Add a function to find a script in an image
Split this functionality out of the 'source' command so it can be used
from another place. For now leave it where it is, but a future patch will
move it out of cmd/

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:24:24 -05:00
Simon Glass
32bab0eae5 menu: Make use of CLI character processing
Avoid duplicating some of the escape-sequence processing here and use the
CLI function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 14:14:11 -05:00
Simon Glass
d0ca98dbd9 menu: Update bootmenu_loop() to return the code
Use the return value to save having to pass around a pointer. This also
resolves any ambiguity about what *key contains when the function is
called.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 14:14:11 -05:00
Simon Glass
5712976b26 menu: Update bootmenu_autoboot_loop() to return the code
Use the return value to save having to pass around a pointer. This also
resolves any ambiguity about what *key contains when the function is
called.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 14:14:11 -05:00
Simon Glass
2da4a15e7e menu: Rename KEY_... to BKEY_...
This enum values conflict with linux/input.h so rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 14:14:11 -05:00
chenzhipeng
c40e021b83 cmd: spi: Judge the number of added parameters
When only sspi is entered, help information can be printed.

Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-12 11:25:17 -05:00
Marek Vasut
721307eba0 cmd: exit: Fix return value propagation out of environment scripts
Make sure the 'exit' command as well as 'exit $val' command exits
from environment scripts immediately and propagates return value
out of those scripts fully. That means the following behavior is
expected:

"
=> setenv foo 'echo bar ; exit 1' ; run foo ; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2' ; run foo ; echo $?
bar
0
"

As well as the followin behavior:

"
=> setenv foo 'echo bar ; exit 3 ; echo fail'; run foo; echo $?
bar
3
=> setenv foo 'echo bar ; exit 1 ; echo fail'; run foo; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -1 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit ; echo fail'; run foo; echo $?
bar
0
"

Fixes: 8c4e3b79bd ("cmd: exit: Fix return value")
Reviewed-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Marek Vasut <marex@denx.de>
2023-01-11 15:02:24 -05:00
Patrick Delaunay
d037990046 fastboot: remove #ifdef CONFIG when it is possible
Much of the fastboot code predates the introduction of Kconfig and
has quite a few #ifdefs in it which is unnecessary now that we can use
IS_ENABLED() et al.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
2023-01-11 15:02:24 -05:00
Shenlin Liang
5b333b9324 cmd: change the return value when argc error
When the number of parameters is wrong, the return value should be processed in
the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 11:54:50 -05:00
Patrick Delaunay
6762c8dd89 cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT
The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
allows the MTDIDS and MTDPARTS to be configured at runtime.

This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
is only used by two platforms (stm32mp and igep00x0) which don't define
CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.

This patch solves an UBI environment load issue for NAND boot for
stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
env_get_f() return a EMPTY string, define in default_environment[]
because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
but a NULL pointer is expected to allow call of board_mtdparts_default.
Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].

It is not a problem when env becomes ready, as these empty variables are
removed form U-Boot environment in env_import() / himport_r().

Fixes: a331017c23 ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-11 11:54:50 -05:00
Alexey Romanov
311106a1c6 arm/mach-meson: move smc commands in cmd/meson
It is incorrect to keep commands in the arch/ folder.

Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230110105650.54580-3-avromanov@sberdevices.ru
[narmstrong: moved after cmd/sound in index.rst]
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-01-10 15:27:17 +01:00
Tom Rini
cebdfc22da Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-09 11:30:08 -05:00
Heinrich Schuchardt
eff4440195 efi_loader: carve out efi_get_memory_map_alloc()
Carve out code from efidebug command used to read the memory map.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-01-06 22:27:30 +01:00
Heinrich Schuchardt
532952f63c cmd: avoid endless loop in sound play command
A parameter starting with a hyphen leads to an endless loop in the sound
play command.

Leave it to dectoul() to handle the hyphen. It will return 0 for a negative
number.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-04 13:17:42 +01:00
Sean Anderson
bcc85b96b5 cmd: source: Support specifying config name
As discussed previously [1,2], the source command is not safe to use with
verified boot unless there is a key with required = "images" (which has its
own problems). This is because if such a key is absent, signatures are
verified but not required. It is assumed that configuration nodes will
provide the signature. Because the source command does not use
configurations to determine the image to source, effectively no
verification takes place.

To address this, allow specifying configuration nodes. We use the same
syntax as the bootm command (helpfully provided for us by fit_parse_conf).
By default, we first try the default config and then the default image. To
force using a config, # must be present in the command (e.g. `source
$loadaddr#my-conf`). For convenience, the config may be omitted, just like
the address may be (e.g. `source \#`). This also works for images
(`source :` behaves exactly like `source` currently does).

[1] https://lore.kernel.org/u-boot/7d711133-d513-5bcb-52f2-a9dbaa9eeded@prevas.dk/
[2] https://lore.kernel.org/u-boot/042dcb34-f85f-351e-1b0e-513f89005fdd@gmail.com/

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-31 13:35:19 -05:00
Sean Anderson
c4f5738e69 cmd: source: Clean up a few lines
This simplifies a few lines and corrects an error message.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-31 13:35:19 -05:00