platform/kernel/u-boot.git
3 years agoMerge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 31 Jan 2021 13:49:53 +0000 (08:49 -0500)]
Merge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

tpm fixes for coral
binman fixes support for symbols in sub-sections
support for additional cros_ec commands
various minor fixes / tweaks

3 years agodisk: part: sandbox support in dev_print()
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:15 +0000 (12:57 +0100)]
disk: part: sandbox support in dev_print()

Commands like 'fatinfo' call dev_print() to print device information. If
the block device is created via 'host bind', we should print accurate
information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agosandbox: fill block device meta information
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:14 +0000 (12:57 +0100)]
sandbox: fill block device meta information

Provide information about host backed block device.

Mark the device created by 'host bind' as removable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodm: replace auto_alloc_size with auto
Dario Binacchi [Sat, 23 Jan 2021 18:48:57 +0000 (19:48 +0100)]
dm: replace auto_alloc_size with auto

The auto_alloc_size members of struct driver has been renamed auto.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodo not pass NULL pointer to libfdt
Stanislav Pinchuk [Wed, 20 Jan 2021 18:52:23 +0000 (21:52 +0300)]
do not pass NULL pointer to libfdt

Re-send because of line-wraps.

Without this patch, u-boot just hangs if the fdt pointer is
not initialized. The diagnostic subsystems are not yet initialized,
so all you get is a blind hang.

Signed-off-by: Stanislav.Pinchuk@kaspersky.com
3 years agosandbox: keep time offset when resetting
Heinrich Schuchardt [Wed, 30 Dec 2020 17:07:48 +0000 (18:07 +0100)]
sandbox: keep time offset when resetting

The UEFI Self Certification Test (SCT) checks the SetTime() service with
the following steps:

* set date
* reset
* check date matches

To be compliant the sandbox should keep the offset to the host RTC during
resets. The implementation uses the environment variable
UBOOT_SB_TIME_OFFSET to persist the offset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Print a debug message when binman selects a node
Simon Glass [Thu, 21 Jan 2021 20:57:16 +0000 (13:57 -0700)]
binman: Print a debug message when binman selects a node

Add some debugging to indicate which node the binman library is looking
at.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoAdd a symlink for ctype.h
Simon Glass [Thu, 21 Jan 2021 20:57:15 +0000 (13:57 -0700)]
Add a symlink for ctype.h

Libraries that link with U-Boot typically may expect to be able to include
ctype.h but this file is in a different place in U-Boot. Add a symlink to
make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Update ofnode_read_fmap_entry() to read hashes
Simon Glass [Thu, 21 Jan 2021 20:57:14 +0000 (13:57 -0700)]
dm: core: Update ofnode_read_fmap_entry() to read hashes

At present this function uses the old format for reading hashes. Add
support for the current format.

Add a test while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a comment about pinctrl_select_state()
Simon Glass [Thu, 21 Jan 2021 20:57:13 +0000 (13:57 -0700)]
dm: core: Add a comment about pinctrl_select_state()

The use of pinctrl in the core of driver model is useful but can provoke
some strange behaviour. Add a comment to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: x86: Correct the driver name
Simon Glass [Thu, 21 Jan 2021 20:57:12 +0000 (13:57 -0700)]
clk: x86: Correct the driver name

The current driver name does not match its compatible string, so
of-platdata does not work correctly. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: Add debugging for return values
Simon Glass [Thu, 21 Jan 2021 20:57:11 +0000 (13:57 -0700)]
clk: Add debugging for return values

Use the log_msg_ret() mechanism to get error-return information when
clocks fail to probe, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Don't inline dev_read...() calls with of-platdata
Simon Glass [Thu, 21 Jan 2021 20:57:10 +0000 (13:57 -0700)]
dm: core: Don't inline dev_read...() calls with of-platdata

At present if these calls are used with of-platdata, a confusing error is
produced, referring to a function not actually called by the code causing
the problem.

Fix this by not inlining, so that the error mentions the dev_read_...()
function and it is more obvious what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Disable I2C emulators in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:09 +0000 (13:57 -0700)]
sandbox: Disable I2C emulators in SPL

These cannot work with of-platdata since they currently need the
devicetree at runtime. Disable the emulators and the sandbox I2C driver
that needs them. We can enable these later, if needed for testing.

Switch the of_plat_parent test over to use a simple bus instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: desigware: Add an alias for Intel Apollo Lake
Simon Glass [Thu, 21 Jan 2021 20:57:08 +0000 (13:57 -0700)]
i2c: desigware: Add an alias for Intel Apollo Lake

