]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
2 years agobinman: Remove obsolete compressed data header handling
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:27 +0000 (16:25 +0200)]
binman: Remove obsolete compressed data header handling

Remove the obsolete compressed data header handling from the utilities
to compress and decompress data. The header is uncommon, not supported
by U-Boot and incompatible with external compressed artifacts.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Disable compressed data header
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:26 +0000 (16:25 +0200)]
binman: Disable compressed data header

Disable the compressed data header of the utilities to compress and
decompress data. The header is uncommon, not supported by U-Boot and
incompatible with external compressed artifacts.

The header was introduced as part of commit eb0f4a4cb402 ("binman:
Support replacing data in a cbfs") to allow device tree entries to be
larger than the compressed contents.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add length header attribute to dtb entry
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:25 +0000 (16:25 +0200)]
binman: Add length header attribute to dtb entry

Add an optional length header attribute to the device tree blob entry
class based on the compressed data header from the utilities to compress
and decompress data.

If needed the header could be enabled with the following
attribute beside the compress attribute:
  prepend = "length";

The header was introduced as part of commit eb0f4a4cb402 ("binman:
Support replacing data in a cbfs") to allow device tree entries to be
larger than the compressed contents. Regarding the commit "this is
necessary to cope with a compressed device tree being updated in such a
way that it shrinks after the entry size is already set (an obscure
case)". This case need to be fixed without influence any compressed data
by itself.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add DecompressData function to entry class
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:24 +0000 (16:25 +0200)]
binman: Add DecompressData function to entry class

Add a DecompressData function to entry class to allow override in child
classes and to centralize the compress and decompress in a single class.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Check only section data in multi section test
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:23 +0000 (16:25 +0200)]
binman: Check only section data in multi section test

Check only section data instead of the rest of the image in multi
section test.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Collect bintools before usage
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:22 +0000 (16:25 +0200)]
binman: Collect bintools before usage

Collect and thereby initialize bintools before any usage but after
generation of entries. This is needed to handle bintools for compress
and decompress like other bintools.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Forward AddBintools calls to base class
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:21 +0000 (16:25 +0200)]
binman: Forward AddBintools calls to base class

Forward AddBintools calls to base class to collect bintools of base
class.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Forward AddBintools calls to sub entries in cbfs_util
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:20 +0000 (16:25 +0200)]
binman: Forward AddBintools calls to sub entries in cbfs_util

Forward AddBintools calls to sub entries in cbfs_util to collect
bintools of sub entries.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Avoid duplicates in bintool lists
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:19 +0000 (16:25 +0200)]
binman: Avoid duplicates in bintool lists

Avoid duplicate entries in the list of bintools used by the image and
the list of missing bintools.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Skip elf tests if python elftools is not available
Stefan Herbrechtsmeier [Fri, 19 Aug 2022 14:25:18 +0000 (16:25 +0200)]
binman: Skip elf tests if python elftools is not available

Skip tests which requires python elftools if the tool is not available.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Allow collection to use entries from other sections
Simon Glass [Sat, 13 Aug 2022 17:40:50 +0000 (11:40 -0600)]
binman: Allow collection to use entries from other sections

At present the collections etype only works with entries in the same
section. This can be limiting, since in some cases the data may be inside
a subsection, e.g. if there are alignment constraints.

Add a function to find the entries in an etype and have it search
recursively. Make use of this for mkimage also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Allow passing entries using -n
Simon Glass [Sat, 13 Aug 2022 17:40:49 +0000 (11:40 -0600)]
binman: Allow passing entries using -n

Also control over what goes in the file passed with -n using a separate
imagename subnode. This can include a section or any other entry type.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Allow the image name to be the data file
Simon Glass [Sat, 13 Aug 2022 17:40:48 +0000 (11:40 -0600)]
binman: Allow the image name to be the data file

Some image types use the -n parameter to pass in the data file. Add
support for this, with a new property.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Improve mkimage documentation
Simon Glass [Sat, 13 Aug 2022 17:40:47 +0000 (11:40 -0600)]
binman: Improve mkimage documentation

Expand this a little to make things clearer. Also drop the invalid
entry arg.

Series-changes 2
- Make it clear that -d data is concatenated/collected by binman
- Fix mulitple typoe
- Reword a sentence for grammar

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Avoid use of expected failure
Simon Glass [Sat, 13 Aug 2022 17:40:46 +0000 (11:40 -0600)]
binman: Avoid use of expected failure

The testReplaceSectionSimple() test is the only one which expects failure.
It looks odd in the output and takes time to glance at it to see that all
is in fact well. Also it does not check that the right exception is
generated.

Use the more common (in binman) approach of checking for an exception.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Adjust mkimage etype node reading
Simon Glass [Sat, 13 Aug 2022 17:40:45 +0000 (11:40 -0600)]
binman: Adjust mkimage etype node reading

Since this is implemented as a section, it should really be split into
several functions, one to read the node and one to read the entries. Do
this so that it matches how Entry_section works.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add a way to check for missing properties
Simon Glass [Sat, 13 Aug 2022 17:40:44 +0000 (11:40 -0600)]
binman: Add a way to check for missing properties

