platform/kernel/u-boot.git
23 months agobootstd: Allow hunting for bootdevs of a given priority
Simon Glass [Tue, 17 Jan 2023 17:48:07 +0000 (10:48 -0700)]
bootstd: Allow hunting for bootdevs of a given priority

Add a way to run the hunter function for a particular priority, so that
new bootdevs can be found.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Use hunters when scanning for bootflows
Simon Glass [Tue, 17 Jan 2023 17:48:06 +0000 (10:48 -0700)]
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>
23 months agobootstd: Treat DHCP and PXE as bootdev labels
Simon Glass [Tue, 17 Jan 2023 17:48:05 +0000 (10:48 -0700)]
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>
23 months agobootstd: Support reading a script from network or SPI flash
Simon Glass [Tue, 17 Jan 2023 17:48:04 +0000 (10:48 -0700)]
bootstd: Support reading a script from network or SPI flash

At present this bootmeth only supports a block device and the sandbox
host filesystem. Add support for obtaining the script from a network
device. Also implement the set_bootflow() method so that it is easy
for other bootdevs (such as enabling SPI flash to support scripts).

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a SPI flash bootdev
Simon Glass [Tue, 17 Jan 2023 17:48:03 +0000 (10:48 -0700)]
bootstd: Add a SPI flash bootdev

Add a bootdev for SPI flash so that these devices can be used with
standard boot. It only supports loading a script.

Add a special case for the label, since we want to use "spi", not
"spi_flash".

Enable the new bootdev on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agosandbox: Allow SPI flash bootdevs to be disabled for tests
Simon Glass [Tue, 17 Jan 2023 17:48:02 +0000 (10:48 -0700)]
sandbox: Allow SPI flash bootdevs to be disabled for tests

Most tests don't want these and they 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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a new bootmeth method to set the bootflow
Simon Glass [Tue, 17 Jan 2023 17:48:01 +0000 (10:48 -0700)]
bootstd: Add a new bootmeth method to set the bootflow

Normally the bootmeth driver reads the bootflow from the bootdev, since
it knows the correct way to do it.

However it is easier for some bootdevs to handle this themselves. For
example, reading from SPI flash is quite different from other devices.

Add a way for the bootdev to pass a bootflow to the bootmeth, so that
this can be supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Move label parsing into its own function
Simon Glass [Tue, 17 Jan 2023 17:48:00 +0000 (10:48 -0700)]
bootstd: Move label parsing into its own function

This is complicated enough to merit its own function, particularly as we
are about to add to it. Create a new label_to_uclass() function to decode
a label.

Also update the code to ignore an empty label or one consisting of just a
number.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Update docs on bootmeth_try_file() for sandbox
Simon Glass [Tue, 17 Jan 2023 17:47:59 +0000 (10:47 -0700)]
bootstd: Update docs on bootmeth_try_file() for sandbox

Mention that this function is also used with a NULL block devices to
access files on the host, when using sandbox.

Update the comment on struct bootflow also.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Set the distro_bootpart env var with scripts
Simon Glass [Tue, 17 Jan 2023 17:47:58 +0000 (10:47 -0700)]
bootstd: Set the distro_bootpart env var with scripts

This environment variable is supposed to be set so that the script knows
which partition holds the script. Set it before invoking the script.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Support reading the device tree with EFI
Simon Glass [Tue, 17 Jan 2023 17:47:57 +0000 (10:47 -0700)]
bootstd: Support reading the device tree with EFI

With EFI booting the device tree is required but is not actually specified
in any way. The normal method is to use a fdtfile environment variable to
get the filename, then look for that file on the media.

Implement this in the bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Include the device tree in the bootflow
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Allow reading an EFI file from the network
Simon Glass [Tue, 17 Jan 2023 17:47:55 +0000 (10:47 -0700)]
bootstd: Allow reading an EFI file from the network

At present this bootmeth only supports reading from a filesystem. Add
support for reading from a network also, using DHCP with autoload.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Rename bootdev checkers
Simon Glass [Tue, 17 Jan 2023 17:47:54 +0000 (10:47 -0700)]
bootstd: Rename bootdev checkers

These functions return 0 if the check passes, so the names are somewhat
confusing. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoata: Don't try to use non-existent ports
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.

This avoids a crash on some controllers.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a virtio bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:52 +0000 (10:47 -0700)]
bootstd: Add a virtio bootdev