Add an alias so that this driver can be used in TPL on coral.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agox86: coral: Support TPM and RTC in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:07 +0000 (13:57 -0700)]
x86: coral: Support TPM and RTC in SPL

Update the devicetree so that the TPM and RTC can be used in SPL. Also
enable the pins used for getting the memory configuration settings while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Tidy up SPL/TPL malloc sizes
Simon Glass [Thu, 21 Jan 2021 20:57:06 +0000 (13:57 -0700)]
spl: Tidy up SPL/TPL malloc sizes

The current help talks about relocation which doesn't apply to SPL and
TPL. Update it to avoid confusion.

Also make the TPL size default to the same as the SPL size, since this is
more likely to be a useful value than the one used by U-Boot proper, which
may be quite a bit larger.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add vstore support
Simon Glass [Sat, 16 Jan 2021 21:52:31 +0000 (14:52 -0700)]
cros_ec: Add vstore support

The EC can store small amounts of data for the benefit of the
verified boot process. Since the EC is seldom reset, this can allow the
AP to store data that survives a reboot or a suspend/resume cycle.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Allow use with of-platdata
Simon Glass [Sat, 16 Jan 2021 21:52:30 +0000 (14:52 -0700)]
cros_ec: Allow use with of-platdata

Avoid reading the device tree when of-platdata is in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Show events in human-readable form
Simon Glass [Sat, 16 Jan 2021 21:52:29 +0000 (14:52 -0700)]
cros_ec: Show events in human-readable form

Add a command to show the current events as a list of names. This is
easier to decipher than a bit mask.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add support for switches
Simon Glass [Sat, 16 Jan 2021 21:52:28 +0000 (14:52 -0700)]
cros_ec: Add support for switches

On x86 platforms the EC provides a way to read 'switches', which are
on/off values determined by the EC.

Add a new driver method for this and implement it for LPC.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add documentation for cros_ec driver operations
Simon Glass [Sat, 16 Jan 2021 21:52:27 +0000 (14:52 -0700)]
cros_ec: Add documentation for cros_ec driver operations

Add comments to these methods so it is documented in this central place,
not just in each driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Support reading EC features
Simon Glass [Sat, 16 Jan 2021 21:52:26 +0000 (14:52 -0700)]
cros_ec: Support reading EC features

The EC can support a variety of features and provides a way to find out
what is available. Add support for this.

Also update the feature list to the lastest available while we are here.
This is at:

   https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/include/ec_commands.h

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add support for reading the SKU ID
Simon Glass [Sat, 16 Jan 2021 21:52:25 +0000 (14:52 -0700)]
cros_ec: Add support for reading the SKU ID

This allows reading strapping pins attached to the EC. Add an
implementation for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add run-time check for input buffer overflow
Simon Glass [Sat, 16 Jan 2021 21:52:24 +0000 (14:52 -0700)]
cros_ec: Add run-time check for input buffer overflow

This should not happen in normal operation, but the EC might have a bug,
so add a run-time check just in case.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Tidy up a few delays
Simon Glass [Sat, 16 Jan 2021 21:52:23 +0000 (14:52 -0700)]
cros_ec: Tidy up a few delays

Allow a longer time for the EC to reboot. Also use a constant for the
hash delay time, so it is clear what it is for.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add a function for the hello message
Simon Glass [Sat, 16 Jan 2021 21:52:22 +0000 (14:52 -0700)]
cros_ec: Add a function for the hello message

This is used several times in this file. Put it in a function to avoid
code duplication.

Also add a test for this function. There are no cros_ec tests at present,
so it is time to update the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc/sandbox: improve formatting of command line options
Heinrich Schuchardt [Wed, 30 Dec 2020 17:10:24 +0000 (18:10 +0100)]
doc/sandbox: improve formatting of command line options

Show the command line options in bold.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: fix sandbox_cmdline_cb_test_fdt()
Heinrich Schuchardt [Fri, 25 Dec 2020 15:04:26 +0000 (16:04 +0100)]
sandbox: fix sandbox_cmdline_cb_test_fdt()

fmt does not foresee any parameter.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: typo segement
Heinrich Schuchardt [Tue, 22 Dec 2020 06:53:03 +0000 (07:53 +0100)]
x86: typo segement

%s/segement/segment/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agobinman: Allow for skip_at_start when reading entries
Simon Glass [Thu, 7 Jan 2021 04:35:19 +0000 (21:35 -0700)]
binman: Allow for skip_at_start when reading entries

The offset of an entry needs to be adjusted by its skip-at-start value.
This is currently missing when reading entry data. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support alignment of files
Simon Glass [Thu, 7 Jan 2021 04:35:18 +0000 (21:35 -0700)]
binman: Support alignment of files