Some new entries are likely to have required properties. Support this in a
standard way, with a list of required properties which can be set up by
base classes. Check for missing properties when the entry is read.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Fix up the entry-docs for Entry_pre_load
Simon Glass [Sat, 13 Aug 2022 17:40:43 +0000 (11:40 -0600)]
binman: Fix up the entry-docs for Entry_pre_load

This has got out of sync and needs a line wrap. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Don't buffer test output with a single test
Simon Glass [Sat, 13 Aug 2022 17:40:42 +0000 (11:40 -0600)]
patman: Don't buffer test output with a single test

When a single test is run we don't need to buffer the test output. This
has the unfortunate side effect of suppressing test output, in particular
the binman output directory normally printed with the -X option. This is
a huge problem since it blocks debugging of tests.

We don't actually know how many tests will be run when we set up the
suite, so as a work-around, assume that test_name being specified
indicates that there is likely only one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Put the coverage command-line last
Simon Glass [Sat, 13 Aug 2022 17:40:41 +0000 (11:40 -0600)]
patman: Put the coverage command-line last

Put this at the end so it is easier to copy it from the terminal.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstage: Show func name for bootstage_mark/error
Michal Simek [Fri, 12 Aug 2022 08:54:51 +0000 (10:54 +0200)]
bootstage: Show func name for bootstage_mark/error

bootstage_mark() and bootstate_error() are not recording any name and in
report it is showing as id=<value>. That's not useful and it is better to
show function name which calls it.
That's why use macros with passing __func__ as recorded name for bootstage.

Origin report looks like this:
ZynqMP> bootstage report
Timer summary in microseconds (10 records):
       Mark    Elapsed  Stage
          0          0  reset
  2,482,383  2,482,383  board_init_f
  4,278,821  1,796,438  board_init_r
  4,825,331    546,510  id=64
  4,858,409     33,078  id=65
  4,862,382      3,973  main_loop
  4,921,713     59,331  usb_start
  9,345,345  4,423,632  id=175

When this patch is applied.
ZynqMP> bootstage report
Timer summary in microseconds (31 records):
       Mark    Elapsed  Stage
          0          0  reset
  2,465,624  2,465,624  board_init_f
  4,278,628  1,813,004  board_init_r
  4,825,139    546,511  eth_common_init
  4,858,228     33,089  eth_initialize
  4,862,201      3,973  main_loop
  4,921,530     59,329  usb_start
  8,885,334  3,963,804  cli_loop

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agolog: Drop log_nop() functions
Simon Glass [Wed, 17 Mar 2021 18:18:37 +0000 (07:18 +1300)]
log: Drop log_nop() functions

These functions are not needed anymore since we now have logic which can
output to the console if logging is disabled. Drop the declarations.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Put fake files in a subdirectory
Simon Glass [Sun, 7 Aug 2022 15:46:46 +0000 (09:46 -0600)]
binman: Put fake files in a subdirectory

At present fake files from a previous build appear to be real files for
a subsequent build, since they sit in the output directory.

This can cause problems, since binman may need to parse the file, e.g.
with the Intel description.bin files.

Fix this by putting them in a 'binman-fake' subdirectory. Keep a track
of the fake filename so we only create it once. Subsequent builds will
still see that the file is missing and mark it as fake.

Update a few tests to check the behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-08-20-assorted-updates'
Tom Rini [Sat, 20 Aug 2022 23:00:10 +0000 (19:00 -0400)]
Merge branch '2022-08-20-assorted-updates'

- Assorted updates including some updates to the rx_51 platform

2 years agogpio: aspeed: port Linux dt-bindings header file
Dhananjay Phadke [Thu, 4 Aug 2022 15:58:54 +0000 (08:58 -0700)]
gpio: aspeed: port Linux dt-bindings header file

Makes it easier to add readable GPIO definitions in DTS files
for Aspeed SOC based boards.

Ported with small edits to add IBM copyright statement and fix
for checkpatch warning.

Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Reviewed-by: Billy Tsai <billy_tsai@aspeedtech.com>
Acked-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agohwconfig: Allow to use restricted env
Pali Rohár [Sun, 7 Aug 2022 19:06:04 +0000 (21:06 +0200)]
hwconfig: Allow to use restricted env

During early boot phase GD_FLG_ENV_READY is not set but env_get() may work
when env is ready in restricted mode. Do not fail with error message
"WARNING: Calling __hwconfig without a buffer and before environment is ready"
when env is already working by checking for ENV_VALID flag.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: k3: Correct an awk warning
Simon Glass [Sun, 7 Aug 2022 13:12:19 +0000 (07:12 -0600)]
arm: k3: Correct an awk warning

The k3_gen_x509_cert.sh script produced this warning on gitlab and also
on my machine, e.g. with j7200_evm_r5:

awk: cmd. line:1: warning: regexp escape sequence `\ ' is not a known
   regexp operator

There is no need to escape spaces, so drop the backslashes. Also split
the line so it is a more reasonable length.

This script should really be deleted and binman used instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoarm64: explicitly disable pointer authentication instructions
Rasmus Villemoes [Mon, 8 Aug 2022 14:12:30 +0000 (16:12 +0200)]
arm64: explicitly disable pointer authentication instructions

The Yocto project builds their aarch64 cross-compiler with the
configure knob --enable-standard-branch-protection, which means that
their gcc behaves as if -mbranch-protection=standard is passed; the
default (lacking that configure knob) is -mbranch-protection=none.

This means that when building U-Boot using the Yocto toolchain, most
functions end up containing paciasp/autiasp/bti instructions. However,
since U-Boot is not an ordinary userspace application, there's no OS
kernel which has set up the required authentication keys, so these
instructions do nothing at all (even on arm64 hardware that does have
the pointer authentication capability). They do however make the image
larger.

It is theoretically possible for U-Boot to make use of the pointer
authentication protection - cf. the linux kernel's
CONFIG_ARM64_PTR_AUTH_KERNEL - but it is far from trivial, and it's
hard to see just what threat model it would protect against in a
bootloader context. Regardless, we certainly have none of the required
infrastructure now, so explicitly pass -mbranch-protection=none to
ensure those useless instructions do not get emitted.

For a toolchain not configured with
--enable-standard-branch-protection, this changes nothing. For the
Yocto toolchain, this reduces the size of both SPL and U-Boot proper
by about 3% for my imx8mp target.

If you don't have a Yocto toolchain, the effect can easily be
reproduced by applying this patch and changing =none to =standard.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoRestore pcm051_rev3_defconfig config
Matwey V. Kornilov [Thu, 11 Aug 2022 14:18:12 +0000 (17:18 +0300)]
Restore pcm051_rev3_defconfig config

pcm051_rev3_defconfig config (Phytec Wega board) has been dropped in

    64efd11d ("arm: Remove pcm051 board")

due to expired migration deadlines. Here, pcm051_rev3_defconfig support is
reintroduced.

Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoNokia RX-51: Move board required options from defconfig to Kconfig
Pali Rohár [Thu, 11 Aug 2022 20:27:25 +0000 (22:27 +0200)]
Nokia RX-51: Move board required options from defconfig to Kconfig

Some of config options are board specific and should be set in into their
default values automatically. So move them from defconfig file to Kconfig
definitions to ensure that possible user custom defconfig files would have
these required options also enabled.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Simplify calculation of attached kernel image address
Pali Rohár [Thu, 11 Aug 2022 20:27:24 +0000 (22:27 +0200)]
Nokia RX-51: Simplify calculation of attached kernel image address

Now when board starup code does not copy image to CONFIG_SYS_TEXT_BASE
address there is no need to calculate all addresses from base address at
runtime. The only address which needs to be calculated is attached kernel
image address which can be simplified at compile time without need to know
CONFIG_SYS_TEXT_BASE address or relocation address at the runtime.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Simplify copy kernel code
Pali Rohár [Thu, 11 Aug 2022 20:27:23 +0000 (22:27 +0200)]
Nokia RX-51: Simplify copy kernel code

Expression (r + (r0 - r1)) produce same result as (r - (r1 - r0)). So it
does not matter which one is called. Always call the first option and
remove second one.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Use U-Boot generic position independent code
Pali Rohár [Thu, 11 Aug 2022 20:27:22 +0000 (22:27 +0200)]
Nokia RX-51: Use U-Boot generic position independent code

Switch from custom board specific fixup/copy code to U-Boot generic
position independent code provided by config option POSITION_INDEPENDENT.

This also slightly decrease size of u-boot.bin binary (by 52 bytes). Note
that option POSITION_INDEPENDENT increase size but not more than custom
board fixup/copy code which is being deleted (as it is not needed anymore).

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Fix invalidating zImage kernel format
Pali Rohár [Thu, 11 Aug 2022 20:27:21 +0000 (22:27 +0200)]
Nokia RX-51: Fix invalidating zImage kernel format

Prior starting copy of kernel image to target location, invalidate also
zImage magic header. This ensures that on target location would be image
with valid header only in the case valid header was also in the source
location and copy from source to target finished successfully. Copy is
always skipped when kernel image in source location is invalid.

Add also comment to the code which explain what is the code doing.

Fixes: cc434fccba4c ("Nokia RX-51: Add support for booting kernel in zImage format")
Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: Set default MACH_TYPE in Kconfig
Pali Rohár [Thu, 11 Aug 2022 20:29:03 +0000 (22:29 +0200)]
arm: Set default MACH_TYPE in Kconfig

For boards which requires correct MACH_TYPE, set their correct default
values directly in Kconfig.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoMAINTAINERS: Update email of Neil Armstrong
Neil Armstrong [Tue, 16 Aug 2022 09:58:08 +0000 (11:58 +0200)]
MAINTAINERS: Update email of Neil Armstrong

My professional e-mail will change and the BayLibre one will
bounce after mid-september of 2022.

This updates the MAINTAINERS files and adds an entry in the
.mailmap file.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 years agoMerge tag 'efi-2022-10-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 20 Aug 2022 17:26:17 +0000 (13:26 -0400)]
Merge tag 'efi-2022-10-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-10-rc3-2

Documentation:

* improve description of device probing
* describe booting RISC-V with KVM and QEMU

UEFI

* fix Makefile for mkeficapsule

2 years agotools: mkeficapsule: use pkg-config for each lib separat
Heiko Thiery [Sat, 6 Aug 2022 11:22:53 +0000 (13:22 +0200)]
tools: mkeficapsule: use pkg-config for each lib separat

Call pkg-config for each library individually.
This improves fallback handling.

Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: 31a7688cbe0e ("tools: mkeficapsule: use pkg-config to get -luuid and -lgnutls")
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: disk: remove unused field
AKASHI Takahiro [Fri, 19 Aug 2022 00:48:30 +0000 (09:48 +0900)]
efi_loader: disk: remove unused field

The field, ifname, in efi_disk_obj is set but never used anywhere.
Just remove it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: dm: clarify activation.
Michal Suchanek [Thu, 4 Aug 2022 17:57:45 +0000 (19:57 +0200)]
doc: dm: clarify activation.

Explain when devices should get activated.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: qemu-riscv: describe booting with QEMU and KVM
Heinrich Schuchardt [Sun, 14 Aug 2022 14:13:49 +0000 (16:13 +0200)]
doc: qemu-riscv: describe booting with QEMU and KVM

The ELF U-Boot image produced by qemu-riscv64_smode_defconfig can be
used to boot with QEMU and KVM.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoMerge tag 'fsl-qoriq-2022-8-17' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 17 Aug 2022 16:10:34 +0000 (12:10 -0400)]
Merge tag 'fsl-qoriq-2022-8-17' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq

Enable SPL authentication for ls1021atwr
Fdt fixups for ls1043ardb v7.0 board

2 years agoboard: ls1043ardb: fdt fixups for revision v7.0 boards
Camelia Groza [Thu, 28 Jul 2022 14:28:11 +0000 (17:28 +0300)]
board: ls1043ardb: fdt fixups for revision v7.0 boards

The LS1043ARDB rev v7.0 board replaces the AQR105 PHY on MAC9 with an
AQR113C PHY. The address of the PHY on the MDIO bus changes from 0x1 to
0x8. Enable CONFIG_OF_BOARD_FIXUP and update both u-boot and Linux device
trees to reflect this change.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2 years agols1021atwr: caam: Enable Uboot validaion in SPL.
Gaurav Jain [Thu, 23 Jun 2022 11:01:35 +0000 (16:31 +0530)]
ls1021atwr: caam: Enable Uboot validaion in SPL.

caam driver model enabled in spl for secure boot.
fsl_rsa_mod_exp driver enabled in spl for validating uboot image.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
2 years agoMerge tag 'efi-2022-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 13 Aug 2022 11:37:48 +0000 (07:37 -0400)]
Merge tag 'efi-2022-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-10-rc3

Documentation:

* Add HTML documentation for patman
* Improve binman documentation
* Man-page for gpio

UEFI:

* move udevice pointer into struct efi_object
* fix efi_convert_device_path_to_text()

Other:

* fs/erofs: silence messages from  erofs_probe()

2 years agocmd: efidebug: Add missing \n at the end of message
Michal Simek [Tue, 9 Aug 2022 14:31:12 +0000 (16:31 +0200)]
cmd: efidebug: Add missing \n at the end of message

Currently message is not intended that prompt end up at the end of debug
line. For example like this:

DFU alt info setting: done
DFU entities configuration failed!
(partition table does not match dfu_alt_info?)
Firmware update failed: <NULL>
Cannot handle a capsule at 10000000Zynq>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: move udevice pointer into struct efi_object
Masahisa Kojima [Fri, 22 Jul 2022 02:39:10 +0000 (11:39 +0900)]
efi_loader: move udevice pointer into struct efi_object

This is a preparation patch to provide the unified method
to access udevice pointer associated with the EFI handle
by adding udevice pointer into struct efi_object.
The patch also introduces a helper function efi_link_dev()
to link the udevice and EFI handle.

The EFI handles of both EFI block io driver implemented in
lib/efi_loader/efi_disk.c and EFI block io driver implemented
as EFI payload can access the udevice pointer in the struct efi_object.
We can use this udevice pointer to get the U-Boot friendly
block device name(e.g. mmc 0:1, nvme 0:1) through EFI handle.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: fix efi_convert_device_path_to_text()
Heinrich Schuchardt [Tue, 26 Jul 2022 05:45:18 +0000 (07:45 +0200)]
efi_loader: fix efi_convert_device_path_to_text()

Ensure that the string we convert to UTF-16 is NUL terminated even
if the device path only contains end nodes.

Fixes: bd3d75bb0c58 ("efi_loader: multi part device paths to text")
Addresses-Coverity: 350434 ("Uninitialized scalar variable")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agobinman: Add more documentation about binman usage
Simon Glass [Sun, 7 Aug 2022 22:33:26 +0000 (16:33 -0600)]
binman: Add more documentation about binman usage

This is an attempt to answer the comments provided by Xavier [1].

[1] https://lore.kernel.org/all/Yulcol7HpTHtjXTX@begut/

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agobinman: Add rST references for binman entry types
Simon Glass [Sun, 7 Aug 2022 22:33:25 +0000 (16:33 -0600)]
binman: Add rST references for binman entry types

Add references in the documentation for each entry type, so we can refer
to them from other documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Add documentation to doc/
Simon Glass [Tue, 9 Aug 2022 19:49:57 +0000 (13:49 -0600)]
patman: Add documentation to doc/

Link to patman's documentation from the doc/ directory so that it appears
in the 'make htmldocs' output.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: Drop a reference to Travis
Simon Glass [Sun, 7 Aug 2022 13:24:52 +0000 (07:24 -0600)]
doc: Drop a reference to Travis

This was widely used by U-Boot for a long time, but is not used anymore,
with Gitlab and Azure taking over.

Drop the text.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agodoc: develop: Add a note about importing code from other projects
Tom Rini [Mon, 1 Aug 2022 18:57:01 +0000 (14:57 -0400)]
doc: develop: Add a note about importing code from other projects

We talk about importing code from other projects in two places. The
first place is in the coding style section, where we explain when to or
not to deviate in terms of white space, etc. In the process
documentation we now add a note about saying where the code was imported
from and to ensure that you do not copy Signed-off-by or other tags.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: crash_dumps.rst missing documentation link
Heinrich Schuchardt [Tue, 2 Aug 2022 13:36:42 +0000 (15:36 +0200)]
doc: crash_dumps.rst missing documentation link

Add link to usage/cmd/exception.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: add more details for crash dump analysis
Heinrich Schuchardt [Tue, 2 Aug 2022 13:23:32 +0000 (15:23 +0200)]
doc: add more details for crash dump analysis

* describe crashs in UEFI binaries
* provide architechture specific information for the sandbox and RISC-V

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: man-page for gpio command
Heinrich Schuchardt [Tue, 2 Aug 2022 12:20:32 +0000 (14:20 +0200)]
doc: man-page for gpio command

Provide a man-page for the gpio command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agobootstd: doc: Fix typos
Paul Barker [Fri, 29 Jul 2022 13:31:58 +0000 (14:31 +0100)]
bootstd: doc: Fix typos

These typos were found while reading the docs.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agofs/erofs: silence erofs_probe()
Heinrich Schuchardt [Mon, 1 Aug 2022 13:27:11 +0000 (15:27 +0200)]
fs/erofs: silence erofs_probe()

fs_set_blk_dev() probes all file-systems until it finds one that matches
the volume. We do not expect any console output for non-matching
file-systems.

Convert error messages in erofs_read_superblock() to debug output.

Fixes: 830613f8f5bb ("fs/erofs: add erofs filesystem support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Huang Jianan <jnhuang95@gmail.com>
2 years agogit-mailrc: remove invalid entry 'efi'
Heinrich Schuchardt [Mon, 8 Aug 2022 19:51:10 +0000 (21:51 +0200)]
git-mailrc: remove invalid entry 'efi'

Remove alias 'efi' with invalid data.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-08-12-assorted-updates'
Tom Rini [Sat, 13 Aug 2022 01:39:15 +0000 (21:39 -0400)]
Merge branch '2022-08-12-assorted-updates'

- Clean up some code with the DH electronics boards, remove a few boards
  that have had their removal ack'd, update Azure CI hosts for macOS and
  Ubuntu, and migrate a few more symbols to Kconfig.

2 years agonet: Remove smc91111 ethernet driver
Tom Rini [Tue, 2 Aug 2022 11:33:35 +0000 (07:33 -0400)]
net: Remove smc91111 ethernet driver

This driver has not been converted to DM_ETH.  The migration deadline
passed 2 years ago.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: David Feng <fenghua@phytium.com.cn>
Cc: Liviu Dudau <liviu.dudau@foss.arm.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoarm: Remove snapper9260 board
Tom Rini [Tue, 2 Aug 2022 11:33:29 +0000 (07:33 -0400)]
arm: Remove snapper9260 board

This board is behind on several mandatory DM migrations and is missing
OF_CONTROL support that makes other conversions impossible. Remove it.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoppc: Remove ids8313 board
Tom Rini [Tue, 2 Aug 2022 11:33:28 +0000 (07:33 -0400)]
ppc: Remove ids8313 board

This board is behind on several mandatory DM migrations and is missing
OF_CONTROL support that makes other conversions impossible. Remove it.

Cc: Heiko Schocher <hs@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Heiko Schocher <hs@denx.de>
2 years agoConvert CONFIG_SYS_FDT_PAD to Kconfig
Tom Rini [Tue, 2 Aug 2022 11:33:27 +0000 (07:33 -0400)]
Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoConvert CONFIG_SYS_FSL_QMAN_V3 et al to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:29 +0000 (21:08 -0400)]
Convert CONFIG_SYS_FSL_QMAN_V3 et al to Kconfig

This converts the following to Kconfig:
   CONFIG_FSL_NGPIXIS
   CONFIG_SYS_FSL_QMAN_V3
   CONFIG_SYS_FSL_RAID_ENGINE
   CONFIG_SYS_FSL_RMU
   CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
   CONFIG_SYS_FSL_SRIO_LIODN
   CONFIG_SYS_FSL_TBCLK_DIV
   CONFIG_SYS_FSL_USB1_PHY_ENABLE
   CONFIG_SYS_FSL_USB2_PHY_ENABLE
   CONFIG_SYS_FSL_USB_DUAL_PHY_ENABLE
   CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_SYS_FSL_PCIE_COMPAT to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:28 +0000 (21:08 -0400)]
Convert CONFIG_SYS_FSL_PCIE_COMPAT to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FSL_PCIE_COMPAT

To do this, introduce a choice and option for each of the strings used
and set CONFIG_SYS_FSL_PCIE_COMPAT based on that.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_SYS_FSL_NUM_CC_PLLS to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:27 +0000 (21:08 -0400)]
Convert CONFIG_SYS_FSL_NUM_CC_PLLS to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FSL_NUM_CC_PLLS

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_SYS_FSL_MAX_NUM_OF_SEC to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:26 +0000 (21:08 -0400)]
Convert CONFIG_SYS_FSL_MAX_NUM_OF_SEC to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FSL_MAX_NUM_OF_SEC

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:25 +0000 (21:08 -0400)]
Convert CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoRemove CONFIG_SYS_FSL_SCFG_IODSECR1_ADDR et al
Tom Rini [Mon, 1 Aug 2022 01:08:24 +0000 (21:08 -0400)]
Remove CONFIG_SYS_FSL_SCFG_IODSECR1_ADDR et al

This removes the following symbols:
   CONFIG_SYS_FSL_DSPI_BE
   CONFIG_SYS_FSL_DSP_CCSRBAR_DEFAULT
   CONFIG_SYS_FSL_DSP_CCSR_DDR_ADDR
   CONFIG_SYS_FSL_DSP_CCSR_DDR_OFFSET
   CONFIG_SYS_FSL_DSP_DDR_ADDR
   CONFIG_SYS_FSL_DSP_M2_RAM_ADDR
   CONFIG_SYS_FSL_DSP_M3_RAM_ADDR
   CONFIG_SYS_FSL_ERRATUM_A008751
   CONFIG_SYS_FSL_ESDHC_BROKEN_TIMEOUT
   CONFIG_SYS_FSL_ESDHC_NUM
   CONFIG_SYS_FSL_ESDHC_P1010_BROKEN_SDCLK
   CONFIG_SYS_FSL_FM1_RX0_1G_OFFSET
   CONFIG_SYS_FSL_FM1_RX1_1G_OFFSET
   CONFIG_SYS_FSL_FM1_RX2_1G_OFFSET
   CONFIG_SYS_FSL_FM1_RX3_1G_OFFSET
   CONFIG_SYS_FSL_FM1_RX4_1G_OFFSET
   CONFIG_SYS_FSL_FM1_RX5_1G_OFFSET
   CONFIG_SYS_FSL_ISBC_VER
   CONFIG_SYS_FSL_QSPI_LE
   CONFIG_SYS_FSL_SCFG_IODSECR1_ADDR
   CONFIG_SYS_FSL_SCFG_IODSECR1_OFFSET
   CONFIG_SYS_FSL_SCFG_PIXCLKCR_OFFSET
   CONFIG_SYS_FSL_SCFG_PIXCLK_ADDR
   CONFIG_SYS_FSL_SRDS_NUM_PLLS
   CONFIG_SYS_FSL_WDOG_BE
   CONFIG_SYS_GP1DIR
   CONFIG_SYS_GP1ODR
   CONFIG_SYS_GP2DIR
   CONFIG_SYS_GP2ODR
   CONFIG_SYS_HALT_BEFOR_RAM_JUMP
   CONFIG_SYS_HMI_BASE
   FSL_QSPI_FLASH_NUM
   FSL_QSPI_FLASH_SIZE

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoarc: Move SYS_LITTLE_ENDIAN / SYS_BIG_ENDIAN selection to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:23 +0000 (21:08 -0400)]
arc: Move SYS_LITTLE_ENDIAN / SYS_BIG_ENDIAN selection to Kconfig

We can determine which of these we need given CPU_BIG_ENDIAN being
enabled or not, so move that logic to Kconfig from config.mk.

Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS et al to Kconfig
Tom Rini [Mon, 1 Aug 2022 01:08:22 +0000 (21:08 -0400)]
Convert CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS
   CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS

And we remove the entries from the README for a number of already
converted items.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoARM: stm32: DH: Use common MAC address functions
Philip Oberfichtner [Tue, 26 Jul 2022 13:04:53 +0000 (15:04 +0200)]
ARM: stm32: DH: Use common MAC address functions

To reduce code duplication, let the stm32 based DH boards use the common
code for setting up their MAC addresses.

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: imx8: DH: Use common MAC address functions
Philip Oberfichtner [Tue, 26 Jul 2022 13:04:52 +0000 (15:04 +0200)]
ARM: imx8: DH: Use common MAC address functions

To reduce code duplication, let the imx8 based DH boards use the common
code for setting up their MAC addresses.

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agoARM: imx6: DH: Use common MAC address functions
Philip Oberfichtner [Tue, 26 Jul 2022 13:04:51 +0000 (15:04 +0200)]
ARM: imx6: DH: Use common MAC address functions

To reduce code duplication, let the imx6 based DH boards use the common
code for setting up their MAC addresses.

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agoboard: dhelectronics: Implement common MAC address functions
Philip Oberfichtner [Tue, 26 Jul 2022 13:04:50 +0000 (15:04 +0200)]
board: dhelectronics: Implement common MAC address functions

This is a starting point for unifying duplicate code in the DH board
files. The functions for setting up MAC addresses are very similar for
the i.MX6, i.MX8 and stm32mp1 based boards.

All pre-existing implementations follow the same logic:

(1) Check if ethaddr is already set in the environment
(2) If not, try to get it from a board specific location (e.g. fuse)
(3) If not, try to get it from eeprom

After this commit, (1) and (3) are implemented as common functions,
ready to be used by board specific files.

Furthermore there is an implementation of (2) for imx based boards.

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agoCI: Azure: Move to using macOS-12 image
Tom Rini [Wed, 27 Jul 2022 15:10:24 +0000 (11:10 -0400)]
CI: Azure: Move to using macOS-12 image

As per https://github.com/actions/virtual-environments/issues/5583 the
macOS-10.15 image is being deprecated.  Move us up to macOS-12.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoCI: Azure: Move to Ubuntu 22.04 image
Tom Rini [Tue, 9 Aug 2022 02:44:45 +0000 (22:44 -0400)]
CI: Azure: Move to Ubuntu 22.04 image

As per https://github.com/actions/runner-images/issues/6002 the Ubuntu
18.04 image is deprecated and will be removed by December 1, 2022.
Move to the Ubuntu 22.04 image as our base for launching our containers
from.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-08-11-verified-boot-for-embedded-initial-support'
Tom Rini [Fri, 12 Aug 2022 16:51:14 +0000 (12:51 -0400)]
Merge branch '2022-08-11-verified-boot-for-embedded-initial-support'

To quote Simon:
This adds the concept of a VBE method to U-Boot, along with an
implementation of the 'VBE simple' method, basically a simple way of
updating firmware in MMC from userspace and monitoring it from U-Boot.

VBE simple is implemented in fwupd. U-Boot's role is to set up the
device tree with the required firmware-update properties and provide the
developer with information about the current VBE state. To that end this
series includes a new 'vbe' command that allows VBE methods to be listed
and examined.

As part of this work, support for doing FDT fixups via the event interface
is provided, along with the ability to write to the device tree via the
ofnode interface.

Another (significant) change is that bootmeths now have a 'global' flag,
to allow the implementation of EFI bootmgr (and VBE) to be cleaned up.
The 'system' bootdev is no-longer needed and these bootmeths are scanned
first.

Further work is needed to pull everything together, but this is a step
along the way.

2 years agovbe: Add a new vbe command
Simon Glass [Sat, 30 Jul 2022 21:52:37 +0000 (15:52 -0600)]
vbe: Add a new vbe command

Add a command to look at VBE methods and their status. Provide a test for
all of this as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Check building without global bootmeths
Simon Glass [Sat, 30 Jul 2022 21:52:36 +0000 (15:52 -0600)]
bootstd: Check building without global bootmeths

Use the sandbox_flattree build to check that everything works correctly
with BOOTMETH_GLOBAL disabled.

Update the tests as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Update documentation
Simon Glass [Sat, 30 Jul 2022 21:52:35 +0000 (15:52 -0600)]
bootstd: Update documentation

Add some documentation updates, particularly about global bootmeths.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add vbe bootmeth into sandbox
Simon Glass [Sat, 30 Jul 2022 21:52:34 +0000 (15:52 -0600)]
bootstd: Add vbe bootmeth into sandbox

Update sandbox to include the VBE bootmeth. Update a few existing tests to
take account of this change, specifically that the new bootmeth now
appears when scanning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovbe: Support VBE simple
Simon Glass [Sat, 30 Jul 2022 21:52:33 +0000 (15:52 -0600)]
vbe: Support VBE simple

Add support for VBE simple, which permits firmware update of a single
image stored in MMC or another block device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovbe: Add initial support for VBE
Simon Glass [Sat, 30 Jul 2022 21:52:32 +0000 (15:52 -0600)]
vbe: Add initial support for VBE

Create a new bootmeth for VBE along with a library to handle finding the
VBE methods.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Add an event for device tree fixups
Simon Glass [Sat, 30 Jul 2022 21:52:31 +0000 (15:52 -0600)]
event: Add an event for device tree fixups

At present there is a confusing array of functions that handle the
device tree fix-ups needed for booting an OS. We should be able to switch
to using events to clean this up.

As a first step, create a new event type and call it from the standard
place.

Note that this event uses the ofnode interface only, since this can
support live tree which is more efficient when making lots of updates.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Change EVENT_SPY to global
Simon Glass [Sat, 30 Jul 2022 21:52:30 +0000 (15:52 -0600)]
event: Change EVENT_SPY to global

This creates static records at present, but it causes a problem with clang
and LTO: the linker list records are sometimes dropped from the image.

Fix this by making the records global.

Update to use __used while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Drop the system bootdev
Simon Glass [Sat, 30 Jul 2022 21:52:29 +0000 (15:52 -0600)]
bootstd: Drop the system bootdev

This was a work-around for the fact that global bootmeths such as EFI
bootmgr and VBE don't use a particular bootdev, or at least select it
themselves so that we don't need to scan all bootdevs when using that
bootmeth.

Drop the system bootdev entirely.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Always create the EFI bootmgr bootmeth
Simon Glass [Sat, 30 Jul 2022 21:52:28 +0000 (15:52 -0600)]
bootstd: Always create the EFI bootmgr bootmeth

Now that we can separate this out from the normal bootmeths, update the
code to create it always.

We cannot rely on the device tree to create this, since the EFI project
is quite opposed to having anything in the device tree that helps U-Boot
with its processing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Allow scanning for global bootmeths separately
Simon Glass [Sat, 30 Jul 2022 21:52:27 +0000 (15:52 -0600)]
bootstd: Allow scanning for global bootmeths separately

Typically we want to find and use global bootmeths first, since they have
the best idea of how the system should boot. We then use normal bootmeths
as a fallback.

Add the logic for this, putting global bootmeths at the end of the
ordering. We can then easily scan the global bootmeths first, then drop
them from the list for subsequent bootdev-centric scans.

This changes the ordering of global bootmeths, so update the
bootflow_system() accordingly.

Drop the comment from bootmeth_setup_iter_order() since this is an
exported function and it should be in the header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Call dm_scan_other() when setting up for tests
Simon Glass [Sat, 30 Jul 2022 21:52:26 +0000 (15:52 -0600)]
dm: core: Call dm_scan_other() when setting up for tests

At present this function is not called, so tests miss out on any devices
created by it. Add it in so that tests can rely on these extra devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Support bootflows with global bootmeths
Simon Glass [Sat, 30 Jul 2022 21:52:25 +0000 (15:52 -0600)]
bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Tidy comments in bootflow_scan_bootdev()
Simon Glass [Sat, 30 Jul 2022 21:52:24 +0000 (15:52 -0600)]
bootstd: Tidy comments in bootflow_scan_bootdev()

Fix a few nits in this function comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Allow the bootdev to be optional in bootflows
Simon Glass [Sat, 30 Jul 2022 21:52:23 +0000 (15:52 -0600)]
bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Allow EFI bootmgr to support an invalid bootflow
Simon Glass [Sat, 30 Jul 2022 21:52:22 +0000 (15:52 -0600)]
bootstd: Allow EFI bootmgr to support an invalid bootflow

For most testing we don't want this bootmeth to actually do anything. For
the one test where we do, add a test hook to obtain the correct behaviour.
This will allow us to bind the device always, rather than just doing it
for this test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Allow bootmeths to be marked as global
Simon Glass [Sat, 30 Jul 2022 21:52:21 +0000 (15:52 -0600)]
bootstd: Allow bootmeths to be marked as global

The current way of handling things like EFI bootmgr is a bit odd, since
that bootmeth handles selection of the bootdev itself. VBE needs to work
the same way, so we should support it properly.

Add a flag that indicates that the bootmeth is global, rather than being
invoked on each bootdev. Provide a helper to read a bootflow from the
bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Tidy up var naming in bootdev_setup_iter_order()
Simon Glass [Sat, 30 Jul 2022 21:52:20 +0000 (15:52 -0600)]
bootstd: Tidy up var naming in bootdev_setup_iter_order()

Avoid using 'count' to mean either a count or an error, since this is
confusing. In fact, the called function never return 0, since that is an
error.

Use 'ret' instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Provide a bootmeth method to obtain state info
Simon Glass [Sat, 30 Jul 2022 21:52:19 +0000 (15:52 -0600)]
bootstd: Provide a bootmeth method to obtain state info

Some bootmeths can provide information about what is available to boot.
For example, VBE simple provides access to the firmware state.

Add a new method for this, along with a sandbox test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Detect empty bootmeth ordering
Simon Glass [Sat, 30 Jul 2022 21:52:18 +0000 (15:52 -0600)]
bootstd: Detect empty bootmeth ordering

If the ordering produces no entries, this is an error. Report it, so that
the caller doesn't try to continue with a NULL bootmeth.

This fixes a crash in the bootflow_iter test when running with the sandbox
'default' device tree, instead of the required 'test' one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Fix comment in bootmeth test
Simon Glass [Sat, 30 Jul 2022 21:52:17 +0000 (15:52 -0600)]
bootstd: Fix comment in bootmeth test

Correct the comment at the top of this file.

Signed-off-by: Simon Glass <sjg@chromium.org>