Add a bootdev for virtio so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovirtio: Add a block device
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovirtio: Avoid strange behaviour on removal
Simon Glass [Tue, 17 Jan 2023 17:47:50 +0000 (10:47 -0700)]
virtio: Avoid strange behaviour on removal

This device does a check on removal which is better handled in the actual
test. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovirtio: Fix returning -ENODEV
Simon Glass [Tue, 17 Jan 2023 17:47:49 +0000 (10:47 -0700)]
virtio: Fix returning -ENODEV

This has a special meaning in driver model. There is clearly a device, so
it does not make sense to return this error code. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovirtio: Avoid repeating a long expression
Simon Glass [Tue, 17 Jan 2023 17:47:48 +0000 (10:47 -0700)]
virtio: Avoid repeating a long expression

Use a local variable to hold this name, to reduce the amount of code that
needs to be read.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add an NVMe bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:47 +0000 (10:47 -0700)]
bootstd: Add an NVMe bootdev

Add a bootdev for NVMe so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add an IDE bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:46 +0000 (10:47 -0700)]
bootstd: Add an IDE bootdev

Add a bootdev for IDE so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a SCSI bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:45 +0000 (10:47 -0700)]
bootstd: Add a SCSI bootdev

Add a bootdev for SCSI so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoscsi: Remove all children of SCSI devices before rescanning
Simon Glass [Tue, 17 Jan 2023 17:47:44 +0000 (10:47 -0700)]
scsi: Remove all children of SCSI devices before rescanning

At present this only unbinds block devices of a certain type. But SCSI
device can have different types of children, including bootdevs.

Unbind all children so tht everything is clean and ready for a new scan.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoscsi: Correct allocation of block-device name
Simon Glass [Tue, 17 Jan 2023 17:47:43 +0000 (10:47 -0700)]
scsi: Correct allocation of block-device name

This should be allocated so that it does not go out of scope. Fix this and
set the log category while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Only scan bootable partitions
Simon Glass [Tue, 17 Jan 2023 17:47:42 +0000 (10:47 -0700)]
bootstd: Only scan bootable partitions

At present all partitions are scanned, whether marked bootable or not.
Use only bootable partitions, defaulting to partition 1 if none is
found.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agopart: Add a function to find the first bootable partition
Simon Glass [Tue, 17 Jan 2023 17:47:41 +0000 (10:47 -0700)]
part: Add a function to find the first bootable partition

If a disk has a bootable partition we are expected to use it to locate the
boot files. Add a function to find it.

To test this, update mmc1 to have two paritions, fixing up other tests
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a hunter for ethernet
Simon Glass [Tue, 17 Jan 2023 17:47:40 +0000 (10:47 -0700)]
bootstd: Add a hunter for ethernet

Sometimes ethernet devices are attached to PCI. Since it is quick to scan,
add this into the ethernet hunter.

Run dhcp to establish the network connection. Drop this from the bootdev
since that is not needed now. Update a log message for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agonet: Add a function to run dhcp
Simon Glass [Tue, 17 Jan 2023 17:47:39 +0000 (10:47 -0700)]
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>
23 months agobootstd: Add an MMC hunter
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a USB hunter
Simon Glass [Tue, 17 Jan 2023 17:47:37 +0000 (10:47 -0700)]
bootstd: Add a USB hunter

Add a hunter for USB which enumerates the bus to find new bootdevs.

Update the tests and speed up bootdev_test_prio() while we are here, by
dropping the USB delays.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotest: Add a generic function to skip delays
Simon Glass [Tue, 17 Jan 2023 17:47:36 +0000 (10:47 -0700)]
test: Add a generic function to skip delays

At present this feature is sandbox-specific. For running tests on boards,
we need a nop version. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: usb: Mark the device name as alloced when binding
Simon Glass [Tue, 17 Jan 2023 17:47:35 +0000 (10:47 -0700)]
dm: usb: Mark the device name as alloced when binding

Since usb_find_and_bind_driver() allocates the device name it should tell
driver about that, to avoid memory leaks. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Support running bootdev hunters
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add the concept of a bootdev hunter
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoefi: Improve logging in efi_disk
Simon Glass [Tue, 17 Jan 2023 17:47:32 +0000 (10:47 -0700)]
efi: Improve logging in efi_disk

When this fails it can be time-consuming to debug. Add some debugging
to help with this. Also try to return error codes instead of just using
-1.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoevent: Correct duplicate log message in event_notify()
Simon Glass [Tue, 17 Jan 2023 17:47:31 +0000 (10:47 -0700)]
event: Correct duplicate log message in event_notify()