When packing files it is sometimes useful to align the start of each file,
e.g. if the flash driver can only access 32-bit-aligned data. Provides a
new property to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Allow vblock to include devicetree blobs
Simon Glass [Thu, 7 Jan 2021 04:35:17 +0000 (21:35 -0700)]
binman: Allow vblock to include devicetree blobs

At present if a devicetree blob is included in a vblock it does not deal
with updates. This is because the vblock is created once at the start and
does not have a method to update itself later, after all the entry
contents are finalised.

Fix this by adjusting how the vblock is created.

Also simplify Image.ProcessEntryContents() since it effectively duplicates
the code in Section.ProcessContents().

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support reading an image with entry args
Simon Glass [Thu, 7 Jan 2021 04:35:16 +0000 (21:35 -0700)]
binman: Support reading an image with entry args

Normally when an entry is created, any entry arguments it has are required
to be provided, so it can actually generate its contents correctly.

However when an existing image is read, Entry objects are created for each
of the entries in the image. This happens as part of the process of
reading the image into binman.

In this case we don't need the entry arguments, since we do not intend to
regenerate the entries, or at least not unless requested. So there is no
sense in reporting an error for missing entry arguments.

Add a new property for the Image to handle this case. Update the error
reporting to be conditional on this property.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support finding symbols in sub-sections
Simon Glass [Thu, 7 Jan 2021 04:35:15 +0000 (21:35 -0700)]
binman: Support finding symbols in sub-sections

At present binman only supports resolving symbols in the same section as
the binary that uses it. This is quite limited because we often need to
group entries into different sections.

Enhance the algorithm to search the entire image for symbols.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Fix a few file comments
Simon Glass [Thu, 7 Jan 2021 04:35:14 +0000 (21:35 -0700)]
binman: Fix a few file comments

Two files have the wrong comment at the top of them. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Show the size when writing entries
Simon Glass [Thu, 7 Jan 2021 04:35:13 +0000 (21:35 -0700)]
binman: Show the size when writing entries

Update the log output to show the size, since this is useful information.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Update the TODO list
Simon Glass [Thu, 7 Jan 2021 04:35:12 +0000 (21:35 -0700)]
binman: Update the TODO list

Two of the items have been completed and I thought of another one. Update
the list.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Correct lz4 compression parameters
Simon Glass [Thu, 7 Jan 2021 04:35:11 +0000 (21:35 -0700)]
patman: Correct lz4 compression parameters

At present on large files, lz4 uses a larger block size (e.g. 256KB) than
the 64KB supported by the U-Boot decompression implementation. Also it is
optimised for maximum compression speed, producing larger output than we
would like.

Update the parameters to correct these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: binman: Drop Python 2 code
Simon Glass [Thu, 7 Jan 2021 04:35:10 +0000 (21:35 -0700)]
dtoc: binman: Drop Python 2 code

Drop a few more Python 2 relics that are no-longer needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Enable CONFIG_BOOTARGS_SUBST
Simon Glass [Thu, 31 Dec 2020 16:52:16 +0000 (09:52 -0700)]
x86: coral: Enable CONFIG_BOOTARGS_SUBST

Enable this option so that the boot-script substitutions of %U works as
expected. With this, it can boot into Chrome OS.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Update an unused pin to reduce power
Simon Glass [Thu, 31 Dec 2020 16:52:15 +0000 (09:52 -0700)]
x86: coral: Update an unused pin to reduce power

GPIO_25 is not used on coral, so set it up in deep sleep.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: cr50: Rename driver to work with of-platdata
Simon Glass [Thu, 31 Dec 2020 16:52:14 +0000 (09:52 -0700)]
tpm: cr50: Rename driver to work with of-platdata

Update the driver name to match the compatible string, so it can work
with of-platdata.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: cr50: Add a better description and more debug
Simon Glass [Thu, 31 Dec 2020 16:52:13 +0000 (09:52 -0700)]
tpm: cr50: Add a better description and more debug

Update the TPM description to include the interrupt mechanicm since this
is useful to know. Also add a warning if the TPM cannot be found and a
debug line if it succeeds.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: cr50: Check for valid locality
Simon Glass [Thu, 31 Dec 2020 16:52:12 +0000 (09:52 -0700)]
tpm: cr50: Check for valid locality

When the Cr50 starts up it doesn't have a valid locality. The driver sets
it to -1 to indicate that. Tracking this allows cr50_i2c_cleanup() to
avoid releasing a locality that was not claimed.

