Commit graph

1941 commits

Author SHA1 Message Date
Masahisa Kojima
1167e88ab8 eficonfig: fix missing variable initialization
The 'ret' variable must be initialized before use
in eficonfig_delete_invalid_boot_option().

Fixes: c416f1c0bc ("bootmenu: add removable media entries")
Addresses-Coverity: 376207 ("Uninitialized variables")
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-11-16 08:34:06 +01:00
Heinrich Schuchardt
3d595ac5f5 cmd: remove superfluous if in eficonfig_edit_boot_option
Goto for an immediately succeeding label is superfluous.

Fixes: 87d791423a ("eficonfig: menu-driven addition of UEFI boot option")
Addresses-Coverity: 376202 ("Identical code for different branches")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-11-16 08:34:06 +01:00
Tom Rini
6cc04547cb global: Migrate CONFIG_SYS_FSL* symbols to the CFG_SYS namespace
Migrate all of COFIG_SYS_FSL* to the CFG_SYS namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-10 10:08:55 -05:00
Tom Rini
2c8d04dd17 Convert CONFIG_SYS_LOADS_BAUD_CHANGE et al to Kconfig
This converts the following to Kconfig:
   CONFIG_SYS_LOADS_BAUD_CHANGE
   CONFIG_LOADS_ECHO

As part of this, we move CMD_SAVES to be after CMD_LOADS as they are
logically related (load or save an s-record format file) and this makes
grouping of CONFIG_SYS_LOADS_BAUD_CHANGE easier.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-10 09:45:54 -05:00
Simon Glass
952018117a dm: sandbox: Switch over to using the new host uclass
Update the sandbox implementation to use UCLASS_HOST and adjust all
the pieces to continue to work:

- Update the 'host' command to use the new API
- Replace various uses of UCLASS_ROOT with UCLASS_HOST
- Disable test_eficonfig since it doesn't work (this should have a unit
  test to allow this to be debugged)
- Update the blk test to use the new API
- Drop the old header file

Unfortunately it does not seem to be possible to split this change up
further.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-07 16:24:30 -07:00
Simon Glass
ff1f0e414a dm: sandbox: Drop non-BLK code from host implementation
This is not used anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-07 16:24:30 -07:00
Baruch Siach
aa59c1bec7 cmd: eeprom: don't truncate target address at 32-bit
On 64-bit platforms where int is 32-bit wide, the eeprom command
parse_numeric_param() routine truncates the memory address parameter to
the lower 32-bit. Make parse_numeric_param() return long to allow
read/write of addresses beyond the lower 4GB.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-11-02 13:58:17 -04:00
Rasmus Villemoes
2896839483 cyclic: switch to using hlist instead of list
A hlist is headed by just a single pointer, so can only be traversed
forwards, and insertions can only happen at the head (or before/after
an existing list member). But each list node still consists of two
pointers, so arbitrary elements can still be removed in O(1).

This is precisely what we need for the cyclic_list - we never need to
traverse it backwards, and the order the callbacks appear in the list
should really not matter.

One advantage, and the main reason for doing this switch, is that an
empty list is represented by a NULL head pointer, so unlike a
list_head, it does not need separate C code to initialize - a
memset(,0,) of the containing structure is sufficient.

This is mostly mechanical:

- The iterators are updated with an h prefix, and the type of the
  temporary variable changed to struct hlist_node*.

- Adding/removing is now just hlist_add_head (and not tail) and
  hlist_del().

- struct members and function return values updated.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*
2022-11-02 08:41:55 +01:00
Sughosh Ganu
e68c03be46 FWU: cmd: Add a command to read FWU metadata
Add a command to read the metadata as specified in the FWU
specification and print the fields of the metadata.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-10-31 14:47:33 -04:00
Simon Glass
7f3470bfaa vbe: Add a command to show the VBE state
Add a VBE comment which shows the current state. Currently this is just
the phases which booted via VBE.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:04:00 -04:00
Simon Glass
984639039f Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE
The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:01:31 -04:00
Tom Rini
218e2c45af - fix [hv]sync active vs back porch in dw_mipi_dsi
- simplefb rotation support
  - support splash as raw image from MMC
  - enhancements to Truetype console (multiple fonts and sizes)
  - drop old LCD support
 -----BEGIN PGP SIGNATURE-----
 
 iGwEABECACwWIQSC4hxrSoIUVfFO0kRM6ATMmsalXAUCY17nfA4cYWd1c3RAZGVu
 eC5kZQAKCRBM6ATMmsalXPPoAJ0UYyt3kwslUlAJhOC+KU9UlYnVuwCbBXIQyBua
 K5clq+GyxXfaDl2Hnvc=
 =XXVp
 -----END PGP SIGNATURE-----