Use a different one for each call.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agolib: Support printing an error string
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agosandbox: Enable the Ethernet bootdev
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agosandbox: Allow ethernet bootdevs to be disabled for tests
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agosandbox: Allow ethernet to be disabled at runtime
Simon Glass [Tue, 17 Jan 2023 17:47:27 +0000 (10:47 -0700)]
sandbox: Allow ethernet to be disabled at runtime

For bootstd tests it is seldom useful to have ethernet enabled. Add a way
to disable it, so that ethernet operations like tftpboot do nothing.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Add a default method to get bootflows
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.

This saves a little code space.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: mmc: Use bootdev_setup_sibling_blk()
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoide: Drop non-DM code for BLK
Simon Glass [Tue, 17 Jan 2023 17:47:24 +0000 (10:47 -0700)]
ide: Drop non-DM code for BLK

We require CONFIG_BLK to be enabled now, so this code is unused. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: test: Correct ordering of DM setup
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: part: Update test to use mmc2
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovbe: sandbox: Drop VBE node in chosen
Simon Glass [Tue, 17 Jan 2023 17:47:21 +0000 (10:47 -0700)]
vbe: sandbox: Drop VBE node in chosen

This is not needed anymore since VBE creates the node when it sets up the
OS requests. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovbe: Avoid a build failure when bloblist is not enabled
Simon Glass [Tue, 17 Jan 2023 17:47:20 +0000 (10:47 -0700)]
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>
23 months agosandbox: mmc: Start off with a zeroed file
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotest: Drop duplicate restore of DM state
Simon Glass [Tue, 17 Jan 2023 17:47:18 +0000 (10:47 -0700)]
test: Drop duplicate restore of DM state

This code is present twice. Fix it so that it is only executed once.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotest: Fix the help for the ut command
Simon Glass [Tue, 17 Jan 2023 17:47:17 +0000 (10:47 -0700)]
test: Fix the help for the ut command

The font help has an incorrect newline. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: cdd964e3801 ("test: Tidy up help for ut command")
23 months agobootstd: Simplify locating existing bootdevs
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootstd: Remove special-case code for boot_targets
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agolib: Add a function to split a string into substrings
Simon Glass [Tue, 17 Jan 2023 17:47:14 +0000 (10:47 -0700)]
lib: Add a function to split a string into substrings

Some environment variables provide a space-separated list of strings. It
is easier to process these when they are broken out into an array of
strings.

Add a utility function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: test: Correct assertion in dm_test_part()
Simon Glass [Tue, 17 Jan 2023 17:47:13 +0000 (10:47 -0700)]
dm: test: Correct assertion in dm_test_part()

This obscures the line number. Update the test to avoid make sure that
the line which failed is displayed, so it is possible to diagnose the
failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: core: Support sorting devices with dm tree
Simon Glass [Tue, 17 Jan 2023 17:47:12 +0000 (10:47 -0700)]
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>
23 months agodm: core: Correct ordering of uclasses IDs
Simon Glass [Tue, 17 Jan 2023 17:47:11 +0000 (10:47 -0700)]
dm: core: Correct ordering of uclasses IDs

A few of these are out of order. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoMerge tag 'efi-2023-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 20 Jan 2023 19:23:20 +0000 (14:23 -0500)]
Merge tag 'efi-2023-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc1-2

Documentation

* man-pages for source, blkcache, bdinfo
* fix references to distro documentation

UEFI:

* allow clear screen by scrolling
* ensure that file ubootefi.var is created
* fix CapsuleMax variable reporting

Others:

* reduce verbosity of fat_read_file()

23 months agoMerge branch '2023-01-20-finish-CONFIG-migration-work'
Tom Rini [Fri, 20 Jan 2023 19:21:38 +0000 (14:21 -0500)]
Merge branch '2023-01-20-finish-CONFIG-migration-work'

- 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.

23 months agoRevert "config: tools only: add VIDEO to build bmp_logo"
Fabio Estevam [Thu, 19 Jan 2023 01:23:21 +0000 (22:23 -0300)]
Revert "config: tools only: add VIDEO to build bmp_logo"

This reverts commit 1cfba53ca46cade2dbf4e067afc8c19e72909a4b.