However the helper functions that generate the flags use a u8 type which
cannot support -1, so they return a locality of 0xff.

Fix this by updating the type. With this, 'tpm startup TPM2_SU_CLEAR'
works as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'efi-2021-04-rc1-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 30 Jan 2021 19:49:17 +0000 (14:49 -0500)]
Merge tag 'efi-2021-04-rc1-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-4

Bug fixes:

* re-read the partition table after writing GPT
* fix a problem booting ARMv7 boards with PSCI without UEFI
* make aarch64 UEFI test programs compatible with GRUB linux command
* correct the alignment check in the EFI_BLOCK_IO_PROTOCOL
* check EFI_BLOCK_IO_PROTOCOL.Media->LastBlock in unit test

3 years agoefi_loader: add Linux magic to aarch64 crt0
Heinrich Schuchardt [Fri, 29 Jan 2021 11:35:51 +0000 (12:35 +0100)]
efi_loader: add Linux magic to aarch64 crt0

Add the Linux magic to the EFI file header to allow running our test
programs with GRUB's linux command. Now we can dump the fixed-up device
tree with our dtbdump.efi tool.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotools: add mkeficapsule to .gitignore
Heinrich Schuchardt [Thu, 28 Jan 2021 21:46:13 +0000 (22:46 +0100)]
tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodisk: part_efi: update partition table entries after write
Gary Bisson [Tue, 26 Jan 2021 13:56:23 +0000 (14:56 +0100)]
disk: part_efi: update partition table entries after write

Fixes fastboot issues when switching from mbr to gpt partition tables.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: switch to non-secure mode later
Heinrich Schuchardt [Sun, 24 Jan 2021 14:34:12 +0000 (14:34 +0000)]
efi_loader: switch to non-secure mode later

Some ARMv7 boards using PSCI require to be in secure-mode when booted via
'bootz' or 'bootm'. During distro-boot 'bootefi bootmgr' is called to check
if booting via UEFI is possible.

With the change we change the switch from secure mode to non-secure mode is
moved from the UEFI subsystem setup to just before calling StartImage().

Cc: Jernej Škrabec <jernej.skrabec@gmail.com>
Reported by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: correct block IO alignment check
Heinrich Schuchardt [Sat, 23 Jan 2021 18:33:11 +0000 (19:33 +0100)]
efi_loader: correct block IO alignment check

If the field Media->IoAlign of the EFI block IO protocol is zero, no
alignment is required. Our code required 4 GiB alignment in this case.

Don't check buffer alignment if Media->IoAlign == 0.

Fixes: f59f0825e8b9 ("efi_loader: parameter checks BLOCK_IO_PROTOCOL")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: test EFI_BLOCK_IO_PROTOCOL.Media->LastBlock
Heinrich Schuchardt [Sat, 23 Jan 2021 18:08:04 +0000 (19:08 +0100)]
efi_selftest: test EFI_BLOCK_IO_PROTOCOL.Media->LastBlock

The field Media->LastBlock of the EFI_BLOCK_IO_PROTOCOL must be filled
with the index of the last logical block (LBA) for the block device that
our test driver provides.

After calling ConnectController() U-Boot exposes the block IO protocol for
the partition check that the value of Media->LastBlock equals the partition
size minus one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 29 Jan 2021 18:56:04 +0000 (13:56 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-29-assorted-fixes'
Tom Rini [Fri, 29 Jan 2021 18:50:06 +0000 (13:50 -0500)]
Merge branch '2021-01-29-assorted-fixes'

- Assorted test fixes
- Assorted minor FAT fixes
- Assorted Kconfig dependency fixes
- MediaTek, vexpress_aemv8a improvements
- Other assorted minor fixes

3 years agocmd: add more implementation IDs to sbi command
Heinrich Schuchardt [Tue, 19 Jan 2021 19:44:45 +0000 (19:44 +0000)]
cmd: add more implementation IDs to sbi command

Additional SBI implementation IDs have been added to the upcoming
next version of the SBI specification.

https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotest: inconsistent string tests
Heinrich Schuchardt [Sun, 17 Jan 2021 23:17:34 +0000 (00:17 +0100)]
test: inconsistent string tests

Excluding ut str in test/cmd_ut.c but compiling test/str_ut.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_str_upper]

Allow to compile test/str_ut.c on all boards.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: inconsistent bootm tests
Heinrich Schuchardt [Sun, 17 Jan 2021 23:17:33 +0000 (00:17 +0100)]
test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: cosmetic: remove unnecessary space
Patrick Delaunay [Mon, 4 Jan 2021 13:41:31 +0000 (14:41 +0100)]
env: sf: cosmetic: remove unnecessary space