Merge tag 'video-20221030' of https://source.denx.de/u-boot/custodians/u-boot-video

 - fix [hv]sync active vs back porch in dw_mipi_dsi
 - simplefb rotation support
 - support splash as raw image from MMC
 - enhancements to Truetype console (multiple fonts and sizes)
 - drop old LCD support
2022-10-30 17:16:35 -04:00
Simon Glass
b86986c7b3 video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO
Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:17 +01:00
Simon Glass
8b1129588c video: Drop CONFIG_LCD
This option is not used anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:17 +01:00
Simon Glass
d32eb92e91 video: Drop CONFIG_VIDEO
This option is not used anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:17 +01:00
Simon Glass
0f9b86f811 video: Drop remaining references to CONFIG_LCD
These rely on the old LCD implementation which is to be removed. Drop it
all.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:17 +01:00
Simon Glass
f9b7bd7e91 video: cmd: Drop old LCD code
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:17 +01:00
Simon Glass
f24404d85f video: Move bmp_display() prototype to video.h
The lcd.h header is about to be deleted, so move this prototype.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:16 +01:00
Simon Glass
e655003384 video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE
This option should not have the SYS_ in it. Drop it so it fits in with the
other video options.

Also simplify the alignment code in gunzip_bmp(), since malloc() always
returns a 32-bit-aligned pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:16 +01:00
Simon Glass
988d19dd5b video: Split SPLASH_SCREEN_ALIGN from bmp command
The bmp command already has a way to centre the image. Using this CONFIG
option to also centre it makes it impossible to control where images are
placed on the screen. Drop the extra check.

Simplify the Kconfig file we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:16 +01:00
Simon Glass
430e1676a7 video: Add commands to list and change fonts
Add a new 'font' command which allows the fonts to be listed as well as
selecting a different font and size.

Allow the test to run on sandbox, where multiple font/size combinations
are supported, as well as sandbox_flattree, where they are not.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
3f425f9ca7 video: Enable the cls command by default
This is enabled for LCD but not for VIDEO. Enable it since it is useful
to be able to clear the screen and adds very little code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
f029f90e7d video: Move the console commands to cmd/
Move these commands and the implementation to the cmd/ directory, which is
where most commands are kept.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
[agust: keep vidconsole_position_cursor() in vidconsole uclass]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2022-10-30 19:55:22 +01:00
Michal Suchanek
4954937d92 dm: treewide: Do not use the return value of simple uclass iterator
uclass_first_device/uclass_next_device return value will be removed,
don't use it.

With the current implementation dev is equivalent to !ret. It is
redundant to check both, ret check can be replaced with dev check, and
ret check inside the iteration is dead code.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Tom Rini
f9d16f2c0d Merge https://source.denx.de/u-boot/custodians/u-boot-spi
- Add s28hl512t, s28hl01gt (Takahiro)
- Rework s25hx_t_post_bfpt_fixup() (Takahiro)
2022-10-25 09:54:59 -04:00
Marek Vasut
622b5d3561 cmd: sf: Handle unaligned 'update' start offset
Currently the 'sf update' command fails in case the 'start' offset is
not aligned to SPI NOR erase block size. Add the missing alignment
calculation. In case the start offset is in the middle of erase block,
round start address down to the nearest aligned one, compare only the
updated data between what is in the SPI NOR and what is being written,
copy new data at offset of the compare buffer, and write back the entire
erase block.

This is useful e.g. on i.MX6Q where the u-boot-with-spl.imx is at
offset 0x400 in the SPI NOR, while the SPI NOR may have erase block
size e.g. 0x1000 bytes.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2022-10-25 10:17:33 +05:30
Mattijs Korpershoek
64a11fb8c9 cmd: bcb: select user(0) hwpart in __bcb_load()
For some blk operations, it's possible that a different hw partition
gets selected via blk_dselect_hwpart().
In that case, only the region of the device covered by that partition
is accessible.

This breaks "bcb load" which attempts to read the gpt and assumes it's
on the user(0) hw partition:

=> bcb load 2 misc
GUID Partition Table Header signature is wrong: 0xDE7B17AD07D9E5D6 != 0x5452415020494645
find_valid_gpt: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
find_valid_gpt: *** ERROR: Invalid Backup GPT ***
Error: mmc 2:misc read failed (-2)

