Simon Glass [Tue, 17 Jan 2023 17:47:56 +0000 (10:47 -0700)]
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.
Simon Glass [Tue, 17 Jan 2023 17:47:53 +0000 (10:47 -0700)]
ata: Don't try to use non-existent ports
The controller indicates the number of ports but also has a port map
which specifies which ports are actually valid. Make use of this to
avoid trying to send commands to an invalid port.
Simon Glass [Tue, 17 Jan 2023 17:47:51 +0000 (10:47 -0700)]
virtio: Add a block device
The test code for virtio is fairly simplistic and does not actually create
a block device. Add a way to specify the device type in the device tree.
Add a block device so that we can do more testing.
Simon Glass [Tue, 17 Jan 2023 17:47:38 +0000 (10:47 -0700)]
bootstd: Add an MMC hunter
Add a hunter for MMC. This doesn't do anything at present, since MMC is
currently set up when U-Boot starts. If MMC moves to lazy init then we can
add a hunter function.
Simon Glass [Tue, 17 Jan 2023 17:47:34 +0000 (10:47 -0700)]
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.
Simon Glass [Tue, 17 Jan 2023 17:47:33 +0000 (10:47 -0700)]
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.
Simon Glass [Tue, 17 Jan 2023 17:47:30 +0000 (10:47 -0700)]
lib: Support printing an error string
It is often useful to show an error code to give the user a clue as to
what went wrong. When error strings are compiled into U-Boot it is
possible to show a message as well.
But at present it is not very convenient, since code must check if the
error strings are present, then obtain the error string and use it in
a printf() string.
Add a %dE option which shows an error code along with an error string,
if available. This makes it easy to show one or both.
Simon Glass [Tue, 17 Jan 2023 17:47:29 +0000 (10:47 -0700)]
sandbox: Enable the Ethernet bootdev
This bootdev is disabled at present since it messes with the tests. Now
that there is a way to disable networking at runtime, enable the driver.
This allows running tests with it if necessary.
Simon Glass [Tue, 17 Jan 2023 17:47:28 +0000 (10:47 -0700)]
sandbox: Allow ethernet bootdevs to be disabled for tests
Most tests don't want these and can create a lot of noise. Add a way to
disable them. Use that in tests, with a flag provided to enable them for
tests that need this feature.
Simon Glass [Tue, 17 Jan 2023 17:47:26 +0000 (10:47 -0700)]
bootstd: Add a default method to get bootflows
The code in these functions turns out to often be the same. Add a default
get_bootflow() function and allow the drivers to select it by setting
the method to NULL.
Simon Glass [Tue, 17 Jan 2023 17:47:25 +0000 (10:47 -0700)]
dm: mmc: Use bootdev_setup_sibling_blk()
At present MMC uses the bootdev_setup_for_dev() function to set up the
bootdev. This is because MMC only has one block-device child, so does not
need to worry about naming of the bootdev.
However this inconsistency with other bootdevs that use block devices is a
bit annoying. The only real reason for it is to have a name like
'mmc0.bootdev' instead of 'mmc0.blk.bootdev'.
Update bootdev_setup_sibling_blk() to drop '.blk' from the name where it
appears, thus removing the only reason to use the bootdev_setup_for_dev().
Switch MMC over to the subling function.
Simon Glass [Tue, 17 Jan 2023 17:47:23 +0000 (10:47 -0700)]
dm: test: Correct ordering of DM setup
We must call dm_scan_other() after devices from the device tree have been
created, since that function behaves differently if there is no bootstd
device.
Adjust the logic to achieve this.
Also fix the bootflow_system() test which was relying on this broken
behaviour.
Simon Glass [Tue, 17 Jan 2023 17:47:22 +0000 (10:47 -0700)]
dm: part: Update test to use mmc2
At present this test sets up a partition table on mmc1. But this is used
by the bootstd tests, so it is not possible to run those after this test
has run, without restarting the Python test harness.
This is inconvenient when running tests repeatedly with 'ut dm'. Move the
test to use mmc2, which is not used by anything.
Simon Glass [Tue, 17 Jan 2023 17:47:19 +0000 (10:47 -0700)]
sandbox: mmc: Start off with a zeroed file
When running multiple tests the mmc emulator calls malloc() to obtain the
memory for its disk image. Since the memory is not cleared, it is possible
that it happens to contain a partition table.
The dm_test_part() test (for one) relies on mmc0 being empty on startup.
Zero the memory to ensure that it is.
Simon Glass [Tue, 17 Jan 2023 17:47:16 +0000 (10:47 -0700)]
bootstd: Simplify locating existing bootdevs
There is no point in trying to match the alias order for bootdevs, since
build_order() either sorts them by priority, uses the boot_targets
environment variable or the bootdev-order property.
Just use the iterator instead, to simplify the code.
Simon Glass [Tue, 17 Jan 2023 17:47:15 +0000 (10:47 -0700)]
bootstd: Remove special-case code for boot_targets
Rather than implement this as its own case in build_order(), process the
boot_targets environment variable in the bootstd_get_bootdev_order()
function. This allows build_order() to be simplified.
- Merge in the final batch of CONFIG to Kconfig/CFG migration work. This
includes a fix for a number of ns16550 or similar UARTs due to a
migration bug. We also pull in a revert for enabling CONFIG_VIDEO on
tools-only_defconfig.
Tom Rini [Tue, 10 Jan 2023 16:19:46 +0000 (11:19 -0500)]
CI: Make check for new defined CONFIG symbols even more robust
Now that all remaining in-tree cases where we define or undef a CONFIG
symbol have been migrated to Kconfig or renamed to CFG we can make the
CI check more robust. We will exclude the doc, tools and arch/arm/dts
directories from this check as they are special cases. Further, we can
exclude the scripts/kconfig/lkc.h and include/linux/kconfig.h files as
the CONFIG values they define are special tooling cases and not real
symbols.
In the case of docs, the only places that currently fail this test are
old documentation that should be rewritten so that we can remove this
special case.
Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini [Tue, 10 Jan 2023 16:19:45 +0000 (11:19 -0500)]
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>
Tom Rini [Tue, 10 Jan 2023 16:19:44 +0000 (11:19 -0500)]
watchdog: Clean up defaults for imx_watchdog / ulp_wdog
In imx_watchdog, clean up the comment to just note the range now, as we
do not need to set the default here as Kconfig does this for us. For
ulp_wdog, set the default value via Kconfig instead.
Cc: Stefan Roese <sr@denx.de> Cc: Stefano Babic <sbabic@denx.de> Cc: Peng Fan <peng.fan@nxp.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Stefan Roese <sr@denx.de>
Tom Rini [Tue, 10 Jan 2023 16:19:42 +0000 (11:19 -0500)]
nxp: Finish migration of SYS_FSL_SRDS_[12] to Kconfig
As this is used on both ARM and PowerPC platforms, this needs to be
listed in arch/Kconfig.nxp and match how they're currently used by
select'ing them under the required PowerPC ARCH_xxx options.
Tom Rini [Tue, 10 Jan 2023 16:19:41 +0000 (11:19 -0500)]
nxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig
As this is used on both ARM and PowerPC platforms, this needs to be
asked in arch/Kconfig.nxp. Set the PowerPC defaults based on
arch/powerpc/include/asm/config_mpc85xx.h and remove the default set in
drivers/mtd/nand/raw/fsl_ifc_nand.c
Tom Rini [Tue, 10 Jan 2023 16:19:36 +0000 (11:19 -0500)]
common/update: Finish Kconfig migration
We can enforce the dependencies of this module via Kconfig now, so do so
rather than with #error statements. Further, we can ensure that all
required values are set to their defaults in Kconfig, and in fact
already do so, so remove the tests here. The exception is
CONFIG_UPDATE_LOAD_ADDR which needed to be migrated to Kconfig in the
first place.
Tom Rini [Tue, 10 Jan 2023 16:19:35 +0000 (11:19 -0500)]
spl: sata: Rework the loading case it not use IS_ENABLED(...)
In this case, using IS_ENABLED(...) to attempt to load the image results
in harder to read and less useful code, along with having to define a
CONFIG value that would be unused. To maintain the current albeit
slightly odd behavior, maintain that if we have both SPL_FS_FAT and
SPL_SATA_RAW_U_BOOT_USE_SECTOR enabled, we use SPL_FS_FAT for the load.
Tom Rini [Tue, 10 Jan 2023 16:19:34 +0000 (11:19 -0500)]
autoboot: Rework CONFIG_AUTOBOOT_STOP_STR_* usage
In order to not define a CONFIG value when the
CONFIG_AUTOBOOT_STOP_STR_* functionality is not enabled, rework the
assignment of empty and unused (as the code will be discarded under if
0, in the end) values to be AUTOBOOT_STOP_STR_* instead of
CONFIG_AUTOBOOT_STOP_STR_*.
Tom Rini [Tue, 10 Jan 2023 16:19:33 +0000 (11:19 -0500)]
arm: lib1funcs.S: Update compatibility with Linux comment slightly
At this point, the Linux code for "lib1funcs" has changed rather
dramatically. While a resync would be beneficial, it's outside the scope
of what we need here. Simply remove the define for CONFIG_AEABI and
tests for it.
Tom Rini [Tue, 17 Jan 2023 22:10:50 +0000 (17:10 -0500)]
dm: ns16550: Restore how we define UART_REG
Prior to commit 380781ce6cf1 ("Convert CONFIG_SYS_NS16550_MEM32 et al to
Kconfig") we had defined CONFIG_SYS_NS16550_REG_SIZE to -1 with
DM_SERIAL such that we would then have a size 0 character array. This
resulted in functionally no padding. The confusion on my part came from
dealing with the constraints around platforms that do not use DM_SERIAL
in SPL/TPL. After Andre Przywara reported that sunxi was broken, I've
re-read the code and comments again and thought on this harder. What we
want I believe is what this patch does now.
If DM_SERIAL is defined for this stage, regardless of
CONFIG_SYS_NS16550_REG_SIZE then we will dynamically handle reg shifts
and 'struct ns16550' needs no padding (which is functionally what
unsigned char foo[0] provides). This is the same case as NS16550_DYNAMIC
and DEBUG_UART. Expand the existing comment here slightly.
Otherwise, we will have CONFIG_SYS_NS16550_REG_SIZE set to a non-zero
value, and handle padding within the struct.
Cc: Simon Glass <sjg@chromium.org> Cc: Sergei Antonov <saproj@gmail.com> Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com> Cc: Andre Przywara <andre.przywara@arm.com> Fixes: 380781ce6cf1 ("Convert CONFIG_SYS_NS16550_MEM32 et al to Kconfig") Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Tom Rini [Tue, 10 Jan 2023 16:19:31 +0000 (11:19 -0500)]
arm: Rework usage of CONFIG_ARMV[78]_SECURE_BASE in linker scripts
In order to avoid defining CONFIG_ARMV[78_]SECURE_BASE as empty in the
linker scripts, if not already defined, add and use
__ARMV[78_]SECURE_BASE for when the base is not defined and we want the
linker scripts to continue.
Tom Rini [Tue, 10 Jan 2023 16:19:30 +0000 (11:19 -0500)]
i2c: fsl_i2c: Rework usage of CONFIG_SYS_IMMR
This driver is used on both m68k, where CONFIG_SYS_IMMR is not used, and
PowerPC an ARM where it is. Abstract this to a new value rather than
re-defining a CONFIG symbol on m68k.
Ilias Apalodimas [Fri, 20 Jan 2023 11:58:48 +0000 (13:58 +0200)]
efi_loader: fix CapsuleMax variable reporting
Currently the code that adds the CapsuleMax variable is under a
Kconfig named 'EFI_HAVE_CAPSULE_UPDATE. Git history only shows a
single occurrence of that. The IS_ENABLED should be checking for
EFI_HAVE_CAPSULE_SUPPORT
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Jan Kiszka [Wed, 18 Jan 2023 21:24:59 +0000 (22:24 +0100)]
efi_loader: Avoid overwriting previous outputs on console screen clearing
Before clearing the screen, ensure that no previous output of firmware
or UEFI programs will be overwritten on serial devices or other
streaming consoles. This helps generating complete boot logs.
Tested regarding multi-output against qemu-x86_defconfig. Still, there
were remaining concerns about side effects, so this is provided as an
opt-in feature.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
UEFI applications call file system functions to determine if a file exists.
The return codes are evaluated to show appropriate messages.
U-Boot's file system layer should not interfere with the output.
Rename file_fat_read_at() to fat_read_file() adjusting the parameter
sequence and names and eliminate the old wrapper function.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Ilias Apalodimas [Thu, 19 Jan 2023 14:36:12 +0000 (16:36 +0200)]
tpm2: ftpm: add the device in the OP-TEE services list
commit b460eca72b596e ("tee: optee: discover services dependent on tee-supplicant")
is trying to automatically scan and add TAs that are presented on pseudo
bus from the secure world.
In order to be able to list and compare the scanned devices the available drivers
have to register themselves on the op-tee service list.
Ilias Apalodimas [Thu, 19 Jan 2023 15:10:57 +0000 (17:10 +0200)]
MAINTAINERS: add a new entry on TEE MAINTAINERS
Since I do have a look on TEE patches regardless and Jens doesn't have
his own tree, add myself as a co-maintainer. I'll be carrying over the
TEE related patches from now on. While at it add the maintenance tree
for TPM
Tom Rini [Thu, 19 Jan 2023 14:46:57 +0000 (09:46 -0500)]
Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm
convert rockchip to use binman
patman fix for checkpatch
binman optional entries, improved support for ELF symbols
trace improvements
minor fdt refactoring
Tom Rini [Thu, 19 Jan 2023 14:41:54 +0000 (09:41 -0500)]
Merge branch '2022-01-18-assorted-updates'
- A few TI platform fixes, compression test cleanup and zstd update,
npcm7xx update, add "part type" subcommand, VBE bugfix on some
platforms, cleanup EVENT related Kconfig option logic (and fix some
platforms), other minor cleanups.
In commit c103c2d30197 ("image: Use gd->ram_base/_size in
env_get_bootm_size()") the size of the available memory for U-Boot to
use when relocating images, and not otherwise constrained, was changed
to include all known memory banks. In the case of this platform however,
all of the memory known to U-Boot is not also part of the Linux kernel
"lowmem" and so we must use CFG_SYS_BOOTMAPSZ to limit where we relocate
images to. We set a conservative limit of 256MB here to mirror the
previous behavior.
Signed-off-by: Joost van Zwieten <joost@diskos.nl>
[trini: Reword the commit messsage] Signed-off-by: Tom Rini <trini@konsulko.com>
Simon Glass [Thu, 12 Jan 2023 23:48:54 +0000 (16:48 -0700)]
vbe: Allow probing the VBE bootmeth to fail in OS fixup
This device is created when there are no bootmeths defined in the device
tree. But it cannot be probed without a device tree node.
For now, ignore a probe failure.
Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Karsten Merker <merker@debian.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Fixes: 9068460cdd5b ("vbe: Add info about the VBE device to the fwupd node") Tested-by: Vagrant Cascadian <vagrant@debian.org> Tested-by: Karsten Merker <merker@debian.org>
Brandon Maier [Thu, 12 Jan 2023 16:27:45 +0000 (10:27 -0600)]
lib: zstd: update to latest Linux zstd 1.5.2
Update the zstd implementation to match Linux zstd 1.5.2 from commit 2aa14b1ab2.
This was motivated by running into decompression corruption issues when
trying to uncompress files compressed with newer versions of zstd. zstd
users also claim significantly improved decompression times with newer
zstd versions which is a side benefit.
Original zstd code was copied from Linux commit 2aa14b1ab2 which is a
custom-built implementation based on zstd 1.3.1. Linux switched to an
implementation that is a copy of the upstream zstd code in Linux commit e0c1b49f5b, this results in a large code diff. However this should make
future updates easier along with other benefits[1].
This commit is a straight mirror of the Linux zstd code, except to:
- update a few #include that do not translate cleanly
- linux/swab.h -> asm/byteorder.h
- linux/limits.h -> linux/kernel.h
- linux/module.h -> linux/compat.h
- remove assert() from debug.h so it doesn't conflict with u-boot's
assert()
- strip out the compressor code as was done in the previous u-boot zstd
- update existing zstd users to the new Linux zstd API
- change the #define for MEM_STATIC to use INLINE_KEYWORD for codesize
- add a new KConfig option that sets zstd build options to minify code
based on zstd's ZSTD_LIB_MINIFY[2].
These changes were tested by booting a zstd 1.5.2 compressed kernel inside a
FIT. And the squashfs changes by loading a file from zstd compressed squashfs
with sqfsload. buildman was used to compile test other boards and check for
binary bloat, as follows:
> $ buildman -b zstd2 --boards dh_imx6,m53menlo,mvebu_espressobin-88f3720,sandbox,sandbox64,stm32mp15_dhcom_basic,stm32mp15_dhcor_basic,turris_mox,turris_omnia -sS
> Summary of 6 commits for 9 boards (8 threads, 1 job per thread)
> 01: Merge branch '2023-01-10-platform-updates'
> arm: w+ m53menlo dh_imx6
> 02: lib: zstd: update to latest Linux zstd 1.5.2
> aarch64: (for 2/2 boards) all -3186.0 rodata +920.0 text -4106.0
> arm: (for 5/5 boards) all +1254.4 rodata +940.0 text +314.4
> sandbox: (for 2/2 boards) all -4452.0 data -16.0 rodata +640.0 text -5076.0
Signed-off-by: Brandon Maier <brandon.maier@collins.com>
[trini: Set ret to -EINVAL for the error of "failed to detect
compressed" to fix warning, drop ZSTD_SRCSIZEHINT_MAX for non-Linux host
tool builds] Signed-off-by: Tom Rini <trini@konsulko.com>
Maxim Cournoyer [Fri, 13 Jan 2023 13:50:49 +0000 (08:50 -0500)]
Revert "patman: invoke the checkpatch.pl script with '--u-boot' and '--strict'"
This reverts commit bef8df75e4ef184dda6a938e1e6f57bfa61b2db7, because
it broke usage of patman on Linux, whose check script doesn't know
about '--strict' or '--u-boot'.
Simon Glass [Wed, 11 Jan 2023 23:10:19 +0000 (16:10 -0700)]
binman: Support positioning an entry by and ELF symbol
In some cases it is useful to position an entry over the top of a symbol
in an ELF file. For example, if the symbol holds a version string then it
allows the string to be accessed from the fdtmap.
Add support for this.
Suggested-by: Pali Rohár <pali@kernel.org> Suggested-by: Keith Short <keithshort@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 11 Jan 2023 23:10:17 +0000 (16:10 -0700)]
binman: Provide general support for updating ELF symbols
The current support for updating variables in a binary is hard-coded to
work with U-Boot:
- It assumes the image starts at __image_copy_start
- It uses the existing U-Boot-specific entry types
It is useful for other projects to use these feature.
Add properties to enable writing symbols for any blob, a way of specifying
the base symbol and a way of providing the ELF filename to allow symbol
lookup to take place.
With this it is possible to update a Zephyr image, such as zephyr.bin
after it has been built.
Simon Glass [Wed, 11 Jan 2023 23:10:16 +0000 (16:10 -0700)]
binman: Support overlapping entries
In some cases it is useful to have an entry overlap with another in a
section, either to update the contents within a blob, or to add an entry
to the fdtmap that covers only part of the blob.
Simon Glass [Wed, 11 Jan 2023 23:10:14 +0000 (16:10 -0700)]
binman: Add a null entry
It is sometimes useful to define an entry which does not have its own
contents but does appear in the image. The contents are set by the section
which contains it, even though it appears as an entry in the fdtmap.