Remove the unnecessary space before the 2 "done:" labels
in env_sf_save().

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agotest: Update test_fs to not use deprecated pytest.yield_fixture()
Tom Rini [Thu, 28 Jan 2021 19:39:56 +0000 (14:39 -0500)]
test: Update test_fs to not use deprecated pytest.yield_fixture()

As noted in comments, yield_fixture has been deprecated for longer than
our minimum required version of pytest.  Newer versions of pytest cause
this to be a louder warning, and as the migration is trivial, perform it
now.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agotest: correct entry point to pytest
Heinrich Schuchardt [Thu, 28 Jan 2021 11:46:11 +0000 (12:46 +0100)]
test: correct entry point to pytest

With Pytest 6.0.2 'make tests' fails:

sandbox: Traceback (most recent call last):
  File "./test/py/test.py", line 20, in <module>
    sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args))
TypeError: console_main() takes 0 positional arguments but 1 was given

The definition of console_scripts has changed as follows:

Pytest 4.6.1:

[options.entry_points]
console_scripts =
        pytest=pytest:main
        py.test=pytest:main
        
Pytest 6.0.2:
        
[options.entry_points]
console_scripts =
    pytest=pytest:console_main
    py.test=pytest:console_main

The new function console_main() has a comment:
"This function is not meant for programmable use; use `main()`"

Hence let's call pytest.main() directly.
Move args processing into the __main__ paragraph.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Tom Rini <trini@konsulko.com>
3 years agotest: pr_cont_test.o depends on CONFIG_LOG=y
Heinrich Schuchardt [Wed, 27 Jan 2021 11:09:46 +0000 (12:09 +0100)]
test: pr_cont_test.o depends on CONFIG_LOG=y

Compiling wandboard_defconfig with CONFIG_UT_LOG=y leads to a build error:

test/log/pr_cont_test.c: In function ‘log_test_pr_cont’:
test/log/pr_cont_test.c:28:14: error:
‘gd_t’ {aka ‘volatile struct global_data’} has no member named ‘log_fmt’
  log_fmt = gd->log_fmt;

We do not want to let CONFIG_UT_LOG depend on CONFIG_LOG=y because we have
tests for logging functions called with CONFIG_LOG=n.

Fix the build dependency.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: btrfs: Select SHA256 in Kconfig
Matthias Brugger [Wed, 27 Jan 2021 09:42:30 +0000 (10:42 +0100)]
fs: btrfs: Select SHA256 in Kconfig

Since commit 565a4147d17a ("fs: btrfs: Add more checksum algorithms")
btrfs uses the sha256 checksum algorithm. But Kconfig lacks to select
it. This leads to compilation errors:
fs/built-in.o: In function `hash_sha256':
fs/btrfs/crypto/hash.c:25: undefined reference to `sha256_starts'
fs/btrfs/crypto/hash.c:26: undefined reference to `sha256_update'
fs/btrfs/crypto/hash.c:27: undefined reference to `sha256_finish'

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
3 years agofs: fat: remove superfluous assignments
Heinrich Schuchardt [Mon, 25 Jan 2021 23:14:14 +0000 (00:14 +0100)]
fs: fat: remove superfluous assignments

Do not assign a value to a variable if it is not used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: avoid out of bounds access warning
Heinrich Schuchardt [Mon, 25 Jan 2021 23:04:19 +0000 (00:04 +0100)]
fs: fat: avoid out of bounds access warning

When copying short name plus extension refer to the encapsulating structure
and not to the short name element.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoavb: AVB_VERIFY depends on MMC
Heinrich Schuchardt [Mon, 25 Jan 2021 11:17:57 +0000 (12:17 +0100)]
avb: AVB_VERIFY depends on MMC

AVB Verified Boot uses functions related to MMC.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
3 years agovexpress_aemv8a: allow overriding BOOTCOMMAND
Stanislav Pinchuk [Wed, 20 Jan 2021 18:54:53 +0000 (21:54 +0300)]
vexpress_aemv8a: allow overriding BOOTCOMMAND

Re-send because of line-wraps.

This patch fixes the behaviour of the menuconfig's BOOTCOMMAND
setting. Which is just ignored without that patch on
vexpress_aemv8a platform.

Signed-off-by: Stanislav.Pinchuk@kaspersky.com
3 years agoarm: dts: enable MTK SPI NOR controller driver
SkyLake.Huang [Wed, 20 Jan 2021 07:31:34 +0000 (15:31 +0800)]
arm: dts: enable MTK SPI NOR controller driver