Add a fail-safe in __bcb_load() to ensure we will always read from the
user(0) hwpartition.

This fixes the following fastboot sequence:

$ fastboot erase mmc2boot1    # switch to hwpart1
$ fastboot reboot bootloader  # switch to hwpart0, then reads GPT

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2022-10-21 21:37:47 -04:00
Andre Przywara
2f6c45eb68 qfw: return failure when no kernel could be loaded
When we try to load a kernel via the QEMU firmware device, we currently
"return -1;" if no kernel was specified on the QEMU command line. This
leads to the usage output, which is confusing (since nothing on the
command line was really wrong), but also somewhat hides the actual error
message.

Return CMD_RET_FAILURE (1), as it's a proper error, and make the message
more clear that this is not only a "warning".

This helps to call this command in boot scripts, and to gracefully
continue if this doesn't work.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-10-21 16:06:14 -04:00
Andre Przywara
163fb37669 qfw: store loaded file size in environment variable
At the moment the QEMU firmware command just prints the size of the
loaded binaries on the console.
To go with all the other load methods, and many boot scripts'
expectations, also store the size of the file loaded last in the
environment variable "filesize".
We first put the kernel size in there, but overwrite this with the
initrd size, should we have one, because this is probably the more
prominent user of $filesize (in the booti or bootz command).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-10-21 16:06:13 -04:00
Samuel Mendoza-Jonas
4b290d4a75 cmd: Add ncsi command
Adds an "ncsi" command to manually start NC-SI configuration.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
2022-10-21 16:04:39 -04:00
Tom Rini
d843273a80 Merge https://source.denx.de/u-boot/custodians/u-boot-riscv 2022-10-20 09:11:08 -04:00
Tom Rini
73ceadcd72 Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Beside some rather unexciting sync of the DTs from the kernel tree, and
some Kconfig cleanup, there are some improvements for the ARMv5 Allwinner
family, to support boards with the F1C200s (64MB DRAM) better. We will
get actual board support as soon as the DTs have passed the Linux review
process.
There is also support for the X96 Mate TV Box, featuring the H616 SoC and
a full 4GB of DRAM.
Also we found the secret to enable SPI booting on the H616 (pin PC5 must
be pulled to GND), so the SPI boot support patch is now good to go.

Passed the gitlab CI, plus briefly tested on Pine64-LTS, LicheePi Nano,
X96 Mate and OrangePi Zero.
2022-10-20 08:58:05 -04:00
Heinrich Schuchardt
f22db44c1b cmd/sbi: user friendly short texts
In the sbi command use the same short texts for the legacy extensions
as the SBI specification 1.0.0.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2022-10-20 15:22:15 +08:00
Heinrich Schuchardt
72c1f5f282 cmd/sbi: error message for failure to get spec version
If calling 'Get SBI specification version' fails, write an error message
and return CMD_RET_FAILURE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2022-10-20 15:22:15 +08:00
Heinrich Schuchardt
9487764e7e cmd/sbi: format RustSBI version number
The SBI command can print out the version number of the SBI implementation.
Choose the correct output format for RustSBI.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2022-10-20 15:22:15 +08:00
Andre Przywara
177040b1eb sunxi: Kconfig: use SoC-wide values for some symbols
Some configuration symbols formerly defined in header files were
recently converted to Kconfig symbols. This moved their value definition
into *every* defconfig file, even though those values are hardly board
choices.
Use the new Kconfig option to define per-SoC default values, in just one
place, which makes the definition in each defconfig file redundant.

We refrain from setting a sunxi specific value for CONFIG_SYS_BOOTM_LEN,
so this defaults to a much better 64MB for uncompressed arm64 kernels.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2022-10-18 08:18:30 +01:00
Simon Glass
baf4141079 fdt: Show a message when the working FDT changes
The working FDT is the one which comes from the OS and is fixed up by
U-Boot. When the bootm command runs, it sets up the working FDT to be the
one it is about to pass to the OS, so that fixups can happen.

This seems like an important step, so add a message indicating that the
working FDT has changed. This is shown during the running of the bootm
command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17 21:17:12 -06:00
Simon Glass
2c0b61d562 bootm: Drop #ifdef from do_bootm()
Drop the #ifdefs from this command by using a variable to hold the states
that should be executed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17 21:17:12 -06:00
Simon Glass
f06443f9d5 bootm: Avoid returning error codes from command
Functions which implement commands must return a CMD_RET_... error code.
At present bootm can return a negative errno value in some cases, thus
causing strange behaviour such as trying to exit the shell and printing
usage information.