Since commit 1cfba53ca46c ("config: tools only: add VIDEO to build
bmp_logo") the build of tools-only_defconfig fails:

| /bin/sh: line 1: tools/bmp_logo: No such file or directory

This has been noticed in OpenEmbedded and Debian [1].

Revert it for now.

[1] https://lists.denx.de/pipermail/u-boot/2023-January/504758.html

Signed-off-by: Fabio Estevam <festevam@denx.de>
23 months agoCI: Make check for new defined CONFIG symbols even more robust
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>
23 months agoglobal: Finish CONFIG -> CFG migration
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>
23 months agowatchdog: Clean up defaults for imx_watchdog / ulp_wdog
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>
23 months agousbtty: Remove default CONFIG_USBD_* values
Tom Rini [Tue, 10 Jan 2023 16:19:43 +0000 (11:19 -0500)]
usbtty: Remove default CONFIG_USBD_* values

For this legacy driver, the only user sets these values in Kconfig, so
we can remove them from the header.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agonxp: Finish migration of SYS_FSL_SRDS_[12] to Kconfig
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agonxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig
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

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agonet: phy: mv88e61xx: Finish migration of MV88E61XX_FIXED_PORTS
Tom Rini [Tue, 10 Jan 2023 16:19:40 +0000 (11:19 -0500)]
net: phy: mv88e61xx: Finish migration of MV88E61XX_FIXED_PORTS

Set the default for MV88E61XX_FIXED_PORTS to 0x0 in Kconfig, and move
the comment from code to the help to explain what this does.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
23 months agofsl-layerscape: Rework usage of CONFIG_CLUSTER_CLK_FREQ
Tom Rini [Tue, 10 Jan 2023 16:19:39 +0000 (11:19 -0500)]
fsl-layerscape: Rework usage of CONFIG_CLUSTER_CLK_FREQ

In the case where CONFIG_CLUSTER_CLK_FREQ is not defined, simply set
cluster_clk to get_board_sys_clk().

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agousb: musb: Rename CONFIG_USB_MUSB_TIMEOUT to MUSB_TIMEOUT
Tom Rini [Tue, 10 Jan 2023 16:19:38 +0000 (11:19 -0500)]
usb: musb: Rename CONFIG_USB_MUSB_TIMEOUT to MUSB_TIMEOUT

This variable has never been configured to another value at present, and
was not converted to Kconfig. Opt instead to rename this to
MUSB_TIMEOUT.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>
23 months agofpga: Migrate CONFIG_MAX_FPGA_DEVICES to Kconfig
Tom Rini [Tue, 10 Jan 2023 16:19:37 +0000 (11:19 -0500)]
fpga: Migrate CONFIG_MAX_FPGA_DEVICES to Kconfig

This is always defined to 5, so use that as the default.

Cc: Michal Simek <michal.simek@amd.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
23 months agocommon/update: Finish Kconfig migration
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agospl: sata: Rework the loading case it not use IS_ENABLED(...)
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoautoboot: Rework CONFIG_AUTOBOOT_STOP_STR_* usage
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_*.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoarm: lib1funcs.S: Update compatibility with Linux comment slightly
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agodm: ns16550: Restore how we define UART_REG
Tom Rini [Tue, 17 Jan 2023 22:10:50 +0000 (17:10 -0500)]
dm: ns16550: Restore how we define UART_REG

Prior to commit 9591b63531fa ("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: 9591b63531fa ("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>
23 months agoarm: Rework usage of CONFIG_ARMV[78]_SECURE_BASE in linker scripts
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoi2c: fsl_i2c: Rework usage of CONFIG_SYS_IMMR
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoarc: Migrate ARC_MMU_VER to Kconfig
Tom Rini [Tue, 10 Jan 2023 16:19:29 +0000 (11:19 -0500)]
arc: Migrate ARC_MMU_VER to Kconfig

Move this value to Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoglobal: Remove unused CONFIG defines
Tom Rini [Tue, 10 Jan 2023 16:19:28 +0000 (11:19 -0500)]
global: Remove unused CONFIG defines

Remove some CONFIG symbols and related comments, etc, that are unused
within the code itself at this point.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoefi_loader: fix CapsuleMax variable reporting
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>
23 months agoefi_loader: update the error message of TCG protocol installation
Ilias Apalodimas [Thu, 19 Jan 2023 14:29:15 +0000 (16:29 +0200)]
efi_loader: update the error message of TCG protocol installation

"Unable to find TPMv2 device" doesn't explain much with regards to the
error origin. Update it to match what we have in the RNG protocol
installation.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoefi_loader: ensure that file ubootefi.var is created
Heinrich Schuchardt [Thu, 19 Jan 2023 13:49:33 +0000 (14:49 +0100)]
efi_loader: ensure that file ubootefi.var is created

Currently file ubootefi.var is only created if the user sets a non-volatile
EFI variable. If the file is missing, a warning is written.

With the change PlatformLang is always persisted. So the file will exist on
second boot.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoefi_loader: Avoid overwriting previous outputs on console screen clearing
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>
23 months agoefi_loader: Set default console colors on efi_cout_clear_screen if needed
Jan Kiszka [Wed, 18 Jan 2023 21:25:00 +0000 (22:25 +0100)]
efi_loader: Set default console colors on efi_cout_clear_screen if needed

Ensures a consistent background color of the whole screen for succeeding
outputs as both demanded by the spec and implemented in EDK2 as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agodoc: fix references to distro documentation
Dario Binacchi [Mon, 9 Jan 2023 11:52:40 +0000 (12:52 +0100)]
doc: fix references to distro documentation

Commit 37c5195dfcd157 ("doc: Move distro boot doc to rST") renamed
doc/README.distro to doc/develop/distro.rst.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Soeren Moch <smoch@web.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
23 months agodoc: man-page for bdinfo
Heinrich Schuchardt [Sun, 15 Jan 2023 11:45:44 +0000 (12:45 +0100)]
doc: man-page for bdinfo

Provide a man-page for the bdinfo command

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agodoc: man-page for blkcache
Heinrich Schuchardt [Sun, 15 Jan 2023 10:35:55 +0000 (11:35 +0100)]
doc: man-page for blkcache

Provide a man-page for the blkcache command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agodoc: man-page for source command
Heinrich Schuchardt [Sat, 14 Jan 2023 19:15:15 +0000 (20:15 +0100)]
doc: man-page for source command

Provide a man-page for the source command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
23 months agofs/fat: avoid noisy message fat_read_file()
Heinrich Schuchardt [Thu, 19 Jan 2023 14:37:40 +0000 (15:37 +0100)]
fs/fat: avoid noisy message fat_read_file()

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>
23 months agoMerge tag 'tpm-20012023' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Fri, 20 Jan 2023 15:36:00 +0000 (10:36 -0500)]
Merge tag 'tpm-20012023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

TPM fixes and state reporting

23 months agotee: optee: fix uuid comparisons on service discovery
Ilias Apalodimas [Thu, 19 Jan 2023 09:21:37 +0000 (11:21 +0200)]
tee: optee: fix uuid comparisons on service discovery

When comparing UUIDs for discovered services we only compare up to the
ptr size instead of the entire UUID

Fixes: 94ccfb78a4d61 ("drivers: tee: optee: discover OP-TEE services")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
23 months agotpm2: ftpm: add the device in the OP-TEE services list
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 fe8a4ed0111073 ("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.

Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoMAINTAINERS: add a new entry on TEE MAINTAINERS
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

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agotee: optee: fix a print error on rng probing
Ilias Apalodimas [Wed, 18 Jan 2023 15:38:21 +0000 (17:38 +0200)]
tee: optee: fix a print error on rng probing

If we fail to probe the optee-rng device, we print a wrong message
referring to the firmware tpm.

Fixes: 476a3d58dfeb ("tee: optee: don't fail probe because of optee-rng")
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoMerge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm
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

23 months agoMerge branch '2022-01-18-assorted-updates'
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.

23 months agoodroid: limit boot memory to lowmem
Joost van Zwieten [Sat, 14 Jan 2023 23:57:30 +0000 (00:57 +0100)]
odroid: limit boot memory to lowmem

In commit 4963f63fe61f ("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>
23 months agoconfigs: enable poweroff command on QEMU ARM platforms
Heinrich Schuchardt [Fri, 13 Jan 2023 19:02:28 +0000 (20:02 +0100)]
configs: enable poweroff command on QEMU ARM platforms

Enable the sysreset based poweroff command. It invokes PSCI.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agovbe: Allow probing the VBE bootmeth to fail in OS fixup
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: a56f663f0707 ("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>
23 months agotest: compression: add zstd uncompression test
Brandon Maier [Thu, 12 Jan 2023 16:27:46 +0000 (10:27 -0600)]
test: compression: add zstd uncompression test

Signed-off-by: Brandon Maier <brandon.maier@collins.com>