1. Enable MTK SPI NOR controller driver on mt7622 & mt7629.
2. Enable quad mode for read and single mode for write.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
3 years agospi: mtk_snor: add support for MTK SPI NOR controller
SkyLake.Huang [Wed, 20 Jan 2021 07:31:33 +0000 (15:31 +0800)]
spi: mtk_snor: add support for MTK SPI NOR controller

This patch adds support for MTK SPI NOR controller, which you
can see on mt7622 & mt7629.

1. This controller is designed only for SPI NOR. We can't adjust
its bus clock dynamically. Set clock in dts instead.
2. This controller only supports 1-1-1 write mode.
3. Remove mtk_snor_match_read() since upper SPI-MEM layer already
handles command.
4. sf read/write/update commands are tested with this driver.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
3 years agotest: test_ofplatdata: Mark as sandbox specific
Tom Rini [Tue, 19 Jan 2021 19:40:10 +0000 (14:40 -0500)]
test: test_ofplatdata: Mark as sandbox specific

This test checks for output specific to the sandbox device tree, mark it
as sandbox specific.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-27-assorted-fixes-and-improvements'
Tom Rini [Thu, 28 Jan 2021 16:37:58 +0000 (11:37 -0500)]
Merge branch '2021-01-27-assorted-fixes-and-improvements'

- A wide variety of fixes throughout the tree.

3 years agocmd: misc: Fix return value for the sleep command
Marek Szyprowski [Fri, 22 Jan 2021 11:27:31 +0000 (12:27 +0100)]
cmd: misc: Fix return value for the sleep command

If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1
(CMD_RET_USAGE).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodoc: device-tree-bindings: rtc: Abracon AB x80x i2c rtc
Ying-Chun Liu (PaulLiu) [Fri, 15 Jan 2021 05:53:03 +0000 (13:53 +0800)]
doc: device-tree-bindings: rtc: Abracon AB x80x i2c rtc

Document the bindings for abracon,abx80x and related compatibles.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
3 years agortc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc
Ying-Chun Liu (PaulLiu) [Fri, 15 Jan 2021 05:53:02 +0000 (13:53 +0800)]
rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc

This is a basic driver for the ultra-low-power Abracon AB x80x series
of RTC chips. It supports in particular, the supersets AB0805 and AB1805.
It allows reading and writing the time, and enables the supercapacitor or
battery charger.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
3 years agoautoboot: fix illegal memory access when stop key and delay key are empty
Yuezhang.Mo@sony.com [Fri, 15 Jan 2021 03:11:49 +0000 (03:11 +0000)]
autoboot: fix illegal memory access when stop key and delay key are empty

If both stop key and delay key are empty, the length of these
keys is 0. The subtraction operation will cause the u_int type
variable to overflow, will cause illegal memory access in key
input loop.

This commit fixes this bug by using int type instead of u_init.
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agobinman: Allow reading entries from a subnode
Simon Glass [Thu, 14 Jan 2021 03:29:57 +0000 (20:29 -0700)]
binman: Allow reading entries from a subnode

Some images may have multiple copies of the same thing, e.g. two versions
of the read/write U-Boots. It is necessary to read data from one or other
of these under selection of the verified-boot logic. Add a function to
select the subnode to use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Move selection of the binman node into a function
Simon Glass [Thu, 14 Jan 2021 03:29:56 +0000 (20:29 -0700)]
binman: Move selection of the binman node into a function

Move this logic out of the main init function so it is available for
other purpose.

Use a different error when multiple-images is in use but no subnode is
available. This makes it easier to determine what is wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocrc32: Exclude crc32 from TPL
Simon Glass [Thu, 14 Jan 2021 03:29:55 +0000 (20:29 -0700)]
crc32: Exclude crc32 from TPL

Unfortunately the toolchain often brings in the crc32 table even if the
function is not actually used. For now, exclude it from the TPL build,
which is very sensitive to size.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agommc: pci_mmc: Set the removable flag
Simon Glass [Thu, 14 Jan 2021 03:29:54 +0000 (20:29 -0700)]
mmc: pci_mmc: Set the removable flag

Set this flag so that it is available to those looking at the device. For
non-removable devices there is no need to check for insertion/removable
since the media can never change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: pci_mmc: Only generate ACPI code for the SD card
Simon Glass [Thu, 14 Jan 2021 03:29:52 +0000 (20:29 -0700)]
mmc: pci_mmc: Only generate ACPI code for the SD card