Fix this by returning the correct value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17 21:17:12 -06:00
Michal Suchanek
8676ae36ae cmd: List all uclass devices regardless of probe error
There are a few commands that iterate uclass with
uclass_first_device/uclass_next_device or the _err variant.

Use the _check class iterator variant to get devices that fail to probe
as well, and print the status.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-17 21:17:12 -06:00
Ilias Apalodimas
70089c13a7 efi_loader: remove efi_delete_handle on loadfile2
Loadfile2 code is installing two protocols on it's own handle
and uses efi_delete_handle() to clean it up on failure(s). However
commit 05c4c9e21a ("efi_loader: define internal implementations of
install/uninstallmultiple") prepares the ground for us to clean up
efi_delete_handle() used in favor of Install/UninstallMultipleProtocol.

While at it clean up the non needed void casts to (void *) on the
protolcol installation.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-16 12:23:22 +02:00
Heinrich Schuchardt
f4d52c4159 cmd: simplify efidebug
* don't use EFI_CALL() for variable services
* don't use runtime pointer to access exported function

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-16 12:23:22 +02:00
Pali Rohár
6de1daf64b cmd: ubi: Add 'ubi list' command for printing list of all UBI volumes
To allow easily iterate over all UBI volumes, add a new command which
either print all user UBI volumes on output or set them into env variable.

As UBI volumes can have arbitrary name/label, in most cases it is useful to
iterate them by their numbers. This can be achieved by -numeric flag.

This functionality is similar to already existing 'part list' command which
prints partitions on formatted block device.

Signed-off-by: Pali Rohár <pali@kernel.org>
2022-10-12 08:55:31 -04:00
Robert Marko
7f673bb8f5 cmd: add temperature command
Currently, there is no way for users to check the readings from thermal
sensors from U-boot console, only some boards print it during boot.

So, lets add a simple "temperature" command that allows listing thermal
uclass devices and getting their value.

Note that the thermal devices are intenionally probed if list is used as
almost always they will not get probed otherwise and there is no way for
users to manually call probe on a certain device from console.

Assumption is made that temperature is returned in degrees C and not
milidegrees like in Linux as this is what most drivers seem to return.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-11 15:40:48 -04:00
Roger Knecht
23c0df6e7c cmd: xxd: add new command
Add xxd command to print file content as hexdump to standard out

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Roger Knecht <rknecht@pm.me>
2022-10-11 15:40:48 -04:00
Roger Knecht
690a1d6948 cmd: cat: add new command
Add cat command to print file content to standard out

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Roger Knecht <rknecht@pm.me>
2022-10-11 15:40:48 -04:00
Tom Rini
c4c32e3596 Merge https://source.denx.de/u-boot/custodians/u-boot-usb 2022-10-10 15:38:14 -04:00
Mattijs Korpershoek
5f7e01e9d5 usb: gadget: fastboot: detach usb on reboot commands
When host issues "fastboot reboot fastboot", it's expected that the
board drops the USB connection before resetting.

On some boards, such as Khadas VIM3L and SEI610, this is not the case.

We observe the following error:
$ fastboot reboot fastboot
Rebooting into fastboot                            OKAY [  0.004s]
fastboot: error: Failed to boot into userspace fastboot; one or more components might be unbootable.

This does not happen when we use the RST button on the board.
It can be reproduced in linux with:
  # echo b > /proc/sysrq-trigger

In this case, we hit a undefined hardware behavior, where D+ and D-
are in an unknown state. Therefore the host can't detect usb
disconnection.

Make sure we always call usb_gadget_release() when a "fastboot reboot"
command is issued.

Note: usb_gadget_release() should be called before g_dnl_unregister()
because g_dnl_unregister() triggers a complete() call on each
endpoint (thus calling do_reset()).

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2022-10-10 18:08:18 +02:00
Heinrich Schuchardt
c6db606dbb cmd: CMD_CLS should not depend on video
The cls command works fine on the serial console. There is no reason to
let it depend on the availability of video.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-10 16:34:25 +02:00
Ilias Apalodimas
a75e8355ea cmd: replace efi_create_handle/add_protocol with InstallMultipleProtocol
In general handles should only be deleted if the last remaining protocol
is removed.  Instead of explicitly calling
efi_create_handle -> efi_add_protocol -> efi_delete_handle which blindly
removes all protocols from a handle before removing it,  use
InstallMultiple/UninstallMultiple which adheres to the EFI spec and only
deletes a handle if there are no additional protocols present

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-10-06 22:54:58 +02:00