At present if an eMMC part is in the system, the ACPI table generated
will include information about that, as well as the SD card. We only need
to include the SD card, since it has a card-detect GPIO. Use a different
compatible string for each option, and add code only for the SD card.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agouuid: Add a comment for UUID_STR_LEN
Simon Glass [Thu, 14 Jan 2021 03:29:51 +0000 (20:29 -0700)]
uuid: Add a comment for UUID_STR_LEN

This macro is the length of the string but excludes the terminator. Users
must add 1 when declaring a large-enough string. Add a comment to make
this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodisplay_options: Use USE_TINY_PRINTF for SPL check
Simon Glass [Thu, 14 Jan 2021 03:29:50 +0000 (20:29 -0700)]
display_options: Use USE_TINY_PRINTF for SPL check

At present this code uses a simple printf() format if running in SPL. But
SPL can use the full printf. Use USE_TINY_PRINTF instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup()
Simon Glass [Thu, 14 Jan 2021 03:29:49 +0000 (20:29 -0700)]
fdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup()

This setting may be different in SPL and TPL. Update the code to check
the correct setting.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdtdec: Update the missing-devicetree message
Simon Glass [Thu, 14 Jan 2021 03:29:48 +0000 (20:29 -0700)]
fdtdec: Update the missing-devicetree message

This includes information about sandbox which is not relevant for most
boards. Drop it.

Also add the address to help figure out the problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agonet: Use CONFIG_IS_ENABLED() in eth_dev_get_mac_address()
Simon Glass [Thu, 14 Jan 2021 03:29:47 +0000 (20:29 -0700)]
net: Use CONFIG_IS_ENABLED() in eth_dev_get_mac_address()

This function may be used in SPL where devicetree is not available.
Use the correct macro so that the function does not try to read it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agovideo: Allow syncing the entire framebuffer to the copy
Simon Glass [Thu, 14 Jan 2021 03:29:46 +0000 (20:29 -0700)]
video: Allow syncing the entire framebuffer to the copy

In some cases so much of the framebuffer is updated that it is not worth
copying the changes piece by piece to the copy framebuffer. Add a function
to copy the whole thing.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobloblist: Add missing tag names
Simon Glass [Thu, 14 Jan 2021 03:29:44 +0000 (20:29 -0700)]
bloblist: Add missing tag names

Add tag names for recently added types.

Fixes: d2cb7a22da0 (x86: Allow putting some tables in the bloblist)
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobloblist: Support relocating to a larger space
Simon Glass [Thu, 14 Jan 2021 03:29:43 +0000 (20:29 -0700)]
bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Add functions for next and previous phase
Simon Glass [Thu, 14 Jan 2021 03:29:42 +0000 (20:29 -0700)]
spl: Add functions for next and previous phase

It is useful to be able to figure out which phase we are loading next and
which phase we came from. Add some functions to handle this as well as
returning the name of a phase. This allows messages like "Booting to x"
where x is the next phase.

At present, TPL says 'Jumping to U-Boot' at the end, when in fact it is
jumping to SPL. This is confusing, so use the new functions to correct
this.

Tests for this will come with an upcoming minor SPL test refactor.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agolib: rsa: rsa-verify: don't look for keys in the FIT image
Philippe Reynes [Tue, 12 Jan 2021 18:18:54 +0000 (19:18 +0100)]
lib: rsa: rsa-verify: don't look for keys in the FIT image

In the function rsa_verify_hash, if the "main" key doesn't
work, u-boot try others keys. But it searches those keys
in the FIT image instead of the u-boot device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopci: Remove CONFIG_PCI_ENUM_ONLY as it's not used (any more)
Stefan Roese [Tue, 12 Jan 2021 11:03:43 +0000 (12:03 +0100)]
pci: Remove CONFIG_PCI_ENUM_ONLY as it's not used (any more)

This patch completely removes CONFIG_PCI_ENUM_ONLY from the PCI code as
it is not configured for any board (any more). With this removal, some
PCI related files get cleaned up a bit.

Additional, dm_pciauto_setup_device() is now static, as it's not
referenced from any code outside of this C file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: fit-sig: Fix error message in fit_config_verify_sig()
Alexandru Gagniuc [Mon, 11 Jan 2021 14:46:58 +0000 (08:46 -0600)]
common: fit-sig: Fix error message in fit_config_verify_sig()

In fit_config_verify_sig(), when no 'signature*' subnode exists in
the configuration node, the fdt_for_each_subnode() loop is a no-op.
Therefore, no error flags are set, and 'err_,sg' is not populated
with an error string. This is incorrect behavior.

Populate err_msg to indicate that no 'signature' is found, before
entering the loop. The first call to fit_image_verify_sig() will
override clear err_msg, or set it to a more specific message.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosmccc: fix sign bit expansion
Volodymyr Babchuk [Tue, 5 Jan 2021 20:03:11 +0000 (20:03 +0000)]
smccc: fix sign bit expansion

Signed ARM_SMCCC_FAST_CALL value is shifted to 31'st bit. Then, it is expanded
to 64 bit value, which results in 1s in higher 32 bits.

This causes corrupted values in 64-bit SMC IDs and issues in buggy handlers of
32-bit calls.

We need to make ARM_SMCCC_FAST_CALL unsigned long, so it would work properly
on 32 bit architectures.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
3 years agobootcount: allow to use this feature on TPL
Philippe Reynes [Fri, 11 Dec 2020 18:56:47 +0000 (19:56 +0100)]
bootcount: allow to use this feature on TPL

This commit add an option TPL_BOOTCOUNT_LIMIT to
use bootcount on TPL.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Do not call useless command 'true'
Pali Rohár [Wed, 4 Nov 2020 14:33:44 +0000 (15:33 +0100)]
Makefile: Do not call useless command 'true'

Macro 'cmd_objcopy_uboot' currently does not work with passed empty command
expanded from 'cmd_static_rela' and therefore dummy command 'true' is set
in 'cmd_static_rela' to workaround this issue.

Eliminate it now by fixing 'cmd_objcopy_uboot' macro to work also with
empty 'cmd_static_rela' macro and remove useless invocation of command
'true'.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Wed, 27 Jan 2021 16:39:31 +0000 (11:39 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- Espressobin: Disable slot when emmc is not present (Pali)
- DS414; config header cleanup (Phil)
- PCI: auto-config enhancement (Phil)
- pci_mvebu: Also map IO region (Phil)
- serial: a3720: Implement pending method for output direction (Pali)
- turris_mox: Enable a few commands (Marek)
- helios4 & ClearFog changes (Dennis)
- Plus some minor misc changes

3 years agoMerge tag 'doc-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 27 Jan 2021 16:32:23 +0000 (11:32 -0500)]
Merge tag 'doc-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for documentation tag doc-2021-04-rc1-3

Update the build system for the HTML documentation to allow using
Sphinx 3.

Man-page for exception command.

3 years agoMerge branch '2021-01-27-assorted-net-updates'
Tom Rini [Wed, 27 Jan 2021 16:30:31 +0000 (11:30 -0500)]
Merge branch '2021-01-27-assorted-net-updates'

- e1000 fixes for MIPS
- netconsole and ping fix
- cortina_ni driver
- micrel PHY fix
- Add fdtoverlays keyword to extlinux file parsing

3 years agocmd: pxe: add support for FDT overlays
Neil Armstrong [Wed, 20 Jan 2021 08:54:53 +0000 (09:54 +0100)]
cmd: pxe: add support for FDT overlays

This adds support for specifying FDT overlays in an extlinux/pxelinux
configuration file.

Without this, there is no simple way to apply overlays when the kernel
and fdt is loaded by the pxe command.

This change adds the 'fdtoverlays' keyword for a label, supporting multiple
overlay files to be applied on top of the fdt specified in the 'fdt' or
'devicetree' keyword.

Example:
  label linux
    kernel /Image
    fdt /soc-board.dtb
    fdtoverlays /soc-board-function.dtbo
    append console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait

This code makes usage of a new variable called fdtoverlay_addr_r used to load
the overlay files without overwritting anything important.

Cc: Tom Rini <trini@konsulko.com>
Cc: Andre Heider <a.heider@gmail.com>
Cc: Jernej Škrabec <jernej.skrabec@siol.net>
Cc: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Jernej Škrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Škrabec <jernej.skrabec@siol.net>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agonet: phy: micrel: Try default PHY ofnode first
Marek Vasut [Sat, 16 Jan 2021 23:16:16 +0000 (00:16 +0100)]
net: phy: micrel: Try default PHY ofnode first

The phydev structure has a PHY OF node pointer in it, use that OF node
first when looking up PHY OF node properties, since that is likely the
correct PHY OF node pointer. If the pointer is not valid, which is the
case e.g. on legacy DTs, fall back to parsing MAC ethernet-phy subnode.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agoboard: presidio-asic: Add CAxxxx Ethernet support
Alex Nemirovsky [Thu, 14 Jan 2021 21:34:13 +0000 (13:34 -0800)]
board: presidio-asic: Add CAxxxx Ethernet support

Add CAxxxx Ethernet support for the Cortina Access
Presidio Engineering Board

Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
CC: Tom Rini <trini@konsulko.com>